From 1f0d9a0d21bb227d659fda5158334325fc64ffa0 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 19 Aug 2022 15:30:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E5=AF=BC=E5=85=A5=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 --- .../api/service/ApiScenarioModuleService.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java index 0ecbf6c9bd..808cdf2323 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java @@ -581,7 +581,7 @@ public class ApiScenarioModuleService extends NodeTreeService nameModuleMap = null; Map repeatDataMap = null; if (chooseModule != null) { - if (!repeatApiScenarioWithBLOBs.isEmpty()) { + if (!CollectionUtils.isEmpty(repeatApiScenarioWithBLOBs)) { String chooseModuleParentId = getChooseModuleParentId(chooseModule); String chooseModulePath = getChooseModulePath(idPathMap, chooseModule, chooseModuleParentId); nameModuleMap = optionData.stream().collect(Collectors.toMap(t -> t.getName() + chooseModulePath, scenario -> scenario)); @@ -608,7 +608,7 @@ public class ApiScenarioModuleService extends NodeTreeService repeatMap = repeatApiScenarioWithBLOBs.stream().collect(Collectors.toMap(t -> t.getName() + t.getModulePath(), scenario -> scenario)); Map optionMap = optionData.stream().collect(Collectors.toMap(t -> t.getName() + t.getModulePath(), scenario -> scenario)); if (fullCoverage) { @@ -786,7 +786,6 @@ public class ApiScenarioModuleService extends NodeTreeService idPathMap, ApiScenarioModuleDTO chooseModule, String chooseModuleParentId) { @@ -867,9 +865,12 @@ public class ApiScenarioModuleService extends NodeTreeService collect = parentModuleList.stream().filter(t -> t.getName().equals(tagTree[finalI])).collect(Collectors.toList()); + List collect = null; + if (!CollectionUtils.isEmpty(parentModuleList)) { + collect = parentModuleList.stream().filter(t -> t.getName().equals(tagTree[finalI])).collect(Collectors.toList()); + } - if (collect.isEmpty()) { + if (CollectionUtils.isEmpty(collect)) { if (i == 0) { //证明需要在根目录创建, parentModule = new ApiScenarioModule(); @@ -877,7 +878,7 @@ public class ApiScenarioModuleService extends NodeTreeService