|
|
@@ -21,8 +21,10 @@ import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
21
|
21
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
|
22
|
22
|
import com.ruoyi.common.log.annotation.Log;
|
|
23
|
23
|
import com.ruoyi.common.log.enums.BusinessType;
|
|
|
24
|
+import com.ruoyi.common.security.utils.SecurityUtils;
|
|
24
|
25
|
import com.ruoyi.job.domain.SysJob;
|
|
25
|
26
|
import com.ruoyi.job.service.ISysJobService;
|
|
|
27
|
+import com.ruoyi.job.util.CronUtils;
|
|
26
|
28
|
|
|
27
|
29
|
/**
|
|
28
|
30
|
* 调度任务信息操作处理
|
|
|
@@ -79,6 +81,11 @@ public class SysJobController extends BaseController
|
|
79
|
81
|
@PostMapping
|
|
80
|
82
|
public AjaxResult add(@RequestBody SysJob sysJob) throws SchedulerException, TaskException
|
|
81
|
83
|
{
|
|
|
84
|
+ if (!CronUtils.isValid(sysJob.getCronExpression()))
|
|
|
85
|
+ {
|
|
|
86
|
+ return AjaxResult.error("cron表达式不正确");
|
|
|
87
|
+ }
|
|
|
88
|
+ sysJob.setCreateBy(SecurityUtils.getUsername());
|
|
82
|
89
|
return toAjax(jobService.insertJob(sysJob));
|
|
83
|
90
|
}
|
|
84
|
91
|
|
|
|
@@ -90,6 +97,11 @@ public class SysJobController extends BaseController
|
|
90
|
97
|
@PutMapping
|
|
91
|
98
|
public AjaxResult edit(@RequestBody SysJob sysJob) throws SchedulerException, TaskException
|
|
92
|
99
|
{
|
|
|
100
|
+ if (!CronUtils.isValid(sysJob.getCronExpression()))
|
|
|
101
|
+ {
|
|
|
102
|
+ return AjaxResult.error("cron表达式不正确");
|
|
|
103
|
+ }
|
|
|
104
|
+ sysJob.setUpdateBy(SecurityUtils.getUsername());
|
|
93
|
105
|
return toAjax(jobService.updateJob(sysJob));
|
|
94
|
106
|
}
|
|
95
|
107
|
|