瀏覽代碼

wbs元素表同步相关

liuyc 3 年之前
父節點
當前提交
5024762ab9

+ 2 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.java

@@ -94,7 +94,7 @@ public interface WbsTreeContractMapper extends BaseMapper<WbsTreeContract> {
 
     List<WbsTreeContract> selectContractList(String wbsId, String projectId,@Param("ids") List<Long> ids);
 
-    void updateBatchByIds(@Param("wbsTreeListNode") WbsTree wbsTreeListNode,@Param("id") Long id);
+    void updateBatchByIds(@Param("wbsTreeList") WbsTree wbsTreeList,@Param("id") Long id);
 
-    void updateBatchByIds2(@Param("wbsTreeListNode") WbsTreePrivate wbsTreeListNode,@Param("id")  Long id);
+    void updateBatchByIds2(@Param("wbsTreeList") WbsTreePrivate wbsTreeList,@Param("id")  Long id);
 }

+ 18 - 16
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml

@@ -572,30 +572,32 @@
 
     <update id="updateBatchByIds">
         UPDATE m_wbs_tree_contract
-        SET dept_name   = #{wbsTreeListNode.deptName},
-            full_name   =#{wbsTreeListNode.deptName},
-            dept_category  = #{wbsTreeListNode.deptCategory},
-            major_data_type = #{wbsTreeListNode.majorDataType},
-            unique_code = #{wbsTreeListNode.uniqueCode},
-            partition_code = #{wbsTreeListNode.partitionCode}
-        WHERE id = #{wbsTreeListNode.id}
+        SET dept_name   = #{wbsTreeList.deptName},
+            full_name   =#{wbsTreeList.deptName},
+            dept_category  = #{wbsTreeList.deptCategory},
+            major_data_type = #{wbsTreeList.majorDataType},
+            unique_code = #{wbsTreeList.uniqueCode},
+            partition_code = #{wbsTreeList.partitionCode},
+            table_type = #{wbsTreeList.tableType},
+            table_owner = #{wbsTreeList.tableOwner}
+        WHERE id = #{wbsTreeList.id}
           AND contract_id = #{id}
-          AND type = 1
           AND status = 1
           AND is_deleted = 0
     </update>
 
     <update id="updateBatchByIds2">
         UPDATE m_wbs_tree_contract
-        SET dept_name   = #{wbsTreeListNode.deptName},
-            full_name   =#{wbsTreeListNode.deptName},
-            dept_category  = #{wbsTreeListNode.deptCategory},
-            major_data_type = #{wbsTreeListNode.majorDataType},
-            unique_code = #{wbsTreeListNode.uniqueCode},
-            partition_code = #{wbsTreeListNode.partitionCode}
-        WHERE id = #{wbsTreeListNode.id}
+        SET dept_name   = #{wbsTreeList.deptName},
+            full_name   = #{wbsTreeList.deptName},
+            dept_category  = #{wbsTreeList.deptCategory},
+            major_data_type = #{wbsTreeList.majorDataType},
+            unique_code = #{wbsTreeList.uniqueCode},
+            partition_code = #{wbsTreeList.partitionCode},
+            table_type = #{wbsTreeList.tableType},
+            table_owner = #{wbsTreeList.tableOwner}
+        WHERE id = #{wbsTreeList.id}
           AND contract_id = #{id}
-          AND type = 1
           AND status = 1
           AND is_deleted = 0
     </update>

+ 3 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreePrivateMapper.java

@@ -82,7 +82,8 @@ public interface WbsTreePrivateMapper extends BaseMapper<WbsTreePrivate> {
 
     List<WbsTreePrivate> selectByIds(@Param("projectId") String projectId, @Param("ids") List<String> ids);
 
-    void updateBatchByIds(@Param("wbsTreeListNode") WbsTree wbsTreeListNode, @Param("projectId") String projectId);
+    void updateBatchByIds(@Param("wbsTreeList") WbsTree wbsTreeList, @Param("projectId") String projectId);
+
+    void updateBatchByIds2(@Param("wbsTreeList") WbsTreePrivate wbsTreeList,@Param("projectId") String projectId,@Param("wbsId") String wbsId);
 
-    void updateBatchByIds2(@Param("wbsTreeListNode") WbsTreePrivate wbsTreeListNode,@Param("projectId") String projectId,@Param("wbsId") String wbsId);
 }

+ 18 - 16
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreePrivateMapper.xml

@@ -201,31 +201,33 @@
 
     <update id="updateBatchByIds">
         UPDATE m_wbs_tree_private
