From ed98065194bd1080d598b9f68f0b6c027b3d4c4a Mon Sep 17 00:00:00 2001 From: Jianguo-Genius Date: Tue, 19 Nov 2024 15:39:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E6=89=B9=E9=87=8F=E7=BC=96=E8=BE=91=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=A2=9E=E5=8A=A0Corn=E8=A1=A8=E8=BE=BE?= =?UTF-8?q?=E5=BC=8F=E7=9A=84=E9=9D=9E=E7=A9=BA=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/api/service/scenario/ApiScenarioService.java | 3 +++ .../io/metersphere/plan/service/TestPlanScheduleService.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java index 87fe8d8581..f0e020fa46 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java @@ -2559,6 +2559,9 @@ public class ApiScenarioService extends MoveNodeService { if (StringUtils.isBlank(request.getCron()) && request.getConfig() == null) { this.batchUpdateSchedule(apiScenarios, request.isEnable(), operator); } else { + if (StringUtils.isBlank(request.getCron())) { + throw new MSException("Cron can not be null"); + } apiScenarios.forEach(apiScenario -> { ScheduleConfig scheduleConfig = ScheduleConfig.builder() .resourceId(apiScenario.getId()) diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanScheduleService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanScheduleService.java index 93158d6f8f..9924e4b7eb 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanScheduleService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanScheduleService.java @@ -46,6 +46,9 @@ public class TestPlanScheduleService { scheduleService.updateIfExist(testPlan.getId(), request.isEnable(), TestPlanScheduleJob.getJobKey(testPlan.getId()), TestPlanScheduleJob.getTriggerKey(testPlan.getId()), TestPlanScheduleJob.class, operator); } else { + if (StringUtils.isBlank(request.getCron())) { + throw new MSException("Cron can not be null"); + } ScheduleConfig scheduleConfig = ScheduleConfig.builder() .resourceId(testPlan.getId()) .key(testPlan.getId())