修改dealwithmapping获取字段数据bug

main
youHong.ai 2023-02-12 22:17:44 +08:00
parent dfc89e7d21
commit 9dacdd2751
12 changed files with 5455 additions and 5045 deletions

View File

@ -297,4 +297,25 @@ $(() => {
}) })
}) })
/* ******************* apa(employee)流程明细分数控制end ******************* */ /* ******************* apa(employee)流程明细分数控制end ******************* */
const workflowInsertValueConfig = [
{
table: '',
targetTable: '',
filedMapping: [{
source: '',
target: ''
}]
}, {
table: '',
targetTable: '',
filedMapping: []
}
]
/* ******************* 流程明细数据整合插入start ******************* */
/* ******************* 流程明细数据整合插入end ******************* */

File diff suppressed because it is too large Load Diff

View File

@ -4,8 +4,13 @@ import aiyh.utils.ApiResult;
import aiyh.utils.Util; import aiyh.utils.Util;
import com.api.youhong.ai.pcn.workflow.doworkflowtomodel.service.ApaLevelByScoreService; import com.api.youhong.ai.pcn.workflow.doworkflowtomodel.service.ApaLevelByScoreService;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
/** /**
@ -18,21 +23,36 @@ import javax.ws.rs.core.MediaType;
@Path("ayh/workflow/apa") @Path("ayh/workflow/apa")
public class ApaLevelByScoreController { public class ApaLevelByScoreController {
private final Logger log = Util.getLogger(); private final Logger log = Util.getLogger();
private final ApaLevelByScoreService service = new ApaLevelByScoreService(); private final ApaLevelByScoreService service = new ApaLevelByScoreService();
@Path("/level") @Path("/level")
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public String getLevelByScore(@QueryParam("score") Double score) { public String getLevelByScore(@QueryParam("score") Double score) {
try { try {
Integer level = service.getLevelByScore(score); Integer level = service.getLevelByScore(score);
return ApiResult.success(level); return ApiResult.success(level);
} catch (Exception e) { } catch (Exception e) {
log.error("get level error \n" + Util.getErrString(e)); log.error("get level error \n" + Util.getErrString(e));
return ApiResult.error("get level error " + e.getMessage()); return ApiResult.error("get level error " + e.getMessage());
} }
} }
@GET
@Path("/get-data-id")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public String getApaLastDateId(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
try {
return ApiResult.success(service.getApaLastDateId(user));
} catch (Exception e) {
log.error("get apa workflow param(mode id) error ! \n" + Util.getErrString(e));
return ApiResult.error(e.getMessage());
}
}
} }

View File

@ -1,5 +1,6 @@
package com.api.youhong.ai.pcn.workflow.doworkflowtomodel.mapper; package com.api.youhong.ai.pcn.workflow.doworkflowtomodel.mapper;
import aiyh.utils.annotation.recordset.ParamMapper;
import aiyh.utils.annotation.recordset.Select; import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper; import aiyh.utils.annotation.recordset.SqlMapper;
@ -13,16 +14,22 @@ import aiyh.utils.annotation.recordset.SqlMapper;
@SqlMapper @SqlMapper
public interface ApaLevelByScoreMapper { public interface ApaLevelByScoreMapper {
/** /**
* <h2>apa</h2> * <h2>apa</h2>
* <i>2022/12/13 10:47</i> * <i>2022/12/13 10:47</i>
* ************************************************************ * ************************************************************
* *
* @param score * @param score
* @return Integer * @return Integer
* @author youHong.ai ****************************************** * @author youHong.ai ******************************************
*/ */
@Select("select level1 from uf_APAlevel where #{score} between zdf and zgf") @Select("select level1 from uf_APAlevel where #{score} between zdf and zgf")
Integer selectLevelByScore(Double score); Integer selectLevelByScore(Double score);
@Select("select id from $t{tableName} where $t{userField} = #{uId}")
Integer selectLevelByUserId(@ParamMapper("uId") int uid,
@ParamMapper("tableName") String tableName,
@ParamMapper("userField") String userField);
} }

