yumeng 3 vuotta sitten
vanhempi
commit
c88b7678e1
31 muutettua tiedostoa jossa 978 lisäystä ja 1820 poistoa
  1. 0 1
      pom.xml
  2. 7 0
      xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java
  3. 261 219
      xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java
  4. 71 34
      xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java
  5. 11 0
      xxl-job-admin/src/main/java/com/xxl/job/admin/dao/AccountDao.java
  6. 396 396
      xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
  7. 3 3
      xxl-job-admin/src/main/resources/application.properties
  8. 2 0
      xxl-job-admin/src/main/resources/i18n/message_en.properties
  9. 2 0
      xxl-job-admin/src/main/resources/i18n/message_zh_CN.properties
  10. 2 0
      xxl-job-admin/src/main/resources/i18n/message_zh_TC.properties
  11. 11 0
      xxl-job-admin/src/main/resources/mybatis-mapper/AccountMapper.xml
  12. 162 146
      xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml
  13. 2 1
      xxl-job-admin/src/main/resources/static/js/jobinfo.index.1.js
  14. 48 0
      xxl-job-admin/src/main/resources/templates/jobinfo/jobinfo.index.ftl
  15. 0 18
      xxl-job-executor-samples/pom.xml
  16. 0 45
      xxl-job-executor-samples/xxl-job-executor-sample-frameless/pom.xml
  17. 0 38
      xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/java/com/xxl/job/executor/sample/frameless/FramelessApplication.java
  18. 0 93
      xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/java/com/xxl/job/executor/sample/frameless/config/FrameLessXxlJobConfig.java
  19. 0 251
      xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/java/com/xxl/job/executor/sample/frameless/jobhandler/SampleXxlJob.java
  20. 0 27
      xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/resources/log4j.xml
  21. 0 17
      xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/resources/xxl-job-executor.properties
  22. 0 12
      xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/test/java/com/xxl/job/executor/sample/frameless/test/FramelessApplicationTest.java
  23. 0 11
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/Dockerfile
  24. 0 74
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/pom.xml
  25. 0 16
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/XxlJobExecutorApplication.java
  26. 0 78
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java
  27. 0 18
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/mvc/controller/IndexController.java
  28. 0 253
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/SampleXxlJob.java
  29. 0 26
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties
  30. 0 29
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/logback.xml
  31. 0 14
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/test/java/com/xxl/job/executor/test/XxlJobExecutorExampleBootApplicationTests.java

+ 0 - 1
pom.xml

@@ -13,7 +13,6 @@
 	<modules>
 		<module>xxl-job-core</module>
 		<module>xxl-job-admin</module>
-		<module>xxl-job-executor-samples</module>
     </modules>
 
 	<properties>

+ 7 - 0
xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java

