fix(接口测试): 修复接口导入报错问题

--user=郭雨琦
This commit is contained in:
guoyuqi 2022-07-15 12:53:34 +08:00 committed by xiaomeinvG
parent 598703aa32
commit 790f077394
1 changed files with 5 additions and 2 deletions

View File

@ -1331,7 +1331,10 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
ApiModule returnModule = null;
for (int i = 0; i < tagTree.length; i++) {
int finalI = i;
List<ApiModule> collect = parentModuleList.stream().filter(t -> t.getName().equals(tagTree[finalI])).collect(Collectors.toList());
List<ApiModule> collect = new ArrayList<>();
if (parentModuleList != null && !parentModuleList.isEmpty()) {
collect = parentModuleList.stream().filter(t -> t.getName().equals(tagTree[finalI])).collect(Collectors.toList());
}
if (collect.isEmpty()) {
if (i == 0) {
//证明需要在根目录创建
@ -1341,7 +1344,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
parentModule.setLevel(0);
parentModule.setProtocol(pidChildrenMap.get("root").get(0).getProtocol());
} else {
if (!parentModuleList.isEmpty() && parentModule == null) {
if (parentModuleList != null && !parentModuleList.isEmpty() && parentModule == null) {
String parentId = parentModuleList.get(0).getParentId();
ApiModuleDTO apiModuleDTO = idModuleMap.get(parentId);
parentModule = JSON.parseObject(JSON.toJSONString(apiModuleDTO), ApiModule.class);