View File

@ -2,7 +2,9 @@ package com.api.youhong.ai.pcn.workflow.doworkflowtomodel.service;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException; import aiyh.utils.excention.CustomerException;
import cn.hutool.core.lang.Assert;
import com.api.youhong.ai.pcn.workflow.doworkflowtomodel.mapper.ApaLevelByScoreMapper; import com.api.youhong.ai.pcn.workflow.doworkflowtomodel.mapper.ApaLevelByScoreMapper;
import weaver.hrm.User;
/** /**
* <h1></h1> * <h1></h1>
@ -13,22 +15,30 @@ import com.api.youhong.ai.pcn.workflow.doworkflowtomodel.mapper.ApaLevelByScoreM
*/ */
public class ApaLevelByScoreService { public class ApaLevelByScoreService {
private final ApaLevelByScoreMapper mapper = Util.getMapper(ApaLevelByScoreMapper.class); private final ApaLevelByScoreMapper mapper = Util.getMapper(ApaLevelByScoreMapper.class);
/** /**
* <h2></h2> * <h2></h2>
* <i>2022/12/13 10:55</i> * <i>2022/12/13 10:55</i>
* ************************************************************ * ************************************************************
* *
* @param score * @param score
* @return Integer * @return Integer
* @author youHong.ai ****************************************** * @author youHong.ai ******************************************
*/ */
public Integer getLevelByScore(Double score) { public Integer getLevelByScore(Double score) {
Integer level = mapper.selectLevelByScore(score); Integer level = mapper.selectLevelByScore(score);
if (level < -1) { if (level < -1) {
throw new CustomerException("query level error, score is [" + score + ""); throw new CustomerException("query level error, score is [" + score + "");
} }
return level; return level;
} }
public Integer getApaLastDateId(User user) {
String apaLastIdTableName = Util.getCusConfigValue("APA_LAST_ID_TABLE_NAME");
String apaLastIdUserField = Util.getCusConfigValue("APA_LAST_ID_USER_FIELD");
Assert.notBlank(apaLastIdTableName, "can not get config [APA_LAST_ID_TABLE_NAME] from uf_cus_dev_config!");
Assert.notBlank(apaLastIdUserField, "can not get config [APA_LAST_ID_USER_FIELD] from uf_cus_dev_config!");
return mapper.selectLevelByUserId(user.getUID(), apaLastIdTableName, apaLastIdUserField);
}
} }

View File

@ -0,0 +1,57 @@
package com.api.youhong.ai.zhishichanquan.ssocaiwu.controller;
import aiyh.utils.Util;
import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSON;
import com.api.youhong.ai.zhishichanquan.ssocaiwu.util.AES;
import com.sun.jersey.api.view.Viewable;
import org.apache.log4j.Logger;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
/**
* <h1></h1>
*
* <p>create: 2023/2/8 17:10</p>
*
* @author youHong.ai
*/
@Path("/aiyh/sso/caiwu/")
public class SingleSignOnController {
private final Logger log = Util.getLogger();
@Path("/send-redirect")
@GET
public Viewable ssoSendRedirect(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
String url = Util.getCusConfigValue("FinancialAffairsURL");
String key = Util.getCusConfigValue("FinancialAffairsKey");
String initVector = Util.getCusConfigValue("FinancialAffairsInitVector");
Assert.notBlank(url, "sendRedirect url is null, check config [FinancialAffairsURL] on uf_cus_dev_config table!");
Assert.notBlank(key, "sendRedirect AES encrypt key is null, check config [FinancialAffairsKey] on uf_cus_dev_config table!");
Assert.notBlank(initVector, "sendRedirect AES encrypt initVector is null, check config [FinancialAffairsInitVector] on uf_cus_dev_config table!");
User user = HrmUserVarify.getUser(request, response);
String userCodeMethod = Util.getCusConfigValueNullOrEmpty("FinancialAffairsUserCodeMethod", "getLoginid");
Method method = User.class.getMethod(userCodeMethod);
Object value = method.invoke(user);
Map<String, Object> param = new HashMap<>(8);
param.put("user", value);
param.put("ts", System.currentTimeMillis());
String encrypt = AES.encrypt(key, initVector, JSON.toJSONString(param));
response.sendRedirect(url + "?params=" + encrypt);
} catch (Exception e) {
log.error("单点登录路径处理失败!" + e.getMessage() + "\n" + Util.getErrString(e));
}
return null;
}
}