@@ -23,6 +23,7 @@ import java.util.Arrays;
 public class XxlJobAdminConfig implements InitializingBean, DisposableBean {
 
     private static XxlJobAdminConfig adminConfig = null;
+
     public static XxlJobAdminConfig getAdminConfig() {
         return adminConfig;
     }
@@ -85,6 +86,8 @@ public class XxlJobAdminConfig implements InitializingBean, DisposableBean {
     private DataSource dataSource;
     @Resource
     private JobAlarmer jobAlarmer;
+    @Resource
+    private AccountDao accountDao;
 
 
     public String getI18n() {
@@ -131,6 +134,10 @@ public class XxlJobAdminConfig implements InitializingBean, DisposableBean {
         return xxlJobInfoDao;
     }
 
+    public AccountDao getAccountDaoDao() {
+        return accountDao;
+    }
+
     public XxlJobRegistryDao getXxlJobRegistryDao() {
         return xxlJobRegistryDao;
     }

+ 261 - 219
xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java

@@ -8,230 +8,272 @@ import java.util.Date;
  * @author xuxueli  2016-1-12 18:25:49
  */
 public class XxlJobInfo {
-	
-	private int id;				// 主键ID
-	
-	private int jobGroup;		// 执行器主键ID
-	private String jobDesc;
-	
-	private Date addTime;
-	private Date updateTime;
-	
-	private String author;		// 负责人
-	private String alarmEmail;	// 报警邮件
-
-	private String scheduleType;			// 调度类型
-	private String scheduleConf;			// 调度配置,值含义取决于调度类型
-	private String misfireStrategy;			// 调度过期策略
-
-	private String executorRouteStrategy;	// 执行器路由策略
-	private String executorHandler;		    // 执行器,任务Handler名称
-	private String executorParam;		    // 执行器,任务参数
-	private String executorBlockStrategy;	// 阻塞处理策略
-	private int executorTimeout;     		// 任务执行超时时间,单位秒
-	private int executorFailRetryCount;		// 失败重试次数
-	
-	private String glueType;		// GLUE类型	#com.xxl.job.core.glue.GlueTypeEnum
-	private String glueSource;		// GLUE源代码
-	private String glueRemark;		// GLUE备注
-	private Date glueUpdatetime;	// GLUE更新时间
-
-	private String childJobId;		// 子任务ID,多个逗号分隔
-
-	private int triggerStatus;		// 调度状态:0-停止,1-运行
-	private long triggerLastTime;	// 上次调度时间
-	private long triggerNextTime;	// 下次调度时间
-
-
-	public int getId() {
-		return id;
-	}
-
-	public void setId(int id) {
-		this.id = id;
-	}
-
-	public int getJobGroup() {
-		return jobGroup;
-	}
-
-	public void setJobGroup(int jobGroup) {
-		this.jobGroup = jobGroup;
-	}
-
-	public String getJobDesc() {
-		return jobDesc;
-	}
-
-	public void setJobDesc(String jobDesc) {
-		this.jobDesc = jobDesc;
-	}
-
-	public Date getAddTime() {
-		return addTime;
-	}
-
-	public void setAddTime(Date addTime) {
-		this.addTime = addTime;
-	}
-
-	public Date getUpdateTime() {
-		return updateTime;
-	}
-
-	public void setUpdateTime(Date updateTime) {
-		this.updateTime = updateTime;
-	}
-
-	public String getAuthor() {
-		return author;
-	}
-
-	public void setAuthor(String author) {
-		this.author = author;
-	}
-
-	public String getAlarmEmail() {
-		return alarmEmail;
-	}
-
-	public void setAlarmEmail(String alarmEmail) {
-		this.alarmEmail = alarmEmail;
-	}
-
-	public String getScheduleType() {
-		return scheduleType;
-	}
-
-	public void setScheduleType(String scheduleType) {
-		this.scheduleType = scheduleType;
-	}
-
-	public String getScheduleConf() {
-		return scheduleConf;
-	}
-
-	public void setScheduleConf(String scheduleConf) {
-		this.scheduleConf = scheduleConf;
-	}
-
-	public String getMisfireStrategy() {
-		return misfireStrategy;
-	}
 
-	public void setMisfireStrategy(String misfireStrategy) {
-		this.misfireStrategy = misfireStrategy;
-	}
+    private int id;                // 主键ID
+    private int jobGroup;        // 执行器主键ID
+    private String jobDesc;
+    private Date addTime;
+    private Date updateTime;
+    private String author;        // 负责人
+    private String alarmEmail;    // 报警邮件
+    private String scheduleType;            // 调度类型
+    private String scheduleConf;            // 调度配置,值含义取决于调度类型
+    private String misfireStrategy;            // 调度过期策略
+    private String executorRouteStrategy;    // 执行器路由策略
+    private String executorHandler;            // 执行器,任务Handler名称
+    private String executorParam;            // 执行器,任务参数
+    private String executorBlockStrategy;    // 阻塞处理策略
+    private int executorTimeout;            // 任务执行超时时间,单位秒
+    private int executorFailRetryCount;        // 失败重试次数
+    private String glueType;        // GLUE类型	#com.xxl.job.core.glue.GlueTypeEnum
+    private String glueSource;        // GLUE源代码
+    private String glueRemark;        // GLUE备注
+    private Date glueUpdatetime;    // GLUE更新时间
+    private String childJobId;        // 子任务ID,多个逗号分隔
+    private int triggerStatus;        // 调度状态:0-停止,1-运行
+    private long triggerLastTime;    // 上次调度时间
+    private long triggerNextTime;    // 下次调度时间
+    private String mediaId;    // 下次调度时间
+    private String subAccount;    // 下次调度时间
+
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public int getJobGroup() {
+        return jobGroup;
+    }
+
+    public void setJobGroup(int jobGroup) {
+        this.jobGroup = jobGroup;
+    }
+
+    public String getJobDesc() {
+        return jobDesc;
+    }
+
+    public void setJobDesc(String jobDesc) {
+        this.jobDesc = jobDesc;
+    }
+
+    public Date getAddTime() {
+        return addTime;
+    }
+
+    public void setAddTime(Date addTime) {
+        this.addTime = addTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public String getAuthor() {
+        return author;
+    }
+
+    public void setAuthor(String author) {
+        this.author = author;
+    }
+
+    public String getAlarmEmail() {
+        return alarmEmail;
+    }
+
+    public void setAlarmEmail(String alarmEmail) {
+        this.alarmEmail = alarmEmail;
+    }
+
+    public String getScheduleType() {
+        return scheduleType;
+    }
+
+    public void setScheduleType(String scheduleType) {
+        this.scheduleType = scheduleType;
+    }
+
+    public String getScheduleConf() {
+        return scheduleConf;
+    }
+
+    public void setScheduleConf(String scheduleConf) {
+        this.scheduleConf = scheduleConf;
+    }
+
+    public String getMisfireStrategy() {
+        return misfireStrategy;
+    }
+
+    public void setMisfireStrategy(String misfireStrategy) {
+        this.misfireStrategy = misfireStrategy;
+    }
+
+    public String getExecutorRouteStrategy() {
+        return executorRouteStrategy;
+    }
+
+    public void setExecutorRouteStrategy(String executorRouteStrategy) {
+        this.executorRouteStrategy = executorRouteStrategy;
+    }
+
+    public String getExecutorHandler() {
+        return executorHandler;
+    }
 
-	public String getExecutorRouteStrategy() {
-		return executorRouteStrategy;
-	}
+    public void setExecutorHandler(String executorHandler) {
+        this.executorHandler = executorHandler;
+    }
 
-	public void setExecutorRouteStrategy(String executorRouteStrategy) {
-		this.executorRouteStrategy = executorRouteStrategy;
-	}
+    public String getExecutorParam() {
+        return executorParam;
+    }
 
-	public String getExecutorHandler() {
-		return executorHandler;
-	}
+    public void setExecutorParam(String executorParam) {
+        this.executorParam = executorParam;
+    }
 
-	public void setExecutorHandler(String executorHandler) {
-		this.executorHandler = executorHandler;
-	}
+    public String getExecutorBlockStrategy() {
+        return executorBlockStrategy;
+    }
 
-	public String getExecutorParam() {
-		return executorParam;
-	}
+    public void setExecutorBlockStrategy(String executorBlockStrategy) {
+        this.executorBlockStrategy = executorBlockStrategy;
+    }
 
-	public void setExecutorParam(String executorParam) {
-		this.executorParam = executorParam;
-	}
-
-	public String getExecutorBlockStrategy() {
-		return executorBlockStrategy;
-	}
-
-	public void setExecutorBlockStrategy(String executorBlockStrategy) {
-		this.executorBlockStrategy = executorBlockStrategy;
-	}
-
-	public int getExecutorTimeout() {
-		return executorTimeout;
-	}
-
-	public void setExecutorTimeout(int executorTimeout) {
-		this.executorTimeout = executorTimeout;
-	}
-
-	public int getExecutorFailRetryCount() {
-		return executorFailRetryCount;
-	}
-
-	public void setExecutorFailRetryCount(int executorFailRetryCount) {
-		this.executorFailRetryCount = executorFailRetryCount;
-	}
-
-	public String getGlueType() {
-		return glueType;
-	}
-
-	public void setGlueType(String glueType) {
-		this.glueType = glueType;
-	}
-
-	public String getGlueSource() {
-		return glueSource;
-	}
-
-	public void setGlueSource(String glueSource) {
-		this.glueSource = glueSource;
-	}
-
-	public String getGlueRemark() {
-		return glueRemark;
-	}
-
-	public void setGlueRemark(String glueRemark) {
-		this.glueRemark = glueRemark;
-	}
-
-	public Date getGlueUpdatetime() {
-		return glueUpdatetime;
-	}
-
-	public void setGlueUpdatetime(Date glueUpdatetime) {
-		this.glueUpdatetime = glueUpdatetime;
-	}
-
-	public String getChildJobId() {
-		return childJobId;
-	}
-
-	public void setChildJobId(String childJobId) {
-		this.childJobId = childJobId;
-	}
-
-	public int getTriggerStatus() {
-		return triggerStatus;
-	}
-
-	public void setTriggerStatus(int triggerStatus) {
-		this.triggerStatus = triggerStatus;
-	}
-
-	public long getTriggerLastTime() {
-		return triggerLastTime;
-	}
-
-	public void setTriggerLastTime(long triggerLastTime) {
-		this.triggerLastTime = triggerLastTime;
-	}
-
-	public long getTriggerNextTime() {
-		return triggerNextTime;
-	}
-
-	public void setTriggerNextTime(long triggerNextTime) {
-		this.triggerNextTime = triggerNextTime;
-	}
+    public int getExecutorTimeout() {
+        return executorTimeout;
+    }
+
+    public void setExecutorTimeout(int executorTimeout) {
+        this.executorTimeout = executorTimeout;
+    }
+
+    public int getExecutorFailRetryCount() {
+        return executorFailRetryCount;
+    }
+
+    public void setExecutorFailRetryCount(int executorFailRetryCount) {
+        this.executorFailRetryCount = executorFailRetryCount;
+    }
+
+    public String getGlueType() {
+        return glueType;
+    }
+
+    public void setGlueType(String glueType) {
+        this.glueType = glueType;
+    }
+
+    public String getGlueSource() {
+        return glueSource;
+    }
+
+    public void setGlueSource(String glueSource) {
+        this.glueSource = glueSource;
+    }
+
+    public String getGlueRemark() {
+        return glueRemark;
+    }
+
+    public void setGlueRemark(String glueRemark) {
+        this.glueRemark = glueRemark;
+    }
+
+    public Date getGlueUpdatetime() {
+        return glueUpdatetime;
+    }
+
+    public void setGlueUpdatetime(Date glueUpdatetime) {
+        this.glueUpdatetime = glueUpdatetime;
+    }
+
+    public String getChildJobId() {
+        return childJobId;
+    }
+
+    public void setChildJobId(String childJobId) {
+        this.childJobId = childJobId;
+    }
+
+    public int getTriggerStatus() {
+        return triggerStatus;
+    }
+
+    public void setTriggerStatus(int triggerStatus) {
+        this.triggerStatus = triggerStatus;
+    }
+
+    public long getTriggerLastTime() {
+        return triggerLastTime;
+    }
+
+    public void setTriggerLastTime(long triggerLastTime) {
+        this.triggerLastTime = triggerLastTime;
+    }
+
+    public long getTriggerNextTime() {
+        return triggerNextTime;
+    }
+
+    public void setTriggerNextTime(long triggerNextTime) {
+        this.triggerNextTime = triggerNextTime;
+    }
+
+    public String getMediaId() {
+        return mediaId;
+    }
+
+    public void setMediaId(String mediaId) {
+        this.mediaId = mediaId;
+    }
+
+    public String getSubAccount() {
+        return subAccount;
+    }
+
+    public void setSubAccount(String subAccount) {
+        this.subAccount = subAccount;
+    }
+
+    @Override
+    public String toString() {
+        return "XxlJobInfo{" +
+                "id=" + id +
+                ", jobGroup=" + jobGroup +
+                ", jobDesc='" + jobDesc + '\'' +
+                ", addTime=" + addTime +
+                ", updateTime=" + updateTime +
+                ", author='" + author + '\'' +
+                ", alarmEmail='" + alarmEmail + '\'' +
+                ", scheduleType='" + scheduleType + '\'' +
+                ", scheduleConf='" + scheduleConf + '\'' +
+                ", misfireStrategy='" + misfireStrategy + '\'' +
+                ", executorRouteStrategy='" + executorRouteStrategy + '\'' +
+                ", executorHandler='" + executorHandler + '\'' +
+                ", executorParam='" + executorParam + '\'' +
+                ", executorBlockStrategy='" + executorBlockStrategy + '\'' +
+                ", executorTimeout=" + executorTimeout +
+                ", executorFailRetryCount=" + executorFailRetryCount +
+                ", glueType='" + glueType + '\'' +
+                ", glueSource='" + glueSource + '\'' +
+                ", glueRemark='" + glueRemark + '\'' +
+                ", glueUpdatetime=" + glueUpdatetime +
+                ", childJobId='" + childJobId + '\'' +
+                ", triggerStatus=" + triggerStatus +
+                ", triggerLastTime=" + triggerLastTime +
+                ", triggerNextTime=" + triggerNextTime +
+                ", mediaId='" + mediaId + '\'' +
+                ", subAccount='" + subAccount + '\'' +
+                '}';
+    }
 }

+ 71 - 34
xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java

@@ -7,6 +7,7 @@ import com.xxl.job.admin.core.model.XxlJobLog;
 import com.xxl.job.admin.core.route.ExecutorRouteStrategyEnum;
 import com.xxl.job.admin.core.scheduler.XxlJobScheduler;
 import com.xxl.job.admin.core.util.I18nUtil;
+import com.xxl.job.admin.dao.AccountDao;
 import com.xxl.job.core.biz.ExecutorBiz;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.biz.model.TriggerParam;
@@ -15,8 +16,11 @@ import com.xxl.job.core.util.IpUtil;
 import com.xxl.job.core.util.ThrowableUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 /**
  * xxl-job trigger
@@ -24,22 +28,21 @@ import java.util.Date;
  */
 public class XxlJobTrigger {
     private static Logger logger = LoggerFactory.getLogger(XxlJobTrigger.class);
+    @Autowired
+    private AccountDao accountMapper;
 
     /**
      * trigger job
      *
      * @param jobId
      * @param triggerType
-     * @param failRetryCount
-     * 			>=0: use this param
-     * 			<0: use param from job info config
+     * @param failRetryCount        >=0: use this param
+     *                              <0: use param from job info config
      * @param executorShardingParam
-     * @param executorParam
-     *          null: use job param
-     *          not null: cover job param
-     * @param addressList
-     *          null: use executor addressList
-     *          not null: cover
+     * @param executorParam         null: use job param
+     *                              not null: cover job param
+     * @param addressList           null: use executor addressList
+     *                              not null: cover
      */
     public static void trigger(int jobId,
                                TriggerTypeEnum triggerType,
@@ -54,44 +57,77 @@ public class XxlJobTrigger {
             logger.warn(">>>>>>>>>>>> trigger fail, jobId invalid,jobId={}", jobId);
             return;
         }
-        if (executorParam != null) {
-            jobInfo.setExecutorParam(executorParam);
+
+        String subAccount = jobInfo.getSubAccount();
+        List<String> accountList = new ArrayList<>();
+        if (subAccount.equals("1")) {
+            accountList = XxlJobAdminConfig.getAdminConfig().getAccountDaoDao().getAccountList(Integer.valueOf(jobInfo.getMediaId()));
         }
-        int finalFailRetryCount = failRetryCount>=0?failRetryCount:jobInfo.getExecutorFailRetryCount();
+
+
+        int finalFailRetryCount = failRetryCount >= 0 ? failRetryCount : jobInfo.getExecutorFailRetryCount();
         XxlJobGroup group = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().load(jobInfo.getJobGroup());
 
         // cover addressList
-        if (addressList!=null && addressList.trim().length()>0) {
+        if (addressList != null && addressList.trim().length() > 0) {
             group.setAddressType(1);
             group.setAddressList(addressList.trim());
         }
 
         // sharding param
         int[] shardingParam = null;
-        if (executorShardingParam!=null){
+        if (executorShardingParam != null) {
             String[] shardingArr = executorShardingParam.split("/");
-            if (shardingArr.length==2 && isNumeric(shardingArr[0]) && isNumeric(shardingArr[1])) {
+            if (shardingArr.length == 2 && isNumeric(shardingArr[0]) && isNumeric(shardingArr[1])) {
                 shardingParam = new int[2];
                 shardingParam[0] = Integer.valueOf(shardingArr[0]);
                 shardingParam[1] = Integer.valueOf(shardingArr[1]);
             }
         }
-        if (ExecutorRouteStrategyEnum.SHARDING_BROADCAST==ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null)
-                && group.getRegistryList()!=null && !group.getRegistryList().isEmpty()
-                && shardingParam==null) {
-            for (int i = 0; i < group.getRegistryList().size(); i++) {
-                processTrigger(group, jobInfo, finalFailRetryCount, triggerType, i, group.getRegistryList().size());
+        if (ExecutorRouteStrategyEnum.SHARDING_BROADCAST == ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null)
+                && group.getRegistryList() != null && !group.getRegistryList().isEmpty()
+                && shardingParam == null) {
+
+            if (executorParam != null && executorParam != "") {
+                jobInfo.setExecutorParam(executorParam);
+                for (int i = 0; i < group.getRegistryList().size(); i++) {
+                    processTrigger(group, jobInfo, finalFailRetryCount, triggerType, i, group.getRegistryList().size());
+                }
+            } else {
+                if (subAccount.equals("1")) {
+                    for (int i = 0; i < accountList.size(); i++) {
+                        jobInfo.setExecutorParam(accountList.get(i));
+                        for (int j = 0; i < group.getRegistryList().size(); j++) {
+                            processTrigger(group, jobInfo, finalFailRetryCount, triggerType, j, group.getRegistryList().size());
+                        }
+                    }
+                } else {
+                    for (int i = 0; i < group.getRegistryList().size(); i++) {
+                        processTrigger(group, jobInfo, finalFailRetryCount, triggerType, i, group.getRegistryList().size());
+                    }
+                }
             }
         } else {
             if (shardingParam == null) {
                 shardingParam = new int[]{0, 1};
             }
-            processTrigger(group, jobInfo, finalFailRetryCount, triggerType, shardingParam[0], shardingParam[1]);
+            if (executorParam != null && executorParam != "") {
+                jobInfo.setExecutorParam(executorParam);
+                processTrigger(group, jobInfo, finalFailRetryCount, triggerType, shardingParam[0], shardingParam[1]);
+            } else {
+                if (subAccount.equals("1")) {
+                    for (int i = 0; i < accountList.size(); i++) {
+                        jobInfo.setExecutorParam(accountList.get(i));
+                        processTrigger(group, jobInfo, finalFailRetryCount, triggerType, shardingParam[0], shardingParam[1]);
+                    }
+                } else {
+                    processTrigger(group, jobInfo, finalFailRetryCount, triggerType, shardingParam[0], shardingParam[1]);
+                }
+            }
         }
-
     }
 
-    private static boolean isNumeric(String str){
+    private static boolean isNumeric(String str) {
         try {
             int result = Integer.valueOf(str);
             return true;
@@ -101,19 +137,19 @@ public class XxlJobTrigger {
     }
 
     /**
-     * @param group                     job group, registry list may be empty
+     * @param group               job group, registry list may be empty
      * @param jobInfo
      * @param finalFailRetryCount
      * @param triggerType
-     * @param index                     sharding index
-     * @param total                     sharding index
+     * @param index               sharding index
+     * @param total               sharding index
      */
-    private static void processTrigger(XxlJobGroup group, XxlJobInfo jobInfo, int finalFailRetryCount, TriggerTypeEnum triggerType, int index, int total){
+    private static void processTrigger(XxlJobGroup group, XxlJobInfo jobInfo, int finalFailRetryCount, TriggerTypeEnum triggerType, int index, int total) {
 
         // param
         ExecutorBlockStrategyEnum blockStrategy = ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), ExecutorBlockStrategyEnum.SERIAL_EXECUTION);  // block strategy
         ExecutorRouteStrategyEnum executorRouteStrategyEnum = ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null);    // route strategy
-        String shardingParam = (ExecutorRouteStrategyEnum.SHARDING_BROADCAST==executorRouteStrategyEnum)?String.valueOf(index).concat("/").concat(String.valueOf(total)):null;
+        String shardingParam = (ExecutorRouteStrategyEnum.SHARDING_BROADCAST == executorRouteStrategyEnum) ? String.valueOf(index).concat("/").concat(String.valueOf(total)) : null;
 
         // 1、save log-id
         XxlJobLog jobLog = new XxlJobLog();
@@ -141,7 +177,7 @@ public class XxlJobTrigger {
         // 3、init address
         String address = null;
         ReturnT<String> routeAddressResult = null;
-        if (group.getRegistryList()!=null && !group.getRegistryList().isEmpty()) {
+        if (group.getRegistryList() != null && !group.getRegistryList().isEmpty()) {
             if (ExecutorRouteStrategyEnum.SHARDING_BROADCAST == executorRouteStrategyEnum) {
                 if (index < group.getRegistryList().size()) {
                     address = group.getRegistryList().get(index);
@@ -171,18 +207,18 @@ public class XxlJobTrigger {
         triggerMsgSb.append(I18nUtil.getString("jobconf_trigger_type")).append(":").append(triggerType.getTitle());
         triggerMsgSb.append("<br>").append(I18nUtil.getString("jobconf_trigger_admin_adress")).append(":").append(IpUtil.getIp());
         triggerMsgSb.append("<br>").append(I18nUtil.getString("jobconf_trigger_exe_regtype")).append(":")
-                .append( (group.getAddressType() == 0)?I18nUtil.getString("jobgroup_field_addressType_0"):I18nUtil.getString("jobgroup_field_addressType_1") );
+                .append((group.getAddressType() == 0) ? I18nUtil.getString("jobgroup_field_addressType_0") : I18nUtil.getString("jobgroup_field_addressType_1"));
         triggerMsgSb.append("<br>").append(I18nUtil.getString("jobconf_trigger_exe_regaddress")).append(":").append(group.getRegistryList());
         triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorRouteStrategy")).append(":").append(executorRouteStrategyEnum.getTitle());
         if (shardingParam != null) {
-            triggerMsgSb.append("("+shardingParam+")");
+            triggerMsgSb.append("(" + shardingParam + ")");
         }
         triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorBlockStrategy")).append(":").append(blockStrategy.getTitle());
         triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_timeout")).append(":").append(jobInfo.getExecutorTimeout());
         triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorFailRetryCount")).append(":").append(finalFailRetryCount);
 
-        triggerMsgSb.append("<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_run") +"<<<<<<<<<<< </span><br>")
-                .append((routeAddressResult!=null&&routeAddressResult.getMsg()!=null)?routeAddressResult.getMsg()+"<br><br>":"").append(triggerResult.getMsg()!=null?triggerResult.getMsg():"");
+        triggerMsgSb.append("<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>" + I18nUtil.getString("jobconf_trigger_run") + "<<<<<<<<<<< </span><br>")
+                .append((routeAddressResult != null && routeAddressResult.getMsg() != null) ? routeAddressResult.getMsg() + "<br><br>" : "").append(triggerResult.getMsg() != null ? triggerResult.getMsg() : "");
 
         // 6、save log trigger-info
         jobLog.setExecutorAddress(address);
@@ -200,11 +236,12 @@ public class XxlJobTrigger {
 
     /**
      * run executor
+     *
      * @param triggerParam
      * @param address
      * @return
      */
-    public static ReturnT<String> runExecutor(TriggerParam triggerParam, String address){
+    public static ReturnT<String> runExecutor(TriggerParam triggerParam, String address) {
         ReturnT<String> runResult = null;
         try {
             ExecutorBiz executorBiz = XxlJobScheduler.getExecutorBiz(address);

+ 11 - 0
xxl-job-admin/src/main/java/com/xxl/job/admin/dao/AccountDao.java

@@ -0,0 +1,11 @@
+package com.xxl.job.admin.dao;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface AccountDao {
+    List<String> getAccountList(@Param("mediaId") Integer valueOf);
+}

+ 396 - 396
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java

@@ -25,410 +25,410 @@ import java.util.*;
 
 /**
  * core job action for xxl-job
+ *
  * @author xuxueli 2016-5-28 15:30:33
  */
 @Service
 public class XxlJobServiceImpl implements XxlJobService {
-	private static Logger logger = LoggerFactory.getLogger(XxlJobServiceImpl.class);
-
-	@Resource
-	private XxlJobGroupDao xxlJobGroupDao;
-	@Resource
-	private XxlJobInfoDao xxlJobInfoDao;
-	@Resource
-	public XxlJobLogDao xxlJobLogDao;
-	@Resource
-	private XxlJobLogGlueDao xxlJobLogGlueDao;
-	@Resource
-	private XxlJobLogReportDao xxlJobLogReportDao;
-	
-	@Override
-	public Map<String, Object> pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author) {
-
-		// page list
-		List<XxlJobInfo> list = xxlJobInfoDao.pageList(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
-		int list_count = xxlJobInfoDao.pageListCount(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
-		
-		// package result
-		Map<String, Object> maps = new HashMap<String, Object>();
-	    maps.put("recordsTotal", list_count);		// 总记录数
-	    maps.put("recordsFiltered", list_count);	// 过滤后的总记录数
-	    maps.put("data", list);  					// 分页列表
-		return maps;
-	}
-
-	@Override
-	public ReturnT<String> add(XxlJobInfo jobInfo) {
-
-		// 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")) );
-		}
-		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")) );
-		}
-
-		// 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")) );
-		}
-		if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
-			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")) );
-			}
-			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")) );
-				}
-			} catch (Exception e) {
-				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")) );
-		}
-		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) {
-			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")) );
-		}
-		if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
-			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")) );
-		}
-
-		// 》ChildJobId valid
-		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)) {
-					XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
-					if (childJobInfo==null) {
-						return new ReturnT<String>(ReturnT.FAIL_CODE,
-								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));
-				}
-			}
-
-			// join , avoid "xxx,,"
-			String temp = "";
-			for (String item:childJobIds) {
-				temp += item + ",";
-			}
-			temp = temp.substring(0, temp.length()-1);
-
-			jobInfo.setChildJobId(temp);
-		}
-
-		// add in db
-		jobInfo.setAddTime(new Date());
-		jobInfo.setUpdateTime(new Date());
-		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>(String.valueOf(jobInfo.getId()));
-	}
-
-	private boolean isNumeric(String str){
-		try {
-			int result = Integer.valueOf(str);
-			return true;
-		} catch (NumberFormatException e) {
-			return false;
-		}
-	}
-
-	@Override
-	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.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")) );
-		}
-		if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
-			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")) );
-			}
-			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")) );
-				}
-			} catch (Exception e) {
-				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")) );
-		}
-		if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
-			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")) );
-		}
-
-		// 》ChildJobId valid
-		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)) {
-					XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
-					if (childJobInfo==null) {
-						return new ReturnT<String>(ReturnT.FAIL_CODE,
-								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));
-				}
-			}
-
-			// join , avoid "xxx,,"
-			String temp = "";
-			for (String item:childJobIds) {
-				temp += item + ",";
-			}
-			temp = temp.substring(0, temp.length()-1);
-
-			jobInfo.setChildJobId(temp);
-		}
-
-		// 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")) );
-		}
-
-		// 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")) );
-		}
-
-		// next trigger time (5s后生效,避开预读周期)
-		long nextTriggerTime = exists_jobInfo.getTriggerNextTime();
-		boolean scheduleDataNotChanged = jobInfo.getScheduleType().equals(exists_jobInfo.getScheduleType()) && jobInfo.getScheduleConf().equals(exists_jobInfo.getScheduleConf());
-		if (exists_jobInfo.getTriggerStatus() == 1 && !scheduleDataNotChanged) {
-			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")) );
-				}
-				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")) );
-			}
-		}
-
-		exists_jobInfo.setJobGroup(jobInfo.getJobGroup());
-		exists_jobInfo.setJobDesc(jobInfo.getJobDesc());
-		exists_jobInfo.setAuthor(jobInfo.getAuthor());
-		exists_jobInfo.setAlarmEmail(jobInfo.getAlarmEmail());
-		exists_jobInfo.setScheduleType(jobInfo.getScheduleType());
-		exists_jobInfo.setScheduleConf(jobInfo.getScheduleConf());
-		exists_jobInfo.setMisfireStrategy(jobInfo.getMisfireStrategy());
-		exists_jobInfo.setExecutorRouteStrategy(jobInfo.getExecutorRouteStrategy());
-		exists_jobInfo.setExecutorHandler(jobInfo.getExecutorHandler());
-		exists_jobInfo.setExecutorParam(jobInfo.getExecutorParam());
-		exists_jobInfo.setExecutorBlockStrategy(jobInfo.getExecutorBlockStrategy());
-		exists_jobInfo.setExecutorTimeout(jobInfo.getExecutorTimeout());
-		exists_jobInfo.setExecutorFailRetryCount(jobInfo.getExecutorFailRetryCount());
-		exists_jobInfo.setChildJobId(jobInfo.getChildJobId());
-		exists_jobInfo.setTriggerNextTime(nextTriggerTime);
-
-		exists_jobInfo.setUpdateTime(new Date());
+    private static Logger logger = LoggerFactory.getLogger(XxlJobServiceImpl.class);
+
+    @Resource
+    private XxlJobGroupDao xxlJobGroupDao;
+    @Resource
+    private XxlJobInfoDao xxlJobInfoDao;
+    @Resource
+    public XxlJobLogDao xxlJobLogDao;
+    @Resource
+    private XxlJobLogGlueDao xxlJobLogGlueDao;
+    @Resource
+    private XxlJobLogReportDao xxlJobLogReportDao;
+
+    @Override
+    public Map<String, Object> pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author) {
+
+        // page list
+        List<XxlJobInfo> list = xxlJobInfoDao.pageList(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
+        int list_count = xxlJobInfoDao.pageListCount(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
+
+        // package result
+        Map<String, Object> maps = new HashMap<String, Object>();
+        maps.put("recordsTotal", list_count);        // 总记录数
+        maps.put("recordsFiltered", list_count);    // 过滤后的总记录数
+        maps.put("data", list);                    // 分页列表
+        return maps;
+    }
+
+    @Override
+    public ReturnT<String> add(XxlJobInfo jobInfo) {
+
+        // 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")));
+        }
+        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")));
+        }
+
+        // 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")));
+        }
+        if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
+            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")));
+            }
+            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")));
+                }
+            } catch (Exception e) {
+                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")));
+        }
+        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) {
+            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")));
+        }
+        if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
+            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")));
+        }
+
+        // 》ChildJobId valid
+        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)) {
+                    XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
+                    if (childJobInfo == null) {
+                        return new ReturnT<String>(ReturnT.FAIL_CODE,
+                                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));
+                }
+            }
+
+            // join , avoid "xxx,,"
+            String temp = "";
+            for (String item : childJobIds) {
+                temp += item + ",";
+            }
+            temp = temp.substring(0, temp.length() - 1);
+
+            jobInfo.setChildJobId(temp);
+        }
+
+        // add in db
+        jobInfo.setAddTime(new Date());
+        jobInfo.setUpdateTime(new Date());
+        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>(String.valueOf(jobInfo.getId()));
+    }
+
+    private boolean isNumeric(String str) {
+        try {
+            int result = Integer.valueOf(str);
+            return true;
+        } catch (NumberFormatException e) {
+            return false;
+        }
+    }
+
+    @Override
+    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.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")));
+        }
+        if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
+            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")));
+            }
+            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")));
+                }
+            } catch (Exception e) {
+                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")));
+        }
+        if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
+            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")));
+        }
+
+        // 》ChildJobId valid
+        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)) {
+                    XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
+                    if (childJobInfo == null) {
+                        return new ReturnT<String>(ReturnT.FAIL_CODE,
+                                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));
+                }
+            }
+
+            // join , avoid "xxx,,"
+            String temp = "";
+            for (String item : childJobIds) {
+                temp += item + ",";
+            }
+            temp = temp.substring(0, temp.length() - 1);
+
+            jobInfo.setChildJobId(temp);
+        }
+
+        // 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")));
+        }
+
+        // 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")));
+        }
+
+        // next trigger time (5s后生效,避开预读周期)
+        long nextTriggerTime = exists_jobInfo.getTriggerNextTime();
+        boolean scheduleDataNotChanged = jobInfo.getScheduleType().equals(exists_jobInfo.getScheduleType()) && jobInfo.getScheduleConf().equals(exists_jobInfo.getScheduleConf());
+        if (exists_jobInfo.getTriggerStatus() == 1 && !scheduleDataNotChanged) {
+            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")));
+                }
+                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")));
+            }
+        }
+
+        exists_jobInfo.setJobGroup(jobInfo.getJobGroup());
+        exists_jobInfo.setJobDesc(jobInfo.getJobDesc());
+        exists_jobInfo.setAuthor(jobInfo.getAuthor());
+        exists_jobInfo.setAlarmEmail(jobInfo.getAlarmEmail());
+        exists_jobInfo.setScheduleType(jobInfo.getScheduleType());
+        exists_jobInfo.setScheduleConf(jobInfo.getScheduleConf());
+        exists_jobInfo.setMisfireStrategy(jobInfo.getMisfireStrategy());
+        exists_jobInfo.setExecutorRouteStrategy(jobInfo.getExecutorRouteStrategy());
+        exists_jobInfo.setExecutorHandler(jobInfo.getExecutorHandler());
+        exists_jobInfo.setExecutorParam(jobInfo.getExecutorParam());
+        exists_jobInfo.setExecutorBlockStrategy(jobInfo.getExecutorBlockStrategy());
+        exists_jobInfo.setExecutorTimeout(jobInfo.getExecutorTimeout());
+        exists_jobInfo.setExecutorFailRetryCount(jobInfo.getExecutorFailRetryCount());
+        exists_jobInfo.setChildJobId(jobInfo.getChildJobId());
+        exists_jobInfo.setTriggerNextTime(nextTriggerTime);
+        exists_jobInfo.setMediaId(jobInfo.getMediaId());
+        exists_jobInfo.setSubAccount(jobInfo.getSubAccount());
+        exists_jobInfo.setUpdateTime(new Date());
         xxlJobInfoDao.update(exists_jobInfo);
