/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.syswarning.service;

import com.jeeplus.common.utils.DateUtils;
import com.jeeplus.modules.workcalendar.entity.WorkCalendar;
import com.jeeplus.modules.workcalendar.service.WorkCalendarService;
import com.jeeplus.modules.workregularapply.service.WorkRegularApplyService;
import com.jeeplus.modules.workregularapply.service.WorkRegularApplyTaskService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Calendar;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 工作日历Service
 * @author ssrh
 * @version 2018-07-17
 */
@Service
@Lazy(false)
@Transactional(readOnly = true)
public class SysWarningTaskService {

    @Autowired
    private SysWarningService sysWarningService;
    private Logger logger = LoggerFactory.getLogger(WorkRegularApplyTaskService.class);
    private static final ExecutorService threadPool = Executors.newFixedThreadPool(10);

//
   /* @Scheduled(cron= "0 0/1 * * * ?")*/
    public void notifyTask() {
        logger.info("-----------系统预警定时开始------------------");

        threadPool.execute(new Runnable() {
            @Override
            public void run() {
                sysWarningService.startTask();
            }
        });
        logger.info("------------系统预警定时任务结束------------------");
    }
}