|
@@ -5,17 +5,28 @@ import cfca.paperless.base.util.Base64;
|
|
|
|
|
|
|
|
|
import cn.hutool.core.io.file.FileReader;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springblade.business.entity.ArchiveFile;
|
|
|
+import org.springblade.business.entity.ContractLog;
|
|
|
+import org.springblade.business.entity.InformationQuery;
|
|
|
+import org.springblade.business.entity.TrialSelfInspectionRecord;
|
|
|
import org.springblade.business.feign.TaskClient;
|
|
|
+import org.springblade.business.vo.TaskApprovalVO;
|
|
|
import org.springblade.business.vo.TaskSignInfoVO;
|
|
|
+import org.springblade.business.vo.TrialRawMaterialSelfRecord;
|
|
|
+import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.constant.EVisaConstant;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
+import org.springblade.core.launch.StartEventListener;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
+import org.springblade.core.tool.utils.ResourceUtil;
|
|
|
import org.springblade.evisa.service.EVDataService;
|
|
|
import org.springblade.evisa.service.EVisaService;
|
|
|
import org.springblade.evisa.utils.FileUtils;
|
|
@@ -25,8 +36,10 @@ import org.springblade.evisa.vo.*;
|
|
|
import org.springblade.manager.entity.ProjectInfo;
|
|
|
import org.springblade.manager.feign.ProjectClient;
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
|
+import org.springblade.system.cache.ParamCache;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -49,6 +62,8 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
|
|
|
@Autowired
|
|
|
StringRedisTemplate RedisTemplate;
|
|
|
+ @Autowired
|
|
|
+ private StartEventListener startEventListener;
|
|
|
|
|
|
/**
|
|
|
* 电签主要流程
|
|
@@ -62,38 +77,46 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
if (taskApp.getSigState() != 1) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+ String sql = "SELECT a.* from u_task_parallel a where a.process_instance_id=(SELECT process_instance_id from u_task_parallel b where b.parallel_process_instance_id='" + taskApp.getParallelProcessInstanceId() + "') and is_deleted=0 and initiative<>2 ";
|
|
|
String fileUrl = CommonUtil.replaceOssUrl(taskApp.getSignPdfUrl());
|
|
|
- List<String> eVisaConfigList = PDFUtils.getPdfSignIds(fileUrl);
|
|
|
+ List<String> eVisaConfigList = PDFUtils.getPdfSignIds(fileUrl,taskApp);
|
|
|
String ids = String.join(",", eVisaConfigList);
|
|
|
- if (taskApp.getRemarkType().equals("1")) { //安心签
|
|
|
- //添加电签策略
|
|
|
- List<SealStrategyVO> strategyListByAXQ = getStrategyListByAXQ(taskApp, ids);
|
|
|
- if (taskApp.getSigState() != 1) {
|
|
|
- return;
|
|
|
- }
|
|
|
- //调用签字逻辑
|
|
|
- signTaskBatchByAXQZ(strategyListByAXQ, taskApp);
|
|
|
- if (taskApp.getSigState() != 1) {
|
|
|
+ List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
|
+ if(maps!=null && maps.size()>=1) {
|
|
|
+ if (eVisaConfigList == null || eVisaConfigList.size() == 0) {
|
|
|
+ //没有电签配置,默认当前任务为不签字审批,返回成功
|
|
|
+ taskApp.setSigState(2);
|
|
|
+ taskApp.setSignSmg("pdf未获取到关键字Id");
|
|
|
+ SignBackPdfInfo(taskApp);
|
|
|
return;
|
|
|
}
|
|
|
- // 回归处理
|
|
|
- SignBackPdfInfo(taskApp);
|
|
|
- if (taskApp.getSigState() != 1) {
|
|
|
- return;
|
|
|
+ if (taskApp.getRemarkType().equals("1")) { //安心签
|
|
|
+ //添加电签策略
|
|
|
+ List<SealStrategyVO> strategyListByAXQ = getStrategyListByAXQ(taskApp, ids);
|
|
|
+ if (taskApp.getSigState() != 1) {
|
|
|
+ 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);
|
|
|
+ //调用签字逻辑
|
|
|
+ signTaskBatchByDFZX(strategyListByDFZX, fileUrl);
|
|
|
+ // 回归处理
|
|
|
+ SignBackPdfInfo(taskApp);
|
|
|
}
|
|
|
- } else if (taskApp.getRemarkType().equals("2")) { //东方中讯
|
|
|
- //添加电签策略
|
|
|
- List<Map<String, Object>> strategyListByDFZX = getStrategyListByDFZX(taskApp, ids);
|
|
|
- //调用签字逻辑
|
|
|
- signTaskBatchByDFZX(strategyListByDFZX, fileUrl);
|
|
|
- // 回归处理
|
|
|
- SignBackPdfInfo(taskApp);
|
|
|
}
|
|
|
-
|
|
|
// 判断签章信息
|
|
|
- String sql = "SELECT a.* from u_task_parallel a where a.process_instance_id=(SELECT process_instance_id from u_task_parallel b where b.parallel_process_instance_id='" + taskApp.getParallelProcessInstanceId() + "') and is_deleted=0 and initiative<>2 ";
|
|
|
- List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
|
+ maps = jdbcTemplate.queryForList(sql);
|
|
|
if (maps == null || maps.size() == 0) {
|
|
|
taskApp.setSigType(2);
|
|
|
if (taskApp.getRemarkType().equals("1")) { //安心签
|
|
@@ -108,7 +131,7 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
//添加电签策略
|
|
|
List<Map<String, Object>> strategyListByDFZX = getStrategyListByDFZX(taskApp, ids);
|
|
|
//调用签字逻辑
|
|
|
- signTaskBatchByDFZX(strategyListByDFZX, fileUrl);
|
|
|
+ signTaskBatchByDFZX(strategyListByDFZX, taskApp.getLastFilePdfUrl());
|
|
|
// 回归处理
|
|
|
SignBackPdfInfo(taskApp);
|
|
|
}
|
|
@@ -123,50 +146,146 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
//档案:4档案数据 ,
|
|
|
//计量: 5中间计量申请,6材料计量单 ,7开工预付款计量单, 8变更令
|
|
|
try {
|
|
|
- if (taskApp.getApprovalType() == 1) {
|
|
|
- if (taskApp.getSigType() == 2) {
|
|
|
- this.jdbcTemplate.execute("update u_information_query set e_visa_pdf_url='" + taskApp.getLastFilePdfUrl() + "',status=2,update_time=SYSDATE() where id='" + taskApp.getFormDataId() + "' ");
|
|
|
- this.jdbcTemplate.execute("update u_task set status=2,update_time=SYSDATE() where id=" + taskApp.getId());
|
|
|
- } else {
|
|
|
- this.jdbcTemplate.execute("update u_information_query set e_visa_pdf_url='" + taskApp.getLastFilePdfUrl() + "', update_time=SYSDATE() where id='" + taskApp.getFormDataId() + "'");
|
|
|
- this.jdbcTemplate.execute("update u_task_parallel set status=2,initiative=2 ,update_time=SYSDATE() where parallel_process_instance_id='" + taskApp.getParallelProcessInstanceId() + "'");
|
|
|
- this.jdbcTemplate.execute("delete from u_task_batch where id=" + taskApp.getId());
|
|
|
- RedisTemplate.delete("sign-" + taskApp.getFormDataId());
|
|
|
- }
|
|
|
-
|
|
|
- } else if (taskApp.getApprovalType() == 2) {
|
|
|
-
|
|
|
- } else if (taskApp.getApprovalType() == 3) {
|
|
|
-
|
|
|
- } else if (taskApp.getApprovalType() == 4) {
|
|
|
+ //电签成功
|
|
|
+ if (taskApp.getSigState() == 1) { //签字成功
|
|
|
+ String updateSql = "";
|
|
|
+ if(taskApp.getApprovalType() == 1 ){ //
|
|
|
+ //
|
|
|
+ String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
|
|
|
+ String pdfPage = "";
|
|
|
+ Long pdfSize = 0L;
|
|
|
+ String nodePdfUrl = "";
|
|
|
+
|
|
|
+ List<Map<String, Object>> mapList = jdbcTemplate.queryForList("select *,domain_url as url from m_table_file where is_deleted = 0 and type in (10,11,12) and tab_id = (select wbs_id from u_information_query WHERE id = + "+taskApp.getFormDataId()+")");
|
|
|
+ if(Func.isNotEmpty(mapList)&&mapList.size()>=1) {
|
|
|
+ String file_path = FileUtils.getSysLocalFileUrl();
|
|
|
+ List<String> datainfo = new ArrayList<>();
|
|
|
+ datainfo.add(taskApp.getLastFilePdfUrl());
|
|
|
+ for (Map<String, Object> tabsx : mapList) {
|
|
|
+ datainfo.add(tabsx.get("url") + "");
|
|
|
+ }
|
|
|
+ String listPdf = file_path + "/nodePDF/" + taskApp.getFormDataId() + ".pdf";
|
|
|
+ File tabpdf2 = ResourceUtil.getFile(listPdf);
|
|
|
+ if (tabpdf2.exists()) {
|
|
|
+ tabpdf2.delete();
|
|
|
+ }
|
|
|
+
|
|
|
+ FileUtils.mergePdfPublicMethods(datainfo, listPdf);
|
|
|
+ if (sys_isonline.equals("20")) {
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(taskApp.getFormDataId() + ".pdf", listPdf);
|
|
|
+ if (bladeFile != null && Func.isNotEmpty(bladeFile.getLink())) {
|
|
|
+ nodePdfUrl = bladeFile.getLink();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ nodePdfUrl = FileUtils.getNetUrl(listPdf);
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ nodePdfUrl = taskApp.getLastFilePdfUrl();
|
|
|
+ }
|
|
|
|
|
|
- } else if (taskApp.getApprovalType() == 5) {
|
|
|
- if (taskApp.getSigState() == 1) { //成功
|
|
|
- this.jdbcTemplate.execute("update s_interim_pay_certificate set approve_status=" + taskApp.getSigType() + ",update_time=SYSDATE(), raw_url='" + taskApp.getLastFilePdfUrl() + "' where contract_period_id = " + taskApp.getFormDataId());
|
|
|
- this.jdbcTemplate.execute("update u_task_parallel set e_visa_status=1,e_visa_content='" + taskApp.getSignSmg() + "' , status=2 , initiative=2 ,update_time=SYSDATE() where parallel_process_instance_id='" + taskApp.getParallelProcessInstanceId() + "'");
|
|
|
- this.jdbcTemplate.execute("update u_task set status=" + taskApp.getSigType() + " ,update_time=SYSDATE() where id='" + taskApp.getTaskId() + "'");
|
|
|
- this.jdbcTemplate.execute("delete from u_task_batch where id=" + taskApp.getId());
|
|
|
- } else {
|
|
|
- this.jdbcTemplate.execute("update s_interim_pay_certificate set approve_status=1,update_time=SYSDATE() where contract_period_id = " + taskApp.getFormDataId());
|
|
|
- this.jdbcTemplate.execute("update u_task_parallel set exe_count=(exe_count+1), e_visa_status=99,e_visa_content='" + taskApp.getSignSmg() + "' ,update_time=SYSDATE() where parallel_process_instance_id='" + taskApp.getParallelProcessInstanceId() + "'");
|
|
|
- this.jdbcTemplate.execute("update u_task set status=1 ,update_time=SYSDATE() where id='" + taskApp.getTaskId() + "'");
|
|
|
- if(totalCount>=3){
|
|
|
- this.jdbcTemplate.execute("delete from u_task_batch where id=" + taskApp.getId());
|
|
|
+ pdfPage = FileUtils.getPdfNum(nodePdfUrl);
|
|
|
+ pdfSize = CommonUtil.getResourceLength(nodePdfUrl);
|
|
|
+
|
|
|
+ // 实验时
|
|
|
+ String pdfTrialUrlPosition = "";
|
|
|
+ if("2".equals(taskApp.getPdfDataType())){
|
|
|
+ String taskStatus = "";
|
|
|
+ if(taskApp.getSigState()==1){
|
|
|
+ taskStatus = "待审批";
|
|
|
+ } else if (taskApp.getSigState()==2) {
|
|
|
+ taskStatus = "已审批";
|
|
|
+ } else if (taskApp.getSigState()==3) {
|
|
|
+ taskStatus = "已废除";
|
|
|
+ }
|
|
|
+ String updTrial = "update u_trial_self_inspection_record set 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);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 在资料填报工序-预览全部pdf时再拼接合并显示,当前只做储存(如果当前资料填报工序节点有其他多个试验记录pdf关联信息,那么合并存储,否则直接存储)
|
|
|
+ */
|
|
|
+
|
|
|
+ String redoe = " select * from u_trial_self_inspection_record 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()+")";
|
|
|
+ TrialSelfInspectionRecord record = jdbcTemplate.query(redoe, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class)).stream().findAny().orElse(null);
|
|
|
+ if (("已审批").equals(record.getTaskStatus()) && (new Integer(1)).equals(record.getDetectionResult()) && (new Integer(1)).equals(record.getDetectionCategory())) {
|
|
|
+ if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotEmpty(record.getProjectPosition())) {
|
|
|
+ //有pdf的节点
|
|
|
+ String sqlNodeAll = "select wbs_id from u_information_query where wbs_id in(" + record.getProjectPosition() + ") and contract_id = " + record.getContractId();
|
|
|
+ List<Long> collect = jdbcTemplate.query(sqlNodeAll, new BeanPropertyRowMapper<>(InformationQuery.class)).stream().map(InformationQuery::getWbsId).collect(Collectors.toList());
|
|
|
+ if (collect.size() > 0) {
|
|
|
+ //删除当前记录关联记录
|
|
|
+ jdbcTemplate.execute("delete from u_trial_self_quality_project where self_id = "+record.getId()+"");
|
|
|
+ for (Long pKeyId : collect) {
|
|
|
+ //新增当前记录关联信息
|
|
|
+ jdbcTemplate.execute("insert into u_trial_self_quality_project(id,self_id,quality_node_id) values("+SnowFlakeUtil.getId()+","+record.getId()+","+pKeyId+") ");
|
|
|
+
|
|
|
+ //获取当前工程部位节点最新的关联试验记录ids
|
|
|
+ String sqlIds = "select self_id from u_trial_self_quality_project where quality_node_id = "+pKeyId+"";
|
|
|
+ List<Map<String, Object>> trialRecordIds = jdbcTemplate.queryForList(sqlNodeAll);
|
|
|
+
|
|
|
+
|
|
|
+ //如果当前工程部位节点的关联试验记录id只有一条,且等于当前关联试验记录id,那么不合并,直接存储该条试验记录的pdf
|
|
|
+ if (trialRecordIds.size() == 1 && (trialRecordIds.get(0).get("self_id")).equals(record.getId().toString())) {
|
|
|
+ //修改当前试验pdf到质检树节点的pdf_trial_url_position上存储
|
|
|
+ pdfTrialUrlPosition = record.getPdfUrl() ;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果当前工程部位节点的关联试验记录id有多条,那么合并
|
|
|
+ String dataSql = "select * from u_trial_self_inspection_record where id in(select self_id from u_trial_self_quality_project where quality_node_id = "+pKeyId+")";
|
|
|
+ List<TrialSelfInspectionRecord> pdfUrlList = jdbcTemplate.queryForList(redoe, TrialSelfInspectionRecord.class);
|
|
|
+ List<String> pdfS = pdfUrlList.stream().filter(f -> com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotEmpty(f.getPdfUrl())).map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
|
|
|
+ if (ObjectUtil.isNotEmpty(pdfS) && pdfS.size() > 0) {
|
|
|
+ String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ String listPdf = filePath + "/pdf/" + pKeyId + ".pdf";
|
|
|
+ File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
+ if (tabPDF.exists()) {
|
|
|
+ tabPDF.delete();
|
|
|
+ }
|
|
|
+
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfS, listPdf);
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(pKeyId + ".pdf", listPdf);
|
|
|
+ if (bladeFile != null) {
|
|
|
+ //修改合并的试验pdf到质检树节点的pdf_trial_url_position上存储
|
|
|
+ pdfTrialUrlPosition = bladeFile.getLink();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ updateSql = "update u_information_query set pdf_trial_url_position='"+pdfTrialUrlPosition+"',business_time='"+taskApp.getPdfDate()+"',node_pdf_url='"+nodePdfUrl+"',e_visa_pdf_page="+pdfPage+",e_visa_pdf_size="+pdfSize+",e_visa_pdf_url='" + taskApp.getLastFilePdfUrl() + "',status='" + taskApp.getSigType() + "',update_time=SYSDATE() where id='" + taskApp.getFormDataId() + "' " ;
|
|
|
+ } else if (taskApp.getApprovalType() == 2) {
|
|
|
+ updateSql = "update u_archive_file set e_visa_file='" + taskApp.getLastFilePdfUrl() + "',status='" + taskApp.getSigType() + "',update_time=SYSDATE() where id='" + taskApp.getFormDataId() + "' " ;
|
|
|
+ } else if (taskApp.getApprovalType() == 3) { // 日志
|
|
|
+ updateSql = "update u_contract_log set e_visa_pdf_url='" + taskApp.getLastFilePdfUrl() + "',status='" + taskApp.getSigType() + "',update_time=SYSDATE() where id='" + taskApp.getFormDataId() + "' " ;
|
|
|
+ } else if (taskApp.getApprovalType() == 5) { //中期计量支付证书
|
|
|
+ updateSql = "update s_interim_pay_certificate set approve_status=" + taskApp.getSigType() + ",update_time=SYSDATE(), raw_url='" + taskApp.getLastFilePdfUrl() + "' where contract_period_id = " + taskApp.getFormDataId();
|
|
|
+ } else if (taskApp.getApprovalType() == 6 || taskApp.getApprovalType() == 7) {
|
|
|
+ updateSql = "update s_material_start_statement set raw_url='" + taskApp.getLastFilePdfUrl() + "' where meter_period_id = " + taskApp.getFormDataId();
|
|
|
+ } else if (taskApp.getApprovalType() == 8){
|
|
|
+ if (taskApp.getSigType() == 2) {
|
|
|
+ this.jdbcTemplate.execute("update u_entrust_info set sample_status=2,status=" + (taskApp.getSigType() + 1) + ",entrust_e_pdf='" + taskApp.getLastFilePdfUrl() + "' where id=(SELECT wbs_id from u_information_query where id='" + taskApp.getFormDataId() + "')");
|
|
|
+ }
|
|
|
+ updateSql = "update u_information_query set e_visa_pdf_url='" + taskApp.getLastFilePdfUrl() + "',status=" + taskApp.getSigType() + " where id='" + taskApp.getFormDataId() + "'";
|
|
|
}
|
|
|
- RedisTemplate.delete("sign-" + taskApp.getFormDataId());
|
|
|
- } else if (taskApp.getApprovalType() == 6 || taskApp.getApprovalType() == 7) {
|
|
|
- this.jdbcTemplate.execute("update s_material_start_statement set raw_url='" + taskApp.getLastFilePdfUrl() + "' where meter_period_id = " + taskApp.getFormDataId());
|
|
|
- this.jdbcTemplate.execute("delete from u_task_batch where id=" + taskApp.getId());
|
|
|
- RedisTemplate.delete("sign-" + taskApp.getFormDataId());
|
|
|
- } else if (taskApp.getApprovalType() == 8) {
|
|
|
- if (taskApp.getSigType() == 2) {
|
|
|
- this.jdbcTemplate.execute("update u_entrust_info set sample_status=2,status=" + (taskApp.getSigType() + 1) + ",entrust_e_pdf='" + taskApp.getLastFilePdfUrl() + "' where id=(SELECT wbs_id from u_information_query where id='" + taskApp.getFormDataId() + "')");
|
|
|
+ this.jdbcTemplate.execute(updateSql);
|
|
|
+ this.jdbcTemplate.execute("update u_task_parallel set e_visa_status=1,e_visa_content='" + taskApp.getSignSmg() + "' , status=2 , initiative=2 ,update_time=SYSDATE() where parallel_process_instance_id='" + taskApp.getParallelProcessInstanceId() + "'");
|
|
|
+ this.jdbcTemplate.execute("update u_task set status=" + taskApp.getSigType() + " ,update_time=SYSDATE() where id='" + taskApp.getTaskId() + "'");
|
|
|
+ if(taskApp.getSigType()==2){
|
|
|
+ this.jdbcTemplate.execute("delete from u_task_batch where JSON_EXTRACT(json_data, '$.taskId')=" + taskApp.getTaskId());
|
|
|
+ }else{
|
|
|
+ this.jdbcTemplate.execute("delete from u_task_batch where id=" + taskApp.getId());
|
|
|
+ }
|
|
|
+ }else{ //签字失败
|
|
|
+ this.jdbcTemplate.execute("update u_task_parallel set exe_count=(exe_count+1), e_visa_status=99,e_visa_content='" + taskApp.getSignSmg() + "' ,update_time=SYSDATE() where parallel_process_instance_id='" + taskApp.getParallelProcessInstanceId() + "'");
|
|
|
+ this.jdbcTemplate.execute("update u_task set status=1 ,update_time=SYSDATE() where id='" + taskApp.getTaskId() + "'");
|
|
|
+ if(totalCount>=3){
|
|
|
+ this.jdbcTemplate.execute("delete from u_task_batch where id=" + taskApp.getId());
|
|
|
}
|
|
|
- jdbcTemplate.execute("update u_information_query set e_visa_pdf_url='" + taskApp.getLastFilePdfUrl() + "',status=" + taskApp.getSigType() + " where id='" + taskApp.getFormDataId() + "'");
|
|
|
- this.jdbcTemplate.execute("delete from u_task_batch where id=" + taskApp.getId());
|
|
|
- RedisTemplate.delete("sign-" + taskApp.getFormDataId());
|
|
|
}
|
|
|
+ RedisTemplate.delete("sign-" + taskApp.getFormDataId());
|
|
|
} catch (Exception e) {
|
|
|
taskApp.setSigState(2);
|
|
|
taskApp.setSignSmg("修改业务数据异常-请联系开发人员");
|
|
@@ -175,7 +294,6 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 获取pdf 文件
|
|
|
public void getSignPdfInfo(TaskSignInfoVO taskApp) {
|
|
|
//上报类型: 1填报资料,2工程文件,3日志资料
|
|
@@ -185,40 +303,75 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
taskApp.setSigState(1);
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
try {
|
|
|
- if (taskApp.getApprovalType() == 1) {
|
|
|
+ if (taskApp.getApprovalType() == 1 || taskApp.getApprovalType() == 8) {
|
|
|
map = this.jdbcTemplate.queryForMap("select * from u_information_query where is_deleted=0 and id = " + taskApp.getFormDataId());
|
|
|
- String url = StringUtils.isNotEmpty(map.get("e_visa_pdf_url") + "") ? map.get("e_visa_pdf_url") + "" : map.get("pdf_url") + "";
|
|
|
- taskApp.setSignPdfUrl(url);
|
|
|
- taskApp.setContractId(map.get("contract_id") + "");
|
|
|
- taskApp.setProjectId(map.get("project_id") + "");
|
|
|
- } else if (taskApp.getApprovalType() == 2) {
|
|
|
- map = this.jdbcTemplate.queryForMap("select * from u_information_query where is_deleted=0 and id = " + taskApp.getFormDataId());
|
|
|
- String url = StringUtils.isNotEmpty(map.get("e_visa_pdf_url") + "") ? map.get("e_visa_pdf_url") + "" : map.get("pdf_url") + "";
|
|
|
- taskApp.setSignPdfUrl(url);
|
|
|
- taskApp.setContractId(map.get("contract_id") + "");
|
|
|
- taskApp.setProjectId(map.get("project_id") + "");
|
|
|
+ String pdfTrialUrlPosition = map.get("pdf_trial_url_position")+""; //关联工程部位信息后合并的pdf路径
|
|
|
+ String pdfTrialUrl = map.get("pdf_trial_url")+""; //pdf路径,引用试验记录后合并的pdf
|
|
|
+ String eVisaPdfUrl = map.get("e_visa_pdf_url")+""; //签字的PDF路径
|
|
|
+ String pdfUrl = map.get("pdf_url")+""; //合并后的PDF路径
|
|
|
+ String type = map.get("type")+""; //资料类型,1资料填报,2试验,3首件
|
|
|
+ taskApp.setPdfDataType(type);
|
|
|
+ if (StringUtils.isNotEmpty(pdfTrialUrlPosition) || StringUtils.isNotEmpty(pdfTrialUrl)|| StringUtils.isNotEmpty(eVisaPdfUrl)|| StringUtils.isNotEmpty(pdfUrl)) {
|
|
|
+ if("1".equals(type)){
|
|
|
+ String approvalPdf = eVisaPdfUrl.length()>=10 ? eVisaPdfUrl : pdfUrl;
|
|
|
+ approvalPdf = pdfTrialUrl.length()>=10 ? pdfTrialUrl : approvalPdf;
|
|
|
+ approvalPdf = pdfTrialUrl.length()>=10 ? pdfTrialUrlPosition : approvalPdf;
|
|
|
+ taskApp.setSignPdfUrl(getHppsToHttp(approvalPdf));
|
|
|
+ } else if ("2".equals(type)) {
|
|
|
+ if (StringUtils.isNotEmpty(eVisaPdfUrl) || StringUtils.isNotEmpty(pdfUrl)) {
|
|
|
+ //试验原始pdf
|
|
|
+ String approvalPdf = StringUtils.isNotEmpty(eVisaPdfUrl) ? eVisaPdfUrl : pdfUrl;
|
|
|
+ taskApp.setSignPdfUrl(getHppsToHttp(approvalPdf));
|
|
|
+
|
|
|
+ //试验关联的原材料检测报告合并pdf (wbsId=试验记录id)TrialSelfInspectionRecord
|
|
|
+ String sqlRecord = "select old_pdf_url from u_trial_raw_material_self_record where self_record_id =" + map.get("wbs_id");
|
|
|
+ TrialRawMaterialSelfRecord recordObj = jdbcTemplate.query(sqlRecord, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class)).stream().findAny().orElse(null);
|
|
|
+ if (recordObj != null) {
|
|
|
+ if (StringUtils.isNotEmpty(recordObj.getOldPdfUrl())) {
|
|
|
+ taskApp.setSignPdfUrl(getHppsToHttp(approvalPdf));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if ("3".equals(type)) {
|
|
|
+ //首件,首件的资料由三个部分组成:封面、关联资料、总结报告
|
|
|
+ if (StringUtils.isNotEmpty(eVisaPdfUrl) || StringUtils.isNotEmpty(pdfUrl)) {
|
|
|
+ String url = StringUtils.isNotEmpty(eVisaPdfUrl) ? eVisaPdfUrl : pdfUrl;
|
|
|
+ String s = getHppsToHttp(url);
|
|
|
+ taskApp.setSignPdfUrl(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (taskApp.getApprovalType() == 2) { //档案
|
|
|
+ map = this.jdbcTemplate.queryForMap("select * from u_archive_file where is_deleted=0 and id =("+taskApp.getFormDataId()+")");
|
|
|
+ String eVisaPdfUrl = map.get("pdf_file_url")+""; //签字的PDF路径
|
|
|
+ String pdfUrl = map.get("file_url")+""; //合并后的PDF路径
|
|
|
+ if (StringUtils.isNotEmpty(eVisaPdfUrl) || StringUtils.isNotEmpty(pdfUrl)) {
|
|
|
+ String url = StringUtils.isNotEmpty(eVisaPdfUrl) ? eVisaPdfUrl : pdfUrl;
|
|
|
+ taskApp.setSignPdfUrl(url);
|
|
|
+ }
|
|
|
} else if (taskApp.getApprovalType() == 3) {
|
|
|
- map = this.jdbcTemplate.queryForMap("select * from u_information_query where is_deleted=0 and id = " + taskApp.getFormDataId());
|
|
|
- String url = StringUtils.isNotEmpty(map.get("e_visa_pdf_url") + "") ? map.get("e_visa_pdf_url") + "" : map.get("pdf_url") + "";
|
|
|
- taskApp.setSignPdfUrl(url);
|
|
|
- taskApp.setContractId(map.get("contract_id") + "");
|
|
|
- taskApp.setProjectId(map.get("project_id") + "");
|
|
|
- } else if (taskApp.getApprovalType() == 4) {
|
|
|
+ map = this.jdbcTemplate.queryForMap("select * from u_contract_log where is_deleted=0 and id = " + taskApp.getFormDataId());
|
|
|
+ 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 = StringUtils.isNotEmpty(eVisaPdfUrl) ? eVisaPdfUrl : pdfUrl;
|
|
|
+ taskApp.setSignPdfUrl(url);
|
|
|
+ }
|
|
|
+ } else if (taskApp.getApprovalType() == 4) { //档案走自定义 搓章的问题
|
|
|
|
|
|
} else if (taskApp.getApprovalType() == 5) {
|
|
|
map = this.jdbcTemplate.queryForMap("select * from s_interim_pay_certificate where is_deleted=0 and contract_period_id = " + taskApp.getFormDataId());
|
|
|
taskApp.setSignPdfUrl(map.get("raw_url") + "");
|
|
|
- taskApp.setContractId(map.get("contract_id") + "");
|
|
|
- taskApp.setProjectId(map.get("project_id") + "");
|
|
|
+
|
|
|
} else if (taskApp.getApprovalType() == 6 || taskApp.getApprovalType() == 7) {
|
|
|
map = this.jdbcTemplate.queryForMap("select * from s_material_start_statement where is_deleted=0 and meter_period_id = " + taskApp.getFormDataId());
|
|
|
taskApp.setSignPdfUrl(map.get("raw_url") + "");
|
|
|
- taskApp.setContractId(map.get("contract_id") + "");
|
|
|
- taskApp.setProjectId(map.get("project_id") + "");
|
|
|
- } else if (taskApp.getApprovalType() == 8) {
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ // 验证数据
|
|
|
+ taskApp.setContractId(map.get("contract_id") + "");
|
|
|
+ taskApp.setProjectId(map.get("project_id") + "");
|
|
|
if (taskApp.getSignPdfUrl() == null || taskApp.getSignPdfUrl() == "" || Func.isEmpty(taskApp.getSignPdfUrl()) || taskApp.getSignPdfUrl().length() <= 10) {
|
|
|
taskApp.setSigState(2);
|
|
|
taskApp.setSignSmg("未获取到PDF信息");
|
|
@@ -299,6 +452,7 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
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 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 ";
|
|
|
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 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("签字Sql="+sqlinfo);
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> maps2 = jdbcTemplate.queryForList(sqlinfo);
|
|
@@ -440,7 +594,9 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
|
|
|
// 安心签 - 关键字策略
|
|
|
public void signTaskBatchByAXQZ(List<SealStrategyVO> list, TaskSignInfoVO taskApp) {
|
|
|
- String pdfUrl = taskApp.getSignPdfUrl();
|
|
|
+
|
|
|
+ String pdfUrl = Func.notNull(taskApp.getLastFilePdfUrl())?taskApp.getLastFilePdfUrl():taskApp.getSignPdfUrl();
|
|
|
+
|
|
|
if (Func.isEmpty(pdfUrl) || list == null) {
|
|
|
taskApp.setLastFilePdfUrl(pdfUrl);
|
|
|
}
|
|
@@ -475,6 +631,8 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
SignFtpUtil.FTPCreateDir(outUrl);
|
|
|
String locPdfUrl = inUrl + "/" + filecode + ".pdf";
|
|
|
String OutPdfUrl = outUrl + "/" + filecode + ".pdf";
|
|
|
+ SignFtpUtil.FTPDeleteDir(locPdfUrl);
|
|
|
+ SignFtpUtil.FTPDeleteDir(OutPdfUrl);
|
|
|
|
|
|
InputStream inputStream = new ByteArrayInputStream(fileByte);
|
|
|
int i = SignFtpUtil.uploadFile(locPdfUrl, inputStream);
|
|
@@ -526,4 +684,12 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public String getHppsToHttp(String url) {
|
|
|
+ String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
|
|
|
+ if (url.contains("https:") && sys_isonline.equals("20")) {
|
|
|
+ return url.replace("https:", "http:");
|
|
|
+ }
|
|
|
+ return url;
|
|
|
+ }
|
|
|
}
|