fix(接口测试): 修复接口测试导入报错的缺陷

This commit is contained in:
wxg0103 2024-03-22 13:18:10 +08:00 committed by 刘瑞斌
parent b26c85d198
commit 53802e892b
1 changed files with 8 additions and 11 deletions

View File

@ -671,19 +671,16 @@ public class ApiDefinitionImportUtilService {
lastSize = traverseList.size(); lastSize = traverseList.size();
List<BaseTreeNode> notMatchedList = new ArrayList<>(); List<BaseTreeNode> notMatchedList = new ArrayList<>();
for (BaseTreeNode treeNode : traverseList) { for (BaseTreeNode treeNode : traverseList) {
if (StringUtils.equalsIgnoreCase(treeNode.getParentId(), ModuleConstants.ROOT_NODE_PARENT_ID)) { if (!baseTreeNodeMap.containsKey(treeNode.getParentId()) && !StringUtils.equalsIgnoreCase(treeNode.getParentId(), ModuleConstants.ROOT_NODE_PARENT_ID)) {
notMatchedList.add(treeNode);
continue;
}
BaseTreeNode node = new BaseTreeNode(treeNode.getId(), treeNode.getName(), treeNode.getType(), treeNode.getParentId()); BaseTreeNode node = new BaseTreeNode(treeNode.getId(), treeNode.getName(), treeNode.getType(), treeNode.getParentId());
node.setPath(StringUtils.join("/", node.getName())); node.genModulePath(baseTreeNodeMap.get(treeNode.getParentId()));
baseTreeNodeList.add(node);
baseTreeNodeMap.put(treeNode.getId(), node); baseTreeNodeMap.put(treeNode.getId(), node);
} else {
if (baseTreeNodeMap.containsKey(treeNode.getParentId())) {
BaseTreeNode node = new BaseTreeNode(treeNode.getId(), treeNode.getName(), treeNode.getType(), treeNode.getParentId());
node.setPath(StringUtils.join(baseTreeNodeMap.get(treeNode.getParentId()).getPath(), "/", node.getName()));
baseTreeNodeList.add(node); baseTreeNodeList.add(node);
} }
}
}
traverseList = notMatchedList; traverseList = notMatchedList;
} }
return baseTreeNodeList; return baseTreeNodeList;