瀏覽代碼

修复以往的定时任务代码。

liyuan 2 年之前
父節點
當前提交
64f05736f2
共有 33 個文件被更改,包括 2808 次插入1631 次删除
  1. 2 1
      .gitignore
  2. 121 0
      ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/BaseJob2.java
  3. 40 40
      ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/ISchedulerLogPersistence.java
  4. 20 20
      ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/ISchedulerStartupService.java
  5. 21 21
      ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/service/AbstractService.java
  6. 63 63
      ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/service/IJobDetailQueryService.java
  7. 79 79
      ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/service/IJobDetailService.java
  8. 53 53
      ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/service/ISchedulerService.java
  9. 20 20
      ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/service/ISchedulerStartupService.java
  10. 68 68
      ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/service/ITriggerQueryService.java
  11. 87 87
      ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/service/ITriggerService.java
  12. 28 26
      ibps-bpmn-root/modules/bpmn-biz/src/main/java/com/lc/ibps/bpmn/job/ReminderJob.java
  13. 1 1
      ibps-bpmn-root/modules/bpmn-biz/src/main/java/com/lc/ibps/bpmn/job/SuperviseDomain.java
  14. 78 78
      ibps-common-root/modules/org-biz/src/main/java/com/lc/ibps/common/quartz/domain/JobDetail.java
  15. 50 50
      ibps-common-root/modules/org-biz/src/main/java/com/lc/ibps/common/quartz/domain/Trigger.java
  16. 112 112
      ibps-common-root/modules/org-biz/src/main/java/com/lc/ibps/common/quartz/repository/impl/JobDetailRepositoryImpl.java
  17. 52 52
      ibps-common-root/modules/org-biz/src/main/java/com/lc/ibps/common/quartz/repository/impl/JobLogRepositoryImpl.java
  18. 97 97
      ibps-common-root/modules/org-biz/src/main/java/com/lc/ibps/common/quartz/repository/impl/TriggerRepositoryImpl.java
  19. 53 53
      ibps-common-root/modules/org-biz/src/main/java/com/lc/ibps/common/quartz/service/impl/SchedulerPersistenceLogImpl.java
  20. 196 0
      ibps-component-root/modules/comp-quartz/src/main/java/com/lc/ibps/components/quartz/config/QuartzConfigure.java
  21. 102 0
      ibps-component-root/modules/comp-quartz/src/main/java/com/lc/ibps/components/quartz/service/impl/JobDetailQueryServiceImpl.java
  22. 172 0
      ibps-component-root/modules/comp-quartz/src/main/java/com/lc/ibps/components/quartz/service/impl/JobDetailServiceImpl.java
  23. 93 0
      ibps-component-root/modules/comp-quartz/src/main/java/com/lc/ibps/components/quartz/service/impl/SchedulerServiceImpl.java
  24. 100 0
      ibps-component-root/modules/comp-quartz/src/main/java/com/lc/ibps/components/quartz/service/impl/TriggerQueryServiceImpl.java
  25. 282 0
      ibps-component-root/modules/comp-quartz/src/main/java/com/lc/ibps/components/quartz/service/impl/TriggerServiceImpl.java
  26. 82 0
      ibps-component-root/modules/comp-quartz/src/main/resources/conf/ibps-component-quartz.xml
  27. 2 1
      ibps-model-root/modules/org-model/src/main/java/com/lc/ibps/common/quartz/vo/JobDetailVo.java
  28. 26 20
      ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/cloud/timer/job/PrintJob.java
  29. 73 55
      ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/cloud/timer/job/RevokeServiceJob.java
  30. 99 99
      ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/cloud/timer/provider/JobLogProvider.java
  31. 286 286
      ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/cloud/timer/provider/JobProvider.java
  32. 67 67
      ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/cloud/timer/provider/SchedulerProvider.java
  33. 183 182
      ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/cloud/timer/provider/TriggerProvider.java

+ 2 - 1
.gitignore

@@ -4,4 +4,5 @@
 *.log
 **/target/**
 /logs/
-/.idea/
+/.idea/
+.run/**

+ 121 - 0
ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/BaseJob2.java

@@ -0,0 +1,121 @@
+package com.lc.ibps.components.quartz;
+
+import java.util.Date;
+
+import org.quartz.DisallowConcurrentExecution;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.quartz.Trigger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.lc.ibps.base.core.util.AppUtil;
+import com.lc.ibps.base.core.util.BeanUtils;
+import com.lc.ibps.components.quartz.model.SchedulerLog;
+
+import cn.hutool.core.date.SystemClock;
+
+/**
+ * 任务执行基类,这个类采用模版模式进行实现。 <br>
+ * 子类继承这个类后,任务执行的日志就会自动记录下来,不需要在子类中在进行记录。
+ *
+ * <pre>
+ * 构建组:ibps-component-quartz
+ * 作者:hugh zhuang
+ * 邮箱:3378340995@qq.com
+ * 日期:2015-10-15-下午3:31:49
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+@DisallowConcurrentExecution
+public abstract class BaseJob2 implements Job {
+
+    private static final Logger log = LoggerFactory.getLogger(BaseJob.class);
+    private ISchedulerLogPersistence schedulerLogPersistence = AppUtil.getBean(ISchedulerLogPersistence.class);
+
+    public BaseJob2() {
+    }
+
+    public abstract void executeJob(JobExecutionContext context)
+            throws Exception;
+
+    /**
+     * 执行日志
+     *
+     * @param context
+     *
+     */
+    public void execute(JobExecutionContext context)
+            throws JobExecutionException {
+        // JobDataMap map= context.getJobDetail().getJobDataMap();
+        String jobName = context.getJobDetail().getKey().getName();
+        String group = context.getJobDetail().getKey().getGroup();
+        String trigName = "directExec";
+        Trigger trig = context.getTrigger();
+        if (trig != null)
+            trigName = trig.getKey().getName();
+        Date strStartTime = new Date();
+        long startTime = SystemClock.now();
+        try {
+            executeJob(context);
+            long endTime = SystemClock.now();
+            Date strEndTime = new Date();
+            // 记录日志
+            long runTime = (endTime - startTime) / 1000;
+            addLog(jobName, trigName,group, strStartTime, strEndTime, runTime,
+                    "任务执行成功!", SchedulerLog.STATE_SUCCESS);
+        } catch (Exception ex) {
+            long endTime = SystemClock.now();
+            Date strEndTime = new Date();
+            long runTime = (endTime - startTime) / 1000;
+            try {
+                addLog(jobName, trigName,group, strStartTime, strEndTime, runTime,
+                        ex.toString(), SchedulerLog.STATE_FAIL);
+            } catch (Exception e) {
+                log.error("执行任务出错:" + e.getMessage());
+            }
+        }
+    }
+
+    /**
+     *
+     * 记录定时器的执行日志
+     *
+     * @param jobName
+     * @param trigName
+     * @param strStartTime
+     * @param strEndTime
+     * @param runTime
+     * @param content
+     * @param state
+     * @throws Exception
+     */
+    private void addLog(String jobName, String trigName, String group, Date strStartTime,
+                        Date strEndTime, long runTime, String content, int state)
+            throws Exception {
+
+        if (BeanUtils.isEmpty(schedulerLogPersistence)) {
+            log.warn("没有实现ISchedulerLog,将不保存执行日志");
+            return;
+        }
+
+        SchedulerLog schedulerLog = schedulerLogPersistence.getSchedulerLog();
+        if (BeanUtils.isEmpty(schedulerLog)) {
+            log.warn("没有初始化:schedulerLog,将不保存执行日志");
+            return;
+        }
+
+        schedulerLog.setJobName(jobName);
+        schedulerLog.setTrigName(trigName);
+        schedulerLog.setGroup(group);
+        schedulerLog.setEndTime(strEndTime);
+        schedulerLog.setStartTime(strStartTime);
+        schedulerLog.setContent(content);
+        schedulerLog.setRunTime(runTime);
+        schedulerLog.setState(state+"");
+
+        schedulerLogPersistence.addLog(schedulerLog);
+    }
+
+}

+ 40 - 40
ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/ISchedulerLogPersistence.java

@@ -1,40 +1,40 @@
-//package com.lc.ibps.components.quartz;
-//
-//import com.lc.ibps.components.quartz.model.SchedulerLog;
-//
-///**
-// * 定时器数据查询或者持久化到第三方数据库的接口
-// *
-// * 接口功能描述:
-// * 1.定时器执行日志实例化
-// * 2.定时器执行日志持久化
-// *
-// * <pre>
-// * 构建组:ibps-component-quartz
-// * 作者:hugh zhuang
-// * 邮箱:3378340995@qq.com
-// * 日期:2015-10-20-上午11:18:55
-// * 版权:广州流辰信息技术有限公司版权所有
-// * </pre>
-// */
-//public interface ISchedulerLogPersistence {
-//
-//	/**
-//	 *
-//	 * 获取定时器执行日志类
-//	 *
-//	 * @return
-//	 * @throws Exception
-//	 */
-//	public  SchedulerLog getSchedulerLog() throws Exception;
-//
-//	/**
-//	 *
-//	 * 持久化定时器执行日志方法
-//	 *
-//	 * @param schedulerLogModel
-//	 */
-//	public  void addLog(SchedulerLog schedulerLogModel);
-//
-//
-//}
+package com.lc.ibps.components.quartz;
+
+import com.lc.ibps.components.quartz.model.SchedulerLog;
+
+/**
+ * 定时器数据查询或者持久化到第三方数据库的接口
+ *
+ * 接口功能描述:
+ * 1.定时器执行日志实例化
+ * 2.定时器执行日志持久化
+ *
+ * <pre>
+ * 构建组:ibps-component-quartz
+ * 作者:hugh zhuang
+ * 邮箱:3378340995@qq.com
+ * 日期:2015-10-20-上午11:18:55
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+public interface ISchedulerLogPersistence {
+
+    /**
+     *
+     * 获取定时器执行日志类
+     *
+     * @return
+     * @throws Exception
+     */
+    public  SchedulerLog getSchedulerLog() throws Exception;
+
+    /**
+     *
+     * 持久化定时器执行日志方法
+     *
+     * @param schedulerLogModel
+     */
+    public  void addLog(SchedulerLog schedulerLogModel);
+
+
+}

+ 20 - 20
ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/ISchedulerStartupService.java

@@ -1,20 +1,20 @@
-//package com.lc.ibps.components.quartz;
-//
-//import java.util.List;
-//
-//import com.lc.ibps.components.quartz.model.IJobDef;
-//
-///**
-// * 第三方数据库启动定时器的接口
-// *
-// * <pre>
-// * 构建组:ibps-component-quartz
-// * 作者:hugh zhuang
-// * 邮箱:3378340995@qq.com
-// * 日期:2015-10-20-上午11:25:47
-// * 版权:广州流辰信息技术有限公司版权所有
-// * </pre>
-// */
-//public interface ISchedulerStartupService {
-//	public void startup(List<IJobDef> jobDefs);
-//}
+package com.lc.ibps.components.quartz;
+
+import java.util.List;
+
+import com.lc.ibps.components.quartz.model.IJobDef;
+
+/**
+ * 第三方数据库启动定时器的接口
+ *
+ * <pre>
+ * 构建组:ibps-component-quartz
+ * 作者:hugh zhuang
+ * 邮箱:3378340995@qq.com
+ * 日期:2015-10-20-上午11:25:47
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+public interface ISchedulerStartupService {
+    public void startup(List<IJobDef> jobDefs);
+}

+ 21 - 21
ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/service/AbstractService.java

@@ -1,21 +1,21 @@
-//package com.lc.ibps.components.quartz.service;
-//
-//import org.quartz.Scheduler;
-//import org.quartz.SchedulerException;
-//
-//public abstract class AbstractService {
-//
-//	protected Scheduler scheduler;
-//
-//	public void setScheduler(Scheduler scheduler) {
-//		this.scheduler = scheduler;
-//	}
-//
-//	protected void verify() throws SchedulerException{
-//		if (scheduler == null)
-//		{
-//			throw new SchedulerException("scheduler 没有配置!");
-//		}
-//	}
-//
-//}
+package com.lc.ibps.components.quartz.service;
+
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+
+public abstract class AbstractService {
+
+    protected Scheduler scheduler;
+
+    public void setScheduler(Scheduler scheduler) {
+        this.scheduler = scheduler;
+    }
+
+    protected void verify() throws SchedulerException{
+        if (scheduler == null)
+        {
+            throw new SchedulerException("scheduler 没有配置!");
+        }
+    }
+
+}

+ 63 - 63
ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/service/IJobDetailQueryService.java

@@ -1,63 +1,63 @@
-//package com.lc.ibps.components.quartz.service;
-//
-//import java.util.List;
-//
-//import org.quartz.JobDetail;
-//import org.quartz.SchedulerException;
-//
-///**
-// * 定时任务查询接口
-// *
-// * <pre>
-// * 构建组:ibps-component-quartz-api
-// * 作者:eddy
-// * 邮箱:xuq@bpmhome.cn
-// * 日期:2018年5月10日-上午9:15:58
-// * 版权:广州流辰信息技术有限公司版权所有
-// * </pre>
-// */
-//public interface IJobDetailQueryService {
-//
-//	/**
-//	 * 判断任务是否存在
-//	 *
-//	 * @param jobName
-//	 * 			任务名
-//	 * @param schedGroup
-//	 * 			分组
-//	 * @return
-//	 * @throws SchedulerException
-//	 */
-//	public boolean isExists(String jobName, String schedGroup) throws SchedulerException;
-//
-//	/**
-//	 * 判断任务是否存在
-//	 *
-//	 * @param jobName
-//	 * 			任务名
-//	 * @param schedGroup
-//	 * 			分组
-//	 * @return
-//	 * @throws SchedulerException
-//	 */
-//	public JobDetail getByJobNameAndGroup(String jobName, String schedGroup) throws SchedulerException;
-//
-//	/**
-//	 * 根据分组查询任务列表
-//	 * schedGroup为空则查询所有
-//	 * @return
-//	 * @throws SchedulerException
-//	 */
-//	public List<JobDetail> findByGroup(String schedGroup) throws SchedulerException;
-//
-//	/**
-//	 * @param jobName
-//	 * 			任务名
-//	 * @param schedGroup
-//	 * 			根据分组查询任务列表,schedGroup为空则查询所有
-//	 * @return
-//	 * @throws SchedulerException
-//	 */
-//	public List<JobDetail> findByJobNameAndGroup(String jobName, String schedGroup) throws SchedulerException;
-//
-//}
+package com.lc.ibps.components.quartz.service;
+
+import java.util.List;
+
+import org.quartz.JobDetail;
+import org.quartz.SchedulerException;
+
+/**
+ * 定时任务查询接口
+ *
+ * <pre>
+ * 构建组:ibps-component-quartz-api
+ * 作者:eddy
+ * 邮箱:xuq@bpmhome.cn
+ * 日期:2018年5月10日-上午9:15:58
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+public interface IJobDetailQueryService {
+
+    /**
+     * 判断任务是否存在
+     *
+     * @param jobName
+     * 			任务名
+     * @param schedGroup
+     * 			分组
+     * @return
+     * @throws SchedulerException
+     */
+    public boolean isExists(String jobName, String schedGroup) throws SchedulerException;
+
+    /**
+     * 判断任务是否存在
+     *
+     * @param jobName
+     * 			任务名
+     * @param schedGroup
+     * 			分组
+     * @return
+     * @throws SchedulerException
+     */
+    public JobDetail getByJobNameAndGroup(String jobName, String schedGroup) throws SchedulerException;
+
+    /**
+     * 根据分组查询任务列表
+     * schedGroup为空则查询所有
+     * @return
+     * @throws SchedulerException
+     */
+    public List<JobDetail> findByGroup(String schedGroup) throws SchedulerException;
+
+    /**
+     * @param jobName
+     * 			任务名
+     * @param schedGroup
+     * 			根据分组查询任务列表,schedGroup为空则查询所有
+     * @return
+     * @throws SchedulerException
+     */
+    public List<JobDetail> findByJobNameAndGroup(String jobName, String schedGroup) throws SchedulerException;
+
+}

+ 79 - 79
ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/service/IJobDetailService.java

@@ -1,79 +1,79 @@
-//package com.lc.ibps.components.quartz.service;
-//
-//import java.util.Map;
-//
-//import org.quartz.SchedulerException;
-//
-///**
-// * 定时任务持久化接口
-// *
-// * <pre>
-// * 构建组:ibps-component-quartz-api
-// * 作者:eddy
-// * 邮箱:xuq@bpmhome.cn
-// * 日期:2018年5月10日-上午9:15:58
-// * 版权:广州流辰信息技术有限公司版权所有
-// * </pre>
-// */
-//public interface IJobDetailService {
-//
-//	/**
-//	 * 添加任务
-//	 *
-//	 * @param jobName
-//	 *            任务名称
-//	 * @param className
-//	 *            类的全路径
-//	 * @param schedGroup
-//	 * 			  分组名称
-//	 * @param parameterMap
-//	 *            参数
-//	 * @param description
-//	 *            任务描述
-//	 * @throws SchedulerException
-//	 */
-//	public void addJob(String jobName, String className, String schedGroup,
-//			Map<String, Object> parameterMap, String description)
-//			throws SchedulerException;
-//
-//
-//	/**
-//	 * 删除任务
-//	 *
-//	 * @param jobName
-//	 * 			  任务名
-//	 * @param schedGroup
-//	 * 			 分组名称
-//	 * @throws SchedulerException
-//	 * @throws ClassNotFoundException
-//	 */
-//	public void delJob(String jobName, String schedGroup) throws SchedulerException;
-//
-//	/**
-//	 * 直接执行任务
-//	 *
-//	 * @param jobName
-//	 * 			任务名称
-//	 * @param schedGroup
-//	 * 			 分组名称
-//	 * @throws SchedulerException
-//	 */
-//	public void execute(String jobName, String schedGroup) throws SchedulerException;
-//
-//	/**
-//	 * 启动任务
-//	 *
-//	 * @return
-//	 * @throws SchedulerException
-//	 */
-//	public boolean run(String jobName, String schedGroup) throws SchedulerException;
-//
-//	/**
-//	 * 停止任务
-//	 *
-//	 * @return
-//	 * @throws SchedulerException
-//	 */
-//	public boolean stop(String jobName, String schedGroup) throws SchedulerException;
-//
-//}
+package com.lc.ibps.components.quartz.service;
+
+import java.util.Map;
+
+import org.quartz.SchedulerException;
+
+/**
+ * 定时任务持久化接口
+ *
+ * <pre>
+ * 构建组:ibps-component-quartz-api
+ * 作者:eddy
+ * 邮箱:xuq@bpmhome.cn
+ * 日期:2018年5月10日-上午9:15:58
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+public interface IJobDetailService {
+
+    /**
+     * 添加任务
+     *
+     * @param jobName
+     *            任务名称
+     * @param className
+     *            类的全路径
+     * @param schedGroup
+     * 			  分组名称
+     * @param parameterMap
+     *            参数
+     * @param description
+     *            任务描述
+     * @throws SchedulerException
+     */
+    public void addJob(String jobName, String className, String schedGroup,
+                       Map<String, Object> parameterMap, String description)
+            throws SchedulerException;
+
+
+    /**
+     * 删除任务
+     *
+     * @param jobName
+     * 			  任务名
+     * @param schedGroup
+     * 			 分组名称
+     * @throws SchedulerException
+     * @throws ClassNotFoundException
+     */
+    public void delJob(String jobName, String schedGroup) throws SchedulerException;
+
+    /**
+     * 直接执行任务
+     *
+     * @param jobName
+     * 			任务名称
+     * @param schedGroup
+     * 			 分组名称
+     * @throws SchedulerException
+     */
+    public void execute(String jobName, String schedGroup) throws SchedulerException;
+
+    /**
+     * 启动任务
+     *
+     * @return
+     * @throws SchedulerException
+     */
+    public boolean run(String jobName, String schedGroup) throws SchedulerException;
+
+    /**
+     * 停止任务
+     *
+     * @return
+     * @throws SchedulerException
+     */
+    public boolean stop(String jobName, String schedGroup) throws SchedulerException;
+
+}

