Browse Source

调整定时任务接口,增加一个参数,定时器ID

wangq 4 years ago
parent
commit
e346215be8

+ 5 - 2
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java

@@ -115,11 +115,13 @@ public class JobInfoController {
      * @param executorParam 任务执行参数
      * @param cron          cron
      * @param author        作者
+     * @param jobGroupId    定时任务执行器ID
      * @return
      */
     //@GetMapping("/onlyoneadd")
     @RequestMapping("/onlyoneadd")
-    public ReturnT<String> onlyOneAdd(String executeName, String executorParam, String cron, String author) {
+    public ReturnT<String> onlyOneAdd(String executeName, String executorParam, String cron, String author,
+                                      int jobGroupId) {
 //        System.err.println("executorParam==" + executorParam);
 //        System.err.println("cron==" + cron);
 //        System.err.println("executeName==" + executeName);
@@ -136,7 +138,7 @@ public class JobInfoController {
 
 
         XxlJobInfo xxlJobInfo = new XxlJobInfo();
-        xxlJobInfo.setJobGroup(2);
+        xxlJobInfo.setJobGroup(jobGroupId);
         xxlJobInfo.setJobDesc(executeName);
         xxlJobInfo.setExecutorRouteStrategy("FIRST");
         xxlJobInfo.setJobCron(cron);
@@ -148,6 +150,7 @@ public class JobInfoController {
         xxlJobInfo.setGlueRemark("创建定时任务结束");
         xxlJobInfo.setExecutorTimeout(2);
         xxlJobInfo.setExecutorFailRetryCount(3);        // 失败重试次数
+        //xxlJobInfo.setAlarmEmail();
 
         ReturnT<String> addT = xxlJobService.add(xxlJobInfo);