-        SET dept_name   = #{wbsTreeListNode.deptName},
-            full_name   =#{wbsTreeListNode.deptName},
-            dept_category  = #{wbsTreeListNode.deptCategory},
-            major_data_type = #{wbsTreeListNode.majorDataType},
-            unique_code = #{wbsTreeListNode.uniqueCode},
-            partition_code = #{wbsTreeListNode.partitionCode}
-        WHERE id = #{wbsTreeListNode.id}
+        SET dept_name   = #{wbsTreeList.deptName},
+            full_name   =#{wbsTreeList.deptName},
+            dept_category  = #{wbsTreeList.deptCategory},
+            major_data_type = #{wbsTreeList.majorDataType},
+            unique_code = #{wbsTreeList.uniqueCode},
+            partition_code = #{wbsTreeList.partitionCode},
+            table_type = #{wbsTreeList.tableType},
+            table_owner = #{wbsTreeList.tableOwner}
+        WHERE id = #{wbsTreeList.id}
         AND project_id = #{projectId}
-        AND type = 1
         AND status = 1
         AND is_deleted = 0
     </update>
 
     <update id="updateBatchByIds2">
         UPDATE m_wbs_tree_private
-        SET dept_name   = #{wbsTreeListNode.deptName},
-            full_name   =#{wbsTreeListNode.deptName},
-            dept_category  = #{wbsTreeListNode.deptCategory},
-            major_data_type = #{wbsTreeListNode.majorDataType},
-            unique_code = #{wbsTreeListNode.uniqueCode},
-            partition_code = #{wbsTreeListNode.partitionCode}
-        WHERE id = #{wbsTreeListNode.id}
+        SET dept_name   = #{wbsTreeList.deptName},
+            full_name   = #{wbsTreeList.deptName},
+            dept_category  = #{wbsTreeList.deptCategory},
+            major_data_type = #{wbsTreeList.majorDataType},
+            unique_code = #{wbsTreeList.uniqueCode},
+            partition_code = #{wbsTreeList.partitionCode},
+            table_type = #{wbsTreeList.tableType},
+            table_owner = #{wbsTreeList.tableOwner}
+        WHERE id = #{wbsTreeList.id}
           AND project_id = #{projectId}
           AND wbs_id = #{wbsId}
-          AND type = 1
           AND status = 1
           AND is_deleted = 0
     </update>

+ 4 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreePrivateService.java

@@ -36,7 +36,9 @@ public interface IWbsTreePrivateService extends BaseService<WbsTreePrivate> {
 
     boolean updateStatus(String pKeyId);
 
-    boolean updateBatchByIds(List<WbsTree> wbsTreeListNodes, String projectId);
+    boolean updateBatchByIds(List<WbsTree> wbsTreeListAll,String projectId);
+
+    boolean updateBatchByIds2(List<WbsTreePrivate> wbsTreePrivates, String projectId,String wbsId);
+
 
-    boolean updateBatchByIds2(List<WbsTreePrivate> wbsTreePrivateNodes, String projectId,String wbsId);
 }

+ 10 - 15
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -263,41 +263,36 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
     }
 
     @Override
