更改合并逻辑,一个文件复制时报错,修改仅对方签署时需要自动归档

dev
IT-xiaoXiong 2021-12-02 21:13:51 +08:00
parent 6a152c5af2
commit c572146997
4 changed files with 72 additions and 42 deletions

View File

@ -338,6 +338,9 @@ public class FaDDContractService {
if("1".equals(Util.null2String(ufContractInfoDTO.getSignedType()))){ if("1".equals(Util.null2String(ufContractInfoDTO.getSignedType()))){
update.put("contract_status", 4); update.put("contract_status", 4);
} }
if("2".equals(Util.null2String(ufContractInfoDTO.getSignedType()))){
update.put("contract_status", 4);
}
} }
} }
@ -345,6 +348,7 @@ public class FaDDContractService {
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql("uf_contract_info", update, PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql("uf_contract_info", update,
Util.createPrepWhereImpl().whereAnd("id").whereEqual(ufContractInfoDTO.getId())); Util.createPrepWhereImpl().whereAnd("id").whereEqual(ufContractInfoDTO.getId()));
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
toolUtil.writeDebuggerLog(String.format("合同签署回调,更新合同状态,更新语句{%s},更新参数{%s}",sqlResult.getSqlStr(),sqlResult.getArgs()));
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
// 查询合同状态,更新明细表 // 查询合同状态,更新明细表
/* Map<String,Object> data = new HashMap<>(); /* Map<String,Object> data = new HashMap<>();

View File

@ -129,7 +129,16 @@ public class ConvertPdfAction implements Action {
toolUtil.writeErrorLog("复制文件时文件转为base64出错文件转换出错" + e); toolUtil.writeErrorLog("复制文件时文件转为base64出错文件转换出错" + e);
} }
String base64 = Base64Utils.encode(bytes); String base64 = Base64Utils.encode(bytes);
fileId = fileProcessor.Process("base64:" + base64, docCategorys, user, fileName); fileId = fileProcessor.Process("base64:" + base64, docCategorys, user, fileName + ".pdf");
if(fileId <= 0){
toolUtil.writeErrorLog(docCategorys + "---------->" + fileName);
toolUtil.writeDebuggerLog("文件创建错误、错误id" + fileId);
toolUtil.writeErrorLog(base64);
// TODO 修改labelId
requestInfo.getRequestManager().setMessagecontent(Util.getHtmlLabelName(-88651,user.getLanguage(),"合并pdf错误请联系管理员"));
requestInfo.getRequestManager().setMessageid("1");
return Action.FAILURE_AND_CONTINUE;
}
}else{ }else{
fileId = createDocForJSGJXT.creatDoc(user, fileName, docCategory, docIds); fileId = createDocForJSGJXT.creatDoc(user, fileName, docCategory, docIds);
} }

View File

@ -93,7 +93,7 @@ public class FaDDContractAction extends ToolUtil implements Action {
} }
try { try {
faddContractUtil.signedContract(); faddContractUtil.signedContract(mainMap);
} catch (Exception e) { } catch (Exception e) {
toolUtil.writeErrorLog("合同已创建,但发起签署失败,失败原因:" + e); toolUtil.writeErrorLog("合同已创建,但发起签署失败,失败原因:" + e);
// TODO 更换labelIndex // TODO 更换labelIndex

View File

@ -52,7 +52,7 @@ public class FaddContractUtil {
} }
public FaddContractUtil(String workflowId, String requestId, String mainTableName, String tableName, String customerNo, public FaddContractUtil(String workflowId, String requestId, String mainTableName, String tableName, String customerNo,
String customerNoField, String contractField,String queueSigned, List<Map<String, Object>> detailMaps, Map<String, Object> mainMap) { String customerNoField, String contractField, String queueSigned, List<Map<String, Object>> detailMaps, Map<String, Object> mainMap) {
this.workflowId = workflowId; this.workflowId = workflowId;
this.requestId = requestId; this.requestId = requestId;
this.mainTableName = mainTableName; this.mainTableName = mainTableName;
@ -118,44 +118,44 @@ public class FaddContractUtil {
toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
// 将合同信息和流程表信息保存到自定义的建模表中 // 将合同信息和流程表信息保存到自定义的建模表中
updateMap.put("workflow_type",workflowId); updateMap.put("workflow_type", workflowId);
updateMap.put("workflow_request_id",requestId); updateMap.put("workflow_request_id", requestId);
updateMap.put("workflow_main_table",mainTableName); updateMap.put("workflow_main_table", mainTableName);
updateMap.put("workflow_detail_table",tableName); updateMap.put("workflow_detail_table", tableName);
// 1表示创建 2表示等待对方签署3表示等待本方签署4表示完成 // 1表示创建 2表示等待对方签署3表示等待本方签署4表示完成
updateMap.put("contract_status",1); updateMap.put("contract_status", 1);
// 对方应该签署的数量 // 对方应该签署的数量
updateMap.put("should_signed_num",detailMaps.size()); updateMap.put("should_signed_num", detailMaps.size());
// 现在已经签署的数量 // 现在已经签署的数量
updateMap.put("signed_num",0); updateMap.put("signed_num", 0);
updateMap.put("signed_type",3); updateMap.put("signed_type", 3);
updateMap.put("main_id",String.valueOf(mainMap.get("id"))); updateMap.put("main_id", String.valueOf(mainMap.get("id")));
updateMap.put("queue_signed","true".equals(queueSigned) ? 1 : 0); updateMap.put("queue_signed", "true".equals(queueSigned) ? 1 : 0);
updateMap.put("single_contract_file_num",contractNoIds.size()); updateMap.put("single_contract_file_num", contractNoIds.size());
// 如果需要控制签署规则 // 如果需要控制签署规则
if (faDaDaConfigDTO.getSignedType() == 1) { if (faDaDaConfigDTO.getSignedType() == 1) {
// 需要控制签署规则 // 需要控制签署规则
if (Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOwn()) { if (Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOwn()) {
// 只需要本方签署 // 只需要本方签署
updateMap.put("contract_status",3); updateMap.put("contract_status", 3);
// 对方应该签署的数量 // 对方应该签署的数量
updateMap.put("should_signed_num",0); updateMap.put("should_signed_num", 0);
// 现在已经签署的数量 // 现在已经签署的数量
updateMap.put("signed_num",0); updateMap.put("signed_num", 0);
updateMap.put("queue_signed",0); updateMap.put("queue_signed", 0);
updateMap.put("signed_type",1); updateMap.put("signed_type", 1);
} }
if (Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOther()) { if (Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOther()) {
updateMap.put("signed_type",2); updateMap.put("signed_type", 2);
} }
} }
// 查询合同信息中,是否存在该信息,如果存在着更新,不存在则插入 // 查询合同信息中,是否存在该信息,如果存在着更新,不存在则插入
String query = "select * from " + contractInfoTable + " where workflow_request_id = ?"; String query = "select * from " + contractInfoTable + " where workflow_request_id = ?";
rs.executeQuery(query,requestId); rs.executeQuery(query, requestId);
String formModeId = "52"; String formModeId = "52";
if(rs.next()){ if (rs.next()) {
sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable,updateMap, sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, updateMap,
Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId)); Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId));
toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
@ -163,11 +163,11 @@ public class FaddContractUtil {
ModeRightInfo mri = new ModeRightInfo(); ModeRightInfo mri = new ModeRightInfo();
int dataId = rs.getInt("id"); int dataId = rs.getInt("id");
toolUtil.writeDebuggerLog("id" + dataId); toolUtil.writeDebuggerLog("id" + dataId);
mri.rebuildModeDataShareByEdit(1,Util.getIntValue(formModeId,-1),dataId); mri.rebuildModeDataShareByEdit(1, Util.getIntValue(formModeId, -1), dataId);
}else{ } else {
ModeDataIdUpdate mdu = ModeDataIdUpdate.getInstance(); ModeDataIdUpdate mdu = ModeDataIdUpdate.getInstance();
int dataId = mdu.getModeDataNewId(contractInfoTable, int dataId = mdu.getModeDataNewId(contractInfoTable,
Util.getIntValue(formModeId,-1), Util.getIntValue(formModeId, -1),
1, 0, TimeUtil.getCurrentDateString(), 1, 0, TimeUtil.getCurrentDateString(),
TimeUtil.getOnlyCurrentTimeString()); TimeUtil.getOnlyCurrentTimeString());
sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, updateMap, sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, updateMap,
@ -175,7 +175,7 @@ public class FaddContractUtil {
toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
ModeRightInfo mri = new ModeRightInfo(); ModeRightInfo mri = new ModeRightInfo();
mri.rebuildModeDataShareByEdit(1,Util.getIntValue(formModeId,-1),dataId); mri.rebuildModeDataShareByEdit(1, Util.getIntValue(formModeId, -1), dataId);
} }
} }
@ -220,7 +220,7 @@ public class FaddContractUtil {
/** /**
* *
*/ */
public void signedContract() { public void signedContract(Map<String, Object> mainMap) {
// 获取配置表信息 // 获取配置表信息
FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(workflowId, 3); FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(workflowId, 3);
// 查询接口配置树形结构 // 查询接口配置树形结构
@ -229,52 +229,69 @@ public class FaddContractUtil {
List<Map<String, Object>> dataArr = faDDContractService.getDataArr(requestId, workflowId, mainTableName, tableName); List<Map<String, Object>> dataArr = faDDContractService.getDataArr(requestId, workflowId, mainTableName, tableName);
// 处理数据 // 处理数据
List<Map<String, Object>> maps = faDDContractService.objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr); List<Map<String, Object>> maps = faDDContractService.objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr);
if(maps == null){ if (maps == null) {
toolUtil.writeErrorLog("签署合同错误错误原因maps为null!"); toolUtil.writeErrorLog("签署合同错误错误原因maps为null!");
throw new RuntimeException("签署合同错误错误原因maps为null"); throw new RuntimeException("签署合同错误错误原因maps为null");
} }
if(maps.size() == 0){ if (maps.size() == 0) {
return; return;
} }
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
Map<String,Object> update = new HashMap<>(); Map<String, Object> update = new HashMap<>();
// 顺序签署合同 // 顺序签署合同
if("true".equals(queueSigned)){ if ("true".equals(queueSigned)) {
Map<String, Object> map = maps.get(0); Map<String, Object> map = maps.get(0);
signedRequest(map,apiConfigMainDTO); if (faDaDaConfigDTO.getSignedType() == 1) {
// 需要控制签署规则
if (Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOther()) {
// 只需要对方签署
map.put("autoArchive", 2);
}
// 双方签署
}
signedRequest(map, apiConfigMainDTO);
// 将合同签署信息更新到合同信息表中 // 将合同签署信息更新到合同信息表中
update.put("contract_status",2); update.put("contract_status", 2);
// update.put("single_signed_num",0); // update.put("single_signed_num",0);
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, update, PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, update,
Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId)); Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId));
rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
update.clear(); update.clear();
// 更新明细表合同信息 TODO 明细表添加字段signed_status合同方签署状态 // 更新明细表合同信息 TODO 明细表添加字段signed_status合同方签署状态
// 签署状态1 已发送待签署2 已签蜀 // 签署状态1 已发送待签署2 已签蜀
update.put("signed_status",1); update.put("signed_status", 1);
sqlResult = Util.createSqlBuilder().updateSql(tableName, update, sqlResult = Util.createSqlBuilder().updateSql(tableName, update,
Util.createPrepWhereImpl().whereAnd("id").whereEqual(String.valueOf(map.get("id")))); Util.createPrepWhereImpl().whereAnd("id").whereEqual(String.valueOf(map.get("id"))));
rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
return; return;
} }
// 不是顺序签署 // 不是顺序签署
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
signedRequest(map,apiConfigMainDTO); if (faDaDaConfigDTO.getSignedType() == 1) {
// 需要控制签署规则
if (Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOther()) {
// 只需要对方签署
map.put("autoArchive", 2);
}
// 双方签署
}
signedRequest(map, apiConfigMainDTO);
} }
// 将合同签署信息更新到合同信息表中 // 将合同签署信息更新到合同信息表中
update.put("contract_status",2); update.put("contract_status", 2);
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, update, PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, update,
Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId)); Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId));
rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
} }
/** /**
* *
*
* @param map * @param map
* @param apiConfigMainDTO * @param apiConfigMainDTO
*/ */
private void signedRequest(Map<String, Object> map, ApiConfigMainDTO apiConfigMainDTO){ private void signedRequest(Map<String, Object> map, ApiConfigMainDTO apiConfigMainDTO) {
String contractNos = Util.null2String(map.get("contractNo")); String contractNos = Util.null2String(map.get("contractNo"));
String[] split = contractNos.split(","); String[] split = contractNos.split(",");
// RecordSet rs = new RecordSet(); // RecordSet rs = new RecordSet();