diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java index e81884ba64..9be31f37bd 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java @@ -33,6 +33,7 @@ import io.metersphere.track.dto.PlanReportCaseDTO; import io.metersphere.utils.LoggerUtil; import org.apache.commons.beanutils.BeanMap; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -162,6 +163,7 @@ public class ApiScenarioReportService { } public List list(QueryAPIReportRequest request) { + request = this.initRequest(request); request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); List list = extApiScenarioReportMapper.list(request); List userIds = list.stream().map(APIScenarioReportResult::getUserId) @@ -175,7 +177,20 @@ public class ApiScenarioReportService { return list; } + public QueryAPIReportRequest initRequest(QueryAPIReportRequest request){ + if(request != null){ + //初始化triggerMode的查询条件: 如果查询API的话,增加 JENKINS_RUN_TEST_PLAN(jenkins调用测试计划时执行的场景) 查询条件 + if(MapUtils.isNotEmpty(request.getFilters()) && request.getFilters().containsKey("trigger_mode") + && CollectionUtils.isNotEmpty(request.getFilters().get("trigger_mode")) + && request.getFilters().get("trigger_mode").contains("API") && !request.getFilters().get("trigger_mode").contains(ReportTriggerMode.JENKINS_RUN_TEST_PLAN.name())){ + request.getFilters().get("trigger_mode").add(ReportTriggerMode.JENKINS_RUN_TEST_PLAN.name()); + } + } + return request; + } + public List idList(QueryAPIReportRequest request) { + request = this.initRequest(request); request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); return extApiScenarioReportMapper.idList(request); } @@ -224,10 +239,6 @@ public class ApiScenarioReportService { if (StringUtils.equals(reportType, RunModeConstants.SET_REPORT.toString())) { return report; } - if(StringUtils.equalsAnyIgnoreCase(report.getTriggerMode(),ReportTriggerMode.JENKINS_RUN_TEST_PLAN.name())){ - //jenkins运行测试计划时执行的场景,触发方式改回API - report.setTriggerMode(ReportTriggerMode.API.name()); - } if (runMode.equals("CASE")) { report.setTriggerMode(TriggerMode.MANUAL.name()); } diff --git a/frontend/src/business/components/common/tableItem/ReportTriggerModeItem.vue b/frontend/src/business/components/common/tableItem/ReportTriggerModeItem.vue index 4fc1eed866..45ec0f71d8 100644 --- a/frontend/src/business/components/common/tableItem/ReportTriggerModeItem.vue +++ b/frontend/src/business/components/common/tableItem/ReportTriggerModeItem.vue @@ -5,6 +5,7 @@ {{$t('commons.trigger_mode.test_plan_schedule')}} {{$t('commons.trigger_mode.test_plan_api')}} {{$t('commons.trigger_mode.api')}} + {{$t('commons.trigger_mode.api')}} {{$t('api_test.automation.batch_execute')}}