-    public boolean updateBatchByIds(List<WbsTree> wbsTreeListNodes, String projectId) {
+    public boolean updateBatchByIds(List<WbsTree> wbsTreeListAll, String projectId) {
         //获取当前项目下所有合同段信息
         List<ContractInfo> contractInfos = contractInfoMapper.selectList(Wrappers.<ContractInfo>query().lambda().eq(ContractInfo::getPId, projectId));
-
-        for (WbsTree wbsTreeListNode : wbsTreeListNodes) {
-            //修改项目wbs信息
-            baseMapper.updateBatchByIds(wbsTreeListNode, projectId);
+        for (WbsTree wbsTreeList : wbsTreeListAll) {
+            //修改项目wbs节点信息、元素表基础信息
+            baseMapper.updateBatchByIds(wbsTreeList, projectId);
 
             for (ContractInfo contractInfo : contractInfos) {
-                //修改合同段wbs信息
-                wbsTreeContractMapper.updateBatchByIds(wbsTreeListNode, contractInfo.getId());
+                //修改合同段wbs节点信息、元素表基础信息
+                wbsTreeContractMapper.updateBatchByIds(wbsTreeList, contractInfo.getId());
             }
         }
-
         return true;
     }
 
 
     @Override
-    public boolean updateBatchByIds2(List<WbsTreePrivate> wbsTreePrivateNodes, String projectId, String wbsId) {
+    public boolean updateBatchByIds2(List<WbsTreePrivate> wbsTreePrivates, String projectId, String wbsId) {
         //获取当前项目下所有合同段信息
         List<ContractInfo> contractInfos = contractInfoMapper.selectList(Wrappers.<ContractInfo>query().lambda().eq(ContractInfo::getPId, projectId));
-
-        for (WbsTreePrivate wbsTreeListNode : wbsTreePrivateNodes) {
+        for (WbsTreePrivate wbsTreeList : wbsTreePrivates) {
             //修改项目wbs信息
-            baseMapper.updateBatchByIds2(wbsTreeListNode, projectId, wbsId);
+            baseMapper.updateBatchByIds2(wbsTreeList, projectId, wbsId);
 
             for (ContractInfo contractInfo : contractInfos) {
                 //修改合同段wbs信息
-                wbsTreeContractMapper.updateBatchByIds2(wbsTreeListNode, contractInfo.getId());
+                wbsTreeContractMapper.updateBatchByIds2(wbsTreeList, contractInfo.getId());
             }
         }
-
         return true;
     }
 
-
 }

+ 6 - 9
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeServiceImpl.java

@@ -708,7 +708,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                     List<WbsTree> wbsTreeList = wbsTreeMapper.selectList(Wrappers.<WbsTree>query().lambda()
                                     .eq(WbsTree::getWbsId, pawDTO.getWbsId())
                                     .eq(WbsTree::getStatus, 1)
-                            //.eq(WbsTree::getType, 2)
                     );
                     wbsTreeListAll.addAll(wbsTreeList);
                 }
@@ -717,8 +716,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                 List<WbsTree> wbsTreeListTables = wbsTreeListAll.stream().filter(f -> f.getType() == 2).collect(Collectors.toList());
 
                 //所有节点信息
-                List<WbsTree> wbsTreeListNodes = wbsTreeListAll.stream().filter(f -> f.getType() == 1).collect(Collectors.toList());
-
+                //List<WbsTree> wbsTreeListNodes = wbsTreeListAll.stream().filter(f -> f.getType() == 1).collect(Collectors.toList());
 
                 //公有元素表的id
                 List<Long> collect1 = wbsTreeListTables.stream().map(WbsTree::getId).collect(Collectors.toList());
@@ -737,8 +735,8 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
 
                 List<String> diffRent1 = WbsTreeContractServiceImpl.getDiffrent(collect2, collect4);
 
-                //同步公有wbs节点信息,编辑修改后的节点信息到项目级wbs、合同段wbs
-                wbsTreePrivateService.updateBatchByIds(wbsTreeListNodes, pawDTO.getProjectId());
+                //同步公有wbs节点信息、元素表基础信息到项目级wbs、合同段wbs
+                wbsTreePrivateService.updateBatchByIds(wbsTreeListAll,pawDTO.getProjectId());
 
                 if (diffRent1.size() == 0) {
                     //当wbsTreeIds == "" 时 1.在第一次新增未选择wbs树时  2.同步新增的元素表时
@@ -830,14 +828,13 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                                 .eq(WbsTreePrivate::getWbsId, wbsTreePrivate.getWbsId())
                                 .eq(WbsTreePrivate::getProjectId, wbsTreePrivate.getProjectId())
                                 .eq(WbsTreePrivate::getStatus, 1)
-                        //.eq(WbsTreePrivate::getType, 2)
                 );
 
                 //私有引用项目的表单信息
                 List<WbsTreePrivate> WbsTreePrivateTables = wbsTreePrivates.stream().filter(f -> f.getType() == 2).collect(Collectors.toList());
 
                 //私有引用项目的节点信息
-                List<WbsTreePrivate> WbsTreePrivateNodes = wbsTreePrivates.stream().filter(f -> f.getType() == 1).collect(Collectors.toList());
+                //List<WbsTreePrivate> WbsTreePrivateNodes = wbsTreePrivates.stream().filter(f -> f.getType() == 1).collect(Collectors.toList());
 
                 //当前新增表单的id
                 List<Long> collect1 = WbsTreePrivateTables.stream().map(WbsTreePrivate::getId).collect(Collectors.toList());
@@ -856,8 +853,8 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
 
                 List<String> diffRent1 = WbsTreeContractServiceImpl.getDiffrent(collect2, collect4);
 
-                //同步私有wbs节点信息,编辑修改后的节点信息到项目级wbs、合同段wbs
-                wbsTreePrivateService.updateBatchByIds2(WbsTreePrivateNodes, pawDTO.getProjectId(), pawDTO.getPrimaryKeyId());
+                //同步私有wbs节点信息、元素表基础信息到项目级wbs、合同段wbs
+                wbsTreePrivateService.updateBatchByIds2(wbsTreePrivates, pawDTO.getProjectId(), pawDTO.getPrimaryKeyId());
 
                 if (diffRent1.size() == 0) {
                     return true;