+ 53 - 53
ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/service/ISchedulerService.java

@@ -1,53 +1,53 @@
-//package com.lc.ibps.components.quartz.service;
-//
-//import org.quartz.SchedulerException;
-//
-///**
-// * *
-// *  定时器基本操作功能接口类
-// *
-// *  接口功能描述:
-// * 1.启动、停止定时计划。
-// * 2.启动、停止定时任务。
-// * 3.执行一次定时任务。
-// * 4.启动、停止触发器。
-// *
-// * <pre>
-// * 构建组:ibps-component-quartz
-// * 作者:hugh zhuang
-// * 邮箱:3378340995@qq.com
-// * 日期:2015-10-15-下午3:34:19
-// * 版权:广州流辰信息技术有限公司版权所有
-// * </pre>
-// */
-//public interface ISchedulerService {
-//
-//	/**
-//	 * 启动
-//	 *
-//	 * @throws SchedulerException
-//	 */
-//	public void start() throws SchedulerException;
-//
-//	/**
-//	 * 关闭
-//	 *
-//	 * @throws SchedulerException
-//	 */
-//	public void shutdown() throws SchedulerException;
-//
-//	/**
-//	 * 启动
-//	 *
-//	 * @throws SchedulerException
-//	 */
-//	public boolean isStarted() throws SchedulerException;
-//
-//	/**
-//	 * 关闭
-//	 *
-//	 * @throws SchedulerException
-//	 */
-//	public boolean isShutdown() throws SchedulerException;
-//
-//}
+package com.lc.ibps.components.quartz.service;
+
+import org.quartz.SchedulerException;
+
+/**
+ * *
+ *  定时器基本操作功能接口类
+ *
+ *  接口功能描述:
+ * 1.启动、停止定时计划。
+ * 2.启动、停止定时任务。
+ * 3.执行一次定时任务。
+ * 4.启动、停止触发器。
+ *
+ * <pre>
+ * 构建组:ibps-component-quartz
+ * 作者:hugh zhuang
+ * 邮箱:3378340995@qq.com
+ * 日期:2015-10-15-下午3:34:19
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+public interface ISchedulerService {
+
+    /**
+     * 启动
+     *
+     * @throws SchedulerException
+     */
+    public void start() throws SchedulerException;
+
+    /**
+     * 关闭
+     *
+     * @throws SchedulerException
+     */
+    public void shutdown() throws SchedulerException;
+
+    /**
+     * 启动
+     *
+     * @throws SchedulerException
+     */
+    public boolean isStarted() throws SchedulerException;
+
+    /**
+     * 关闭
+     *
+     * @throws SchedulerException
+     */
+    public boolean isShutdown() throws SchedulerException;
+
+}

+ 20 - 20
ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/service/ISchedulerStartupService.java

@@ -1,20 +1,20 @@
-//package com.lc.ibps.components.quartz.service;
-//
-//import java.util.List;
-//
-//import com.lc.ibps.components.quartz.model.IJobDef;
-//
-///**
-// * 第三方数据库启动定时器的接口
-// *
-// * <pre>
-// * 构建组:ibps-component-quartz
-// * 作者:hugh zhuang
-// * 邮箱:3378340995@qq.com
-// * 日期:2015-10-20-上午11:25:47
-// * 版权:广州流辰信息技术有限公司版权所有
-// * </pre>
-// */
-//public interface ISchedulerStartupService {
-//	public void startup(List<IJobDef> jobDefs);
-//}
+package com.lc.ibps.components.quartz.service;
+
+import java.util.List;
+
+import com.lc.ibps.components.quartz.model.IJobDef;
+
+/**
+ * 第三方数据库启动定时器的接口
+ *
+ * <pre>
+ * 构建组:ibps-component-quartz
+ * 作者:hugh zhuang
+ * 邮箱:3378340995@qq.com
+ * 日期:2015-10-20-上午11:25:47
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+public interface ISchedulerStartupService {
+    public void startup(List<IJobDef> jobDefs);
+}

+ 68 - 68
ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/service/ITriggerQueryService.java

@@ -1,68 +1,68 @@
-//package com.lc.ibps.components.quartz.service;
-//
-//import java.util.HashMap;
-//import java.util.List;
-//
-//import org.quartz.SchedulerException;
-//import org.quartz.Trigger;
-//
-///**
-// * 定时计划查询接口
-// *
-// * <pre>
-// * 构建组:ibps-component-quartz-api
-// * 作者:eddy
-// * 邮箱:xuq@bpmhome.cn
-// * 日期:2018年5月10日-上午9:15:58
-// * 版权:广州流辰信息技术有限公司版权所有
-// * </pre>
-// */
-//public interface ITriggerQueryService {
-//
-//	/**
-//	 * 判断计划是否存在
-//	 *
-//	 * @param triggerName
-//	 *            触发器名称
-//	 * @param schedGroup
-//	 * 			  分组名称
-//	 * @return
-//	 * @throws SchedulerException
-//	 */
-//	public boolean isTriggerExists(String triggerName ,String schedGroup) throws SchedulerException ;
-//
-//	/**
-//	 * 获取计划
-//	 *
-//	 * @param triggerName
-//	 *            触发器名称
-//	 * @param schedGroup
-//	 * 			  分组名称
-//	 * @return
-//	 * @throws SchedulerException
-//	 */
-//	public Trigger getTrigger(String triggerName ,String schedGroup) throws SchedulerException ;
-//
-//	/**
-//	 * 根据任务名称获取触发器
-//	 *
-//	 * @param jobName
-//	 * 			   任务名称
-//	 * @param schedGroup
-//	 * 			  分组名称
-//	 * @return
-//	 * @throws SchedulerException
-//	 */
-//	public List<Trigger> findTriggersByJob(String jobName ,String schedGroup) throws SchedulerException;
-//
-//	/**
-//	 * 取得触发器的状态
-//	 *
-//	 * @param list
-//	 * @return
-//	 * @throws SchedulerException
-//	 */
-//	public HashMap<String, Trigger.TriggerState> getTriggerStatus(
-//			List<Trigger> list) throws SchedulerException;
-//
-//}
+package com.lc.ibps.components.quartz.service;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.quartz.SchedulerException;
+import org.quartz.Trigger;
+
+/**
+ * 定时计划查询接口
+ *
+ * <pre>
+ * 构建组:ibps-component-quartz-api
+ * 作者:eddy
+ * 邮箱:xuq@bpmhome.cn
+ * 日期:2018年5月10日-上午9:15:58
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+public interface ITriggerQueryService {
+
+    /**
+     * 判断计划是否存在
+     *
+     * @param triggerName
+     *            触发器名称
+     * @param schedGroup
+     * 			  分组名称
+     * @return
+     * @throws SchedulerException
+     */
+    public boolean isTriggerExists(String triggerName ,String schedGroup) throws SchedulerException ;
+
+    /**
+     * 获取计划
+     *
+     * @param triggerName
+     *            触发器名称
+     * @param schedGroup
+     * 			  分组名称
+     * @return
+     * @throws SchedulerException
+     */
+    public Trigger getTrigger(String triggerName ,String schedGroup) throws SchedulerException ;
+
+    /**
+     * 根据任务名称获取触发器
+     *
+     * @param jobName
+     * 			   任务名称
+     * @param schedGroup
+     * 			  分组名称
+     * @return
+     * @throws SchedulerException
+     */
+    public List<Trigger> findTriggersByJob(String jobName ,String schedGroup) throws SchedulerException;
+
+    /**
+     * 取得触发器的状态
+     *
+     * @param list
+     * @return
+     * @throws SchedulerException
+     */
+    public HashMap<String, Trigger.TriggerState> getTriggerStatus(
+            List<Trigger> list) throws SchedulerException;
+
+}

+ 87 - 87
ibps-base-root/modules/base-quartz/src/main/java/com/lc/ibps/components/quartz/service/ITriggerService.java

@@ -1,87 +1,87 @@
-//package com.lc.ibps.components.quartz.service;
-//
-//import java.text.ParseException;
-//
-//import org.quartz.SchedulerException;
-//
-///**
-// * 定时计划持久化接口
-// *
-// * <pre>
-// * 构建组:ibps-component-quartz-api
-// * 作者:eddy
-// * 邮箱:xuq@bpmhome.cn
-// * 日期:2018年5月10日-上午9:15:58
-// * 版权:广州流辰信息技术有限公司版权所有
-// * </pre>
-// */
-//public interface ITriggerService {
-//
-//	/**
-//	 * 添加计划
-//	 *
-//	 * @param jobName
-//	 *            任务名
-//	 * @param triggerName
-//	 *            计划名
-//	 * @param planJson
-//	 *
-//	 * @param schedGroup
-//	 * 			 分组名称
-//	 * @throws SchedulerException
-//	 * @throws ParseException
-//	 */
-//	public void addTrigger(String jobName, String triggerName, String planJson, String schedGroup)
-//			throws SchedulerException, ParseException;
-//
-//	/**
-//	 * 添加计划
-//	 *
-//	 * @param jobName
-//	 *            任务名
-//	 * @param triggerName
-//	 *            计划名
-//	 *
-//	 * @param schedGroup
-//	 * 			 分组名称
-//	 * @throws SchedulerException
-//	 * @throws ParseException
-//	 */
-//	public void addTrigger(String jobName, String triggerName, String schedGroup)
-//			throws SchedulerException, ParseException;
-//
-//	/**
-//	 * 删除计划
-//	 *
-//	 * @param triggerName
-//	 *            触发器名称
-//	  * @param schedGroup
-//	 * 			  分组名称
-//	 * @throws SchedulerException
-//	 * @throws ClassNotFoundException
-//	 */
-//	public void delTrigger(String triggerName ,String schedGroup) throws SchedulerException;
-//
-//	/**
-//	 * 启动触发器
-//	 *
-//	 * @param triggerName
-//	 * 			  触发器名称
-//	 * @param schedGroup
-//	 * 			 分组名称
-//	 * @throws SchedulerException
-//	 */
-//	public boolean run(String triggerName, String schedGroup) throws SchedulerException;
-//
-//	/**
-//	 * 停止或暂停触发器
-//	 *
-//	 * @param triggerName
-//	 * 			  触发器名称
-//	 * @param schedGroup
-//	 * 			 分组名称
-//	 * @throws SchedulerException
-//	 */
-//	public boolean stop(String triggerName, String schedGroup) throws SchedulerException;
-//
-//}
+package com.lc.ibps.components.quartz.service;
+
+import java.text.ParseException;
+
+import org.quartz.SchedulerException;
+
+/**
+ * 定时计划持久化接口
+ *
+ * <pre>
+ * 构建组:ibps-component-quartz-api
+ * 作者:eddy
+ * 邮箱:xuq@bpmhome.cn
+ * 日期:2018年5月10日-上午9:15:58
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+public interface ITriggerService {
+
+    /**
+     * 添加计划
+     *
+     * @param jobName
+     *            任务名
+     * @param triggerName
+     *            计划名
+     * @param planJson
+     *
+     * @param schedGroup
+     * 			 分组名称
+     * @throws SchedulerException
+     * @throws ParseException
+     */
+    public void addTrigger(String jobName, String triggerName, String planJson, String schedGroup)
+            throws SchedulerException, ParseException;
+
+    /**
+     * 添加计划
+     *
+     * @param jobName
+     *            任务名
+     * @param triggerName
+     *            计划名
+     *
+     * @param schedGroup
+     * 			 分组名称
+     * @throws SchedulerException
+     * @throws ParseException
+     */
+    public void addTrigger(String jobName, String triggerName, String schedGroup)
+            throws SchedulerException, ParseException;
+
+    /**
+     * 删除计划
+     *
+     * @param triggerName
+     *            触发器名称
+     * @param schedGroup
+     * 			  分组名称
+     * @throws SchedulerException
+     * @throws ClassNotFoundException
+     */
+    public void delTrigger(String triggerName ,String schedGroup) throws SchedulerException;
+
+    /**
+     * 启动触发器
+     *
+     * @param triggerName
+     * 			  触发器名称
+     * @param schedGroup
+     * 			 分组名称
+     * @throws SchedulerException
+     */
+    public boolean run(String triggerName, String schedGroup) throws SchedulerException;
+
+    /**
+     * 停止或暂停触发器
+     *
+     * @param triggerName
+     * 			  触发器名称
+     * @param schedGroup
+     * 			 分组名称
+     * @throws SchedulerException
+     */
+    public boolean stop(String triggerName, String schedGroup) throws SchedulerException;
+
+}

+ 28 - 26
ibps-bpmn-root/modules/bpmn-biz/src/main/java/com/lc/ibps/bpmn/job/ReminderJob.java

