fix(测试跟踪): 测试计划关闭定时任务失效

--bug=1018354 --user=陈建星 【测试跟踪】测试计划设置定时任务,首页关闭后继续执行 https://www.tapd.cn/55049933/s/1266270
This commit is contained in:
chenjianxing 2022-10-18 16:40:06 +08:00 committed by jianxing
parent 93b6d84b34
commit 6f7708e2b1
4 changed files with 7 additions and 14 deletions

View File

@ -251,20 +251,20 @@ public class TestPlanController {
testPlanService.editReport(testPlanWithBLOBs); testPlanService.editReport(testPlanWithBLOBs);
} }
@PostMapping(value = "/schedule/updateEnableByPrimyKey") @PostMapping(value = "/schedule/update/enable")
public Schedule updateScheduleEnableByPrimyKey(@RequestBody ScheduleInfoRequest request) { public Schedule updateScheduleEnableByPrimyKey(@RequestBody ScheduleInfoRequest request) {
Schedule schedule = baseScheduleService.getSchedule(request.getTaskID()); Schedule schedule = baseScheduleService.getSchedule(request.getTaskID());
schedule.setEnable(request.isEnable()); schedule.setEnable(request.isEnable());
planApiAutomationService.updateSchedule(schedule); testPlanService.updateSchedule(schedule);
return schedule; return schedule;
} }
@PostMapping(value = "/schedule/updateEnableByPrimyKey/disable") @PostMapping(value = "/schedule/update/disable")
@SendNotice(taskType = NoticeConstants.TaskType.TRACK_HOME_TASK, event = NoticeConstants.Event.CLOSE_SCHEDULE, subject = "测试跟踪通知") @SendNotice(taskType = NoticeConstants.TaskType.TRACK_HOME_TASK, event = NoticeConstants.Event.CLOSE_SCHEDULE, subject = "测试跟踪通知")
public Schedule disableSchedule(@RequestBody ScheduleInfoRequest request) { public Schedule disableSchedule(@RequestBody ScheduleInfoRequest request) {
Schedule schedule = baseScheduleService.getSchedule(request.getTaskID()); Schedule schedule = baseScheduleService.getSchedule(request.getTaskID());
schedule.setEnable(false); schedule.setEnable(false);
planApiAutomationService.updateSchedule(schedule); testPlanService.updateSchedule(schedule);
return schedule; return schedule;
} }

View File

@ -1578,7 +1578,7 @@ public class TestPlanService {
for (String id : scheduleIds) { for (String id : scheduleIds) {
Schedule schedule = baseScheduleService.getSchedule(id); Schedule schedule = baseScheduleService.getSchedule(id);
schedule.setEnable(request.isEnable()); schedule.setEnable(request.isEnable());
planApiAutomationService.updateSchedule(schedule); updateSchedule(schedule);
} }
} }

View File

@ -1,12 +1,9 @@
package io.metersphere.plan.service.remote.api; package io.metersphere.plan.service.remote.api;
import io.metersphere.base.domain.ApiScenarioWithBLOBs; import io.metersphere.base.domain.ApiScenarioWithBLOBs;
import io.metersphere.base.domain.Schedule;
import io.metersphere.dto.MsExecResponseDTO; import io.metersphere.dto.MsExecResponseDTO;
import io.metersphere.plan.reuest.api.RunScenarioRequest; import io.metersphere.plan.reuest.api.RunScenarioRequest;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import java.util.List; import java.util.List;
@ -21,10 +18,6 @@ public class PlanApiAutomationService extends ApiTestService {
return microService.postForDataArray(serviceName, BASE_UEL + "/plan/run", request, MsExecResponseDTO.class); return microService.postForDataArray(serviceName, BASE_UEL + "/plan/run", request, MsExecResponseDTO.class);
} }
public void updateSchedule(Schedule request) {
microService.postForData(serviceName, BASE_UEL + "/schedule/update", request);
}
public ApiScenarioWithBLOBs get(@PathVariable String id) { public ApiScenarioWithBLOBs get(@PathVariable String id) {
return microService.getForData(serviceName, BASE_UEL + "/get/" + id, ApiScenarioWithBLOBs.class); return microService.getForData(serviceName, BASE_UEL + "/get/" + id, ApiScenarioWithBLOBs.class);
} }

View File

@ -250,11 +250,11 @@ export function getPlanUiScenarioAllCase(planId, param) {
} }
export function updatePlanSchedule(param) { export function updatePlanSchedule(param) {
return post(BASE_URL + 'schedule/updateEnableByPrimyKey/disable', param); return post(BASE_URL + 'schedule/update/disable', param);
} }
export function updateScheduleEnableByPrimyKey(param) { export function updateScheduleEnableByPrimyKey(param) {
return post(BASE_URL + 'schedule/updateEnableByPrimyKey', param); return post(BASE_URL + 'schedule/update/enable', param);
} }