View File

@ -0,0 +1,43 @@
package com.api.youhong.ai.zhishichanquan.ssocaiwu.util;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;
public class AES {
public static String encrypt(String key, String initVector, String value) {
try {
IvParameterSpec iv = new IvParameterSpec(initVector.getBytes("UTF-8"));
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv);
byte[] encrypted = cipher.doFinal(value.getBytes());
return Base64.getEncoder().encodeToString(encrypted);
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
public static String decrypt(String key, String initVector, String encrypted) {
try {
IvParameterSpec iv = new IvParameterSpec(initVector.getBytes("UTF-8"));
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
byte[] original = cipher.doFinal(Base64.getDecoder().decode(encrypted));
return new String(original);
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
}

View File

@ -12,7 +12,10 @@ import lombok.ToString;
import weaver.hrm.User; import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo; import weaver.soa.workflow.request.RequestInfo;
import weaver.youhong.ai.haripijiu.action.sapdocking.service.VoucherPayableService; import weaver.youhong.ai.haripijiu.action.sapdocking.service.VoucherPayableService;
import weaver.youhong.ai.haripijiu.action.sapdocking.util.SmbjUtil;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List; import java.util.List;
/** /**
@ -26,55 +29,87 @@ import java.util.List;
@ToString @ToString
@ActionDesc(author = "youhong.ai", value = "sap对接action收付款文件生成发送给sap服务方") @ActionDesc(author = "youhong.ai", value = "sap对接action收付款文件生成发送给sap服务方")
public class ReceiptAndPaymentAction extends SafeCusBaseAction { public class ReceiptAndPaymentAction extends SafeCusBaseAction {
@PrintParamMark @PrintParamMark
@ActionOptionalParam(value = "false", desc = "是否自动提交流程 false 不提交; true : 提交") @ActionOptionalParam(value = "false", desc = "是否自动提交流程 false 不提交; true : 提交")
private String submitAction = "false"; private String submitAction = "false";
@PrintParamMark @PrintParamMark
@ActionOptionalParam(value = "true", desc = "是否失败后阻断流程, false 不阻断; true 阻断") @ActionOptionalParam(value = "true", desc = "是否失败后阻断流程, false 不阻断; true 阻断")
private String block = "true"; private String block = "true";
@PrintParamMark @PrintParamMark
@RequiredMark("sap对接配置表的唯一标识") @RequiredMark("sap对接配置表的唯一标识")
private String onlyMark; private String onlyMark;
@PrintParamMark @PrintParamMark
@RequiredMark("凭证类型1- 付款单; 2- 收款单") @RequiredMark("凭证类型1- 付款单; 2- 收款单")
private String voucherType; private String voucherType;
@Override
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) { @PrintParamMark
try { @RequiredMark("收款单远程路径存储")
VoucherPayableService server = new VoucherPayableService(); private String receiptPath;
String fileName = "";
if (Integer.parseInt(voucherType) == 1) { @PrintParamMark
/* ******************* 一个明细对应一个文件 ******************* */ @RequiredMark("付款单远程路径存储")
List<String> paymentFilePathList = server.sendPaymentVoucher(onlyMark, requestId, billTable); private String paymentPath;
for (String filePath : paymentFilePathList) {
fileName = "Receipt" + Util.getTime("yyyyMMddHHmmss") + ".txt"; @PrintParamMark
// TODO 根据不同的规则生成不同的文件名并将文件存储到指定位置 @RequiredMark("用户名")
} private String userName;
} else if (Integer.parseInt(voucherType) == 2) {
String tempFilePath = server.sendReceiptVoucher(onlyMark, requestId, billTable); @PrintParamMark
fileName = "Payment" + Util.getTime("yyyyMMddHHmmss") + ".txt"; @RequiredMark("密码")
// TODO 根据不同的规则生成不同的文件名并将文件存储到指定位置 private String password;
}
/* ******************* 是否提交流程 ******************* */
if (Boolean.parseBoolean(submitAction)) { @PrintParamMark
this.submitWorkflow(requestId, user.getUID()); @RequiredMark("ip")
} private String ip;
} catch (Exception e) {
if (Boolean.parseBoolean(block)) { @Override
throw new CustomerException(e.getMessage(), e); public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
} try {
} SmbjUtil smbjUtil = new SmbjUtil();
} VoucherPayableService server = new VoucherPayableService();
String fileName = "";
public void submitWorkflow(String requestId, Integer userId) { if (Integer.parseInt(voucherType) == 1) {
Util.submitWorkflowThread(Integer.parseInt(requestId), userId, "sap对接自动提交流程"); /* ******************* 一个明细对应一个文件 ******************* */
} List<String> paymentFilePathList = server.sendPaymentVoucher(onlyMark, requestId, billTable);
for (String filePath : paymentFilePathList) {
fileName = "Receipt" + Util.getTime("yyyyMMddHHmmss") + ".txt";
// TODO 根据不同的规则生成不同的文件名并将文件存储到指定位置
log.info("远程连接地址:" + "smb://" + ip + receiptPath);
log.info("本地文件地址: " + filePath);
smbjUtil.smbPut("smb://" + ip + receiptPath, filePath, userName, password, fileName);
Files.delete(Paths.get(filePath));
}
} else if (Integer.parseInt(voucherType) == 2) {
String tempFilePath = server.sendReceiptVoucher(onlyMark, requestId, billTable);
fileName = "Payment" + Util.getTime("yyyyMMddHHmmss") + ".txt";
// TODO 根据不同的规则生成不同的文件名并将文件存储到指定位置
log.info("远程连接地址:" + "smb://" + ip + paymentPath);
log.info("本地文件地址: " + tempFilePath);
smbjUtil.smbPut("smb://" + ip + paymentPath, tempFilePath, userName, password, fileName);
Files.delete(Paths.get(tempFilePath));
}
/* ******************* 是否提交流程 ******************* */
if (Boolean.parseBoolean(submitAction)) {
this.submitWorkflow(requestId, user.getUID());
}
} catch (Exception e) {
log.error("推送收付款凭证失败!" + e.getMessage());
if (Boolean.parseBoolean(block)) {
throw new CustomerException(e.getMessage(), e);
}
}
}
public void submitWorkflow(String requestId, Integer userId) {
Util.submitWorkflowThread(Integer.parseInt(requestId), userId, "sap对接自动提交流程");
}
} }