@@ -1,26 +1,28 @@
-//package com.lc.ibps.bpmn.job;
-//
-//import com.lc.ibps.base.core.util.AppUtil;
-//
-///**
-// * 催办操作-定时任务
-// *
-// * <pre>
-// * 构建组:ibps-bpmn-biz
-// * 作者:eddy
-// * 邮箱:xuq@bpmhome.cn
-// * 日期:2019年9月5日-下午6:05:39
-// * 版权:广州流辰信息技术有限公司版权所有
-// * </pre>
-// */
-//public class ReminderJob extends BaseJob {
-//
-//	private ReminderDomain reminderDomain = AppUtil.getBean(ReminderDomain.class);
-//
-//	@Override
-//	public void executeJob() throws Exception {
-//		reminderDomain.execute();
-//	}
-//
-//
-//}
+package com.lc.ibps.bpmn.job;
+
+import com.lc.ibps.components.quartz.BaseJob2;
+import org.quartz.JobExecutionContext;
+
+import com.lc.ibps.base.core.util.AppUtil;
+
+/**
+ * 催办操作-定时任务
+ *
+ * <pre>
+ * 构建组:ibps-bpmn-biz
+ * 作者:eddy
+ * 邮箱:xuq@bpmhome.cn
+ * 日期:2019年9月5日-下午6:05:39
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+public class ReminderJob extends BaseJob2 {
+
+    private ReminderDomain reminderDomain = AppUtil.getBean(ReminderDomain.class);
+
+    @Override
+    public void executeJob(JobExecutionContext context) throws Exception {
+        reminderDomain.execute();
+    }
+
+}

+ 1 - 1
ibps-bpmn-root/modules/bpmn-biz/src/main/java/com/lc/ibps/bpmn/job/SuperviseDomain.java

@@ -64,7 +64,7 @@ import com.lc.ibps.org.vo.ExtractUserVo;
 import com.lc.ibps.org.vo.IdKeyVo;
 
 /** 
- * 督办处理
+ * 督办处理pr
  *
  * <pre> 
  * 构建组:ibps-bpmn-biz

+ 78 - 78
ibps-common-root/modules/org-biz/src/main/java/com/lc/ibps/common/quartz/domain/JobDetail.java

@@ -1,78 +1,78 @@
-//package com.lc.ibps.common.quartz.domain;
-//
-//import java.util.List;
-//
-//import javax.annotation.Resource;
-//
-//import org.quartz.SchedulerException;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.springframework.transaction.annotation.Transactional;
-//
-//import com.lc.ibps.base.core.exception.BaseException;
-//import com.lc.ibps.base.core.util.BeanUtils;
-//import com.lc.ibps.base.core.util.JacksonUtil;
-//import com.lc.ibps.components.quartz.service.IJobDetailService;
-//import com.lc.ibps.components.quartz.service.ITriggerQueryService;
-//import com.lc.ibps.components.quartz.service.ITriggerService;
-//
-//@Transactional
-//public class JobDetail {
-//
-//	private static final Logger logger = LoggerFactory.getLogger(JobDetail.class);
-//	@Resource
-//	private IJobDetailService jobDetailService;
-//	@Resource
-//	private ITriggerQueryService triggerQueryService;
-//	@Resource
-//	private ITriggerService triggerService;
-//
-//	public void create(String jobName, String group, String jobClass, String parameterJson, String description)
-//			throws SchedulerException, ClassNotFoundException {
-//		if(JacksonUtil.isNotEmpty(parameterJson) && JacksonUtil.isNotJsonObject(parameterJson)) {
-//			throw new BaseException("invalid json <" + parameterJson + ">.");
-//		}
-//		jobDetailService.addJob(jobName, jobClass, group, JacksonUtil.toMap(parameterJson), description);
-//	}
-//
-//	public void update(String jobName, String group, String jobClass, String parameterJson, String description)
-//			throws SchedulerException, ClassNotFoundException {
-//		if(JacksonUtil.isNotEmpty(parameterJson) && JacksonUtil.isNotJsonObject(parameterJson)) {
-//			throw new BaseException("invalid json <" + parameterJson + ">.");
-//		}
-//		jobDetailService.delJob(jobName, group);
-//		jobDetailService.addJob(jobName, jobClass, group, JacksonUtil.toMap(parameterJson), description);
-//	}
-//
-//	public void remove(String[] jobNames, String[] groups) throws SchedulerException {
-//		if(BeanUtils.isEmpty(jobNames)
-//				|| BeanUtils.isEmpty(groups)
-//				|| jobNames.length != groups.length){
-//			throw new RuntimeException("参数不完整");
-//		}
-//
-//		for(int i = 0, len = jobNames.length; i < len; i ++)
-//		{
-//	        List<org.quartz.Trigger> triggers = triggerQueryService.findTriggersByJob(jobNames[i], groups[i]);
-//	        if(BeanUtils.isNotEmpty(triggers))
-//	        {
-//	        	for(org.quartz.Trigger trigger : triggers)
-//	        	{
-//	        		// 停止触发器
-//	        		triggerService.stop(trigger.getKey().getName(), trigger.getKey().getGroup());
-//	        		// 移除触发器
-//	        		triggerService.delTrigger(trigger.getKey().getName(), trigger.getKey().getGroup());
-//	        		logger.debug("group {} trigger {} removed.", trigger.getKey().getGroup(), trigger.getKey().getName());
-//	        	}
-//	        }
-//	        jobDetailService.stop(jobNames[i], groups[i]);
-//			jobDetailService.delJob(jobNames[i], groups[i]);
-//			logger.debug("group {} job {} removed.", groups[i], jobNames[i]);
-//		}
-//	}
-//
-//	public void execute(String jobName, String schedGroup) throws SchedulerException {
-//		jobDetailService.execute(jobName, schedGroup);
-//	}
-//
-//}
+package com.lc.ibps.common.quartz.domain;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.quartz.SchedulerException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.lc.ibps.base.core.exception.BaseException;
+import com.lc.ibps.base.core.util.BeanUtils;
+import com.lc.ibps.base.core.util.JacksonUtil;
+import com.lc.ibps.components.quartz.service.IJobDetailService;
+import com.lc.ibps.components.quartz.service.ITriggerQueryService;
+import com.lc.ibps.components.quartz.service.ITriggerService;
+
+@Transactional
+public class JobDetail {
+
+	private static final Logger logger = LoggerFactory.getLogger(JobDetail.class);
+	@Resource
+	private IJobDetailService jobDetailService;
+	@Resource
+	private ITriggerQueryService triggerQueryService;
+	@Resource
+	private ITriggerService triggerService;
+
+	public void create(String jobName, String group, String jobClass, String parameterJson, String description)
+			throws SchedulerException, ClassNotFoundException {
+		if(JacksonUtil.isNotEmpty(parameterJson) && JacksonUtil.isNotJsonObject(parameterJson)) {
+			throw new BaseException("invalid json <" + parameterJson + ">.");
+		}
+		jobDetailService.addJob(jobName, jobClass, group, JacksonUtil.toMap(parameterJson), description);
+	}
+
+	public void update(String jobName, String group, String jobClass, String parameterJson, String description)
+			throws SchedulerException, ClassNotFoundException {
+		if(JacksonUtil.isNotEmpty(parameterJson) && JacksonUtil.isNotJsonObject(parameterJson)) {
+			throw new BaseException("invalid json <" + parameterJson + ">.");
+		}
+		jobDetailService.delJob(jobName, group);
+		jobDetailService.addJob(jobName, jobClass, group, JacksonUtil.toMap(parameterJson), description);
+	}
+
+	public void remove(String[] jobNames, String[] groups) throws SchedulerException {
+		if(BeanUtils.isEmpty(jobNames)
+				|| BeanUtils.isEmpty(groups)
+				|| jobNames.length != groups.length){
+			throw new RuntimeException("参数不完整");
+		}
+
+		for(int i = 0, len = jobNames.length; i < len; i ++)
+		{
+	        List<org.quartz.Trigger> triggers = triggerQueryService.findTriggersByJob(jobNames[i], groups[i]);
+	        if(BeanUtils.isNotEmpty(triggers))
+	        {
+	        	for(org.quartz.Trigger trigger : triggers)
+	        	{
+	        		// 停止触发器
+	        		triggerService.stop(trigger.getKey().getName(), trigger.getKey().getGroup());
+	        		// 移除触发器
+	        		triggerService.delTrigger(trigger.getKey().getName(), trigger.getKey().getGroup());
+	        		logger.debug("group {} trigger {} removed.", trigger.getKey().getGroup(), trigger.getKey().getName());
+	        	}
+	        }
+	        jobDetailService.stop(jobNames[i], groups[i]);
+			jobDetailService.delJob(jobNames[i], groups[i]);
+			logger.debug("group {} job {} removed.", groups[i], jobNames[i]);
+		}
+	}
+
+	public void execute(String jobName, String schedGroup) throws SchedulerException {
+		jobDetailService.execute(jobName, schedGroup);
+	}
+
+}

+ 50 - 50
ibps-common-root/modules/org-biz/src/main/java/com/lc/ibps/common/quartz/domain/Trigger.java

@@ -1,50 +1,50 @@
-//package com.lc.ibps.common.quartz.domain;
-//
-//import java.text.ParseException;
-//
-//import javax.annotation.Resource;
-//
-//import org.quartz.SchedulerException;
-//import org.springframework.transaction.annotation.Transactional;
-//
-//import com.lc.ibps.base.core.util.BeanUtils;
-//import com.lc.ibps.components.quartz.service.ITriggerService;
-//
-//@Transactional
-//public class Trigger {
-//
-//	@Resource
-//	private ITriggerService triggerService;
-//
-//	public void create(String jobName, String triggerName, String planJson, String schedGroup)
-//			throws SchedulerException, ClassNotFoundException, ParseException {
-//		triggerService.addTrigger(jobName, triggerName, planJson, schedGroup);
-//	}
-//
-//	public void create(String jobName, String triggerName, String schedGroup)
-//			throws SchedulerException, ClassNotFoundException, ParseException {
-//		triggerService.addTrigger(jobName, triggerName, schedGroup);
-//	}
-//
-//	public void remove(String[] triggerNames, String[] groups) throws SchedulerException {
-//		if(BeanUtils.isEmpty(triggerNames)
-//				|| BeanUtils.isEmpty(groups)
-//				|| triggerNames.length != groups.length){
-//			throw new RuntimeException("参数不完整");
-//		}
-//
-//		for(int i = 0, len = triggerNames.length; i < len; i ++)
-//		{
-//			triggerService.delTrigger(triggerNames[i], groups[i]);
-//		}
-//	}
-//
-//	public boolean start(String triggerName, String schedGroup) throws SchedulerException {
-//		return triggerService.run(triggerName, schedGroup);
-//	}
-//
-//	public boolean stop(String triggerName, String schedGroup) throws SchedulerException {
-//		return triggerService.stop(triggerName, schedGroup);
-//	}
-//
-//}
+package com.lc.ibps.common.quartz.domain;
+
+import java.text.ParseException;
+
+import javax.annotation.Resource;
+
+import org.quartz.SchedulerException;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.lc.ibps.base.core.util.BeanUtils;
+import com.lc.ibps.components.quartz.service.ITriggerService;
+
+@Transactional
+public class Trigger {
+
+    @Resource
+    private ITriggerService triggerService;
+
+    public void create(String jobName, String triggerName, String planJson, String schedGroup)
+            throws SchedulerException, ClassNotFoundException, ParseException {
+        triggerService.addTrigger(jobName, triggerName, planJson, schedGroup);
+    }
+
+    public void create(String jobName, String triggerName, String schedGroup)
+            throws SchedulerException, ClassNotFoundException, ParseException {
+        triggerService.addTrigger(jobName, triggerName, schedGroup);
+    }
+
+    public void remove(String[] triggerNames, String[] groups) throws SchedulerException {
+        if(BeanUtils.isEmpty(triggerNames)
+                || BeanUtils.isEmpty(groups)
+                || triggerNames.length != groups.length){
+            throw new RuntimeException("参数不完整");
+        }
+
+        for(int i = 0, len = triggerNames.length; i < len; i ++)
+        {
+            triggerService.delTrigger(triggerNames[i], groups[i]);
+        }
+    }
+
+    public boolean start(String triggerName, String schedGroup) throws SchedulerException {
+        return triggerService.run(triggerName, schedGroup);
+    }
+
+    public boolean stop(String triggerName, String schedGroup) throws SchedulerException {
+        return triggerService.stop(triggerName, schedGroup);
+    }
+
+}

+ 112 - 112
ibps-common-root/modules/org-biz/src/main/java/com/lc/ibps/common/quartz/repository/impl/JobDetailRepositoryImpl.java

@@ -1,112 +1,112 @@
-//package com.lc.ibps.common.quartz.repository.impl;
-//
-//import java.util.ArrayList;
-//import java.util.Arrays;
-//import java.util.HashMap;
-//import java.util.List;
-//import java.util.Map;
-//
-//import javax.annotation.Resource;
-//
-//import org.quartz.JobDetail;
-//import org.quartz.SchedulerException;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.springframework.context.annotation.Lazy;
-//import org.springframework.stereotype.Repository;
-//
-//import com.lc.ibps.api.base.page.Page;
-//import com.lc.ibps.base.core.constants.StringPool;
-//import com.lc.ibps.base.core.util.AppUtil;
-//import com.lc.ibps.base.core.util.BeanUtils;
-//import com.lc.ibps.base.framework.page.PageList;
-//import com.lc.ibps.base.framework.page.PageResult;
-//import com.lc.ibps.common.quartz.builder.JobDetailVoBuilder;
-//import com.lc.ibps.common.quartz.repository.JobDetailRepository;
-//import com.lc.ibps.common.quartz.vo.JobDetailVo;
-//import com.lc.ibps.components.quartz.service.IJobDetailQueryService;
-//
-//@Repository
-//public class JobDetailRepositoryImpl implements JobDetailRepository {
-//
-//	private static final Logger logger = LoggerFactory.getLogger(JobDetailRepositoryImpl.class);
-//	@Resource
-//	@Lazy
-//	private IJobDetailQueryService jobDetailQueryService;
-//
-//	@Override
-//	public List<JobDetailVo> query(String jobName, String schedGroup, Page page) throws SchedulerException {
-//		List<JobDetailVo> list = findByJobNameAndGroup(jobName, schedGroup);
-//
-//		// 分页大小
-//		final int limit = page.getPageSize();
-//		// 页码
-//		final int pageNo = page.getPageNo();
-//		// 总记录数
-//		final int totalCount = list.size();
-//		PageResult pageResult = new PageResult(pageNo, limit, totalCount);
-//		final int offset = pageResult.getOffset();
-//		int totalPages = pageResult.getTotalPages();
-//		int currentLimit = pageNo == totalPages ? totalCount % limit : limit;
-//		logger.debug("totalCount is {}, totalPages is {}, pageNo is {}, limit is {}, offset is {}, currentLimit is {}.",
-//				totalCount, totalPages, pageNo, limit, offset, currentLimit);
-//
-//		List<JobDetailVo> data = new ArrayList<JobDetailVo>();
-//		if(totalCount > 0 && offset <= totalCount)
-//		{
-//			data.addAll(list.subList(offset, offset + currentLimit));
-//		}
-//
-//		PageList<JobDetailVo> result = new PageList<JobDetailVo>(data, pageResult);
-//
-//		return result;
-//	}
-//
-//	@Override
-//	public List<JobDetailVo> findByJobNameAndGroup(String jobName, String schedGroup) throws SchedulerException {
-//		List<JobDetail> JobDetailList = jobDetailQueryService.findByJobNameAndGroup(jobName, schedGroup);
-//
-//		List<JobDetailVo> list = new ArrayList<JobDetailVo>();
-//		for (JobDetail jobDetail : JobDetailList) {
-//			JobDetailVo jobDetailVo = JobDetailVoBuilder.build(jobDetail);
-//			list.add(jobDetailVo);
-//		}
-//
-//		return list;
-//	}
-//
-//	@Override
-//	public boolean isExists(String jobName, String schedGroup) throws SchedulerException {
-//		return jobDetailQueryService.isExists(jobName, schedGroup);
-//	}
-//
-//	@Override
-//	public JobDetailVo getByJobNameAndGroup(String jobName, String schedGroup) throws SchedulerException {
-//		JobDetail jobDetail = jobDetailQueryService.getByJobNameAndGroup(jobName, schedGroup);
-//		return JobDetailVoBuilder.build(jobDetail);
-//	}
-//
-//	@Override
-//	public List<String> getAllGroups() {
-//		String group = AppUtil.getProperty("quartz.group", "group1");
-//		String[] groups = group.split(StringPool.COMMA);
-//
-//		return Arrays.asList(groups);
-//	}
-//
-//	@Override
-//	public Map<String, List<String>> findAllJobNameMap() throws SchedulerException {
-//		List<JobDetail> findJobList = jobDetailQueryService.findByGroup("");
-//		Map<String, List<String>> jobNameMap = new HashMap<String, List<String>>();
-//		for (JobDetail jobDetail : findJobList) {
-//			List<String> list = jobNameMap.get(jobDetail.getKey().getGroup());
-//			if (BeanUtils.isEmpty(list)) {
-//				list = new ArrayList<String>();
-//			}
-//			list.add(jobDetail.getKey().getName());
-//			jobNameMap.put(jobDetail.getKey().getGroup(), list);
-//		}
-//		return jobNameMap;
-//	}
-//
-//}
+package com.lc.ibps.common.quartz.repository.impl;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.quartz.JobDetail;
+import org.quartz.SchedulerException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Repository;
+
+import com.lc.ibps.api.base.page.Page;
+import com.lc.ibps.base.core.constants.StringPool;
+import com.lc.ibps.base.core.util.AppUtil;
+import com.lc.ibps.base.core.util.BeanUtils;
+import com.lc.ibps.base.framework.page.PageList;
+import com.lc.ibps.base.framework.page.PageResult;
+import com.lc.ibps.common.quartz.builder.JobDetailVoBuilder;
+import com.lc.ibps.common.quartz.repository.JobDetailRepository;
+import com.lc.ibps.common.quartz.vo.JobDetailVo;
+import com.lc.ibps.components.quartz.service.IJobDetailQueryService;
+
+@Repository
+public class JobDetailRepositoryImpl implements JobDetailRepository {
+
+	private static final Logger logger = LoggerFactory.getLogger(JobDetailRepositoryImpl.class);
+	@Resource
+	@Lazy
+	private IJobDetailQueryService jobDetailQueryService;
+
+	@Override
+	public List<JobDetailVo> query(String jobName, String schedGroup, Page page) throws SchedulerException {
+		List<JobDetailVo> list = findByJobNameAndGroup(jobName, schedGroup);
+
+		// 分页大小
+		final int limit = page.getPageSize();
+		// 页码
+		final int pageNo = page.getPageNo();
+		// 总记录数
+		final int totalCount = list.size();
+		PageResult pageResult = new PageResult(pageNo, limit, totalCount);
+		final int offset = pageResult.getOffset();
+		int totalPages = pageResult.getTotalPages();
+		int currentLimit = pageNo == totalPages ? totalCount % limit : limit;
+		logger.debug("totalCount is {}, totalPages is {}, pageNo is {}, limit is {}, offset is {}, currentLimit is {}.",
+				totalCount, totalPages, pageNo, limit, offset, currentLimit);
+
+		List<JobDetailVo> data = new ArrayList<JobDetailVo>();
+		if(totalCount > 0 && offset <= totalCount)
+		{
+			data.addAll(list.subList(offset, offset + currentLimit));
+		}
+
+		PageList<JobDetailVo> result = new PageList<JobDetailVo>(data, pageResult);
+
+		return result;
+	}
+
+	@Override
+	public List<JobDetailVo> findByJobNameAndGroup(String jobName, String schedGroup) throws SchedulerException {
+		List<JobDetail> JobDetailList = jobDetailQueryService.findByJobNameAndGroup(jobName, schedGroup);
+
+		List<JobDetailVo> list = new ArrayList<JobDetailVo>();
+		for (JobDetail jobDetail : JobDetailList) {
+			JobDetailVo jobDetailVo = JobDetailVoBuilder.build(jobDetail);
+			list.add(jobDetailVo);
+		}
+
+		return list;
+	}
+
+	@Override
+	public boolean isExists(String jobName, String schedGroup) throws SchedulerException {
+		return jobDetailQueryService.isExists(jobName, schedGroup);
+	}
+
+	@Override
+	public JobDetailVo getByJobNameAndGroup(String jobName, String schedGroup) throws SchedulerException {
+		JobDetail jobDetail = jobDetailQueryService.getByJobNameAndGroup(jobName, schedGroup);
+		return JobDetailVoBuilder.build(jobDetail);
+	}
+
+	@Override
+	public List<String> getAllGroups() {
+		String group = AppUtil.getProperty("quartz.group", "group1");
+		String[] groups = group.split(StringPool.COMMA);
+
+		return Arrays.asList(groups);
+	}
+
+	@Override
+	public Map<String, List<String>> findAllJobNameMap() throws SchedulerException {
+		List<JobDetail> findJobList = jobDetailQueryService.findByGroup("");
+		Map<String, List<String>> jobNameMap = new HashMap<String, List<String>>();
+		for (JobDetail jobDetail : findJobList) {
+			List<String> list = jobNameMap.get(jobDetail.getKey().getGroup());
+			if (BeanUtils.isEmpty(list)) {
+				list = new ArrayList<String>();
+			}
+			list.add(jobDetail.getKey().getName());
+			jobNameMap.put(jobDetail.getKey().getGroup(), list);
+		}
+		return jobNameMap;
+	}
+
+}

+ 52 - 52
ibps-common-root/modules/org-biz/src/main/java/com/lc/ibps/common/quartz/repository/impl/JobLogRepositoryImpl.java

@@ -1,52 +1,52 @@
-//package com.lc.ibps.common.quartz.repository.impl;
-//
-//import javax.annotation.Resource;
-//
-//import org.springframework.stereotype.Repository;
-//
-//import com.lc.ibps.base.core.util.AppUtil;
-//import com.lc.ibps.base.framework.persistence.dao.IQueryDao;
-//import com.lc.ibps.base.framework.repository.AbstractRepository;
-//import com.lc.ibps.common.quartz.domain.JobLog;
-//import com.lc.ibps.common.quartz.persistence.dao.JobLogQueryDao;
-//import com.lc.ibps.common.quartz.persistence.entity.JobLogPo;
-//import com.lc.ibps.common.quartz.repository.JobLogRepository;
-//
-///**
-// * 定时器运行日志仓库查询实现类
-// *
-// * <pre>
-// * 构建组:ibps-common-biz
-// * 作者:simon cai
-// * 邮箱:simon1498@qq.com
-// * 日期:2016年9月20日-下午4:50:25
-// * 版权:广州流辰信息技术有限公司版权所有
-// * </pre>
-// */
-//@Repository
-//public class JobLogRepositoryImpl extends AbstractRepository<String, JobLogPo,JobLog> implements JobLogRepository{
-//
-//	@Resource
-//	private JobLogQueryDao jobLogQueryDao;
-//
-//	@Override
-//	public JobLog newInstance() {
-//		JobLogPo JobLogPo = new JobLogPo();
-//		JobLog JobLog = AppUtil.getBean(JobLog.class);
-//		JobLog.setData(JobLogPo);
-//		return JobLog;
-//	}
-//
-//	@Override
-//	public JobLog newInstance(JobLogPo po) {
-//		JobLog JobLog = AppUtil.getBean(JobLog.class);
-//		JobLog.setData(po);
-//		return JobLog;
-//	}
-//
-//	@Override
-//	protected IQueryDao<String, JobLogPo> getQueryDao() {
-//		return jobLogQueryDao;
-//	}
-//
-//}
+package com.lc.ibps.common.quartz.repository.impl;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Repository;
+
+import com.lc.ibps.base.core.util.AppUtil;
+import com.lc.ibps.base.framework.persistence.dao.IQueryDao;
+import com.lc.ibps.base.framework.repository.AbstractRepository;
+import com.lc.ibps.common.quartz.domain.JobLog;
+import com.lc.ibps.common.quartz.persistence.dao.JobLogQueryDao;
+import com.lc.ibps.common.quartz.persistence.entity.JobLogPo;
+import com.lc.ibps.common.quartz.repository.JobLogRepository;
+
+/**
+ * 定时器运行日志仓库查询实现类
+ *
+ * <pre>
+ * 构建组:ibps-common-biz
+ * 作者:simon cai
+ * 邮箱:simon1498@qq.com
+ * 日期:2016年9月20日-下午4:50:25
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+@Repository
+public class JobLogRepositoryImpl extends AbstractRepository<String, JobLogPo,JobLog> implements JobLogRepository{
+
+	@Resource
+	private JobLogQueryDao jobLogQueryDao;
+
+	@Override
+	public JobLog newInstance() {
+		JobLogPo JobLogPo = new JobLogPo();
+		JobLog JobLog = AppUtil.getBean(JobLog.class);
+		JobLog.setData(JobLogPo);
+		return JobLog;
+	}
+
+	@Override
+	public JobLog newInstance(JobLogPo po) {
+		JobLog JobLog = AppUtil.getBean(JobLog.class);
+		JobLog.setData(po);
+		return JobLog;
+	}
+
+	@Override
+	protected IQueryDao<String, JobLogPo> getQueryDao() {
+		return jobLogQueryDao;
+	}
+
+}

+ 97 - 97
ibps-common-root/modules/org-biz/src/main/java/com/lc/ibps/common/quartz/repository/impl/TriggerRepositoryImpl.java

@@ -1,97 +1,97 @@
-//package com.lc.ibps.common.quartz.repository.impl;
-//
-//import java.util.ArrayList;
-//import java.util.HashMap;
-//import java.util.List;
-//
-//import javax.annotation.Resource;
-//
-//import org.quartz.SchedulerException;
-//import org.quartz.Trigger;
-//import org.quartz.Trigger.TriggerState;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.springframework.context.annotation.Lazy;
-//import org.springframework.stereotype.Repository;
-//
-//import com.lc.ibps.api.base.page.Page;
-//import com.lc.ibps.base.core.util.BeanUtils;
-//import com.lc.ibps.base.framework.page.PageList;
-//import com.lc.ibps.base.framework.page.PageResult;
-//import com.lc.ibps.common.quartz.builder.TriggerVoBuilder;
-//import com.lc.ibps.common.quartz.repository.TriggerRepository;
-//import com.lc.ibps.common.quartz.vo.TriggerVo;
-//import com.lc.ibps.components.quartz.service.ITriggerQueryService;
-//
-//@Repository
-//public class TriggerRepositoryImpl implements TriggerRepository {
-//
-//	private static final Logger logger = LoggerFactory.getLogger(TriggerRepositoryImpl.class);
-//	@Resource
-//	@Lazy
-//	private ITriggerQueryService triggerQueryService;
-//
-//	@Override
-//	public List<TriggerVo> query(String jobName, String group, Page page) throws SchedulerException {
-//		List<TriggerVo> list = findByJobNameAndGroup(jobName, group);
-//
-//		// 分页大小
-//		final int limit = page.getPageSize();
-//		// 页码
-//		final int pageNo = page.getPageNo();
-//		// 总记录数
-//		final int totalCount = list.size();
-//		PageResult pageResult = new PageResult(pageNo, limit, totalCount);
-//		final int offset = pageResult.getOffset();
-//		int totalPages = pageResult.getTotalPages();
-//		int currentLimit = pageNo == totalPages ? totalCount % limit : limit;
-//		logger.debug("totalCount is {}, totalPages is {}, pageNo is {}, limit is {}, offset is {}, currentLimit is {}.",
-//				totalCount, totalPages, pageNo, limit, offset, currentLimit);
-//
-//		List<TriggerVo> data = new ArrayList<TriggerVo>();
-//		if(totalCount > 0 && offset <= totalCount)
-//		{
-//			data.addAll(list.subList(offset, offset + currentLimit));
-//		}
-//
-//		PageList<TriggerVo> result = new PageList<TriggerVo>(data, pageResult);
-//
-//		return result;
-//	}
-//
-//	@Override
-//	public List<TriggerVo> findByJobNameAndGroup(String jobName, String group) throws SchedulerException {
-//		List<Trigger> triggerList = triggerQueryService.findTriggersByJob(jobName, group);
-//		HashMap<String, TriggerState> triggerStatus = triggerQueryService.getTriggerStatus(triggerList);
-//
-//		List<TriggerVo> list = new ArrayList<TriggerVo>();
-//		for (Trigger trigger : triggerList) {
-//			TriggerState triggerState = triggerStatus.get(trigger.getKey().getName());
-//			TriggerVo triggerVo = TriggerVoBuilder.build(trigger, triggerState, group);
-//			list.add(triggerVo);
-//		}
-//
-//		return list;
-//	}
-//
-//	@Override
-//	public boolean isExists(String trigName, String group) throws SchedulerException {
-//		return triggerQueryService.isTriggerExists(trigName, group);
-//	}
-//
-//	@Override
-//	public TriggerVo getByTrigNameAndGroup(String trigName, String group) throws SchedulerException {
-//		Trigger trigger = triggerQueryService.getTrigger(trigName, group);
-//		if(BeanUtils.isEmpty(trigger))
-//		{
-//			return null;
-//		}
-//
-//		List<Trigger> triggerList = new ArrayList<Trigger>();
-//		triggerList.add(trigger);
-//		HashMap<String, TriggerState> triggerStatus = triggerQueryService.getTriggerStatus(triggerList);
-//
-//		return TriggerVoBuilder.build(trigger, triggerStatus.get(trigger.getKey().getName()), group);
-//	}
-//
-//}
+package com.lc.ibps.common.quartz.repository.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.quartz.SchedulerException;
+import org.quartz.Trigger;
+import org.quartz.Trigger.TriggerState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Repository;
+
+import com.lc.ibps.api.base.page.Page;
+import com.lc.ibps.base.core.util.BeanUtils;
+import com.lc.ibps.base.framework.page.PageList;
+import com.lc.ibps.base.framework.page.PageResult;
+import com.lc.ibps.common.quartz.builder.TriggerVoBuilder;
+import com.lc.ibps.common.quartz.repository.TriggerRepository;
+import com.lc.ibps.common.quartz.vo.TriggerVo;
+import com.lc.ibps.components.quartz.service.ITriggerQueryService;
+
+@Repository
+public class TriggerRepositoryImpl implements TriggerRepository {
+
+	private static final Logger logger = LoggerFactory.getLogger(TriggerRepositoryImpl.class);
+	@Resource
+	@Lazy
+	private ITriggerQueryService triggerQueryService;
+
+	@Override
+	public List<TriggerVo> query(String jobName, String group, Page page) throws SchedulerException {
+		List<TriggerVo> list = findByJobNameAndGroup(jobName, group);
+
+		// 分页大小
+		final int limit = page.getPageSize();
+		// 页码
+		final int pageNo = page.getPageNo();
+		// 总记录数
+		final int totalCount = list.size();
+		PageResult pageResult = new PageResult(pageNo, limit, totalCount);
+		final int offset = pageResult.getOffset();
+		int totalPages = pageResult.getTotalPages();
+		int currentLimit = pageNo == totalPages ? totalCount % limit : limit;
+		logger.debug("totalCount is {}, totalPages is {}, pageNo is {}, limit is {}, offset is {}, currentLimit is {}.",
+				totalCount, totalPages, pageNo, limit, offset, currentLimit);
+
+		List<TriggerVo> data = new ArrayList<TriggerVo>();
+		if(totalCount > 0 && offset <= totalCount)
+		{
+			data.addAll(list.subList(offset, offset + currentLimit));
+		}
+
+		PageList<TriggerVo> result = new PageList<TriggerVo>(data, pageResult);
+
+		return result;
+	}
+
+	@Override
+	public List<TriggerVo> findByJobNameAndGroup(String jobName, String group) throws SchedulerException {
+		List<Trigger> triggerList = triggerQueryService.findTriggersByJob(jobName, group);
+		HashMap<String, TriggerState> triggerStatus = triggerQueryService.getTriggerStatus(triggerList);
+
+		List<TriggerVo> list = new ArrayList<TriggerVo>();
+		for (Trigger trigger : triggerList) {
+			TriggerState triggerState = triggerStatus.get(trigger.getKey().getName());
+			TriggerVo triggerVo = TriggerVoBuilder.build(trigger, triggerState, group);
+			list.add(triggerVo);
+		}
+
+		return list;
+	}
+
+	@Override
+	public boolean isExists(String trigName, String group) throws SchedulerException {
+		return triggerQueryService.isTriggerExists(trigName, group);
+	}
+
+	@Override
+	public TriggerVo getByTrigNameAndGroup(String trigName, String group) throws SchedulerException {
+		Trigger trigger = triggerQueryService.getTrigger(trigName, group);
+		if(BeanUtils.isEmpty(trigger))
+		{
+			return null;
+		}
+
+		List<Trigger> triggerList = new ArrayList<Trigger>();
+		triggerList.add(trigger);
+		HashMap<String, TriggerState> triggerStatus = triggerQueryService.getTriggerStatus(triggerList);
+
+		return TriggerVoBuilder.build(trigger, triggerStatus.get(trigger.getKey().getName()), group);
+	}
+
+}

+ 53 - 53
ibps-common-root/modules/org-biz/src/main/java/com/lc/ibps/common/quartz/service/impl/SchedulerPersistenceLogImpl.java

@@ -1,53 +1,53 @@
-//package com.lc.ibps.common.quartz.service.impl;
-//
-//import javax.annotation.Resource;
-//
-//import org.springframework.transaction.annotation.Transactional;
-//
-//import com.lc.ibps.base.core.util.BeanUtils;
-//import com.lc.ibps.base.framework.id.UniqueIdUtil;
-//import com.lc.ibps.common.quartz.domain.JobLog;
-//import com.lc.ibps.common.quartz.persistence.entity.JobLogPo;
-//import com.lc.ibps.common.quartz.repository.JobLogRepository;
-//import com.lc.ibps.components.quartz.ISchedulerLogPersistence;
-//import com.lc.ibps.components.quartz.model.SchedulerLog;
-//
-///**
-// * 实现定时器执行日志接口。
-// * 获取到执行日志,可以持久化到数据库
-// * <pre>
-// * 构建组:ibps-common-biz
-// * 作者:hugh zhuang
-// * 邮箱:3378340995@qq.com
-// * 日期:2015-10-16-上午11:52:05
-// * 版权:广州流辰信息技术有限公司版权所有
-// * </pre>
-// */
-//@Transactional
-//public class SchedulerPersistenceLogImpl implements ISchedulerLogPersistence {
-//	@Resource
-//	protected JobLogRepository jobLogRepository;
-//
-//	protected JobLog jobLogDomain;
-//
-//	@Override
-//	public SchedulerLog getSchedulerLog() throws Exception {
-//		SchedulerLog schedulerLog = (SchedulerLog) new JobLogPo();
-//		return schedulerLog;
-//	}
-//
-//	/**O
-//	 *  实现定时器执行日志持久化操作
-//	 */
-//	@Override
-//	public void addLog(SchedulerLog schedulerLog) {
-//		if (BeanUtils.isEmpty(schedulerLog)) return;
-//		JobLogPo jobLog =(JobLogPo) schedulerLog;
-//		String id = UniqueIdUtil.getId();
-//		jobLog.setId(id);
-//
-//		jobLogDomain = jobLogRepository.newInstance(jobLog);
-//		jobLogDomain.create();
-//	}
-//
-//}
+package com.lc.ibps.common.quartz.service.impl;
+
+import javax.annotation.Resource;
+
+import org.springframework.transaction.annotation.Transactional;
+
+import com.lc.ibps.base.core.util.BeanUtils;
+import com.lc.ibps.base.framework.id.UniqueIdUtil;
+import com.lc.ibps.common.quartz.domain.JobLog;
+import com.lc.ibps.common.quartz.persistence.entity.JobLogPo;
+import com.lc.ibps.common.quartz.repository.JobLogRepository;
+import com.lc.ibps.components.quartz.ISchedulerLogPersistence;
+import com.lc.ibps.components.quartz.model.SchedulerLog;
+
+/**
+ * 实现定时器执行日志接口。
+ * 获取到执行日志,可以持久化到数据库
+ * <pre>
+ * 构建组:ibps-common-biz
+ * 作者:hugh zhuang
+ * 邮箱:3378340995@qq.com
+ * 日期:2015-10-16-上午11:52:05
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+@Transactional
+public class SchedulerPersistenceLogImpl implements ISchedulerLogPersistence {
+	@Resource
+	protected JobLogRepository jobLogRepository;
+
+	protected JobLog jobLogDomain;
+
+	@Override
+	public SchedulerLog getSchedulerLog() throws Exception {
+		SchedulerLog schedulerLog = (SchedulerLog) new JobLogPo();
+		return schedulerLog;
+	}
+
+	/**O
+	 *  实现定时器执行日志持久化操作
+	 */
+	@Override
+	public void addLog(SchedulerLog schedulerLog) {
+		if (BeanUtils.isEmpty(schedulerLog)) return;
+		JobLogPo jobLog =(JobLogPo) schedulerLog;
+		String id = UniqueIdUtil.getId();
+		jobLog.setId(id);
+
+		jobLogDomain = jobLogRepository.newInstance(jobLog);
+		jobLogDomain.create();
+	}
+
+}

