package com.gyee.alarm.task;


import com.gyee.alarm.service.EarlyReportParam;
import com.gyee.alarm.service.EarlyReportService;


import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Executor;

/**
 * @ClassName : SaticScheduleTask
 * @Description : 调度
 */


@Component
public class SaticScheduleTask {

    private static Logger logger = LoggerFactory.getLogger(SaticScheduleTask.class);
    @Resource
    private EarlyReportService earlyReportService;


    /**
     * 判定
     */
//    @Scheduled(cron = "0 0/1 * * * ?")
    //或直接指定时间间隔，例如：5秒
    //@Scheduled(fixedRate=5000)
    @XxlJob("alarmStat_earlyReport")
    public void alarmStat_earlyReport() {


        XxlJobHelper.log("报警按模块统计调度程序执行开始!........");

        try {
            Calendar c = Calendar.getInstance();
//
////            Date begin = DateUtils.truncate(c.getTime());
////            Date end = DateUtils.addDays(begin, 1);
//            EarlyReportParam reportParam=new EarlyReportParam();
            earlyReportService.createEarlyReport(c.getTime());
        } catch (Exception e) {

            e.printStackTrace();
        }

        XxlJobHelper.log("报警按模块统计调度任务处理完成!........");
    }


}