View File

@ -12,6 +12,10 @@ import lombok.ToString;
import weaver.hrm.User; import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo; import weaver.soa.workflow.request.RequestInfo;
import weaver.youhong.ai.haripijiu.action.sapdocking.service.VoucherPayableService; import weaver.youhong.ai.haripijiu.action.sapdocking.service.VoucherPayableService;
import weaver.youhong.ai.haripijiu.action.sapdocking.util.SmbjUtil;
import java.nio.file.Files;
import java.nio.file.Paths;
/** /**
* <h1></h1> * <h1></h1>
@ -25,54 +29,83 @@ import weaver.youhong.ai.haripijiu.action.sapdocking.service.VoucherPayableServi
@ToString @ToString
@ActionDesc(author = "youhong.ai", value = "sap对接action付款应付凭证文件生成发送给sap服务方") @ActionDesc(author = "youhong.ai", value = "sap对接action付款应付凭证文件生成发送给sap服务方")
public class VoucherPayableAction extends SafeCusBaseAction { public class VoucherPayableAction extends SafeCusBaseAction {
@PrintParamMark @PrintParamMark
@ActionOptionalParam(value = "false", desc = "是否自动提交流程 false 不提交; true : 提交") @ActionOptionalParam(value = "false", desc = "是否自动提交流程 false 不提交; true : 提交")
private String submitAction = "false"; private String submitAction = "false";
@PrintParamMark @PrintParamMark
@ActionOptionalParam(value = "true", desc = "是否失败后阻断流程, false 不阻断; true 阻断") @ActionOptionalParam(value = "true", desc = "是否失败后阻断流程, false 不阻断; true 阻断")
private String block = "true"; private String block = "true";
@PrintParamMark @PrintParamMark
@RequiredMark("sap对接配置表的唯一标识") @RequiredMark("sap对接配置表的唯一标识")
private String onlyMark; private String onlyMark;
@PrintParamMark @PrintParamMark
@RequiredMark("凭证类型1- 应付凭证; 2- 付款凭证") @RequiredMark("凭证类型1- 应付凭证; 2- 付款凭证")
private String voucherType; private String voucherType;
@Override @PrintParamMark
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) { @RequiredMark("应付凭证远程路径")
private String pavRemotePath;
try {
VoucherPayableService server = new VoucherPayableService();
String tempFilePath = server.sendSapVoucher(onlyMark, requestId, billTable); @PrintParamMark
String fileName = ""; @RequiredMark("付款凭证远程路径")
if (Integer.parseInt(voucherType) == 1) { private String pmvRemotePath;
fileName = "Pav" + Util.getTime("yyyyMMddHHmmss") + ".txt";
} else if (Integer.parseInt(voucherType) == 2) { @PrintParamMark
fileName = "Pmv" + Util.getTime("yyyyMMddHHmmss") + ".txt"; @RequiredMark("用户名")
} private String userName;
// TODO 根据不同的规则生成不同的文件名并将文件存储到指定位置
@PrintParamMark
/* ******************* 是否提交流程 ******************* */ @RequiredMark("密码")
if (Boolean.parseBoolean(submitAction)) { private String password;
this.submitWorkflow(requestId, user.getUID());
}
} catch (Exception e) { @PrintParamMark
if (Boolean.parseBoolean(block)) { @RequiredMark("ip")
throw new CustomerException(e.getMessage(), e); private String ip;
}
} @Override
} public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
public void submitWorkflow(String requestId, Integer userId) { try {
Util.submitWorkflowThread(Integer.parseInt(requestId), userId, "sap对接自动提交流程"); SmbjUtil smbjUtil = new SmbjUtil();
} VoucherPayableService server = new VoucherPayableService();
String tempFilePath = server.sendSapVoucher(onlyMark, requestId, billTable);
String fileName = "";
String remotePath = "";
if (Integer.parseInt(voucherType) == 1) {
fileName = "Pav" + Util.getTime("yyyyMMddHHmmss") + ".txt";
remotePath = pavRemotePath;
} else if (Integer.parseInt(voucherType) == 2) {
fileName = "Pmv" + Util.getTime("yyyyMMddHHmmss") + ".txt";
remotePath = pmvRemotePath;
}
log.info("远程连接地址:" + "smb://" + ip + remotePath);
log.info("本地文件地址: " + tempFilePath);
smbjUtil.smbPut("smb://" + ip + remotePath, tempFilePath, userName, password, fileName);
Files.delete(Paths.get(tempFilePath));
/* ******************* 是否提交流程 ******************* */
if (Boolean.parseBoolean(submitAction)) {
this.submitWorkflow(requestId, user.getUID());
}
} catch (Exception e) {
log.error("推送应付款凭证失败!" + e.getMessage());
if (Boolean.parseBoolean(block)) {
throw new CustomerException(e.getMessage(), e);
}
}
}
public void submitWorkflow(String requestId, Integer userId) {
Util.submitWorkflowThread(Integer.parseInt(requestId), userId, "sap对接自动提交流程");
}
} }

