From 9dd8567dc6ce77b5bc24dbd5eb6c476d603d5cd8 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 19 Apr 2024 14:11:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=BA=E6=99=AF=E5=BC=80=E5=90=AF=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E4=B8=8D=E5=8F=91?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1039786 --user=王孝刚 【接口测试】场景-场景列表开启/关闭定时任务失败,导致发通知失败 https://www.tapd.cn/55049933/s/1501995 --- .../api/controller/scenario/ApiScenarioController.java | 2 +- .../java/io/metersphere/system/schedule/ScheduleService.java | 4 +++- frontend/src/views/api-test/management/components/import.vue | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioController.java b/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioController.java index de0966ea5a..a0e4ef8928 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioController.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioController.java @@ -214,7 +214,7 @@ public class ApiScenarioController { @GetMapping(value = "/schedule-config-delete/{scenarioId}") @Operation(summary = "接口测试-接口场景管理-删除定时任务配置") @RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_EXECUTE) - @Log(type = OperationLogType.UPDATE, expression = "#msClass.scheduleLog(#request.getScenarioId())", msClass = ApiScenarioLogService.class) + @Log(type = OperationLogType.UPDATE, expression = "#msClass.scheduleLog(#scenarioId)", msClass = ApiScenarioLogService.class) @CheckOwner(resourceId = "#scenarioId", resourceType = "api_scenario") public void deleteScheduleConfig(@PathVariable String scenarioId) { apiValidateService.validateApiMenuInProject(scenarioId, ApiResource.API_SCENARIO.name()); diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/schedule/ScheduleService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/schedule/ScheduleService.java index ea960e6168..78d57c49ca 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/schedule/ScheduleService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/schedule/ScheduleService.java @@ -118,7 +118,9 @@ public class ScheduleService { ScheduleExample example = new ScheduleExample(); example.createCriteria().andResourceIdEqualTo(scheduleConfig.getResourceId()).andJobEqualTo(clazz.getName()); List scheduleList = scheduleMapper.selectByExample(example); + boolean needSendNotice = false; if (CollectionUtils.isNotEmpty(scheduleList)) { + needSendNotice = !scheduleList.getFirst().getEnable().equals(scheduleConfig.getEnable()); schedule = scheduleConfig.genCronSchedule(scheduleList.getFirst()); schedule.setUpdateTime(System.currentTimeMillis()); schedule.setJob(clazz.getName()); @@ -134,7 +136,7 @@ public class ScheduleService { } //通知 if ((CollectionUtils.isEmpty(scheduleList) && BooleanUtils.isTrue(scheduleConfig.getEnable())) - || (CollectionUtils.isNotEmpty(scheduleList) && !scheduleList.getFirst().getEnable().equals(scheduleConfig.getEnable()))) { + || needSendNotice) { apiScheduleNoticeService.sendScheduleNotice(schedule, operator); } diff --git a/frontend/src/views/api-test/management/components/import.vue b/frontend/src/views/api-test/management/components/import.vue index 5bef6c94a4..4580fd4767 100644 --- a/frontend/src/views/api-test/management/components/import.vue +++ b/frontend/src/views/api-test/management/components/import.vue @@ -395,7 +395,7 @@ const defaultForm: ImportApiDefinitionRequest = { platform: RequestImportFormat.SWAGGER, name: '', - moduleId: 'root', + moduleId: '', coverData: false, syncCase: true, coverModule: false,