Browse Source

客户端节点多份复制相关

liuyc 2 years ago
parent
commit
0216bc6570

+ 4 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/TableFileClient.java

@@ -2,6 +2,7 @@ package org.springblade.manager.feign;
 
 import org.springblade.manager.entity.TableFile;
 import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -28,4 +29,7 @@ public interface TableFileClient {
     @PostMapping(API_PREFIX + "/saveBatch")
     boolean saveBatch(@RequestBody List<TableFile> newFiles);
 
+    @GetMapping(API_PREFIX + "/getTabFilesByTabIds")
+    List<TableFile> getTabFilesByTabIds(@RequestParam String tabFileIds);
+
 }

+ 4 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/WbsTreeContractClient.java

@@ -22,6 +22,9 @@ public interface WbsTreeContractClient {
      */
     String API_PREFIX = "/api/manager/WbsTreeContract";
 
+    @GetMapping(API_PREFIX + "/queryContractTreeNodeByPKeyId")
+    WbsTreeContract queryContractTreeNodeByPKeyId(@RequestParam Long toCopyNodePKeyId);
+
     @PostMapping(API_PREFIX + "/queryContractTreeNodeByPKIds")
     List<WbsTreeContract> queryContractTreeNodeByPKIds(@RequestParam List<Long> PKIds);
 
@@ -157,4 +160,5 @@ public interface WbsTreeContractClient {
     @PostMapping(API_PREFIX + "/queryContractFirstTab")
     List<WbsTreeContract> queryContractFirstTab(@RequestParam String contractId, @RequestParam String tabType);
 
+
 }

+ 148 - 95
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -1,7 +1,5 @@
 package org.springblade.business.controller;
 
-import cn.hutool.core.lang.hash.Hash;
-import com.alibaba.excel.util.DateUtils;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -10,7 +8,6 @@ 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;
@@ -29,12 +26,9 @@ import org.springblade.business.service.*;
 import org.springblade.business.socket.WebSocket;
 import org.springblade.business.utils.FileUtils;
 import org.springblade.business.vo.*;
-import org.springblade.common.constant.BusinessConstant;
 import org.springblade.common.constant.CommonConstant;
-import org.springblade.common.constant.LauncherConstant;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
-import org.springblade.core.cache.utils.CacheUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
@@ -42,10 +36,7 @@ import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.node.ForestNodeMerger;
-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.StringUtil;
+import org.springblade.core.tool.utils.*;
 import org.springblade.evisa.feign.EVisaClient;
 import org.springblade.evisa.vo.CertBeanVO;
 import org.springblade.manager.entity.*;
@@ -57,11 +48,6 @@ import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.CachePut;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.cache.annotation.Caching;
-import org.springframework.data.redis.core.RedisConnectionUtils;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -72,11 +58,8 @@ import org.springblade.core.boot.ctrl.BladeController;
 
 import java.io.IOException;
 import java.util.*;
-import java.util.function.Function;
 import java.util.stream.Collectors;
 
-import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
-
 /**
  * 资料填报及查询控制器
  *
@@ -920,7 +903,7 @@ public class InformationWriteQueryController extends BladeController {
     @ApiOperation(value = "批量打印")
     public R<String> batchPrint(@RequestParam String ids) {
         //判断是否未生成文件
-        List<String> list = Arrays.asList(ids.split(","));
+        String[] list = ids.split(",");
         for (String s : list) {
             if (StringUtils.isBlank(s)) {
                 return R.fail("选择的资料未生成文件");
@@ -982,7 +965,7 @@ public class InformationWriteQueryController extends BladeController {
     public R<String> batchDownloadFileToZip(String ids, HttpServletResponse response) {
         if (StringUtils.isNotEmpty(ids)) {
             //判断是否未生成文件
-            List<String> list = Arrays.asList(ids.split(","));
+            String[] list = ids.split(",");
             for (String s : list) {
                 if (StringUtils.isBlank(s)) {
                     return R.fail("选择的资料未生成文件");
@@ -1454,20 +1437,26 @@ public class InformationWriteQueryController extends BladeController {
              *      2.2 如果点击选择的是当前复制节点本身的同等级节点,那么复制对应表数据,如果没有对应表,那么跳过。
              */
         } else if (("2").equals(vo.getCopyType())) {
-            //首先查询需要复制的节点的信息
-            WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
             //获取需要复制到的位置节点信息的集合
             List<CopyContractTreeNodeVO.CopyBatch> copyBatches = vo.getCopyBatchToPaths();
-            if (needCopyNode != null && copyBatches.size() > 0) {
+            if (copyBatches.size() > 0) {
                 //获取当前需要复制到的位置节点信息,判断同节点复制或跨节点复制
                 List<Long> toCopyNodePKeyIds = copyBatches.stream().map(CopyContractTreeNodeVO.CopyBatch::getPrimaryKeyId).map(Long::valueOf).collect(Collectors.toList());
-                List<WbsTreeContract> toCopyNodes = wbsTreeContractClient.queryContractTreeNodeByPKIds(toCopyNodePKeyIds);
-                Map<String, CopyContractTreeNodeVO.CopyBatch> toCopyMaps = copyBatches.stream().collect(Collectors.toMap(CopyContractTreeNodeVO.CopyBatch::getPrimaryKeyId, Function.identity()));
+                List<WbsTreeContract> toCopyNodes = new ArrayList<>();
+                String contractId = "";
+                //选择的复制节点PKeyId可能一样(选择相同节点复制),所以循环分开查询
+                for (Long toCopyNodePKeyId : toCopyNodePKeyIds) {
+                    WbsTreeContract toCopyNode = wbsTreeContractClient.queryContractTreeNodeByPKeyId(toCopyNodePKeyId);
+                    toCopyNodes.add(toCopyNode);
+                    if (StringUtils.isEmpty(contractId)) {
+                        contractId = toCopyNode.getContractId();
+                    }
+                }
 
                 //结果集
-                List<WbsTreeContract> addChildNodes = null;
-                List<WbsTreeContract> addChildNodesTables = null;
-                List<WbsTreeContract> addChildNodesTablesOld = null; //原始表单
+                List<WbsTreeContract> addChildNodesAll = new ArrayList<>();
+                List<WbsTreeContract> addChildNodesTablesAll = new ArrayList<>();
+                Set<WbsTreeContract> addChildNodesTablesOldAll = new HashSet<>();
                 List<String> resultTablesData = new ArrayList<>();
 
                 //表单所属方
@@ -1481,87 +1470,109 @@ public class InformationWriteQueryController extends BladeController {
                 }
 
                 //解析位置信息,进行复制数据构造
-                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 选择的同级的父级节点,新增
-                            if (needCopyNode.getParentId().equals(toCopyNode.getId())) {
-                                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);
-                                }
+                if (toCopyNodes.size() == copyBatches.size()) {
+                    for (int i = 0; i < toCopyNodes.size(); i++) {
+                        //首先查询需要复制的节点的信息
+                        WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
+                        WbsTreeContract toCopyNode = toCopyNodes.get(i);
+                        CopyContractTreeNodeVO.CopyBatch toCopyVO = copyBatches.get(i);
+
+                        if (toCopyNode != null && toCopyVO != null && needCopyNode != null) {
+                            //TODO 同节点复制
+                            if (new Integer(1).equals(toCopyVO.getIsSameNode())) {
+                                //1.1 选择当前节点的父级节点,新增
+                                if (needCopyNode.getParentId().equals(toCopyNode.getId())) {
+                                    toCopyNode.setNodeName(toCopyVO.getNodeName());
+                                    toCopyNode.setPartitionCode(toCopyVO.getPartitionCode());
+
+                                    //获取需要复制的所有子节点
+                                    List<WbsTreeContract> 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, 1, tabOwner, vo.getIsCopyData());
+                                    //获取所有复制的表
+                                    List<WbsTreeContract> addChildNodesTables = this.getChildNodesTables(addChildNodes, toCopyNode.getContractId());
 
-                                //1.2 选择的同级的同级节点,只复制数据
-                            } else if (needCopyNode.getParentId().equals(toCopyNode.getParentId())) {
-                                //构造数据
-                                this.addCopyTabData(needCopyNode, toCopyNode, tabOwner, resultTablesData, vo.getIsCopyData());
-                            }
+                                    //复制数据源表,文件附件用
+                                    List<WbsTreeContract> oldTab = BeanUtil.copyProperties(addChildNodesTables, WbsTreeContract.class);
+                                    addChildNodesTablesOldAll.addAll(oldTab);
 
-                            //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());
+                                    //构造新的节点、表、数据
+                                    this.addCopyNodesAndTabsBuildData(addChildNodes, addChildNodesTables, needCopyNode, toCopyNode, resultTablesData, 1, tabOwner, vo.getIsCopyData());
 
-                                //获取需要复制的所有子节点节点
-                                addChildNodes = this.getChildNodes(needCopyNode);
+                                    //返回结果集
+                                    addChildNodesAll.addAll(addChildNodes);
+                                    addChildNodesTablesAll.addAll(addChildNodesTables);
 
-                                if (ObjectUtil.isEmpty(addChildNodes) || addChildNodes.size() == 0) {
-                                    //最下层级节点复制
-                                    addChildNodes = new ArrayList<>();
-                                    addChildNodes.add(needCopyNode);
+                                    //1.2 选择同父级的同级节点,只复制数据
+                                } else if (needCopyNode.getParentId().equals(toCopyNode.getParentId())) {
+                                    //构造数据
+                                    this.addCopyTabData(needCopyNode, toCopyNode, tabOwner, resultTablesData, addChildNodesTablesOldAll, addChildNodesTablesAll, vo.getIsCopyData());
                                 }
 
-                                //获取所有复制的表
-                                addChildNodesTables = this.getChildNodesTables(addChildNodes, toCopyNode.getContractId());
-                                addChildNodesTablesOld = addChildNodesTables;
-                                //构造新的节点、表、数据
-                                this.addCopyNodesAndTabsBuildData(addChildNodes, addChildNodesTables, needCopyNode, toCopyNode, resultTablesData, 0, tabOwner, 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());
+
+                                    //获取需要复制的所有子节点
+                                    List<WbsTreeContract> addChildNodes = this.getChildNodes(needCopyNode);
+
+                                    //最下层级节点复制
+                                    if (ObjectUtil.isEmpty(addChildNodes) || addChildNodes.size() == 0) {
+                                        addChildNodes = new ArrayList<>();
+                                        addChildNodes.add(needCopyNode);
+                                    }
+
+                                    //获取所有复制的表
+                                    List<WbsTreeContract> addChildNodesTables = this.getChildNodesTables(addChildNodes, toCopyNode.getContractId());
+
+                                    //复制数据源表,文件附件用
+                                    List<WbsTreeContract> oldTab = BeanUtil.copyProperties(addChildNodesTables, WbsTreeContract.class);
+                                    addChildNodesTablesOldAll.addAll(oldTab);
+
+                                    //构造新的节点、表、数据
+                                    this.addCopyNodesAndTabsBuildData(addChildNodes, addChildNodesTables, needCopyNode, toCopyNode, resultTablesData, 0, tabOwner, vo.getIsCopyData());
+
+                                    //返回结果集
+                                    addChildNodesAll.addAll(addChildNodes);
+                                    addChildNodesTablesAll.addAll(addChildNodesTables);
 
-                                //2.2 如果点击选择的是当前复制节点本身的同等级节点,那么就只复制数据。(如果是跨节点,类型相同的情况下,只复制数据)
-                            } else if (needCopyNode.getNodeType().equals(toCopyNode.getNodeType()) && !needCopyNode.getParentId().equals(toCopyNode.getParentId())) {
-                                //构造数据
-                                this.addCopyTabData(needCopyNode, toCopyNode, tabOwner, resultTablesData, vo.getIsCopyData());
+                                    //2.2 如果点击选择的是当前复制节点本身的同等级节点,那么就只复制数据。(如果是跨节点,类型相同的情况下,只复制数据)
+                                } else if (needCopyNode.getNodeType().equals(toCopyNode.getNodeType()) && !needCopyNode.getParentId().equals(toCopyNode.getParentId())) {
+                                    //构造数据
+                                    this.addCopyTabData(needCopyNode, toCopyNode, tabOwner, resultTablesData, addChildNodesTablesOldAll, addChildNodesTablesAll, vo.getIsCopyData());
+                                }
                             }
                         }
                     }
                 }
 
                 //节点
