Browse Source

电签检测,save-again添加操作日志

cr 1 tuần trước cách đây
mục cha
commit
c3b7a2d1b2

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskService.java

@@ -57,7 +57,7 @@ public interface ITaskService extends BaseService<Task> {
     /**
      * 批量审批
      */
-    void batchCompleteApprovalTask(List<TaskApprovalVO> taskApprovalVOS) throws FileNotFoundException;
+    Boolean batchCompleteApprovalTask(List<TaskApprovalVO> taskApprovalVOS) throws FileNotFoundException;
 
     /**
      * 启动流程

+ 26 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java

@@ -82,6 +82,7 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
     private final ContractClient contractClient;
 
     private final JdbcTemplate jdbcTemplate;
+    private final IOperationLogService operationLogService;
 
     @Autowired
     StringRedisTemplate RedisTemplate;
@@ -1134,8 +1135,33 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
         }else{
             return R.fail("type有误,无法处理该业务");
         }
+        List<InformationQuery> list = this.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getId, strList));
+        recordResignLog("电签检测", ids, list, new HashMap<String, Object>() {{
+            put("ids", ids);
+            put("classify", classify);
+            put("type", type);
+        }}, list.get(0).getProjectId()+"", list.get(0).getContractId()+"");
         return R.success("操作成功");
     }
+    public void recordResignLog(String module, String businessIds, Object data, Object requestData, String projectId, String contractId){
+        try {
+            OperationLog resignLog = new OperationLog();
+            resignLog.setProjectId(StringUtil.isNumeric(projectId) ? Long.parseLong(projectId) : null);
+            resignLog.setContractId(StringUtil.isNumeric(contractId) ? Long.parseLong(contractId) : null);
+            resignLog.setOperationType(33);
+            resignLog.setOperationModule(module);
+            resignLog.setOperationContent(JSON.toJSONString(requestData));
+            resignLog.setSaveData(JSON.toJSONString(data));
+            resignLog.setOperationTime(DateUtil.formatTime(DateUtil.now()));
+            resignLog.setOperationView("");
+            resignLog.setBusinessId(businessIds);
+            resignLog.setCreateUser(AuthUtil.getUserId());
+            resignLog.setOperationAccount(AuthUtil.getNickName());
+            operationLogService.save(resignLog);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
     @Override
     public ChekPdfPaceVo getCheckPdfPaceInfo(String contractId, String classify) {
        /* ChekPdfPaceVo da = new ChekPdfPaceVo();

+ 180 - 37
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -1,9 +1,10 @@
 package org.springblade.business.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
@@ -20,7 +21,6 @@ import org.springblade.business.feignClient.WbsTreeContractStatisticsClientImpl;
 import org.springblade.business.mapper.TaskMapper;
 import org.springblade.business.mapper.TrialSelfInspectionRecordMapper;
 import org.springblade.business.service.*;
-import org.springblade.business.sync.TaskSync;
 import org.springblade.business.utils.FileUtils;
 import org.springblade.business.vo.*;
 import org.springblade.common.constant.CommonConstant;
@@ -29,16 +29,12 @@ import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.oss.model.BladeFile;
-import org.springblade.core.redis.cache.BladeRedis;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 
-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.core.tool.utils.*;
 import org.springblade.evisa.feign.EVisaClient;
 import org.springblade.evisa.redissionUtil.DistributedRedisLock;
 import org.springblade.evisa.vo.EVisaTaskApprovalVO;
@@ -67,7 +63,6 @@ import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.SingleColumnRowMapper;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -135,6 +130,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
     private final WbsTreePrivateClient wbsTreePrivateClient;
     private final TrialSelfInspectionRecordMapper trialSelfInspectionRecordMapper;
     private final WbsTreeContractStatisticsClientImpl wbsTreeContractStatisticsClient;
+    private final IOperationLogService operationLogService;
     //超级管理员的角色id
     private final String SUPER_ADMIN_ROLE_ID = "1123598816738675201";
     //泓创智诚公司的部门id
@@ -626,7 +622,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
      * @throws FileNotFoundException
      */
     @Override
-    public void batchCompleteApprovalTask(List<TaskApprovalVO> taskApprovalVOS) {
+    public Boolean batchCompleteApprovalTask(List<TaskApprovalVO> taskApprovalVOS) {
         Long userId = AuthUtil.getUserId();
         String nickName = AuthUtil.getNickName();
         // 批量审批接口
@@ -674,7 +670,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                         e.printStackTrace();
                     }
                 }
-                this.taskBatchService.saveBatch(taskList);
+               return this.taskBatchService.saveBatch(taskList);
             } else if (taskAppr.getFlag().equals("NO")) { //废除
                 Set<String> taskIds = taskApprovalVOS.stream().map(TaskApprovalVO::getTaskId).collect(Collectors.toSet());
                 List<Task> tasks = this.listByIds(taskIds);
@@ -767,8 +763,10 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     }
                 }
                 wbsTreeContractStatisticsClient.updateInformationQueryStatusByTaskId(String.join(",", taskIds));