+        return ReturnT.SUCCESS;
+    }
 
+    @Override
+    public ReturnT<String> remove(int id) {
+        XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
+        if (xxlJobInfo == null) {
+            return ReturnT.SUCCESS;
+        }
+
+        xxlJobInfoDao.delete(id);
+        xxlJobLogDao.delete(id);
+        xxlJobLogGlueDao.deleteByJobId(id);
+        return ReturnT.SUCCESS;
+    }
+
+    @Override
+    public ReturnT<String> start(int id) {
+        XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
 
-		return ReturnT.SUCCESS;
-	}
-
-	@Override
-	public ReturnT<String> remove(int id) {
-		XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
-		if (xxlJobInfo == null) {
-			return ReturnT.SUCCESS;
-		}
-
-		xxlJobInfoDao.delete(id);
-		xxlJobLogDao.delete(id);
-		xxlJobLogGlueDao.deleteByJobId(id);
-		return ReturnT.SUCCESS;
-	}
-
-	@Override
-	public ReturnT<String> start(int id) {
-		XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
-
-		// 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")) );
-		}
-
-		// next trigger time (5s后生效,避开预读周期)
-		long nextTriggerTime = 0;
-		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")) );
-			}
-			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")) );
-		}
-
-		xxlJobInfo.setTriggerStatus(1);
-		xxlJobInfo.setTriggerLastTime(0);
-		xxlJobInfo.setTriggerNextTime(nextTriggerTime);
-
-		xxlJobInfo.setUpdateTime(new Date());
-		xxlJobInfoDao.update(xxlJobInfo);
-		return ReturnT.SUCCESS;
-	}
-
-	@Override
-	public ReturnT<String> stop(int id) {
+        // 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")));
+        }
+
+        // next trigger time (5s后生效,避开预读周期)
+        long nextTriggerTime = 0;
+        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")));
+            }
+            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")));
+        }
+
+        xxlJobInfo.setTriggerStatus(1);
+        xxlJobInfo.setTriggerLastTime(0);
+        xxlJobInfo.setTriggerNextTime(nextTriggerTime);
+
+        xxlJobInfo.setUpdateTime(new Date());
+        xxlJobInfoDao.update(xxlJobInfo);
+        return ReturnT.SUCCESS;
+    }
+
+    @Override
+    public ReturnT<String> stop(int id) {
         XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
 
-		xxlJobInfo.setTriggerStatus(0);
-		xxlJobInfo.setTriggerLastTime(0);
-		xxlJobInfo.setTriggerNextTime(0);
-
-		xxlJobInfo.setUpdateTime(new Date());
-		xxlJobInfoDao.update(xxlJobInfo);
-		return ReturnT.SUCCESS;
-	}
-
-	@Override
-	public Map<String, Object> dashboardInfo() {
-
-		int jobInfoCount = xxlJobInfoDao.findAllCount();
-		int jobLogCount = 0;
-		int jobLogSuccessCount = 0;
-		XxlJobLogReport xxlJobLogReport = xxlJobLogReportDao.queryLogReportTotal();
-		if (xxlJobLogReport != null) {
-			jobLogCount = xxlJobLogReport.getRunningCount() + xxlJobLogReport.getSucCount() + xxlJobLogReport.getFailCount();
-			jobLogSuccessCount = xxlJobLogReport.getSucCount();
-		}
-
-		// executor count
-		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()) {
-					executorAddressSet.addAll(group.getRegistryList());
-				}
-			}
-		}
-
-		int executorCount = executorAddressSet.size();
-
-		Map<String, Object> dashboardMap = new HashMap<String, Object>();
-		dashboardMap.put("jobInfoCount", jobInfoCount);
-		dashboardMap.put("jobLogCount", jobLogCount);
-		dashboardMap.put("jobLogSuccessCount", jobLogSuccessCount);
-		dashboardMap.put("executorCount", executorCount);
-		return dashboardMap;
-	}
-
-	@Override
-	public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
-
-		// process
-		List<String> triggerDayList = new ArrayList<String>();
-		List<Integer> triggerDayCountRunningList = new ArrayList<Integer>();
-		List<Integer> triggerDayCountSucList = new ArrayList<Integer>();
-		List<Integer> triggerDayCountFailList = new ArrayList<Integer>();
-		int triggerCountRunningTotal = 0;
-		int triggerCountSucTotal = 0;
-		int triggerCountFailTotal = 0;
-
-		List<XxlJobLogReport> logReportList = xxlJobLogReportDao.queryLogReport(startDate, endDate);
-
-		if (logReportList!=null && logReportList.size()>0) {
-			for (XxlJobLogReport item: logReportList) {
-				String day = DateUtil.formatDate(item.getTriggerDay());
-				int triggerDayCountRunning = item.getRunningCount();
-				int triggerDayCountSuc = item.getSucCount();
-				int triggerDayCountFail = item.getFailCount();
-
-				triggerDayList.add(day);
-				triggerDayCountRunningList.add(triggerDayCountRunning);
-				triggerDayCountSucList.add(triggerDayCountSuc);
-				triggerDayCountFailList.add(triggerDayCountFail);
-
-				triggerCountRunningTotal += triggerDayCountRunning;
-				triggerCountSucTotal += triggerDayCountSuc;
-				triggerCountFailTotal += triggerDayCountFail;
-			}
-		} else {
-			for (int i = -6; i <= 0; i++) {
-				triggerDayList.add(DateUtil.formatDate(DateUtil.addDays(new Date(), i)));
-				triggerDayCountRunningList.add(0);
-				triggerDayCountSucList.add(0);
-				triggerDayCountFailList.add(0);
-			}
-		}
-
-		Map<String, Object> result = new HashMap<String, Object>();
-		result.put("triggerDayList", triggerDayList);
-		result.put("triggerDayCountRunningList", triggerDayCountRunningList);
-		result.put("triggerDayCountSucList", triggerDayCountSucList);
-		result.put("triggerDayCountFailList", triggerDayCountFailList);
-
-		result.put("triggerCountRunningTotal", triggerCountRunningTotal);
-		result.put("triggerCountSucTotal", triggerCountSucTotal);
-		result.put("triggerCountFailTotal", triggerCountFailTotal);
-
-		return new ReturnT<Map<String, Object>>(result);
-	}
+        xxlJobInfo.setTriggerStatus(0);
+        xxlJobInfo.setTriggerLastTime(0);
+        xxlJobInfo.setTriggerNextTime(0);
+
+        xxlJobInfo.setUpdateTime(new Date());
+        xxlJobInfoDao.update(xxlJobInfo);
+        return ReturnT.SUCCESS;
+    }
+
+    @Override
+    public Map<String, Object> dashboardInfo() {
+
+        int jobInfoCount = xxlJobInfoDao.findAllCount();
+        int jobLogCount = 0;
+        int jobLogSuccessCount = 0;
+        XxlJobLogReport xxlJobLogReport = xxlJobLogReportDao.queryLogReportTotal();
+        if (xxlJobLogReport != null) {
+            jobLogCount = xxlJobLogReport.getRunningCount() + xxlJobLogReport.getSucCount() + xxlJobLogReport.getFailCount();
+            jobLogSuccessCount = xxlJobLogReport.getSucCount();
+        }
+
+        // executor count
+        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()) {
+                    executorAddressSet.addAll(group.getRegistryList());
+                }
+            }
+        }
+
+        int executorCount = executorAddressSet.size();
+
+        Map<String, Object> dashboardMap = new HashMap<String, Object>();
+        dashboardMap.put("jobInfoCount", jobInfoCount);
+        dashboardMap.put("jobLogCount", jobLogCount);
+        dashboardMap.put("jobLogSuccessCount", jobLogSuccessCount);
+        dashboardMap.put("executorCount", executorCount);
+        return dashboardMap;
+    }
+
+    @Override
+    public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
+
+        // process
+        List<String> triggerDayList = new ArrayList<String>();
+        List<Integer> triggerDayCountRunningList = new ArrayList<Integer>();
+        List<Integer> triggerDayCountSucList = new ArrayList<Integer>();
+        List<Integer> triggerDayCountFailList = new ArrayList<Integer>();
+        int triggerCountRunningTotal = 0;
+        int triggerCountSucTotal = 0;
+        int triggerCountFailTotal = 0;
+
+        List<XxlJobLogReport> logReportList = xxlJobLogReportDao.queryLogReport(startDate, endDate);
+
+        if (logReportList != null && logReportList.size() > 0) {
+            for (XxlJobLogReport item : logReportList) {
+                String day = DateUtil.formatDate(item.getTriggerDay());
+                int triggerDayCountRunning = item.getRunningCount();
+                int triggerDayCountSuc = item.getSucCount();
+                int triggerDayCountFail = item.getFailCount();
+
+                triggerDayList.add(day);
+                triggerDayCountRunningList.add(triggerDayCountRunning);
+                triggerDayCountSucList.add(triggerDayCountSuc);
+                triggerDayCountFailList.add(triggerDayCountFail);
+
+                triggerCountRunningTotal += triggerDayCountRunning;
+                triggerCountSucTotal += triggerDayCountSuc;
+                triggerCountFailTotal += triggerDayCountFail;
+            }
+        } else {
+            for (int i = -6; i <= 0; i++) {
+                triggerDayList.add(DateUtil.formatDate(DateUtil.addDays(new Date(), i)));
+                triggerDayCountRunningList.add(0);
+                triggerDayCountSucList.add(0);
+                triggerDayCountFailList.add(0);
+            }
+        }
+
+        Map<String, Object> result = new HashMap<String, Object>();
+        result.put("triggerDayList", triggerDayList);
+        result.put("triggerDayCountRunningList", triggerDayCountRunningList);
+        result.put("triggerDayCountSucList", triggerDayCountSucList);
+        result.put("triggerDayCountFailList", triggerDayCountFailList);
+
+        result.put("triggerCountRunningTotal", triggerCountRunningTotal);
+        result.put("triggerCountSucTotal", triggerCountSucTotal);
+        result.put("triggerCountFailTotal", triggerCountFailTotal);
+
+        return new ReturnT<Map<String, Object>>(result);
+    }
 
 }