+ 196 - 0
ibps-component-root/modules/comp-quartz/src/main/java/com/lc/ibps/components/quartz/config/QuartzConfigure.java

@@ -0,0 +1,196 @@
+package com.lc.ibps.components.quartz.config;
+
+import java.util.Properties;
+
+import javax.sql.DataSource;
+
+import org.quartz.simpl.SimpleJobFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.core.env.Environment;
+import org.springframework.scheduling.quartz.SchedulerFactoryBean;
+
+import com.lc.ibps.base.core.util.EnvUtil;
+import com.lc.ibps.base.datasource.constants.DbConstant;
+import com.lc.ibps.components.quartz.service.IJobDetailQueryService;
+import com.lc.ibps.components.quartz.service.ITriggerQueryService;
+import com.lc.ibps.components.quartz.service.ITriggerService;
+import com.lc.ibps.components.quartz.service.impl.JobDetailQueryServiceImpl;
+import com.lc.ibps.components.quartz.service.impl.JobDetailServiceImpl;
+import com.lc.ibps.components.quartz.service.impl.SchedulerServiceImpl;
+import com.lc.ibps.components.quartz.service.impl.TriggerQueryServiceImpl;
+import com.lc.ibps.components.quartz.service.impl.TriggerServiceImpl;
+
+/**
+ * 定时器配置类
+ *
+ * <pre> 
+ * 构建组:ibps-component-quartz
+ * 作者:zhongjh
+ * 邮箱:zjh20140614@163.com
+ * 日期:2020年1月7日-下午3:52:23
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+@Configuration
+public class QuartzConfigure {
+
+	@Autowired
+	private Environment env;
+
+	public final String JDBCJOBSTORE_MYSQL = "org.quartz.impl.jdbcjobstore.StdJDBCDelegate";
+	public final String JDBCJOBSTORE_ORACLE = "org.quartz.impl.jdbcjobstore.oracle.OracleDelegate";
+	public final String JDBCJOBSTORE_MSSQL = "org.quartz.impl.jdbcjobstore.MSSQLDelegate";
+	public final String JDBCJOBSTORE_POSTGRESQL = "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate";
+
+	private Properties getProperties() {
+		Properties prop = new Properties();
+
+		prop.put("org.quartz.scheduler.instanceName", "ClusteredScheduler");
+		prop.put("org.quartz.scheduler.instanceId", "AUTO");
+		prop.put("org.quartz.scheduler.skipUpdateCheck", true);
+
+		prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
+		prop.put("org.quartz.threadPool.threadCount", "5");
+		prop.put("org.quartz.threadPool.threadPriority", "5");
+
+		prop.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");
+		prop.put("org.quartz.jobStore.driverDelegateClass", setJobStore());
+		prop.put("org.quartz.jobStore.misfireThreshold", "60000");
+		prop.put("org.quartz.jobStore.useProperties", false);
+		prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
+
+		prop.put("org.quartz.jobStore.isClustered", true);
+		prop.put("org.quartz.jobStore.clusterCheckinInterval", "20000");
+
+		prop.put("org.quartz.scheduler.classLoadHelper.class", "org.quartz.simpl.CascadingClassLoadHelper");
+		prop.put("org.quartz.jobStore.lockHandler.class", "org.quartz.impl.jdbcjobstore.UpdateLockRowSemaphore");
+		prop.put("org.quartz.jobStore.lockHandler.updateLockRowSQL",
+				"UPDATE QRTZ_LOCKS SET LOCK_NAME = LOCK_NAME WHERE LOCK_NAME = ?");
+
+		return prop;
+	}
+
+	/**
+	 * 
+	 * 根据环境变量【数据路类型】返回quartz的数据解析器
+	 *
+	 * @return
+	 */
+	private String setJobStore() {
+		String DB_DBTYPE = EnvUtil.getProperty(env, "db.dbType", String.class, DbConstant.DB_MYSQL);
+		if (DB_DBTYPE.equals(DbConstant.DB_MYSQL)) {
+			return JDBCJOBSTORE_MYSQL;
+		} else if (DB_DBTYPE.equals(DbConstant.DB_ORACLE)) {
+			return JDBCJOBSTORE_ORACLE;
+		} else if (DB_DBTYPE.equals(DbConstant.DB_MSSQL)) {
+			return JDBCJOBSTORE_MSSQL;
+		} else if (DB_DBTYPE.equals(DbConstant.DB_POSTGRESQL)) {
+			return JDBCJOBSTORE_POSTGRESQL;
+		}
+		return JDBCJOBSTORE_MYSQL;
+	}
+	
+	/*
+	<bean id="scheduler"
+		class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
+		lazy-init="true" destroy-method="destroy">
+		<property name="autoStartup" value="${quartz.auto.startup}" />
+		<property name="waitForJobsToCompleteOnShutdown" value="true" />
+		<property name="dataSource" ref="dataSource" />
+		<property name="overwriteExistingJobs" value="true" />
+		<property name="startupDelay" value="60"></property>
+		<property name="jobFactory">
+			<bean class="org.quartz.simpl.SimpleJobFactory"></bean>
+		</property>
+		<property name="quartzProperties">
+			<props>
+				<prop key="org.quartz.scheduler.instanceName">ClusteredScheduler</prop>
+				<prop key="org.quartz.scheduler.instanceId">AUTO</prop>
+				<prop key="org.quartz.scheduler.skipUpdateCheck">true</prop>
+	
+				<prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
+				<prop key="org.quartz.threadPool.threadCount">5</prop>
+				<prop key="org.quartz.threadPool.threadPriority">5</prop>
+	
+				<prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreTX</prop>
+				<prop key="org.quartz.jobStore.driverDelegateClass">${quartz.jdbcjobstore}</prop>
+				<prop key="org.quartz.jobStore.misfireThreshold">60000</prop>
+				<prop key="org.quartz.jobStore.useProperties">false</prop>
+				<prop key="org.quartz.jobStore.tablePrefix">QRTZ_</prop>
+	
+				<prop key="org.quartz.jobStore.isClustered">true</prop>
+				<prop key="org.quartz.jobStore.clusterCheckinInterval">20000</prop>
+	
+				<prop key="org.quartz.scheduler.classLoadHelper.class">org.quartz.simpl.CascadingClassLoadHelper</prop>
+				<prop key="org.quartz.jobStore.lockHandler.class">org.quartz.impl.jdbcjobstore.UpdateLockRowSemaphore
+				</prop>
+				<prop key="org.quartz.jobStore.lockHandler.updateLockRowSQL">UPDATE QRTZ_LOCKS SET LOCK_NAME = LOCK_NAME WHERE LOCK_NAME = ?</prop>
+			</props>
+		</property>
+	</bean>
+	*/
+	@Bean
+	public SchedulerFactoryBean scheduler(DataSource dataSource) {
+		SchedulerFactoryBean factory = new SchedulerFactoryBean();
+
+		factory.setAutoStartup(EnvUtil.getProperty(env, "quartz.auto.startup", Boolean.class, false));
+		factory.setWaitForJobsToCompleteOnShutdown(true);
+		factory.setDataSource(dataSource);
+		factory.setOverwriteExistingJobs(true);
+		factory.setStartupDelay(60);
+		factory.setJobFactory(new SimpleJobFactory());
+		factory.setQuartzProperties(getProperties());
+
+		return factory;
+	}
+
+	@Bean
+	@DependsOn("scheduler")
+	public SchedulerServiceImpl schedulerServiceImpl(SchedulerFactoryBean factory) {
+		SchedulerServiceImpl schedulerService = new SchedulerServiceImpl();
+		schedulerService.setScheduler(factory.getObject());
+		return schedulerService;
+	}
+
+	@Bean
+	@DependsOn("scheduler")
+	public ITriggerQueryService triggerQueryService(SchedulerFactoryBean factory) {
+		TriggerQueryServiceImpl triggerQueryServiceImpl = new TriggerQueryServiceImpl();
+		triggerQueryServiceImpl.setScheduler(factory.getObject());
+		return triggerQueryServiceImpl;
+	}
+
+	@Bean
+	@DependsOn({"scheduler", "triggerQueryService"})
+	public ITriggerService triggerService(SchedulerFactoryBean factory, ITriggerQueryService triggerQueryService) {
+		TriggerServiceImpl triggerServiceImpl = new TriggerServiceImpl();
+		triggerServiceImpl.setScheduler(factory.getObject());
+		triggerServiceImpl.setTriggerQueryService(triggerQueryService);
+		return triggerServiceImpl;
+	}
+
+	@Bean
+	@DependsOn({"scheduler"})
+	public IJobDetailQueryService jobDetailQueryService(SchedulerFactoryBean factory) {
+		JobDetailQueryServiceImpl jobDetailQueryService = new JobDetailQueryServiceImpl();
+		jobDetailQueryService.setScheduler(factory.getObject());
+		return jobDetailQueryService;
+	}
+
+	@Bean
+	@DependsOn({"scheduler", "triggerQueryService", "triggerService", "jobDetailQueryService"})
+	public JobDetailServiceImpl jobDetailService(SchedulerFactoryBean factory, ITriggerQueryService triggerQueryService,
+			ITriggerService triggerService, IJobDetailQueryService jobDetailQueryService) {
+		JobDetailServiceImpl jobDetailServiceImpl = new JobDetailServiceImpl();
+		jobDetailServiceImpl.setScheduler(factory.getObject());
+		jobDetailServiceImpl.setJobDetailQueryService(jobDetailQueryService);
+		jobDetailServiceImpl.setTriggerQueryService(triggerQueryService);
+		jobDetailServiceImpl.setTriggerService(triggerService);
+
+		return jobDetailServiceImpl;
+	}
+
+}