+                return true;
             }
         }
+        return true;
     }
 
 
@@ -1215,6 +1213,13 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                                 .eq(TaskParallel::getProcessInstanceId, task.getProcessInstanceId()));
                     }
                 }
+                recordResignLog("一键重签-日志", formDataIds, contractLogList, new HashMap<String, Object>() {{
+                    put("logids", logids);
+                    put("type", type);
+                    put("logPkeyId", logPkeyId);
+                    put("nodePrimaryKeyId", nodePrimaryKeyId);
+                    put("contractId", contractId);
+                }}, null, contractId);
             } catch (Exception e) {
                 e.printStackTrace();
                 throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
@@ -1243,7 +1248,9 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             Map<String, List<TaskParallel>> finalTaskParallelGroupMap = taskParallelGroupMap;
             //获取每条任务对应的节点信息
             List<String> dataIdList = taskList.stream().map(Task::getFormDataId).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
-            Map<String, String> queryMap = jdbcTemplate.query("select * from u_information_query where id in(" + StringUtils.join(dataIdList, ",") + ")", new BeanPropertyRowMapper<>(InformationQuery.class)).stream().collect(Collectors.toMap(l -> l.getId() + "", l -> l.getWbsId() + ""));
+            //Map<String, String> queryMap = jdbcTemplate.query("select * from u_information_query where id in(" + StringUtils.join(dataIdList, ",") + ")", new BeanPropertyRowMapper<>(InformationQuery.class)).stream().collect(Collectors.toMap(l -> l.getId() + "", l -> l.getWbsId() + ""));
+            List<InformationQuery> list = informationQueryService.list(new LambdaQueryWrapper<InformationQuery>().in(InformationQuery::getId, dataIdList));
+            Map<String, String> queryMap=list.stream().collect(Collectors.toMap(l -> l.getId() + "", l -> l.getWbsId() + ""));
             Map<String, String> typeMap = jdbcTemplate.query("select * from u_information_query where id in(" + StringUtils.join(dataIdList, ",") + ")", new BeanPropertyRowMapper<>(InformationQuery.class)).stream().collect(Collectors.toMap(l -> l.getId() + "", l -> l.getClassify() + ""));
 
             try {
@@ -1316,6 +1323,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     String taskIds = StringUtils.join(taskList, ",");
                     removeUserAndName(taskIds, userId, userName);
                 }*/
+                recordResignLog("一键重签-试验", StringUtils.join(dataIdList, ","), list, dto, dto.getProjectId(), null);
             } catch (Exception e) {
                 e.printStackTrace();
                 throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
@@ -1349,6 +1357,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             }
             Map<String, List<TaskParallel>> finalTaskParallelGroupMap = taskParallelGroupMap;
             try {
+                String entrustIds = dtos.stream().map(ReSigningEntrustDto::getEntrustId).collect(Collectors.joining(","));
+                List<EntrustInfo> entrustInfos = jdbcTemplate.query("select * from u_entrust_info where id in ( " + entrustIds + " )", new BeanPropertyRowMapper<>(EntrustInfo.class));
                 for (int i = 0; i < taskList.size(); i++) {
                     ReSigningEntrustDto dto = longMap.get(taskList.get(i).getId());
                     R result = new R();
@@ -1420,6 +1430,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                                 .eq(TaskParallel::getProcessInstanceId, taskList.get(i).getProcessInstanceId()));
                     }
                 }
