Jelajahi Sumber

节点多份复制

liuyc 2 tahun lalu
induk
melakukan
97e9572195

+ 8 - 1
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/CopyContractTreeNodeVO.java

@@ -30,7 +30,14 @@ public class CopyContractTreeNodeVO {
     @ApiModelProperty("所属方,1=施工,2=监理,字符串拼接,复制数据")
     private String classify;
 
-    @ApiModelProperty("划分编号,单份复制")
+    @ApiModelProperty("所属方,1=施工,2=监理,字符串拼接,复制数据," +
+            "不知道之前的接口为什么会入参这个值,有个接口单独用的,懒得叫前端改了")
+    private String classifyType;
+
+    @ApiModelProperty("是否需要复制数据 0=否1=是")
+    private Integer isCopyData;
+
+    @ApiModelProperty("划分编号")
     private String partitionCode;
 
     public void setCopyBatchToPaths(String primaryKeyId, String nodeName, String partitionCode, Integer isSameNode) {

+ 223 - 84
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import io.github.classgraph.utils.LogNode;
 import io.swagger.annotations.*;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
@@ -1450,12 +1451,9 @@ public class InformationWriteQueryController extends BladeController {
              *      1.2 如果点击选择的是当前复制节点的同级节点(自己本身节点是无法点击进行复制的),那么复制对应表数据,如果没有对应表,那么跳过。
              *  2:跨节点复制(不同父级下)
              *      2.1 如果点击选择的是其他父级节点的父级,那么新增一个新的当前选择的复制的节点-新的表-新的表数据(根据所属方查询对应数据)。
-             *      2.2 如果点击选择的是当前复制节点本身的节点,那么就只复制数据。
-             *      2.3 如果点击选择的是当前复制节点本身的同级别节点,那么就表示,要在当前同级别的节点下新增一份当前复制的节点-新的表-新的表数据(根据所属方查询对应数据)。
-             *      2.4 如果点击选择的是当前复制节点本身的同级别节点的子节点,如果是复制本身相同的节点,那么就只复制数据。
-             *      2.5 如果点击选择的是当前复制节点本身的同级别节点的子节点,如果是复制本身不相同的节点,那么复制对应表数据,如果没有对应表,那么跳过。
+             *      2.2 如果点击选择的是当前复制节点本身的同等级节点,那么复制对应表数据,如果没有对应表,那么跳过。
              */
-        }/* else if (("2").equals(vo.getCopyType())) {
+        } else if (("2").equals(vo.getCopyType())) {
             //首先查询需要复制的节点的信息
             WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
             //获取需要复制到的位置节点信息的集合
@@ -1467,15 +1465,25 @@ public class InformationWriteQueryController extends BladeController {
                 Map<String, CopyContractTreeNodeVO.CopyBatch> toCopyMaps = copyBatches.stream().collect(Collectors.toMap(CopyContractTreeNodeVO.CopyBatch::getPrimaryKeyId, Function.identity()));
 
                 //结果集
-                List<WbsTreeContract> resultNodes = new ArrayList<>();
-                List<WbsTreeContract> resultTables = new ArrayList<>();
+                List<WbsTreeContract> addChildNodes = null;
+                List<WbsTreeContract> addChildNodesTables = null;
+                List<WbsTreeContract> addChildNodesTablesOld = null; //原始表单
                 List<String> resultTablesData = new ArrayList<>();
 
+                //表单所属方
+                String tabOwner = "";
+                if (("1,2").equals(vo.getClassifyType()) || ("2,1").equals(vo.getClassifyType())) {
+                    tabOwner = "1,2,3,4,5,6";
+                } else if (("1").equals(vo.getClassifyType())) {
+                    tabOwner = "1,2,3";
+                } else if (("2").equals(vo.getClassifyType())) {
+                    tabOwner = "4,5,6";
+                }
+
                 //解析位置信息,进行复制数据构造
                 for (WbsTreeContract toCopyNode : toCopyNodes) {
                     CopyContractTreeNodeVO.CopyBatch toCopyVO = toCopyMaps.get(toCopyNode.getPKeyId().toString());
                     if (toCopyVO != null) {
-
                         //TODO 同节点复制
                         if (new Integer(1).equals(toCopyVO.getIsSameNode())) {
                             //1.1 选择的同级的父级节点,新增
@@ -1483,67 +1491,157 @@ public class InformationWriteQueryController extends BladeController {
                                 toCopyNode.setNodeName(toCopyVO.getNodeName());
                                 toCopyNode.setPartitionCode(toCopyVO.getPartitionCode());
 
-                                //获取需要复制的所有节点
-                                List<WbsTreeContract> addChildNodes = this.getChildNodes(needCopyNode);
+                                //获取需要复制的所有子节点节点
+                                addChildNodes = this.getChildNodes(needCopyNode);
 
-                                if (addChildNodes == null || addChildNodes.size() == 0) {
+                                if (ObjectUtil.isEmpty(addChildNodes) || addChildNodes.size() == 0) {
                                     //最下层级节点复制
                                     addChildNodes = new ArrayList<>();
                                     addChildNodes.add(needCopyNode);
-                                    List<WbsTreeContract> addChildNodesTables = this.getChildNodesTables(addChildNodes, toCopyNode.getContractId());
-                                    //构造
-                                    this.addCopyNodesAndTabsBuildData(addChildNodes, addChildNodesTables, needCopyNode, toCopyNode, resultTablesData);
-                                    resultNodes = addChildNodes;
-                                    resultTables = addChildNodesTables;
-
-                                } else {
-                                    //多层级节点复制
-                                    List<WbsTreeContract> addChildNodesTables = this.getChildNodesTables(addChildNodes, toCopyNode.getContractId());
-                                    this.addCopyNodesAndTabsBuildData(addChildNodes, addChildNodesTables, needCopyNode, toCopyNode, resultTablesData);
-                                    resultNodes = addChildNodes;
-                                    resultTables = addChildNodesTables;
                                 }
 
+                                //获取所有复制的表
+                                addChildNodesTables = this.getChildNodesTables(addChildNodes, toCopyNode.getContractId());
+                                addChildNodesTablesOld = addChildNodesTables;
+                                //构造新的节点、表、数据
+                                this.addCopyNodesAndTabsBuildData(addChildNodes, addChildNodesTables, needCopyNode, toCopyNode, resultTablesData, 1, tabOwner, vo.getIsCopyData());
+
                                 //1.2 选择的同级的同级节点,只复制数据
                             } else if (needCopyNode.getParentId().equals(toCopyNode.getParentId())) {
-
-
+                                //构造数据
+                                this.addCopyTabData(needCopyNode, toCopyNode, tabOwner, resultTablesData, vo.getIsCopyData());
                             }
 
                             //TODO 跨节点复制
                         } else if (new Integer(0).equals(toCopyVO.getIsSameNode())) {
+                            //获取需要复制节点的上级
+                            WbsTreeContract parentNodeNeed = wbsTreeContractClient.getContractWbsTreeByContractIdAndId(needCopyNode.getParentId(), Long.parseLong(needCopyNode.getContractId()));
+                            //2.1 选择的父级的同级的父级节点,新增(跨节点新增)
+                            //当复制节点父级与选择复制到的位置节点的父级id相同时,表示新增
+                            if (parentNodeNeed != null && parentNodeNeed.getParentId().equals(toCopyNode.getParentId())) {
+                                toCopyNode.setNodeName(toCopyVO.getNodeName());
+                                toCopyNode.setPartitionCode(toCopyVO.getPartitionCode());
+
+                                //获取需要复制的所有子节点节点
+                                addChildNodes = this.getChildNodes(needCopyNode);
+
+                                if (ObjectUtil.isEmpty(addChildNodes) || addChildNodes.size() == 0) {
+                                    //最下层级节点复制
+                                    addChildNodes = new ArrayList<>();
+                                    addChildNodes.add(needCopyNode);
+                                }
 
+                                //获取所有复制的表
+                                addChildNodesTables = this.getChildNodesTables(addChildNodes, toCopyNode.getContractId());
+                                addChildNodesTablesOld = addChildNodesTables;
+                                //构造新的节点、表、数据
+                                this.addCopyNodesAndTabsBuildData(addChildNodes, addChildNodesTables, needCopyNode, toCopyNode, resultTablesData, 0, tabOwner, vo.getIsCopyData());
 
+                                //2.2 如果点击选择的是当前复制节点本身的同等级节点,那么就只复制数据。(如果是跨节点,类型相同的情况下,只复制数据)
+                            } else if (needCopyNode.getNodeType().equals(toCopyNode.getNodeType()) && !needCopyNode.getParentId().equals(toCopyNode.getParentId())) {
+                                //构造数据
+                                this.addCopyTabData(needCopyNode, toCopyNode, tabOwner, resultTablesData, vo.getIsCopyData());
+                            }
                         }
                     }
                 }
 
-                //入库
-                if (resultNodes.size() > 0) {
-                    wbsTreeContractClient.saveBatch(resultNodes);
+                //节点
+                if (addChildNodes != null && addChildNodes.size() > 0) {
+                    wbsTreeContractClient.saveBatch(addChildNodes);
+                    //更新redis缓存
+                    Map<Long, List<WbsTreeContract>> collect = addChildNodes.stream().filter(f -> new Integer(1).equals(f.getType()) && ObjectUtil.isNotEmpty(f.getParentId())).collect(Collectors.groupingBy(WbsTreeContract::getParentId));
+                    for (Map.Entry<Long, List<WbsTreeContract>> longListEntry : collect.entrySet()) {
+                        informationQueryService.AsyncWbsTree("", longListEntry.getKey().toString(), needCopyNode.getContractId(), "", "1");
+                    }
                 }
-                if (resultTables.size() > 0) {
-                    wbsTreeContractClient.saveBatch(resultTables);
+                //元素表
+                if (addChildNodesTables != null && addChildNodesTables.size() > 0) {
+                    wbsTreeContractClient.saveBatch(addChildNodesTables);
+
+                    if (addChildNodesTablesOld.size() > 0) {
+                        //文件附件新增 TODO
+
+                    }
                 }
+                //实体表数据
                 if (resultTablesData.size() > 0) {
                     jdbcTemplate.execute(StringUtils.join(resultTablesData, ""));
                 }
-
+                return R.success("操作成功");
             }
-            return null;
-        }*/
-        return null;
+        }
+        return R.fail("操作失败");
     }
 