+ 102 - 0
ibps-component-root/modules/comp-quartz/src/main/java/com/lc/ibps/components/quartz/service/impl/JobDetailQueryServiceImpl.java

@@ -0,0 +1,102 @@
+package com.lc.ibps.components.quartz.service.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.lang.StringUtils;
+import org.quartz.JobDetail;
+import org.quartz.JobKey;
+import org.quartz.SchedulerException;
+import org.quartz.impl.matchers.GroupMatcher;
+
+import com.lc.ibps.components.quartz.service.AbstractService;
+import com.lc.ibps.components.quartz.service.IJobDetailQueryService;
+
+/** 
+ * 定时任务查询接口-默认实现
+ * <pre> 
+ * 构建组:ibps-component-quartz
+ * 作者:eddy
+ * 邮箱:xuq@bpmhome.cn
+ * 日期:2018年5月10日-上午9:24:27
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+public class JobDetailQueryServiceImpl extends AbstractService implements IJobDetailQueryService {
+
+	/**
+	 * 判断任务是否存在
+	 * 
+	 * @param jobName
+	 * @return
+	 * @throws SchedulerException
+	 */
+	@Override
+	public boolean isExists(String jobName, String schedGroup)
+			throws SchedulerException {
+		verify();
+		
+		JobKey key = new JobKey(jobName, schedGroup);
+		return scheduler.checkExists(key);
+	}
+
+	@Override
+	public JobDetail getByJobNameAndGroup(String jobName, String schedGroup) throws SchedulerException {
+		verify();
+		
+		JobKey key = new JobKey(jobName, schedGroup);
+		return scheduler.getJobDetail(key);
+	}
+	
+	@Override
+	public List<JobDetail> findByGroup(String schedGroup)
+			throws SchedulerException {
+		verify();
+		
+		List<JobDetail> list = new ArrayList<JobDetail>();
+		GroupMatcher<JobKey> matcher = null;
+		if (StringUtils.isNotEmpty(schedGroup)) {
+			matcher = GroupMatcher.jobGroupEquals(schedGroup);
+		}else {
+			matcher = GroupMatcher.anyJobGroup();
+		}
+		Set<JobKey> set = scheduler.getJobKeys(matcher);
+		for (JobKey jobKey : set) {
+			JobDetail detail = scheduler.getJobDetail(jobKey);
+			list.add(detail);
+		}
+		return list;
+	}
+
+	@Override
+	public List<JobDetail> findByJobNameAndGroup(String jobName, String schedGroup) throws SchedulerException {
+		verify();
+		if(jobName == null)
+		{
+			jobName = "";
+		}
+		
+		List<JobDetail> list = findByGroup(schedGroup);
+		
+		if("".equals(jobName))
+		{
+			return list;
+		}
+		
+		for (Iterator<JobDetail> iterator = list.iterator(); iterator.hasNext();) 
+		{
+			JobDetail jobDetail = iterator.next();
+			if(jobDetail.getKey().getName().contains(jobName))
+			{
+				continue;
+			}
+			
+			iterator.remove();
+		}
+		
+		return list;
+	}
+	
+}

+ 172 - 0
ibps-component-root/modules/comp-quartz/src/main/java/com/lc/ibps/components/quartz/service/impl/JobDetailServiceImpl.java

@@ -0,0 +1,172 @@
+package com.lc.ibps.components.quartz.service.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import org.quartz.Job;
+import org.quartz.JobBuilder;
+import org.quartz.JobDataMap;
+import org.quartz.JobDetail;
+import org.quartz.JobKey;
+import org.quartz.SchedulerException;
+import org.quartz.Trigger;
+
+import com.lc.ibps.components.quartz.service.AbstractService;
+import com.lc.ibps.components.quartz.service.IJobDetailQueryService;
+import com.lc.ibps.components.quartz.service.IJobDetailService;
+import com.lc.ibps.components.quartz.service.ITriggerQueryService;
+import com.lc.ibps.components.quartz.service.ITriggerService;
+
+/** 
+ * 定时任务持久化接口-默认实现
+ * <pre> 
+ * 构建组:ibps-component-quartz
+ * 作者:eddy
+ * 邮箱:xuq@bpmhome.cn
+ * 日期:2018年5月10日-上午9:26:06
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+public class JobDetailServiceImpl extends AbstractService implements IJobDetailService {
+
+	private IJobDetailQueryService jobDetailQueryService;
+	private ITriggerService triggerService;
+	private ITriggerQueryService triggerQueryService;
+	
+	public void setJobDetailQueryService(IJobDetailQueryService jobDetailQueryService) {
+		this.jobDetailQueryService = jobDetailQueryService;
+	}
+
+	public void setTriggerService(ITriggerService triggerService) {
+		this.triggerService = triggerService;
+	}
+
+	public void setTriggerQueryService(ITriggerQueryService triggerQueryService) {
+		this.triggerQueryService = triggerQueryService;
+	}
+
+	/**
+	 * 添加任务
+	 * 
+	 * @param jobName
+	 * 			 任务名称
+	 * @param cls
+	 * 			 类名
+	 * @param schedGroup
+	 * 			 分组名称 
+	 * @param parameterMap
+	 * 			 参数
+	 * @param description
+	 * 			 任务描述
+	 * @return
+	 */
+	@SuppressWarnings("unchecked")
+	@Override
+	public void addJob(String jobName, String className,
+			String schedGroup, Map<String, Object> parameterMap,
+			String description) throws SchedulerException {
+		verify();
+		
+		boolean isJobExist = jobDetailQueryService.isExists(jobName,schedGroup);
+		if (isJobExist) 
+		{
+			throw new SchedulerException("定时任务已存在!");
+		}
+		
+		try {
+			Class<Job> clazz = (Class<Job>) Class.forName(className);
+			JobBuilder jb = JobBuilder.newJob(clazz);
+			jb.withIdentity(jobName, schedGroup);
+			if (parameterMap != null) 
+			{
+				JobDataMap map = new JobDataMap();
+				map.putAll(parameterMap);
+				jb.usingJobData(map);
+			}
+			jb.storeDurably();
+			jb.withDescription(description);
+			JobDetail jobDetail = jb.build();
+			scheduler.addJob(jobDetail, true);
+		}catch(ClassNotFoundException e){
+			throw new SchedulerException(className+",指定的任务类不存在,或者没有实现BaseJob");
+		}catch (Exception e) {
+			throw new SchedulerException(e);
+		}
+	}
+
+	/**
+	 * 删除任务
+	 * 
+	 * @param jobName
+	 * 			  任务名
+	 * @param schedGroup
+	 * 			 分组名称  
+	 * @throws SchedulerException
+	 * @throws ClassNotFoundException
+	 */
+	@Override
+	public void delJob(String jobName, String schedGroup)
+			throws SchedulerException {
+		verify();
+		
+		JobKey key = new JobKey(jobName, schedGroup);
+		scheduler.deleteJob(key);
+	}
+
+	/**
+	 * 直接执行任务
+	 * 
+	 * @param jobName
+	 * 			任务名称
+	 * @param schedGroup
+	 * 			 分组名称  
+	 * @throws SchedulerException
+	 */
+	public void execute(String jobName, String schedGroup) throws SchedulerException {
+		verify();
+		
+		JobKey key = new JobKey(jobName, schedGroup);
+		scheduler.triggerJob(key);
+	}
+	
+	/**
+	 * 启动任务
+	 * 
+	 * @return
+	 * @throws SchedulerException
+	 */
+	@Override
+	public boolean run(String jobName, String schedGroup) throws SchedulerException {
+		verify();
+		
+		List<Trigger> triggersByJob = triggerQueryService.findTriggersByJob(jobName, schedGroup);
+		for (Trigger trigger : triggersByJob) {
+			boolean runTrigger = triggerService.run(trigger.getKey().getName(),schedGroup);
+			if (!runTrigger) {
+				return false;
+			}
+		}
+		return true;
+	}
+
+	/**
+	 * 停止任务
+	 * 
+	 * @return
+	 * @throws SchedulerException
+	 */
+	@Override
+	public boolean stop(String jobName, String schedGroup) throws SchedulerException {
+		verify();
+		
+		List<Trigger> triggersByJob = triggerQueryService.findTriggersByJob(jobName, schedGroup);
+		for (Trigger trigger : triggersByJob) {
+			boolean stopTrigger = triggerService.stop(trigger.getKey().getName(),schedGroup);
+			if (!stopTrigger) {
+				return false;
+			}
+		}
+		return true;
+	}
+	
+}

+ 93 - 0
ibps-component-root/modules/comp-quartz/src/main/java/com/lc/ibps/components/quartz/service/impl/SchedulerServiceImpl.java

@@ -0,0 +1,93 @@
+package com.lc.ibps.components.quartz.service.impl;
+
+import org.quartz.SchedulerException;
+
+import com.lc.ibps.components.quartz.service.AbstractService;
+import com.lc.ibps.components.quartz.service.ISchedulerService;
+
+/**
+ * * 
+ *  定时器基本操作功能接口类
+ * 
+ *  接口功能描述:
+ * 1.启动、停止定时计划。
+ * 2.启动、停止定时任务。
+ * 3.执行一次定时任务。
+ * 4.启动、停止触发器。
+ * 
+ * spring 配置文件如下:
+ * 
+ * &lt;bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
+ * 	lazy-init="false" destroy-method="destroy">
+ * 	&lt;property name="autoStartup" value="true" />
+ * 	&lt;property name="waitForJobsToCompleteOnShutdown" value="false" />
+ * 	&lt;property name="dataSource" ref="dataSource" />
+ * 	&lt;property name="overwriteExistingJobs" value="true" />
+ * 	&lt;property name="jobFactory">  
+ *            &lt;bean class="org.quartz.simpl.SimpleJobFactory">&lt;/bean>  
+ *       &lt;/property>  
+ * 		&lt;property name="quartzProperties">
+ * 		&lt;props>
+ * 			&lt;!--Job Store -->
+ * 			&lt;prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.StdJDBCDelegate&lt;/prop>
+ * 			&lt;prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreTX&lt;/prop>
+ * 			&lt;prop key="org.quartz.jobStore.tablePrefix">QRTZ_&lt;/prop>
+ * 			
+ * 			&lt;prop key="org.quartz.jobStore.clusterCheckinInterval">20000&lt;/prop>
+ * 			&lt;prop key="org.quartz.scheduler.instanceId">AUTO&lt;/prop>
+ * 			&lt;prop key="org.quartz.scheduler.classLoadHelper.class">org.quartz.simpl.CascadingClassLoadHelper&lt;/prop> 
+ * 			&lt;prop key="org.quartz.jobStore.lockHandler.class">org.quartz.impl.jdbcjobstore.UpdateLockRowSemaphore&lt;/prop> 
+ * 			&lt;prop key="org.quartz.jobStore.lockHandler.updateLockRowSQL">UPDATE QRTZ_LOCKS SET LOCK_NAME = LOCK_NAME WHERE LOCK_NAME = ?&lt;/prop>
+ * 
+ * 		&lt;/props>
+ * 	&lt;/property>
+ * &lt;/bean>
+ * 
+ *
+ * <pre> 
+ * 构建组:ibps-component-quartz
+ * 作者:hugh zhuang
+ * 邮箱:3378340995@qq.com
+ * 日期:2015-10-15-下午3:34:19
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+public class SchedulerServiceImpl extends AbstractService implements ISchedulerService{
+
+	/**
+	 * 启动
+	 * 
+	 * @throws SchedulerException
+	 */
+	@Override
+	public void start() throws SchedulerException {
+		if(isShutdown())
+		{
+			scheduler.start();
+		}
+	}
+
+	/**
+	 * 关闭
+	 * 
+	 * @throws SchedulerException
+	 */
+	@Override
+	public void shutdown() throws SchedulerException {
+		if(isStarted())
+		{
+			scheduler.standby();
+		}
+	}
+
+	@Override
+	public boolean isStarted() throws SchedulerException {
+		return scheduler.isStarted();
+	}
+
+	@Override
+	public boolean isShutdown() throws SchedulerException {
+		return scheduler.isShutdown() || scheduler.isInStandbyMode();
+	}
+	
+}

+ 100 - 0
ibps-component-root/modules/comp-quartz/src/main/java/com/lc/ibps/components/quartz/service/impl/TriggerQueryServiceImpl.java

@@ -0,0 +1,100 @@
+package com.lc.ibps.components.quartz.service.impl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.quartz.JobKey;
+import org.quartz.SchedulerException;
+import org.quartz.Trigger;
+import org.quartz.Trigger.TriggerState;
+import org.quartz.TriggerKey;
+
+import com.lc.ibps.components.quartz.service.AbstractService;
+import com.lc.ibps.components.quartz.service.ITriggerQueryService;
+
+/** 
+ * 定时计划查询接口-默认实现
+ * <pre> 
+ * 构建组:ibps-component-quartz
+ * 作者:eddy
+ * 邮箱:xuq@bpmhome.cn
+ * 日期:2018年5月10日-上午9:41:18
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+public class TriggerQueryServiceImpl extends AbstractService implements ITriggerQueryService {
+
+	/**
+	 * 判断计划是否存在
+	 * 
+	 * @param triggerName
+	 *            触发器名称
+	 * @param schedGroup
+	 * 			  分组名称
+	 * @return
+	 * @throws SchedulerException
+	 */
+	@Override
+	public boolean isTriggerExists(String triggerName, String schedGroup)
+			throws SchedulerException {
+		verify();
+		
+		TriggerKey triggerKey = new TriggerKey(triggerName, schedGroup);
+		return scheduler.checkExists(triggerKey);
+	}
+	
+	@Override
+	public Trigger getTrigger(String triggerName, String schedGroup) throws SchedulerException {
+		verify();
+		
+		TriggerKey triggerKey = new TriggerKey(triggerName, schedGroup);
+		
+		return scheduler.getTrigger(triggerKey);
+	}
+
+	/**
+	 * 根据任务名称获取触发器
+	 * 
+	 * @param jobName
+	 * 			   任务名称
+	 * @param schedGroup
+	 * 			  分组名称
+	 * @return
+	 * @throws SchedulerException
+	 */
+	@SuppressWarnings("unchecked")
+	@Override
+	public List<Trigger> findTriggersByJob(String jobName, String schedGroup)
+			throws SchedulerException {
+		verify();
+		
+		JobKey key = new JobKey(jobName, schedGroup);
+		
+		return (List<Trigger>) scheduler.getTriggersOfJob(key);
+	}
+
+	/**
+	 * 取得触发器的状态
+	 * 
+	 * @param list
+	 * @return
+	 * @throws SchedulerException
+	 */
+	@Override
+	public HashMap<String, TriggerState> getTriggerStatus(List<Trigger> list)
+			throws SchedulerException {
+		verify();
+		
+		HashMap<String, Trigger.TriggerState> map = new HashMap<String, Trigger.TriggerState>();
+		for (Iterator<Trigger> it = list.iterator(); it.hasNext();) {
+			Trigger trigger = it.next();
+			TriggerKey key = trigger.getKey();
+			Trigger.TriggerState state = scheduler.getTriggerState(key);
+			map.put(key.getName(), state);
+		}
+		
+		return map;
+	}
+
+}

+ 282 - 0
ibps-component-root/modules/comp-quartz/src/main/java/com/lc/ibps/components/quartz/service/impl/TriggerServiceImpl.java