+                this.recordResignLog("一键重签-委托单",  entrustIds, entrustInfos, dtos,taskList.get(0).getProjectId() , taskList.get(0).getContractId());
             } catch (Exception e) {
                 e.printStackTrace();
                 throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
@@ -1959,6 +1970,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     .set(InformationQuery::getSaveAgain, 0)
                     .ne(InformationQuery::getSaveAgain, 1)
                     .in(InformationQuery::getId, newIds));
+            List<InformationQuery> list = informationQueryService.list(new LambdaQueryWrapper<>(InformationQuery.class).in(InformationQuery::getId, newIds));
+            recordResignLog("save-again", StringUtils.join(newIds, ","), list, dtos, dtos.get(0).getProjectId()+"", dtos.get(0).getContractId()+"");
         }
         return R.success("操作成功");
     }
@@ -1995,6 +2008,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             Map<String, List<TaskParallel>> finalTaskParallelGroupMap = taskParallelGroupMap;
             //获取每条任务对应的节点信息
             List<String> dataIdList = taskList.stream().map(Task::getFormDataId).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
+            List<InformationQuery> list = informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getId, dataIdList));
             Map<String, String> queryMap = jdbcTemplate.query("select * from u_information_query where id in(" + StringUtils.join(dataIdList, ",") + ")", new BeanPropertyRowMapper<>(InformationQuery.class)).stream().collect(Collectors.toMap(l -> l.getId() + "", l -> l.getWbsId() + ""));
             Map<String, String> typeMap = jdbcTemplate.query("select * from u_information_query where id in(" + StringUtils.join(dataIdList, ",") + ")", new BeanPropertyRowMapper<>(InformationQuery.class)).stream().collect(Collectors.toMap(l -> l.getId() + "", l -> l.getClassify() + ""));
 
@@ -2003,22 +2017,45 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     R result = new R();
                     jdbcTemplate.execute("DELETE from u_task_batch where json_data like '%" + task.getId() + "%'");
                     boolean b = false;
