diff --git a/api-test/backend/src/main/java/io/metersphere/service/ext/ExtApiScheduleService.java b/api-test/backend/src/main/java/io/metersphere/service/ext/ExtApiScheduleService.java index 9986eb8830..39d2d38d14 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/ext/ExtApiScheduleService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/ext/ExtApiScheduleService.java @@ -89,6 +89,18 @@ public class ExtApiScheduleService { return scheduleMapper.deleteByExample(scheduleExample); } + public void closeByResourceId(String resourceId, String group) { + ScheduleExample scheduleExample = new ScheduleExample(); + scheduleExample.createCriteria().andResourceIdEqualTo(resourceId); + removeJob(resourceId, group); + List list = scheduleMapper.selectByExample(scheduleExample); + for (Schedule schedule : list) { + schedule.setEnable(false); + scheduleMapper.updateByPrimaryKey(schedule); + } + + } + public int deleteByProjectId(String projectId) { ScheduleExample scheduleExample = new ScheduleExample(); scheduleExample.createCriteria().andProjectIdEqualTo(projectId); diff --git a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java index 27b762e4f9..4098b58fe1 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java @@ -617,7 +617,7 @@ public class ApiScenarioService { return; } List scenarioIds = apiScenarioVersions.stream().map(ApiScenario::getId).collect(toList()); - scenarioIds.forEach(scenarioId -> scheduleService.deleteByResourceId(scenarioId, ScheduleGroup.API_SCENARIO_TEST.name())); + scenarioIds.forEach(scenarioId -> scheduleService.closeByResourceId(scenarioId, ScheduleGroup.API_SCENARIO_TEST.name())); ApiScenarioExampleWithOperation example = new ApiScenarioExampleWithOperation(); example.createCriteria().andRefIdIn(refIds); @@ -736,7 +736,7 @@ public class ApiScenarioService { ApiScenarioEnvRequest request = new ApiScenarioEnvRequest(); request.setEnvironmentEnable(false); request.setDefinition(scenarioWithBLOBs.getScenarioDefinition()); - request.setEnvironmentMap( JSON.parseObject(scenarioWithBLOBs.getEnvironmentJson(), Map.class)); + request.setEnvironmentMap(JSON.parseObject(scenarioWithBLOBs.getEnvironmentJson(), Map.class)); request.setEnvironmentType(scenarioWithBLOBs.getEnvironmentType()); request.setEnvironmentGroupId(scenarioWithBLOBs.getEnvironmentGroupId()); request.setId(scenarioWithBLOBs.getId()); diff --git a/api-test/frontend/src/business/automation/scenario/ApiScenarioList.vue b/api-test/frontend/src/business/automation/scenario/ApiScenarioList.vue index 12df45ab49..a7d95e6893 100644 --- a/api-test/frontend/src/business/automation/scenario/ApiScenarioList.vue +++ b/api-test/frontend/src/business/automation/scenario/ApiScenarioList.vue @@ -198,6 +198,7 @@ :field="item" :fields-width="fieldsWidth" min-width="100px" + v-if="!trashEnable" :filters="!trashEnable ? scheduleFilters : null" prop="schedule">