+ 3 - 3
xxl-job-admin/src/main/resources/application.properties

@@ -23,9 +23,9 @@ mybatis.mapper-locations=classpath:/mybatis-mapper/*Mapper.xml
 #mybatis.type-aliases-package=com.xxl.job.admin.core.model
 
 ### xxl-job, datasource
-spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
-spring.datasource.username=root
-spring.datasource.password=root_pwd
+spring.datasource.url=jdbc:mysql://139.186.165.84:3306/xxl-job-new?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
+spring.datasource.username=hcst
+spring.datasource.password=hcst@2020
 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
 
 ### datasource-pool

+ 2 - 0
xxl-job-admin/src/main/resources/i18n/message_en.properties

@@ -36,6 +36,8 @@ system_digits=digits
 system_lengh_limit=Length limit
 system_permission_limit=Permission limit
 system_welcome=Welcome
+jobinfo_media_id=媒体类型
+jobinfo_sub_account=是否分账户
 
 ## daterangepicker
 daterangepicker_ranges_recent_hour=recent one hour

+ 2 - 0
xxl-job-admin/src/main/resources/i18n/message_zh_CN.properties

@@ -155,6 +155,8 @@ jobinfo_conf_base=基础配置
 jobinfo_conf_schedule=调度配置
 jobinfo_conf_job=任务配置
 jobinfo_conf_advanced=高级配置
+jobinfo_media_id=媒体类型
+jobinfo_sub_account=是否分账户
 
 ## job log
 joblog_name=调度日志

+ 2 - 0
xxl-job-admin/src/main/resources/i18n/message_zh_TC.properties

@@ -36,6 +36,8 @@ system_digits=整數
 system_lengh_limit=長度限制
 system_permission_limit=權限控管
 system_welcome=歡迎
+jobinfo_media_id=媒体类型
+jobinfo_sub_account=是否分账户
 
 ## daterangepicker
 daterangepicker_ranges_recent_hour=最近一小時

+ 11 - 0
xxl-job-admin/src/main/resources/mybatis-mapper/AccountMapper.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xxl.job.admin.dao.AccountDao">
+
+    <select id="getAccountList" resultType="java.lang.String">
+	  SELECT account_id  from `jeecg-boot`.ctop_user_allocation
+	  where media_id = #{mediaId}
+	  and account_status = 0
+	</select>
+</mapper>

+ 162 - 146
xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml

@@ -1,44 +1,46 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-	"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.xxl.job.admin.dao.XxlJobInfoDao">
 
-	<resultMap id="XxlJobInfo" type="com.xxl.job.admin.core.model.XxlJobInfo" >
-		<result column="id" property="id" />
+    <resultMap id="XxlJobInfo" type="com.xxl.job.admin.core.model.XxlJobInfo">
+        <result column="id" property="id"/>
 
-		<result column="job_group" property="jobGroup" />
-	    <result column="job_desc" property="jobDesc" />
+        <result column="job_group" property="jobGroup"/>
+        <result column="job_desc" property="jobDesc"/>
 
-	    <result column="add_time" property="addTime" />
-	    <result column="update_time" property="updateTime" />
+        <result column="add_time" property="addTime"/>
+        <result column="update_time" property="updateTime"/>
 
-	    <result column="author" property="author" />
-	    <result column="alarm_email" property="alarmEmail" />
+        <result column="author" property="author"/>
+        <result column="alarm_email" property="alarmEmail"/>
 
-		<result column="schedule_type" property="scheduleType" />
-		<result column="schedule_conf" property="scheduleConf" />
-		<result column="misfire_strategy" property="misfireStrategy" />
+        <result column="schedule_type" property="scheduleType"/>
+        <result column="schedule_conf" property="scheduleConf"/>
+        <result column="misfire_strategy" property="misfireStrategy"/>
 
-		<result column="executor_route_strategy" property="executorRouteStrategy" />
-		<result column="executor_handler" property="executorHandler" />
-	    <result column="executor_param" property="executorParam" />
-		<result column="executor_block_strategy" property="executorBlockStrategy" />
-		<result column="executor_timeout" property="executorTimeout" />
-		<result column="executor_fail_retry_count" property="executorFailRetryCount" />
+        <result column="executor_route_strategy" property="executorRouteStrategy"/>
+        <result column="executor_handler" property="executorHandler"/>
+        <result column="executor_param" property="executorParam"/>
+        <result column="executor_block_strategy" property="executorBlockStrategy"/>
+        <result column="executor_timeout" property="executorTimeout"/>
+        <result column="executor_fail_retry_count" property="executorFailRetryCount"/>
 
-	    <result column="glue_type" property="glueType" />
-	    <result column="glue_source" property="glueSource" />
-	    <result column="glue_remark" property="glueRemark" />
-		<result column="glue_updatetime" property="glueUpdatetime" />
+        <result column="glue_type" property="glueType"/>
+        <result column="glue_source" property="glueSource"/>
+        <result column="glue_remark" property="glueRemark"/>
+        <result column="glue_updatetime" property="glueUpdatetime"/>
 
-		<result column="child_jobid" property="childJobId" />
+        <result column="child_jobid" property="childJobId"/>
 
-		<result column="trigger_status" property="triggerStatus" />
-		<result column="trigger_last_time" property="triggerLastTime" />
-		<result column="trigger_next_time" property="triggerNextTime" />
-	</resultMap>
+        <result column="trigger_status" property="triggerStatus"/>
+        <result column="trigger_last_time" property="triggerLastTime"/>
+        <result column="trigger_next_time" property="triggerNextTime"/>
+        <result column="media_id" property="mediaId"/>
+        <result column="sub_account" property="subAccount"/>
+    </resultMap>
 
-	<sql id="Base_Column_List">
+    <sql id="Base_Column_List">
 		t.id,
 		t.job_group,
 		t.job_desc,
@@ -62,118 +64,128 @@
 		t.child_jobid,
 		t.trigger_status,
 		t.trigger_last_time,
-		t.trigger_next_time
+		t.trigger_next_time,
+		t.media_id,
+		t.sub_account
+
 	</sql>
 
-	<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
-		SELECT <include refid="Base_Column_List" />
-		FROM xxl_job_info AS t
-		<trim prefix="WHERE" prefixOverrides="AND | OR" >
-			<if test="jobGroup gt 0">
-				AND t.job_group = #{jobGroup}
-			</if>
+    <select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM xxl_job_info AS t
+        <trim prefix="WHERE" prefixOverrides="AND | OR">
+            <if test="jobGroup gt 0">
+                AND t.job_group = #{jobGroup}
+            </if>
             <if test="triggerStatus gte 0">
                 AND t.trigger_status = #{triggerStatus}
             </if>
-			<if test="jobDesc != null and jobDesc != ''">
-				AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
-			</if>
-			<if test="executorHandler != null and executorHandler != ''">
-				AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler}), '%')
-			</if>
-			<if test="author != null and author != ''">
-				AND t.author like CONCAT(CONCAT('%', #{author}), '%')
-			</if>
-		</trim>
-		ORDER BY id DESC
-		LIMIT #{offset}, #{pagesize}
-	</select>
+            <if test="jobDesc != null and jobDesc != ''">
+                AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
+            </if>
+            <if test="executorHandler != null and executorHandler != ''">
+                AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler}), '%')
+            </if>
+            <if test="author != null and author != ''">
+                AND t.author like CONCAT(CONCAT('%', #{author}), '%')
+            </if>
+        </trim>
+        ORDER BY id DESC
+        LIMIT #{offset}, #{pagesize}
+    </select>
 
-	<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
-		SELECT count(1)
-		FROM xxl_job_info AS t
-		<trim prefix="WHERE" prefixOverrides="AND | OR" >
-			<if test="jobGroup gt 0">
-				AND t.job_group = #{jobGroup}
-			</if>
+    <select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
+        SELECT count(1)
+        FROM xxl_job_info AS t
+        <trim prefix="WHERE" prefixOverrides="AND | OR">
+            <if test="jobGroup gt 0">
+                AND t.job_group = #{jobGroup}
+            </if>
             <if test="triggerStatus gte 0">
                 AND t.trigger_status = #{triggerStatus}
             </if>
-			<if test="jobDesc != null and jobDesc != ''">
-				AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
-			</if>
-			<if test="executorHandler != null and executorHandler != ''">
-				AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler}), '%')
-			</if>
-			<if test="author != null and author != ''">
-				AND t.author like CONCAT(CONCAT('%', #{author}), '%')
-			</if>
-		</trim>
-	</select>
+            <if test="jobDesc != null and jobDesc != ''">
+                AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
+            </if>
+            <if test="executorHandler != null and executorHandler != ''">
+                AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler}), '%')
+            </if>
+            <if test="author != null and author != ''">
+                AND t.author like CONCAT(CONCAT('%', #{author}), '%')
+            </if>
+        </trim>
+    </select>
 
-	<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" useGeneratedKeys="true" keyProperty="id" >
-		INSERT INTO xxl_job_info (
-			job_group,
-			job_desc,
-			add_time,
-			update_time,
-			author,
-			alarm_email,
-			schedule_type,
-			schedule_conf,
-			misfire_strategy,
-            executor_route_strategy,
-			executor_handler,
-			executor_param,
-			executor_block_strategy,
-			executor_timeout,
-			executor_fail_retry_count,
-			glue_type,
-			glue_source,
-			glue_remark,
-			glue_updatetime,
-			child_jobid,
-			trigger_status,
-			trigger_last_time,
-			trigger_next_time
-		) VALUES (
-			#{jobGroup},
-			#{jobDesc},
-			#{addTime},
-			#{updateTime},
-			#{author},
-			#{alarmEmail},
-			#{scheduleType},
-			#{scheduleConf},
-			#{misfireStrategy},
-			#{executorRouteStrategy},
-			#{executorHandler},
-			#{executorParam},
-			#{executorBlockStrategy},
-			#{executorTimeout},
-			#{executorFailRetryCount},
-			#{glueType},
-			#{glueSource},
-			#{glueRemark},
-			#{glueUpdatetime},
-			#{childJobId},
-			#{triggerStatus},
-			#{triggerLastTime},
-			#{triggerNextTime}
-		);
-		<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
-			SELECT LAST_INSERT_ID()
-			/*SELECT @@IDENTITY AS id*/
-		</selectKey>-->
-	</insert>
-
-	<select id="loadById" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
-		SELECT <include refid="Base_Column_List" />
-		FROM xxl_job_info AS t
-		WHERE t.id = #{id}
-	</select>
+    <insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO xxl_job_info (
+        job_group,
+        job_desc,
+        add_time,
+        update_time,
+        author,
+        alarm_email,
+        schedule_type,
+        schedule_conf,
+        misfire_strategy,
+        executor_route_strategy,
+        executor_handler,
+        executor_param,
+        executor_block_strategy,
+        executor_timeout,
+        executor_fail_retry_count,
+        glue_type,
+        glue_source,
+        glue_remark,
+        glue_updatetime,
+        child_jobid,
+        trigger_status,
+        trigger_last_time,
+        trigger_next_time,
+        media_id,
+        sub_account
+
+        ) VALUES (
+        #{jobGroup},
+        #{jobDesc},
+        #{addTime},
+        #{updateTime},
+        #{author},
+        #{alarmEmail},
+        #{scheduleType},
+        #{scheduleConf},
+        #{misfireStrategy},
+        #{executorRouteStrategy},
+        #{executorHandler},
+        #{executorParam},
+        #{executorBlockStrategy},
+        #{executorTimeout},
+        #{executorFailRetryCount},
+        #{glueType},
+        #{glueSource},
+        #{glueRemark},
+        #{glueUpdatetime},
+        #{childJobId},
+        #{triggerStatus},
+        #{triggerLastTime},
+        #{triggerNextTime},
+        #{mediaId},
+        #{subAccount}
+        );
+        <!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
+            SELECT LAST_INSERT_ID()
+            /*SELECT @@IDENTITY AS id*/
+        </selectKey>-->
+    </insert>
 