-                    if (type == 1) {
-                        b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
-                                        .eq(InformationQuery::getId, task.getFormDataId())
-                                        .set(InformationQuery::getEVisaPdfUrl, null)
-//                                .set(InformationQuery::getPdfUrl, null)
-                        );
-                    } else {
-                        if (task.getApprovalType() == 3) {
-                            b = contractLogService.update(new LambdaUpdateWrapper<ContractLog>()
-                                    .eq(ContractLog::getId, task.getFormDataId())
-                                    .set(ContractLog::getEVisaPdfUrl, null));
-                            if (!b) {
-                                jdbcTemplate.update("update u_task set is_deleted=1 where id=" + task.getId());
-                                return;
+
+                    //是否恢复pdf
+                    Boolean isRestorePdf = false;
+                    //当前节点的电签pdf
+                    String eVisaPdfUrl = "";
+                    String pdfUrl = "";
+                    if(type == 1){
+                        //当前节点的电签pdf
+                        InformationQuery byId = informationQueryService.getById(task.getFormDataId());
+                        if(byId != null){
+                            eVisaPdfUrl = byId.getEVisaPdfUrl();
+                            pdfUrl = byId.getPdfUrl();
+                        }
+                         b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                .eq(InformationQuery::getId, task.getFormDataId())
+                                .set(InformationQuery::getEVisaPdfUrl, null)
+                                .set(InformationQuery::getPdfUrl, null)
+                         );
+                    }else {
+                        if(task.getApprovalType()==3){
+                            //当前节点的电签pdf
+                            ContractLog byId = contractLogService.getById(task.getFormDataId());
+                            if(byId != null){
+                                eVisaPdfUrl = byId.getEVisaPdfUrl();
+                            }
+
+                            b=contractLogService.update(new LambdaUpdateWrapper<ContractLog>()
+                               .eq(ContractLog::getId,task.getFormDataId())
+                               .set(ContractLog::getEVisaPdfUrl,null));
+                           if(!b){
+                               jdbcTemplate.update("update u_task set is_deleted=1 where id="+task.getId());
+                               return;
+                           }
+                        }else {
+                            //当前节点的电签pdf
+                            InformationQuery byId = informationQueryService.getById(task.getFormDataId());
+                            if(byId != null){
+                                eVisaPdfUrl = byId.getEVisaPdfUrl();
                             }
-                        } else {
                             b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
                                     .eq(InformationQuery::getId, task.getFormDataId())
                                     .set(InformationQuery::getEVisaPdfUrl, null));
@@ -2039,7 +2076,15 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                             String sql = "select type from u_information_query where id=" + task.getFormDataId();
                             Integer InformationType = jdbcTemplate.queryForObject(sql, new SingleColumnRowMapper<>(Integer.class));
                             if (InformationType == 1) {
-                                result = this.saveNodePdf(typeMap.get(task.getFormDataId()), queryMap.get(task.getFormDataId()), contractId, projectId, header);
+                                try {
+                                    result = this.saveNodePdf(typeMap.get(task.getFormDataId()), queryMap.get(task.getFormDataId()), contractId, projectId, header);
+                                    //恢复pdf
+                                    if(result.getCode()!=200){
+                                        isRestorePdf = true;
+                                    }
+                                } catch (Exception e) {
+                                    isRestorePdf = true;
+                                }
                             } else {
                                 TrialResignDto dto = new TrialResignDto();
                                 dto.setType(1);
@@ -2059,14 +2104,23 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                             String sql = "SELECT * from u_entrust_info where id=(select wbs_id from u_information_query where id=" + task.getFormDataId() + ")";
                             EntrustInfo info = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(EntrustInfo.class));
                             ReSigningEntrustDto dto = new ReSigningEntrustDto(info.getId().toString(), task.getId().toString(), contractId, info.getNodeId(), 2, 1);
-                            result = excelTabClient.saveReEntrustTabData(dto, header);
-                            if (result.getCode() == 200) {
-                                if (result.getData() != null) {
-                                    informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
-                                            .eq(InformationQuery::getId, task.getFormDataId())
-                                            .set(InformationQuery::getPdfUrl, result.getData()));
+                            try {
+                                result=excelTabClient.saveReEntrustTabData(dto,header);
+                                if(result.getCode()==200){
+                                    if(result.getData()!=null){
+                                        informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                                .eq(InformationQuery::getId, task.getFormDataId())
+                                                .set(InformationQuery::getPdfUrl,result.getData()));
+                                    }
+                                }else{
+                                    //恢复pdf
+                                    isRestorePdf = true;
                                 }
+                            } catch (Exception e) {
+                                //恢复pdf
+                                isRestorePdf = true;
                             }
+
                         }
                         long endTime_1 = System.currentTimeMillis();
                         long executionTime_1 = endTime_1 - startTime_1;
@@ -2077,6 +2131,16 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                         }
                         result.setData("成功");
                     }