View File

@ -0,0 +1,120 @@
package weaver.youhong.ai.haripijiu.action.sapdocking.util;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import com.google.common.base.Strings;
import jcifs.smb.*;
import org.apache.log4j.Logger;
import java.io.*;
import java.net.MalformedURLException;
import java.nio.file.Files;
import java.util.Objects;
/**
* <h1>windows访</h1>
*
* <p>create: 2023/2/8 17:55</p>
*
* @author youHong.ai
*/
public class SmbjUtil {
private final Logger log = Util.getLogger();
/**
* Description:
*
* @param remoteUrl
* @param localFilePath
*/
public void smbPut(String remoteUrl, String localFilePath, String userName, String pwd, String fileName) {
InputStream in = null;
OutputStream out = null;
try {
File localFile = new File(localFilePath);
if (Strings.isNullOrEmpty(fileName)) {
fileName = localFile.getName();
}
// 这里推荐使用这种方式进行用户名密码的校验在url中拼接如果需要特殊字符可能无法转换
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, userName, pwd);
SmbFile remoteFile = new SmbFile(remoteUrl + "/" + fileName, auth);
in = new BufferedInputStream(Files.newInputStream(localFile.toPath()));
out = new BufferedOutputStream(new SmbFileOutputStream(remoteFile));
byte[] buffer = new byte[1024];
while (in.read(buffer) != -1) {
out.write(buffer);
buffer = new byte[1024];
}
} catch (Exception e) {
log.error("提交文件到 共享目录失败!\n" + Util.getErrString(e));
throw new CustomerException("提交文件到 共享目录失败");
} finally {
closeStream(in, out);
}
}
private void closeStream(InputStream in, OutputStream out) {
try {
if (!Objects.isNull(out)) {
out.close();
}
if (!Objects.isNull(in)) {
in.close();
}
} catch (IOException e) {
log.error("流关闭失败!\n" + Util.getErrString(e));
throw new CustomerException("流关闭失败");
}
}
/**
* Description:
*
* @param remoteUrl
* @param localDir
*/
public void smbGet(String remoteUrl, String localDir) {
InputStream in = null;
OutputStream out = null;
try {
SmbFile remoteFile = new SmbFile(remoteUrl);
String fileName = remoteFile.getName();
File localFile = new File(localDir + File.separator + fileName);
in = new BufferedInputStream(new SmbFileInputStream(remoteFile));
out = new BufferedOutputStream(Files.newOutputStream(localFile.toPath()));
byte[] buffer = new byte[1024];
while (in.read(buffer) != -1) {
out.write(buffer);
buffer = new byte[1024];
}
} catch (Exception e) {
log.error("从共享目录拷贝文件到本地失败!\n" + Util.getErrString(e));
throw new CustomerException("从共享目录拷贝文件到本地失败");
} finally {
closeStream(in, out);
}
}
/**
*
*
* @param remoteUrl
* @param fileName
*/
public void deleteFile(String remoteUrl, String fileName, String userName, String pwd) {
SmbFile smbFile;
try {
// smb://userName:passWord@host/path/shareFolderPath/fileName
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, userName, pwd);
smbFile = new SmbFile(remoteUrl + "/" + fileName, auth);
if (smbFile.exists()) {
smbFile.delete();
}
} catch (MalformedURLException | SmbException e) {
log.error("删除共享目录文件失败!\n" + Util.getErrString(e));
throw new CustomerException("删除共享目录文件失败");
}
}
}

View File

@ -0,0 +1,23 @@
package youhong.ai.haripijiu;
import aiyh.utils.GenerateFileUtil;
import basetest.BaseTest;
import org.junit.Test;
import weaver.youhong.ai.haripijiu.action.sapdocking.ReceiptAndPaymentAction;
import weaver.youhong.ai.haripijiu.action.sapdocking.VoucherPayableAction;
/**
* <h1></h1>
*
* <p>create: 2023/2/12 13:24</p>
*
* @author youHong.ai
*/
public class TestHaRiPiJiu extends BaseTest {
@Test
public void testA() {
GenerateFileUtil.createActionDocument(VoucherPayableAction.class);
GenerateFileUtil.createActionDocument(ReceiptAndPaymentAction.class);
}
}