|
|
|
|
@ -25,6 +25,7 @@ import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* core job action for xxl-job
|
|
|
|
|
*
|
|
|
|
|
* @author xuxueli 2016-5-28 15:30:33
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
@ -63,83 +64,83 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
// valid base
|
|
|
|
|
XxlJobGroup group = xxlJobGroupDao.load(jobInfo.getJobGroup());
|
|
|
|
|
if (group == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_choose")+I18nUtil.getString("jobinfo_field_jobgroup")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_choose") + I18nUtil.getString("jobinfo_field_jobgroup")));
|
|
|
|
|
}
|
|
|
|
|
if (jobInfo.getJobDesc()==null || jobInfo.getJobDesc().trim().length()==0) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_jobdesc")) );
|
|
|
|
|
if (jobInfo.getJobDesc() == null || jobInfo.getJobDesc().trim().length() == 0) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobdesc")));
|
|
|
|
|
}
|
|
|
|
|
if (jobInfo.getAuthor()==null || jobInfo.getAuthor().trim().length()==0) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_author")) );
|
|
|
|
|
if (jobInfo.getAuthor() == null || jobInfo.getAuthor().trim().length() == 0) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_author")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// valid trigger
|
|
|
|
|
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
|
|
|
|
|
if (scheduleTypeEnum == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
|
|
|
|
|
if (jobInfo.getScheduleConf()==null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, "Cron"+I18nUtil.getString("system_unvalid"));
|
|
|
|
|
if (jobInfo.getScheduleConf() == null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, "Cron" + I18nUtil.getString("system_unvalid"));
|
|
|
|
|
}
|
|
|
|
|
} else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE/* || scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY*/) {
|
|
|
|
|
if (jobInfo.getScheduleConf() == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")));
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
int fixSecond = Integer.valueOf(jobInfo.getScheduleConf());
|
|
|
|
|
if (fixSecond < 1) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// valid job
|
|
|
|
|
if (GlueTypeEnum.match(jobInfo.getGlueType()) == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_gluetype")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_gluetype") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
if (GlueTypeEnum.BEAN==GlueTypeEnum.match(jobInfo.getGlueType()) && (jobInfo.getExecutorHandler()==null || jobInfo.getExecutorHandler().trim().length()==0) ) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+"JobHandler") );
|
|
|
|
|
if (GlueTypeEnum.BEAN == GlueTypeEnum.match(jobInfo.getGlueType()) && (jobInfo.getExecutorHandler() == null || jobInfo.getExecutorHandler().trim().length() == 0)) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + "JobHandler"));
|
|
|
|
|
}
|
|
|
|
|
// 》fix "\r" in shell
|
|
|
|
|
if (GlueTypeEnum.GLUE_SHELL==GlueTypeEnum.match(jobInfo.getGlueType()) && jobInfo.getGlueSource()!=null) {
|
|
|
|
|
if (GlueTypeEnum.GLUE_SHELL == GlueTypeEnum.match(jobInfo.getGlueType()) && jobInfo.getGlueSource() != null) {
|
|
|
|
|
jobInfo.setGlueSource(jobInfo.getGlueSource().replaceAll("\r", ""));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// valid advanced
|
|
|
|
|
if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 》ChildJobId valid
|
|
|
|
|
if (jobInfo.getChildJobId()!=null && jobInfo.getChildJobId().trim().length()>0) {
|
|
|
|
|
if (jobInfo.getChildJobId() != null && jobInfo.getChildJobId().trim().length() > 0) {
|
|
|
|
|
String[] childJobIds = jobInfo.getChildJobId().split(",");
|
|
|
|
|
for (String childJobIdItem: childJobIds) {
|
|
|
|
|
if (childJobIdItem!=null && childJobIdItem.trim().length()>0 && isNumeric(childJobIdItem)) {
|
|
|
|
|
for (String childJobIdItem : childJobIds) {
|
|
|
|
|
if (childJobIdItem != null && childJobIdItem.trim().length() > 0 && isNumeric(childJobIdItem)) {
|
|
|
|
|
XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
|
|
|
|
|
if (childJobInfo==null) {
|
|
|
|
|
if (childJobInfo == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE,
|
|
|
|
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_not_found")), childJobIdItem));
|
|
|
|
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_not_found")), childJobIdItem));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE,
|
|
|
|
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_unvalid")), childJobIdItem));
|
|
|
|
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_unvalid")), childJobIdItem));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// join , avoid "xxx,,"
|
|
|
|
|
String temp = "";
|
|
|
|
|
for (String item:childJobIds) {
|
|
|
|
|
for (String item : childJobIds) {
|
|
|
|
|
temp += item + ",";
|
|
|
|
|
}
|
|
|
|
|
temp = temp.substring(0, temp.length()-1);
|
|
|
|
|
temp = temp.substring(0, temp.length() - 1);
|
|
|
|
|
|
|
|
|
|
jobInfo.setChildJobId(temp);
|
|
|
|
|
}
|
|
|
|
|
@ -150,13 +151,13 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
jobInfo.setGlueUpdatetime(new Date());
|
|
|
|
|
xxlJobInfoDao.save(jobInfo);
|
|
|
|
|
if (jobInfo.getId() < 1) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_add")+I18nUtil.getString("system_fail")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_add") + I18nUtil.getString("system_fail")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new ReturnT<String>(String.valueOf(jobInfo.getId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean isNumeric(String str){
|
|
|
|
|
private boolean isNumeric(String str) {
|
|
|
|
|
try {
|
|
|
|
|
int result = Integer.valueOf(str);
|
|
|
|
|
return true;
|
|
|
|
|
@ -169,69 +170,69 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
public ReturnT<String> update(XxlJobInfo jobInfo) {
|
|
|
|
|
|
|
|
|
|
// valid base
|
|
|
|
|
if (jobInfo.getJobDesc()==null || jobInfo.getJobDesc().trim().length()==0) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_jobdesc")) );
|
|
|
|
|
if (jobInfo.getJobDesc() == null || jobInfo.getJobDesc().trim().length() == 0) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobdesc")));
|
|
|
|
|
}
|
|
|
|
|
if (jobInfo.getAuthor()==null || jobInfo.getAuthor().trim().length()==0) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_author")) );
|
|
|
|
|
if (jobInfo.getAuthor() == null || jobInfo.getAuthor().trim().length() == 0) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_author")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// valid trigger
|
|
|
|
|
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
|
|
|
|
|
if (scheduleTypeEnum == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
|
|
|
|
|
if (jobInfo.getScheduleConf()==null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, "Cron"+I18nUtil.getString("system_unvalid") );
|
|
|
|
|
if (jobInfo.getScheduleConf() == null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, "Cron" + I18nUtil.getString("system_unvalid"));
|
|
|
|
|
}
|
|
|
|
|
} else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE /*|| scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY*/) {
|
|
|
|
|
if (jobInfo.getScheduleConf() == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
int fixSecond = Integer.valueOf(jobInfo.getScheduleConf());
|
|
|
|
|
if (fixSecond < 1) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// valid advanced
|
|
|
|
|
if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 》ChildJobId valid
|
|
|
|
|
if (jobInfo.getChildJobId()!=null && jobInfo.getChildJobId().trim().length()>0) {
|
|
|
|
|
if (jobInfo.getChildJobId() != null && jobInfo.getChildJobId().trim().length() > 0) {
|
|
|
|
|
String[] childJobIds = jobInfo.getChildJobId().split(",");
|
|
|
|
|
for (String childJobIdItem: childJobIds) {
|
|
|
|
|
if (childJobIdItem!=null && childJobIdItem.trim().length()>0 && isNumeric(childJobIdItem)) {
|
|
|
|
|
for (String childJobIdItem : childJobIds) {
|
|
|
|
|
if (childJobIdItem != null && childJobIdItem.trim().length() > 0 && isNumeric(childJobIdItem)) {
|
|
|
|
|
XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
|
|
|
|
|
if (childJobInfo==null) {
|
|
|
|
|
if (childJobInfo == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE,
|
|
|
|
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_not_found")), childJobIdItem));
|
|
|
|
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_not_found")), childJobIdItem));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE,
|
|
|
|
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_unvalid")), childJobIdItem));
|
|
|
|
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_unvalid")), childJobIdItem));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// join , avoid "xxx,,"
|
|
|
|
|
String temp = "";
|
|
|
|
|
for (String item:childJobIds) {
|
|
|
|
|
for (String item : childJobIds) {
|
|
|
|
|
temp += item + ",";
|
|
|
|
|
}
|
|
|
|
|
temp = temp.substring(0, temp.length()-1);
|
|
|
|
|
temp = temp.substring(0, temp.length() - 1);
|
|
|
|
|
|
|
|
|
|
jobInfo.setChildJobId(temp);
|
|
|
|
|
}
|
|
|
|
|
@ -239,13 +240,13 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
// group valid
|
|
|
|
|
XxlJobGroup jobGroup = xxlJobGroupDao.load(jobInfo.getJobGroup());
|
|
|
|
|
if (jobGroup == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_jobgroup")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_jobgroup") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// stage job info
|
|
|
|
|
XxlJobInfo exists_jobInfo = xxlJobInfoDao.loadById(jobInfo.getId());
|
|
|
|
|
if (exists_jobInfo == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_id")+I18nUtil.getString("system_not_found")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_id") + I18nUtil.getString("system_not_found")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// next trigger time (5s后生效,避开预读周期)
|
|
|
|
|
@ -255,12 +256,12 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
try {
|
|
|
|
|
Date nextValidTime = JobScheduleHelper.generateNextValidTime(jobInfo, new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
|
|
|
|
|
if (nextValidTime == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
nextTriggerTime = nextValidTime.getTime();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error(e.getMessage(), e);
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -307,7 +308,7 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
// valid
|
|
|
|
|
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(xxlJobInfo.getScheduleType(), ScheduleTypeEnum.NONE);
|
|
|
|
|
if (ScheduleTypeEnum.NONE == scheduleTypeEnum) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type_none_limit_start")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type_none_limit_start")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// next trigger time (5s后生效,避开预读周期)
|
|
|
|
|
@ -315,12 +316,12 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
try {
|
|
|
|
|
Date nextValidTime = JobScheduleHelper.generateNextValidTime(xxlJobInfo, new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
|
|
|
|
|
if (nextValidTime == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
nextTriggerTime = nextValidTime.getTime();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error(e.getMessage(), e);
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xxlJobInfo.setTriggerStatus(1);
|
|
|
|
|
@ -361,9 +362,9 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
Set<String> executorAddressSet = new HashSet<String>();
|
|
|
|
|
List<XxlJobGroup> groupList = xxlJobGroupDao.findAll();
|
|
|
|
|
|
|
|
|
|
if (groupList!=null && !groupList.isEmpty()) {
|
|
|
|
|
for (XxlJobGroup group: groupList) {
|
|
|
|
|
if (group.getRegistryList()!=null && !group.getRegistryList().isEmpty()) {
|
|
|
|
|
if (groupList != null && !groupList.isEmpty()) {
|
|
|
|
|
for (XxlJobGroup group : groupList) {
|
|
|
|
|
if (group.getRegistryList() != null && !group.getRegistryList().isEmpty()) {
|
|
|
|
|
executorAddressSet.addAll(group.getRegistryList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -393,8 +394,8 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
|
|
|
|
|
List<XxlJobLogReport> logReportList = xxlJobLogReportDao.queryLogReport(startDate, endDate);
|
|
|
|
|
|
|
|
|
|
if (logReportList!=null && logReportList.size()>0) {
|
|
|
|
|
for (XxlJobLogReport item: logReportList) {
|
|
|
|
|
if (logReportList != null && logReportList.size() > 0) {
|
|
|
|
|
for (XxlJobLogReport item : logReportList) {
|
|
|
|
|
String day = DateUtil.formatDate(item.getTriggerDay());
|
|
|
|
|
int triggerDayCountRunning = item.getRunningCount();
|
|
|
|
|
int triggerDayCountSuc = item.getSucCount();
|
|
|
|
|
|