+                    //恢复pdf 并且 恢复电签pdf
+                    if(isRestorePdf){
+                        informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                .eq(InformationQuery::getId, task.getFormDataId())
+                                .set(InformationQuery::getPdfUrl, pdfUrl)
+                                .set(InformationQuery::getEVisaPdfUrl, eVisaPdfUrl));
+                        continue;
+                    }
+
+
                     //重新电签
                     if (result != null && ("成功".equals(result.getData()) || 200 == result.getCode())) {
                         List<TaskApprovalVO> taskApprovalVOS = new ArrayList<>();
@@ -2098,12 +2162,57 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                         }
                         long startTime_2 = System.currentTimeMillis();
                         if (taskApprovalVOS != null && taskApprovalVOS.size() >= 1) {
-                            this.batchCompleteApprovalTask(taskApprovalVOS);
+                            boolean b1 = this.batchCompleteApprovalTask(taskApprovalVOS);
+                            //如果失败 恢复电签
+                            if (!b1) {
+                                if (type == 1) {
+                                    //当前节点的电签pdf
+                                    informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                            .eq(InformationQuery::getId, task.getFormDataId())
+                                            .set(InformationQuery::getEVisaPdfUrl, eVisaPdfUrl)
+                                    );
+                                } else {
+                                    if (task.getApprovalType() == 3) {
+                                        contractLogService.update(new LambdaUpdateWrapper<ContractLog>()
+                                                .eq(ContractLog::getId, task.getFormDataId())
+                                                .set(ContractLog::getEVisaPdfUrl, eVisaPdfUrl));
+                                        if (!b) {
+                                            jdbcTemplate.update("update u_task set is_deleted=1 where id=" + task.getId());
+                                            return;
+                                        }
+                                    } else {
+                                        informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                                .eq(InformationQuery::getId, task.getFormDataId())
+                                                .set(InformationQuery::getEVisaPdfUrl, eVisaPdfUrl));
+                                    }
+                                }
+                            }
                         }
                         long endTime_2 = System.currentTimeMillis();
                         long executionTime_2 = endTime_2 - startTime_2;
                         log.info("batchCompleteApprovalTask执行时间:" + executionTime_2 + " 毫秒");
                     } else {
+                        if (type == 1) {
+                            //当前节点的电签pdf
+                            informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                    .eq(InformationQuery::getId, task.getFormDataId())
+                                    .set(InformationQuery::getEVisaPdfUrl, eVisaPdfUrl)
+                            );
+                        } else {
+                            if (task.getApprovalType() == 3) {
+                                contractLogService.update(new LambdaUpdateWrapper<ContractLog>()
+                                        .eq(ContractLog::getId, task.getFormDataId())
+                                        .set(ContractLog::getEVisaPdfUrl, eVisaPdfUrl));
+                                if (!b) {
+                                    jdbcTemplate.update("update u_task set is_deleted=1 where id=" + task.getId());
+                                    return;
+                                }
+                            } else {
+                                informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                        .eq(InformationQuery::getId, task.getFormDataId())
+                                        .set(InformationQuery::getEVisaPdfUrl, eVisaPdfUrl));
+                            }
+                        }
                         //修改重签状态为保存PDF失败
                         this.taskParallelService.update(Wrappers.<TaskParallel>lambdaUpdate()
                                 .set(TaskParallel::getEVisaContent, "重新保存PDF失败")
@@ -2118,6 +2227,13 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     //满足去除当前填报人的条件 去除当前任务的填报人中当前操作人的信息
                     removeUserAndName(taskIds, userId, userName);
                 }
+                recordResignLog("一键重签-质检",StringUtils.join(dataIdList, ","), list, new HashMap<String, Object>() {{
+                    put("taskIds", taskIds);
+                    put("contractId", contractId);
+                    put("projectId", projectId);
+                    put("classify", classify);
+                    put("type", type);
+                }}, projectId, contractId);
             } catch (Exception e) {
                 e.printStackTrace();
                 throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
@@ -2224,14 +2340,14 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             }
             ids2 = ids2.substring(0, ids2.length() - 1);
         }
