| | |
| | | package com.ruoyi.project.monitor.service.impl;
|
| | |
|
| | | import java.util.List;
|
| | | import javax.annotation.PostConstruct;
|
| | | import org.quartz.JobDataMap;
|
| | | import org.quartz.JobKey;
|
| | | import org.quartz.Scheduler;
|
| | | import org.quartz.SchedulerException;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import com.ruoyi.common.constant.ScheduleConstants;
|
| | | import com.ruoyi.common.exception.job.TaskException;
|
| | | import com.ruoyi.common.utils.job.CronUtils;
|
| | |
| | | import com.ruoyi.project.monitor.domain.SysJob;
|
| | | import com.ruoyi.project.monitor.mapper.SysJobMapper;
|
| | | import com.ruoyi.project.monitor.service.ISysJobService;
|
| | | import jakarta.annotation.PostConstruct;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.quartz.JobDataMap;
|
| | | import org.quartz.JobKey;
|
| | | import org.quartz.Scheduler;
|
| | | import org.quartz.SchedulerException;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * 定时任务调度信息 服务层
|
| | |
| | | * @author ruoyi
|
| | | */
|
| | | @Service
|
| | | @RequiredArgsConstructor
|
| | | public class SysJobServiceImpl implements ISysJobService
|
| | | {
|
| | | @Autowired
|
| | | private Scheduler scheduler;
|
| | | private final Scheduler scheduler;
|
| | |
|
| | | @Autowired
|
| | | private SysJobMapper jobMapper;
|
| | | private final SysJobMapper jobMapper;
|
| | |
|
| | | /**
|
| | | * 项目启动时,初始化定时器 主要是防止手动修改数据库导致未同步到定时任务处理(注:不能手动修改数据库ID和任务组名,否则会导致脏数据)
|
| | |
| | | @PostConstruct
|
| | | public void init() throws SchedulerException, TaskException
|
| | | {
|
| | | scheduler.clear();
|
| | | // scheduler.clear();
|
| | | List<SysJob> jobList = jobMapper.selectJobAll();
|
| | | for (SysJob job : jobList)
|
| | | {
|