package com.ann.demo.job;

import com.ann.demo.service.ArchiveDetailService;
import com.ann.demo.service.ArchiveMasterService;
import com.ann.demo.service.TimerService;
import com.ann.demo.utils.QuartzUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Scheduler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalTime;
import java.util.List;

/**
 * 取从属表报错的消息 次数小于6
 *
 * @Author: LeiJiaXin
 * @Date: 2019/8/16 10:12
 */
public class ScheduledJob3 implements Job {

    static final Logger logger = LoggerFactory.getLogger(ScheduledJob3.class);

    @Autowired
    Scheduler scheduler;

    @Autowired
    TimerService timerService;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        try {
            //System.out.println("动态的定时任务3执行时间：" + LocalTime.now());
            QuartzUtils.pauseScheduleJob(scheduler, "group1", "job3");
            timerService.doSomethingByMedicalRecordHomepageCache();
        } catch (Exception e) {
            logger.error("出错咯！错误信息:" + e);
        }
        QuartzUtils.resumeScheduleJob(scheduler, "group1", "job3");
    }
}
