|
|
@@ -13,17 +13,16 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import com.fs.common.annotation.Log;
|
|
|
-import com.fs.common.constant.Constants;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.enums.BusinessType;
|
|
|
import com.fs.common.exception.job.TaskException;
|
|
|
-import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
|
import com.fs.quartz.domain.SysJob;
|
|
|
import com.fs.quartz.service.ISysJobService;
|
|
|
import com.fs.quartz.util.CronUtils;
|
|
|
+import com.fs.quartz.util.ScheduleUtils;
|
|
|
|
|
|
/**
|
|
|
* 调度任务信息操作处理
|
|
|
@@ -84,17 +83,10 @@ public class SysJobController extends BaseController
|
|
|
{
|
|
|
return error("新增任务'" + job.getJobName() + "'失败,Cron表达式不正确");
|
|
|
}
|
|
|
- else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI))
|
|
|
+ String validateMsg = ScheduleUtils.validateInvokeTarget(job.getInvokeTarget());
|
|
|
+ if (validateMsg != null)
|
|
|
{
|
|
|
- return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi://'调用");
|
|
|
- }
|
|
|
- else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_LDAP))
|
|
|
- {
|
|
|
- return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap://'调用");
|
|
|
- }
|
|
|
- else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS }))
|
|
|
- {
|
|
|
- return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)//'调用");
|
|
|
+ return error("新增任务'" + job.getJobName() + "'失败," + validateMsg);
|
|
|
}
|
|
|
job.setCreateBy(getUsername());
|
|
|
return toAjax(jobService.insertJob(job));
|
|
|
@@ -112,17 +104,10 @@ public class SysJobController extends BaseController
|
|
|
{
|
|
|
return error("修改任务'" + job.getJobName() + "'失败,Cron表达式不正确");
|
|
|
}
|
|
|
- else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI))
|
|
|
- {
|
|
|
- return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi://'调用");
|
|
|
- }
|
|
|
- else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_LDAP))
|
|
|
- {
|
|
|
- return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap://'调用");
|
|
|
- }
|
|
|
- else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS }))
|
|
|
+ String validateMsg = ScheduleUtils.validateInvokeTarget(job.getInvokeTarget());
|
|
|
+ if (validateMsg != null)
|
|
|
{
|
|
|
- return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)//'调用");
|
|
|
+ return error("修改任务'" + job.getJobName() + "'失败," + validateMsg);
|
|
|
}
|
|
|
job.setUpdateBy(getUsername());
|
|
|
return toAjax(jobService.updateJob(job));
|