mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-01 02:38:43 +08:00 
			
		
		
		
	1. 完成 quartz 的封装
This commit is contained in:
		| @@ -1,48 +0,0 @@ | ||||
| package com.ruoyi.quartz.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 ruoyi | ||||
|  */ | ||||
| @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", "RuoyiScheduler"); | ||||
|         prop.put("org.quartz.scheduler.instanceId", "AUTO"); | ||||
|         // 集群配置 | ||||
|         prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000"); | ||||
|         prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1"); | ||||
|         prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true"); | ||||
|  | ||||
|         // sqlserver 启用 | ||||
|         // prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?"); | ||||
|         prop.put("org.quartz.jobStore.misfireThreshold", "12000"); | ||||
|         factory.setQuartzProperties(prop); | ||||
|  | ||||
|         factory.setSchedulerName("RuoyiScheduler"); | ||||
|         // 延时启动 | ||||
|         factory.setStartupDelay(1); | ||||
|         factory.setApplicationContextSchedulerContextKey("applicationContextKey"); | ||||
|         // 可选,QuartzScheduler | ||||
|         // 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了 | ||||
|         factory.setOverwriteExistingJobs(true); | ||||
|  | ||||
|  | ||||
|         return factory; | ||||
|     } | ||||
| } | ||||
| @@ -1,64 +0,0 @@ | ||||
| package com.ruoyi.quartz.controller; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.web.bind.annotation.DeleteMapping; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.PathVariable; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| import com.ruoyi.common.annotation.Log; | ||||
| import com.ruoyi.common.core.controller.BaseController; | ||||
| import com.ruoyi.common.core.domain.AjaxResult; | ||||
| import com.ruoyi.common.core.page.TableDataInfo; | ||||
| import com.ruoyi.common.enums.BusinessType; | ||||
| import com.ruoyi.common.utils.poi.ExcelUtil; | ||||
| import com.ruoyi.quartz.domain.SysJobLog; | ||||
| import com.ruoyi.quartz.service.ISysJobLogService; | ||||
|  | ||||
| /** | ||||
|  * 调度日志操作处理 | ||||
|  * | ||||
|  * @author ruoyi | ||||
|  */ | ||||
| @RestController | ||||
| @RequestMapping("/monitor/jobLog") | ||||
| public class SysJobLogController extends BaseController { | ||||
|     @Autowired | ||||
|     private ISysJobLogService jobLogService; | ||||
|  | ||||
|     /** | ||||
|      * 查询定时任务调度日志列表 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('monitor:job:list')") | ||||
|     @GetMapping("/list") | ||||
|     public TableDataInfo list(SysJobLog sysJobLog) { | ||||
|         startPage(); | ||||
|         List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog); | ||||
|         return getDataTable(list); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 导出定时任务调度日志列表 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('monitor:job:export')") | ||||
|     @Log(title = "任务调度日志", businessType = BusinessType.EXPORT) | ||||
|     @GetMapping("/export") | ||||
|     public AjaxResult export(SysJobLog sysJobLog) { | ||||
|         List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog); | ||||
|         ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class); | ||||
|         return util.exportExcel(list, "调度日志"); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 根据调度编号获取详细信息 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('monitor:job:query')") | ||||
|     @GetMapping(value = "/{configId}") | ||||
|     public AjaxResult getInfo(@PathVariable Long jobLogId) { | ||||
|         return AjaxResult.success(jobLogService.selectJobLogById(jobLogId)); | ||||
|     } | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV