fix(测试跟踪): 测试计划用例模块数量统计有误

This commit is contained in:
chenjianxing 2022-07-18 16:44:54 +08:00 committed by f2c-ci-robot[bot]
parent 3bd5324d24
commit fa0d4e25b8
1 changed files with 5 additions and 5 deletions

View File

@ -83,18 +83,18 @@ public class NodeTreeService<T extends TreeNodeDTO> {
return nodeTree;
}
List<T> children = Optional.ofNullable(nodeTree.getChildren()).orElse(new ArrayList<>());
List<T> children = new ArrayList<>();
lowerNodes.forEach(node -> {
if (node.getParentId() != null && node.getParentId().equals(rootNode.getId())) {
children.add(buildNodeTree(nodeLevelMap, node, countMap));
if (countMap != null) {
Integer childrenCount = children.stream().map(TreeNodeDTO::getCaseNum).reduce(Integer::sum).get();
nodeTree.setCaseNum(nodeTree.getCaseNum() + childrenCount);
}
nodeTree.setChildren(children);
}
});
if (countMap != null && CollectionUtils.isNotEmpty(children)) {
Integer childrenCount = children.stream().map(TreeNodeDTO::getCaseNum).reduce(Integer::sum).get();
nodeTree.setCaseNum(nodeTree.getCaseNum() + childrenCount);
}
return nodeTree;
}