|
|
|
|
@ -83,11 +83,11 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
// valid trigger
|
|
|
|
|
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
|
|
|
|
|
if (scheduleTypeEnum == null) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
|
|
|
|
|
if (jobInfo.getScheduleConf()==null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
|
|
|
|
|
return Response.ofFail ( "Cron"+I18nUtil.getString("system_unvalid"));
|
|
|
|
|
return Response.ofFail ( "Cron"+I18nUtil.getString("system_invalid"));
|
|
|
|
|
}
|
|
|
|
|
} else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE/* || scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY*/) {
|
|
|
|
|
if (jobInfo.getScheduleConf() == null) {
|
|
|
|
|
@ -96,16 +96,16 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
try {
|
|
|
|
|
int fixSecond = Integer.parseInt(jobInfo.getScheduleConf());
|
|
|
|
|
if (fixSecond < 1) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// valid job
|
|
|
|
|
if (GlueTypeEnum.match(jobInfo.getGlueType()) == null) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("jobinfo_field_gluetype")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("jobinfo_field_gluetype")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
if (GlueTypeEnum.BEAN==GlueTypeEnum.match(jobInfo.getGlueType()) && StringTool.isBlank(jobInfo.getExecutorHandler()) ) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("system_please_input")+"JobHandler") );
|
|
|
|
|
@ -117,13 +117,13 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
|
|
|
|
|
// valid advanced
|
|
|
|
|
if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("misfire_strategy")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("misfire_strategy")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 》ChildJobId valid
|
|
|
|
|
@ -143,7 +143,7 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return Response.ofFail (
|
|
|
|
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_unvalid")), childJobIdItem));
|
|
|
|
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_invalid")), childJobIdItem));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -189,35 +189,35 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
// valid trigger
|
|
|
|
|
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
|
|
|
|
|
if (scheduleTypeEnum == null) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
|
|
|
|
|
if (jobInfo.getScheduleConf()==null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
|
|
|
|
|
return Response.ofFail ( "Cron"+I18nUtil.getString("system_unvalid") );
|
|
|
|
|
return Response.ofFail ( "Cron"+I18nUtil.getString("system_invalid") );
|
|
|
|
|
}
|
|
|
|
|
} else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE /*|| scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY*/) {
|
|
|
|
|
if (jobInfo.getScheduleConf() == null) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
int fixSecond = Integer.parseInt(jobInfo.getScheduleConf());
|
|
|
|
|
if (fixSecond < 1) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// valid advanced
|
|
|
|
|
if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("misfire_strategy")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("misfire_strategy")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 》ChildJobId valid
|
|
|
|
|
@ -228,7 +228,7 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
// parse child
|
|
|
|
|
int childJobId = Integer.parseInt(childJobIdItem);
|
|
|
|
|
if (childJobId == jobInfo.getId()) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("jobinfo_field_childJobId")+"("+childJobId+")"+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("jobinfo_field_childJobId")+"("+childJobId+")"+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// valid child
|
|
|
|
|
@ -244,7 +244,7 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return Response.ofFail (
|
|
|
|
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_unvalid")), childJobIdItem));
|
|
|
|
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_invalid")), childJobIdItem));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -261,7 +261,7 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
// group valid
|
|
|
|
|
XxlJobGroup jobGroup = xxlJobGroupMapper.load(jobInfo.getJobGroup());
|
|
|
|
|
if (jobGroup == null) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("jobinfo_field_jobgroup")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("jobinfo_field_jobgroup")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// stage job info
|
|
|
|
|
@ -279,12 +279,12 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
// generate next trigger time
|
|
|
|
|
Date nextValidTime = scheduleTypeEnum.getScheduleType().generateNextTriggerTime(jobInfo, new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
|
|
|
|
|
if (nextValidTime == null) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
nextTriggerTime = nextValidTime.getTime();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error(e.getMessage(), e);
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -344,7 +344,7 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
// load and valid
|
|
|
|
|
XxlJobInfo xxlJobInfo = xxlJobInfoMapper.loadById(id);
|
|
|
|
|
if (xxlJobInfo == null) {
|
|
|
|
|
return Response.ofFail(I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
|
|
|
|
|
return Response.ofFail(I18nUtil.getString("jobinfo_glue_jobid_invalid"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// valid jobGroup permission
|
|
|
|
|
@ -365,12 +365,12 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
Date nextValidTime = scheduleTypeEnum.getScheduleType().generateNextTriggerTime(xxlJobInfo, new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
|
|
|
|
|
|
|
|
|
|
if (nextValidTime == null) {
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
nextTriggerTime = nextValidTime.getTime();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error(e.getMessage(), e);
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return Response.ofFail ( (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_invalid")) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xxlJobInfo.setTriggerStatus(TriggerStatus.RUNNING.getValue());
|
|
|
|
|
@ -392,7 +392,7 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
// load and valid
|
|
|
|
|
XxlJobInfo xxlJobInfo = xxlJobInfoMapper.loadById(id);
|
|
|
|
|
if (xxlJobInfo == null) {
|
|
|
|
|
return Response.ofFail(I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
|
|
|
|
|
return Response.ofFail(I18nUtil.getString("jobinfo_glue_jobid_invalid"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// valid jobGroup permission
|
|
|
|
|
@ -420,7 +420,7 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
// valid job
|
|
|
|
|
XxlJobInfo xxlJobInfo = xxlJobInfoMapper.loadById(jobId);
|
|
|
|
|
if (xxlJobInfo == null) {
|
|
|
|
|
return Response.ofFail(I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
|
|
|
|
|
return Response.ofFail(I18nUtil.getString("jobinfo_glue_jobid_invalid"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// valid jobGroup permission
|
|
|
|
|
|