|
@@ -8,6 +8,9 @@ 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 com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.google.common.cache.Cache;
|
|
|
+import com.google.common.cache.CacheBuilder;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import io.swagger.annotations.*;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
@@ -61,6 +64,7 @@ import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -575,7 +579,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
@ApiOperation(value = "单个废除")
|
|
|
public R<Boolean> abolishOne(@RequestParam String primaryKeyId, @RequestParam String classify) {
|
|
|
//查询填报状态
|
|
|
- InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).eq(InformationQuery::getType,1));
|
|
|
+ InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).eq(InformationQuery::getType, 1));
|
|
|
if (businessData != null) {
|
|
|
//使用批量废除接口
|
|
|
return this.batchAbolish(businessData.getId().toString(), primaryKeyId);
|
|
@@ -859,7 +863,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
@ApiOperation(value = "填报页单个上报")
|
|
|
public R<Boolean> taskOne(@RequestBody StartTaskVO startTaskVO) throws IOException {
|
|
|
//此时的ids是当前节点的primaryKeyId但并不是业务数据ID,需要根据ids和classify去查询具体的业务ID
|
|
|
- InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, startTaskVO.getIds().replaceAll(",", "")).eq(InformationQuery::getClassify, startTaskVO.getClassify().toString()).eq(InformationQuery::getType,1));
|
|
|
+ InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, startTaskVO.getIds().replaceAll(",", "")).eq(InformationQuery::getClassify, startTaskVO.getClassify().toString()).eq(InformationQuery::getType, 1));
|
|
|
|
|
|
//处理上报信息
|
|
|
if (businessData != null) {
|
|
@@ -1445,7 +1449,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//复制元素表附件信息
|
|
|
List<WbsTreeContract> newTabs = saveList.stream().filter(f -> (new Integer(2).equals(f.getType()))).collect(Collectors.toList());
|
|
|
if (newTabs.size() > 0 && oldTabs.size() > 0 && vo.getIsCopyData() == 1) {
|
|
|
- this.addCopyTabFile(newTabs, oldTabs);
|
|
|
+ this.addCopyTabFile(new HashSet<>(newTabs), oldTabs);
|
|
|
}
|
|
|
|
|
|
//复制表单数据
|
|
@@ -1504,99 +1508,94 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//结果集
|
|
|
List<WbsTreeContract> addNodeList = new ArrayList<>();//新增节点
|
|
|
List<WbsTreeContract> addTabList = new ArrayList<>(); //新增表单
|
|
|
- //List<WbsTreeContract> asyncWbsTreeNodes = new ArrayList<>(); //redis同步节点
|
|
|
Set<WbsTreeContract> addChildNodesTablesOldAll = new HashSet<>(addChildNodesTables);//数据源表附件
|
|
|
- Set<WbsTreeContract> addNewFileTabs = new HashSet<>(addChildNodesTables);//新增到目标表附件
|
|
|
+ Set<WbsTreeContract> addNewFileTabs = new HashSet<>();//新增到目标表附件
|
|
|
List<String> resultTablesData = new ArrayList<>();//表单数据
|
|
|
|
|
|
- //创建线程池,默认设置4个线程
|
|
|
- ExecutorService executor = Executors.newFixedThreadPool(4);
|
|
|
- try {
|
|
|
- //解析位置信息,进行复制数据构造
|
|
|
- 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);
|
|
|
- //asyncWbsTreeNodes.add(toCopyNode);
|
|
|
- String finalTabOwner = tabOwner;
|
|
|
- executor.submit(() -> {
|
|
|
- if (toCopyNode != null && toCopyVO != null && needCopyNodeAndTabMap.size() > 0) {
|
|
|
- //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> needCopyNodes = needCopyNodeAndTabMap.get("node:" + needCopyNodeRoot.getPKeyId());
|
|
|
- List<WbsTreeContract> needCopyTab = needCopyNodeAndTabMap.get("tab:" + needCopyNodeRoot.getPKeyId());
|
|
|
-
|
|
|
- //构造新的节点、表、数据
|
|
|
- this.addCopyNodesAndTabsBuildData(addNodeList, addTabList, needCopyNodes, needCopyTab, needCopyNode, toCopyNode, resultTablesData, 1, finalTabOwner, vo.getIsCopyData());
|
|
|
-
|
|
|
- //1.2 选择同父级的同级节点,只复制数据
|
|
|
- } else if (needCopyNode.getParentId().equals(toCopyNode.getParentId())) {
|
|
|
- //构造数据
|
|
|
- this.addCopyTabData(needCopyNode, toCopyNode, finalTabOwner, resultTablesData, addTabList, vo.getIsCopyData(), addNewFileTabs);
|
|
|
- }
|
|
|
+ //解析位置信息,进行复制数据构造
|
|
|
+ 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 && needCopyNodeAndTabMap.size() > 0) {
|
|
|
+ //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> needCopyNodes = needCopyNodeAndTabMap.get("node:" + needCopyNodeRoot.getPKeyId());
|
|
|
+ List<WbsTreeContract> needCopyTab = needCopyNodeAndTabMap.get("tab:" + needCopyNodeRoot.getPKeyId());
|
|
|
+
|
|
|
+ //构造新的节点、表、数据
|
|
|
+ this.addCopyNodesAndTabsBuildData(addNodeList, addTabList, needCopyNodes, needCopyTab, needCopyNode, toCopyNode, resultTablesData, 1, tabOwner, vo.getIsCopyData());
|
|
|
+
|
|
|
+ //附件
|
|
|
+ addNewFileTabs.addAll(addTabList);
|
|
|
+
|
|
|
+ //1.2 选择同父级的同级节点,只复制数据
|
|
|
+ } else if (needCopyNode.getParentId().equals(toCopyNode.getParentId())) {
|
|
|
+ //构造数据
|
|
|
+ this.addCopyTabData(needCopyNode, toCopyNode, tabOwner, resultTablesData, addTabList, vo.getIsCopyData(), addNewFileTabs);
|
|
|
+ }
|
|
|
|
|
|
- //TODO 跨节点复制
|
|
|
- } else if (new Integer(0).equals(toCopyVO.getIsSameNode())) {
|
|
|
- //获取需要复制节点的上级
|
|
|
- WbsTreeContract parentNodeNeed = wbsTreeContractClient.getContractWbsTreeByContractIdAndId(needCopyNode.getParentId(), Long.parseLong(needCopyNode.getContractId()));
|
|
|
-
|
|
|
- boolean var = false;
|
|
|
- //2.1 选择的父级的同级的父级节点,新增(当复制节点父级与选择复制到的位置节点的父级id相同时,表示跨节点新增)
|
|
|
- if (parentNodeNeed != null) {
|
|
|
- //2.1.1 如果是跨一级的情况下:parentNodeNeed.getParentId() == toCopyNode.getParentId() ,且 parentNodeNeed.getAncestors() == toCopyNode.getAncestors() ,且节点类型必须一样
|
|
|
- if (parentNodeNeed.getParentId().equals(toCopyNode.getParentId()) && parentNodeNeed.getAncestors().equals(toCopyNode.getAncestors()) && parentNodeNeed.getNodeType().equals(toCopyNode.getNodeType())) {
|
|
|
- toCopyNode.setNodeName(toCopyVO.getNodeName());
|
|
|
- toCopyNode.setPartitionCode(toCopyVO.getPartitionCode());
|
|
|
-
|
|
|
- //获取缓存节点、表信息
|
|
|
- List<WbsTreeContract> needCopyNodes = needCopyNodeAndTabMap.get("node:" + needCopyNodeRoot.getPKeyId());
|
|
|
- List<WbsTreeContract> needCopyTab = needCopyNodeAndTabMap.get("tab:" + needCopyNodeRoot.getPKeyId());
|
|
|
-
|
|
|
- //构造新的节点、表、数据
|
|
|
- this.addCopyNodesAndTabsBuildData(addNodeList, addTabList, needCopyNodes, needCopyTab, needCopyNode, toCopyNode, resultTablesData, 0, finalTabOwner, vo.getIsCopyData());
|
|
|
- var = true;
|
|
|
-
|
|
|
- } else if (!parentNodeNeed.getParentId().equals(toCopyNode.getParentId()) && !parentNodeNeed.getAncestors().equals(toCopyNode.getAncestors()) && parentNodeNeed.getNodeType().equals(toCopyNode.getNodeType())) {
|
|
|
- //2.1.2 如果跨多级的情况下父级id不相同 parentNodeNeed.getParentId() != toCopyNode.getParentId() ,且 parentNodeNeed.getAncestors() != toCopyNode.getAncestors() ,且节点类型必须一样
|
|
|
- toCopyNode.setNodeName(toCopyVO.getNodeName());
|
|
|
- toCopyNode.setPartitionCode(toCopyVO.getPartitionCode());
|
|
|
-
|
|
|
- //获取缓存节点、表信息
|
|
|
- List<WbsTreeContract> needCopyNodes = needCopyNodeAndTabMap.get("node:" + needCopyNodeRoot.getPKeyId());
|
|
|
- List<WbsTreeContract> needCopyTab = needCopyNodeAndTabMap.get("tab:" + needCopyNodeRoot.getPKeyId());
|
|
|
-
|
|
|
- //构造新的节点、表、数据
|
|
|
- this.addCopyNodesAndTabsBuildData(addNodeList, addTabList, needCopyNodes, needCopyTab, needCopyNode, toCopyNode, resultTablesData, 0, finalTabOwner, vo.getIsCopyData());
|
|
|
- var = true;
|
|
|
- }
|
|
|
- }
|
|
|
+ //TODO 跨节点复制
|
|
|
+ } else if (new Integer(0).equals(toCopyVO.getIsSameNode())) {
|
|
|
+ //获取需要复制节点的上级
|
|
|
+ WbsTreeContract parentNodeNeed = wbsTreeContractClient.getContractWbsTreeByContractIdAndId(needCopyNode.getParentId(), Long.parseLong(needCopyNode.getContractId()));
|
|
|
|
|
|
- //2.2 如果点击选择的是当前复制节点本身的同等级节点,那么就只复制数据。(如果是跨节点,类型相同的情况下,只复制数据),且var=false,表示没有进行到跨节点新增的逻辑,只是跨节点复制数据
|
|
|
- if (needCopyNode.getNodeType().equals(toCopyNode.getNodeType()) && !needCopyNode.getParentId().equals(toCopyNode.getParentId()) && !var) {
|
|
|
- //构造数据
|
|
|
- this.addCopyTabData(needCopyNode, toCopyNode, finalTabOwner, resultTablesData, addTabList, vo.getIsCopyData(), addNewFileTabs);
|
|
|
- }
|
|
|
+ boolean var = false;
|
|
|
+ //2.1 选择的父级的同级的父级节点,新增(当复制节点父级与选择复制到的位置节点的父级id相同时,表示跨节点新增)
|
|
|
+ if (parentNodeNeed != null) {
|
|
|
+ //2.1.1 如果是跨一级的情况下:parentNodeNeed.getParentId() == toCopyNode.getParentId() ,且 parentNodeNeed.getAncestors() == toCopyNode.getAncestors() ,且节点类型必须一样
|
|
|
+ if (parentNodeNeed.getParentId().equals(toCopyNode.getParentId()) && parentNodeNeed.getAncestors().equals(toCopyNode.getAncestors()) && parentNodeNeed.getNodeType().equals(toCopyNode.getNodeType())) {
|
|
|
+ toCopyNode.setNodeName(toCopyVO.getNodeName());
|
|
|
+ toCopyNode.setPartitionCode(toCopyVO.getPartitionCode());
|
|
|
+
|
|
|
+ //获取缓存节点、表信息
|
|
|
+ List<WbsTreeContract> needCopyNodes = needCopyNodeAndTabMap.get("node:" + needCopyNodeRoot.getPKeyId());
|
|
|
+ List<WbsTreeContract> needCopyTab = needCopyNodeAndTabMap.get("tab:" + needCopyNodeRoot.getPKeyId());
|
|
|
+
|
|
|
+ //构造新的节点、表、数据
|
|
|
+ this.addCopyNodesAndTabsBuildData(addNodeList, addTabList, needCopyNodes, needCopyTab, needCopyNode, toCopyNode, resultTablesData, 0, tabOwner, vo.getIsCopyData());
|
|
|
+
|
|
|
+ //附件
|
|
|
+ addNewFileTabs.addAll(addTabList);
|
|
|
+
|
|
|
+ var = true;
|
|
|
+
|
|
|
+ } else if (!parentNodeNeed.getParentId().equals(toCopyNode.getParentId()) && !parentNodeNeed.getAncestors().equals(toCopyNode.getAncestors()) && parentNodeNeed.getNodeType().equals(toCopyNode.getNodeType())) {
|
|
|
+ //2.1.2 如果跨多级的情况下父级id不相同 parentNodeNeed.getParentId() != toCopyNode.getParentId() ,且 parentNodeNeed.getAncestors() != toCopyNode.getAncestors() ,且节点类型必须一样
|
|
|
+ toCopyNode.setNodeName(toCopyVO.getNodeName());
|
|
|
+ toCopyNode.setPartitionCode(toCopyVO.getPartitionCode());
|
|
|
+
|
|
|
+ //获取缓存节点、表信息
|
|
|
+ List<WbsTreeContract> needCopyNodes = needCopyNodeAndTabMap.get("node:" + needCopyNodeRoot.getPKeyId());
|
|
|
+ List<WbsTreeContract> needCopyTab = needCopyNodeAndTabMap.get("tab:" + needCopyNodeRoot.getPKeyId());
|
|
|
+
|
|
|
+ //构造新的节点、表、数据
|
|
|
+ this.addCopyNodesAndTabsBuildData(addNodeList, addTabList, needCopyNodes, needCopyTab, needCopyNode, toCopyNode, resultTablesData, 0, tabOwner, vo.getIsCopyData());
|
|
|
+
|
|
|
+ //附件
|
|
|
+ addNewFileTabs.addAll(addTabList);
|
|
|
+
|
|
|
+ var = true;
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+
|
|
|
+ //2.2 如果点击选择的是当前复制节点本身的同等级节点,那么就只复制数据。(如果是跨节点,类型相同的情况下,只复制数据),且var=false,表示没有进行到跨节点新增的逻辑,只是跨节点复制数据
|
|
|
+ if (needCopyNode.getNodeType().equals(toCopyNode.getNodeType()) && !needCopyNode.getParentId().equals(toCopyNode.getParentId()) && !var) {
|
|
|
+ //构造数据
|
|
|
+ this.addCopyTabData(needCopyNode, toCopyNode, tabOwner, resultTablesData, addTabList, vo.getIsCopyData(), addNewFileTabs);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- } finally {
|
|
|
- //关闭线程池
|
|
|
- executor.shutdown();
|
|
|
- //等待所有线程执行完毕
|
|
|
- while (!executor.isTerminated()) {
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
//重构祖级id
|
|
@@ -1621,7 +1620,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
if (addNewFileTabs.size() > 0 && addChildNodesTablesOldAll.size() > 0 && vo.getIsCopyData() == 1) {
|
|
|
//复制新增表附件
|
|
|
- this.addCopyTabFile(tabs, addChildNodesTablesOldAll);
|
|
|
+ this.addCopyTabFile(addNewFileTabs, addChildNodesTablesOldAll);
|
|
|
}
|
|
|
|
|
|
if (resultTablesData.size() > 0 && vo.getIsCopyData() == 1) {
|
|
@@ -1631,15 +1630,12 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
jdbcTemplate.execute(StringUtils.join(strings, ""));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (row) {
|
|
|
//更新redis缓存
|
|
|
informationQueryService.delAsyncWbsTree(contractId);
|
|
|
- /*List<WbsTreeContract> collect = asyncWbsTreeNodes.stream().distinct().collect(Collectors.toList());
|
|
|
- for (WbsTreeContract asyncWbsTreeNode : collect) {
|
|
|
- informationQueryService.AsyncWbsTree("", asyncWbsTreeNode.getId() + "", contractId, "", "1");
|
|
|
- informationQueryService.AsyncWbsTree("", asyncWbsTreeNode.getParentId() + "", contractId, "", "1");
|
|
|
- }*/
|
|
|
}
|
|
|
+
|
|
|
return R.success("操作成功");
|
|
|
} else {
|
|
|
throw new ServiceException("没有找到需要复制的节点信息,请联系管理员");
|
|
@@ -1681,25 +1677,37 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
* 新增复制的表单文件
|
|
|
*/
|
|
|
@Async
|
|
|
- public void addCopyTabFile(List<WbsTreeContract> addChildNodesTables, Set<WbsTreeContract> addChildNodesTablesOld) {
|
|
|
+ public void addCopyTabFile(Set<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<>();
|
|
|
- List<Long> updatePKeyIds = 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()))) {
|
|
|
- //构建文件数据
|
|
|
+ Set<Long> updatePKeyIds = new HashSet<>();
|
|
|
+
|
|
|
+ Map<String, WbsTreeContract> addChildNodesTablesOldMap = new HashMap<>();
|
|
|
+ for (WbsTreeContract node : addChildNodesTablesOld) {
|
|
|
+ if (StringUtils.isNotBlank(node.getHtmlUrl())) {
|
|
|
+ String key = node.getNodeName() + node.getHtmlUrl();
|
|
|
+ addChildNodesTablesOldMap.put(key, node);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (WbsTreeContract tabNew : addChildNodesTables) {
|
|
|
+ if (StringUtils.isNotBlank(tabNew.getHtmlUrl())) {
|
|
|
+ String key = tabNew.getNodeName() + tabNew.getHtmlUrl();
|
|
|
+ WbsTreeContract tabOld = addChildNodesTablesOldMap.get(key);
|
|
|
+ if (tabOld != null) {
|
|
|
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);
|
|
|
+ for (TableFile tableFile : tab) {
|
|
|
+ TableFile obj = BeanUtil.copyProperties(tableFile, TableFile.class);
|
|
|
+ if (obj != null) {
|
|
|
+ obj.setTabId(tabNew.getPKeyId() + "");
|
|
|
+ obj.setId(SnowFlakeUtil.getId());
|
|
|
+ resultFileData.add(obj);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (ObjectUtil.isNotEmpty(tabOld) && tabOld.getTabFileType() == 2) {
|
|
|
updatePKeyIds.add(tabNew.getPKeyId());
|
|
|
}
|
|
@@ -1707,11 +1715,12 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (resultFileData.size() > 0) {
|
|
|
//入库
|
|
|
if (tableFileClient.saveBatch(resultFileData) && updatePKeyIds.size() > 0) {
|
|
|
//修改表的文件按钮状态
|
|
|
- wbsTreeContractClient.updateTabFileTypeByPkeyIds(updatePKeyIds);
|
|
|
+ wbsTreeContractClient.updateTabFileTypeByPkeyIds(new ArrayList<>(updatePKeyIds));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2038,35 +2047,6 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取所有子级节点-资料查询
|
|
|
- */
|
|
|
- private List<WbsTreeContract> getChildNodesZL(WbsTreeContract obj) {
|
|
|
- if (obj != null) {
|
|
|
- List<WbsTreeContract> wbsTreeContracts = Collections.singletonList(obj);
|
|
|
- List<WbsTreeContract> result = new ArrayList<>();
|
|
|
- this.recursionGetChildNodesZL(wbsTreeContracts, result, obj.getContractId());
|
|
|
- if (result.size() > 0) {
|
|
|
- return result;
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 递归获取所有子级节点-资料查询
|
|
|
- */
|
|
|
- private void recursionGetChildNodesZL(List<WbsTreeContract> list, List<WbsTreeContract> result, String contractId) {
|
|
|
- List<Long> ids = list.stream().map(WbsTreeContract::getId).collect(Collectors.toList());
|
|
|
- if (ids.size() > 0) {
|
|
|
- List<WbsTreeContract> query = jdbcTemplate.query("select full_name,id,p_key_id,parent_id,sort from m_wbs_tree_contract where type = 1 and parent_id in(" + StringUtils.join(ids, ",") + ") and status = 1 and is_deleted = 0 and contract_id = " + contractId, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
- if (query.size() > 0) {
|
|
|
- result.addAll(query);
|
|
|
- recursionGetChildNodesZL(query, result, contractId);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 获取所有子级下的表
|
|
|
*/
|
|
@@ -3124,65 +3104,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
vo.setContractId(Long.valueOf(vo.getContractIdRelation()));
|
|
|
}
|
|
|
|
|
|
- IPage<InformationQueryVO> resultPageData = this.informationQueryService.selectInformationQueryPage(Condition.getPage(query), vo);
|
|
|
-
|
|
|
- //TODO 处理资料查询,page数据与节点顺序同步问题
|
|
|
- //获取选择的节点下的所有子节点信息
|
|
|
- /*WbsTreeContract oldSelectedNode = BeanUtil.copyProperties(node, WbsTreeContract.class);
|
|
|
- List<WbsTreeContract> treeAll = this.getChildNodesZL(oldSelectedNode);
|
|
|
- if (treeAll == null) {
|
|
|
- treeAll = new ArrayList<>();
|
|
|
- }
|
|
|
- treeAll.add(oldSelectedNode);
|
|
|
-
|
|
|
- if (treeAll.size() == 1) { //最底层节点,直接返回
|
|
|
- return R.data(resultPageData);
|
|
|
- } else {
|
|
|
- List<InformationQueryVO> resultData = new ArrayList<>();
|
|
|
- if (oldSelectedNode != null) {
|
|
|
- List<WbsTreeContract> resultNodes = this.reOrderNode(treeAll, oldSelectedNode);
|
|
|
- Map<Long, InformationQueryVO> dataMaps = resultPageData.getRecords().stream().collect(Collectors.toMap(InformationQueryVO::getWbsId, Function.identity()));
|
|
|
- for (WbsTreeContract resultNode : resultNodes) {
|
|
|
- InformationQueryVO queryVO = dataMaps.get(resultNode.getPKeyId());
|
|
|
- if (queryVO != null) {
|
|
|
- resultData.add(queryVO);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (resultData.size() > 0) {
|
|
|
- return R.data(resultPageData.setRecords(resultData));
|
|
|
- } else {*/
|
|
|
- return R.data(resultPageData);
|
|
|
- //}
|
|
|
- //}
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 节点重新排序
|
|
|
- */
|
|
|
- private List<WbsTreeContract> reOrderNode(List<WbsTreeContract> inList, WbsTreeContract oldSelectedNode) {
|
|
|
- Map<Long, List<WbsTreeContract>> parentGroup = inList.stream().collect(Collectors.groupingBy(WbsTreeContract::getParentId));
|
|
|
- Long parentId = oldSelectedNode.getId();
|
|
|
- return getSubNodes(parentId, parentGroup);
|
|
|
- }
|
|
|
-
|
|
|
- private List<WbsTreeContract> getSubNodes(Long parentId, Map<Long, List<WbsTreeContract>> parentGroup) {
|
|
|
- List<WbsTreeContract> subNodes = new ArrayList<>();
|
|
|
- if (parentGroup.containsKey(parentId)) {
|
|
|
- List<WbsTreeContract> children = parentGroup.get(parentId);
|
|
|
- for (WbsTreeContract child : children) {
|
|
|
- List<WbsTreeContract> grandChildren = this.getSubNodes(child.getId(), parentGroup);
|
|
|
- subNodes.addAll(grandChildren);
|
|
|
- }
|
|
|
- subNodes.addAll(children);
|
|
|
- }
|
|
|
- subNodes.sort(
|
|
|
- Comparator.comparingInt((WbsTreeContract node) -> node.getSort() == null ? Integer.MAX_VALUE : node.getSort())
|
|
|
- .thenComparing(Comparator.nullsLast(Comparator.comparing(WbsTreeContract::getFullName)))
|
|
|
- .thenComparingLong(node -> node.getPKeyId() == null ? Long.MAX_VALUE : node.getPKeyId())
|
|
|
- .thenComparing(Comparator.nullsLast(Comparator.comparing(WbsTreeContract::getUpdateTime)))
|
|
|
- );
|
|
|
- return subNodes;
|
|
|
+ return R.data(this.informationQueryService.selectInformationQueryPage(Condition.getPage(query), vo, node));
|
|
|
}
|
|
|
|
|
|
/**
|