Browse Source

fix create&update wrokflow cron APIs, verify end time must bigger than start time (#8871)

3.0.0/version-upgrade
Tq 3 years ago committed by GitHub
parent
commit
1f83140558
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java

11
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java

@ -168,6 +168,11 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe
putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME); putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME);
return result; return result;
} }
if (scheduleParam.getStartTime().getTime() > scheduleParam.getEndTime().getTime()) {
logger.warn("The start time must smaller than end time");
putMsg(result, Status.START_TIME_BIGGER_THAN_END_TIME_ERROR);
return result;
}
scheduleObj.setStartTime(scheduleParam.getStartTime()); scheduleObj.setStartTime(scheduleParam.getStartTime());
scheduleObj.setEndTime(scheduleParam.getEndTime()); scheduleObj.setEndTime(scheduleParam.getEndTime());
if (!org.quartz.CronExpression.isValidExpression(scheduleParam.getCrontab())) { if (!org.quartz.CronExpression.isValidExpression(scheduleParam.getCrontab())) {
@ -649,6 +654,12 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe
putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME); putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME);
return; return;
} }
if (scheduleParam.getStartTime().getTime() > scheduleParam.getEndTime().getTime()) {
logger.warn("The start time must smaller than end time");
putMsg(result, Status.START_TIME_BIGGER_THAN_END_TIME_ERROR);
return;
}
schedule.setStartTime(scheduleParam.getStartTime()); schedule.setStartTime(scheduleParam.getStartTime());
schedule.setEndTime(scheduleParam.getEndTime()); schedule.setEndTime(scheduleParam.getEndTime());
if (!org.quartz.CronExpression.isValidExpression(scheduleParam.getCrontab())) { if (!org.quartz.CronExpression.isValidExpression(scheduleParam.getCrontab())) {

Loading…
Cancel
Save