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

This commit is contained in:
chenjianxing 2022-07-18 16:44:54 +08:00 committed by jianxing
parent 3468cf1f7b
commit 2e1bcde9d4
1 changed files with 5 additions and 5 deletions

View File

@ -83,18 +83,18 @@ public class NodeTreeService<T extends TreeNodeDTO> {
return nodeTree; return nodeTree;
} }
List<T> children = Optional.ofNullable(nodeTree.getChildren()).orElse(new ArrayList<>()); List<T> children = new ArrayList<>();
lowerNodes.forEach(node -> { lowerNodes.forEach(node -> {
if (node.getParentId() != null && node.getParentId().equals(rootNode.getId())) { if (node.getParentId() != null && node.getParentId().equals(rootNode.getId())) {
children.add(buildNodeTree(nodeLevelMap, node, countMap)); 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); 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; return nodeTree;
} }