-                if (addChildNodes != null && addChildNodes.size() > 0) {
-                    wbsTreeContractClient.saveBatch(addChildNodes);
+                if (addChildNodesAll.size() > 0) {
+                    wbsTreeContractClient.saveBatch(addChildNodesAll);
                     //更新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));
+                    Map<Long, List<WbsTreeContract>> collect = addChildNodesAll.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");
+                        informationQueryService.AsyncWbsTree("", longListEntry.getKey().toString(), contractId, "", "1");
                     }
                 }
                 //元素表
-                if (addChildNodesTables != null && addChildNodesTables.size() > 0) {
-                    wbsTreeContractClient.saveBatch(addChildNodesTables);
-
-                    if (addChildNodesTablesOld.size() > 0) {
-                        //文件附件新增 TODO
+                if (addChildNodesTablesAll.size() > 0) {
+                    wbsTreeContractClient.saveBatch(addChildNodesTablesAll);
 
+                    //表单文件附件
+                    if (addChildNodesTablesOldAll.size() > 0 && vo.getIsCopyData() == 1) {
+                        this.addCopyTabFile(addChildNodesTablesAll, addChildNodesTablesOldAll);
                     }
                 }
                 //实体表数据
@@ -1575,9 +1586,41 @@ public class InformationWriteQueryController extends BladeController {
     }
 
     /**
-     * 复制数据
+     * 新增复制的表单文件
      */
-    private void addCopyTabData(WbsTreeContract needCopyNode, WbsTreeContract toCopyNode, String tabOwner, List<String> resultTablesData, Integer isCopyData) {
+    @Async
+    public void addCopyTabFile(List<WbsTreeContract> addChildNodesTables, Set<WbsTreeContract> addChildNodesTablesOld) {
+        //获取所有数据源附件文件
+        List<Long> tabFileIds = addChildNodesTablesOld.stream().distinct().map(WbsTreeContract::getPKeyId).collect(Collectors.toList());
+        Map<String, List<TableFile>> tableFileOldMap = tableFileClient.getTabFilesByTabIds(StringUtils.join(tabFileIds, ",")).stream().collect(Collectors.groupingBy(TableFile::getTabId));
+        if (tableFileOldMap != null && tableFileOldMap.size() > 0) {
+            List<TableFile> resultFileData = new ArrayList<>();
+            for (WbsTreeContract tabOld : addChildNodesTablesOld) {
+                for (WbsTreeContract tabNew : addChildNodesTables) {
+                    //获取对应表
+                    if (tabOld.getNodeName().equals(tabNew.getNodeName()) && (ObjectUtil.isNotEmpty(tabOld.getHtmlUrl()) && ObjectUtil.isNotEmpty(tabNew.getHtmlUrl()) && tabOld.getHtmlUrl().equals(tabNew.getHtmlUrl()))) {
+                        //构建文件数据
+                        List<TableFile> tab = tableFileOldMap.get(tabOld.getPKeyId() + "");
+                        if (tab != null && tab.size() > 0) {
+                            tab.forEach(file -> {
+                                file.setTabId(tabNew.getPKeyId() + "");
+                                file.setId(SnowFlakeUtil.getId());
+                            });
+                            resultFileData.addAll(tab);
+                        }
+                    }
+                }
+            }
+            if (resultFileData.size() > 0) {
+                tableFileClient.saveBatch(resultFileData);
+            }
+        }
+    }
+
+    /**
+     * 新增复制的数据
+     */
+    private void addCopyTabData(WbsTreeContract needCopyNode, WbsTreeContract toCopyNode, String tabOwner, List<String> resultTablesData, Set<WbsTreeContract> addChildNodesTablesOldAll, List<WbsTreeContract> addChildNodesTablesAll, Integer isCopyData) {
         List<WbsTreeContract> wbsTreeContractsNeed = Collections.singletonList(needCopyNode);
         List<WbsTreeContract> wbsTreeContractsTo = Collections.singletonList(toCopyNode);
         List<WbsTreeContract> needCopyNodeTabs = getChildNodesTables(wbsTreeContractsNeed, needCopyNode.getContractId());
@@ -1595,6 +1638,15 @@ public class InformationWriteQueryController extends BladeController {
 
                         //表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
                         if (tabOwner.contains(needTab.getTableOwner()) && isCopyData == 1) {
+
+                            //源表obj对象,文件附件使用
+                            addChildNodesTablesOldAll.add(needTab);
+                            if (!needTab.getTabFileType().equals(toCopyNodeTab.getTabFileType())) {
+                                toCopyNodeTab.setTabFileType(2); //已上传
+                            }
+                            //目标表obj对象,文件附件使用
+                            addChildNodesTablesAll.add(toCopyNodeTab);
+
                             //获取实体表列对象
                             List<QueryProcessDataVO> nodeTabColOneTab = informationQueryService.getNodeChildTabColsAllByTabName(needTab.getInitTableName());
                             //转化为map
@@ -1620,7 +1672,7 @@ public class InformationWriteQueryController extends BladeController {
     }
 
     /**
-     * 新增复制节点、表的数据构造
+     * 新增复制节点、表的数据构造
      */
     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;
@@ -1651,7 +1703,6 @@ public class InformationWriteQueryController extends BladeController {
             }
             //构造当前节点下所有元素表
             for (WbsTreeContract needTab : needTabs) {
-
                 if (StringUtils.isEmpty(needTab.getInitTableName())) {
                     continue;
                 }
@@ -1690,8 +1741,7 @@ public class InformationWriteQueryController extends BladeController {
                 }
             }
 
-            //多层级节点复制
-        } else {
+        } else { //多层级节点复制
             //根节点id
             Long toCopyNodeOldId = toCopyNode.getId();
             toCopyNode.setId(SnowFlakeUtil.getId());
@@ -1801,6 +1851,9 @@ 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) {

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

@@ -1,7 +1,9 @@
 package org.springblade.manager.feign;
 
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
 import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.core.tool.utils.Func;
 import org.springblade.manager.entity.TableFile;
 import org.springblade.manager.service.ITableFileService;
 import org.springframework.web.bind.annotation.RestController;
@@ -13,7 +15,7 @@ import java.util.List;
 @AllArgsConstructor
 public class TableFileClientImpl implements TableFileClient {
 
-    private ITableFileService tableFileService;
+    private final ITableFileService tableFileService;
 
     @Override
     public void saveFile(TableFile tableFile) {
@@ -32,4 +34,12 @@ public class TableFileClientImpl implements TableFileClient {
     public boolean saveBatch(List<TableFile> newFiles) {
         return tableFileService.saveBatch(newFiles, 100);
     }
+
+    @Override
+    public List<TableFile> getTabFilesByTabIds(String tabFileIds) {
+        return tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>lambdaQuery()
+                .in(TableFile::getTabId, Func.toLongList(tabFileIds))
+                .isNotNull(TableFile::getTabId)
+        );
+    }
 }

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

@@ -40,6 +40,11 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
 
     private final ISysClient sysClient;
 
+    @Override
+    public WbsTreeContract queryContractTreeNodeByPKeyId(Long toCopyNodePKeyId) {
+        return this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, toCopyNodePKeyId));
+    }
+
     @Override
     public List<WbsTreeContract> queryContractTreeNodeByPKIds(List<Long> PKIds) {
         return this.wbsTreeContractService.list(Wrappers.<WbsTreeContract>lambdaQuery().in(WbsTreeContract::getPKeyId, PKIds));
@@ -106,7 +111,7 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
 
     @Override
     public Boolean saveBatch(List<WbsTreeContract> list) {
-        return this.wbsTreeContractServiceImpl.insertBatch(list,1000);
+        return this.wbsTreeContractServiceImpl.saveOrUpdateBatch(list,1000);
     }
 
     @Override