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,18 +671,15 @@ 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)) {
BaseTreeNode node = new BaseTreeNode(treeNode.getId(), treeNode.getName(), treeNode.getType(), treeNode.getParentId()); notMatchedList.add(treeNode);
node.setPath(StringUtils.join("/", node.getName())); continue;
baseTreeNodeList.add(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);
}
} }
BaseTreeNode node = new BaseTreeNode(treeNode.getId(), treeNode.getName(), treeNode.getType(), treeNode.getParentId());
node.genModulePath(baseTreeNodeMap.get(treeNode.getParentId()));
baseTreeNodeMap.put(treeNode.getId(), node);
baseTreeNodeList.add(node);
} }
traverseList = notMatchedList; traverseList = notMatchedList;
} }