From 61e1c504be9810f69c847ddf93a913009743d165 Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Fri, 25 Oct 2024 16:02:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=BB=E5=8A=A1=E4=B8=AD=E5=BF=83):=20?= =?UTF-8?q?=20=E8=A1=A5=E5=85=85=E5=90=8E=E5=8F=B0=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E8=A7=84=E5=88=99=E4=BF=AE=E6=94=B9=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1047955 --user=王旭 【项目任务中心】系统后台任务列表-开启/关闭/修改运行规则/删除操作-未生成系统日志 https://www.tapd.cn/55049933/s/1598388 --- .../project/controller/ProjectTaskHubController.java | 2 +- .../system/controller/OrganizationTaskHubController.java | 4 ++-- .../system/controller/SystemTaskHubController.java | 2 +- .../io/metersphere/system/service/BaseTaskHubService.java | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectTaskHubController.java b/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectTaskHubController.java index c6a1aebbb8..900c8bd88b 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectTaskHubController.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectTaskHubController.java @@ -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") diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationTaskHubController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationTaskHubController.java index 09f19dc5e0..0260bceed6 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationTaskHubController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationTaskHubController.java @@ -182,7 +182,7 @@ public class OrganizationTaskHubController { public void batchEnable(@Validated @RequestBody TableBatchProcessDTO request) { List projectList = baseProjectMapper.getProjectOptionsByOrgId(SessionUtils.getCurrentOrganizationId()); List projectIds = projectList.stream().map(OptionDTO::getId).toList(); - baseTaskHubService.scheduleBatchOperation(request, SessionUtils.getUserId(), SessionUtils.getCurrentProjectId(), "/organization/task-center/schedule/batch-enable", OperationLogModule.SETTING_ORGANIZATION_TASK_CENTER, true,projectIds); + baseTaskHubService.scheduleBatchOperation(request, SessionUtils.getUserId(), SessionUtils.getCurrentProjectId(), "/organization/task-center/schedule/batch-enable", OperationLogModule.SETTING_ORGANIZATION_TASK_CENTER, true, projectIds); } @@ -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") diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemTaskHubController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemTaskHubController.java index c2ed338c78..63cd56a8aa 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemTaskHubController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemTaskHubController.java @@ -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); } } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java index 1818a8d600..32863e853a 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java @@ -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);