-    //新增复制节点、表的数据构造
-    private void addCopyNodesAndTabsBuildData(List<WbsTreeContract> needNodes, List<WbsTreeContract> needTabs, WbsTreeContract needCopyNode, WbsTreeContract toCopyNode, List<String> resultTablesData) {
-        Map<Long, Long> parentIdToId = new HashMap<>();
+    /**
+     * 复制数据
+     */
+    private void addCopyTabData(WbsTreeContract needCopyNode, WbsTreeContract toCopyNode, String tabOwner, List<String> resultTablesData, Integer isCopyData) {
+        List<WbsTreeContract> wbsTreeContractsNeed = Collections.singletonList(needCopyNode);
+        List<WbsTreeContract> wbsTreeContractsTo = Collections.singletonList(toCopyNode);
+        List<WbsTreeContract> needCopyNodeTabs = getChildNodesTables(wbsTreeContractsNeed, needCopyNode.getContractId());
+        List<WbsTreeContract> toCopyNodeTabs = getChildNodesTables(wbsTreeContractsTo, needCopyNode.getContractId());
+        if (needCopyNodeTabs.size() > 0) {
+            for (WbsTreeContract needTab : needCopyNodeTabs) {
+                for (WbsTreeContract toCopyNodeTab : toCopyNodeTabs) {
+                    //获取相同表单 nodeName 、HtmlUrl相同
+                    if (needTab.getNodeName().equals(toCopyNodeTab.getNodeName()) && (ObjectUtil.isNotEmpty(needTab.getHtmlUrl()) && ObjectUtil.isNotEmpty(toCopyNodeTab.getHtmlUrl()) && needTab.getHtmlUrl().equals(toCopyNodeTab.getHtmlUrl()))) {
+                        if (StringUtils.isEmpty(needTab.getInitTableName())) {
+                            //没有对应实体表,跳过
+                            continue;
+                        }
+                        Long oldPKeyId = needTab.getPKeyId();
+
+                        //表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
+                        if (tabOwner.contains(needTab.getTableOwner()) && isCopyData == 1) {
+                            //获取实体表列对象
+                            List<QueryProcessDataVO> nodeTabColOneTab = informationQueryService.getNodeChildTabColsAllByTabName(needTab.getInitTableName());
+                            //转化为map
+                            Map<String, String> nodeTabColsMap = nodeTabColOneTab.stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, QueryProcessDataVO::getAncestors, (key1, key2) -> key2));
+                            //组织复制表的数据的sql
+                            if (nodeTabColsMap.size() > 0) {
+                                StringBuilder copyDataSql = new StringBuilder();
+                                String tableName = needTab.getInitTableName();
+                                String col = nodeTabColsMap.get(tableName);
+                                String colVal = nodeTabColsMap.get(tableName);
+                                colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + toCopyNodeTab.getPKeyId() + "' as p_key_id,");
+                                //delete SQL (先删除旧数据,再新增)
+                                String delSql = "delete from " + tableName + " where p_key_id = " + toCopyNodeTab.getPKeyId() + " ; ";
+                                //insert into SQL
+                                copyDataSql.append(delSql).append("insert into ").append(tableName).append("  (").append(col).append(") select ").append(colVal).append(" from ").append(tableName).append(" where p_key_id='").append(oldPKeyId).append("' ;");
+                                resultTablesData.add(copyDataSql.toString());
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
 
-        //TODO 最下层级节点复制
+    /**
+     * 新增复制节点、表的数据构造
+     */
+    private void addCopyNodesAndTabsBuildData(List<WbsTreeContract> needNodes, List<WbsTreeContract> needTabs, WbsTreeContract needCopyNode, WbsTreeContract toCopyNode, List<String> resultTablesData, Integer isSameNode, String tabOwner, Integer isCopyData) {
+        int var = 0;
         if (needNodes.size() == 1) {
-            //todo 构造节点
+            //判断是否为最下级节点
+            WbsTreeContract wbsTreeContract = needNodes.stream().filter(f -> f.getPKeyId().equals(needCopyNode.getPKeyId())).findAny().orElse(null);
+            if (wbsTreeContract != null) {
+                var = 1;
+            }
+        }
+
+        //最下层级节点复制
+        if (var == 1) {
+            //构造节点
             Long id = SnowFlakeUtil.getId();
             for (WbsTreeContract needNode : needNodes) {
+                if (isSameNode == 0) {
+                    //跨节点复制,更改父级id
+                    needNode.setParentId(toCopyNode.getId());
+                }
+                needNode.setOldId(needNode.getId() + "");
                 needNode.setPKeyId(SnowFlakeUtil.getId());
                 needNode.setId(id);
                 needNode.setNodeName(toCopyNode.getNodeName());
@@ -1551,8 +1649,9 @@ public class InformationWriteQueryController extends BladeController {
                 needNode.setPartitionCode(toCopyNode.getPartitionCode());
                 break;
             }
-            //todo 构造当前节点下所有元素表
+            //构造当前节点下所有元素表
             for (WbsTreeContract needTab : needTabs) {
+
                 if (StringUtils.isEmpty(needTab.getInitTableName())) {
                     continue;
                 }
@@ -1572,29 +1671,37 @@ public class InformationWriteQueryController extends BladeController {
                 //初始化PDF路径
                 needTab.setPdfUrl(null);
 
-                //获取实体表列对象
-                List<QueryProcessDataVO> nodeTabColOneTab = informationQueryService.getNodeChildTabColsAllByTabName(needTab.getInitTableName());
-                //转化为map
-                Map<String, String> nodeTabColsMap = nodeTabColOneTab.stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, QueryProcessDataVO::getAncestors, (key1, key2) -> key2));
-                //组织复制表的数据的sql
-                if (nodeTabColsMap.size() > 0) {
-                    StringBuilder copyDataSql = new StringBuilder();
-                    String tableName = needTab.getInitTableName();
-                    String col = nodeTabColsMap.get(tableName);
-                    String colVal = nodeTabColsMap.get(tableName);
-                    colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + needTab.getPKeyId() + "' as p_key_id,");
-                    copyDataSql.append("insert into ").append(tableName).append("  (").append(col).append(") select ").append(colVal).append(" from ").append(tableName).append(" where p_key_id='").append(oldPKeyId).append("' ;");
-                    resultTablesData.add(copyDataSql.toString());
+                //表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
+                if (tabOwner.contains(needTab.getTableOwner()) && isCopyData == 1) {
+                    //获取实体表列对象
+                    List<QueryProcessDataVO> nodeTabColOneTab = informationQueryService.getNodeChildTabColsAllByTabName(needTab.getInitTableName());
+                    //转化为map
+                    Map<String, String> nodeTabColsMap = nodeTabColOneTab.stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, QueryProcessDataVO::getAncestors, (key1, key2) -> key2));
+                    //组织复制表的数据的sql
+                    if (nodeTabColsMap.size() > 0) {
+                        StringBuilder copyDataSql = new StringBuilder();
+                        String tableName = needTab.getInitTableName();
+                        String col = nodeTabColsMap.get(tableName);
+                        String colVal = nodeTabColsMap.get(tableName);
+                        colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + needTab.getPKeyId() + "' as p_key_id,");
+                        copyDataSql.append("insert into ").append(tableName).append("  (").append(col).append(") select ").append(colVal).append(" from ").append(tableName).append(" where p_key_id='").append(oldPKeyId).append("' ;");
+                        resultTablesData.add(copyDataSql.toString());
+                    }
                 }
             }
 
-            //TODO 多层级节点复制
+            //多层级节点复制
         } else {
-            Map<Long, List<WbsTreeContract>> tabMap = needTabs.stream().collect(Collectors.groupingBy(WbsTreeContract::getParentId));
+            //根节点id
+            Long toCopyNodeOldId = toCopyNode.getId();
             toCopyNode.setId(SnowFlakeUtil.getId());
+
+            Map<Long, Long> parentIdToId = new HashMap<>();
+            Map<Long, List<WbsTreeContract>> tabMap = needTabs.stream().collect(Collectors.groupingBy(WbsTreeContract::getParentId));
+
             for (WbsTreeContract node : needNodes) {
                 Long oldId = node.getId();
-                //todo 构造节点
+                //构造节点
                 Long newParentId;
                 if (parentIdToId.size() > 0) {
                     //去数据源节点获取父级id对应的新id,设置成重设后的新的父级id
@@ -1617,7 +1724,7 @@ public class InformationWriteQueryController extends BladeController {
                 node.setId(id);
                 node.setParentId(newParentId);
 
-                //todo 构造当前节点下所有元素表
+                //构造当前节点下所有元素表
                 List<WbsTreeContract> tabs = tabMap.get(oldId);
                 //构造节点下的表
                 if (tabs != null && tabs.size() > 0) {
@@ -1641,29 +1748,47 @@ public class InformationWriteQueryController extends BladeController {
                         //初始化PDF路径
                         needTab.setPdfUrl(null);
 
-                        //获取实体表列对象
-                        List<QueryProcessDataVO> nodeTabColOneTab = informationQueryService.getNodeChildTabColsAllByTabName(needTab.getInitTableName());
-                        //转化为map
-                        Map<String, String> nodeTabColsMap = nodeTabColOneTab.stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, QueryProcessDataVO::getAncestors, (key1, key2) -> key2));
-                        //组织复制表的数据的sql
-                        if (nodeTabColsMap.size() > 0) {
-                            StringBuilder copyDataSql = new StringBuilder();
-                            String tableName = needTab.getInitTableName();
-                            String col = nodeTabColsMap.get(tableName);
-                            String colVal = nodeTabColsMap.get(tableName);
-                            colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + needTab.getPKeyId() + "' as p_key_id,");
-                            copyDataSql.append("insert into ").append(tableName).append("  (").append(col).append(") select ").append(colVal).append(" from ").append(tableName).append(" where p_key_id='").append(oldPKeyId).append("' ;");
-                            resultTablesData.add(copyDataSql.toString());
+                        //表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
+                        if (tabOwner.contains(needTab.getTableOwner()) && isCopyData == 1) {
+                            //获取实体表列对象
+                            List<QueryProcessDataVO> nodeTabColOneTab = informationQueryService.getNodeChildTabColsAllByTabName(needTab.getInitTableName());
+                            //转化为map
+                            Map<String, String> nodeTabColsMap = nodeTabColOneTab.stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, QueryProcessDataVO::getAncestors, (key1, key2) -> key2));
+                            //组织复制表的数据的sql
+                            if (nodeTabColsMap.size() > 0) {
+                                StringBuilder copyDataSql = new StringBuilder();
+                                String tableName = needTab.getInitTableName();
+                                String col = nodeTabColsMap.get(tableName);
+                                String colVal = nodeTabColsMap.get(tableName);
+                                colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + needTab.getPKeyId() + "' as p_key_id,");
+                                copyDataSql.append("insert into ").append(tableName).append("  (").append(col).append(") select ").append(colVal).append(" from ").append(tableName).append(" where p_key_id='").append(oldPKeyId).append("' ;");
+                                resultTablesData.add(copyDataSql.toString());
+                            }
                         }
                     }
                 }
             }
+
             //添加根节点
+            toCopyNode.setOldId(needCopyNode.getId() + "");
+            if (isSameNode == 1) {
+                //同节点
+                toCopyNode.setParentId(needCopyNode.getParentId());
+            } else {
+                //跨节点
+                toCopyNode.setParentId(toCopyNodeOldId);
+            }
+            toCopyNode.setPKeyId(SnowFlakeUtil.getId());
+            toCopyNode.setNodeName(toCopyNode.getNodeName());
+            toCopyNode.setFullName(toCopyNode.getNodeName());
+            toCopyNode.setPartitionCode(toCopyNode.getPartitionCode());
             needNodes.add(toCopyNode);
         }
     }
 