-	<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" >
+    <select id="loadById" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM xxl_job_info AS t
+        WHERE t.id = #{id}
+    </select>
+
+    <update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobInfo">
 		UPDATE xxl_job_info
 		SET
 			job_group = #{jobGroup},
@@ -197,38 +209,42 @@
 			child_jobid = #{childJobId},
 			trigger_status = #{triggerStatus},
 			trigger_last_time = #{triggerLastTime},
-			trigger_next_time = #{triggerNextTime}
+			trigger_next_time = #{triggerNextTime},
+			media_id = #{mediaId},
+			sub_account = #{subAccount}
 		WHERE id = #{id}
 	</update>
 
-	<delete id="delete" parameterType="java.util.HashMap">
+    <delete id="delete" parameterType="java.util.HashMap">
 		DELETE
 		FROM xxl_job_info
 		WHERE id = #{id}
 	</delete>
 
-	<select id="getJobsByGroup" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
-		SELECT <include refid="Base_Column_List" />
-		FROM xxl_job_info AS t
-		WHERE t.job_group = #{jobGroup}
-	</select>
+    <select id="getJobsByGroup" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM xxl_job_info AS t
+        WHERE t.job_group = #{jobGroup}
+    </select>
 
-	<select id="findAllCount" resultType="int">
+    <select id="findAllCount" resultType="int">
 		SELECT count(1)
 		FROM xxl_job_info
 	</select>
 
 
