refactor(系统设置): 优化定时任务修改规则

This commit is contained in:
wxg0103 2024-04-10 13:08:44 +08:00 committed by 刘瑞斌
parent e799f147f5
commit ad1c56290e
2 changed files with 4 additions and 4 deletions

View File

@ -65,11 +65,11 @@ public class TaskCenterController {
taskCenterService.enable(id); taskCenterService.enable(id);
} }
@PostMapping("/schedule/update/{id}/{cron}") @PostMapping("/schedule/update/{id}")
@Operation(summary = "系统-任务中心-修改定时任务") @Operation(summary = "系统-任务中心-修改定时任务")
@CheckOwner(resourceId = "#id", resourceType = "schedule") @CheckOwner(resourceId = "#id", resourceType = "schedule")
public void update(@PathVariable String id, @PathVariable String cron) { public void update(@PathVariable String id, @RequestBody Object cron) {
taskCenterService.update(id, cron); taskCenterService.update(id, cron.toString());
} }

View File

@ -193,6 +193,6 @@ class TaskCenterScheduleControllerTests extends BaseTest {
scheduleService.getScheduleByResource(schedule.getResourceId(), schedule.getJob()); scheduleService.getScheduleByResource(schedule.getResourceId(), schedule.getJob());
this.requestGet("/task/center/schedule/switch" + "test-schedule-switch"); this.requestGet("/task/center/schedule/switch" + "test-schedule-switch");
this.requestGet("/task/center/schedule/switch" + "test-schedule-switch"); this.requestGet("/task/center/schedule/switch" + "test-schedule-switch");
this.requestGet("/task/center/schedule/update/" + "test-schedule-switch" + "/0 0/2 * * * ?"); this.requestPost("/task/center/schedule/update/" + "test-schedule-switch" ,"/0 0/2 * * * ?");
} }
} }