瀏覽代碼

2021/7/5 注释掉定时任务

yinhao 4 年之前
父節點
當前提交
880479b17c
共有 19 個文件被更改,包括 1118 次插入1000 次删除
  1. 5 1
      huimv-smart-management/src/main/resources/application-dev.yml
  2. 112 0
      huimv-smart-management/src/main/resources/application-prod.yml
  3. 2 2
      huimv-smart-management/src/main/resources/application.properties
  4. 2 0
      huimv-smart-management/src/main/resources/logback-spring.xml
  5. 66 66
      renren-fast/src/main/java/io/renren/modules/job/config/ScheduleConfig.java
  6. 132 132
      renren-fast/src/main/java/io/renren/modules/job/controller/ScheduleJobController.java
  7. 55 55
      renren-fast/src/main/java/io/renren/modules/job/controller/ScheduleJobLogController.java
  8. 29 29
      renren-fast/src/main/java/io/renren/modules/job/dao/ScheduleJobDao.java
  9. 23 23
      renren-fast/src/main/java/io/renren/modules/job/dao/ScheduleJobLogDao.java
  10. 74 74
      renren-fast/src/main/java/io/renren/modules/job/entity/ScheduleJobEntity.java
  11. 71 71
      renren-fast/src/main/java/io/renren/modules/job/entity/ScheduleJobLogEntity.java
  12. 26 26
      renren-fast/src/main/java/io/renren/modules/job/service/ScheduleJobLogService.java
  13. 60 60
      renren-fast/src/main/java/io/renren/modules/job/service/ScheduleJobService.java
  14. 39 39
      renren-fast/src/main/java/io/renren/modules/job/service/impl/ScheduleJobLogServiceImpl.java
  15. 131 131
      renren-fast/src/main/java/io/renren/modules/job/service/impl/ScheduleJobServiceImpl.java
  16. 24 24
      renren-fast/src/main/java/io/renren/modules/job/task/ITask.java
  17. 30 30
      renren-fast/src/main/java/io/renren/modules/job/task/TestTask.java
  18. 81 81
      renren-fast/src/main/java/io/renren/modules/job/utils/ScheduleJob.java
  19. 156 156
      renren-fast/src/main/java/io/renren/modules/job/utils/ScheduleUtils.java

+ 5 - 1
huimv-smart-management/src/main/resources/application-dev.yml

@@ -105,4 +105,8 @@ mybatis-plus:
 
 local:
   token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhdXRoMCIsInVzZXJOYW1lIjoiMjAyMTA1MDEiLCJleHAiOjQ3NzgyMDAyMzV9.U6CANYSs3HyvZmnw6SHqNDcNV32PkGc3o6ZcggdeSf0
-  expire: 2121-06-01 13:50:35
+  expire: 2121-06-01 13:50:35
+
+user:
+  info:
+    url: http://192:168:1:57:88/api/sys/user/info

+ 112 - 0
huimv-smart-management/src/main/resources/application-prod.yml

@@ -0,0 +1,112 @@
+server:
+  port: 9200
+  tomcat:
+    uri-encoding: UTF-8
+#    min-spare-threads: 30
+#    max-threads: 1000
+#  servlet:
+#    context-path:
+
+
+spring:
+  # jackson时间格式化
+  jackson:
+    time-zone: GMT+8
+    date-format: yyyy-MM-dd HH:mm:ss
+  servlet:
+    multipart:
+      max-file-size: 100MB
+      max-request-size: 100MB
+      enabled: true
+
+  # 数据源
+  datasource:
+    # 数据连接池类型
+    type: com.alibaba.druid.pool.DruidDataSource
+    druid:
+      driver-class-name: com.mysql.cj.jdbc.Driver
+      url: jdbc:mysql://192.168.1.7:3306/huimv_smart_apiservice?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
+      username: root
+      password: hm123456
+      # 初始化时建立物理连接的个数。初始化发生在显示调用init方法,或者第一次getConnection时
+      initial-size: 10
+      # 最大连接池连接数量,最大活跃连接数
+      max-active: 100
+      # 最小连接池连接数量,最小空闲数量
+      min-idle: 10
+      # 配置获取连接等待超时的时间
+      max-wait: 60000
+      # 是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql下建议关闭。
+      pool-prepared-statements: false
+      # 指定每个连接上PSCache的大小
+      max-pool-prepared-statement-per-connection-size: 20
+      time-between-eviction-runs-millis: 60000
+      min-evictable-idle-time-millis: 300000
+      #Oracle需要打开注释
+      # 指定检测连接sql,如果是null,会影响testWhileIdle、testOnBorrow、testOnReturn失效,如果底层代码use-ping-method是true,默认使用ping
+      #validation-query: SELECT 1 FROM DUAL
+
+      # 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果此连接空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
+      test-while-idle: true
+      # 申请连接时会使用validationQuery检测连接是否有效,true会降低性能,如果是true,并且检测到连接已关闭,会获取其它的可用的连接
+      test-on-borrow: false
+      # 归还连接时会使用validationQuery检测连接是否有效,true会降低性能,如果是true,并且检测到连接已关闭,会获取其它的可用的连接,放回数据库线程池
+      test-on-return: false
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        #login-username: admin
+        #login-password: admin
+      filter:
+        stat:
+          log-slow-sql: true
+          slow-sql-millis: 1000
+          merge-sql: false
+        wall:
+          config:
+            multi-statement-allow: true
+
+  # redis
+  redis:
+    #    open: false  # 是否开启redis缓存  true开启   false关闭
+    database: 0
+    host: localhost
+    port: 6379
+    password:    # 密码(默认为空)
+    timeout: 6000ms  # 连接超时时长(毫秒)
+    jedis:
+      pool:
+        max-active: 1000  # 连接池最大连接数(使用负值表示没有限制)
+        max-wait: -1ms      # 连接池最大阻塞等待时间(使用负值表示没有限制)
+        max-idle: 10      # 连接池中的最大空闲连接
+        min-idle: 5       # 连接池中的最小空闲连接
+
+
+
+# mybatis-plus相关配置
+mybatis-plus:
+  type-aliases-package: com.huimv.*.entity
+  global-config:
+    banner: false
+    db-config:
+      #主键类型  AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
+      id-type: auto
+      logic-delete-field: deleted  # 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2)
+      logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
+      logic-delete-value: UNIX_TIMESTAMP() # 逻辑已删除值(unix时间戳)
+  #原生配置
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+    call-setters-on-nulls: true
+    jdbc-type-for-null: 'null'
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+
+
+local:
+  token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhdXRoMCIsInVzZXJOYW1lIjoiMjAyMTA1MDEiLCJleHAiOjQ3NzgyMDAyMzV9.U6CANYSs3HyvZmnw6SHqNDcNV32PkGc3o6ZcggdeSf0
+  expire: 2121-06-01 13:50:35
+
+user:
+  info:
+    url: http://192:168:1:44:88/api/sys/user/info

+ 2 - 2
huimv-smart-management/src/main/resources/application.properties

@@ -1,3 +1,3 @@
 # \u73AF\u5883 dev|test|prod
-spring.profiles.active=dev
-user.info.url=http://192.168.1.57:88/api/sys/user/info
+spring.profiles.active=prod
+#user.info.url=http://192.168.1.57:88/api/sys/user/info

+ 2 - 0
huimv-smart-management/src/main/resources/logback-spring.xml

@@ -18,6 +18,8 @@
         <logger name="org.springframework.web" level="ERROR"/>
         <logger name="org.springboot.sample" level="ERROR" />
         <logger name="com.huimv" level="ERROR" />
+        <logger name="com.alibaba.druid.pool" level="ERROR"/>
+        <logger name="org.mybatis.spring.mapper.ClassPathMapperScanner" level="ERROR"/>
     </springProfile>
 
 </configuration>