@@ -0,0 +1,282 @@
+package com.lc.ibps.components.quartz.service.impl;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.HashMap;
+
+import org.quartz.CalendarIntervalScheduleBuilder;
+import org.quartz.CronScheduleBuilder;
+import org.quartz.ScheduleBuilder;
+import org.quartz.SchedulerException;
+import org.quartz.Trigger;
+import org.quartz.TriggerBuilder;
+import org.quartz.TriggerKey;
+import org.quartz.Trigger.TriggerState;
+
+import com.lc.ibps.base.core.util.JacksonUtil;
+import com.lc.ibps.base.core.util.time.DateFormatUtil;
+import com.lc.ibps.components.quartz.model.PlanObject;
+import com.lc.ibps.components.quartz.service.AbstractService;
+import com.lc.ibps.components.quartz.service.ITriggerQueryService;
+import com.lc.ibps.components.quartz.service.ITriggerService;
+
+import net.sf.json.JSONObject;
+
+/** 
+ * 定时计划持久化接口-默认实现
+ * <pre> 
+ * 构建组:ibps-component-quartz
+ * 作者:eddy
+ * 邮箱:xuq@bpmhome.cn
+ * 日期:2018年5月10日-上午9:46:39
+ * 版权:广州流辰信息技术有限公司版权所有
+ * </pre>
+ */
+public class TriggerServiceImpl extends AbstractService implements ITriggerService {
+
+	private ITriggerQueryService triggerQueryService;
+	
+	private static HashMap<String, String> mapWeek;
+	static {
+		// "MON,TUE,WED,THU,FRI,SAT,SUN"
+		mapWeek = new HashMap<String, String>();
+		mapWeek.put("MON", "星期一");
+		mapWeek.put("TUE", "星期二");
+		mapWeek.put("WED", "星期三");
+		mapWeek.put("THU", "星期四");
+		mapWeek.put("FRI", "星期五");
+		mapWeek.put("SAT", "星期六");
+		mapWeek.put("SUN", "星期日");
+	}
+	
+	public void setTriggerQueryService(ITriggerQueryService triggerQueryService) {
+		this.triggerQueryService = triggerQueryService;
+	}
+
+	/**
+	 * 添加计划
+	 * 
+	 * @param jobName
+	 *            任务名
+	 * @param triggerName
+	 *            计划名
+	 * @param planJson
+	 * 
+	 * @param schedGroup
+	 * 			 分组名称 
+	 * @throws SchedulerException
+	 * @throws ParseException
+	 */
+	@Override
+	public void addTrigger(String jobName, String triggerName, String planJson,
+			String schedGroup) throws SchedulerException, ParseException {
+		verify();
+		
+		boolean isJobExist = triggerQueryService.isTriggerExists(triggerName, schedGroup);
+		if (isJobExist) 
+		{
+			throw new SchedulerException("定时计划已存在!");
+		}
+		
+		TriggerBuilder<Trigger> tb = TriggerBuilder.newTrigger();
+		tb.withIdentity(triggerName, schedGroup);
+		this.setTrigBuilder(planJson, tb);
+		tb.forJob(jobName, schedGroup);
+		Trigger trig = tb.build();
+		scheduler.scheduleJob(trig);
+	}
+	
+	/**
+	 * 添加计划
+	 * 
+	 * @param jobName
+	 *            任务名
+	 * @param triggerName
+	 *            计划名
+	 * @param schedGroup
+	 * 			 分组名称 
+	 * @throws SchedulerException
+	 * @throws ParseException
+	 */
+	@Override
+	public void addTrigger(String jobName, String triggerName,
+			String schedGroup) throws SchedulerException, ParseException {
+		verify();
+		
+		Trigger trig = triggerQueryService.getTrigger(triggerName, schedGroup);
+		trig.getTriggerBuilder().forJob(jobName, schedGroup);
+		scheduler.scheduleJob(trig);
+	}
+
+	/**
+	 * 删除计划
+	 * 
+	 * @param triggerName
+	 *            触发器名称
+	  * @param schedGroup
+	 * 			  分组名称
+	 * @throws SchedulerException
+	 * @throws ClassNotFoundException
+	 */
+	@Override
+	public void delTrigger(String triggerName, String schedGroup)
+			throws SchedulerException {
+		verify();
+		
+		TriggerKey key = new TriggerKey(triggerName, schedGroup);
+		scheduler.unscheduleJob(key);
+	}
+	
+	@Override
+	public boolean run(String triggerName, String schedGroup) throws SchedulerException {
+		verify();
+		
+		TriggerKey key = new TriggerKey(triggerName, schedGroup);
+		Trigger.TriggerState state = scheduler.getTriggerState(key);
+		if (state == TriggerState.PAUSED) {
+			scheduler.resumeTrigger(key);
+			return true;
+		} else if (state == TriggerState.NORMAL) {
+			return true;
+		}
+		
+		return false;
+	}
+	
+	/**
+	 * 停止或暂停触发器
+	 * 
+	 * @param triggerName
+	 * 			  触发器名称
+	 * @param schedGroup
+	 * 			 分组名称  
+	 * @throws SchedulerException
+	 */
+	@Override
+	public boolean stop(String triggerName, String schedGroup) throws SchedulerException {
+		verify();
+		
+		TriggerKey key = new TriggerKey(triggerName, schedGroup);
+		Trigger.TriggerState state = scheduler.getTriggerState(key);
+		if (state == TriggerState.PAUSED) {
+			return true;
+		} else if (state == TriggerState.NORMAL) {
+			scheduler.pauseTrigger(key);
+			return true;
+		}else {
+			return false;
+		}
+	}
+	
+	private void setTrigBuilder(String planJson, TriggerBuilder<Trigger> tb)
+			throws ParseException {
+		JSONObject jsonObject = JSONObject.fromObject(JacksonUtil.toMap(planJson));
+
+		PlanObject planObject = (PlanObject) JSONObject.toBean(jsonObject,
+				PlanObject.class);
+		int type = planObject.getType();
+		String value = planObject.getTimeInterval();
+		ScheduleBuilder<?> sb = null;
+		switch (type) {
+		// 启动一次
+		case PlanObject.TYPE_FIRST:
+			Date date = DateFormatUtil.parseDateTime(value);
+			tb.startAt(date).withDescription("执行一次,执行时间:" + DateFormatUtil.format(date));
+			break;
+		// 每分钟执行
+		case PlanObject.TYPE_PER_MINUTE:
+			int minute = Integer.parseInt(value);
+			sb = CalendarIntervalScheduleBuilder.calendarIntervalSchedule()
+					.withIntervalInMinutes(minute);
+			tb.startNow().withSchedule(sb)
+					.withDescription("每:" + minute + "分钟执行!");
+			break;
+		// 每天时间点执行
+		case PlanObject.TYPE_PER_DAY:
+			String[] aryTime = value.split(":");
+			int hour = Integer.parseInt(aryTime[0]);
+			int m = Integer.parseInt(aryTime[1]);
+			sb = CronScheduleBuilder.dailyAtHourAndMinute(hour, m);
+			tb.startNow().withSchedule(sb)
+					.withDescription("每天:" + hour + ":" + m + "执行!");
+			break;
+		// 每周时间点执行
+		case PlanObject.TYPE_PER_WEEK:
+			// 0 15 10 ? * MON-FRI Fire at 10:15am every Monday, Tuesday,
+			// Wednesday, Thursday and Friday
+			String[] aryExpression = value.split("[|]");
+			String week = aryExpression[0];
+			String[] aryTime1 = aryExpression[1].split(":");
+			String h1 = aryTime1[0];
+			String m1 = aryTime1[1];
+			String cronExperssion = "0 " + m1 + " " + h1 + " ? * " + week;
+			sb = CronScheduleBuilder.cronSchedule(cronExperssion);
+			tb.startNow()
+					.withSchedule(sb)
+					.withDescription(
+							"每周:" + getWeek(week) + "," + h1 + ":" + m1 + "执行!");
+			break;
+		// 每月执行
+		case PlanObject.TYPE_PER_MONTH:
+			// 0 15 10 15 * ?
+			String[] aryExpression5 = value.split("[|]");
+			String day = aryExpression5[0];
+			String[] aryTime2 = aryExpression5[1].split(":");
+			String h2 = aryTime2[0];
+			String m2 = aryTime2[1];
+			String cronExperssion1 = "0 " + m2 + " " + h2 + " " + day + " * ?";
+			sb = CronScheduleBuilder.cronSchedule(cronExperssion1);
+			tb.startNow()
+					.withSchedule(sb)
+					.withDescription(
+							"每月:" + getDay(day) + "," + h2 + ":" + m2 + "执行!");
+			break;
+		// 表达式
+		case PlanObject.TYPE_CRON:
+			try {
+				sb = CronScheduleBuilder.cronSchedule(value);
+				tb.startNow().withSchedule(sb);
+			} catch (RuntimeException e) {
+				throw e;
+			}
+			tb.withDescription("CronTrigger表达式:" + value);
+			break;
+		}
+	}
+	
+	/**
+	 * 取得星期名称
+	 * 
+	 * @param week
+	 * @return
+	 */
+	private String getWeek(String week) {
+		String[] aryWeek = week.split(",");
+		int len = aryWeek.length;
+		String str = "";
+		for (int i = 0; i < len; i++) {
+			if (i < len - 1)
+				str += mapWeek.get(aryWeek[i]) + ",";
+			else
+				str += mapWeek.get(aryWeek[i]);
+		}
+		return str;
+	}
+	
+	private String getDay(String day) {
+		String[] aryDay = day.split(",");
+		int len = aryDay.length;
+		String str = "";
+		for (int i = 0; i < len; i++) {
+			String tmp = aryDay[i];
+			tmp = tmp.equals("L") ? "最后一天" : tmp+"日";
+			if (i < len - 1) {
+				str += tmp + ",";
+			} else {
+				str += tmp;
+			}
+		}
+		return str;
+	}
+
+}

+ 82 - 0
ibps-component-root/modules/comp-quartz/src/main/resources/conf/ibps-component-quartz.xml

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xmlns:context="http://www.springframework.org/schema/context"
+	xmlns:aop="http://www.springframework.org/schema/aop" 
+	xmlns:tx="http://www.springframework.org/schema/tx"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans 
+	http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://www.springframework.org/schema/context 
+       http://www.springframework.org/schema/context/spring-context.xsd
+       http://www.springframework.org/schema/aop 
+       http://www.springframework.org/schema/aop/spring-aop.xsd
+       http://www.springframework.org/schema/tx 
+       http://www.springframework.org/schema/tx/spring-tx.xsd"
+	default-autowire="byName" default-lazy-init="false">
+	
+    <!-- <context:component-scan base-package="com.lc.ibps.components.quartz.job">
+		<context:include-filter type="annotation" expression="org.springframework.transaction.annotation.Transactional" />
+	</context:component-scan> -->
+	<!-- QUARTZ 2.0配置的问题 -->
+	<!-- 
+	<bean id="scheduler"
+		class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
+		lazy-init="true" destroy-method="destroy">
+		<property name="autoStartup" value="${quartz.auto.startup}" />
+		<property name="waitForJobsToCompleteOnShutdown" value="true" />
+		<property name="dataSource" ref="dataSource" />
+		<property name="overwriteExistingJobs" value="true" />
+		<property name="startupDelay" value="60"></property>
+		<property name="jobFactory">
+			<bean class="org.quartz.simpl.SimpleJobFactory"></bean>
+		</property>
+		<property name="quartzProperties">
+			<props>
+				<prop key="org.quartz.scheduler.instanceName">ClusteredScheduler</prop>
+				<prop key="org.quartz.scheduler.instanceId">AUTO</prop>
+				<prop key="org.quartz.scheduler.skipUpdateCheck">true</prop>
+
+				<prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
+				<prop key="org.quartz.threadPool.threadCount">5</prop>
+				<prop key="org.quartz.threadPool.threadPriority">5</prop>
+
+				<prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreTX</prop>
+				<prop key="org.quartz.jobStore.driverDelegateClass">${quartz.jdbcjobstore}</prop>
+				<prop key="org.quartz.jobStore.misfireThreshold">60000</prop>
+				<prop key="org.quartz.jobStore.useProperties">false</prop>
+				<prop key="org.quartz.jobStore.tablePrefix">QRTZ_</prop>
+
+				<prop key="org.quartz.jobStore.isClustered">true</prop>
+				<prop key="org.quartz.jobStore.clusterCheckinInterval">20000</prop>
+
+				<prop key="org.quartz.scheduler.classLoadHelper.class">org.quartz.simpl.CascadingClassLoadHelper</prop>
+				<prop key="org.quartz.jobStore.lockHandler.class">org.quartz.impl.jdbcjobstore.UpdateLockRowSemaphore
+				</prop>
+				<prop key="org.quartz.jobStore.lockHandler.updateLockRowSQL">UPDATE QRTZ_LOCKS SET LOCK_NAME = LOCK_NAME WHERE LOCK_NAME = ?</prop>
+			</props>
+		</property>
+	</bean>
+	 -->
+	
+	<!-- 新代码 -->
+	<!-- 
+	<bean id="schedulerServiceImpl" class="com.lc.ibps.components.quartz.service.impl.SchedulerServiceImpl"></bean>
+	<bean id="triggerQueryService" class="com.lc.ibps.components.quartz.service.impl.TriggerQueryServiceImpl">
+		<property name="scheduler" ref="scheduler"/>
+	</bean>
+	<bean id="triggerService" class="com.lc.ibps.components.quartz.service.impl.TriggerServiceImpl">
+		<property name="scheduler" ref="scheduler"/>
+		<property name="triggerQueryService" ref="triggerQueryService"/>
+	</bean>
+	<bean id="jobDetailQueryService" class="com.lc.ibps.components.quartz.service.impl.JobDetailQueryServiceImpl">
+		<property name="scheduler" ref="scheduler"/>
+	</bean>
+	<bean id="jobDetailService" class="com.lc.ibps.components.quartz.service.impl.JobDetailServiceImpl">
+		<property name="scheduler" ref="scheduler"/>
+		<property name="jobDetailQueryService" ref="jobDetailQueryService"/>
+		<property name="triggerQueryService" ref="triggerQueryService"/>
+		<property name="triggerService" ref="triggerService"/>
+	</bean>
+	 -->
+	
+</beans>

+ 2 - 1
ibps-model-root/modules/org-model/src/main/java/com/lc/ibps/common/quartz/vo/JobDetailVo.java

@@ -6,6 +6,7 @@ import java.util.Map;
 import javax.validation.groups.Default;
 
 import com.lc.ibps.components.quartz.BaseJob;
+import com.lc.ibps.components.quartz.BaseJob2;
 import org.hibernate.validator.constraints.NotBlank;
 
 import com.lc.ibps.base.core.util.JacksonUtil;
