|
@@ -415,7 +415,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
public List<AppWbsTreeContractVO> searchNodeAllTable(String primaryKeyId, String tableOwner, String contractId, String projectId) {
|
|
|
//由于Feign调用时,获取不到UserId
|
|
|
Long userId;
|
|
|
- if (primaryKeyId.contains(":")) {
|
|
|
+ if (StringUtils.isNotEmpty(primaryKeyId) && primaryKeyId.contains(":")) {
|
|
|
String[] ds = primaryKeyId.split(":");
|
|
|
primaryKeyId = ds[0];
|
|
|
userId = Long.parseLong(ds[1]);
|
|
@@ -951,20 +951,65 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<WbsTreeContractLazyVO> getConcealedWorksNodeTree(String contractId) {
|
|
|
+ public List<WbsTreeContractVO> getConcealedWorksNodeTree(String contractId) {
|
|
|
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
|
|
|
+ .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> distinctWbsTreeContracts = wbsTreeContracts.stream()
|
|
|
+ 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);
|
|
|
+ result.add(vo);
|
|
|
+ }
|
|
|
+ return this.buildWbsTreeByStream(result, 0L);
|
|
|
+ }
|
|
|
|
|
|
- //TODO
|
|
|
+ /**
|
|
|
+ * 递归获取隐蔽工程节点的所有父级节点
|
|
|
+ *
|
|
|
+ * @param resultAllNodes 结果集
|
|
|
+ * @param initNode 初始化节点入参
|
|
|
+ * @param contractId 合同段id
|
|
|
+ */
|
|
|
+ private void getConcealedWorkParentNode(Set<WbsTreeContract> resultAllNodes, List<WbsTreeContract> initNode, String contractId) {
|
|
|
+ Set<Long> parentIds = initNode.stream().map(WbsTreeContract::getParentId).collect(Collectors.toSet());
|
|
|
+ if (parentIds.size() > 0) {
|
|
|
+ List<WbsTreeContract> parentNodes = baseMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery().in(WbsTreeContract::getId, parentIds).eq(WbsTreeContract::getContractId, contractId).eq(WbsTreeContract::getType, 1));
|
|
|
+ if (parentNodes.size() > 0) {
|
|
|
+ resultAllNodes.addAll(parentNodes);
|
|
|
+ this.getConcealedWorkParentNode(resultAllNodes, parentNodes, contractId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- return null;
|
|
|
+ /**
|
|
|
+ * 递归获取隐蔽工程节点的所有子级节点
|
|
|
+ *
|
|
|
+ * @param resultAllNodes 结果集
|
|
|
+ * @param initNode 初始化节点入参
|
|
|
+ * @param contractId 合同段id
|
|
|
+ */
|
|
|
+ private void getConcealedWorkChildNode(Set<WbsTreeContract> resultAllNodes, List<WbsTreeContract> initNode, String contractId) {
|
|
|
+ Set<Long> childIds = initNode.stream().map(WbsTreeContract::getId).collect(Collectors.toSet());
|
|
|
+ if (childIds.size() > 0) {
|
|
|
+ List<WbsTreeContract> childNodes = baseMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery().in(WbsTreeContract::getParentId, childIds).eq(WbsTreeContract::getContractId, contractId).eq(WbsTreeContract::getType, 1));
|
|
|
+ if (childNodes.size() > 0) {
|
|
|
+ resultAllNodes.addAll(childNodes);
|
|
|
+ this.getConcealedWorkChildNode(resultAllNodes, childNodes, contractId);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|