+ 66 - 66
renren-fast/src/main/java/io/renren/modules/job/config/ScheduleConfig.java

@@ -1,66 +1,66 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.config;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.quartz.SchedulerFactoryBean;
-
-import javax.sql.DataSource;
-import java.util.Properties;
-
-/**
- * 定时任务配置
- *
- * @author Mark sunlightcs@gmail.com
- */
-@Configuration
-public class ScheduleConfig {
-
-    @Bean
-    public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) {
-        SchedulerFactoryBean factory = new SchedulerFactoryBean();
-        factory.setDataSource(dataSource);
-
-        //quartz参数
-        Properties prop = new Properties();
-        prop.put("org.quartz.scheduler.instanceName", "RenrenScheduler");
-        prop.put("org.quartz.scheduler.instanceId", "AUTO");
-        //线程池配置
-        prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
-        prop.put("org.quartz.threadPool.threadCount", "20");
-        prop.put("org.quartz.threadPool.threadPriority", "5");
-        //JobStore配置
-        prop.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");
-        //集群配置
-        prop.put("org.quartz.jobStore.isClustered", "true");
-        prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
-        prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1");
-
-        prop.put("org.quartz.jobStore.misfireThreshold", "12000");
-        prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
-        prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
-
-        //PostgreSQL数据库,需要打开此注释
-        //prop.put("org.quartz.jobStore.driverDelegateClass", "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate");
-
-        factory.setQuartzProperties(prop);
-
-        factory.setSchedulerName("RenrenScheduler");
-        //延时启动
-        factory.setStartupDelay(30);
-        factory.setApplicationContextSchedulerContextKey("applicationContextKey");
-        //可选,QuartzScheduler 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了
-        factory.setOverwriteExistingJobs(true);
-        //设置自动启动,默认为true
-        factory.setAutoStartup(true);
-
-        return factory;
-    }
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.config;
+//
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.scheduling.quartz.SchedulerFactoryBean;
+//
+//import javax.sql.DataSource;
+//import java.util.Properties;
+//
+///**
+// * 定时任务配置
+// *
+// * @author Mark sunlightcs@gmail.com
+// */
+////@Configuration
+//public class ScheduleConfig {
+//
+//    @Bean
+//    public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) {
+//        SchedulerFactoryBean factory = new SchedulerFactoryBean();
+//        factory.setDataSource(dataSource);
+//
+//        //quartz参数
+//        Properties prop = new Properties();
+//        prop.put("org.quartz.scheduler.instanceName", "RenrenScheduler");
+//        prop.put("org.quartz.scheduler.instanceId", "AUTO");
+//        //线程池配置
+//        prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
+//        prop.put("org.quartz.threadPool.threadCount", "20");
+//        prop.put("org.quartz.threadPool.threadPriority", "5");
+//        //JobStore配置
+//        prop.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");
+//        //集群配置
+//        prop.put("org.quartz.jobStore.isClustered", "true");
+//        prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
+//        prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1");
+//
+//        prop.put("org.quartz.jobStore.misfireThreshold", "12000");
+//        prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
+//        prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
+//
+//        //PostgreSQL数据库,需要打开此注释
+//        //prop.put("org.quartz.jobStore.driverDelegateClass", "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate");
+//
+//        factory.setQuartzProperties(prop);
+//
+//        factory.setSchedulerName("RenrenScheduler");
+//        //延时启动
+//        factory.setStartupDelay(30);
+//        factory.setApplicationContextSchedulerContextKey("applicationContextKey");
+//        //可选,QuartzScheduler 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了
+//        factory.setOverwriteExistingJobs(true);
+//        //设置自动启动,默认为true
+//        factory.setAutoStartup(true);
+//
+//        return factory;
+//    }
+//}

+ 132 - 132
renren-fast/src/main/java/io/renren/modules/job/controller/ScheduleJobController.java

