|
@@ -75,90 +75,106 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
@Override
|
|
|
public void signTaskBatch(TaskSignInfoVO taskApp) {
|
|
|
//获取pdf 文件
|
|
|
- this.getSignPdfInfo(taskApp);
|
|
|
- if (taskApp.getSigState() != 1) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- this.addSignatureTaskBatch(taskApp);
|
|
|
-
|
|
|
- String fileUrl = CommonUtil.replaceOssUrl(taskApp.getSignPdfUrl());
|
|
|
- List<String> eVisaConfigList = PDFUtils.getPdfSignIds(fileUrl, taskApp);
|
|
|
- if (eVisaConfigList == null || eVisaConfigList.size() == 0) {
|
|
|
- //没有电签配置,默认当前任务为不签字审批,返回成功
|
|
|
- taskApp.setSigState(2);
|
|
|
- taskApp.setSignSmg("pdf未获取到关键字Id");
|
|
|
- SignBackPdfInfo(taskApp);
|
|
|
- return;
|
|
|
- }
|
|
|
- // 获取pdf上的电签Ids
|
|
|
- String ids = String.join(",", eVisaConfigList);
|
|
|
- if (taskApp.getRemarkType().equals("1")) { //安心签
|
|
|
- //添加电签策略
|
|
|
- List<SealStrategyVO> strategyListByAXQ = getStrategyListByAXQ(taskApp, ids);
|
|
|
- if(strategyListByAXQ==null || Func.isEmpty(strategyListByAXQ) || strategyListByAXQ.size()==0){
|
|
|
- List<Map<String, Object>> mapList = jdbcTemplate.queryForList("SELECT * from m_textdict_info where type=6 and is_deleted=0 and id in(" + ids + ")");
|
|
|
- if(mapList!=null && mapList.size()>0){
|
|
|
- taskApp.setSigState(2);
|
|
|
- taskApp.setSignSmg("未获取到签字证书信息");
|
|
|
- }else{
|
|
|
- if(taskApp.getSigType()==1){
|
|
|
- taskApp.setSigState(2);
|
|
|
- taskApp.setSignSmg("未获取到签字证书信息");
|
|
|
- }else if(taskApp.getSigType()==2){
|
|
|
- taskApp.setSigState(1);
|
|
|
- taskApp.setSignSmg("签字成功");
|
|
|
- taskApp.setLastFilePdfUrl(taskApp.getSignPdfUrl());
|
|
|
- }
|
|
|
- }
|
|
|
- SignBackPdfInfo(taskApp);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- //调用签字逻辑
|
|
|
- signTaskBatchByAXQZ(strategyListByAXQ, taskApp);
|
|
|
+ if (taskApp.getFlag().equals("OK")) {
|
|
|
+ this.getSignPdfInfo(taskApp);
|
|
|
if (taskApp.getSigState() != 1) {
|
|
|
return;
|
|
|
}
|
|
|
- // 回归处理
|
|
|
- SignBackPdfInfo(taskApp);
|
|
|
- if (taskApp.getSigState() != 1) {
|
|
|
+ this.addSignatureTaskBatch(taskApp);
|
|
|
+ String fileUrl = CommonUtil.replaceOssUrl(taskApp.getSignPdfUrl());
|
|
|
+ List<String> eVisaConfigList = PDFUtils.getPdfSignIds(fileUrl, taskApp);
|
|
|
+ if (eVisaConfigList == null || eVisaConfigList.size() == 0) {
|
|
|
+ //没有电签配置,默认当前任务为不签字审批,返回成功
|
|
|
+ taskApp.setSigState(2);
|
|
|
+ taskApp.setSignSmg("pdf未获取到关键字Id");
|
|
|
+ SignBackPdfInfo(taskApp);
|
|
|
return;
|
|
|
}
|
|
|
- } else if (taskApp.getRemarkType().equals("2")) { //东方中讯
|
|
|
- //添加电签策略
|
|
|
- List<Map<String, Object>> strategyListByDFZX = getStrategyListByDFZX(taskApp, ids);
|
|
|
- //调用签字逻辑
|
|
|
- String s = signTaskBatchByDFZX(strategyListByDFZX, fileUrl,taskApp.getSigType());
|
|
|
- if (s.contains("sucess")) {
|
|
|
- taskApp.setLastFilePdfUrl(s.split("@@@@")[1]);
|
|
|
- taskApp.setSigState(1);
|
|
|
- taskApp.setSignSmg("电签成功");
|
|
|
- } else {
|
|
|
- taskApp.setSigState(2);
|
|
|
- taskApp.setSignSmg("电签中失败");
|
|
|
+ // 获取pdf上的电签Ids
|
|
|
+ String ids = String.join(",", eVisaConfigList);
|
|
|
+ if (taskApp.getRemarkType().equals("1")) { //安心签
|
|
|
+ //添加电签策略
|
|
|
+ List<SealStrategyVO> strategyListByAXQ = getStrategyListByAXQ(taskApp, ids);
|
|
|
+ if (strategyListByAXQ == null || Func.isEmpty(strategyListByAXQ) || strategyListByAXQ.size() == 0) {
|
|
|
+ List<Map<String, Object>> mapList = jdbcTemplate.queryForList("SELECT * from m_textdict_info where type=6 and is_deleted=0 and id in(" + ids + ")");
|
|
|
+ if (mapList != null && mapList.size() > 0) {
|
|
|
+ taskApp.setSigState(2);
|
|
|
+ taskApp.setSignSmg("未获取到签字证书信息");
|
|
|
+ } else {
|
|
|
+ if (taskApp.getSigType() == 1) {
|
|
|
+ taskApp.setSigState(2);
|
|
|
+ taskApp.setSignSmg("未获取到签字证书信息");
|
|
|
+ } else if (taskApp.getSigType() == 2) {
|
|
|
+ taskApp.setSigState(1);
|
|
|
+ taskApp.setSignSmg("签字成功");
|
|
|
+ taskApp.setLastFilePdfUrl(taskApp.getSignPdfUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SignBackPdfInfo(taskApp);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //调用签字逻辑
|
|
|
+ signTaskBatchByAXQZ(strategyListByAXQ, taskApp);
|
|
|
+ if (taskApp.getSigState() != 1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 回归处理
|
|
|
+ SignBackPdfInfo(taskApp);
|
|
|
+ if (taskApp.getSigState() != 1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else if (taskApp.getRemarkType().equals("2")) { //东方中讯
|
|
|
+ //添加电签策略
|
|
|
+ List<Map<String, Object>> strategyListByDFZX = getStrategyListByDFZX(taskApp, ids);
|
|
|
+ //调用签字逻辑
|
|
|
+ String s = signTaskBatchByDFZX(strategyListByDFZX, fileUrl, taskApp.getSigType());
|
|
|
+ if (s.contains("sucess")) {
|
|
|
+ taskApp.setLastFilePdfUrl(s.split("@@@@")[1]);
|
|
|
+ taskApp.setSigState(1);
|
|
|
+ taskApp.setSignSmg("电签成功");
|
|
|
+ } else {
|
|
|
+ taskApp.setSigState(2);
|
|
|
+ taskApp.setSignSmg("电签中失败");
|
|
|
+ SignBackPdfInfo(taskApp);
|
|
|
+ }
|
|
|
+ // 回归处理
|
|
|
SignBackPdfInfo(taskApp);
|
|
|
}
|
|
|
- // 回归处理
|
|
|
- SignBackPdfInfo(taskApp);
|
|
|
+ } else{ //废除
|
|
|
+ // 修改 主 任务 u_task 表 状态改为3
|
|
|
+ String up_task_par = "update u_task_parallel set status=3 where parallel_process_instance_id='"+taskApp.getParallelProcessInstanceId()+"'";
|
|
|
+ String up_task = "update u_task set status=3 where id='"+taskApp.getTaskId()+"'";
|
|
|
+ this.jdbcTemplate.execute("delete from u_task_batch where id="+taskApp.getId());
|
|
|
+ jdbcTemplate.execute(up_task_par);
|
|
|
+ jdbcTemplate.execute(up_task);
|
|
|
+
|
|
|
+ if(taskApp.getApprovalType() == 3){
|
|
|
+ jdbcTemplate.execute("update u_contract_log set status=0 where id='"+taskApp.getFormDataId()+"'");
|
|
|
+ }else if (taskApp.getApprovalType()==8) {
|
|
|
+ this.jdbcTemplate.execute("update u_entrust_info set status=1 where id=(SELECT wbs_id from u_information_query where id='"+taskApp.getFormDataId()+"')");
|
|
|
+ }else {
|
|
|
+ jdbcTemplate.execute("update u_information_query set e_visa_pdf_url='',status=0 where id='"+taskApp.getFormDataId()+"'");
|
|
|
+ }
|
|
|
+ RedisTemplate.delete("sign-" + taskApp.getFormDataId());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public void addSignatureTaskBatch(TaskSignInfoVO taskApp) {
|
|
|
// 添加签字任务
|
|
|
- if(taskApp.getSigType()==1){
|
|
|
- String sql = "SELECT * from u_task_batch where JSON_EXTRACT(json_data, '$.taskId')="+taskApp.getTaskId()+" and sign_type=2";
|
|
|
+ if (taskApp.getSigType() == 1) {
|
|
|
+ String sql = " SELECT * from u_task_batch where sign_type=2 and (JSON_EXTRACT(json_data, '$.taskId')='" + taskApp.getTaskId() + "' or JSON_EXTRACT(json_data, '$.taskId')=" + taskApp.getTaskId() + ")";
|
|
|
List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
|
- String id = SnowFlakeUtil.getId()+"";
|
|
|
- if(maps==null || maps.size()==0){
|
|
|
- String sql2 ="INSERT into u_task_batch(id,task_parallel_id,json_data,create_user,create_dept,create_time,update_user,update_time,status,is_deleted,nick_name,sign_format,sign_type)" +
|
|
|
- "SELECT "+id+" as id,task_parallel_id,json_data,create_user,create_dept,create_time,update_user,update_time,status,is_deleted,nick_name,sign_format,2 as sign_type from u_task_batch where id="+taskApp.getId()+"";
|
|
|
+ String id = SnowFlakeUtil.getId() + "";
|
|
|
+ if (maps == null || maps.size() == 0) {
|
|
|
+ String sql2 = "INSERT into u_task_batch(id,task_parallel_id,json_data,create_user,create_dept,create_time,update_user,update_time,status,is_deleted,nick_name,sign_format,sign_type)" +
|
|
|
+ "SELECT " + id + " as id,task_parallel_id,json_data,create_user,create_dept,create_time,update_user,update_time,status,is_deleted,nick_name,sign_format,2 as sign_type from u_task_batch where id=" + taskApp.getId() + "";
|
|
|
jdbcTemplate.execute(sql2);
|
|
|
}
|
|
|
}
|
|
|
// 计量签字时,需要 把 审计的任务改为已经审批
|
|
|
- if(taskApp.getApprovalType()==5 || taskApp.getApprovalType()==6 || taskApp.getApprovalType()==7){
|
|
|
+ if (taskApp.getApprovalType() == 5 || taskApp.getApprovalType() == 6 || taskApp.getApprovalType() == 7) {
|
|
|
String UPSqlJL = " update u_task_parallel a set a.e_visa_status=1,e_visa_content='电签成功',initiative=2 where sort in( SELECT a.fixed_flow_branch_sort from u_task b,u_fixed_flow_link a where b.`status` in(1,2) and b.id='" + taskApp.getTaskId() + "' and a.fixed_flow_id=b.fixed_flow_id and a.flow_task_type=2 ) and a.process_instance_id in(SELECT process_instance_id from u_task b where b.`status` in(1,2) and b.id='" + taskApp.getTaskId() + "')";
|
|
|
jdbcTemplate.execute(UPSqlJL);
|
|
|
}
|
|
@@ -197,7 +213,7 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
}
|
|
|
|
|
|
FileUtils.mergePdfPublicMethods(datainfo, listPdf);
|
|
|
- if("20".equals(sys_isonline) || SystemUtils.isWindows() || SystemUtils.isMacOs()){
|
|
|
+ if ("20".equals(sys_isonline) || SystemUtils.isWindows() || SystemUtils.isMacOs()) {
|
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(taskApp.getFormDataId() + ".pdf", listPdf);
|
|
|
if (bladeFile != null && Func.isNotEmpty(bladeFile.getLink())) {
|
|
|
nodePdfUrl = bladeFile.getLink();
|
|
@@ -217,14 +233,14 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
String pdfTrialUrlPosition = "";
|
|
|
if ("2".equals(taskApp.getPdfDataType())) {
|
|
|
String taskStatus = "";
|
|
|
- if (taskApp.getSigState() == 1 && taskApp.getSigType()==1) {
|
|
|
+ if (taskApp.getSigState() == 1 && taskApp.getSigType() == 1) {
|
|
|
taskStatus = "待审批";
|
|
|
- } else if (taskApp.getSigState() == 1 && taskApp.getSigType()==2) {
|
|
|
+ } else if (taskApp.getSigState() == 1 && taskApp.getSigType() == 2) {
|
|
|
taskStatus = "已审批";
|
|
|
} else if (taskApp.getSigState() == 3) {
|
|
|
taskStatus = "已废除";
|
|
|
}
|
|
|
- String updTrial = "update u_trial_self_inspection_record set status="+taskApp.getSigType()+", task_status='" + taskStatus + "',pdf_url='" + taskApp.getLastFilePdfUrl() + "' where id=(select b.trial_self_inspection_record_id from u_task b,u_task_parallel c where b.process_instance_id=c.process_instance_id and b.is_deleted=0 and c.is_deleted=0 and b.status in(1,2) and parallel_process_instance_id='" + taskApp.getParallelProcessInstanceId() + "')";
|
|
|
+ String updTrial = "update u_trial_self_inspection_record set status=" + taskApp.getSigType() + ", task_status='" + taskStatus + "',pdf_url='" + taskApp.getLastFilePdfUrl() + "' where id=(select b.trial_self_inspection_record_id from u_task b,u_task_parallel c where b.process_instance_id=c.process_instance_id and b.is_deleted=0 and c.is_deleted=0 and b.status in(1,2) and parallel_process_instance_id='" + taskApp.getParallelProcessInstanceId() + "')";
|
|
|
jdbcTemplate.execute(updTrial);
|
|
|
|
|
|
/**
|
|
@@ -357,7 +373,7 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
} else if ("3".equals(type)) {
|
|
|
//首件,首件的资料由三个部分组成:封面、关联资料、总结报告
|
|
|
if (StringUtils.isNotEmpty(eVisaPdfUrl) || StringUtils.isNotEmpty(pdfUrl)) {
|
|
|
- String url = eVisaPdfUrl.length()>=10 ? eVisaPdfUrl : pdfUrl;
|
|
|
+ String url = eVisaPdfUrl.length() >= 10 ? eVisaPdfUrl : pdfUrl;
|
|
|
String s = getHppsToHttp(url);
|
|
|
taskApp.setSignPdfUrl(s);
|
|
|
}
|
|
@@ -368,7 +384,7 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
String eVisaPdfUrl = map.get("pdf_file_url") + ""; //签字的PDF路径
|
|
|
String pdfUrl = map.get("file_url") + ""; //合并后的PDF路径
|
|
|
if (StringUtils.isNotEmpty(eVisaPdfUrl) || StringUtils.isNotEmpty(pdfUrl)) {
|
|
|
- String url = eVisaPdfUrl.length()>=10 ? eVisaPdfUrl : pdfUrl;
|
|
|
+ String url = eVisaPdfUrl.length() >= 10 ? eVisaPdfUrl : pdfUrl;
|
|
|
taskApp.setSignPdfUrl(url);
|
|
|
}
|
|
|
} else if (taskApp.getApprovalType() == 3) {
|
|
@@ -376,7 +392,7 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
String eVisaPdfUrl = map.get("e_visa_pdf_url") + ""; //签字的PDF路径
|
|
|
String pdfUrl = map.get("pdf_url") + ""; //合并后的PDF路径
|
|
|
if (StringUtils.isNotEmpty(eVisaPdfUrl) || StringUtils.isNotEmpty(pdfUrl)) {
|
|
|
- String url = eVisaPdfUrl.length()>=10 ? eVisaPdfUrl : pdfUrl;
|
|
|
+ String url = eVisaPdfUrl.length() >= 10 ? eVisaPdfUrl : pdfUrl;
|
|
|
taskApp.setSignPdfUrl(url);
|
|
|
}
|
|
|
} else if (taskApp.getApprovalType() == 4) { //档案走自定义 搓章的问题
|
|
@@ -440,9 +456,9 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
String sqlinfo = " SELECT * from ( SELECT a.id as keyWord,a.project_id,a.pyzbx ,a.pyzby,(SELECT acc_code from blade_user where id='" + task.getUserId() + "' and is_deleted=0 ) as sealId from m_textdict_info a where a.type =2 and a.id in (" + ids + ") and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c where c.contract_id=" + task.getContractId() + " and user_id=" + task.getUserId() + " and c.is_deleted=0 ) ) x where x.sealId is not null ";
|
|
|
if (task.getSigType() == 2) {
|
|
|
sqlinfo = "SELECT a.id as keyWord,a.pyzbx,a.pyzby,b.certificate_number as sealId from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + task.getContractId() + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + ids + ")";
|
|
|
- System.out.println("东方中讯--签章--"+sqlinfo);
|
|
|
- }else{
|
|
|
- System.out.println("东方中讯--签字--"+sqlinfo);
|
|
|
+ System.out.println("东方中讯--签章--" + sqlinfo);
|
|
|
+ } else {
|
|
|
+ System.out.println("东方中讯--签字--" + sqlinfo);
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> maps2 = jdbcTemplate.queryForList(sqlinfo);
|
|
@@ -474,11 +490,11 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
// 添加电签策略 -- 安心签
|
|
|
public List<SealStrategyVO> getStrategyListByAXQ(TaskSignInfoVO task, String ids) {
|
|
|
List<SealStrategyVO> sealStrategyVOS = new ArrayList<>();
|
|
|
- String sqlinfo = "SELECT * from ( SELECT DISTINCT a.id,a.pyzbx ,a.pyzby,a.project_id,(SELECT signature_file_url from m_sign_pfx_file where is_register=1 and certificate_user_id='" + task.getUserId() + "' and is_deleted=0 ) as signature_file_url, (SELECT wide from m_sign_pfx_file where is_register=1 and certificate_user_id='" + task.getUserId() + "' and is_deleted=0 ) as wide ,(SELECT high from m_sign_pfx_file where is_register=1 and certificate_user_id='"+task.getUserId()+"' and is_deleted=0 ) as high from m_textdict_info a where a.type =2 and a.id in (" + ids + ") and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c where c.contract_id=" + task.getContractId() + " and user_id=" + task.getUserId() + " and c.is_deleted=0 ) ) x where x.signature_file_url is not null and x.project_id="+task.getProjectId()+" ";
|
|
|
+ String sqlinfo = "SELECT * from ( SELECT DISTINCT a.id,a.pyzbx ,a.pyzby,a.project_id,(SELECT signature_file_url from m_sign_pfx_file where is_register=1 and certificate_user_id='" + task.getUserId() + "' and is_deleted=0 ) as signature_file_url, (SELECT wide from m_sign_pfx_file where is_register=1 and certificate_user_id='" + task.getUserId() + "' and is_deleted=0 ) as wide ,(SELECT high from m_sign_pfx_file where is_register=1 and certificate_user_id='" + task.getUserId() + "' and is_deleted=0 ) as high from m_textdict_info a where a.type =2 and a.id in (" + ids + ") and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c where c.contract_id=" + task.getContractId() + " and user_id=" + task.getUserId() + " and c.is_deleted=0 ) ) x where x.signature_file_url is not null and x.project_id=" + task.getProjectId() + " ";
|
|
|
if (task.getSigType() == 2) {
|
|
|
- sqlinfo = "SELECT a.id,a.pyzbx,a.pyzby,b.signature_file_url,b.id as sfId,a.project_id,b.certificate_password,b.certificate_user_name,b.certificate_number ,b.wide,b.high from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + task.getContractId() + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + ids + ") and a.project_id="+task.getProjectId()+"";
|
|
|
+ sqlinfo = "SELECT a.id,a.pyzbx,a.pyzby,b.signature_file_url,b.id as sfId,a.project_id,b.certificate_password,b.certificate_user_name,b.certificate_number ,b.wide,b.high from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + task.getContractId() + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + ids + ") and a.project_id=" + task.getProjectId() + "";
|
|
|
System.out.println("安心签--签章--=" + sqlinfo);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
System.out.println("安心签--签字--=" + sqlinfo);
|
|
|
}
|
|
|
List<Map<String, Object>> maps2 = jdbcTemplate.queryForList(sqlinfo);
|
|
@@ -554,7 +570,7 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
}
|
|
|
|
|
|
// 添加电签策略 -- 东方中讯
|
|
|
- public String signTaskBatchByDFZX(List<Map<String, Object>> maps, String pdfUrl,int type) {
|
|
|
+ public String signTaskBatchByDFZX(List<Map<String, Object>> maps, String pdfUrl, int type) {
|
|
|
if (maps != null && maps.size() > 0) {
|
|
|
String fileUrl = pdfUrl;
|
|
|
for (Map<String, Object> dataMap : maps) {
|
|
@@ -562,7 +578,7 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
daMa.put("keyWord", dataMap.get("keyWord"));
|
|
|
daMa.put("sealId", dataMap.get("sealId"));
|
|
|
// 设置图片显示大小
|
|
|
- if(type!=2){ //章
|
|
|
+ if (type != 2) { //章
|
|
|
daMa.put("showHeight", 30);
|
|
|
daMa.put("showWidth", 60);
|
|
|
}
|
|
@@ -713,7 +729,7 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
|
|
|
public String getHppsToHttp(String url) {
|
|
|
String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
|
|
|
- if (Func.isNotEmpty(sys_isonline) &&url.contains("https:") && sys_isonline.equals("20")) {
|
|
|
+ if (Func.isNotEmpty(sys_isonline) && url.contains("https:") && sys_isonline.equals("20")) {
|
|
|
return url.replace("https:", "http:");
|
|
|
}
|
|
|
return url;
|