|
@@ -1214,52 +1214,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;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -2134,6 +2141,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;
|