diff --git a/com/api/aiyh_pcn/fadada/service/impl/FaDDContractService.java b/com/api/aiyh_pcn/fadada/service/impl/FaDDContractService.java index d4f18cc..6b19250 100644 --- a/com/api/aiyh_pcn/fadada/service/impl/FaDDContractService.java +++ b/com/api/aiyh_pcn/fadada/service/impl/FaDDContractService.java @@ -338,6 +338,9 @@ public class FaDDContractService { if("1".equals(Util.null2String(ufContractInfoDTO.getSignedType()))){ 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, Util.createPrepWhereImpl().whereAnd("id").whereEqual(ufContractInfoDTO.getId())); RecordSet rs = new RecordSet(); + toolUtil.writeDebuggerLog(String.format("合同签署回调,更新合同状态,更新语句{%s},更新参数{%s}",sqlResult.getSqlStr(),sqlResult.getArgs())); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); // 查询合同状态,更新明细表 /* Map data = new HashMap<>(); diff --git a/weaver/aiyh_pcn/convert_pdf/ConvertPdfAction.java b/weaver/aiyh_pcn/convert_pdf/ConvertPdfAction.java index 8f13d95..315e48f 100644 --- a/weaver/aiyh_pcn/convert_pdf/ConvertPdfAction.java +++ b/weaver/aiyh_pcn/convert_pdf/ConvertPdfAction.java @@ -129,7 +129,16 @@ public class ConvertPdfAction implements Action { toolUtil.writeErrorLog("复制文件时,文件转为base64出错,文件转换出错!" + e); } 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{ fileId = createDocForJSGJXT.creatDoc(user, fileName, docCategory, docIds); } diff --git a/weaver/aiyh_pcn/fadada/FaDDContractAction.java b/weaver/aiyh_pcn/fadada/FaDDContractAction.java index fdb5fc9..a3ec5ef 100644 --- a/weaver/aiyh_pcn/fadada/FaDDContractAction.java +++ b/weaver/aiyh_pcn/fadada/FaDDContractAction.java @@ -93,7 +93,7 @@ public class FaDDContractAction extends ToolUtil implements Action { } try { - faddContractUtil.signedContract(); + faddContractUtil.signedContract(mainMap); } catch (Exception e) { toolUtil.writeErrorLog("合同已创建,但发起签署失败,失败原因:" + e); // TODO 更换labelIndex diff --git a/weaver/aiyh_pcn/fadada/util/FaddContractUtil.java b/weaver/aiyh_pcn/fadada/util/FaddContractUtil.java index e418cd8..86b87ca 100644 --- a/weaver/aiyh_pcn/fadada/util/FaddContractUtil.java +++ b/weaver/aiyh_pcn/fadada/util/FaddContractUtil.java @@ -52,7 +52,7 @@ public class FaddContractUtil { } public FaddContractUtil(String workflowId, String requestId, String mainTableName, String tableName, String customerNo, - String customerNoField, String contractField,String queueSigned, List> detailMaps, Map mainMap) { + String customerNoField, String contractField, String queueSigned, List> detailMaps, Map mainMap) { this.workflowId = workflowId; this.requestId = requestId; this.mainTableName = mainTableName; @@ -118,44 +118,44 @@ public class FaddContractUtil { toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); // 将合同信息和流程表信息保存到自定义的建模表中 - updateMap.put("workflow_type",workflowId); - updateMap.put("workflow_request_id",requestId); - updateMap.put("workflow_main_table",mainTableName); - updateMap.put("workflow_detail_table",tableName); + updateMap.put("workflow_type", workflowId); + updateMap.put("workflow_request_id", requestId); + updateMap.put("workflow_main_table", mainTableName); + updateMap.put("workflow_detail_table", tableName); // 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_type",3); + updateMap.put("signed_num", 0); + updateMap.put("signed_type", 3); - updateMap.put("main_id",String.valueOf(mainMap.get("id"))); - updateMap.put("queue_signed","true".equals(queueSigned) ? 1 : 0); - updateMap.put("single_contract_file_num",contractNoIds.size()); + updateMap.put("main_id", String.valueOf(mainMap.get("id"))); + updateMap.put("queue_signed", "true".equals(queueSigned) ? 1 : 0); + updateMap.put("single_contract_file_num", contractNoIds.size()); // 如果需要控制签署规则 if (faDaDaConfigDTO.getSignedType() == 1) { // 需要控制签署规则 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("queue_signed",0); - updateMap.put("signed_type",1); + updateMap.put("signed_num", 0); + updateMap.put("queue_signed", 0); + updateMap.put("signed_type", 1); } 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 = ?"; - rs.executeQuery(query,requestId); + rs.executeQuery(query, requestId); String formModeId = "52"; - if(rs.next()){ - sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable,updateMap, + if (rs.next()) { + sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, updateMap, Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId)); toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); @@ -163,11 +163,11 @@ public class FaddContractUtil { ModeRightInfo mri = new ModeRightInfo(); int dataId = rs.getInt("id"); toolUtil.writeDebuggerLog("id:" + dataId); - mri.rebuildModeDataShareByEdit(1,Util.getIntValue(formModeId,-1),dataId); - }else{ + mri.rebuildModeDataShareByEdit(1, Util.getIntValue(formModeId, -1), dataId); + } else { ModeDataIdUpdate mdu = ModeDataIdUpdate.getInstance(); int dataId = mdu.getModeDataNewId(contractInfoTable, - Util.getIntValue(formModeId,-1), + Util.getIntValue(formModeId, -1), 1, 0, TimeUtil.getCurrentDateString(), TimeUtil.getOnlyCurrentTimeString()); sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, updateMap, @@ -175,7 +175,7 @@ public class FaddContractUtil { toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); ModeRightInfo mri = new ModeRightInfo(); - mri.rebuildModeDataShareByEdit(1,Util.getIntValue(formModeId,-1),dataId); + mri.rebuildModeDataShareByEdit(1, Util.getIntValue(formModeId, -1), dataId); } } @@ -186,7 +186,7 @@ public class FaddContractUtil { * @return */ public List contractHandle(String contractField) { - String fileIds = Util.null2String(this.mainMap.get(contractField)); + String fileIds = Util.null2String(this.mainMap.get(contractField)); // 如果没有合同字段的数据,则返回一个空的 if ("".equals(fileIds)) { return new ArrayList<>(); @@ -220,7 +220,7 @@ public class FaddContractUtil { /** * 签署合同 */ - public void signedContract() { + public void signedContract(Map mainMap) { // 获取配置表信息 FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(workflowId, 3); // 查询接口配置树形结构 @@ -229,52 +229,69 @@ public class FaddContractUtil { List> dataArr = faDDContractService.getDataArr(requestId, workflowId, mainTableName, tableName); // 处理数据 List> maps = faDDContractService.objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr); - if(maps == null){ + if (maps == null) { toolUtil.writeErrorLog("签署合同错误,错误原因:maps为null!"); throw new RuntimeException("签署合同错误,错误原因:maps为null!"); } - if(maps.size() == 0){ + if (maps.size() == 0) { return; } RecordSet rs = new RecordSet(); - Map update = new HashMap<>(); + Map update = new HashMap<>(); // 顺序签署合同 - if("true".equals(queueSigned)){ + if ("true".equals(queueSigned)) { Map 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); PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, update, Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId)); - rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs()); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); update.clear(); // 更新明细表合同信息 TODO 明细表添加字段,signed_status(合同方签署状态) // 签署状态,1 已发送待签署,2 已签蜀 - update.put("signed_status",1); + update.put("signed_status", 1); sqlResult = Util.createSqlBuilder().updateSql(tableName, update, Util.createPrepWhereImpl().whereAnd("id").whereEqual(String.valueOf(map.get("id")))); - rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs()); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); return; } // 不是顺序签署 for (Map 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, Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId)); - rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs()); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); } /** * 合同签署发送请求 + * * @param map * @param apiConfigMainDTO */ - private void signedRequest(Map map, ApiConfigMainDTO apiConfigMainDTO){ + private void signedRequest(Map map, ApiConfigMainDTO apiConfigMainDTO) { String contractNos = Util.null2String(map.get("contractNo")); String[] split = contractNos.split(","); // RecordSet rs = new RecordSet();