|
@@ -87,8 +87,8 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
this.addSignatureTaskBatch(taskApp);
|
|
|
//for循环 pdfUrl分割
|
|
|
String fileUrl = CommonUtil.replaceOssUrl(taskApp.getSignPdfUrl());
|
|
|
- List<String> eVisaConfigList = PDFUtils.getPdfSignIds(fileUrl, taskApp);
|
|
|
- if (eVisaConfigList == null || eVisaConfigList.size() == 0) {
|
|
|
+ Map<String, Integer> eVisaConfigMap = PDFUtils.getPdfSignIds(fileUrl, taskApp);
|
|
|
+ if (eVisaConfigMap == null || eVisaConfigMap.size() == 0) {
|
|
|
//没有电签配置,默认当前任务为不签字审批,返回成功
|
|
|
taskApp.setSigState(2);
|
|
|
taskApp.setSignSmg("pdf未获取到关键字Id");
|
|
@@ -96,7 +96,7 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
return;
|
|
|
}
|
|
|
// 获取pdf上的电签Ids
|
|
|
- String ids = String.join(",", eVisaConfigList);
|
|
|
+ String ids = String.join(",", eVisaConfigMap.keySet());
|
|
|
if (taskApp.getRemarkType().equals("1")) { //安心签
|
|
|
//添加电签策略
|
|
|
List<SealStrategyVO> strategyListByAXQ = getStrategyListByAXQ(taskApp, ids);
|
|
@@ -118,6 +118,26 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
}
|
|
|
SignBackPdfInfo(taskApp);
|
|
|
return;
|
|
|
+ } else {
|
|
|
+ // 一个位置只留一个签字
|
|
|
+ Map<Integer, SealStrategyVO> map = new HashMap<>();
|
|
|
+ strategyListByAXQ.forEach(item -> {
|
|
|
+ String keyword = item.getKeyword();
|
|
|
+ Integer lineNum = eVisaConfigMap.get(keyword);
|
|
|
+ if (lineNum == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ SealStrategyVO vo = map.get(lineNum);
|
|
|
+ if (vo == null) {
|
|
|
+ map.put(lineNum, item);
|
|
|
+ } else {
|
|
|
+ String keyword1 = vo.getKeyword();
|
|
|
+ if (keyword1 != null && keyword1.contains("✹") && !keyword.contains("✹")) {
|
|
|
+ map.put(lineNum, item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ strategyListByAXQ = new ArrayList<>(map.values());
|
|
|
}
|
|
|
|
|
|
//调用签字逻辑
|
|
@@ -133,6 +153,27 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
} else if (taskApp.getRemarkType().equals("2") || taskApp.getRemarkType().equals("3")) { //东方中讯
|
|
|
//添加电签策略
|
|
|
List<Map<String, Object>> strategyListByDFZX = getStrategyListByDFZX(taskApp, ids);
|
|
|
+ if (strategyListByDFZX != null && !strategyListByDFZX.isEmpty()) {
|
|
|
+ // 一个位置只留一个签字
|
|
|
+ Map<Integer, Map<String, Object>> map = new HashMap<>();
|
|
|
+ strategyListByDFZX.forEach(item -> {
|
|
|
+ String keyword = item.get("keyword") + "";
|
|
|
+ Integer lineNum = eVisaConfigMap.get(keyword);
|
|
|
+ if (lineNum == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<String, Object> vo = map.get(lineNum);
|
|
|
+ if (vo == null) {
|
|
|
+ map.put(lineNum, item);
|
|
|
+ } else {
|
|
|
+ String keyword1 = vo.get("keyword") + "";
|
|
|
+ if (!keyword1.equals("null") && keyword1.contains("✹") && !keyword.contains("✹")) {
|
|
|
+ map.put(lineNum, item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ strategyListByDFZX = new ArrayList<>(map.values());
|
|
|
+ }
|
|
|
//调用签字逻辑
|
|
|
String s = signTaskBatchByDFZX(strategyListByDFZX, fileUrl, taskApp.getSigType(),taskApp.getRemarkType(),taskApp.getContractId());
|
|
|
if (s.contains("sucess")) {
|
|
@@ -624,8 +665,8 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
}
|
|
|
maps2 = jdbcTemplate.queryForList(sqlinfo);
|
|
|
}
|
|
|
+ List<Map<String, Object>> maps = new ArrayList<>();
|
|
|
if (maps2 != null && maps2.size() > 0) {
|
|
|
- List<Map<String, Object>> maps = new ArrayList<>();
|
|
|
Map<String, List<Map<String, Object>>> peopleByAge = maps2.stream()
|
|
|
.collect(Collectors.groupingBy(hada -> (Func.toStr(hada.get("id")))));
|
|
|
|
|
@@ -647,68 +688,68 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
maps.add(keyList.get(0));
|
|
|
}
|
|
|
}
|
|
|
- if (signIds.length() > 0 && task.getSigType() != 2) {
|
|
|
- String sql = "SELECT * from ( SELECT DISTINCT a.conf_id as id,0.0 as pyzbx ,0.0 as pyzby,(SELECT signature_file_url from m_sign_pfx_file where is_register=1 and certificate_user_id='"
|
|
|
- + userId + "' and is_deleted=0 ) as signature_file_url, (SELECT wide from m_sign_pfx_file where is_register=1 and certificate_user_id='"
|
|
|
- + userId + "' and is_deleted=0 ) as wide ,(SELECT high from m_sign_pfx_file where is_register=1 and certificate_user_id='"
|
|
|
- + userId + "' and is_deleted=0 ) as high from m_sign_config_relation a where a.type = 1 and a.is_deleted = 0 and a.conf_id in (" + signIds + ") and a.relation_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c where c.contract_id="
|
|
|
- + task.getContractId() + " and user_id=" + userId + " and c.is_deleted=0 ) ) x where x.signature_file_url is not null ";
|
|
|
- List<Map<String, Object>> maps3 = jdbcTemplate.queryForList(sql);
|
|
|
- System.out.println("安心签--签章--key =" + sql);
|
|
|
- if (!maps3.isEmpty()) {
|
|
|
- Map<String, List<Map<String, Object>>> peopleByAges = maps3.stream()
|
|
|
- .collect(Collectors.groupingBy(hada -> (Func.toStr(hada.get("id")))));
|
|
|
- for (String keyId : peopleByAges.keySet()) {
|
|
|
- List<Map<String, Object>> keyList = peopleByAges.get(keyId);
|
|
|
- if (keyList != null && !keyList.isEmpty()) {
|
|
|
- Map<String, Object> map = keyList.get(0);
|
|
|
- map.put("id", "✹" + map.get("id"));
|
|
|
- maps.add(map);
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (signIds.length() > 0 && task.getSigType() != 2) {
|
|
|
+ String sql = "SELECT * from ( SELECT DISTINCT a.conf_id as id,0.0 as pyzbx ,0.0 as pyzby,(SELECT signature_file_url from m_sign_pfx_file where is_register=1 and certificate_user_id='"
|
|
|
+ + userId + "' and is_deleted=0 ) as signature_file_url, (SELECT wide from m_sign_pfx_file where is_register=1 and certificate_user_id='"
|
|
|
+ + userId + "' and is_deleted=0 ) as wide ,(SELECT high from m_sign_pfx_file where is_register=1 and certificate_user_id='"
|
|
|
+ + userId + "' and is_deleted=0 ) as high from m_sign_config_relation a where a.type = 1 and a.is_deleted = 0 and a.conf_id in (" + signIds + ") and a.relation_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c where c.contract_id="
|
|
|
+ + task.getContractId() + " and user_id=" + userId + " and c.is_deleted=0 ) ) x where x.signature_file_url is not null ";
|
|
|
+ List<Map<String, Object>> maps3 = jdbcTemplate.queryForList(sql);
|
|
|
+ System.out.println("安心签--签章--key =" + sql);
|
|
|
+ if (!maps3.isEmpty()) {
|
|
|
+ Map<String, List<Map<String, Object>>> peopleByAges = maps3.stream()
|
|
|
+ .collect(Collectors.groupingBy(hada -> (Func.toStr(hada.get("id")))));
|
|
|
+ for (String keyId : peopleByAges.keySet()) {
|
|
|
+ List<Map<String, Object>> keyList = peopleByAges.get(keyId);
|
|
|
+ if (keyList != null && !keyList.isEmpty()) {
|
|
|
+ Map<String, Object> map = keyList.get(0);
|
|
|
+ map.put("id", "✹" + map.get("id"));
|
|
|
+ maps.add(map);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (maps == null || maps.size() <= 0) {
|
|
|
- break;
|
|
|
- }
|
|
|
- //准备签章策略
|
|
|
- for (Map<String, Object> eVisaConfig : maps) {
|
|
|
- //设置签章策略
|
|
|
- SealStrategyVO vo = new SealStrategyVO();
|
|
|
- if (task.getSigType() == 1) {
|
|
|
- vo.setSealCode(EVisaConstant.SIGN_SEAL_CODE + userId);
|
|
|
- if (userId.length() <= EVisaConstant.USER_ID_SUB) {
|
|
|
- vo.setSealPassword(userId.toString());
|
|
|
- } else {
|
|
|
- vo.setSealPassword(userId.substring(0, EVisaConstant.USER_ID_SUB));
|
|
|
- }
|
|
|
- vo.setSealPerson(userNames[i]);
|
|
|
- //设置签字文件
|
|
|
- vo.setImageUrl(eVisaConfig.get("signature_file_url") + "");
|
|
|
- vo.setSealType("3");
|
|
|
- vo.setKeyword(eVisaConfig.get("id") + "");
|
|
|
- vo.setOffSetX(eVisaConfig.get("pyzbx") + "");
|
|
|
- vo.setOffSetY(eVisaConfig.get("pyzby") + "");
|
|
|
- vo.setHeight(eVisaConfig.get("high") + "");
|
|
|
- vo.setWidth(eVisaConfig.get("wide") + "");
|
|
|
- vo.setProjectId(eVisaConfig.get("project_id") + "");
|
|
|
- } else if (task.getSigType() == 2) {
|
|
|
- vo.setSealCode(EVisaConstant.SIGN_SEAL_CODE + eVisaConfig.get("sfId"));
|
|
|
- vo.setSealPassword(eVisaConfig.get("certificate_password") + "");
|
|
|
- vo.setSealPerson(eVisaConfig.get("certificate_user_name") + "" + System.currentTimeMillis());
|
|
|
- //设置签字文件
|
|
|
- vo.setImageUrl(eVisaConfig.get("signature_file_url") + "");
|
|
|
- vo.setSealType("3");
|
|
|
- vo.setCompanySeal(true);
|
|
|
- vo.setKeyword(eVisaConfig.get("id") + "");
|
|
|
- vo.setOffSetX(eVisaConfig.get("pyzbx") + "");
|
|
|
- vo.setOffSetY(eVisaConfig.get("pyzby") + "");
|
|
|
- vo.setHeight(eVisaConfig.get("high") + "");
|
|
|
- vo.setWidth(eVisaConfig.get("wide") + "");
|
|
|
- vo.setProjectId(eVisaConfig.get("project_id") + "");
|
|
|
+ }
|
|
|
+ if (maps.size() <= 0) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ //准备签章策略
|
|
|
+ for (Map<String, Object> eVisaConfig : maps) {
|
|
|
+ //设置签章策略
|
|
|
+ SealStrategyVO vo = new SealStrategyVO();
|
|
|
+ if (task.getSigType() == 1) {
|
|
|
+ vo.setSealCode(EVisaConstant.SIGN_SEAL_CODE + userId);
|
|
|
+ if (userId.length() <= EVisaConstant.USER_ID_SUB) {
|
|
|
+ vo.setSealPassword(userId.toString());
|
|
|
+ } else {
|
|
|
+ vo.setSealPassword(userId.substring(0, EVisaConstant.USER_ID_SUB));
|
|
|
}
|
|
|
- sealStrategyVOS.add(vo);
|
|
|
+ vo.setSealPerson(userNames[i]);
|
|
|
+ //设置签字文件
|
|
|
+ vo.setImageUrl(eVisaConfig.get("signature_file_url") + "");
|
|
|
+ vo.setSealType("3");
|
|
|
+ vo.setKeyword(eVisaConfig.get("id") + "");
|
|
|
+ vo.setOffSetX(eVisaConfig.get("pyzbx") + "");
|
|
|
+ vo.setOffSetY(eVisaConfig.get("pyzby") + "");
|
|
|
+ vo.setHeight(eVisaConfig.get("high") + "");
|
|
|
+ vo.setWidth(eVisaConfig.get("wide") + "");
|
|
|
+ vo.setProjectId(eVisaConfig.get("project_id") + "");
|
|
|
+ } else if (task.getSigType() == 2) {
|
|
|
+ vo.setSealCode(EVisaConstant.SIGN_SEAL_CODE + eVisaConfig.get("sfId"));
|
|
|
+ vo.setSealPassword(eVisaConfig.get("certificate_password") + "");
|
|
|
+ vo.setSealPerson(eVisaConfig.get("certificate_user_name") + "" + System.currentTimeMillis());
|
|
|
+ //设置签字文件
|
|
|
+ vo.setImageUrl(eVisaConfig.get("signature_file_url") + "");
|
|
|
+ vo.setSealType("3");
|
|
|
+ vo.setCompanySeal(true);
|
|
|
+ vo.setKeyword(eVisaConfig.get("id") + "");
|
|
|
+ vo.setOffSetX(eVisaConfig.get("pyzbx") + "");
|
|
|
+ vo.setOffSetY(eVisaConfig.get("pyzby") + "");
|
|
|
+ vo.setHeight(eVisaConfig.get("high") + "");
|
|
|
+ vo.setWidth(eVisaConfig.get("wide") + "");
|
|
|
+ vo.setProjectId(eVisaConfig.get("project_id") + "");
|
|
|
}
|
|
|
+ sealStrategyVOS.add(vo);
|
|
|
}
|
|
|
}
|
|
|
}
|