-    //获取所有子级节点
+    /**
+     * 获取所有子级节点
+     */
     private List<WbsTreeContract> getChildNodes(WbsTreeContract obj) {
         if (obj != null) {
             List<WbsTreeContract> wbsTreeContracts = Collections.singletonList(obj);
@@ -1676,7 +1801,6 @@ public class InformationWriteQueryController extends BladeController {
         return null;
     }
 
-    //递归获取所有子级节点
     private void recursionGetChildNodes(List<WbsTreeContract> list, List<WbsTreeContract> result, String contractId) {
         List<Long> ids = list.stream().map(WbsTreeContract::getId).collect(Collectors.toList());
         if (ids.size() > 0) {
@@ -1688,7 +1812,9 @@ public class InformationWriteQueryController extends BladeController {
         }
     }
 
-    //获取所有子级下的表
+    /**
+     * 获取所有子级下的表
+     */
     private List<WbsTreeContract> getChildNodesTables(List<WbsTreeContract> list, String contractId) {
         if (list != null && list.size() > 0) {
             List<Long> parentIds = list.stream().map(WbsTreeContract::getId).collect(Collectors.toList());
@@ -1923,7 +2049,8 @@ public class InformationWriteQueryController extends BladeController {
     /**
      * 生成施工日志记录
      */
-    private void createLedger(WbsTreeContract newData, List<ConstructionLedger> saveLedger, Map<String, WbsTreeContract> contractNodeMap, Map<String, WbsTreePrivate> projectNodeMap) {
+    private void createLedger(WbsTreeContract
+                                      newData, List<ConstructionLedger> saveLedger, Map<String, WbsTreeContract> contractNodeMap, Map<String, WbsTreePrivate> projectNodeMap) {
         //工序,需要新增施工台账
         ConstructionLedger ledger = new ConstructionLedger();
         //获取这个节点的原始信息
@@ -1977,7 +2104,8 @@ public class InformationWriteQueryController extends BladeController {
      * @param parentList 父节点集合
      * @param childList  保存集合
      */
-    private void foreachQueryChildContract(List<WbsTreeContract> parentList, List<WbsTreeContract> childList, Map<String, List<WbsTreeContract>> contractAllNodeMap) {
+    private void foreachQueryChildContract
+    (List<WbsTreeContract> parentList, List<WbsTreeContract> childList, Map<String, List<WbsTreeContract>> contractAllNodeMap) {
         parentList.forEach(parent -> {
             List<WbsTreeContract> childs;
             if (contractAllNodeMap.containsKey(parent.getId().toString())) {
@@ -2018,7 +2146,8 @@ public class InformationWriteQueryController extends BladeController {
             @ApiImplicitParam(name = "wbsType", value = "模板类型, 1质检,2试验", required = true),
             @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
     })
-    public R<List<WbsTreeContractTreeVOS>> queryMappingStructureTree(@RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation) {
+    public R<List<WbsTreeContractTreeVOS>> queryMappingStructureTree(@RequestParam String
+                                                                             parentId, @RequestParam String contractId, @RequestParam String contractIdRelation) {
         List<WbsTreeContractTreeVOS> result = this.informationQueryService.queryContractTree(parentId, contractId, contractIdRelation, null);
         if (result.size() == 1) {
             //只有一个子节点,继续向下
@@ -2070,7 +2199,8 @@ public class InformationWriteQueryController extends BladeController {
             @ApiImplicitParam(name = "nodeName", value = "节点的title", required = true),
             @ApiImplicitParam(name = "partitionCode", value = "划分编号")
     })
-    public R<Boolean> updateContractNodeParameter(@RequestParam Long pKeyId, @RequestParam String nodeName, @RequestParam String partitionCode) {
+    public R<Boolean> updateContractNodeParameter(@RequestParam Long pKeyId, @RequestParam String
+            nodeName, @RequestParam String partitionCode) {
         WbsTreeContract node = new WbsTreeContract();
         node.setPKeyId(pKeyId);
         node.setNodeName(nodeName);
@@ -2380,7 +2510,8 @@ public class InformationWriteQueryController extends BladeController {
         return booleanR;
     }
 
-    private List<WbsTreePrivate> unifiedCode(List<AddContractTreeNodeVO.Node> allSelectedNodeList, WbsTreeContract treeContract) {
+    private List<WbsTreePrivate> unifiedCode
+            (List<AddContractTreeNodeVO.Node> allSelectedNodeList, WbsTreeContract treeContract) {
         //获取主键
         List<String> halfSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).distinct().collect(Collectors.toList());
         //查询数据
@@ -2392,7 +2523,9 @@ public class InformationWriteQueryController extends BladeController {
     }
 
     @NotNull
-    private R<Boolean> saveOrCopyNodeTree(List<WbsTreeContract> saveList, List<ConstructionLedger> saveLedger, Integer operationType, WbsTreeContract currentNode) {
+    private R<Boolean> saveOrCopyNodeTree
+            (List<WbsTreeContract> saveList, List<ConstructionLedger> saveLedger, Integer
+                    operationType, WbsTreeContract currentNode) {
 
         if (saveList.size() > 0) {
             StringBuilder str = new StringBuilder();
@@ -2446,7 +2579,8 @@ public class InformationWriteQueryController extends BladeController {
     /**
      * 处理半选集合
      */
-    private void disposeHalfSelectList(@RequestBody WbsTreeContract treeContract, List<AddContractTreeNodeVO.Node> allSelectedNodeList, List<WbsTreePrivate> selectedNodeList) {
+    private void disposeHalfSelectList(@RequestBody WbsTreeContract
+                                               treeContract, List<AddContractTreeNodeVO.Node> allSelectedNodeList, List<WbsTreePrivate> selectedNodeList) {
         if (allSelectedNodeList != null && allSelectedNodeList.size() > 0) {
             //获取主键
             List<String> allSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).distinct().collect(Collectors.toList());
@@ -2492,7 +2626,8 @@ public class InformationWriteQueryController extends BladeController {
             @ApiImplicitParam(name = "projectId", value = "项目ID"),
             @ApiImplicitParam(name = "id", value = "点击节点ID")
     })
-    public R<List<WbsTreeContractTreeVOS>> queryWbsTreePrivateByProjectIdAndId(@RequestParam String projectId, @RequestParam String id) {
+    public R<List<WbsTreeContractTreeVOS>> queryWbsTreePrivateByProjectIdAndId(@RequestParam String
+                                                                                       projectId, @RequestParam String id) {
         List<WbsTreeContractTreeVOS> result = new ArrayList<>();
 
         if (StringUtils.isNotEmpty(id)) {
@@ -2666,7 +2801,9 @@ public class InformationWriteQueryController extends BladeController {
             @ApiImplicitParam(name = "parentId", value = "父节点,为空则查询第一级节点"),
             @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
     })
-    public R<List<WbsTreeContractTreeVOS>> queryStandingBookContractWbsTree(@RequestParam String primaryKeyId, @RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation) {
+    public R<List<WbsTreeContractTreeVOS>> queryStandingBookContractWbsTree(@RequestParam String
+                                                                                    primaryKeyId, @RequestParam String parentId, @RequestParam String contractId, @RequestParam String
+                                                                                    contractIdRelation) {
         if (StringUtils.isNotEmpty(primaryKeyId)) {
             parentId = primaryKeyId;
         }
@@ -2689,7 +2826,8 @@ public class InformationWriteQueryController extends BladeController {
             @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true),
             @ApiImplicitParam(name = "classifyType", value = "所属方,监理、总监办的资料查询使用,=1施工数据(默认),=2监理数据")
     })
-    public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByContractIdAndType(@RequestParam String primaryKeyId,
+    public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByContractIdAndType(@RequestParam String
+                                                                                           primaryKeyId,
                                                                                    @RequestParam String parentId,
                                                                                    @RequestParam String contractId,
                                                                                    @RequestParam String contractIdRelation,
@@ -2757,7 +2895,8 @@ public class InformationWriteQueryController extends BladeController {
             @ApiImplicitParam(name = "parentId", value = "父节点,为空则查询第一级节点"),
             @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
     })
-    public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByFirstInfo(@RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation) {
+    public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByFirstInfo(@RequestParam String
+                                                                                   parentId, @RequestParam String contractId, @RequestParam String contractIdRelation) {
         List<WbsTreeContractTreeVOS> rootTreeNode = informationQueryService.queryContractTree(parentId, contractId, contractIdRelation, null);
         //查询被标记为首件的数据
         rootTreeNode = rootTreeNode.stream().filter(WbsTreeContractTreeVOS::getIsFirst).collect(Collectors.toList());

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreeContractClientImpl.java

@@ -156,7 +156,7 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
 
     @Override
     public WbsTreeContract getContractWbsTreeByContractIdAndId(Long id, Long contractId) {
-        return this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getId, id.toString()).eq(WbsTreeContract::getContractId, contractId.toString()));
+        return this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getId, id).eq(WbsTreeContract::getContractId, contractId.toString()));
     }
 
     @Override