@@ -1,132 +1,132 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.controller;
-
-import io.renren.common.annotation.SysLog;
-import io.renren.common.utils.PageUtils;
-import io.renren.common.utils.R;
-import io.renren.common.validator.ValidatorUtils;
-import io.renren.modules.job.entity.ScheduleJobEntity;
-import io.renren.modules.job.service.ScheduleJobService;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Map;
-
-/**
- * 定时任务
- *
- * @author Mark sunlightcs@gmail.com
- */
-@RestController
-@RequestMapping("/sys/schedule")
-public class ScheduleJobController {
-	@Autowired
-	private ScheduleJobService scheduleJobService;
-	
-	/**
-	 * 定时任务列表
-	 */
-	@RequestMapping("/list")
-	@RequiresPermissions("sys:schedule:list")
-	public R list(@RequestParam Map<String, Object> params){
-		PageUtils page = scheduleJobService.queryPage(params);
-
-		return R.ok().put("page", page);
-	}
-	
-	/**
-	 * 定时任务信息
-	 */
-	@RequestMapping("/info/{jobId}")
-	@RequiresPermissions("sys:schedule:info")
-	public R info(@PathVariable("jobId") Long jobId){
-		ScheduleJobEntity schedule = scheduleJobService.getById(jobId);
-		
-		return R.ok().put("schedule", schedule);
-	}
-	
-	/**
-	 * 保存定时任务
-	 */
-	@SysLog("保存定时任务")
-	@RequestMapping("/save")
-	@RequiresPermissions("sys:schedule:save")
-	public R save(@RequestBody ScheduleJobEntity scheduleJob){
-		ValidatorUtils.validateEntity(scheduleJob);
-		
-		scheduleJobService.saveJob(scheduleJob);
-		
-		return R.ok();
-	}
-	
-	/**
-	 * 修改定时任务
-	 */
-	@SysLog("修改定时任务")
-	@RequestMapping("/update")
-	@RequiresPermissions("sys:schedule:update")
-	public R update(@RequestBody ScheduleJobEntity scheduleJob){
-		ValidatorUtils.validateEntity(scheduleJob);
-				
-		scheduleJobService.update(scheduleJob);
-		
-		return R.ok();
-	}
-	
-	/**
-	 * 删除定时任务
-	 */
-	@SysLog("删除定时任务")
-	@RequestMapping("/delete")
-	@RequiresPermissions("sys:schedule:delete")
-	public R delete(@RequestBody Long[] jobIds){
-		scheduleJobService.deleteBatch(jobIds);
-		
-		return R.ok();
-	}
-	
-	/**
-	 * 立即执行任务
-	 */
-	@SysLog("立即执行任务")
-	@RequestMapping("/run")
-	@RequiresPermissions("sys:schedule:run")
-	public R run(@RequestBody Long[] jobIds){
-		scheduleJobService.run(jobIds);
-		
-		return R.ok();
-	}
-	
-	/**
-	 * 暂停定时任务
-	 */
-	@SysLog("暂停定时任务")
-	@RequestMapping("/pause")
-	@RequiresPermissions("sys:schedule:pause")
-	public R pause(@RequestBody Long[] jobIds){
-		scheduleJobService.pause(jobIds);
-		
-		return R.ok();
-	}
-	
-	/**
-	 * 恢复定时任务
-	 */
-	@SysLog("恢复定时任务")
-	@RequestMapping("/resume")
-	@RequiresPermissions("sys:schedule:resume")
-	public R resume(@RequestBody Long[] jobIds){
-		scheduleJobService.resume(jobIds);
-		
-		return R.ok();
-	}
-
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.controller;
+//
+//import io.renren.common.annotation.SysLog;
+//import io.renren.common.utils.PageUtils;
+//import io.renren.common.utils.R;
+//import io.renren.common.validator.ValidatorUtils;
+//import io.renren.modules.job.entity.ScheduleJobEntity;
+//import io.renren.modules.job.service.ScheduleJobService;
+//import org.apache.shiro.authz.annotation.RequiresPermissions;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.web.bind.annotation.*;
+//
+//import java.util.Map;
+//
+///**
+// * 定时任务
+// *
+// * @author Mark sunlightcs@gmail.com
+// */
+//@RestController
+//@RequestMapping("/sys/schedule")
+//public class ScheduleJobController {
+//	@Autowired
+//	private ScheduleJobService scheduleJobService;
+//
+//	/**
+//	 * 定时任务列表
+//	 */
+//	@RequestMapping("/list")
+//	@RequiresPermissions("sys:schedule:list")
+//	public R list(@RequestParam Map<String, Object> params){
+//		PageUtils page = scheduleJobService.queryPage(params);
+//
+//		return R.ok().put("page", page);
+//	}
+//
+//	/**
+//	 * 定时任务信息
+//	 */
+//	@RequestMapping("/info/{jobId}")
+//	@RequiresPermissions("sys:schedule:info")
+//	public R info(@PathVariable("jobId") Long jobId){
+//		ScheduleJobEntity schedule = scheduleJobService.getById(jobId);
+//
+//		return R.ok().put("schedule", schedule);
+//	}
+//
+//	/**
+//	 * 保存定时任务
+//	 */
+//	@SysLog("保存定时任务")
+//	@RequestMapping("/save")
+//	@RequiresPermissions("sys:schedule:save")
+//	public R save(@RequestBody ScheduleJobEntity scheduleJob){
+//		ValidatorUtils.validateEntity(scheduleJob);
+//
+//		scheduleJobService.saveJob(scheduleJob);
+//
+//		return R.ok();
+//	}
+//
+//	/**
+//	 * 修改定时任务
+//	 */
+//	@SysLog("修改定时任务")
+//	@RequestMapping("/update")
+//	@RequiresPermissions("sys:schedule:update")
+//	public R update(@RequestBody ScheduleJobEntity scheduleJob){
+//		ValidatorUtils.validateEntity(scheduleJob);
+//
+//		scheduleJobService.update(scheduleJob);
+//
+//		return R.ok();
+//	}
+//
+//	/**
+//	 * 删除定时任务
+//	 */
+//	@SysLog("删除定时任务")
+//	@RequestMapping("/delete")
+//	@RequiresPermissions("sys:schedule:delete")
+//	public R delete(@RequestBody Long[] jobIds){
+//		scheduleJobService.deleteBatch(jobIds);
+//
+//		return R.ok();
+//	}
+//
+//	/**
+//	 * 立即执行任务
+//	 */
+//	@SysLog("立即执行任务")
+//	@RequestMapping("/run")
+//	@RequiresPermissions("sys:schedule:run")
+//	public R run(@RequestBody Long[] jobIds){
+//		scheduleJobService.run(jobIds);
+//
+//		return R.ok();
+//	}
+//
+//	/**
+//	 * 暂停定时任务
+//	 */
+//	@SysLog("暂停定时任务")
+//	@RequestMapping("/pause")
+//	@RequiresPermissions("sys:schedule:pause")
+//	public R pause(@RequestBody Long[] jobIds){
+//		scheduleJobService.pause(jobIds);
+//
+//		return R.ok();
+//	}
+//
+//	/**
+//	 * 恢复定时任务
+//	 */
+//	@SysLog("恢复定时任务")
+//	@RequestMapping("/resume")
+//	@RequiresPermissions("sys:schedule:resume")
+//	public R resume(@RequestBody Long[] jobIds){
+//		scheduleJobService.resume(jobIds);
+//
+//		return R.ok();
+//	}
+//
+//}

+ 55 - 55
renren-fast/src/main/java/io/renren/modules/job/controller/ScheduleJobLogController.java

@@ -1,55 +1,55 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.controller;
-
-import io.renren.common.utils.PageUtils;
-import io.renren.common.utils.R;
-import io.renren.modules.job.entity.ScheduleJobLogEntity;
-import io.renren.modules.job.service.ScheduleJobLogService;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.Map;
-
-/**
- * 定时任务日志
- *
- * @author Mark sunlightcs@gmail.com
- */
-@RestController
-@RequestMapping("/sys/scheduleLog")
-public class ScheduleJobLogController {
-	@Autowired
-	private ScheduleJobLogService scheduleJobLogService;
-	
-	/**
-	 * 定时任务日志列表
-	 */
-	@RequestMapping("/list")
-	@RequiresPermissions("sys:schedule:log")
-	public R list(@RequestParam Map<String, Object> params){
-		PageUtils page = scheduleJobLogService.queryPage(params);
-		
-		return R.ok().put("page", page);
-	}
-	
-	/**
-	 * 定时任务日志信息
-	 */
-	@RequestMapping("/info/{logId}")
-	public R info(@PathVariable("logId") Long logId){
-		ScheduleJobLogEntity log = scheduleJobLogService.getById(logId);
-		
-		return R.ok().put("log", log);
-	}
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.controller;
+//
+//import io.renren.common.utils.PageUtils;
+//import io.renren.common.utils.R;
+//import io.renren.modules.job.entity.ScheduleJobLogEntity;
+//import io.renren.modules.job.service.ScheduleJobLogService;
+//import org.apache.shiro.authz.annotation.RequiresPermissions;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.web.bind.annotation.PathVariable;
+//import org.springframework.web.bind.annotation.RequestMapping;
+//import org.springframework.web.bind.annotation.RequestParam;
+//import org.springframework.web.bind.annotation.RestController;
+//
+//import java.util.Map;
+//
+///**
+// * 定时任务日志
+// *
+// * @author Mark sunlightcs@gmail.com
+// */
+//@RestController
+//@RequestMapping("/sys/scheduleLog")
+//public class ScheduleJobLogController {
+//	@Autowired
+//	private ScheduleJobLogService scheduleJobLogService;
+//
+//	/**
+//	 * 定时任务日志列表
+//	 */
+//	@RequestMapping("/list")
+//	@RequiresPermissions("sys:schedule:log")
+//	public R list(@RequestParam Map<String, Object> params){
+//		PageUtils page = scheduleJobLogService.queryPage(params);
+//
+//		return R.ok().put("page", page);
+//	}
+//
+//	/**
+//	 * 定时任务日志信息
+//	 */
+//	@RequestMapping("/info/{logId}")
+//	public R info(@PathVariable("logId") Long logId){
+//		ScheduleJobLogEntity log = scheduleJobLogService.getById(logId);
+//
+//		return R.ok().put("log", log);
+//	}
+//}

+ 29 - 29
renren-fast/src/main/java/io/renren/modules/job/dao/ScheduleJobDao.java

@@ -1,29 +1,29 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import io.renren.modules.job.entity.ScheduleJobEntity;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.Map;
-
-/**
- * 定时任务
- *
- * @author Mark sunlightcs@gmail.com
- */
-@Mapper
-public interface ScheduleJobDao extends BaseMapper<ScheduleJobEntity> {
-	
-	/**
-	 * 批量更新状态
-	 */
-	int updateBatch(Map<String, Object> map);
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.dao;
+//
+//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+//import io.renren.modules.job.entity.ScheduleJobEntity;
+//import org.apache.ibatis.annotations.Mapper;
+//
+//import java.util.Map;
+//
+///**
+// * 定时任务
+// *
+// * @author Mark sunlightcs@gmail.com
+// */
+//@Mapper
+//public interface ScheduleJobDao extends BaseMapper<ScheduleJobEntity> {
+//
+//	/**
+//	 * 批量更新状态
+//	 */
+//	int updateBatch(Map<String, Object> map);
+//}

+ 23 - 23
renren-fast/src/main/java/io/renren/modules/job/dao/ScheduleJobLogDao.java

@@ -1,23 +1,23 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import io.renren.modules.job.entity.ScheduleJobLogEntity;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * 定时任务日志
- *
- * @author Mark sunlightcs@gmail.com
- */
-@Mapper
-public interface ScheduleJobLogDao extends BaseMapper<ScheduleJobLogEntity> {
-	
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.dao;
+//
+//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+//import io.renren.modules.job.entity.ScheduleJobLogEntity;
+//import org.apache.ibatis.annotations.Mapper;
+//
+///**
+// * 定时任务日志
+// *
+// * @author Mark sunlightcs@gmail.com
+// */
+//@Mapper
+//public interface ScheduleJobLogDao extends BaseMapper<ScheduleJobLogEntity> {
+//
+//}

+ 74 - 74
renren-fast/src/main/java/io/renren/modules/job/entity/ScheduleJobEntity.java

@@ -1,74 +1,74 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.entity;
-
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * 定时任务
- *
- * @author Mark sunlightcs@gmail.com
- */
-@Data
-@TableName("schedule_job")
-public class ScheduleJobEntity implements Serializable {
-	private static final long serialVersionUID = 1L;
-	
-	/**
-	 * 任务调度参数key
-	 */
-    public static final String JOB_PARAM_KEY = "JOB_PARAM_KEY";
-	
-	/**
-	 * 任务id
-	 */
-	@TableId
-	private Long jobId;
-
-	/**
-	 * spring bean名称
-	 */
-	@NotBlank(message="bean名称不能为空")
-	private String beanName;
-	
-	/**
-	 * 参数
-	 */
-	private String params;
-	
-	/**
-	 * cron表达式
-	 */
-	@NotBlank(message="cron表达式不能为空")
-	private String cronExpression;
-
-	/**
-	 * 任务状态
-	 */
-	private Integer status;
-
-	/**
-	 * 备注
-	 */
-	private String remark;
-
-	/**
-	 * 创建时间
-	 */
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-	private Date createTime;
-
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.entity;
+//
+//import com.baomidou.mybatisplus.annotation.TableId;
+//import com.baomidou.mybatisplus.annotation.TableName;
+//import com.fasterxml.jackson.annotation.JsonFormat;
+//import lombok.Data;
+//
+//import javax.validation.constraints.NotBlank;
+//import java.io.Serializable;
+//import java.util.Date;
+//
+///**
+// * 定时任务
+// *
+// * @author Mark sunlightcs@gmail.com
+// */
+//@Data
+//@TableName("schedule_job")
+//public class ScheduleJobEntity implements Serializable {
+//	private static final long serialVersionUID = 1L;
+//
+//	/**
+//	 * 任务调度参数key
+//	 */
+//    public static final String JOB_PARAM_KEY = "JOB_PARAM_KEY";
+//
+//	/**
+//	 * 任务id
+//	 */
+//	@TableId
+//	private Long jobId;
+//
+//	/**
+//	 * spring bean名称
+//	 */
+//	@NotBlank(message="bean名称不能为空")
+//	private String beanName;
+//
+//	/**
+//	 * 参数
+//	 */
+//	private String params;
+//
+//	/**
+//	 * cron表达式
+//	 */
+//	@NotBlank(message="cron表达式不能为空")
+//	private String cronExpression;
+//
+//	/**
+//	 * 任务状态
+//	 */
+//	private Integer status;
+//
+//	/**
+//	 * 备注
+//	 */
+//	private String remark;
+//
+//	/**
+//	 * 创建时间
+//	 */
+//	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+//	private Date createTime;
+//
+//}

+ 71 - 71
renren-fast/src/main/java/io/renren/modules/job/entity/ScheduleJobLogEntity.java

@@ -1,71 +1,71 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.entity;
-
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * 定时任务日志
- *
- * @author Mark sunlightcs@gmail.com
- */
-@Data
-@TableName("schedule_job_log")
-public class ScheduleJobLogEntity implements Serializable {
-	private static final long serialVersionUID = 1L;
-	
-	/**
-	 * 日志id
-	 */
-	@TableId
-	private Long logId;
-	
-	/**
-	 * 任务id
-	 */
-	private Long jobId;
-	
-	/**
-	 * spring bean名称
-	 */
-	private String beanName;
-	
-	/**
-	 * 参数
-	 */
-	private String params;
-	
-	/**
-	 * 任务状态    0:成功    1:失败
-	 */
-	private Integer status;
-	
-	/**
-	 * 失败信息
-	 */
-	private String error;
-	
-	/**
-	 * 耗时(单位:毫秒)
-	 */
-	private Integer times;
-	
-	/**
-	 * 创建时间
-	 */
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-	private Date createTime;
-	
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.entity;
+//
+//import com.baomidou.mybatisplus.annotation.TableId;
+//import com.baomidou.mybatisplus.annotation.TableName;
+//import com.fasterxml.jackson.annotation.JsonFormat;
+//import lombok.Data;
+//
+//import java.io.Serializable;
+//import java.util.Date;
+//
+///**
+// * 定时任务日志
+// *
+// * @author Mark sunlightcs@gmail.com
+// */
+//@Data
+//@TableName("schedule_job_log")
+//public class ScheduleJobLogEntity implements Serializable {
+//	private static final long serialVersionUID = 1L;
+//
+//	/**
+//	 * 日志id
+//	 */
+//	@TableId
+//	private Long logId;
+//
+//	/**
+//	 * 任务id
+//	 */
+//	private Long jobId;
+//
+//	/**
+//	 * spring bean名称
+//	 */
+//	private String beanName;
+//
+//	/**
+//	 * 参数
+//	 */
+//	private String params;
+//
+//	/**
+//	 * 任务状态    0:成功    1:失败
+//	 */
+//	private Integer status;
+//
+//	/**
+//	 * 失败信息
+//	 */
+//	private String error;
+//
+//	/**
+//	 * 耗时(单位:毫秒)
+//	 */
+//	private Integer times;
+//
+//	/**
+//	 * 创建时间
+//	 */
+//	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+//	private Date createTime;
+//
+//}

+ 26 - 26
renren-fast/src/main/java/io/renren/modules/job/service/ScheduleJobLogService.java

@@ -1,26 +1,26 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import io.renren.common.utils.PageUtils;
-import io.renren.modules.job.entity.ScheduleJobLogEntity;
-
-import java.util.Map;
-
-/**
- * 定时任务日志
- *
- * @author Mark sunlightcs@gmail.com
- */
-public interface ScheduleJobLogService extends IService<ScheduleJobLogEntity> {
-
-	PageUtils queryPage(Map<String, Object> params);
-	
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.service;
+//
+//import com.baomidou.mybatisplus.extension.service.IService;
+//import io.renren.common.utils.PageUtils;
+//import io.renren.modules.job.entity.ScheduleJobLogEntity;
+//
+//import java.util.Map;
+//
+///**
+// * 定时任务日志
+// *
+// * @author Mark sunlightcs@gmail.com
+// */
+//public interface ScheduleJobLogService extends IService<ScheduleJobLogEntity> {
+//
+//	PageUtils queryPage(Map<String, Object> params);
+//
+//}

+ 60 - 60
renren-fast/src/main/java/io/renren/modules/job/service/ScheduleJobService.java

@@ -1,60 +1,60 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import io.renren.common.utils.PageUtils;
-import io.renren.modules.job.entity.ScheduleJobEntity;
-
-import java.util.Map;
-
-/**
- * 定时任务
- *
- * @author Mark sunlightcs@gmail.com
- */
-public interface ScheduleJobService extends IService<ScheduleJobEntity> {
-
-	PageUtils queryPage(Map<String, Object> params);
-
-	/**
-	 * 保存定时任务
-	 */
-	void saveJob(ScheduleJobEntity scheduleJob);
-	
-	/**
-	 * 更新定时任务
-	 */
-	void update(ScheduleJobEntity scheduleJob);
-	
-	/**
-	 * 批量删除定时任务
-	 */
-	void deleteBatch(Long[] jobIds);
-	
-	/**
-	 * 批量更新定时任务状态
-	 */
-	int updateBatch(Long[] jobIds, int status);
-	
-	/**
-	 * 立即执行
-	 */
-	void run(Long[] jobIds);
-	
-	/**
-	 * 暂停运行
-	 */
-	void pause(Long[] jobIds);
-	
-	/**
-	 * 恢复运行
-	 */
-	void resume(Long[] jobIds);
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.service;
+//
+//import com.baomidou.mybatisplus.extension.service.IService;
+//import io.renren.common.utils.PageUtils;
+//import io.renren.modules.job.entity.ScheduleJobEntity;
+//
+//import java.util.Map;
+//
+///**
+// * 定时任务
+// *
+// * @author Mark sunlightcs@gmail.com
+// */
+//public interface ScheduleJobService extends IService<ScheduleJobEntity> {
+//
+//	PageUtils queryPage(Map<String, Object> params);
+//
+//	/**
+//	 * 保存定时任务
+//	 */
+//	void saveJob(ScheduleJobEntity scheduleJob);
+//
+//	/**
+//	 * 更新定时任务
+//	 */
+//	void update(ScheduleJobEntity scheduleJob);
+//
+//	/**
+//	 * 批量删除定时任务
+//	 */
+//	void deleteBatch(Long[] jobIds);
+//
+//	/**
+//	 * 批量更新定时任务状态
+//	 */
+//	int updateBatch(Long[] jobIds, int status);
+//
+//	/**
+//	 * 立即执行
+//	 */
+//	void run(Long[] jobIds);
+//
+//	/**
+//	 * 暂停运行
+//	 */
+//	void pause(Long[] jobIds);
+//
+//	/**
+//	 * 恢复运行
+//	 */
+//	void resume(Long[] jobIds);
+//}

+ 39 - 39
renren-fast/src/main/java/io/renren/modules/job/service/impl/ScheduleJobLogServiceImpl.java

@@ -1,39 +1,39 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import io.renren.common.utils.PageUtils;
-import io.renren.common.utils.Query;
-import io.renren.modules.job.dao.ScheduleJobLogDao;
-import io.renren.modules.job.entity.ScheduleJobLogEntity;
-import io.renren.modules.job.service.ScheduleJobLogService;
-import org.apache.commons.lang.StringUtils;
-import org.springframework.stereotype.Service;
-
-import java.util.Map;
-
-@Service("scheduleJobLogService")
-public class ScheduleJobLogServiceImpl extends ServiceImpl<ScheduleJobLogDao, ScheduleJobLogEntity> implements ScheduleJobLogService {
-
-	@Override
-	public PageUtils queryPage(Map<String, Object> params) {
-		String jobId = (String)params.get("jobId");
-
-		IPage<ScheduleJobLogEntity> page = this.page(
-			new Query<ScheduleJobLogEntity>().getPage(params),
-			new QueryWrapper<ScheduleJobLogEntity>().like(StringUtils.isNotBlank(jobId),"job_id", jobId)
-		);
-
-		return new PageUtils(page);
-	}
-
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.service.impl;
+//
+//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+//import com.baomidou.mybatisplus.core.metadata.IPage;
+//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+//import io.renren.common.utils.PageUtils;
+//import io.renren.common.utils.Query;
+//import io.renren.modules.job.dao.ScheduleJobLogDao;
+//import io.renren.modules.job.entity.ScheduleJobLogEntity;
+//import io.renren.modules.job.service.ScheduleJobLogService;
+//import org.apache.commons.lang.StringUtils;
+//import org.springframework.stereotype.Service;
+//
+//import java.util.Map;
+//
+//@Service("scheduleJobLogService")
+//public class ScheduleJobLogServiceImpl extends ServiceImpl<ScheduleJobLogDao, ScheduleJobLogEntity> implements ScheduleJobLogService {
+//
+//	@Override
+//	public PageUtils queryPage(Map<String, Object> params) {
+//		String jobId = (String)params.get("jobId");
+//
+//		IPage<ScheduleJobLogEntity> page = this.page(
+//			new Query<ScheduleJobLogEntity>().getPage(params),
+//			new QueryWrapper<ScheduleJobLogEntity>().like(StringUtils.isNotBlank(jobId),"job_id", jobId)
+//		);
+//
+//		return new PageUtils(page);
+//	}
+//
+//}

+ 131 - 131
renren-fast/src/main/java/io/renren/modules/job/service/impl/ScheduleJobServiceImpl.java

@@ -1,131 +1,131 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import io.renren.common.utils.Constant;
-import io.renren.common.utils.PageUtils;
-import io.renren.common.utils.Query;
-import io.renren.modules.job.dao.ScheduleJobDao;
-import io.renren.modules.job.entity.ScheduleJobEntity;
-import io.renren.modules.job.service.ScheduleJobService;
-import io.renren.modules.job.utils.ScheduleUtils;
-import org.apache.commons.lang.StringUtils;
-import org.quartz.CronTrigger;
-import org.quartz.Scheduler;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.PostConstruct;
-import java.util.*;
-
-@Service("scheduleJobService")
-public class ScheduleJobServiceImpl extends ServiceImpl<ScheduleJobDao, ScheduleJobEntity> implements ScheduleJobService {
-	@Autowired
-    private Scheduler scheduler;
-	
-	/**
-	 * 项目启动时,初始化定时器
-	 */
-	@PostConstruct
-	public void init(){
-		List<ScheduleJobEntity> scheduleJobList = this.list();
-		for(ScheduleJobEntity scheduleJob : scheduleJobList){
-			CronTrigger cronTrigger = ScheduleUtils.getCronTrigger(scheduler, scheduleJob.getJobId());
-            //如果不存在,则创建
-            if(cronTrigger == null) {
-                ScheduleUtils.createScheduleJob(scheduler, scheduleJob);
-            }else {
-                ScheduleUtils.updateScheduleJob(scheduler, scheduleJob);
-            }
-		}
-	}
-
-	@Override
-	public PageUtils queryPage(Map<String, Object> params) {
-		String beanName = (String)params.get("beanName");
-
-		IPage<ScheduleJobEntity> page = this.page(
-			new Query<ScheduleJobEntity>().getPage(params),
-			new QueryWrapper <ScheduleJobEntity>().like(StringUtils.isNotBlank(beanName),"bean_name", beanName)
-		);
-
-		return new PageUtils(page);
-	}
-
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void saveJob(ScheduleJobEntity scheduleJob) {
-		scheduleJob.setCreateTime(new Date());
-		scheduleJob.setStatus(Constant.ScheduleStatus.NORMAL.getValue());
-        this.save(scheduleJob);
-        
-        ScheduleUtils.createScheduleJob(scheduler, scheduleJob);
-    }
-	
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void update(ScheduleJobEntity scheduleJob) {
-        ScheduleUtils.updateScheduleJob(scheduler, scheduleJob);
-                
-        this.updateById(scheduleJob);
-    }
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-    public void deleteBatch(Long[] jobIds) {
-    	for(Long jobId : jobIds){
-    		ScheduleUtils.deleteScheduleJob(scheduler, jobId);
-    	}
-    	
-    	//删除数据
-    	this.removeByIds(Arrays.asList(jobIds));
-	}
-
-	@Override
-    public int updateBatch(Long[] jobIds, int status){
-    	Map<String, Object> map = new HashMap<>(2);
-    	map.put("list", jobIds);
-    	map.put("status", status);
-    	return baseMapper.updateBatch(map);
-    }
-    
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-    public void run(Long[] jobIds) {
-    	for(Long jobId : jobIds){
-    		ScheduleUtils.run(scheduler, this.getById(jobId));
-    	}
-    }
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-    public void pause(Long[] jobIds) {
-        for(Long jobId : jobIds){
-    		ScheduleUtils.pauseJob(scheduler, jobId);
-    	}
-        
-    	updateBatch(jobIds, Constant.ScheduleStatus.PAUSE.getValue());
-    }
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-    public void resume(Long[] jobIds) {
-    	for(Long jobId : jobIds){
-    		ScheduleUtils.resumeJob(scheduler, jobId);
-    	}
-
-    	updateBatch(jobIds, Constant.ScheduleStatus.NORMAL.getValue());
-    }
-    
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.service.impl;
+//
+//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+//import com.baomidou.mybatisplus.core.metadata.IPage;
+//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+//import io.renren.common.utils.Constant;
+//import io.renren.common.utils.PageUtils;
+//import io.renren.common.utils.Query;
+//import io.renren.modules.job.dao.ScheduleJobDao;
+//import io.renren.modules.job.entity.ScheduleJobEntity;
+//import io.renren.modules.job.service.ScheduleJobService;
+//import io.renren.modules.job.utils.ScheduleUtils;
+//import org.apache.commons.lang.StringUtils;
+//import org.quartz.CronTrigger;
+//import org.quartz.Scheduler;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Service;
+//import org.springframework.transaction.annotation.Transactional;
+//
+//import javax.annotation.PostConstruct;
+//import java.util.*;
+//
+//@Service("scheduleJobService")
+//public class ScheduleJobServiceImpl extends ServiceImpl<ScheduleJobDao, ScheduleJobEntity> implements ScheduleJobService {
+//	@Autowired
+//    private Scheduler scheduler;
+//
+//	/**
+//	 * 项目启动时,初始化定时器
+//	 */
+//	@PostConstruct
+//	public void init(){
+//		List<ScheduleJobEntity> scheduleJobList = this.list();
+//		for(ScheduleJobEntity scheduleJob : scheduleJobList){
+//			CronTrigger cronTrigger = ScheduleUtils.getCronTrigger(scheduler, scheduleJob.getJobId());
+//            //如果不存在,则创建
+//            if(cronTrigger == null) {
+//                ScheduleUtils.createScheduleJob(scheduler, scheduleJob);
+//            }else {
+//                ScheduleUtils.updateScheduleJob(scheduler, scheduleJob);
+//            }
+//		}
+//	}
+//
+//	@Override
+//	public PageUtils queryPage(Map<String, Object> params) {
+//		String beanName = (String)params.get("beanName");
+//
+//		IPage<ScheduleJobEntity> page = this.page(
+//			new Query<ScheduleJobEntity>().getPage(params),
+//			new QueryWrapper <ScheduleJobEntity>().like(StringUtils.isNotBlank(beanName),"bean_name", beanName)
+//		);
+//
+//		return new PageUtils(page);
+//	}
+//
+//
+//	@Override
+//	@Transactional(rollbackFor = Exception.class)
+//	public void saveJob(ScheduleJobEntity scheduleJob) {
+//		scheduleJob.setCreateTime(new Date());
+//		scheduleJob.setStatus(Constant.ScheduleStatus.NORMAL.getValue());
+//        this.save(scheduleJob);
+//
+//        ScheduleUtils.createScheduleJob(scheduler, scheduleJob);
+//    }
+//
+//	@Override
+//	@Transactional(rollbackFor = Exception.class)
+//	public void update(ScheduleJobEntity scheduleJob) {
+//        ScheduleUtils.updateScheduleJob(scheduler, scheduleJob);
+//
+//        this.updateById(scheduleJob);
+//    }
+//
+//	@Override
+//	@Transactional(rollbackFor = Exception.class)
+//    public void deleteBatch(Long[] jobIds) {
+//    	for(Long jobId : jobIds){
+//    		ScheduleUtils.deleteScheduleJob(scheduler, jobId);
+//    	}
+//
+//    	//删除数据
+//    	this.removeByIds(Arrays.asList(jobIds));
+//	}
+//
+//	@Override
+//    public int updateBatch(Long[] jobIds, int status){
+//    	Map<String, Object> map = new HashMap<>(2);
+//    	map.put("list", jobIds);
+//    	map.put("status", status);
+//    	return baseMapper.updateBatch(map);
+//    }
+//
+//	@Override
+//	@Transactional(rollbackFor = Exception.class)
+//    public void run(Long[] jobIds) {
+//    	for(Long jobId : jobIds){
+//    		ScheduleUtils.run(scheduler, this.getById(jobId));
+//    	}
+//    }
+//
+//	@Override
+//	@Transactional(rollbackFor = Exception.class)
+//    public void pause(Long[] jobIds) {
+//        for(Long jobId : jobIds){
+//    		ScheduleUtils.pauseJob(scheduler, jobId);
+//    	}
+//
+//    	updateBatch(jobIds, Constant.ScheduleStatus.PAUSE.getValue());
+//    }
+//
+//	@Override
+//	@Transactional(rollbackFor = Exception.class)
+//    public void resume(Long[] jobIds) {
+//    	for(Long jobId : jobIds){
+//    		ScheduleUtils.resumeJob(scheduler, jobId);
+//    	}
+//
+//    	updateBatch(jobIds, Constant.ScheduleStatus.NORMAL.getValue());
+//    }
+//
+//}

+ 24 - 24
renren-fast/src/main/java/io/renren/modules/job/task/ITask.java

@@ -1,24 +1,24 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.task;
-
-/**
- * 定时任务接口,所有定时任务都要实现该接口
- *
- * @author Mark sunlightcs@gmail.com
- */
-public interface ITask {
-
-    /**
-     * 执行定时任务接口
-     *
-     * @param params   参数,多参数使用JSON数据
-     */
-    void run(String params);
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.task;
+//
+///**
+// * 定时任务接口,所有定时任务都要实现该接口
+// *
+// * @author Mark sunlightcs@gmail.com
+// */
+//public interface ITask {
+//
+//    /**
+//     * 执行定时任务接口
+//     *
+//     * @param params   参数,多参数使用JSON数据
+//     */
+//    void run(String params);
+//}

+ 30 - 30
renren-fast/src/main/java/io/renren/modules/job/task/TestTask.java

@@ -1,30 +1,30 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.task;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-/**
- * 测试定时任务(演示Demo,可删除)
- *
- * testTask为spring bean的名称
- *
- * @author Mark sunlightcs@gmail.com
- */
-@Component("testTask")
-public class TestTask implements ITask {
-	private Logger logger = LoggerFactory.getLogger(getClass());
-
-	@Override
-	public void run(String params){
-		logger.debug("TestTask定时任务正在执行,参数为:{}", params);
-	}
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.task;
+//
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.springframework.stereotype.Component;
+//
+///**
+// * 测试定时任务(演示Demo,可删除)
+// *
+// * testTask为spring bean的名称
+// *
+// * @author Mark sunlightcs@gmail.com
+// */
+//@Component("testTask")
+//public class TestTask implements ITask {
+//	private Logger logger = LoggerFactory.getLogger(getClass());
+//
+//	@Override
+//	public void run(String params){
+//		logger.debug("TestTask定时任务正在执行,参数为:{}", params);
+//	}
+//}

+ 81 - 81
renren-fast/src/main/java/io/renren/modules/job/utils/ScheduleJob.java

@@ -1,81 +1,81 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.utils;
-
-import io.renren.common.utils.SpringContextUtils;
-import io.renren.modules.job.entity.ScheduleJobEntity;
-import io.renren.modules.job.entity.ScheduleJobLogEntity;
-import io.renren.modules.job.service.ScheduleJobLogService;
-import org.apache.commons.lang.StringUtils;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.scheduling.quartz.QuartzJobBean;
-
-import java.lang.reflect.Method;
-import java.util.Date;
-
-
-/**
- * 定时任务
- *
- * @author Mark sunlightcs@gmail.com
- */
-public class ScheduleJob extends QuartzJobBean {
-	private Logger logger = LoggerFactory.getLogger(getClass());
-
-    @Override
-    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
-        ScheduleJobEntity scheduleJob = (ScheduleJobEntity) context.getMergedJobDataMap()
-        		.get(ScheduleJobEntity.JOB_PARAM_KEY);
-        
-        //获取spring bean
-        ScheduleJobLogService scheduleJobLogService = (ScheduleJobLogService) SpringContextUtils.getBean("scheduleJobLogService");
-        
-        //数据库保存执行记录
-        ScheduleJobLogEntity log = new ScheduleJobLogEntity();
-        log.setJobId(scheduleJob.getJobId());
-        log.setBeanName(scheduleJob.getBeanName());
-        log.setParams(scheduleJob.getParams());
-        log.setCreateTime(new Date());
-        
-        //任务开始时间
-        long startTime = System.currentTimeMillis();
-        
-        try {
-            //执行任务
-        	logger.debug("任务准备执行,任务ID:" + scheduleJob.getJobId());
-
-			Object target = SpringContextUtils.getBean(scheduleJob.getBeanName());
-			Method method = target.getClass().getDeclaredMethod("run", String.class);
-			method.invoke(target, scheduleJob.getParams());
-			
-			//任务执行总时长
-			long times = System.currentTimeMillis() - startTime;
-			log.setTimes((int)times);
-			//任务状态    0:成功    1:失败
-			log.setStatus(0);
-			
-			logger.debug("任务执行完毕,任务ID:" + scheduleJob.getJobId() + "  总共耗时:" + times + "毫秒");
-		} catch (Exception e) {
-			logger.error("任务执行失败,任务ID:" + scheduleJob.getJobId(), e);
-			
-			//任务执行总时长
-			long times = System.currentTimeMillis() - startTime;
-			log.setTimes((int)times);
-			
-			//任务状态    0:成功    1:失败
-			log.setStatus(1);
-			log.setError(StringUtils.substring(e.toString(), 0, 2000));
-		}finally {
-			scheduleJobLogService.save(log);
-		}
-    }
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.utils;
+//
+//import io.renren.common.utils.SpringContextUtils;
+//import io.renren.modules.job.entity.ScheduleJobEntity;
+//import io.renren.modules.job.entity.ScheduleJobLogEntity;
+//import io.renren.modules.job.service.ScheduleJobLogService;
+//import org.apache.commons.lang.StringUtils;
+//import org.quartz.JobExecutionContext;
+//import org.quartz.JobExecutionException;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.springframework.scheduling.quartz.QuartzJobBean;
+//
+//import java.lang.reflect.Method;
+//import java.util.Date;
+//
+//
+///**
+// * 定时任务
+// *
+// * @author Mark sunlightcs@gmail.com
+// */
+//public class ScheduleJob extends QuartzJobBean {
+//	private Logger logger = LoggerFactory.getLogger(getClass());
+//
+//    @Override
+//    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
+//        ScheduleJobEntity scheduleJob = (ScheduleJobEntity) context.getMergedJobDataMap()
+//        		.get(ScheduleJobEntity.JOB_PARAM_KEY);
+//
+//        //获取spring bean
+//        ScheduleJobLogService scheduleJobLogService = (ScheduleJobLogService) SpringContextUtils.getBean("scheduleJobLogService");
+//
+//        //数据库保存执行记录
+//        ScheduleJobLogEntity log = new ScheduleJobLogEntity();
+//        log.setJobId(scheduleJob.getJobId());
+//        log.setBeanName(scheduleJob.getBeanName());
+//        log.setParams(scheduleJob.getParams());
+//        log.setCreateTime(new Date());
+//
+//        //任务开始时间
+//        long startTime = System.currentTimeMillis();
+//
+//        try {
+//            //执行任务
+//        	logger.debug("任务准备执行,任务ID:" + scheduleJob.getJobId());
+//
+//			Object target = SpringContextUtils.getBean(scheduleJob.getBeanName());
+//			Method method = target.getClass().getDeclaredMethod("run", String.class);
+//			method.invoke(target, scheduleJob.getParams());
+//
+//			//任务执行总时长
+//			long times = System.currentTimeMillis() - startTime;
+//			log.setTimes((int)times);
+//			//任务状态    0:成功    1:失败
+//			log.setStatus(0);
+//
+//			logger.debug("任务执行完毕,任务ID:" + scheduleJob.getJobId() + "  总共耗时:" + times + "毫秒");
+//		} catch (Exception e) {
+//			logger.error("任务执行失败,任务ID:" + scheduleJob.getJobId(), e);
+//
+//			//任务执行总时长
+//			long times = System.currentTimeMillis() - startTime;
+//			log.setTimes((int)times);
+//
+//			//任务状态    0:成功    1:失败
+//			log.setStatus(1);
+//			log.setError(StringUtils.substring(e.toString(), 0, 2000));
+//		}finally {
+//			scheduleJobLogService.save(log);
+//		}
+//    }
+//}

+ 156 - 156
renren-fast/src/main/java/io/renren/modules/job/utils/ScheduleUtils.java

@@ -1,156 +1,156 @@
-/**
- * Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package io.renren.modules.job.utils;
-
-import io.renren.common.exception.RRException;
-import io.renren.common.utils.Constant;
-import io.renren.modules.job.entity.ScheduleJobEntity;
-import org.quartz.*;
-
-/**
- * 定时任务工具类
- *
- * @author Mark sunlightcs@gmail.com
- */
-public class ScheduleUtils {
-    private final static String JOB_NAME = "TASK_";
-    
-    /**
-     * 获取触发器key
-     */
-    public static TriggerKey getTriggerKey(Long jobId) {
-        return TriggerKey.triggerKey(JOB_NAME + jobId);
-    }
-    
-    /**
-     * 获取jobKey
-     */
-    public static JobKey getJobKey(Long jobId) {
-        return JobKey.jobKey(JOB_NAME + jobId);
-    }
-
-    /**
-     * 获取表达式触发器
-     */
-    public static CronTrigger getCronTrigger(Scheduler scheduler, Long jobId) {
-        try {
-            return (CronTrigger) scheduler.getTrigger(getTriggerKey(jobId));
-        } catch (SchedulerException e) {
-            throw new RRException("获取定时任务CronTrigger出现异常", e);
-        }
-    }
-
-    /**
-     * 创建定时任务
-     */
-    public static void createScheduleJob(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
-        try {
-        	//构建job信息
-            JobDetail jobDetail = JobBuilder.newJob(ScheduleJob.class).withIdentity(getJobKey(scheduleJob.getJobId())).build();
-
-            //表达式调度构建器
-            CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression())
-            		.withMisfireHandlingInstructionDoNothing();
-
-            //按新的cronExpression表达式构建一个新的trigger
-            CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(scheduleJob.getJobId())).withSchedule(scheduleBuilder).build();
-
-            //放入参数,运行时的方法可以获取
-            jobDetail.getJobDataMap().put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob);
-
-            scheduler.scheduleJob(jobDetail, trigger);
-            
-            //暂停任务
-            if(scheduleJob.getStatus() == Constant.ScheduleStatus.PAUSE.getValue()){
-            	pauseJob(scheduler, scheduleJob.getJobId());
-            }
-        } catch (SchedulerException e) {
-            throw new RRException("创建定时任务失败", e);
-        }
-    }
-    
-    /**
-     * 更新定时任务
-     */
-    public static void updateScheduleJob(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
-        try {
-            TriggerKey triggerKey = getTriggerKey(scheduleJob.getJobId());
-
-            //表达式调度构建器
-            CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression())
-            		.withMisfireHandlingInstructionDoNothing();
-
-            CronTrigger trigger = getCronTrigger(scheduler, scheduleJob.getJobId());
-            
-            //按新的cronExpression表达式重新构建trigger
-            trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
-            
-            //参数
-            trigger.getJobDataMap().put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob);
-            
-            scheduler.rescheduleJob(triggerKey, trigger);
-            
-            //暂停任务
-            if(scheduleJob.getStatus() == Constant.ScheduleStatus.PAUSE.getValue()){
-            	pauseJob(scheduler, scheduleJob.getJobId());
-            }
-            
-        } catch (SchedulerException e) {
-            throw new RRException("更新定时任务失败", e);
-        }
-    }
-
-    /**
-     * 立即执行任务
-     */
-    public static void run(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
-        try {
-        	//参数
-        	JobDataMap dataMap = new JobDataMap();
-        	dataMap.put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob);
-        	
-            scheduler.triggerJob(getJobKey(scheduleJob.getJobId()), dataMap);
-        } catch (SchedulerException e) {
-            throw new RRException("立即执行定时任务失败", e);
-        }
-    }
-
-    /**
-     * 暂停任务
-     */
-    public static void pauseJob(Scheduler scheduler, Long jobId) {
-        try {
-            scheduler.pauseJob(getJobKey(jobId));
-        } catch (SchedulerException e) {
-            throw new RRException("暂停定时任务失败", e);
-        }
-    }
-
-    /**
-     * 恢复任务
-     */
-    public static void resumeJob(Scheduler scheduler, Long jobId) {
-        try {
-            scheduler.resumeJob(getJobKey(jobId));
-        } catch (SchedulerException e) {
-            throw new RRException("暂停定时任务失败", e);
-        }
-    }
-
-    /**
-     * 删除定时任务
-     */
-    public static void deleteScheduleJob(Scheduler scheduler, Long jobId) {
-        try {
-            scheduler.deleteJob(getJobKey(jobId));
-        } catch (SchedulerException e) {
-            throw new RRException("删除定时任务失败", e);
-        }
-    }
-}
+///**
+// * Copyright (c) 2016-2019 人人开源 All rights reserved.
+// *
+// * https://www.renren.io
+// *
+// * 版权所有,侵权必究!
+// */
+//
+//package io.renren.modules.job.utils;
+//
+//import io.renren.common.exception.RRException;
+//import io.renren.common.utils.Constant;
+//import io.renren.modules.job.entity.ScheduleJobEntity;
+//import org.quartz.*;
+//
+///**
+// * 定时任务工具类
+// *
+// * @author Mark sunlightcs@gmail.com
+// */
+//public class ScheduleUtils {
+//    private final static String JOB_NAME = "TASK_";
+//
+//    /**
+//     * 获取触发器key
+//     */
+//    public static TriggerKey getTriggerKey(Long jobId) {
+//        return TriggerKey.triggerKey(JOB_NAME + jobId);
+//    }
+//
+//    /**
+//     * 获取jobKey
+//     */
+//    public static JobKey getJobKey(Long jobId) {
+//        return JobKey.jobKey(JOB_NAME + jobId);
+//    }
+//
+//    /**
+//     * 获取表达式触发器
+//     */
+//    public static CronTrigger getCronTrigger(Scheduler scheduler, Long jobId) {
+//        try {
+//            return (CronTrigger) scheduler.getTrigger(getTriggerKey(jobId));
+//        } catch (SchedulerException e) {
+//            throw new RRException("获取定时任务CronTrigger出现异常", e);
+//        }
+//    }
+//
+//    /**
+//     * 创建定时任务
+//     */
+//    public static void createScheduleJob(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
+//        try {
+//        	//构建job信息
+//            JobDetail jobDetail = JobBuilder.newJob(ScheduleJob.class).withIdentity(getJobKey(scheduleJob.getJobId())).build();
+//
+//            //表达式调度构建器
+//            CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression())
+//            		.withMisfireHandlingInstructionDoNothing();
+//
+//            //按新的cronExpression表达式构建一个新的trigger
+//            CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(scheduleJob.getJobId())).withSchedule(scheduleBuilder).build();
+//
+//            //放入参数,运行时的方法可以获取
+//            jobDetail.getJobDataMap().put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob);
+//
+//            scheduler.scheduleJob(jobDetail, trigger);
+//
+//            //暂停任务
+//            if(scheduleJob.getStatus() == Constant.ScheduleStatus.PAUSE.getValue()){
+//            	pauseJob(scheduler, scheduleJob.getJobId());
+//            }
+//        } catch (SchedulerException e) {
+//            throw new RRException("创建定时任务失败", e);
+//        }
+//    }
+//
+//    /**
+//     * 更新定时任务
+//     */
+//    public static void updateScheduleJob(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
+//        try {
+//            TriggerKey triggerKey = getTriggerKey(scheduleJob.getJobId());
+//
+//            //表达式调度构建器
+//            CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression())
+//            		.withMisfireHandlingInstructionDoNothing();
+//
+//            CronTrigger trigger = getCronTrigger(scheduler, scheduleJob.getJobId());
+//
+//            //按新的cronExpression表达式重新构建trigger
+//            trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
+//
+//            //参数
+//            trigger.getJobDataMap().put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob);
+//
+//            scheduler.rescheduleJob(triggerKey, trigger);
+//
+//            //暂停任务
+//            if(scheduleJob.getStatus() == Constant.ScheduleStatus.PAUSE.getValue()){
+//            	pauseJob(scheduler, scheduleJob.getJobId());
+//            }
+//
+//        } catch (SchedulerException e) {
+//            throw new RRException("更新定时任务失败", e);
+//        }
+//    }
+//
+//    /**
+//     * 立即执行任务
+//     */
+//    public static void run(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
+//        try {
+//        	//参数
+//        	JobDataMap dataMap = new JobDataMap();
+//        	dataMap.put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob);
+//
+//            scheduler.triggerJob(getJobKey(scheduleJob.getJobId()), dataMap);
+//        } catch (SchedulerException e) {
+//            throw new RRException("立即执行定时任务失败", e);
+//        }
+//    }
+//
+//    /**
+//     * 暂停任务
+//     */
+//    public static void pauseJob(Scheduler scheduler, Long jobId) {
+//        try {
+//            scheduler.pauseJob(getJobKey(jobId));
+//        } catch (SchedulerException e) {
+//            throw new RRException("暂停定时任务失败", e);
+//        }
+//    }
+//
+//    /**
+//     * 恢复任务
+//     */
+//    public static void resumeJob(Scheduler scheduler, Long jobId) {
+//        try {
+//            scheduler.resumeJob(getJobKey(jobId));
+//        } catch (SchedulerException e) {
+//            throw new RRException("暂停定时任务失败", e);
+//        }
+//    }
+//
+//    /**
+//     * 删除定时任务
+//     */
+//    public static void deleteScheduleJob(Scheduler scheduler, Long jobId) {
+//        try {
+//            scheduler.deleteJob(getJobKey(jobId));
+//        } catch (SchedulerException e) {
+//            throw new RRException("删除定时任务失败", e);
+//        }
+//    }
+//}