mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-05 05:29:29 +08:00
refactor(系统设置): 定时任务增加修改表达式
This commit is contained in:
parent
cbfb5e2221
commit
2022245d00
@ -251,7 +251,7 @@ public class ApiTaskCenterService {
|
||||
String path,
|
||||
String method,
|
||||
String module) {
|
||||
nodesList.forEach(node -> {
|
||||
nodesList.parallelStream().forEach(node -> {
|
||||
String endpoint = TaskRunnerClient.getEndpoint(node.getIp(), node.getPort());
|
||||
//需要去除取消勾选的report
|
||||
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {
|
||||
|
@ -2292,7 +2292,7 @@ public class ApiScenarioService extends MoveNodeService {
|
||||
request.setSelectIds(scenarioIds);
|
||||
ApiScenarioBatchOperationResponse response =
|
||||
ApiScenarioBatchOperationUtils.executeWithBatchOperationResponse(scenarioIds, sublist -> copyAndInsert(sublist, request, logInsertModule.getOperator()));
|
||||
apiScenarioLogService.saveBatchOperationLog(response, request.getProjectId(), OperationLogType.COPY.name(), logInsertModule, null);
|
||||
apiScenarioLogService.saveBatchOperationLog(response, request.getProjectId(), OperationLogType.ADD.name(), logInsertModule, null);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -1753,7 +1753,7 @@ public class ApiScenarioControllerTests extends BaseTest {
|
||||
//增加日志检查
|
||||
operationScenarioIds.forEach(item -> {
|
||||
LOG_CHECK_LIST.add(
|
||||
new CheckLogModel(item, OperationLogType.COPY, "/api/scenario/batch-operation/copy")
|
||||
new CheckLogModel(item, OperationLogType.ADD, "/api/scenario/batch-operation/copy")
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -65,6 +65,13 @@ public class TaskCenterController {
|
||||
taskCenterService.enable(id);
|
||||
}
|
||||
|
||||
@PostMapping("/schedule/update/{id}/{cron}")
|
||||
@Operation(summary = "系统-任务中心-修改定时任务")
|
||||
@CheckOwner(resourceId = "#id", resourceType = "schedule")
|
||||
public void update(@PathVariable String id, @PathVariable String cron) {
|
||||
taskCenterService.update(id, cron);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -210,4 +210,12 @@ public class TaskCenterService {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void update(String id, String cron) {
|
||||
Schedule schedule = checkScheduleExit(id);
|
||||
schedule.setValue(cron);
|
||||
scheduleService.editSchedule(schedule);
|
||||
scheduleService.addOrUpdateCronJob(schedule, new JobKey(schedule.getKey(), schedule.getJob()),
|
||||
new TriggerKey(schedule.getKey(),schedule.getJob()), schedule.getJob().getClass());
|
||||
}
|
||||
}
|
||||
|
@ -192,6 +192,7 @@ class TaskCenterScheduleControllerTests extends BaseTest {
|
||||
scheduleService.editSchedule(schedule);
|
||||
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/update/" + "test-schedule-switch" + "/0 0/2 * * * ?");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user