@@ -24,7 +25,7 @@ public class JobDetailVo implements Serializable  {
 	@ApiModelProperty(value = "描述")
 	private String description;   /* 描述*/
 	@ApiModelProperty(value = "任务类")
-	@CheckClass(sclass = BaseJob.class, message = "{com.lc.ibps.common.quartz.vo.JobDetailVo.jobClass.valid}", groups = {Default.class})
+	@CheckClass(sclass = BaseJob2.class, message = "{com.lc.ibps.common.quartz.vo.JobDetailVo.jobClass.valid}", groups = {Default.class})
 	@NotBlank(message = "{com.lc.ibps.common.quartz.vo.JobDetailVo.jobClass}",groups = {Default.class})
 	private String jobClass;   /* 任务类 */
 	@ApiModelProperty(value = "分组")

+ 26 - 20
ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/cloud/timer/job/PrintJob.java

@@ -1,20 +1,26 @@
-//package com.lc.ibps.cloud.timer.job;
-//
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//
-//public class PrintJob extends BaseJob {
-//
-//	private static final Logger logger = LoggerFactory.getLogger(PrintJob.class);
-//
-//	@Override
-//	public void executeJob() throws Exception {
-////		JobDataMap dataMap = context.getMergedJobDataMap();
-////		logger.info("group={} job={} trigger={} is running.",
-////				context.getJobDetail().getKey().getGroup(),
-////				context.getJobDetail().getKey().getName(),
-////				context.getTrigger().getKey().getName());
-////		logger.info("jobDataMap=is {}.", JacksonUtil.toJsonString(dataMap.getWrappedMap()));
-//	}
-//
-//}
+package com.lc.ibps.cloud.timer.job;
+
+import com.lc.ibps.components.quartz.BaseJob2;
+import org.quartz.JobDataMap;
+import org.quartz.JobExecutionContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.lc.ibps.base.core.util.JacksonUtil;
+import com.lc.ibps.components.quartz.BaseJob;
+
+public class PrintJob extends BaseJob2 {
+
+    private static final Logger logger = LoggerFactory.getLogger(PrintJob.class);
+
+    @Override
+    public void executeJob(JobExecutionContext context) throws Exception {
+        JobDataMap dataMap = context.getMergedJobDataMap();
+        logger.info("group={} job={} trigger={} is running.",
+                context.getJobDetail().getKey().getGroup(),
+                context.getJobDetail().getKey().getName(),
+                context.getTrigger().getKey().getName());
+        logger.info("jobDataMap=is {}.", JacksonUtil.toJsonString(dataMap.getWrappedMap()));
+    }
+
+}

+ 73 - 55
ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/cloud/timer/job/RevokeServiceJob.java

@@ -1,55 +1,73 @@
-//package com.lc.ibps.cloud.timer.job;
-//
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//
-//import com.lc.ibps.base.core.util.AppUtil;
-//import com.lc.ibps.base.saas.token.ITenantTokenService;
-//
-//public class RevokeServiceJob extends BaseJob {
-//
-//	private static final Logger logger = LoggerFactory.getLogger(RevokeServiceJob.class);
-//	public static final String SERVICE_URL = "service-url";
-//
-//	private ITenantTokenService tenantTokenService = AppUtil.getBean(ITenantTokenService.class);
-//
-//	@SuppressWarnings("unchecked")
-//	@Override
-//	public void executeJob() throws Exception {
-////		JobDataMap dataMap = context.getMergedJobDataMap();
-////		if(logger.isInfoEnabled()) {
-////			logger.info("group={} job={} trigger={} is running.",
-////					context.getJobDetail().getKey().getGroup(),
-////					context.getJobDetail().getKey().getName(),
-////					context.getTrigger().getKey().getName());
-////			logger.info("jobDataMap=is {}.", JacksonUtil.toJsonString(dataMap.getWrappedMap()));
-////		}
-//
-//		// revoke service
-////		String url = dataMap.getString(SERVICE_URL);
-////		if(StringUtil.isBlank(url))
-////		{
-////			throw new RuntimeException("service url is empty.");
-////		}
-////
-////		// 获取token
-////		// 这里获取的是平台库的admin用户token
-////		// saas模式下切换库之后租户库中查询不到admin用户,所以找不到用户,导致null exception
-////		String accessToken = tenantTokenService.getAccessToken();
-////		List<NameValuePair> nameValuePairs = new ArrayList<>();
-////		NameValuePair nameValuePair = new BasicNameValuePair(ParameterKey.PARAMETER_ACCESS_TOKEN, accessToken);
-////		nameValuePairs.add(nameValuePair);
-////		Header header = new BasicHeader(ParameterKey.HEADER_AUTHORIZATION, accessToken);
-////		String responseData = ApacheHttpClient.doPost(url, nameValuePairs, header);
-////		APIResult<Void> result = JacksonUtil.getDTO(responseData, APIResult.class);
-////		if(null == result)
-////		{
-////			throw new RuntimeException("response is empty.");
-////		}
-////
-////		if(StateEnum.SUCCESS.getCode() != result.getState()){
-////			throw new BaseException(result.getCause());
-////		}
-//	}
-//
-//}
+package com.lc.ibps.cloud.timer.job;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.lc.ibps.components.quartz.BaseJob2;
+import org.apache.http.Header;
+import org.apache.http.NameValuePair;
+import org.apache.http.message.BasicHeader;
+import org.apache.http.message.BasicNameValuePair;
+import org.quartz.JobDataMap;
+import org.quartz.JobExecutionContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.lc.ibps.api.base.constants.StateEnum;
+import com.lc.ibps.base.core.exception.BaseException;
+import com.lc.ibps.base.core.util.AppUtil;
+import com.lc.ibps.base.core.util.JacksonUtil;
+import com.lc.ibps.base.core.util.string.StringUtil;
+import com.lc.ibps.base.saas.token.ITenantTokenService;
+import com.lc.ibps.cloud.constants.ParameterKey;
+import com.lc.ibps.cloud.entity.APIResult;
+import com.lc.ibps.components.httpclient.http.ApacheHttpClient;
+import com.lc.ibps.components.quartz.BaseJob;
+
+public class RevokeServiceJob extends BaseJob2 {
+
+	private static final Logger logger = LoggerFactory.getLogger(RevokeServiceJob.class);
+	public static final String SERVICE_URL = "service-url";
+
+	private ITenantTokenService tenantTokenService = AppUtil.getBean(ITenantTokenService.class);
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public void executeJob(JobExecutionContext context) throws Exception {
+		JobDataMap dataMap = context.getMergedJobDataMap();
+		if(logger.isInfoEnabled()) {
+			logger.info("group={} job={} trigger={} is running.",
+					context.getJobDetail().getKey().getGroup(),
+					context.getJobDetail().getKey().getName(),
+					context.getTrigger().getKey().getName());
+			logger.info("jobDataMap=is {}.", JacksonUtil.toJsonString(dataMap.getWrappedMap()));
+		}
+
+		// revoke service
+		String url = dataMap.getString(SERVICE_URL);
+		if(StringUtil.isBlank(url))
+		{
+			throw new RuntimeException("service url is empty.");
+		}
+
+		// 获取token
+		// 这里获取的是平台库的admin用户token
+		// saas模式下切换库之后租户库中查询不到admin用户,所以找不到用户,导致null exception
+		String accessToken = tenantTokenService.getAccessToken();
+		List<NameValuePair> nameValuePairs = new ArrayList<>();
+		NameValuePair nameValuePair = new BasicNameValuePair(ParameterKey.PARAMETER_ACCESS_TOKEN, accessToken);
+		nameValuePairs.add(nameValuePair);
+		Header header = new BasicHeader(ParameterKey.HEADER_AUTHORIZATION, accessToken);
+		String responseData = ApacheHttpClient.doPost(url, nameValuePairs, header);
+		APIResult<Void> result = JacksonUtil.getDTO(responseData, APIResult.class);
+		if(null == result)
+		{
+			throw new RuntimeException("response is empty.");
+		}
+
+		if(StateEnum.SUCCESS.getCode() != result.getState()){
+			throw new BaseException(result.getCause());
+		}
+	}
+
+}

+ 99 - 99
ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/cloud/timer/provider/JobLogProvider.java

@@ -1,99 +1,99 @@
-//package com.lc.ibps.cloud.timer.provider;
-//
-//import java.util.List;
-//
-//import javax.annotation.Resource;
-//
-//import org.springframework.stereotype.Service;
-//import org.springframework.web.bind.annotation.RequestBody;
-//import org.springframework.web.bind.annotation.RequestParam;
-//
-//import com.lc.ibps.api.base.constants.StateEnum;
-//import com.lc.ibps.api.base.query.QueryFilter;
-//import com.lc.ibps.base.core.constants.StringPool;
-//import com.lc.ibps.base.core.util.I18nUtil;
-//import com.lc.ibps.base.framework.request.signature.annotation.Signature;
-//import com.lc.ibps.cloud.entity.APIPageList;
-//import com.lc.ibps.cloud.entity.APIRequest;
-//import com.lc.ibps.cloud.entity.APIResult;
-//import com.lc.ibps.cloud.provider.GenericProvider;
-//import com.lc.ibps.common.quartz.domain.JobLog;
-//import com.lc.ibps.common.quartz.persistence.entity.JobLogPo;
-//import com.lc.ibps.common.quartz.repository.JobLogRepository;
-//import com.lc.ibps.timer.api.IJobLogService;
-//
-//import io.swagger.annotations.Api;
-//import io.swagger.annotations.ApiOperation;
-//import io.swagger.annotations.ApiParam;
-//import io.swagger.annotations.Extension;
-//import io.swagger.annotations.ExtensionProperty;
-//
-//@Api(tags = "定时计划日志管理", value = "定时计划日志")
-//@Service
-//public class JobLogProvider extends GenericProvider implements IJobLogService {
-//
-//	@Resource
-//	private JobLogRepository jobLogRepository;
-//
-//	@Override
-//	@ApiOperation(value = "定时计划日志列表", notes = "根据传入参数查询,并返回定时计划日志列表")
-//	public APIResult<APIPageList<JobLogPo>> query(
-//			@ApiParam(name = "request", value = "传入查询请求json字符串", required = true)
-//			@RequestBody(required = true) APIRequest request){
-//		APIResult<APIPageList<JobLogPo>> result = new APIResult<>();
-//		try{
-//			QueryFilter queryFilter = getQueryFilter(request);
-//			List<JobLogPo> data = jobLogRepository.query(queryFilter);
-//			// 注意构造返回数据
-//			APIPageList<JobLogPo> apiPageData = getAPIPageList(data);
-//			result.setData(apiPageData);
-//			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobLogProvider.query"));
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@Override
-//	@ApiOperation(value = "根据id定时计划日志", notes = "根据传入id查询,并返回定时计划日志")
-//	public APIResult<JobLogPo> get(
-//			@ApiParam(name = "id", value = "传入查询请求id", required = true)
-//			@RequestParam(name = "id", required = true) String id){
-//		APIResult<JobLogPo> result = new APIResult<>();
-//		try{
-//			JobLogPo data = jobLogRepository.get(id);
-//			result.setData(data);
-//			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobLogProvider.get"));
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@Override
-//	@ApiOperation(value = "定时计划日志删除", notes = "删除定时计划日志",
-//			extensions = {
-//					@Extension(properties = {
-//							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
-//					})
-//			})
-//	@Signature
-//	public APIResult<Void> remove(
-//			@ApiParam(name = "ids", value = "定时计划日志id数组", required = true)
-//			@RequestParam(name = "ids", required = true) String[] ids
-//			){
-//		APIResult<Void> result = new APIResult<>();
-//		try{
-//			JobLog jobLogDomain = jobLogRepository.newInstance();
-//			jobLogDomain.deleteByIds(ids);
-//			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobLogProvider.remove"));
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//}
+package com.lc.ibps.cloud.timer.provider;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import com.lc.ibps.api.base.constants.StateEnum;
+import com.lc.ibps.api.base.query.QueryFilter;
+import com.lc.ibps.base.core.constants.StringPool;
+import com.lc.ibps.base.core.util.I18nUtil;
+import com.lc.ibps.base.framework.request.signature.annotation.Signature;
+import com.lc.ibps.cloud.entity.APIPageList;
+import com.lc.ibps.cloud.entity.APIRequest;
+import com.lc.ibps.cloud.entity.APIResult;
+import com.lc.ibps.cloud.provider.GenericProvider;
+import com.lc.ibps.common.quartz.domain.JobLog;
+import com.lc.ibps.common.quartz.persistence.entity.JobLogPo;
+import com.lc.ibps.common.quartz.repository.JobLogRepository;
+import com.lc.ibps.timer.api.IJobLogService;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.Extension;
+import io.swagger.annotations.ExtensionProperty;
+
+@Api(tags = "定时计划日志管理", value = "定时计划日志")
+@Service
+public class JobLogProvider extends GenericProvider implements IJobLogService {
+
+	@Resource
+	private JobLogRepository jobLogRepository;
+
+	@Override
+	@ApiOperation(value = "定时计划日志列表", notes = "根据传入参数查询,并返回定时计划日志列表")
+	public APIResult<APIPageList<JobLogPo>> query(
+			@ApiParam(name = "request", value = "传入查询请求json字符串", required = true)
+			@RequestBody(required = true) APIRequest request){
+		APIResult<APIPageList<JobLogPo>> result = new APIResult<>();
+		try{
+			QueryFilter queryFilter = getQueryFilter(request);
+			List<JobLogPo> data = jobLogRepository.query(queryFilter);
+			// 注意构造返回数据
+			APIPageList<JobLogPo> apiPageData = getAPIPageList(data);
+			result.setData(apiPageData);
+			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobLogProvider.query"));
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@Override
+	@ApiOperation(value = "根据id定时计划日志", notes = "根据传入id查询,并返回定时计划日志")
+	public APIResult<JobLogPo> get(
+			@ApiParam(name = "id", value = "传入查询请求id", required = true)
+			@RequestParam(name = "id", required = true) String id){
+		APIResult<JobLogPo> result = new APIResult<>();
+		try{
+			JobLogPo data = jobLogRepository.get(id);
+			result.setData(data);
+			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobLogProvider.get"));
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@Override
+	@ApiOperation(value = "定时计划日志删除", notes = "删除定时计划日志",
+			extensions = {
+					@Extension(properties = {
+							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
+					})
+			})
+	@Signature
+	public APIResult<Void> remove(
+			@ApiParam(name = "ids", value = "定时计划日志id数组", required = true)
+			@RequestParam(name = "ids", required = true) String[] ids
+			){
+		APIResult<Void> result = new APIResult<>();
+		try{
+			JobLog jobLogDomain = jobLogRepository.newInstance();
+			jobLogDomain.deleteByIds(ids);
+			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobLogProvider.remove"));
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+}

+ 286 - 286
ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/cloud/timer/provider/JobProvider.java

@@ -1,286 +1,286 @@
-//package com.lc.ibps.cloud.timer.provider;
-//
-//import java.util.List;
-//
-//import javax.annotation.Resource;
-//
-//import org.springframework.context.annotation.Lazy;
-//import org.springframework.stereotype.Service;
-//import org.springframework.web.bind.annotation.RequestBody;
-//import org.springframework.web.bind.annotation.RequestParam;
-//
-//import com.lc.ibps.api.base.constants.StateEnum;
-//import com.lc.ibps.api.base.page.Page;
-//import com.lc.ibps.base.core.constants.StringPool;
-//import com.lc.ibps.base.core.exception.BaseException;
-//import com.lc.ibps.base.core.util.BeanUtils;
-//import com.lc.ibps.base.core.util.I18nUtil;
-//import com.lc.ibps.base.core.util.JacksonUtil;
-//import com.lc.ibps.base.framework.request.signature.annotation.Signature;
-//import com.lc.ibps.cloud.entity.APIPageList;
-//import com.lc.ibps.cloud.entity.APIRequestPage;
-//import com.lc.ibps.cloud.entity.APIResult;
-//import com.lc.ibps.cloud.provider.GenericProvider;
-//import com.lc.ibps.cloud.utils.QueryFilterUtil;
-//import com.lc.ibps.common.quartz.domain.JobDetail;
-//import com.lc.ibps.common.quartz.repository.JobDetailRepository;
-//import com.lc.ibps.common.quartz.vo.JobDetailVo;
-//import com.lc.ibps.components.quartz.BaseJob;
-//import com.lc.ibps.timer.api.IJobMgrService;
-//import com.lc.ibps.timer.api.IJobService;
-//
-//import io.swagger.annotations.Api;
-//import io.swagger.annotations.ApiOperation;
-//import io.swagger.annotations.ApiParam;
-//import io.swagger.annotations.Extension;
-//import io.swagger.annotations.ExtensionProperty;
-//
-//@Api(tags = "定时任务管理", value = "定时任务")
-//@Service
-//public class JobProvider extends GenericProvider implements IJobService, IJobMgrService {
-//
-//	@Resource
-//	@Lazy
-//	private JobDetailRepository jobDetailRepository;
-//	@Resource
-//	@Lazy
-//	private JobDetail jobDetailDomain;
-//
-//	@ApiOperation(value = "定时任务列表", notes = "根据传入参数查询,并返回定时任务列表")
-//	@Override
-//	public APIResult<APIPageList<JobDetailVo>> query(
-//			@ApiParam(name = "jobName", value = "任务名", required = false)
-//			@RequestParam(name = "jobName", required = false) String jobName,
-//			@ApiParam(name = "group", value = "分组", required = false)
-//			@RequestParam(name = "group", required = false) String group,
-//			@ApiParam(name = "page", value = "传入查询请求json字符串", required = true)
-//			@RequestBody(required = true) APIRequestPage page){
-//		APIResult<APIPageList<JobDetailVo>> result = new APIResult<>();
-//		try{
-//			Page dpage = QueryFilterUtil.getQueryFilterPage(page);
-//			List<JobDetailVo> data = jobDetailRepository.query(jobName, group, dpage);
-//			// 注意构造返回数据
-//			APIPageList<JobDetailVo> apiPageData = getAPIPageList(data);
-//			result.setData(apiPageData);
-//			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.query"));
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@ApiOperation(value = "定时任务对象", notes = "根据传入参数查询,并返回定时任务对象")
-//	@Override
-//	public APIResult<JobDetailVo> get(
-//			@ApiParam(name = "jobName", value = "任务名", required = true)
-//			@RequestParam(name = "jobName", required = true) String jobName,
-//			@ApiParam(name = "group", value = "分组", required = true)
-//			@RequestParam(name = "group", required = true) String group){
-//		APIResult<JobDetailVo> result = new APIResult<>();
-//		try{
-//			JobDetailVo data = jobDetailRepository.getByJobNameAndGroup(jobName, group);
-//			result.setData(data);
-//			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.get"));
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@ApiOperation(value = "定时任务分组列表", notes = "返回定时任务分组列表")
-//	@Override
-//	public APIResult<List<String>> groups(){
-//		APIResult<List<String>> result = new APIResult<>();
-//		try{
-//			result.setData(jobDetailRepository.getAllGroups());
-//			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.groups"));
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@ApiOperation(value = "定时任务创建", notes = "根据传入数据,保存定时任务",
-//			extensions = {
-//					@Extension(properties = {
-//							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
-//					})
-//			})
-//	@Signature
-//	@Override
-//	public APIResult<String> create(
-//			@ApiParam(name = "jobDetail", value = "定时任务对象", required = true)
-//			@RequestBody(required = true) JobDetailVo job){
-//		APIResult<String> result = new APIResult<>();
-//		try{
-//			boolean isExist = jobDetailRepository.isExists(job.getJobName(), job.getGroup());
-//			if (isExist) {
-//				throw new BaseException(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.create.ex"));
-//			} else {
-//				logger.debug("jobDataMap ==> {}", job.getJobDataMap());
-//				jobDetailDomain.create(job.getJobName(),
-//						job.getGroup(),
-//						job.getJobClass(),
-//						JacksonUtil.toJsonString(job.getJobDataMap()),
-//						job.getDescription());
-//				result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.create"));
-//			}
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@ApiOperation(value = "定时任务编辑", notes = "根据传入数据,保存定时任务",
-//			extensions = {
-//					@Extension(properties = {
-//							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
-//					})
-//			})
-//	@Signature
-//	@Override
-//	public APIResult<String> update(
-//			@ApiParam(name = "jobDetail", value = "定时任务对象", required = true)
-//			@RequestBody(required = true) JobDetailVo job){
-//		APIResult<String> result = new APIResult<>();
-//		try{
-//			boolean isExist = jobDetailRepository.isExists(job.getJobName(), job.getGroup());
-//			if (isExist) {
-//				jobDetailDomain.update(job.getJobName(),
-//						job.getGroup(),
-//						job.getJobClass(),
-//						JacksonUtil.toJsonString(job.getJobDataMap()),
-//						job.getDescription());
-//				result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.update"));
-//			} else {
-//				throw new BaseException(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.update.ex"));
-//			}
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@ApiOperation(value = "定时任务保存", notes = "根据传入数据,保存定时任务", hidden = true,
-//			extensions = {
-//					@Extension(properties = {
-//							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
-//					})
-//			})
-//	@Signature
-//	@Override
-//	public APIResult<String> save(
-//			@ApiParam(name = "jobDetail", value = "定时任务对象", required = true)
-//			@RequestBody(required = true) JobDetailVo job){
-//		APIResult<String> result = new APIResult<>();
-//		try{
-//			boolean isExist = jobDetailRepository.isExists(job.getJobName(), job.getGroup());
-//			if (isExist) {
-//				jobDetailDomain.update(job.getJobName(),
-//						job.getGroup(),
-//						job.getJobClass(),
-//						JacksonUtil.toJsonString(job.getJobDataMap()),
-//						job.getDescription());
-//			} else {
-//				logger.debug("jobDataMap ==> {}", job.getJobDataMap());
-//				jobDetailDomain.create(job.getJobName(),
-//						job.getGroup(),
-//						job.getJobClass(),
-//						JacksonUtil.toJsonString(job.getJobDataMap()),
-//						job.getDescription());
-//				result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.save"));
-//			}
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@ApiOperation(value = "定时任务删除", notes = "删除定时任务",
-//			extensions = {
-//					@Extension(properties = {
-//							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
-//					})
-//			})
-//	@Signature
-//	@Override
-//	public APIResult<Void> remove(
-//			@ApiParam(name = "jobNames", value = "任务名数组", required = true)
-//			@RequestParam(name = "jobNames", required = true) String[] jobNames,
-//			@ApiParam(name = "groups", value = "分组名数组", required = true)
-//			@RequestParam(name = "groups", required = true) String[] groups
-//			){
-//		APIResult<Void> result = new APIResult<>();
-//		try{
-//			jobDetailDomain.remove(jobNames, groups);
-//			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.remove"));
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@ApiOperation(value = "定时任务执行", notes = "执行定时任务",
-//			extensions = {
-//					@Extension(properties = {
-//							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
-//					})
-//			})
-//	@Signature
-//	@Override
-//	public APIResult<Void> execute(
-//			@ApiParam(name = "jobName", value = "任务名", required = true)
-//			@RequestParam(name = "jobName", required = true) String jobName,
-//			@ApiParam(name = "group", value = "分组名", required = true)
-//			@RequestParam(name = "group", required = true) String group
-//			){
-//		APIResult<Void> result = new APIResult<>();
-//		try{
-//			jobDetailDomain.execute(jobName, group);
-//			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.execute"));
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	/**
-//	 * 验证类
-//	 *
-//	 * @param jobClass
-//	 * @throws Exception
-//	 */
-//	@ApiOperation(value = "验证类", notes = "验证类")
-//	@Override
-//	public APIResult<Void> validClass(
-//			@ApiParam(name = "jobClass", value = "完整类名", required = true)
-//			@RequestParam(name = "jobClass", required = true) String jobClass) throws Exception {
-//		APIResult<Void> result = new APIResult<>();
-//		try{
-//			boolean exist = BeanUtils.validClass(jobClass);
-//			boolean spClass = BeanUtils.isInherit(Class.forName(jobClass), BaseJob.class);
-//
-//			if(exist && spClass)
-//			{
-//				result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.validClass.success"));
-//			}
-//			else
-//			{
-//				result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.validClass.failure"));
-//			}
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//}
+package com.lc.ibps.cloud.timer.provider;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import com.lc.ibps.common.quartz.domain.JobDetail;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import com.lc.ibps.api.base.constants.StateEnum;
+import com.lc.ibps.api.base.page.Page;
+import com.lc.ibps.base.core.constants.StringPool;
+import com.lc.ibps.base.core.exception.BaseException;
+import com.lc.ibps.base.core.util.BeanUtils;
+import com.lc.ibps.base.core.util.I18nUtil;
+import com.lc.ibps.base.core.util.JacksonUtil;
+import com.lc.ibps.base.framework.request.signature.annotation.Signature;
+import com.lc.ibps.cloud.entity.APIPageList;
+import com.lc.ibps.cloud.entity.APIRequestPage;
+import com.lc.ibps.cloud.entity.APIResult;
+import com.lc.ibps.cloud.provider.GenericProvider;
+import com.lc.ibps.cloud.utils.QueryFilterUtil;
+import com.lc.ibps.common.quartz.repository.JobDetailRepository;
+import com.lc.ibps.common.quartz.vo.JobDetailVo;
+import com.lc.ibps.components.quartz.BaseJob;
+import com.lc.ibps.timer.api.IJobMgrService;
+import com.lc.ibps.timer.api.IJobService;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.Extension;
+import io.swagger.annotations.ExtensionProperty;
+
+@Api(tags = "定时任务管理", value = "定时任务")
+@Service
+public class JobProvider extends GenericProvider implements IJobService, IJobMgrService {
+
+	@Resource
+	@Lazy
+	private JobDetailRepository jobDetailRepository;
+	@Resource
+	@Lazy
+	private JobDetail jobDetailDomain;
+
+	@ApiOperation(value = "定时任务列表", notes = "根据传入参数查询,并返回定时任务列表")
+	@Override
+	public APIResult<APIPageList<JobDetailVo>> query(
+			@ApiParam(name = "jobName", value = "任务名", required = false)
+			@RequestParam(name = "jobName", required = false) String jobName,
+			@ApiParam(name = "group", value = "分组", required = false)
+			@RequestParam(name = "group", required = false) String group,
+			@ApiParam(name = "page", value = "传入查询请求json字符串", required = true)
+			@RequestBody(required = true) APIRequestPage page){
+		APIResult<APIPageList<JobDetailVo>> result = new APIResult<>();
+		try{
+			Page dpage = QueryFilterUtil.getQueryFilterPage(page);
+			List<JobDetailVo> data = jobDetailRepository.query(jobName, group, dpage);
+			// 注意构造返回数据
+			APIPageList<JobDetailVo> apiPageData = getAPIPageList(data);
+			result.setData(apiPageData);
+			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.query"));
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@ApiOperation(value = "定时任务对象", notes = "根据传入参数查询,并返回定时任务对象")
+	@Override
+	public APIResult<JobDetailVo> get(
+			@ApiParam(name = "jobName", value = "任务名", required = true)
+			@RequestParam(name = "jobName", required = true) String jobName,
+			@ApiParam(name = "group", value = "分组", required = true)
+			@RequestParam(name = "group", required = true) String group){
+		APIResult<JobDetailVo> result = new APIResult<>();
+		try{
+			JobDetailVo data = jobDetailRepository.getByJobNameAndGroup(jobName, group);
+			result.setData(data);
+			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.get"));
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@ApiOperation(value = "定时任务分组列表", notes = "返回定时任务分组列表")
+	@Override
+	public APIResult<List<String>> groups(){
+		APIResult<List<String>> result = new APIResult<>();
+		try{
+			result.setData(jobDetailRepository.getAllGroups());
+			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.groups"));
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@ApiOperation(value = "定时任务创建", notes = "根据传入数据,保存定时任务",
+			extensions = {
+					@Extension(properties = {
+							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
+					})
+			})
+	@Signature
+	@Override
+	public APIResult<String> create(
+			@ApiParam(name = "jobDetail", value = "定时任务对象", required = true)
+			@RequestBody(required = true) JobDetailVo job){
+		APIResult<String> result = new APIResult<>();
+		try{
+			boolean isExist = jobDetailRepository.isExists(job.getJobName(), job.getGroup());
+			if (isExist) {
+				throw new BaseException(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.create.ex"));
+			} else {
+				logger.debug("jobDataMap ==> {}", job.getJobDataMap());
+				jobDetailDomain.create(job.getJobName(),
+						job.getGroup(),
+						job.getJobClass(),
+						JacksonUtil.toJsonString(job.getJobDataMap()),
+						job.getDescription());
+				result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.create"));
+			}
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@ApiOperation(value = "定时任务编辑", notes = "根据传入数据,保存定时任务",
+			extensions = {
+					@Extension(properties = {
+							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
+					})
+			})
+	@Signature
+	@Override
+	public APIResult<String> update(
+			@ApiParam(name = "jobDetail", value = "定时任务对象", required = true)
+			@RequestBody(required = true) JobDetailVo job){
+		APIResult<String> result = new APIResult<>();
+		try{
+			boolean isExist = jobDetailRepository.isExists(job.getJobName(), job.getGroup());
+			if (isExist) {
+				jobDetailDomain.update(job.getJobName(),
+						job.getGroup(),
+						job.getJobClass(),
+						JacksonUtil.toJsonString(job.getJobDataMap()),
+						job.getDescription());
+				result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.update"));
+			} else {
+				throw new BaseException(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.update.ex"));
+			}
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@ApiOperation(value = "定时任务保存", notes = "根据传入数据,保存定时任务", hidden = true,
+			extensions = {
+					@Extension(properties = {
+							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
+					})
+			})
+	@Signature
+	@Override
+	public APIResult<String> save(
+			@ApiParam(name = "jobDetail", value = "定时任务对象", required = true)
+			@RequestBody(required = true) JobDetailVo job){
+		APIResult<String> result = new APIResult<>();
+		try{
+			boolean isExist = jobDetailRepository.isExists(job.getJobName(), job.getGroup());
+			if (isExist) {
+				jobDetailDomain.update(job.getJobName(),
+						job.getGroup(),
+						job.getJobClass(),
+						JacksonUtil.toJsonString(job.getJobDataMap()),
+						job.getDescription());
+			} else {
+				logger.debug("jobDataMap ==> {}", job.getJobDataMap());
+				jobDetailDomain.create(job.getJobName(),
+						job.getGroup(),
+						job.getJobClass(),
+						JacksonUtil.toJsonString(job.getJobDataMap()),
+						job.getDescription());
+				result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.save"));
+			}
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@ApiOperation(value = "定时任务删除", notes = "删除定时任务",
+			extensions = {
+					@Extension(properties = {
+							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
+					})
+			})
+	@Signature
+	@Override
+	public APIResult<Void> remove(
+			@ApiParam(name = "jobNames", value = "任务名数组", required = true)
+			@RequestParam(name = "jobNames", required = true) String[] jobNames,
+			@ApiParam(name = "groups", value = "分组名数组", required = true)
+			@RequestParam(name = "groups", required = true) String[] groups
+			){
+		APIResult<Void> result = new APIResult<>();
+		try{
+			jobDetailDomain.remove(jobNames, groups);
+			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.remove"));
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@ApiOperation(value = "定时任务执行", notes = "执行定时任务",
+			extensions = {
+					@Extension(properties = {
+							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
+					})
+			})
+	@Signature
+	@Override
+	public APIResult<Void> execute(
+			@ApiParam(name = "jobName", value = "任务名", required = true)
+			@RequestParam(name = "jobName", required = true) String jobName,
+			@ApiParam(name = "group", value = "分组名", required = true)
+			@RequestParam(name = "group", required = true) String group
+			){
+		APIResult<Void> result = new APIResult<>();
+		try{
+			jobDetailDomain.execute(jobName, group);
+			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.execute"));
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	/**
+	 * 验证类
+	 *
+	 * @param jobClass
+	 * @throws Exception
+	 */
+	@ApiOperation(value = "验证类", notes = "验证类")
+	@Override
+	public APIResult<Void> validClass(
+			@ApiParam(name = "jobClass", value = "完整类名", required = true)
+			@RequestParam(name = "jobClass", required = true) String jobClass) throws Exception {
+		APIResult<Void> result = new APIResult<>();
+		try{
+			boolean exist = BeanUtils.validClass(jobClass);
+			boolean spClass = BeanUtils.isInherit(Class.forName(jobClass), BaseJob.class);
+
+			if(exist && spClass)
+			{
+				result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.validClass.success"));
+			}
+			else
+			{
+				result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.JobProvider.validClass.failure"));
+			}
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+}

+ 67 - 67
ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/cloud/timer/provider/SchedulerProvider.java

@@ -1,67 +1,67 @@
-//package com.lc.ibps.cloud.timer.provider;
-//
-//import javax.annotation.Resource;
-//
-//import org.springframework.stereotype.Service;
-//
-//import com.lc.ibps.api.base.constants.StateEnum;
-//import com.lc.ibps.base.core.util.I18nUtil;
-//import com.lc.ibps.cloud.entity.APIResult;
-//import com.lc.ibps.cloud.provider.GenericProvider;
-//import com.lc.ibps.components.quartz.service.ISchedulerService;
-//import com.lc.ibps.timer.api.ISchedulerApiService;
-//
-//import io.swagger.annotations.Api;
-//import io.swagger.annotations.ApiOperation;
-//
-//@Api(tags = "调度管理", value = "调度中心")
-//@Service
-//public class SchedulerProvider extends GenericProvider implements ISchedulerApiService {
-//
-//	@Resource(name = "schedulerServiceImpl")
-//	private ISchedulerService schedulerService;
-//
-//	@Override
-//	@ApiOperation(value = "启动调度中心", notes = "启动调度中心")
-//	public APIResult<String> start(){
-//		APIResult<String> result = new APIResult<>();
-//		try{
-//			schedulerService.start();
-//			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.SchedulerProvider.start"));
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@Override
-//	@ApiOperation(value = "停止调度中心", notes = "停止调度中心")
-//	public APIResult<String> stop(){
-//		APIResult<String> result = new APIResult<>();
-//		try{
-//			schedulerService.shutdown();
-//			result.setMessage(I18nUtil.getMessage(""));
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@Override
-//	@ApiOperation(value = "调度中心是否启动状态", notes = "调度中心是否启动状态")
-//	public APIResult<Void> status() {
-//		APIResult<Void> result = new APIResult<>();
-//		try{
-//			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.SchedulerProvider.status"));
-//			result.addVariable("isStarted", schedulerService.isStarted());
-//			result.addVariable("isShutdown", schedulerService.isShutdown());
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//}
+package com.lc.ibps.cloud.timer.provider;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.lc.ibps.api.base.constants.StateEnum;
+import com.lc.ibps.base.core.util.I18nUtil;
+import com.lc.ibps.cloud.entity.APIResult;
+import com.lc.ibps.cloud.provider.GenericProvider;
+import com.lc.ibps.components.quartz.service.ISchedulerService;
+import com.lc.ibps.timer.api.ISchedulerApiService;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+@Api(tags = "调度管理", value = "调度中心")
+@Service
+public class SchedulerProvider extends GenericProvider implements ISchedulerApiService {
+
+	@Resource(name = "schedulerServiceImpl")
+	private ISchedulerService schedulerService;
+
+	@Override
+	@ApiOperation(value = "启动调度中心", notes = "启动调度中心")
+	public APIResult<String> start(){
+		APIResult<String> result = new APIResult<>();
+		try{
+			schedulerService.start();
+			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.SchedulerProvider.start"));
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@Override
+	@ApiOperation(value = "停止调度中心", notes = "停止调度中心")
+	public APIResult<String> stop(){
+		APIResult<String> result = new APIResult<>();
+		try{
+			schedulerService.shutdown();
+			result.setMessage(I18nUtil.getMessage(""));
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@Override
+	@ApiOperation(value = "调度中心是否启动状态", notes = "调度中心是否启动状态")
+	public APIResult<Void> status() {
+		APIResult<Void> result = new APIResult<>();
+		try{
+			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.SchedulerProvider.status"));
+			result.addVariable("isStarted", schedulerService.isStarted());
+			result.addVariable("isShutdown", schedulerService.isShutdown());
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+}

+ 183 - 182
ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/cloud/timer/provider/TriggerProvider.java

@@ -1,182 +1,183 @@
-//package com.lc.ibps.cloud.timer.provider;
-//
-//import java.util.List;
-//import java.util.Map;
-//
-//import javax.annotation.Resource;
-//
-//import org.springframework.context.annotation.Lazy;
-//import org.springframework.stereotype.Service;
-//import org.springframework.web.bind.annotation.RequestBody;
-//import org.springframework.web.bind.annotation.RequestParam;
-//
-//import com.lc.ibps.api.base.constants.StateEnum;
-//import com.lc.ibps.api.base.page.Page;
-//import com.lc.ibps.base.core.constants.StringPool;
-//import com.lc.ibps.base.core.util.I18nUtil;
-//import com.lc.ibps.base.core.util.JacksonUtil;
-//import com.lc.ibps.base.framework.request.signature.annotation.Signature;
-//import com.lc.ibps.cloud.entity.APIPageList;
-//import com.lc.ibps.cloud.entity.APIRequestPage;
-//import com.lc.ibps.cloud.entity.APIResult;
-//import com.lc.ibps.cloud.provider.GenericProvider;
-//import com.lc.ibps.cloud.utils.QueryFilterUtil;
-//import com.lc.ibps.common.quartz.repository.TriggerRepository;
-//import com.lc.ibps.common.quartz.vo.TriggerVo;
-//import com.lc.ibps.timer.api.ITriggerService;
-//
-//import io.swagger.annotations.Api;
-//import io.swagger.annotations.ApiOperation;
-//import io.swagger.annotations.ApiParam;
-//import io.swagger.annotations.Extension;
-//import io.swagger.annotations.ExtensionProperty;
-//
-//@Api(tags = "定时计划管理", value = "定时计划")
-//@Service
-//public class TriggerProvider extends GenericProvider implements ITriggerService {
-//
-//	@Resource
-//	@Lazy
-//	private TriggerRepository triggerRepository;
-//	@Resource
-//	@Lazy
-//	private Trigger triggerDomain;
-//
-//	@Override
-//	@ApiOperation(value = "定时计划列表", notes = "根据传入参数查询,并返回定时计划列表")
-//	public APIResult<APIPageList<TriggerVo>> query(
-//			@ApiParam(name = "jobName", value = "任务名", required = false)
-//			@RequestParam(name = "jobName", required = false) String jobName,
-//			@ApiParam(name = "group", value = "分组", required = false)
-//			@RequestParam(name = "group", required = false) String group,
-//			@ApiParam(name = "page", value = "传入查询请求json字符串", required = true)
-//			@RequestBody(required = true) APIRequestPage page){
-//		APIResult<APIPageList<TriggerVo>> result = new APIResult<>();
-//		try{
-//			Page dpage = QueryFilterUtil.getQueryFilterPage(page);
-//			List<TriggerVo> data = triggerRepository.query(jobName, group, dpage);
-//			// 注意构造返回数据
-//			APIPageList<TriggerVo> apiPageData = getAPIPageList(data);
-//			result.setData(apiPageData);
-//			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.TriggerProvider.query"));
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@Override
-//	@ApiOperation(value = "定时计划保存", notes = "根据传入数据,保存定时计划",
-//			extensions = {
-//					@Extension(properties = {
-//							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
-//					})
-//			})
-//	@Signature
-//	public APIResult<String> save(
-//			@ApiParam(name = "jobName", value = "任务名", required = true)
-//			@RequestParam(name = "jobName", required = true) String jobName,
-//			@ApiParam(name = "group", value = "分组", required = true)
-//			@RequestParam(name = "group", required = true) String group,
-//			@ApiParam(name = "triggerName", value = "计划名称", required = true)
-//			@RequestParam(name = "triggerName", required = true) String triggerName,
-//			@ApiParam(name = "dataMap", value = "参数", required = false)
-//			@RequestBody(required = false) Map<String, String> dataMap){
-//		APIResult<String> result = new APIResult<>();
-//		try{
-//
-//			boolean isExist = triggerRepository.isExists(jobName, group);
-//			if (isExist) {
-//				result.setState(StateEnum.ERROR_TIMER_EXIST.getCode());
-//				result.setCause(StateEnum.ERROR_TIMER_EXIST.getText());
-//			} else {
-//				triggerDomain.create(jobName,
-//						triggerName,
-//						JacksonUtil.toJsonString(dataMap),
-//						group);
-//				result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.TriggerProvider.save"));
-//			}
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@Override
-//	@ApiOperation(value = "定时计划删除", notes = "删除定时计划",
-//			extensions = {
-//					@Extension(properties = {
-//							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
-//					})
-//			})
-//	@Signature
-//	public APIResult<Void> remove(
-//			@ApiParam(name = "triggerNames", value = "计划名数组", required = true)
-//			@RequestParam(name = "triggerNames", required = true) String[] triggerNames,
-//			@ApiParam(name = "groups", value = "分组名数组", required = true)
-//			@RequestParam(name = "groups", required = true) String[] groups
-//			){
-//		APIResult<Void> result = new APIResult<>();
-//		try{
-//			triggerDomain.remove(triggerNames, groups);
-//			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.TriggerProvider.remove"));
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@Override
-//	@ApiOperation(value = "定时计划启动", notes = "启动定时计划",
-//			extensions = {
-//					@Extension(properties = {
-//							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
-//					})
-//			})
-//	@Signature
-//	public APIResult<Void> start(
-//			@ApiParam(name = "triggerName", value = "计划名", required = true)
-//			@RequestParam(name = "triggerName", required = true) String triggerName,
-//			@ApiParam(name = "group", value = "分组名", required = true)
-//			@RequestParam(name = "group", required = true) String group
-//			){
-//		APIResult<Void> result = new APIResult<>();
-//		try{
-//			triggerDomain.start(triggerName, group);
-//			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.TriggerProvider.start"));
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//	@Override
-//	@ApiOperation(value = "定时计划停止", notes = "停止定时计划",
-//			extensions = {
-//					@Extension(properties = {
-//							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
-//					})
-//			})
-//	@Signature
-//	public APIResult<Void> stop(
-//			@ApiParam(name = "triggerName", value = "计划名", required = true)
-//			@RequestParam(name = "triggerName", required = true) String triggerName,
-//			@ApiParam(name = "group", value = "分组名", required = true)
-//			@RequestParam(name = "group", required = true) String group
-//			){
-//		APIResult<Void> result = new APIResult<>();
-//		try{
-//			triggerDomain.stop(triggerName, group);
-//			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.TriggerProvider.stop"));
-//		}catch(Exception e){
-//			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
-//		}
-//
-//		return result;
-//	}
-//
-//}
+package com.lc.ibps.cloud.timer.provider;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import com.lc.ibps.common.quartz.domain.Trigger;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import com.lc.ibps.api.base.constants.StateEnum;
+import com.lc.ibps.api.base.page.Page;
+import com.lc.ibps.base.core.constants.StringPool;
+import com.lc.ibps.base.core.util.I18nUtil;
+import com.lc.ibps.base.core.util.JacksonUtil;
+import com.lc.ibps.base.framework.request.signature.annotation.Signature;
+import com.lc.ibps.cloud.entity.APIPageList;
+import com.lc.ibps.cloud.entity.APIRequestPage;
+import com.lc.ibps.cloud.entity.APIResult;
+import com.lc.ibps.cloud.provider.GenericProvider;
+import com.lc.ibps.cloud.utils.QueryFilterUtil;
+import com.lc.ibps.common.quartz.repository.TriggerRepository;
+import com.lc.ibps.common.quartz.vo.TriggerVo;
+import com.lc.ibps.timer.api.ITriggerService;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.Extension;
+import io.swagger.annotations.ExtensionProperty;
+
+@Api(tags = "定时计划管理", value = "定时计划")
+@Service
+public class TriggerProvider extends GenericProvider implements ITriggerService {
+
+	@Resource
+	@Lazy
+	private TriggerRepository triggerRepository;
+	@Resource
+	@Lazy
+	private Trigger triggerDomain;
+
+	@Override
+	@ApiOperation(value = "定时计划列表", notes = "根据传入参数查询,并返回定时计划列表")
+	public APIResult<APIPageList<TriggerVo>> query(
+			@ApiParam(name = "jobName", value = "任务名", required = false)
+			@RequestParam(name = "jobName", required = false) String jobName,
+			@ApiParam(name = "group", value = "分组", required = false)
+			@RequestParam(name = "group", required = false) String group,
+			@ApiParam(name = "page", value = "传入查询请求json字符串", required = true)
+			@RequestBody(required = true) APIRequestPage page){
+		APIResult<APIPageList<TriggerVo>> result = new APIResult<>();
+		try{
+			Page dpage = QueryFilterUtil.getQueryFilterPage(page);
+			List<TriggerVo> data = triggerRepository.query(jobName, group, dpage);
+			// 注意构造返回数据
+			APIPageList<TriggerVo> apiPageData = getAPIPageList(data);
+			result.setData(apiPageData);
+			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.TriggerProvider.query"));
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@Override
+	@ApiOperation(value = "定时计划保存", notes = "根据传入数据,保存定时计划",
+			extensions = {
+					@Extension(properties = {
+							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
+					})
+			})
+	@Signature
+	public APIResult<String> save(
+			@ApiParam(name = "jobName", value = "任务名", required = true)
+			@RequestParam(name = "jobName", required = true) String jobName,
+			@ApiParam(name = "group", value = "分组", required = true)
+			@RequestParam(name = "group", required = true) String group,
+			@ApiParam(name = "triggerName", value = "计划名称", required = true)
+			@RequestParam(name = "triggerName", required = true) String triggerName,
+			@ApiParam(name = "dataMap", value = "参数", required = false)
+			@RequestBody(required = false) Map<String, String> dataMap){
+		APIResult<String> result = new APIResult<>();
+		try{
+
+			boolean isExist = triggerRepository.isExists(jobName, group);
+			if (isExist) {
+				result.setState(StateEnum.ERROR_TIMER_EXIST.getCode());
+				result.setCause(StateEnum.ERROR_TIMER_EXIST.getText());
+			} else {
+				triggerDomain.create(jobName,
+						triggerName,
+						JacksonUtil.toJsonString(dataMap),
+						group);
+				result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.TriggerProvider.save"));
+			}
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@Override
+	@ApiOperation(value = "定时计划删除", notes = "删除定时计划",
+			extensions = {
+					@Extension(properties = {
+							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
+					})
+			})
+	@Signature
+	public APIResult<Void> remove(
+			@ApiParam(name = "triggerNames", value = "计划名数组", required = true)
+			@RequestParam(name = "triggerNames", required = true) String[] triggerNames,
+			@ApiParam(name = "groups", value = "分组名数组", required = true)
+			@RequestParam(name = "groups", required = true) String[] groups
+			){
+		APIResult<Void> result = new APIResult<>();
+		try{
+			triggerDomain.remove(triggerNames, groups);
+			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.TriggerProvider.remove"));
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@Override
+	@ApiOperation(value = "定时计划启动", notes = "启动定时计划",
+			extensions = {
+					@Extension(properties = {
+							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
+					})
+			})
+	@Signature
+	public APIResult<Void> start(
+			@ApiParam(name = "triggerName", value = "计划名", required = true)
+			@RequestParam(name = "triggerName", required = true) String triggerName,
+			@ApiParam(name = "group", value = "分组名", required = true)
+			@RequestParam(name = "group", required = true) String group
+			){
+		APIResult<Void> result = new APIResult<>();
+		try{
+			triggerDomain.start(triggerName, group);
+			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.TriggerProvider.start"));
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+	@Override
+	@ApiOperation(value = "定时计划停止", notes = "停止定时计划",
+			extensions = {
+					@Extension(properties = {
+							@ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
+					})
+			})
+	@Signature
+	public APIResult<Void> stop(
+			@ApiParam(name = "triggerName", value = "计划名", required = true)
+			@RequestParam(name = "triggerName", required = true) String triggerName,
+			@ApiParam(name = "group", value = "分组名", required = true)
+			@RequestParam(name = "group", required = true) String group
+			){
+		APIResult<Void> result = new APIResult<>();
+		try{
+			triggerDomain.stop(triggerName, group);
+			result.setMessage(I18nUtil.getMessage("com.lc.ibps.cloud.timer.provider.TriggerProvider.stop"));
+		}catch(Exception e){
+			setExceptionResult(result, StateEnum.ERROR_TIMER.getCode(), I18nUtil.getMessage(StateEnum.ERROR_TIMER.getCode()+""), e);
+		}
+
+		return result;
+	}
+
+}