|
@@ -1,6 +1,5 @@
|
|
package org.springblade.manager.service.impl;
|
|
package org.springblade.manager.service.impl;
|
|
|
|
|
|
-import cn.hutool.core.swing.ScreenUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -57,7 +56,6 @@ import java.io.FileInputStream;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.math.BigInteger;
|
|
import java.math.BigInteger;
|
|
-import java.time.Year;
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Matcher;
|
|
@@ -936,21 +934,13 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
ArrayList::new
|
|
ArrayList::new
|
|
));
|
|
));
|
|
|
|
|
|
- //所有节点parentId分组Map
|
|
|
|
- Map<Long, List<WbsTreeContractLazyVO>> parentIdToNodesMap = distinctNodesAll.stream()
|
|
|
|
- .collect(Collectors.groupingBy(WbsTreeContractLazyVO::getParentId));
|
|
|
|
-
|
|
|
|
- //所有节点id分组Map
|
|
|
|
- Map<Long, List<WbsTreeContractLazyVO>> idToNodesMap = distinctNodesAll.stream()
|
|
|
|
- .collect(Collectors.groupingBy(WbsTreeContractLazyVO::getId));
|
|
|
|
-
|
|
|
|
//所有最底层节点
|
|
//所有最底层节点
|
|
List<WbsTreeContractLazyVO> distinctLowestNodesAll = distinctNodesAll.stream().filter(f -> f.getHasChildren().equals(0)).collect(Collectors.collectingAndThen(
|
|
List<WbsTreeContractLazyVO> distinctLowestNodesAll = distinctNodesAll.stream().filter(f -> f.getHasChildren().equals(0)).collect(Collectors.collectingAndThen(
|
|
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WbsTreeContractLazyVO::getPKeyId))),
|
|
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WbsTreeContractLazyVO::getPKeyId))),
|
|
ArrayList::new
|
|
ArrayList::new
|
|
));
|
|
));
|
|
//获取当前合同段所有影像文件信息
|
|
//获取当前合同段所有影像文件信息
|
|
- List<WbsTreeContractLazyFileVO> queryFileList = jdbcTemplate.query("select wbs_id,id from u_image_classification_file where status = 1 and contract_id = " + contractId + " and classify_id = " + classId, new BeanPropertyRowMapper<>(WbsTreeContractLazyFileVO.class));
|
|
|
|
|
|
+ List<WbsTreeContractLazyFileVO> queryFileList = jdbcTemplate.query("select wbs_id,id from u_image_classification_file where status = 1 and is_deleted = 0 and contract_id = " + contractId + " and classify_id = " + classId, new BeanPropertyRowMapper<>(WbsTreeContractLazyFileVO.class));
|
|
//最底层节点与存储文件数量map
|
|
//最底层节点与存储文件数量map
|
|
Map<Long, Integer> queryFileMaps = queryFileList.stream()
|
|
Map<Long, Integer> queryFileMaps = queryFileList.stream()
|
|
.collect(Collectors.groupingBy(
|
|
.collect(Collectors.groupingBy(
|
|
@@ -959,27 +949,34 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
));
|
|
));
|
|
List<Long> pKeyIdList = new ArrayList<>(queryFileMaps.keySet());
|
|
List<Long> pKeyIdList = new ArrayList<>(queryFileMaps.keySet());
|
|
|
|
|
|
- //所有最底层节点,处理文件数量
|
|
|
|
- List<WbsTreeContractLazyVO> lowestNodesFile = distinctLowestNodesAll.stream().filter(f -> pKeyIdList.contains(f.getPKeyId())).collect(Collectors.toList());
|
|
|
|
- Set<Long> lowestNodeParentIds = lowestNodesFile.stream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toSet());
|
|
|
|
-
|
|
|
|
- //获取所有父级节点
|
|
|
|
- Set<WbsTreeContractLazyVO> resultParentNodes = new HashSet<>();
|
|
|
|
- this.getParentNodes(resultParentNodes, lowestNodeParentIds, idToNodesMap);
|
|
|
|
|
|
+ //填报过的所有最底层节点,处理数量
|
|
|
|
+ List<WbsTreeContractLazyVO> lowestNodesTB = distinctLowestNodesAll.stream().filter(f -> pKeyIdList.contains(f.getPKeyId())).collect(Collectors.toList());
|
|
|
|
+ List<WbsTreeContractLazyVO> lowestNodesTBNew = BeanUtil.copyProperties(lowestNodesTB, WbsTreeContractLazyVO.class);
|
|
|
|
+ for (WbsTreeContractLazyVO vo : lowestNodesTB) {
|
|
|
|
+ Integer fileCounts = queryFileMaps.get(vo.getPKeyId());
|
|
|
|
+ if (fileCounts > 1) {
|
|
|
|
+ /*当前节点下存在多个影像资料文件信息,那么就要添加进入集合中统一处理,
|
|
|
|
+ 在入参根据parentId分组时,就存在出现多个父级节点信息;
|
|
|
|
+ 此处要从1开始循环,因为不包含本身,如果从0,会多一条父级节点信息*/
|
|
|
|
+ for (int i = 1; i < fileCounts; i++) {
|
|
|
|
+ lowestNodesTBNew.add(vo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<Long> lowestNodeParentIdsTB = lowestNodesTBNew.stream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toList());
|
|
|
|
+ List<WbsTreeContractLazyVO> resultParentNodesTB = new ArrayList<>();
|
|
|
|
+ this.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAll);
|
|
|
|
|
|
//处理最终结果集
|
|
//处理最终结果集
|
|
if (lazyNodes.size() > 0) {
|
|
if (lazyNodes.size() > 0) {
|
|
Map<Long, Integer> countMap = new HashMap<>();
|
|
Map<Long, Integer> countMap = new HashMap<>();
|
|
- for (WbsTreeContractLazyVO node : resultParentNodes) {
|
|
|
|
|
|
+ for (WbsTreeContractLazyVO node : resultParentNodesTB) {
|
|
Long key = node.getPKeyId();
|
|
Long key = node.getPKeyId();
|
|
- Set<WbsTreeContractLazyVO> resultNodes = new HashSet<>();
|
|
|
|
- //获取最底层节点的文件数量信息
|
|
|
|
- this.getDcNodes(resultNodes, Collections.singletonList(node), parentIdToNodesMap);
|
|
|
|
- int totalCount = 0;
|
|
|
|
- for (Long pKeyId : resultNodes.stream().map(WbsTreeContractLazyVO::getPKeyId).collect(Collectors.toSet())) {
|
|
|
|
- totalCount += queryFileMaps.getOrDefault(pKeyId, 0);
|
|
|
|
|
|
+ if (countMap.containsKey(key)) {
|
|
|
|
+ countMap.put(key, countMap.get(key) + 1);
|
|
|
|
+ } else {
|
|
|
|
+ countMap.put(key, 1);
|
|
}
|
|
}
|
|
- countMap.put(key, totalCount);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//返回最终结果集
|
|
//返回最终结果集
|
|
@@ -1041,14 +1038,6 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
ArrayList::new
|
|
ArrayList::new
|
|
));
|
|
));
|
|
|
|
|
|
- //所有节点parentId分组Map
|
|
|
|
- Map<Long, List<WbsTreeContractLazyVO>> parentIdToNodesMap = distinctNodesAll.stream()
|
|
|
|
- .collect(Collectors.groupingBy(WbsTreeContractLazyVO::getParentId));
|
|
|
|
-
|
|
|
|
- //所有节点id分组Map
|
|
|
|
- Map<Long, List<WbsTreeContractLazyVO>> idToNodesMap = distinctNodesAll.stream()
|
|
|
|
- .collect(Collectors.groupingBy(WbsTreeContractLazyVO::getId));
|
|
|
|
-
|
|
|
|
//所有最底层节点
|
|
//所有最底层节点
|
|
List<WbsTreeContractLazyVO> distinctLowestNodesAll = distinctNodesAll.stream().filter(f -> f.getHasChildren().equals(0)).collect(Collectors.collectingAndThen(
|
|
List<WbsTreeContractLazyVO> distinctLowestNodesAll = distinctNodesAll.stream().filter(f -> f.getHasChildren().equals(0)).collect(Collectors.collectingAndThen(
|
|
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WbsTreeContractLazyVO::getPKeyId))),
|
|
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WbsTreeContractLazyVO::getPKeyId))),
|
|
@@ -1066,27 +1055,31 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
|
|
|
List<Long> pKeyIdList = new ArrayList<>(queryFileMaps.keySet());
|
|
List<Long> pKeyIdList = new ArrayList<>(queryFileMaps.keySet());
|
|
|
|
|
|
- //所有最底层节点,处理文件数量
|
|
|
|
- List<WbsTreeContractLazyVO> lowestNodesFile = distinctLowestNodesAll.stream().filter(f -> pKeyIdList.contains(f.getPKeyId())).collect(Collectors.toList());
|
|
|
|
- Set<Long> lowestNodeParentIds = lowestNodesFile.stream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toSet());
|
|
|
|
-
|
|
|
|
- //获取所有父级节点
|
|
|
|
- Set<WbsTreeContractLazyVO> resultParentNodes = new HashSet<>();
|
|
|
|
- this.getParentNodes(resultParentNodes, lowestNodeParentIds, idToNodesMap);
|
|
|
|
|
|
+ //填报过的所有最底层节点,处理数量
|
|
|
|
+ List<WbsTreeContractLazyVO> lowestNodesTB = distinctLowestNodesAll.stream().filter(f -> pKeyIdList.contains(f.getPKeyId())).collect(Collectors.toList());
|
|
|
|
+ List<WbsTreeContractLazyVO> lowestNodesTBNew = BeanUtil.copyProperties(lowestNodesTB, WbsTreeContractLazyVO.class);
|
|
|
|
+ for (WbsTreeContractLazyVO vo : lowestNodesTB) {
|
|
|
|
+ Integer fileCounts = queryFileMaps.get(vo.getPKeyId());
|
|
|
|
+ if (fileCounts > 1) {
|
|
|
|
+ for (int i = 1; i < fileCounts; i++) {
|
|
|
|
+ lowestNodesTBNew.add(vo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<Long> lowestNodeParentIdsTB = lowestNodesTBNew.stream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toList());
|
|
|
|
+ List<WbsTreeContractLazyVO> resultParentNodesTB = new ArrayList<>();
|
|
|
|
+ this.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAll);
|
|
|
|
|
|
//处理最终结果集
|
|
//处理最终结果集
|
|
if (lazyNodes.size() > 0) {
|
|
if (lazyNodes.size() > 0) {
|
|
Map<Long, Integer> countMap = new HashMap<>();
|
|
Map<Long, Integer> countMap = new HashMap<>();
|
|
- for (WbsTreeContractLazyVO node : resultParentNodes) {
|
|
|
|
|
|
+ for (WbsTreeContractLazyVO node : resultParentNodesTB) {
|
|
Long key = node.getPKeyId();
|
|
Long key = node.getPKeyId();
|
|
- Set<WbsTreeContractLazyVO> resultNodes = new HashSet<>();
|
|
|
|
- //获取最底层节点的文件数量信息
|
|
|
|
- this.getDcNodes(resultNodes, Collections.singletonList(node), parentIdToNodesMap);
|
|
|
|
- int totalCount = 0;
|
|
|
|
- for (Long pKeyId : resultNodes.stream().map(WbsTreeContractLazyVO::getPKeyId).collect(Collectors.toSet())) {
|
|
|
|
- totalCount += queryFileMaps.getOrDefault(pKeyId, 0);
|
|
|
|
|
|
+ if (countMap.containsKey(key)) {
|
|
|
|
+ countMap.put(key, countMap.get(key) + 1);
|
|
|
|
+ } else {
|
|
|
|
+ countMap.put(key, 1);
|
|
}
|
|
}
|
|
- countMap.put(key, totalCount);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//返回最终结果集
|
|
//返回最终结果集
|
|
@@ -1117,59 +1110,6 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 获取所有父级节点
|
|
|
|
- *
|
|
|
|
- * @param resultParentNodes
|
|
|
|
- * @param parentIds
|
|
|
|
- * @param idToNodesMap
|
|
|
|
- */
|
|
|
|
- private void getParentNodes(Set<WbsTreeContractLazyVO> resultParentNodes, Set<Long> parentIds, Map<Long, List<WbsTreeContractLazyVO>> idToNodesMap) {
|
|
|
|
- if (parentIds.size() > 0 && !parentIds.contains(0L)) {
|
|
|
|
- Set<Long> parentIdsAll = new HashSet<>();
|
|
|
|
- for (Long parentId : parentIds) {
|
|
|
|
- List<WbsTreeContractLazyVO> parentNodes = idToNodesMap.get(parentId);
|
|
|
|
- if (parentNodes.size() > 0) {
|
|
|
|
- resultParentNodes.addAll(parentNodes);
|
|
|
|
- Set<Long> parentIdsFu = parentNodes.stream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toSet());
|
|
|
|
- if (parentIdsFu.size() > 0) {
|
|
|
|
- parentIdsAll.addAll(parentIdsFu);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (parentIdsAll.size() > 0) {
|
|
|
|
- this.getParentNodes(resultParentNodes, parentIdsAll, idToNodesMap);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 递归获取所有最底层节点
|
|
|
|
- */
|
|
|
|
- private void getDcNodes(Set<WbsTreeContractLazyVO> resultNodes, List<WbsTreeContractLazyVO> initNode, Map<Long, List<WbsTreeContractLazyVO>> parentIdToNodeAllMap) {
|
|
|
|
- Set<Long> childIds = initNode.stream().map(WbsTreeContractLazyVO::getId).collect(Collectors.toSet());
|
|
|
|
- if (childIds.size() > 0) {
|
|
|
|
- List<WbsTreeContractLazyVO> dcNodeAll = new ArrayList<>();
|
|
|
|
- for (Long childId : childIds) {
|
|
|
|
- //所有子级
|
|
|
|
- List<WbsTreeContractLazyVO> childNodes = parentIdToNodeAllMap.get(childId);
|
|
|
|
- //最底层节点,返回结果
|
|
|
|
- List<WbsTreeContractLazyVO> dcNode = childNodes.stream().filter(f -> f.getHasChildren() == 0).collect(Collectors.toList());
|
|
|
|
- if (dcNode.size() > 0) {
|
|
|
|
- resultNodes.addAll(dcNode);
|
|
|
|
- }
|
|
|
|
- //非最底层节点,进入下次递归循环
|
|
|
|
- List<WbsTreeContractLazyVO> noDcNode = childNodes.stream().filter(f -> f.getHasChildren() == 1).collect(Collectors.toList());
|
|
|
|
- if (noDcNode.size() > 0) {
|
|
|
|
- dcNodeAll.addAll(noDcNode);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (dcNodeAll.size() > 0) {
|
|
|
|
- this.getDcNodes(resultNodes, dcNodeAll, parentIdToNodeAllMap);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public boolean syncContractTabSort(String projectId) {
|
|
public boolean syncContractTabSort(String projectId) {
|
|
if (ObjectUtil.isNotEmpty(projectId)) {
|
|
if (ObjectUtil.isNotEmpty(projectId)) {
|
|
@@ -1214,52 +1154,59 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<WbsTreeContractVO> getConcealedWorksNodeTree(String contractId, String parentId) {
|
|
|
|
- List<WbsTreeContract> wbsTreeContracts = this.getBaseMapper().selectList(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
|
- .select(WbsTreeContract::getId, WbsTreeContract::getPKeyId, WbsTreeContract::getParentId, WbsTreeContract::getNodeType,
|
|
|
|
- WbsTreeContract::getType, WbsTreeContract::getWbsType, WbsTreeContract::getMajorDataType, WbsTreeContract::getPartitionCode,
|
|
|
|
- WbsTreeContract::getOldId, WbsTreeContract::getContractIdRelation, WbsTreeContract::getIsConcealedWorksNode, WbsTreeContract::getIsConcrete
|
|
|
|
- )
|
|
|
|
- .eq(WbsTreeContract::getContractId, contractId).eq(WbsTreeContract::getIsConcealedWorksNode, 1));
|
|
|
|
- List<WbsTreeContract> initNode = wbsTreeContracts.stream()
|
|
|
|
- .distinct()
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
- //获取所有隐蔽节点的父级、子级
|
|
|
|
- Set<WbsTreeContract> resultAllNodes = new HashSet<>();
|
|
|
|
- this.getConcealedWorkParentNode(resultAllNodes, initNode, contractId);
|
|
|
|
- this.getConcealedWorkChildNode(resultAllNodes, initNode, contractId);
|
|
|
|
- resultAllNodes.addAll(initNode);
|
|
|
|
-
|
|
|
|
- /*List<WbsTreeContractVO> result = new ArrayList<>();
|
|
|
|
- for (WbsTreeContract resultAllNode : resultAllNodes) {
|
|
|
|
- WbsTreeContractVO vo = new WbsTreeContractVO();
|
|
|
|
- BeanUtil.copyProperties(resultAllNode, vo);
|
|
|
|
- vo.setNodeName(resultAllNode.getNodeName());
|
|
|
|
- vo.setFullName(resultAllNode.getFullName());
|
|
|
|
- vo.setTitle(resultAllNode.getFullName());
|
|
|
|
- result.add(vo);
|
|
|
|
- }*/
|
|
|
|
- //return this.buildWbsTreeByStream(result, 0L); //全加载树
|
|
|
|
-
|
|
|
|
- List<WbsTreeContractVO> result = BeanUtil.copyProperties(resultAllNodes, WbsTreeContractVO.class);
|
|
|
|
- Map<Long, List<WbsTreeContractVO>> groupMaps = result.stream().collect(Collectors.groupingBy(WbsTreeContractVO::getParentId));
|
|
|
|
-
|
|
|
|
- //半懒加载,实际上已经查出全部的数据了,过滤一下,懒得重新改接口;
|
|
|
|
- List<WbsTreeContractVO> wbsTreeContractVOS;
|
|
|
|
- if (StringUtils.isNotEmpty(parentId)) {
|
|
|
|
- //返回子节点
|
|
|
|
- wbsTreeContractVOS = groupMaps.get(Long.parseLong(parentId));
|
|
|
|
|
|
+ public List<WbsTreeContractLazyVO> getConcealedWorksNodeTree(String contractId, String parentId) {
|
|
|
|
+ //获取当前合同段隐蔽工程节点相关的缓存信息
|
|
|
|
+ List<WbsTreeContract> nodesAllByConcealedWorksNode = new ArrayList<>();
|
|
|
|
+ Object data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:ConcealedWorksNode:" + contractId);
|
|
|
|
+ if (data != null) {
|
|
|
|
+ nodesAllByConcealedWorksNode = JSON.parseArray(data.toString(), WbsTreeContract.class);
|
|
} else {
|
|
} else {
|
|
- //返回根节点
|
|
|
|
- wbsTreeContractVOS = groupMaps.get(0L);
|
|
|
|
|
|
+ List<WbsTreeContract> initNode = this.getBaseMapper().selectList(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
|
+ .eq(WbsTreeContract::getContractId, contractId).eq(WbsTreeContract::getIsConcealedWorksNode, 1)).stream().distinct().collect(Collectors.toList());
|
|
|
|
+ Set<WbsTreeContract> resultAllNodes = new HashSet<>();
|
|
|
|
+ this.getConcealedWorkParentNode(resultAllNodes, initNode, contractId);
|
|
|
|
+ this.getConcealedWorkChildNode(resultAllNodes, initNode, contractId);
|
|
|
|
+ resultAllNodes.addAll(initNode);
|
|
|
|
+ if (resultAllNodes.size() > 0) {
|
|
|
|
+ //把隐蔽工程相关节点存入缓存
|
|
|
|
+ JSONArray array = JSONArray.parseArray(JSON.toJSONString(resultAllNodes));
|
|
|
|
+ redisTemplate.opsForValue().set("blade-manager::contract:wbstree:ConcealedWorksNode:" + contractId, JSON.toJSON(array).toString());
|
|
|
|
+ nodesAllByConcealedWorksNode.addAll(resultAllNodes);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- for (WbsTreeContractVO wbsTreeContractVO : wbsTreeContractVOS) {
|
|
|
|
- List<WbsTreeContractVO> child = groupMaps.get(wbsTreeContractVO.getId());
|
|
|
|
- if (child != null && child.size() > 0) {
|
|
|
|
- wbsTreeContractVO.setHasChildren(true);
|
|
|
|
|
|
+ if (nodesAllByConcealedWorksNode != null) {
|
|
|
|
+ List<WbsTreeContractLazyVO> result = new ArrayList<>();
|
|
|
|
+ for (WbsTreeContract obj : nodesAllByConcealedWorksNode) {
|
|
|
|
+ WbsTreeContractLazyVO vo = BeanUtil.copyProperties(obj, WbsTreeContractLazyVO.class);
|
|
|
|
+ if (vo != null) {
|
|
|
|
+ vo.setTitle(ObjectUtil.isNotEmpty(obj.getFullName()) ? obj.getFullName() : obj.getNodeName());
|
|
|
|
+ result.add(vo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ Map<Long, List<WbsTreeContractLazyVO>> groupMaps = result.stream().collect(Collectors.groupingBy(WbsTreeContractLazyVO::getParentId));
|
|
|
|
+ List<WbsTreeContractLazyVO> wbsTreeContractLazyVOList;
|
|
|
|
+ if (StringUtils.isNotEmpty(parentId)) {
|
|
|
|
+ //返回子节点
|
|
|
|
+ wbsTreeContractLazyVOList = groupMaps.get(Long.parseLong(parentId));
|
|
|
|
+ } else {
|
|
|
|
+ //返回根节点
|
|
|
|
+ wbsTreeContractLazyVOList = groupMaps.get(0L);
|
|
|
|
+ }
|
|
|
|
+ if (wbsTreeContractLazyVOList != null && wbsTreeContractLazyVOList.size() > 0) {
|
|
|
|
+ for (WbsTreeContractLazyVO vo : wbsTreeContractLazyVOList) {
|
|
|
|
+ List<WbsTreeContractLazyVO> child = groupMaps.get(vo.getId());
|
|
|
|
+ if (child != null && child.size() > 0) {
|
|
|
|
+ vo.setHasChildren(1);
|
|
|
|
+ vo.setNotExsitChild(false);
|
|
|
|
+ } else {
|
|
|
|
+ vo.setHasChildren(0);
|
|
|
|
+ vo.setNotExsitChild(true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return wbsTreeContractLazyVOList;
|
|
}
|
|
}
|
|
- return wbsTreeContractVOS;
|
|
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1375,6 +1322,56 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void recursiveGetParentNodes2(List<WbsTreeContractLazyVO> result, List<Long> lowestNodeParentIds, List<WbsTreeContractLazyVO> nodesAll) {
|
|
|
|
+ if (lowestNodeParentIds.isEmpty()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //父级Id与出现的次数Map
|
|
|
|
+ Map<Long, Long> parentIdGroup = lowestNodeParentIds.stream()
|
|
|
|
+ .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
|
|
|
|
+
|
|
|
|
+ List<String> keysWithValueOne = new ArrayList<>();
|
|
|
|
+ Map<Long, Long> keysWithValueSome = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ for (Map.Entry<Long, Long> entry : parentIdGroup.entrySet()) {
|
|
|
|
+ if (entry.getValue() == 1L) {
|
|
|
|
+ keysWithValueOne.add(entry.getKey().toString());
|
|
|
|
+ } else {
|
|
|
|
+ keysWithValueSome.put(entry.getKey(), entry.getValue());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //批量查询单次节点
|
|
|
|
+ List<WbsTreeContractLazyVO> parentNodes = new ArrayList<>();
|
|
|
|
+ if (keysWithValueOne.size() > 0) {
|
|
|
|
+ parentNodes = nodesAll.stream().filter(f -> keysWithValueOne.contains(f.getId().toString())).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //批量查询多次节点
|
|
|
|
+ List<WbsTreeContractLazyVO> multipleParentNodes = new ArrayList<>();
|
|
|
|
+ for (Map.Entry<Long, Long> entry : keysWithValueSome.entrySet()) {
|
|
|
|
+ Long key = entry.getKey();
|
|
|
|
+ Long count = entry.getValue();
|
|
|
|
+
|
|
|
|
+ List<WbsTreeContractLazyVO> nodes = nodesAll.stream().filter(f -> key.equals(f.getId())).collect(Collectors.toList());
|
|
|
|
+ if (!nodes.isEmpty()) {
|
|
|
|
+ multipleParentNodes.addAll(Collections.nCopies(count.intValue(), nodes.get(0)));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //结果集
|
|
|
|
+ List<Long> collect = Stream.concat(parentNodes.stream(), multipleParentNodes.stream())
|
|
|
|
+ .map(WbsTreeContractLazyVO::getParentId)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ if (!collect.isEmpty()) {
|
|
|
|
+ result.addAll(parentNodes);
|
|
|
|
+ result.addAll(multipleParentNodes);
|
|
|
|
+ this.recursiveGetParentNodes(result, collect, nodesAll);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 反向递归处理父节点颜色
|
|
* 反向递归处理父节点颜色
|
|
*/
|
|
*/
|
|
@@ -2134,6 +2131,15 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
updateWrapper.eq(WbsTreeContract::getPKeyId, treeContract.getPKeyId()).set(WbsTreeContract::getIsConcealedWorksNode, treeContract.getIsConcealedWorksNode());
|
|
updateWrapper.eq(WbsTreeContract::getPKeyId, treeContract.getPKeyId()).set(WbsTreeContract::getIsConcealedWorksNode, treeContract.getIsConcealedWorksNode());
|
|
baseMapper.update(null, updateWrapper);
|
|
baseMapper.update(null, updateWrapper);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //更新缓存信息,APP懒加载隐蔽工程节点树使用
|
|
|
|
+ Set<String> contractIds = wbsTreeContractList.stream().map(WbsTreeContract::getContractId).collect(Collectors.toSet());
|
|
|
|
+ for (String contractId : contractIds) {
|
|
|
|
+ Set<String> keys = redisTemplate.keys("blade-manager::contract:wbstree:ConcealedWorksNode:" + contractId + "*");
|
|
|
|
+ if (keys != null) {
|
|
|
|
+ redisTemplate.delete(keys);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|