fix(任务中心): 补充后台任务运行规则修改日志

--bug=1047955 --user=王旭 【项目任务中心】系统后台任务列表-开启/关闭/修改运行规则/删除操作-未生成系统日志 https://www.tapd.cn/55049933/s/1598388
This commit is contained in:
WangXu10 2024-10-25 16:02:59 +08:00 committed by Craftsman
parent 892917346d
commit 61e1c504be
4 changed files with 6 additions and 5 deletions

View File

@ -187,7 +187,7 @@ public class ProjectTaskHubController {
@Operation(summary = "项目-任务中心-后台任务更新cron表达式")
@RequiresPermissions(PermissionConstants.PROJECT_SCHEDULE_TASK_CENTER_READ_UPDATE)
public void updateValue(@Validated @RequestBody ScheduleRequest request) {
baseTaskHubService.updateCron(request);
baseTaskHubService.updateCron(request, SessionUtils.getUserId(), "/project/task-center/schedule/update-cron", OperationLogModule.PROJECT_MANAGEMENT_TASK_CENTER);
}
@PostMapping("/exec-task/batch/page")

View File

@ -200,7 +200,7 @@ public class OrganizationTaskHubController {
@Operation(summary = "组织-任务中心-后台任务更新cron表达式")
@RequiresPermissions(PermissionConstants.ORGANIZATION_SCHEDULE_TASK_CENTER_READ_UPDATE)
public void updateValue(@Validated @RequestBody ScheduleRequest request) {
baseTaskHubService.updateCron(request);
baseTaskHubService.updateCron(request, SessionUtils.getUserId(), "/organization/task-center/schedule/update-cron", OperationLogModule.SETTING_ORGANIZATION_TASK_CENTER);
}
@PostMapping("/exec-task/batch/page")

View File

@ -206,7 +206,7 @@ public class SystemTaskHubController {
@Operation(summary = "系统-任务中心-后台任务更新cron表达式")
@RequiresPermissions(PermissionConstants.SYSTEM_SCHEDULE_TASK_CENTER_READ_UPDATE)
public void updateValue(@Validated @RequestBody ScheduleRequest request) {
baseTaskHubService.updateCron(request);
baseTaskHubService.updateCron(request, SessionUtils.getUserId(), "/system/task-center/schedule/update-cron", OperationLogModule.SETTING_SYSTEM_TASK_CENTER);
}
}

View File

@ -888,13 +888,14 @@ public class BaseTaskHubService {
return list;
}
public void updateCron(ScheduleRequest request) {
public void updateCron(ScheduleRequest request, String userId, String path, String module) {
Schedule schedule = checkScheduleExit(request.getId());
schedule.setValue(request.getCron());
scheduleService.editSchedule(schedule);
try {
scheduleService.addOrUpdateCronJob(schedule, new JobKey(schedule.getKey(), schedule.getJob()),
new TriggerKey(schedule.getKey(), schedule.getJob()), Class.forName(schedule.getJob()));
saveLog(List.of(schedule), userId, path, HttpMethodConstants.GET.name(), module, OperationLogType.UPDATE.name());
} catch (ClassNotFoundException e) {
LogUtils.error(e);
throw new RuntimeException(e);