-
+        List<InformationQuery> queryList = jdbcTemplate.query("select id, e_visa_pdf_url, status from u_information_query where id in( " + ids + ") and is_deleted=0 and status in (1,2)", new BeanPropertyRowMapper<>(InformationQuery.class));
         String sqlqu = "update u_information_query set status=2,e_visa_pdf_url='' where id in( " + ids + ") and is_deleted=0 and status in (1,2)";
         String sqlForTask = "update u_task set status=2 where form_data_id in( " + ids2 + ") and status in(1,2) and is_deleted=0 ";
-        String sqlForTaskPall = "UPDATE u_task_parallel a  set a.is_resign = 1, a.`status`=2 , a.e_visa_status=1 ,a.e_visa_content='电签成功' where a.process_instance_id in(select process_instance_id  from u_task b  where b.form_data_id in( " + ids2 + ") and b.status in(0,1,2) and b.is_deleted = 0)  and a.`status` in(0,1)";
+        String sqlForTaskPall = "update u_task_parallel a INNER JOIN u_task b on a.process_instance_id = b.process_instance_id set a.is_resign = 1, a.`status`=2 , a.e_visa_status=1 ,a.e_visa_content='电签成功' where b.form_data_id in( " + ids2 + ") and b.status in(0,1,2) and b.is_deleted = 0 and a.`status` in(0,1)";
 
         String taskBtech = "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 a.id,a.process_instance_id,json_object('approvalFileList',json_array(),'approvalType',b.approval_type,'comment','','flag','OK','formDataId',b.form_data_id,'parallelProcessInstanceId',a.parallel_process_instance_id,'pass',true,'taskId',b.id) as  json_data,a.task_user,a.create_dept,a.create_time,a.update_user,SYSDATE(),1 as status,0 as is_deleted,a.task_user_name as nick_name ,1 as sign_format,1 as sign_type from u_task_parallel a,u_task b where b.`status` in(1,2) and a.`status` in(2)  and   a.process_instance_id=b.process_instance_id " +
-                " and b.form_data_id in( " + ids2 + ") and not exists (SELECT 1 from u_task_batch c where c.json_data like CONCAT('%',a.parallel_process_instance_id ,'%'))";
+                " and b.form_data_id in( " + ids2 + ") and a.parallel_process_instance_id not in(SELECT JSON_EXTRACT(c.json_data, '$.parallelProcessInstanceId') from u_task_batch c)";
 
         if(userIds!=null && userIds.length()>=1){
             taskBtech += " and b.task_user in("+userIds+")";
@@ -2246,6 +2362,33 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         jdbcTemplate.execute(sqlForTaskPall);
         jdbcTemplate.execute(taskBtech);
 
+        if (!queryList.isEmpty()) {
+            Map<String, String> requestMap = new HashMap<>();
+            requestMap.put("ids", ids);
+            requestMap.put("userIds", userIds);
+            recordResignLog("一键电签", ids, queryList, requestMap, null, null);
+        }
         return R.success("操作成功");
     }
+
+
+    public void recordResignLog(String module, String businessIds, Object data, Object requestData, String projectId, String contractId){
+        try {
+            OperationLog resignLog = new OperationLog();
+            resignLog.setProjectId(StringUtil.isNumeric(projectId) ? Long.parseLong(projectId) : null);
+            resignLog.setContractId(StringUtil.isNumeric(contractId) ? Long.parseLong(contractId) : null);
+            resignLog.setOperationType(33);
+            resignLog.setOperationModule(module);
+            resignLog.setOperationContent(JSON.toJSONString(requestData));
+            resignLog.setSaveData(JSON.toJSONString(data));
+            resignLog.setOperationTime(DateUtil.formatTime(DateUtil.now()));
+            resignLog.setOperationView("");
+            resignLog.setBusinessId(businessIds);
+            resignLog.setCreateUser(AuthUtil.getUserId());
+            resignLog.setOperationAccount(AuthUtil.getNickName());
+            operationLogService.save(resignLog);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 }