fix(接口测试): 接口场景导入har不加模块

--user=郭雨琦
--bug=1014743
--bug=1014736
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001014743
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001014736
This commit is contained in:
guoyuqi 2022-07-08 11:45:25 +08:00 committed by xiaomeinvG
parent 81df1f9328
commit b780741f48
3 changed files with 11 additions and 2 deletions

View File

@ -60,7 +60,6 @@ public class HarScenarioParser extends HarScenarioAbstractParser<ScenarioImport>
private void parseScenarioWithBLOBs(List<ApiScenarioWithBLOBs> scenarioWithBLOBsList, MsScenario msScenario) {
ApiScenarioWithBLOBs scenarioWithBLOBs = parseScenario(msScenario);
scenarioWithBLOBs.setModulePath("/" + msScenario.getName());
scenarioWithBLOBsList.add(scenarioWithBLOBs);
}

View File

@ -790,6 +790,9 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
}
}
if (optionData.isEmpty()) {
moduleMap = new HashMap<>();
}
return getUpdateApiModuleDTO(moduleMap, toUpdateList, optionData);
}

View File

@ -516,7 +516,11 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
setModule(optionData, moduleMap, pidChildrenMap, idPathMap, idModuleMap, chooseModule);
List<String> names = optionData.stream().map(ApiScenario::getName).collect(Collectors.toList());
//系统内重复的数据
List<ApiScenarioWithBLOBs> repeatApiScenarioWithBLOBs = extApiScenarioMapper.selectRepeatByBLOBs(names, projectId);
List<ApiScenarioWithBLOBs> repeatAllScenarioWithBLOBs = extApiScenarioMapper.selectRepeatByBLOBs(names, projectId);
ArrayList<ApiScenarioWithBLOBs> repeatApiScenarioWithBLOBs = repeatAllScenarioWithBLOBs.stream().collect(
Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(t -> t.getName() + t.getModulePath()))), ArrayList::new)
);
Map<String, ApiScenarioWithBLOBs> nameModuleMap = null;
Map<String, ApiScenarioWithBLOBs> repeatDataMap = null;
@ -559,6 +563,9 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
}
}
if (optionData.isEmpty()) {
moduleMap = new HashMap<>();
}
UpdateScenarioModuleDTO updateScenarioModuleDTO = new UpdateScenarioModuleDTO();
updateScenarioModuleDTO.setModuleList(new ArrayList<>(moduleMap.values()));
updateScenarioModuleDTO.setNeedUpdateList(toUpdateList);