|  |  | 
 |  |  | package com.doumee.service.timer; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | import com.doumee.core.constants.ResponseStatus; | 
 |  |  | import com.doumee.core.exception.BusinessException; | 
 |  |  | import com.doumee.core.model.PageData; | 
 |  |  | import com.doumee.core.model.PageWrap; | 
 |  |  | import com.doumee.service.business.third.model.PageData; | 
 |  |  | import com.doumee.service.business.third.model.PageWrap; | 
 |  |  | import com.doumee.core.utils.Utils; | 
 |  |  | import com.doumee.dao.timer.entity.JobState; | 
 |  |  | import com.doumee.dao.timer.entity.QuartzJob; | 
 |  |  | import com.doumee.dao.timer.mapper.QuartzJobMapper; | 
 |  |  | import com.doumee.dao.timer.scheduler.QuartzManage; | 
 |  |  | import org.quartz.CronTrigger; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | import javax.annotation.PostConstruct; | 
 |  |  | import javax.annotation.Resource; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Objects; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  | 
 |  |  |      * 新增任务 | 
 |  |  |      */ | 
 |  |  |     public int insert(QuartzJob quartzJob) { | 
 |  |  |         if(quartzJobMapper.selectCount(new QueryWrapper<QuartzJob>().lambda() | 
 |  |  |                 .eq(QuartzJob::getModule,quartzJob.getModule()) | 
 |  |  |                 .eq(QuartzJob::getBeanName,quartzJob.getBeanName())) >0){ | 
 |  |  |             throw  new BusinessException(ResponseStatus.DATA_EXISTS); | 
 |  |  |         } | 
 |  |  |         int flag = quartzJobMapper.insert(quartzJob) ; | 
 |  |  |         if (flag > 0){ | 
 |  |  |             quartzManage.createJob(quartzJob) ; | 
 |  |  | 
 |  |  |      * 更新任务 | 
 |  |  |      */ | 
 |  |  |     public int update(QuartzJob quartzJob) { | 
 |  |  |         if(quartzJobMapper.selectCount(new QueryWrapper<QuartzJob>().lambda() | 
 |  |  |                 .eq(QuartzJob::getModule,quartzJob.getModule()) | 
 |  |  |                 .ne(QuartzJob::getId,quartzJob.getId()) | 
 |  |  |                 .eq(QuartzJob::getBeanName,quartzJob.getBeanName())) >0){ | 
 |  |  |             throw  new BusinessException(ResponseStatus.DATA_EXISTS); | 
 |  |  |         } | 
 |  |  |         int flag = quartzJobMapper.updateById(quartzJob); | 
 |  |  |         if (flag > 0){ | 
 |  |  |             quartzManage.updateJob(quartzJob); |