fix(接口管理): 修复场景导入系统请求问题

--bug=1047839 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001047839
This commit is contained in:
guoyuqi 2024-10-22 19:07:16 +08:00 committed by Craftsman
parent bb5bb53322
commit 4376d3bc91
1 changed files with 6 additions and 3 deletions

View File

@ -49,12 +49,15 @@ public class ApiScenarioSelectAssociateService {
case "SCENARIO": case "SCENARIO":
List<ApiScenarioStepDTO> apiScenarioStepDTOs = handleApiScenarioData(request.get(key)); List<ApiScenarioStepDTO> apiScenarioStepDTOs = handleApiScenarioData(request.get(key));
steps.addAll(apiScenarioStepDTOs); steps.addAll(apiScenarioStepDTOs);
break;
case "CASE": case "CASE":
List<ApiScenarioStepDTO> apiCaseStepDTOs = handleApiCaseData(request.get(key)); List<ApiScenarioStepDTO> apiCaseStepDTOs = handleApiCaseData(request.get(key));
steps.addAll(apiCaseStepDTOs); steps.addAll(apiCaseStepDTOs);
break;
default: default:
List<ApiScenarioStepDTO> apiStepDTOs = handleApiData(request.get(key)); List<ApiScenarioStepDTO> apiStepDTOs = handleApiData(request.get(key));
steps.addAll(apiStepDTOs); steps.addAll(apiStepDTOs);
break;
} }
} }
return steps; return steps;
@ -126,20 +129,20 @@ public class ApiScenarioSelectAssociateService {
moduleMaps.remove(MODULE_ALL); moduleMaps.remove(MODULE_ALL);
if (selectAllModule) { if (selectAllModule) {
// 选择了全部模块 // 选择了全部模块
List<ApiTestCaseAssociateDTO> apiTestCaseList = extApiTestCaseMapper.selectAllApiCaseWithAssociate(request.getProjectId(), request.getProtocols()); List<ApiTestCaseAssociateDTO> apiTestCaseList = extApiTestCaseMapper.selectAllApiCaseWithAssociate(request.getProjectId(), request.getProtocols());
getCaseSteps(request, apiTestCaseList, steps); getCaseSteps(request, apiTestCaseList, steps);
} else { } else {
AssociateCaseDTO dto = getCaseIds(moduleMaps); AssociateCaseDTO dto = getCaseIds(moduleMaps);
List<ApiTestCaseAssociateDTO> apiTestCaseList = new ArrayList<>(); List<ApiTestCaseAssociateDTO> apiTestCaseList = new ArrayList<>();
//获取全选的模块数据 //获取全选的模块数据
if (CollectionUtils.isNotEmpty(dto.getModuleIds())) { if (CollectionUtils.isNotEmpty(dto.getModuleIds())) {
apiTestCaseList = extApiTestCaseMapper.getListBySelectModulesWithAssociate( request.getProjectId(), dto.getModuleIds(), request.getProtocols()); apiTestCaseList = extApiTestCaseMapper.getListBySelectModulesWithAssociate(request.getProjectId(), dto.getModuleIds(), request.getProtocols());
} }
if (CollectionUtils.isNotEmpty(dto.getSelectIds())) { if (CollectionUtils.isNotEmpty(dto.getSelectIds())) {
CollectionUtils.removeAll(dto.getSelectIds(), apiTestCaseList.stream().map(ApiTestCase::getId).toList()); CollectionUtils.removeAll(dto.getSelectIds(), apiTestCaseList.stream().map(ApiTestCase::getId).toList());
//获取选中的ids数据 //获取选中的ids数据
List<ApiTestCaseAssociateDTO> selectIdList = extApiTestCaseMapper.getListBySelectIdsWithAssociate(request.getProjectId(), dto.getSelectIds(), request.getProtocols()); List<ApiTestCaseAssociateDTO> selectIdList = extApiTestCaseMapper.getListBySelectIdsWithAssociate(request.getProjectId(), dto.getSelectIds(), request.getProtocols());
apiTestCaseList.addAll(selectIdList); apiTestCaseList.addAll(selectIdList);
} }