|
|
@@ -2,9 +2,11 @@ package com.yingyangfly.platform.sys.job.controller;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.yingyangfly.common.dto.ResultResponse;
|
|
|
import com.yingyangfly.common.log.annotation.TraceLog;
|
|
|
+import com.yingyangfly.core.util.Constants;
|
|
|
import com.yingyangfly.platform.sys.job.domain.SysJob;
|
|
|
import com.yingyangfly.platform.sys.job.service.SysJobService;
|
|
|
import com.yingyangfly.platform.sys.job.util.CronUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
@@ -51,6 +53,12 @@ public class SysJobController {
|
|
|
public ResultResponse add(@RequestBody SysJob job) throws Exception {
|
|
|
if (!CronUtils.isValid(job.getCronExpression())) {
|
|
|
return ResultResponse.fail("新增任务'" + job.getJobName() + "'失败,Cron表达式不正确");
|
|
|
+ }else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)){
|
|
|
+ return ResultResponse.fail("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
|
|
|
+ } else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS })) {
|
|
|
+ return ResultResponse.fail("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用");
|
|
|
+ } else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })){
|
|
|
+ return ResultResponse.fail("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用");
|
|
|
}
|
|
|
return ResultResponse.success(jobService.insertJob(job));
|
|
|
}
|