-	<select id="scheduleJobQuery" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
-		SELECT <include refid="Base_Column_List" />
-		FROM xxl_job_info AS t
-		WHERE t.trigger_status = 1
-			and t.trigger_next_time <![CDATA[ <= ]]> #{maxNextTime}
-		ORDER BY id ASC
-		LIMIT #{pagesize}
-	</select>
+    <select id="scheduleJobQuery" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM xxl_job_info AS t
+        WHERE t.trigger_status = 1
+        and t.trigger_next_time <![CDATA[ <= ]]> #{maxNextTime}
+        ORDER BY id ASC
+        LIMIT #{pagesize}
+    </select>
 
-	<update id="scheduleUpdate" parameterType="com.xxl.job.admin.core.model.XxlJobInfo"  >
+    <update id="scheduleUpdate" parameterType="com.xxl.job.admin.core.model.XxlJobInfo">
 		UPDATE xxl_job_info
 		SET
 			trigger_last_time = #{triggerLastTime},

+ 2 - 1
xxl-job-admin/src/main/resources/static/js/jobinfo.index.1.js

@@ -576,7 +576,8 @@ $(function() {
 		$('#updateModal .form select[name=executorBlockStrategy] option[value='+ row.executorBlockStrategy +']').prop('selected', true);
 		$("#updateModal .form input[name='executorTimeout']").val( row.executorTimeout );
         $("#updateModal .form input[name='executorFailRetryCount']").val( row.executorFailRetryCount );
-
+		$('#updateModal .form select[name=mediaId] option[value='+ row.mediaId +']').prop('selected', true);
+		$('#updateModal .form select[name=subAccount] option[value='+ row.subAccount +']').prop('selected', true);
 		// show
 		$('#updateModal').modal({backdrop: false, keyboard: false}).modal('show');
 	});

+ 48 - 0
xxl-job-admin/src/main/resources/templates/jobinfo/jobinfo.index.ftl

@@ -163,8 +163,31 @@
                             <label for="lastname" class="col-sm-2 control-label">${I18n.schedule_type_fix_delay}<font color="red">*</font></label>
                             <div class="col-sm-4"><input type="text" class="form-control" name="schedule_conf_FIX_DELAY" placeholder="${I18n.system_please_input} ( Second )" maxlength="10" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
                         </div>
+
                     </div>
+                    <br>
+                    <p style="margin: 0 0 10px;text-align: left;border-bottom: 1px solid #e5e5e5;color: gray;">媒体配置</p>
+                    <div  class="form-group">
+                        <label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_media_id}<font color="red">*</font></label>
+                        <div class="col-sm-4">
+                            <select class="form-control" name="mediaId" >
+
+                                <option value="1" >头条</option>
+                                <option value="2" >快手</option>
+
+                            </select>
+                        </div>
 
+                        <label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_sub_account}<font color="red">*</font></label>
+                        <div class="col-sm-4">
+                            <select class="form-control" name="subAccount" >
+
+                                <option value="1" >是</option>
+                                <option value="2" >否</option>
+
+                            </select>
+                        </div>
+                    </div>
                     <br>
                     <p style="margin: 0 0 10px;text-align: left;border-bottom: 1px solid #e5e5e5;color: gray;">${I18n.jobinfo_conf_job}</p>    <#-- 任务配置 -->
 
@@ -408,8 +431,33 @@ exit 0
                             <label for="lastname" class="col-sm-2 control-label">${I18n.schedule_type_fix_delay}<font color="red">*</font></label>
                             <div class="col-sm-4"><input type="text" class="form-control" name="schedule_conf_FIX_DELAY" placeholder="${I18n.system_please_input} ( Second )" maxlength="10" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
                         </div>
+
+
+
                     </div>
+                    <br>
+                    <p style="margin: 0 0 10px;text-align: left;border-bottom: 1px solid #e5e5e5;color: gray;">媒体配置</p>
+                    <div  class="form-group">
+                        <label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_media_id}<font color="red">*</font></label>
+                        <div class="col-sm-4">
+                            <select class="form-control" name="mediaId" >
+
+                                <option value="1" >头条</option>
+                                <option value="2" >快手</option>
+
+                            </select>
+                        </div>
+
+                        <label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_sub_account}<font color="red">*</font></label>
+                        <div class="col-sm-4">
+                            <select class="form-control" name="subAccount" >
+
+                                <option value="1" >是</option>
+                                <option value="2" >否</option>
 
+                            </select>
+                        </div>
+                    </div>
                     <br>
                     <p style="margin: 0 0 10px;text-align: left;border-bottom: 1px solid #e5e5e5;color: gray;">${I18n.jobinfo_conf_job}</p>    <#-- 任务配置 -->
 

+ 0 - 18
xxl-job-executor-samples/pom.xml

@@ -1,18 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>com.xuxueli</groupId>
-        <artifactId>xxl-job</artifactId>
-        <version>2.3.1-SNAPSHOT</version>
-    </parent>
-    <artifactId>xxl-job-executor-samples</artifactId>
-    <packaging>pom</packaging>
-
-    <modules>
-        <module>xxl-job-executor-sample-frameless</module>
-        <module>xxl-job-executor-sample-springboot</module>
-    </modules>
-
-</project>

+ 0 - 45
xxl-job-executor-samples/xxl-job-executor-sample-frameless/pom.xml

@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>com.xuxueli</groupId>
-        <artifactId>xxl-job-executor-samples</artifactId>
-        <version>2.3.1-SNAPSHOT</version>
-    </parent>
-    <artifactId>xxl-job-executor-sample-frameless</artifactId>
-    <packaging>jar</packaging>
-
-    <name>${project.artifactId}</name>
-    <description>Example executor project for spring boot.</description>
-    <url>https://www.xuxueli.com/</url>
-
-
-    <dependencies>
-
-        <!-- slf4j -->
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-            <version>${slf4j-api.version}</version>
-        </dependency>
-        <!-- junit -->
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-engine</artifactId>
-            <version>${junit-jupiter.version}</version>
-            <scope>test</scope>
-        </dependency>
-
-        <!-- xxl-job-core -->
-        <dependency>
-            <groupId>com.xuxueli</groupId>
-            <artifactId>xxl-job-core</artifactId>
-            <version>${project.parent.version}</version>
-        </dependency>
-
-    </dependencies>
-
-
-</project>

+ 0 - 38
xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/java/com/xxl/job/executor/sample/frameless/FramelessApplication.java

@@ -1,38 +0,0 @@
-package com.xxl.job.executor.sample.frameless;
-
-import com.xxl.job.executor.sample.frameless.config.FrameLessXxlJobConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * @author xuxueli 2018-10-31 19:05:43
- */
-public class FramelessApplication {
-    private static Logger logger = LoggerFactory.getLogger(FramelessApplication.class);
-
-    public static void main(String[] args) {
-
-        try {
-            // start
-            FrameLessXxlJobConfig.getInstance().initXxlJobExecutor();
-
-            // Blocks until interrupted
-            while (true) {
-                try {
-                    TimeUnit.HOURS.sleep(1);
-                } catch (InterruptedException e) {
-                    break;
-                }
-            }
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-        } finally {
-            // destroy
-            FrameLessXxlJobConfig.getInstance().destroyXxlJobExecutor();
-        }
-
-    }
-
-}

+ 0 - 93
xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/java/com/xxl/job/executor/sample/frameless/config/FrameLessXxlJobConfig.java

