|
@@ -22,6 +22,7 @@ import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
|
+import org.springblade.manager.bean.NodeVO;
|
|
import org.springblade.manager.dto.FindAllUserByConditionDTO;
|
|
import org.springblade.manager.dto.FindAllUserByConditionDTO;
|
|
import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
|
|
import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
|
|
import org.springblade.manager.entity.*;
|
|
import org.springblade.manager.entity.*;
|
|
@@ -394,7 +395,8 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
|
|
Map<Long, Integer> informationQueryMaps = informationQueryList.stream().collect(Collectors.toMap(InformationQuery::getWbsId, InformationQuery::getStatus, (v1, v2) -> v1));
|
|
Map<Long, Integer> informationQueryMaps = informationQueryList.stream().collect(Collectors.toMap(InformationQuery::getWbsId, InformationQuery::getStatus, (v1, v2) -> v1));
|
|
List<Long> pKeyIdList = new ArrayList<>(informationQueryMaps.keySet());
|
|
List<Long> pKeyIdList = new ArrayList<>(informationQueryMaps.keySet());
|
|
|
|
|
|
- //填报过的所有最底层节点(并且是查询有效节点的最下级节点)处理数量
|
|
|
|
|
|
+ //TODO 处理数量
|
|
|
|
+ //填报过的所有最底层节点
|
|
List<WbsTreeContractLazyVO> lowestNodesTB = distinctLowestNodesAll.stream().filter(f -> pKeyIdList.contains(f.getPKeyId()) && resultNodesPKeyIds.contains(f.getPKeyId())).collect(Collectors.toList());
|
|
List<WbsTreeContractLazyVO> lowestNodesTB = distinctLowestNodesAll.stream().filter(f -> pKeyIdList.contains(f.getPKeyId()) && resultNodesPKeyIds.contains(f.getPKeyId())).collect(Collectors.toList());
|
|
List<Long> lowestNodeParentIdsTB = lowestNodesTB.stream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toList());
|
|
List<Long> lowestNodeParentIdsTB = lowestNodesTB.stream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toList());
|
|
List<WbsTreeContractLazyVO> resultParentNodesTB = new ArrayList<>();
|
|
List<WbsTreeContractLazyVO> resultParentNodesTB = new ArrayList<>();
|
|
@@ -413,6 +415,20 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
|
|
}
|
|
}
|
|
}).collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity()));
|
|
}).collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity()));
|
|
|
|
|
|
|
|
+ //TODO 处理颜色
|
|
|
|
+ //先将WbsTreeContractLazyVO转为NodeVO
|
|
|
|
+ List<NodeVO> nodeVOList = distinctNodesAll.stream().map(wbsTreeContractServiceImpl::convertToNodeVO).collect(Collectors.toList());
|
|
|
|
+ //转为Map<Long, NodeVO>
|
|
|
|
+ Map<Long, NodeVO> nodeVOMap = nodeVOList.stream().collect(Collectors.toMap(NodeVO::getId, vo -> vo, (existing, replacement) -> existing));
|
|
|
|
+ //把distinctNodesAll把所有节点转为树形结构,再转为List<NodeVO>对象
|
|
|
|
+ List<NodeVO> treeNodeVOList = wbsTreeContractServiceImpl.buildNodeTreeByStream(distinctNodesAll, lowestNodesMap);
|
|
|
|
+ //处理节点颜色
|
|
|
|
+ NodeVO.calculateStatusToDFS(treeNodeVOList, nodeVOMap);
|
|
|
|
+ //把树形结构转为普通List集合
|
|
|
|
+ List<NodeVO> nodeVOS = wbsTreeContractServiceImpl.flattenTree(treeNodeVOList);
|
|
|
|
+ //获取所有节点颜色Map
|
|
|
|
+ Map<Long, Integer> nodeColorStatusMap = nodeVOS.stream().collect(Collectors.toMap(NodeVO::getPKeyId, NodeVO::getStatus, (existing, replacement) -> existing));
|
|
|
|
+
|
|
//构造vo
|
|
//构造vo
|
|
if (wbsTreeContractList.size() > 0) {
|
|
if (wbsTreeContractList.size() > 0) {
|
|
//处理填报数量
|
|
//处理填报数量
|
|
@@ -425,24 +441,31 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
|
|
countMap.put(key, 1L);
|
|
countMap.put(key, 1L);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- List<WbsTreeContractTreeAllVO> wbsTreeContractTreeAllVOS = wbsTreeContractList.stream().map(node -> {
|
|
|
|
- WbsTreeContractTreeAllVO vo = BeanUtil.copyProperties(node, WbsTreeContractTreeAllVO.class);
|
|
|
|
- if (vo != null) {
|
|
|
|
- vo.setContractIdRelation(node.getContractId());
|
|
|
|
- vo.setType(ObjectUtils.isNotEmpty(node.getNodeType()) ? node.getNodeType() : 0);
|
|
|
|
- vo.setTitle(ObjectUtil.isNotEmpty(node.getFullName()) ? node.getFullName() : node.getNodeName());
|
|
|
|
- vo.setPrimaryKeyId(node.getPKeyId());
|
|
|
|
- vo.setSubmitCounts(ObjectUtil.isNotEmpty(countMap.get(vo.getPrimaryKeyId())) ? countMap.get(vo.getPrimaryKeyId()) : (ObjectUtil.isNotEmpty(informationQueryMaps.get(vo.getPrimaryKeyId())) ? 1L : 0L));
|
|
|
|
- if (vo.getSubmitCounts() >= 1L) {
|
|
|
|
- vo.setColorStatus(2);
|
|
|
|
- }
|
|
|
|
- WbsTreeContractLazyVO lowestNode = lowestNodesMap.get(vo.getPrimaryKeyId());
|
|
|
|
- if (lowestNode != null) {
|
|
|
|
- vo.setColorStatus(lowestNode.getColorStatus());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return vo;
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
|
|
+ List<WbsTreeContractTreeAllVO> wbsTreeContractTreeAllVOS = wbsTreeContractList.stream()
|
|
|
|
+ .map(node -> {
|
|
|
|
+ WbsTreeContractTreeAllVO vo = BeanUtil.copyProperties(node, WbsTreeContractTreeAllVO.class);
|
|
|
|
+ if (vo != null) {
|
|
|
|
+ vo.setContractIdRelation(node.getContractId());
|
|
|
|
+ vo.setType(ObjectUtils.isNotEmpty(node.getNodeType()) ? node.getNodeType() : 0);
|
|
|
|
+ vo.setTitle(ObjectUtil.isNotEmpty(node.getFullName()) ? node.getFullName() : node.getNodeName());
|
|
|
|
+ vo.setPrimaryKeyId(node.getPKeyId());
|
|
|
|
+
|
|
|
|
+ //设置数量
|
|
|
|
+ vo.setSubmitCounts(ObjectUtil.isNotEmpty(countMap.get(vo.getPrimaryKeyId())) ? countMap.get(vo.getPrimaryKeyId()) : (ObjectUtil.isNotEmpty(informationQueryMaps.get(vo.getPrimaryKeyId())) ? 1L : 0L));
|
|
|
|
+
|
|
|
|
+ //设置颜色
|
|
|
|
+ Integer parentColorStatus = nodeColorStatusMap.get(vo.getPrimaryKeyId());
|
|
|
|
+ if (parentColorStatus != null) {
|
|
|
|
+ vo.setColorStatus(parentColorStatus);
|
|
|
|
+ } else {
|
|
|
|
+ WbsTreeContractLazyVO lowestNode = lowestNodesMap.get(vo.getPrimaryKeyId());
|
|
|
|
+ if (lowestNode != null) {
|
|
|
|
+ vo.setColorStatus(lowestNode.getColorStatus());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return vo;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
return R.data(this.buildWbsTreeByStreamByTreeAll(wbsTreeContractTreeAllVOS));
|
|
return R.data(this.buildWbsTreeByStreamByTreeAll(wbsTreeContractTreeAllVOS));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -514,6 +537,13 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
|
|
}
|
|
}
|
|
}).collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity()));
|
|
}).collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity()));
|
|
|
|
|
|
|
|
+ List<NodeVO> nodeVOList = distinctNodesAll.stream().map(wbsTreeContractServiceImpl::convertToNodeVO).collect(Collectors.toList());
|
|
|
|
+ Map<Long, NodeVO> nodeVOMap = nodeVOList.stream().collect(Collectors.toMap(NodeVO::getId, vo -> vo, (existing, replacement) -> existing));
|
|
|
|
+ List<NodeVO> treeNodeVOList = wbsTreeContractServiceImpl.buildNodeTreeByStream(distinctNodesAll, lowestNodesMap);
|
|
|
|
+ NodeVO.calculateStatusToDFS(treeNodeVOList, nodeVOMap);
|
|
|
|
+ List<NodeVO> nodeVOS = wbsTreeContractServiceImpl.flattenTree(treeNodeVOList);
|
|
|
|
+ Map<Long, Integer> nodeColorStatusMap = nodeVOS.stream().collect(Collectors.toMap(NodeVO::getPKeyId, NodeVO::getStatus, (existing, replacement) -> existing));
|
|
|
|
+
|
|
if (wbsTreeContractList.size() > 0) {
|
|
if (wbsTreeContractList.size() > 0) {
|
|
Map<Long, Long> countMap = new HashMap<>();
|
|
Map<Long, Long> countMap = new HashMap<>();
|
|
for (WbsTreeContractLazyVO node : resultParentNodesTB) {
|
|
for (WbsTreeContractLazyVO node : resultParentNodesTB) {
|
|
@@ -524,24 +554,28 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
|
|
countMap.put(key, 1L);
|
|
countMap.put(key, 1L);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- List<WbsTreeContractTreeAllVO> wbsTreeContractTreeAllVOS = wbsTreeContractList.stream().map(node -> {
|
|
|
|
- WbsTreeContractTreeAllVO vo = BeanUtil.copyProperties(node, WbsTreeContractTreeAllVO.class);
|
|
|
|
- if (vo != null) {
|
|
|
|
- vo.setContractIdRelation(node.getContractId());
|
|
|
|
- vo.setType(ObjectUtils.isNotEmpty(node.getNodeType()) ? node.getNodeType() : 0);
|
|
|
|
- vo.setTitle(ObjectUtil.isNotEmpty(node.getFullName()) ? node.getFullName() : node.getNodeName());
|
|
|
|
- vo.setPrimaryKeyId(node.getPKeyId());
|
|
|
|
- vo.setSubmitCounts(ObjectUtil.isNotEmpty(countMap.get(vo.getPrimaryKeyId())) ? countMap.get(vo.getPrimaryKeyId()) : (ObjectUtil.isNotEmpty(informationQueryMaps.get(vo.getPrimaryKeyId())) ? 1L : 0L));
|
|
|
|
- if (vo.getSubmitCounts() >= 1L) {
|
|
|
|
- vo.setColorStatus(2);
|
|
|
|
- }
|
|
|
|
- WbsTreeContractLazyVO lowestNode = lowestNodesMap.get(vo.getPrimaryKeyId());
|
|
|
|
- if (lowestNode != null) {
|
|
|
|
- vo.setColorStatus(lowestNode.getColorStatus());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return vo;
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
|
|
+ List<WbsTreeContractTreeAllVO> wbsTreeContractTreeAllVOS = wbsTreeContractList.stream()
|
|
|
|
+ .map(node -> {
|
|
|
|
+ WbsTreeContractTreeAllVO vo = BeanUtil.copyProperties(node, WbsTreeContractTreeAllVO.class);
|
|
|
|
+ if (vo != null) {
|
|
|
|
+ vo.setContractIdRelation(node.getContractId());
|
|
|
|
+ vo.setType(ObjectUtils.isNotEmpty(node.getNodeType()) ? node.getNodeType() : 0);
|
|
|
|
+ vo.setTitle(ObjectUtil.isNotEmpty(node.getFullName()) ? node.getFullName() : node.getNodeName());
|
|
|
|
+ vo.setPrimaryKeyId(node.getPKeyId());
|
|
|
|
+ vo.setSubmitCounts(ObjectUtil.isNotEmpty(countMap.get(vo.getPrimaryKeyId())) ? countMap.get(vo.getPrimaryKeyId()) : (ObjectUtil.isNotEmpty(informationQueryMaps.get(vo.getPrimaryKeyId())) ? 1L : 0L));
|
|
|
|
+
|
|
|
|
+ Integer parentColorStatus = nodeColorStatusMap.get(vo.getPrimaryKeyId());
|
|
|
|
+ if (parentColorStatus != null) {
|
|
|
|
+ vo.setColorStatus(parentColorStatus);
|
|
|
|
+ } else {
|
|
|
|
+ WbsTreeContractLazyVO lowestNode = lowestNodesMap.get(vo.getPrimaryKeyId());
|
|
|
|
+ if (lowestNode != null) {
|
|
|
|
+ vo.setColorStatus(lowestNode.getColorStatus());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return vo;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
resultMaps.put(contractRelationJlyz.getContractIdSg(), this.buildWbsTreeByStreamByTreeAll(wbsTreeContractTreeAllVOS));
|
|
resultMaps.put(contractRelationJlyz.getContractIdSg(), this.buildWbsTreeByStreamByTreeAll(wbsTreeContractTreeAllVOS));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -553,94 +587,6 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 处理submitCounts计数、colorStatus颜色问题
|
|
|
|
- *
|
|
|
|
- * @param reNodes 数据源
|
|
|
|
- */
|
|
|
|
- private void reSetSubmitCountsAndColorStatus(List<WbsTreeContractTreeAllVO> reNodes) {
|
|
|
|
- //反向for循环解决顺序问题,最底层节点才是数据源
|
|
|
|
- for (int i = reNodes.size() - 1; i >= 0; i--) {
|
|
|
|
- WbsTreeContractTreeAllVO node = reNodes.get(i);
|
|
|
|
- if (node.getChildren() != null && !node.getChildren().isEmpty()) {
|
|
|
|
- //计数
|
|
|
|
- long childSubmitCounts = 0L;
|
|
|
|
- for (WbsTreeContractTreeAllVO child : node.getChildren()) {
|
|
|
|
- if (child.getSubmitCounts() == 1L) {
|
|
|
|
- childSubmitCounts++;
|
|
|
|
- } else if (child.getSubmitCounts() > 1L) {
|
|
|
|
- childSubmitCounts = child.getSubmitCounts();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- node.setSubmitCounts(childSubmitCounts);
|
|
|
|
-
|
|
|
|
- //颜色
|
|
|
|
- boolean allThree = true; //是否所有子节点的getColorStatus都等于3
|
|
|
|
- boolean allFour = true; //是否所有子节点的getColorStatus都等于4
|
|
|
|
- boolean hasTwo = false; //是否存在子节点的getColorStatus等于2
|
|
|
|
- boolean hasOne = false; //是否存在子节点的getColorStatus等于1
|
|
|
|
- boolean hasThreeOrFour = false; //是否存在子节点的getColorStatus等于3或4
|
|
|
|
- for (WbsTreeContractTreeAllVO child : node.getChildren()) {
|
|
|
|
- if (child.getColorStatus() != 3) {
|
|
|
|
- allThree = false;
|
|
|
|
- }
|
|
|
|
- if (child.getColorStatus() != 4) {
|
|
|
|
- allFour = false;
|
|
|
|
- }
|
|
|
|
- if (child.getColorStatus() == 2) {
|
|
|
|
- hasTwo = true;
|
|
|
|
- }
|
|
|
|
- if (child.getColorStatus() == 1) {
|
|
|
|
- hasOne = true;
|
|
|
|
- }
|
|
|
|
- if (child.getColorStatus() == 3 || child.getColorStatus() == 4) {
|
|
|
|
- hasThreeOrFour = true;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (allThree) {
|
|
|
|
- node.setColorStatus(3);
|
|
|
|
- } else if (allFour) {
|
|
|
|
- node.setColorStatus(4);
|
|
|
|
- } else if (hasTwo || (hasOne && hasThreeOrFour)) {
|
|
|
|
- node.setColorStatus(2);
|
|
|
|
- } else {
|
|
|
|
- node.setColorStatus(1);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if (node.getSubmitCounts() == 1L) {
|
|
|
|
- node.setSubmitCounts(1L);
|
|
|
|
- //最底层节点颜色
|
|
|
|
- if (ObjectUtils.isNotEmpty(node.getColorStatus())) {
|
|
|
|
- if (node.getColorStatus().equals(0)) { //任务状态=0,未上报
|
|
|
|
- node.setColorStatus(2); //蓝色
|
|
|
|
- } else if (node.getColorStatus().equals(1)) { //任务状态=1,待审批
|
|
|
|
- node.setColorStatus(3); //橙色
|
|
|
|
- } else if (node.getColorStatus().equals(2)) { //任务状态=2,已审批
|
|
|
|
- node.setColorStatus(4); //绿色
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else if (node.getSubmitCounts() == 0L && ObjectUtils.isEmpty(node.getColorStatus())) {
|
|
|
|
- node.setColorStatus(1); //黑色 //任务状态=null,未填报
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取构造完的List集合
|
|
|
|
- *
|
|
|
|
- * @param reNodes 数据源
|
|
|
|
- * @param result 结果集
|
|
|
|
- */
|
|
|
|
- private void getNodesAll(List<WbsTreeContractTreeAllVO> reNodes, LinkedList<WbsTreeContractTreeAllVO> result) {
|
|
|
|
- for (WbsTreeContractTreeAllVO node : reNodes) {
|
|
|
|
- if (node.getChildren() != null && !node.getChildren().isEmpty()) {
|
|
|
|
- result.addAll(node.getChildren());
|
|
|
|
- this.getNodesAll(node.getChildren(), result);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 反向递归获取父级
|
|
* 反向递归获取父级
|
|
*
|
|
*
|