Compare commits
2 Commits
5d7421da8d
...
65daeb7e4a
| Author | SHA1 | Date | |
|---|---|---|---|
| 65daeb7e4a | |||
| 713e3dc74d |
@@ -434,7 +434,6 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
|||||||
}
|
}
|
||||||
// 查询子节点,可能是同类型节点也可能是不同类型节点
|
// 查询子节点,可能是同类型节点也可能是不同类型节点
|
||||||
// 先查同类型节点:当前标签下,包含currentNodeTagId且深度+1
|
// 先查同类型节点:当前标签下,包含currentNodeTagId且深度+1
|
||||||
// int depth = finalCurrentNodeTagId.split(",").length;
|
|
||||||
int depth = getCurrentNodeDepth(projectNodePo);
|
int depth = getCurrentNodeDepth(projectNodePo);
|
||||||
String finalCurrentTag = currentTag;
|
String finalCurrentTag = currentTag;
|
||||||
List<ProjectNodePo> sameTypeNodeList = taskTreeNodeList.stream().filter(node -> {
|
List<ProjectNodePo> sameTypeNodeList = taskTreeNodeList.stream().filter(node -> {
|
||||||
@@ -450,22 +449,6 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
// 再查不同类型的节点:下一标签下的节点
|
// 再查不同类型的节点:下一标签下的节点
|
||||||
TaskNodeTag finalNextNodeTag = nextNodeTag;
|
TaskNodeTag finalNextNodeTag = nextNodeTag;
|
||||||
// List<ProjectNodePo> childrenTypeNodeList = taskTreeNodeList.stream().filter(node -> {
|
|
||||||
// try {
|
|
||||||
// String nodeTagId = getTagProperty(node, currentTag);
|
|
||||||
// if (StringUtils.isBlank(nodeTagId)) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// // tagId相同且:当前深度 = task深度 + 1
|
|
||||||
// // tagId相同,且nodeType是nextNodeTag类型且子tagId的深度最少
|
|
||||||
// return nodeTagId.equals(finalCurrentNodeTagId) && node.getNodeType().equals(finalNextNodeTag.getKey());
|
|
||||||
//// return nodeTagId.equals(finalCurrentNodeTagId) && currentNodeDepth == getCurrentNodeDepth(node) - 1;
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// throw new RuntimeException(e);
|
|
||||||
// }
|
|
||||||
// }).collect(Collectors.toList());
|
|
||||||
// maxNodeTagSize
|
|
||||||
|
|
||||||
List<NodeAllBase> children = new ArrayList<>();
|
List<NodeAllBase> children = new ArrayList<>();
|
||||||
if (CollectionUtils.isNotEmpty(sameTypeNodeList)) {
|
if (CollectionUtils.isNotEmpty(sameTypeNodeList)) {
|
||||||
// 递归
|
// 递归
|
||||||
@@ -475,9 +458,12 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
|||||||
if (CollectionUtils.isNotEmpty(sameTypeNodeList)) {
|
if (CollectionUtils.isNotEmpty(sameTypeNodeList)) {
|
||||||
children.addAll(sameTypeNodeList);
|
children.addAll(sameTypeNodeList);
|
||||||
}
|
}
|
||||||
}else if (!currentTag.equals(finalNextNodeTag.getValue()) && !lastNodeTag.equals(currentTag)){
|
}
|
||||||
|
if (!currentTag.equals(finalNextNodeTag.getValue()) && !lastNodeTag.equals(currentTag)){
|
||||||
List<ProjectNodePo> childrenTypeNodeList = getChildrenTypeNodeList(currentTag,finalNextNodeTag,finalCurrentNodeTagId);
|
List<ProjectNodePo> childrenTypeNodeList = getChildrenTypeNodeList(currentTag,finalNextNodeTag,finalCurrentNodeTagId);
|
||||||
|
List<Long> childrenTypeNodeIdList = new ArrayList<>();
|
||||||
if (CollectionUtils.isNotEmpty(childrenTypeNodeList)) {
|
if (CollectionUtils.isNotEmpty(childrenTypeNodeList)) {
|
||||||
|
childrenTypeNodeIdList = childrenTypeNodeList.stream().map(ProjectNodePo::getId).toList();
|
||||||
int firstLayerNodeDepth = getFirstLayerNodeDepth(childrenTypeNodeList);
|
int firstLayerNodeDepth = getFirstLayerNodeDepth(childrenTypeNodeList);
|
||||||
childrenTypeNodeList = childrenTypeNodeList.stream().filter(node -> getCurrentNodeDepth(node) == firstLayerNodeDepth).collect(Collectors.toList());
|
childrenTypeNodeList = childrenTypeNodeList.stream().filter(node -> getCurrentNodeDepth(node) == firstLayerNodeDepth).collect(Collectors.toList());
|
||||||
if (CollectionUtils.isNotEmpty(childrenTypeNodeList)) {
|
if (CollectionUtils.isNotEmpty(childrenTypeNodeList)) {
|
||||||
@@ -485,13 +471,34 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
|||||||
for (ProjectNodePo nodePo : childrenTypeNodeList) {
|
for (ProjectNodePo nodePo : childrenTypeNodeList) {
|
||||||
generateTaskTree(nodePo);
|
generateTaskTree(nodePo);
|
||||||
}
|
}
|
||||||
|
children.addAll(childrenTypeNodeList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(childrenTypeNodeList)) {
|
// 查找当前节点的其他子节点(非直接顺序子节点)
|
||||||
children.addAll(childrenTypeNodeList);
|
List<Long> finalChildrenTypeNodeIdList = childrenTypeNodeIdList;
|
||||||
|
List<ProjectNodePo> otherChildrenNodeList = taskTreeNodeList.stream().filter(node -> {
|
||||||
|
try {
|
||||||
|
String nodeTagId = getTagProperty(node, finalCurrentTag);
|
||||||
|
if (StringUtils.isBlank(nodeTagId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !node.getNodeType().equals(currentNodeType) && nodeTagId.equals(finalCurrentNodeTagId) && getCurrentNodeDepth(node) == depth + 1 && !finalChildrenTypeNodeIdList.contains(node.getId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(otherChildrenNodeList)) {
|
||||||
|
int firstLayerNodeDepth = getFirstLayerNodeDepth(otherChildrenNodeList);
|
||||||
|
otherChildrenNodeList = otherChildrenNodeList.stream().filter(node -> getCurrentNodeDepth(node) == firstLayerNodeDepth).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(otherChildrenNodeList)) {
|
||||||
|
// 递归
|
||||||
|
for (ProjectNodePo nodePo : otherChildrenNodeList) {
|
||||||
|
generateTaskTree(nodePo);
|
||||||
|
}
|
||||||
|
children.addAll(otherChildrenNodeList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(currentNodeAssociatedTaskList)) {
|
if (CollectionUtils.isNotEmpty(currentNodeAssociatedTaskList)) {
|
||||||
currentNodeAssociatedTaskList.forEach(task -> task.setNodeName(task.getTaskName()));
|
currentNodeAssociatedTaskList.forEach(task -> task.setNodeName(task.getTaskName()));
|
||||||
children.addAll(currentNodeAssociatedTaskList);
|
children.addAll(currentNodeAssociatedTaskList);
|
||||||
|
|||||||
Reference in New Issue
Block a user