Browse Source

Merge remote-tracking branch 'origin/test-merge' into test-merge

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

+ 17 - 4
blade-service/blade-business/src/main/java/org/springblade/business/controller/FixedFlowController.java

@@ -367,12 +367,20 @@ public class FixedFlowController extends BladeController {
             }
             Long number = nameCountMap.get(fixedFlow.getFixedFlowName());
             if (number == null) {
-                number = this.fixedFlowService.count(Wrappers.<FixedFlow>lambdaQuery().likeRight(FixedFlow::getFixedFlowName, fixedFlow.getFixedFlowName()).eq(FixedFlow::getContractId, fixedFlow.getContractId()).ne(FixedFlow::getId, fixedFlow.getId()));
+                List<FixedFlow> list = this.fixedFlowService.list(Wrappers.<FixedFlow>lambdaQuery().select(FixedFlow::getFixedFlowName).likeRight(FixedFlow::getFixedFlowName, fixedFlow.getFixedFlowName())
+                        .eq(FixedFlow::getContractId, fixedFlow.getContractId()).ne(FixedFlow::getId, fixedFlow.getId()));
+                if (list.isEmpty()) {
+                    number = 0L;
+                } else {
+                    int length = fixedFlow.getFixedFlowName().split("_").length;
+                    number = list.stream().filter(item -> item.getFixedFlowName().split("_").length == length + 1).count();
+                }
             }
             nameCountMap.put(fixedFlow.getFixedFlowName(), number + 1);
             fixedFlow.setId(fixedFlowId);
             fixedFlow.setFixedFlowName(fixedFlow.getFixedFlowName() + "_" + (number + 1));
             fixedFlow.setCreateTime(new Date());
+            fixedFlow.setCreateDept(fixedFlow.getId());
             fixedFlow.setUpdateTime(new Date());
             fixedFlow.setCreateUser(AuthUtil.getUserId());
         });
@@ -411,7 +419,12 @@ public class FixedFlowController extends BladeController {
                 for (String userId : userIds) {
                     List<SignPfxFile> userPfxList = collect.get(userId);
                     if (userPfxList == null || userPfxList.isEmpty()) {
-                        notCertificateUserInfoSet.add(userId);
+                        String[] split = userId.split(",");
+                        for (String s : split) {
+                            if (StringUtils.isNumeric( s)) {
+                                notCertificateUserInfoSet.add(s);
+                            }
+                        }
                     }
                 }
                 if (!notCertificateUserInfoSet.isEmpty()) {
@@ -461,7 +474,7 @@ public class FixedFlowController extends BladeController {
                         }
                         FixedFlowLink fixedFlowLink = new FixedFlowLink();
                         fixedFlowLink.setFixedFlowId(fixedFlowId);
-                        fixedFlowLink.setFixedFlowLink(dto.getFixedName());
+                        fixedFlowLink.setFixedFlowLink(fixedBranch.getName() != null ? fixedBranch.getName() : dto.getFixedName());
                         fixedFlowLink.setFixedFlowLinkType(projectInfo.getApprovalType());
                         fixedFlowLink.setFixedFlowLinkUser(Long.parseLong(userId));
                         fixedFlowLink.setFixedFlowLinkUserName(user.getRealName());
@@ -551,7 +564,7 @@ public class FixedFlowController extends BladeController {
             resultMap.setSize(fixedFlowsPage.getSize());
             resultMap.setTotal(fixedFlowsPage.getTotal());
             resultMap.setRecords(fixedFlowVOList);
-            fixedFlowVOList.sort(Comparator.comparing(FixedFlowVO::getSort));
+            fixedFlowVOList.sort(Comparator.comparing(item -> item.getSort() == null ? 0 : item.getSort()));
             Map<Boolean, List<FixedFlowVO>> groupMap = fixedFlowVOList.stream().collect(Collectors.groupingBy(record -> record.getFixedFlowName() != null && record.getFixedFlowName().contains("_") && record.getSort() == null));
             List<FixedFlowVO> copyFixedFlowVOS = groupMap.get(true);
             List<FixedFlowVO> fixedFlowVOS = groupMap.get(false);

+ 50 - 6
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -1,5 +1,6 @@
 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.update.LambdaUpdateWrapper;
@@ -35,10 +36,7 @@ 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;
@@ -135,6 +133,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
@@ -1217,6 +1216,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());
@@ -1318,6 +1324,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     String taskIds = StringUtils.join(taskList, ",");
                     removeUserAndName(taskIds, userId, userName);
                 }*/
+                recordResignLog("一键重签-试验", StringUtils.join(dataIdList, ","), queryMap, dto, dto.getProjectId(), null);
             } catch (Exception e) {
                 e.printStackTrace();
                 throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
@@ -1351,6 +1358,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();
@@ -1422,6 +1431,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());
@@ -2215,6 +2225,13 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     //满足去除当前填报人的条件 去除当前任务的填报人中当前操作人的信息
                     removeUserAndName(taskIds, userId, userName);
                 }