@@ -1,93 +0,0 @@
-package com.xxl.job.executor.sample.frameless.config;
-
-import com.xxl.job.executor.sample.frameless.jobhandler.SampleXxlJob;
-import com.xxl.job.core.executor.impl.XxlJobSimpleExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Arrays;
-import java.util.Properties;
-
-/**
- * @author xuxueli 2018-10-31 19:05:43
- */
-public class FrameLessXxlJobConfig {
-    private static Logger logger = LoggerFactory.getLogger(FrameLessXxlJobConfig.class);
-
-
-    private static FrameLessXxlJobConfig instance = new FrameLessXxlJobConfig();
-    public static FrameLessXxlJobConfig getInstance() {
-        return instance;
-    }
-
-
-    private XxlJobSimpleExecutor xxlJobExecutor = null;
-
-    /**
-     * init
-     */
-    public void initXxlJobExecutor() {
-
-        // load executor prop
-        Properties xxlJobProp = loadProperties("xxl-job-executor.properties");
-
-        // init executor
-        xxlJobExecutor = new XxlJobSimpleExecutor();
-        xxlJobExecutor.setAdminAddresses(xxlJobProp.getProperty("xxl.job.admin.addresses"));
-        xxlJobExecutor.setAccessToken(xxlJobProp.getProperty("xxl.job.accessToken"));
-        xxlJobExecutor.setAppname(xxlJobProp.getProperty("xxl.job.executor.appname"));
-        xxlJobExecutor.setAddress(xxlJobProp.getProperty("xxl.job.executor.address"));
-        xxlJobExecutor.setIp(xxlJobProp.getProperty("xxl.job.executor.ip"));
-        xxlJobExecutor.setPort(Integer.valueOf(xxlJobProp.getProperty("xxl.job.executor.port")));
-        xxlJobExecutor.setLogPath(xxlJobProp.getProperty("xxl.job.executor.logpath"));
-        xxlJobExecutor.setLogRetentionDays(Integer.valueOf(xxlJobProp.getProperty("xxl.job.executor.logretentiondays")));
-
-        // registry job bean
-        xxlJobExecutor.setXxlJobBeanList(Arrays.asList(new SampleXxlJob()));
-
-        // start executor
-        try {
-            xxlJobExecutor.start();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-
-    /**
-     * destroy
-     */
-    public void destroyXxlJobExecutor() {
-        if (xxlJobExecutor != null) {
-            xxlJobExecutor.destroy();
-        }
-    }
-
-
-    public static Properties loadProperties(String propertyFileName) {
-        InputStreamReader in = null;
-        try {
-            ClassLoader loder = Thread.currentThread().getContextClassLoader();
-
-            in = new InputStreamReader(loder.getResourceAsStream(propertyFileName), "UTF-8");;
-            if (in != null) {
-                Properties prop = new Properties();
-                prop.load(in);
-                return prop;
-            }
-        } catch (IOException e) {
-            logger.error("load {} error!", propertyFileName);
-        } finally {
-            if (in != null) {
-                try {
-                    in.close();
-                } catch (IOException e) {
-                    logger.error("close {} error!", propertyFileName);
-                }
-            }
-        }
-        return null;
-    }
-
-}

+ 0 - 251
xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/java/com/xxl/job/executor/sample/frameless/jobhandler/SampleXxlJob.java

@@ -1,251 +0,0 @@
-package com.xxl.job.executor.sample.frameless.jobhandler;
-
-import com.xxl.job.core.context.XxlJobHelper;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.DataOutputStream;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.concurrent.TimeUnit;
-
-/**
- * XxlJob开发示例(Bean模式)
- *
- * 开发步骤:
- *      1、任务开发:在Spring Bean实例中,开发Job方法;
- *      2、注解配置:为Job方法添加注解 "@XxlJob(value="自定义jobhandler名称", init = "JobHandler初始化方法", destroy = "JobHandler销毁方法")",注解value值对应的是调度中心新建任务的JobHandler属性的值。
- *      3、执行日志:需要通过 "XxlJobHelper.log" 打印执行日志;
- *      4、任务结果:默认任务结果为 "成功" 状态,不需要主动设置;如有诉求,比如设置任务结果为失败,可以通过 "XxlJobHelper.handleFail/handleSuccess" 自主设置任务结果;
- *
- * @author xuxueli 2019-12-11 21:52:51
- */
-public class SampleXxlJob {
-    private static Logger logger = LoggerFactory.getLogger(SampleXxlJob.class);
-
-
-    /**
-     * 1、简单任务示例(Bean模式)
-     */
-    @XxlJob("demoJobHandler")
-    public void demoJobHandler() throws Exception {
-        XxlJobHelper.log("XXL-JOB, Hello World.");
-
-        for (int i = 0; i < 5; i++) {
-            XxlJobHelper.log("beat at:" + i);
-            TimeUnit.SECONDS.sleep(2);
-        }
-        // default success
-    }
-
-
-    /**
-     * 2、分片广播任务
-     */
-    @XxlJob("shardingJobHandler")
-    public void shardingJobHandler() throws Exception {
-
-        // 分片参数
-        int shardIndex = XxlJobHelper.getShardIndex();
-        int shardTotal = XxlJobHelper.getShardTotal();
-
-        XxlJobHelper.log("分片参数:当前分片序号 = {}, 总分片数 = {}", shardIndex, shardTotal);
-
-        // 业务逻辑
-        for (int i = 0; i < shardTotal; i++) {
-            if (i == shardIndex) {
-                XxlJobHelper.log("第 {} 片, 命中分片开始处理", i);
-            } else {
-                XxlJobHelper.log("第 {} 片, 忽略", i);
-            }
-        }
-
-    }
-
-
-    /**
-     * 3、命令行任务
-     */
-    @XxlJob("commandJobHandler")
-    public void commandJobHandler() throws Exception {
-        String command = XxlJobHelper.getJobParam();
-        int exitValue = -1;
-
-        BufferedReader bufferedReader = null;
-        try {
-            // command process
-            ProcessBuilder processBuilder = new ProcessBuilder();
-            processBuilder.command(command);
-            processBuilder.redirectErrorStream(true);
-
-            Process process = processBuilder.start();
-            //Process process = Runtime.getRuntime().exec(command);
-
-            BufferedInputStream bufferedInputStream = new BufferedInputStream(process.getInputStream());
-            bufferedReader = new BufferedReader(new InputStreamReader(bufferedInputStream));
-
-            // command log
-            String line;
-            while ((line = bufferedReader.readLine()) != null) {
-                XxlJobHelper.log(line);
-            }
-
-            // command exit
-            process.waitFor();
-            exitValue = process.exitValue();
-        } catch (Exception e) {
-            XxlJobHelper.log(e);
-        } finally {
-            if (bufferedReader != null) {
-                bufferedReader.close();
-            }
-        }
-
-        if (exitValue == 0) {
-            // default success
-        } else {
-            XxlJobHelper.handleFail("command exit value("+exitValue+") is failed");
-        }
-
-    }
-
-
-    /**
-     * 4、跨平台Http任务
-     *  参数示例:
-     *      "url: http://www.baidu.com\n" +
-     *      "method: get\n" +
-     *      "data: content\n";
-     */
-    @XxlJob("httpJobHandler")
-    public void httpJobHandler() throws Exception {
-
-        // param parse
-        String param = XxlJobHelper.getJobParam();
-        if (param==null || param.trim().length()==0) {
-            XxlJobHelper.log("param["+ param +"] invalid.");
-
-            XxlJobHelper.handleFail();
-            return;
-        }
-
-        String[] httpParams = param.split("\n");
-        String url = null;
-        String method = null;
-        String data = null;
-        for (String httpParam: httpParams) {
-            if (httpParam.startsWith("url:")) {
-                url = httpParam.substring(httpParam.indexOf("url:") + 4).trim();
-            }
-            if (httpParam.startsWith("method:")) {
-                method = httpParam.substring(httpParam.indexOf("method:") + 7).trim().toUpperCase();
-            }
-            if (httpParam.startsWith("data:")) {
-                data = httpParam.substring(httpParam.indexOf("data:") + 5).trim();
-            }
-        }
-
-        // param valid
-        if (url==null || url.trim().length()==0) {
-            XxlJobHelper.log("url["+ url +"] invalid.");
-
-            XxlJobHelper.handleFail();
-            return;
-        }
-        if (method==null || !Arrays.asList("GET", "POST").contains(method)) {
-            XxlJobHelper.log("method["+ method +"] invalid.");
-
-            XxlJobHelper.handleFail();
-            return;
-        }
-        boolean isPostMethod = method.equals("POST");
-
-        // request
-        HttpURLConnection connection = null;
-        BufferedReader bufferedReader = null;
-        try {
-            // connection
-            URL realUrl = new URL(url);
-            connection = (HttpURLConnection) realUrl.openConnection();
-
-            // connection setting
-            connection.setRequestMethod(method);
-            connection.setDoOutput(isPostMethod);
-            connection.setDoInput(true);
-            connection.setUseCaches(false);
-            connection.setReadTimeout(5 * 1000);
-            connection.setConnectTimeout(3 * 1000);
-            connection.setRequestProperty("connection", "Keep-Alive");
-            connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
-            connection.setRequestProperty("Accept-Charset", "application/json;charset=UTF-8");
-
-            // do connection
-            connection.connect();
-
-            // data
-            if (isPostMethod && data!=null && data.trim().length()>0) {
-                DataOutputStream dataOutputStream = new DataOutputStream(connection.getOutputStream());
-                dataOutputStream.write(data.getBytes("UTF-8"));
-                dataOutputStream.flush();
-                dataOutputStream.close();
-            }
-
-            // valid StatusCode
-            int statusCode = connection.getResponseCode();
-            if (statusCode != 200) {
-                throw new RuntimeException("Http Request StatusCode(" + statusCode + ") Invalid.");
-            }
-
-            // result
-            bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
-            StringBuilder result = new StringBuilder();
-            String line;
-            while ((line = bufferedReader.readLine()) != null) {
-                result.append(line);
-            }
-            String responseMsg = result.toString();
-
-            XxlJobHelper.log(responseMsg);
-
-            return;
-        } catch (Exception e) {
-            XxlJobHelper.log(e);
-
-            XxlJobHelper.handleFail();
-            return;
-        } finally {
-            try {
-                if (bufferedReader != null) {
-                    bufferedReader.close();
-                }
-                if (connection != null) {
-                    connection.disconnect();
-                }
-            } catch (Exception e2) {
-                XxlJobHelper.log(e2);
-            }
-        }
-
-    }
-
-    /**
-     * 5、生命周期任务示例:任务初始化与销毁时,支持自定义相关逻辑;
-     */
-    @XxlJob(value = "demoJobHandler2", init = "init", destroy = "destroy")
-    public void demoJobHandler2() throws Exception {
-        XxlJobHelper.log("XXL-JOB, Hello World.");
-    }
-    public void init(){
-        logger.info("init");
-    }
-    public void destroy(){
-        logger.info("destroy");
-    }
-
-
-}

+ 0 - 27
xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/resources/log4j.xml

@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration PUBLIC "-//log4j/log4j Configuration//EN" "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" threshold="null" debug="null">
-
-	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
-		<param name="Target" value="System.out" />
-		<layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-job-executor-sample-frameless [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
-		</layout>
-	</appender>
-	
-    <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
-        <param name="file" value="/data/applogs/xxl-job/xxl-job-executor-sample-frameless.log"/>
-        <param name="append" value="true"/>
-        <param name="encoding" value="UTF-8"/>
-        <layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-job-executor-sample-frameless [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
-        </layout>
-    </appender>
-
-    <root>
-        <level value="INFO" />
-        <appender-ref ref="CONSOLE" />
-        <appender-ref ref="FILE" />
-    </root>
-
-</log4j:configuration>

+ 0 - 17
xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/resources/xxl-job-executor.properties

@@ -1,17 +0,0 @@
-### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
-xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
-
-### xxl-job, access token
-xxl.job.accessToken=
-
-### xxl-job executor appname
-xxl.job.executor.appname=xxl-job-executor-sample
-### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null
-xxl.job.executor.address=
-### xxl-job executor server-info
-xxl.job.executor.ip=
-xxl.job.executor.port=9998
-### xxl-job executor log-path
-xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler
-### xxl-job executor log-retention-days
-xxl.job.executor.logretentiondays=30

+ 0 - 12
xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/test/java/com/xxl/job/executor/sample/frameless/test/FramelessApplicationTest.java

@@ -1,12 +0,0 @@
-package com.xxl.job.executor.sample.frameless.test;
-
-import org.junit.jupiter.api.Test;
-
-public class FramelessApplicationTest {
-
-    @Test
-    public void test(){
-        System.out.println("111");
-    }
-
-}

+ 0 - 11
xxl-job-executor-samples/xxl-job-executor-sample-springboot/Dockerfile

@@ -1,11 +0,0 @@
-FROM openjdk:8-jre-slim
-MAINTAINER xuxueli
-
-ENV PARAMS=""
-
-ENV TZ=PRC
-RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
-
-ADD target/xxl-job-executor-sample-springboot-*.jar /app.jar
-
-ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /app.jar $PARAMS"]

+ 0 - 74
xxl-job-executor-samples/xxl-job-executor-sample-springboot/pom.xml

@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>com.xuxueli</groupId>
-        <artifactId>xxl-job-executor-samples</artifactId>
-        <version>2.3.1-SNAPSHOT</version>
-    </parent>
-    <artifactId>xxl-job-executor-sample-springboot</artifactId>
-    <packaging>jar</packaging>
-
-    <name>${project.artifactId}</name>
-    <description>Example executor project for spring boot.</description>
-    <url>https://www.xuxueli.com/</url>
-
-    <properties>
-    </properties>
-
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <!-- Import dependency management from Spring Boot (依赖管理:继承一些默认的依赖,工程需要依赖的jar包的管理,申明其他dependency的时候就不需要version) -->
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-starter-parent</artifactId>
-                <version>${spring-boot.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
-    <dependencies>
-        <!-- spring-boot-starter-web (spring-webmvc + tomcat) -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <!-- xxl-job-core -->
-        <dependency>
-            <groupId>com.xuxueli</groupId>
-            <artifactId>xxl-job-core</artifactId>
-            <version>${project.parent.version}</version>
-        </dependency>
-
-    </dependencies>
-
-    <build>
-        <plugins>
-            <!-- spring-boot-maven-plugin (提供了直接运行项目的插件:如果是通过parent方式继承spring-boot-starter-parent则不用此插件) -->
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <version>${spring-boot.version}</version>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>repackage</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
-
-</project>

+ 0 - 16
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/XxlJobExecutorApplication.java

@@ -1,16 +0,0 @@
-package com.xxl.job.executor;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * @author xuxueli 2018-10-28 00:38:13
- */
-@SpringBootApplication
-public class XxlJobExecutorApplication {
-
-	public static void main(String[] args) {
-        SpringApplication.run(XxlJobExecutorApplication.class, args);
-	}
-
-}

+ 0 - 78
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java

@@ -1,78 +0,0 @@
-package com.xxl.job.executor.core.config;
-
-import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * xxl-job config
- *
- * @author xuxueli 2017-04-28
- */
-@Configuration
-public class XxlJobConfig {
-    private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
-
-    @Value("${xxl.job.admin.addresses}")
-    private String adminAddresses;
-
-    @Value("${xxl.job.accessToken}")
-    private String accessToken;
-
-    @Value("${xxl.job.executor.appname}")
-    private String appname;
-
-    @Value("${xxl.job.executor.address}")
-    private String address;
-
-    @Value("${xxl.job.executor.ip}")
-    private String ip;
-
-    @Value("${xxl.job.executor.port}")
-    private int port;
-
-    @Value("${xxl.job.executor.logpath}")
-    private String logPath;
-
-    @Value("${xxl.job.executor.logretentiondays}")
-    private int logRetentionDays;
-
-
-    @Bean
-    public XxlJobSpringExecutor xxlJobExecutor() {
-        logger.info(">>>>>>>>>>> xxl-job config init.");
-        XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
-        xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
-        xxlJobSpringExecutor.setAppname(appname);
-        xxlJobSpringExecutor.setAddress(address);
-        xxlJobSpringExecutor.setIp(ip);
-        xxlJobSpringExecutor.setPort(port);
-        xxlJobSpringExecutor.setAccessToken(accessToken);
-        xxlJobSpringExecutor.setLogPath(logPath);
-        xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
-
-        return xxlJobSpringExecutor;
-    }
-
-    /**
-     * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
-     *
-     *      1、引入依赖:
-     *          <dependency>
-     *             <groupId>org.springframework.cloud</groupId>
-     *             <artifactId>spring-cloud-commons</artifactId>
-     *             <version>${version}</version>
-     *         </dependency>
-     *
-     *      2、配置文件,或者容器启动变量
-     *          spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
-     *
-     *      3、获取IP
-     *          String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
-     */
-
-
-}

+ 0 - 18
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/mvc/controller/IndexController.java

@@ -1,18 +0,0 @@
-//package com.xxl.job.executor.mvc.controller;
-//
-//import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-//import org.springframework.stereotype.Controller;
-//import org.springframework.web.bind.annotation.RequestMapping;
-//import org.springframework.web.bind.annotation.ResponseBody;
-//
-//@Controller
-//@EnableAutoConfiguration
-//public class IndexController {
-//
-//    @RequestMapping("/")
-//    @ResponseBody
-//    String index() {
-//        return "xxl job executor running.";
-//    }
-//
-//}

+ 0 - 253
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/SampleXxlJob.java

@@ -1,253 +0,0 @@
-package com.xxl.job.executor.service.jobhandler;
-
-import com.xxl.job.core.context.XxlJobHelper;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.DataOutputStream;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.concurrent.TimeUnit;
-
-/**
- * XxlJob开发示例(Bean模式)
- *
- * 开发步骤:
- *      1、任务开发:在Spring Bean实例中,开发Job方法;
- *      2、注解配置:为Job方法添加注解 "@XxlJob(value="自定义jobhandler名称", init = "JobHandler初始化方法", destroy = "JobHandler销毁方法")",注解value值对应的是调度中心新建任务的JobHandler属性的值。
- *      3、执行日志:需要通过 "XxlJobHelper.log" 打印执行日志;
- *      4、任务结果:默认任务结果为 "成功" 状态,不需要主动设置;如有诉求,比如设置任务结果为失败,可以通过 "XxlJobHelper.handleFail/handleSuccess" 自主设置任务结果;
- *
- * @author xuxueli 2019-12-11 21:52:51
- */
-@Component
-public class SampleXxlJob {
-    private static Logger logger = LoggerFactory.getLogger(SampleXxlJob.class);
-
-
-    /**
-     * 1、简单任务示例(Bean模式)
-     */
-    @XxlJob("demoJobHandler")
-    public void demoJobHandler() throws Exception {
-        XxlJobHelper.log("XXL-JOB, Hello World.");
-
-        for (int i = 0; i < 5; i++) {
-            XxlJobHelper.log("beat at:" + i);
-            TimeUnit.SECONDS.sleep(2);
-        }
-        // default success
-    }
-
-
-    /**
-     * 2、分片广播任务
-     */
-    @XxlJob("shardingJobHandler")
-    public void shardingJobHandler() throws Exception {
-
-        // 分片参数
-        int shardIndex = XxlJobHelper.getShardIndex();
-        int shardTotal = XxlJobHelper.getShardTotal();
-
-        XxlJobHelper.log("分片参数:当前分片序号 = {}, 总分片数 = {}", shardIndex, shardTotal);
-
-        // 业务逻辑
-        for (int i = 0; i < shardTotal; i++) {
-            if (i == shardIndex) {
-                XxlJobHelper.log("第 {} 片, 命中分片开始处理", i);
-            } else {
-                XxlJobHelper.log("第 {} 片, 忽略", i);
-            }
-        }
-
-    }
-
-
-    /**
-     * 3、命令行任务
-     */
-    @XxlJob("commandJobHandler")
-    public void commandJobHandler() throws Exception {
-        String command = XxlJobHelper.getJobParam();
-        int exitValue = -1;
-
-        BufferedReader bufferedReader = null;
-        try {
-            // command process
-            ProcessBuilder processBuilder = new ProcessBuilder();
-            processBuilder.command(command);
-            processBuilder.redirectErrorStream(true);
-
-            Process process = processBuilder.start();
-            //Process process = Runtime.getRuntime().exec(command);
-
-            BufferedInputStream bufferedInputStream = new BufferedInputStream(process.getInputStream());
-            bufferedReader = new BufferedReader(new InputStreamReader(bufferedInputStream));
-
-            // command log
-            String line;
-            while ((line = bufferedReader.readLine()) != null) {
-                XxlJobHelper.log(line);
-            }
-
-            // command exit
-            process.waitFor();
-            exitValue = process.exitValue();
-        } catch (Exception e) {
-            XxlJobHelper.log(e);
-        } finally {
-            if (bufferedReader != null) {
-                bufferedReader.close();
-            }
-        }
-
-        if (exitValue == 0) {
-            // default success
-        } else {
-            XxlJobHelper.handleFail("command exit value("+exitValue+") is failed");
-        }
-
-    }
-
-
-    /**
-     * 4、跨平台Http任务
-     *  参数示例:
-     *      "url: http://www.baidu.com\n" +
-     *      "method: get\n" +
-     *      "data: content\n";
-     */
-    @XxlJob("httpJobHandler")
-    public void httpJobHandler() throws Exception {
-
-        // param parse
-        String param = XxlJobHelper.getJobParam();
-        if (param==null || param.trim().length()==0) {
-            XxlJobHelper.log("param["+ param +"] invalid.");
-
-            XxlJobHelper.handleFail();
-            return;
-        }
-
-        String[] httpParams = param.split("\n");
-        String url = null;
-        String method = null;
-        String data = null;
-        for (String httpParam: httpParams) {
-            if (httpParam.startsWith("url:")) {
-                url = httpParam.substring(httpParam.indexOf("url:") + 4).trim();
-            }
-            if (httpParam.startsWith("method:")) {
-                method = httpParam.substring(httpParam.indexOf("method:") + 7).trim().toUpperCase();
-            }
-            if (httpParam.startsWith("data:")) {
-                data = httpParam.substring(httpParam.indexOf("data:") + 5).trim();
-            }
-        }
-
-        // param valid
-        if (url==null || url.trim().length()==0) {
-            XxlJobHelper.log("url["+ url +"] invalid.");
-
-            XxlJobHelper.handleFail();
-            return;
-        }
-        if (method==null || !Arrays.asList("GET", "POST").contains(method)) {
-            XxlJobHelper.log("method["+ method +"] invalid.");
-
-            XxlJobHelper.handleFail();
-            return;
-        }
-        boolean isPostMethod = method.equals("POST");
-
-        // request
-        HttpURLConnection connection = null;
-        BufferedReader bufferedReader = null;
-        try {
-            // connection
-            URL realUrl = new URL(url);
-            connection = (HttpURLConnection) realUrl.openConnection();
-
-            // connection setting
-            connection.setRequestMethod(method);
-            connection.setDoOutput(isPostMethod);
-            connection.setDoInput(true);
-            connection.setUseCaches(false);
-            connection.setReadTimeout(5 * 1000);
-            connection.setConnectTimeout(3 * 1000);
-            connection.setRequestProperty("connection", "Keep-Alive");
-            connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
-            connection.setRequestProperty("Accept-Charset", "application/json;charset=UTF-8");
-
-            // do connection
-            connection.connect();
-
-            // data
-            if (isPostMethod && data!=null && data.trim().length()>0) {
-                DataOutputStream dataOutputStream = new DataOutputStream(connection.getOutputStream());
-                dataOutputStream.write(data.getBytes("UTF-8"));
-                dataOutputStream.flush();
-                dataOutputStream.close();
-            }
-
-            // valid StatusCode
-            int statusCode = connection.getResponseCode();
-            if (statusCode != 200) {
-                throw new RuntimeException("Http Request StatusCode(" + statusCode + ") Invalid.");
-            }
-
-            // result
-            bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
-            StringBuilder result = new StringBuilder();
-            String line;
-            while ((line = bufferedReader.readLine()) != null) {
-                result.append(line);
-            }
-            String responseMsg = result.toString();
-
-            XxlJobHelper.log(responseMsg);
-
-            return;
-        } catch (Exception e) {
-            XxlJobHelper.log(e);
-
-            XxlJobHelper.handleFail();
-            return;
-        } finally {
-            try {
-                if (bufferedReader != null) {
-                    bufferedReader.close();
-                }
-                if (connection != null) {
-                    connection.disconnect();
-                }
-            } catch (Exception e2) {
-                XxlJobHelper.log(e2);
-            }
-        }
-
-    }
-
-    /**
-     * 5、生命周期任务示例:任务初始化与销毁时,支持自定义相关逻辑;
-     */
-    @XxlJob(value = "demoJobHandler2", init = "init", destroy = "destroy")
-    public void demoJobHandler2() throws Exception {
-        XxlJobHelper.log("XXL-JOB, Hello World.");
-    }
-    public void init(){
-        logger.info("init");
-    }
-    public void destroy(){
-        logger.info("destroy");
-    }
-
-
-}

+ 0 - 26
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties

@@ -1,26 +0,0 @@
-# web port
-server.port=8081
-# no web
-#spring.main.web-environment=false
-
-# log config
-logging.config=classpath:logback.xml
-
-
-### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
-xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
-
-### xxl-job, access token
-xxl.job.accessToken=
-
-### xxl-job executor appname
-xxl.job.executor.appname=xxl-job-executor-sample
-### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null
-xxl.job.executor.address=
-### xxl-job executor server-info
-xxl.job.executor.ip=
-xxl.job.executor.port=9999
-### xxl-job executor log-path
-xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler
-### xxl-job executor log-retention-days
-xxl.job.executor.logretentiondays=30

+ 0 - 29
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/logback.xml

@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration debug="false" scan="true" scanPeriod="1 seconds">
-
-    <contextName>logback</contextName>
-    <property name="log.path" value="/data/applogs/xxl-job/xxl-job-executor-sample-springboot.log"/>
-
-    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
-            <pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
-        </encoder>
-    </appender>
-
-    <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${log.path}</file>
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern>
-        </rollingPolicy>
-        <encoder>
-            <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n
-            </pattern>
-        </encoder>
-    </appender>
-
-    <root level="info">
-        <appender-ref ref="console"/>
-        <appender-ref ref="file"/>
-    </root>
-
-</configuration>

+ 0 - 14
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/test/java/com/xxl/job/executor/test/XxlJobExecutorExampleBootApplicationTests.java

@@ -1,14 +0,0 @@
-package com.xxl.job.executor.test;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest
-public class XxlJobExecutorExampleBootApplicationTests {
-
-	@Test
-	public void test() {
-		System.out.println(11);
-	}
-
-}