Explorar o código

回收站修改

lvy hai 1 semana
pai
achega
092c8535f8

+ 5 - 2
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -2006,11 +2006,14 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
 
             //旧节点的pkeyId和新节点的pkeyId
             Map<Long, Long> oldPKeyIdToNewPKeyIdMap = new HashMap<>();
+            Map<Long, Long> oldIdToNewIdMap = new HashMap<>();
             //节点和表的id 与 节点/表 实体类
             Map<String, WbsTreeContract> nodeMap = new HashMap<>();
 
             nodeChildAll.forEach(node -> {
-                oldPKeyIdToNewPKeyIdMap.put(node.getPKeyId(),SnowFlakeUtil.getId());
+                Long id = SnowFlakeUtil.getId();
+                oldPKeyIdToNewPKeyIdMap.put(node.getPKeyId(), id);
+                oldIdToNewIdMap.put(node.getId(), id);
                 oldToNewIdMap.put(node.getId(), SnowFlakeUtil.getId());
                 nodeMap.put(node.getId().toString(), node);
             });
@@ -2125,7 +2128,7 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
                     //如果不是  判断旧节点的父级id是否在旧节点集合中 如果在 则设置新节点的父级id为旧节点的父级id的映射id  否则就是随机id
                     newData.setParentId(oldToNewIdMap.containsKey(nodeOld.getParentId()) ? oldToNewIdMap.get(nodeOld.getParentId()) : SnowFlakeUtil.getId());
                     //TODO 20250414-lhb-新增
-                    newData.setPId(oldPKeyIdToNewPKeyIdMap.containsKey(nodeOld.getPId()) ? oldPKeyIdToNewPKeyIdMap.get(nodeOld.getPId()) : SnowFlakeUtil.getId());
+                    newData.setPId(oldPKeyIdToNewPKeyIdMap.containsKey(nodeOld.getPId()) ? oldPKeyIdToNewPKeyIdMap.get(nodeOld.getPId()) : oldToNewIdMap.get(nodeOld.getParentId()) ==  null ? SnowFlakeUtil.getId() : oldToNewIdMap.get(nodeOld.getParentId()));
                 }
                 newData.setCreateTime(new Date());
                 newData.setUpdateTime(new Date());

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/RecycleBinInfoMapper.xml

@@ -71,7 +71,7 @@
             </if>
         </if>
         <if test="vo.content != null">
-            and (file_name like concat('%',#{vo.content},'%') or jl_file_name like concat('%',#{vo.content},'%') or delRootName like concat('%',#{vo.content},'%') or position like concat('%',#{vo.content},'%'))
+            and (file_name like concat('%',#{vo.content},'%') or jl_file_name like concat('%',#{vo.content},'%') or del_root_name like concat('%',#{vo.content},'%') or position like concat('%',#{vo.content},'%'))
         </if>
         <if test="vo.operationId != null">
             and operation_id = #{vo.operationId}

+ 10 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/WbsTreeContractStatisticsServiceImpl.java

@@ -298,6 +298,7 @@ public class WbsTreeContractStatisticsServiceImpl extends ServiceImpl<WbsTreeCon
                 for (WbsTreeContractDto dto : contractDtoList) {
                     addWbsTreeContractStatistics.add(createWbsTreeContractStatistics(dto));
                 }
+                updateStatusAndIsDeleted(contractId);
             }
             // 统计叶子节点数量
 //            countLeafNum(addWbsTreeContractStatistics);
@@ -326,6 +327,15 @@ public class WbsTreeContractStatisticsServiceImpl extends ServiceImpl<WbsTreeCon
             log.error("更新合同段wbs树统计信息异常", e);
         }
     }
+    private void updateStatusAndIsDeleted(Long contractId) {
+        List<WbsTreeContractStatistics> query = jdbcTemplate.query("SELECT a.id,b.status,b.is_deleted from m_wbs_tree_contract_statistics a LEFT JOIN m_wbs_tree_contract b on a.id = b.p_key_id WHERE (a.status != b.status OR a.is_deleted != b.is_deleted) AND b.p_key_id IS NOT NULl and a.contract_id = " + contractId,
+                new BeanPropertyRowMapper<>(WbsTreeContractStatistics.class));
+        if (query.isEmpty()) {
+            return;
+        }
+        List<WbsTreeContractStatistics> list = query.stream().filter(item -> item.getStatus() != null && item.getIsDeleted() != null).collect(Collectors.toList());
+        this.updateBatchById(list);
+    }
 
     private boolean updateWbsTreeContractStatisticsFields(WbsTreeContractStatistics old, WbsTreeContractStatistics newObj) {
         boolean result = false;