+                recordResignLog("一键重签-质检",StringUtils.join(dataIdList, ","), queryMap, 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());
@@ -2321,10 +2338,10 @@ 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 " +
@@ -2343,6 +2360,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.setOperationContent(AuthUtil.getNickName());
+            operationLogService.save(resignLog);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 }

+ 7 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -1627,7 +1627,13 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
             }
             List<WbsTreeContract> wbsTreeContractList = new ArrayList<>();
             if (!pKeyIds.isEmpty()) {
-                wbsTreeContractList = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery().in(WbsTreeContract::getPKeyId, pKeyIds).eq(WbsTreeContract::getPId, pKeyId));
+                LambdaQueryWrapper<WbsTreeContract> wrapper = Wrappers.<WbsTreeContract>lambdaQuery().in(WbsTreeContract::getPKeyId, pKeyIds);
+                if (pKeyId == null || pKeyId == 0) {
+                    wrapper.and(wrapper1 -> wrapper1.isNull(WbsTreeContract::getPId).or().eq(WbsTreeContract::getPId, 0));
+                } else {
+                    wrapper.eq(WbsTreeContract::getPId, pKeyId);
+                }
+                wbsTreeContractList = wbsTreeContractMapper.selectList(wrapper);
             }
             if (!wbsTreeContractList.isEmpty()) {
                 String pKeyIdStr = wbsTreeContractList.stream().map(item -> item.getPKeyId() + "").collect(Collectors.joining(","));

+ 4 - 44
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@@ -795,7 +795,6 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
             }
 
             if (contractInfo != null) {
-                Map<Long, String> collectNodesMap = getCollectNodesByContractId(contractId);
                 /* =========================== 施工合同段 =========================== */
                 if (new Integer(1).equals(contractInfo.getContractType())) {
                     String sql = "SELECT is_custom,p_key_id,contract_id," +
@@ -892,6 +891,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
                         List<WbsTreeContractStatistics> wbsTreeContractStatisticsList = jdbcTemplate.query("select id, leaf_num, fill_num, approve_num, complete_num,jl_fill_num, jl_approve_num, jl_complete_num from m_wbs_tree_contract_statistics where id in (" + pKeyIds + ")",
                                 new BeanPropertyRowMapper<>(WbsTreeContractStatistics.class));
                         Map<Long, WbsTreeContractStatistics> wbsTreeContractStatisticsMap = wbsTreeContractStatisticsList.stream().collect(Collectors.toMap(WbsTreeContractStatistics::getId, item -> item));
+                        List<ContractCollectFolder> collectList = jdbcTemplate.query("select node_id from m_contract_collect_folder where type = 1 and contract_id = " + contractId + " and node_id in ( " + pKeyIds + ")", new BeanPropertyRowMapper<>(ContractCollectFolder.class));
+                        Map<Long, ContractCollectFolder> collectNodesMap = collectList.stream().collect(Collectors.toMap(ContractCollectFolder::getNodeId, item -> item, (existing, replacement) -> existing));
                         setPrivateTemplate(lazyNodes);
                         for (WbsTreeContractLazyVO lazyNodeVO : lazyNodes) {
                                 if(lazyNodeVO.getIsCustom()!=null&&lazyNodeVO.getIsCustom()==1){
@@ -1034,6 +1035,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
                                 List<WbsTreeContractStatistics> wbsTreeContractStatisticsList = jdbcTemplate.query("select id, leaf_num, fill_num, approve_num, complete_num,jl_fill_num, jl_approve_num, jl_complete_num  from m_wbs_tree_contract_statistics where id in (" + pKeyIds + ")",
                                         new BeanPropertyRowMapper<>(WbsTreeContractStatistics.class));
                                 Map<Long, WbsTreeContractStatistics> wbsTreeContractStatisticsMap = wbsTreeContractStatisticsList.stream().collect(Collectors.toMap(WbsTreeContractStatistics::getId, item -> item));
+                                List<ContractCollectFolder> collectList = jdbcTemplate.query("select node_id from m_contract_collect_folder where type = 1 and contract_id = " + contractId + " and node_id in ( " + pKeyIds + ")", new BeanPropertyRowMapper<>(ContractCollectFolder.class));
+                                Map<Long, ContractCollectFolder> collectNodesMap = collectList.stream().collect(Collectors.toMap(ContractCollectFolder::getNodeId, item -> item, (existing, replacement) -> existing));
                                 setPrivateTemplate(lazyNodes);
                                     for (WbsTreeContractLazyVO lazyNodeVO : lazyNodes) {
                                         if(lazyNodeVO.getIsCustom()!=null&&lazyNodeVO.getIsCustom()==1){
@@ -1138,49 +1141,6 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
             }
         }
     }
-    private Map<Long, String> getCollectNodesByContractId(String contractId){
-        if (contractId ==  null || contractId.trim().isEmpty()) {
-            return new HashMap<>();
-        }
-        Map<Long, String> collectNodes = new HashMap<>();
-        try {
-            String string = redisTemplate.opsForValue().get("blade-manager::contract:collectFolder:" + contractId);
-            if (string != null) {
-                String[] split = string.split(",");
-                for (String s : split) {
-                    if (StringUtil.isNumeric(s)) {
-                        collectNodes.put(Long.parseLong(s), "");
-                    }
-                }
-            }
-        } catch (Exception e) {
-            log.error("",e);
-        }
-        try {
-            if (!collectNodes.isEmpty()) {
-                return collectNodes;
-            }
-            List<ContractCollectFolder> query = jdbcTemplate.query(String.format("select node_id from m_contract_collect_folder where contract_id = %s and type = 1", contractId), new BeanPropertyRowMapper<>(ContractCollectFolder.class));
-            for (ContractCollectFolder contractCollectFolder : query) {
-                Long nodeId = contractCollectFolder.getNodeId();
-                collectNodes.put(nodeId, "");
-//                String nodeAncestors = contractCollectFolder.getNodeAncestors();
-//                if (nodeAncestors != null) {
-//                    String[] split = nodeAncestors.split(",");
-//                    for (String s : split) {
-//                        if (StringUtil.isNumeric(s)) {
-//                            collectNodes.put(Long.parseLong(s), "");
-//                        }
-//                    }
-//                }
-                String ids = collectNodes.keySet().stream().map(item -> item + "").collect(Collectors.joining(","));
-                redisTemplate.opsForValue().set("blade-manager::contract:collectFolder:" + contractId, ids, 60 * 60 * 40L, TimeUnit.SECONDS);
-            }
-        } catch (Exception e) {
-            log.error("合同段id:" + contractId + ", 获取收藏节点失败:" + e.getMessage(), e);
-        }
-        return collectNodes;
-    }
 
     /**
      * 非批量电签时,主动清理本地缓存,如资料填报保存、任务上报等