package com.ssj.task.sz;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.ssj.framework.core.util.SystemResourceLocator;
import com.ssj.service.sys.analysis.service.AnalysisCountService;
import com.ssj.service.sys.analysis.service.AnalysisWeekService;

@Component
@DisallowConcurrentExecution
public class AnalysisCountAndWeekTask implements Job {
	
    private static Logger logger = LoggerFactory.getLogger(AnalysisCountAndWeekTask.class);

    @Override
    public void execute(JobExecutionContext jobExecutionContext){
    	
    	try{
        	AnalysisCountService analysisCountService = SystemResourceLocator.getBean(AnalysisCountService.class);
        	logger.info("统计前一天的接口数据开始");
        	analysisCountService.runTaskAnalysisCount();
        }catch (Exception e) {
            logger.error("统计前一天的接口数据异常-->"+e.getMessage());
        }
    	
        try {
        	AnalysisWeekService analysisWeekService = SystemResourceLocator.getBean(AnalysisWeekService.class);
            logger.info("统计前一天周的接口数据开始");
            analysisWeekService.runTaskByAnalysisWeek();
        } catch (Exception e) {
            logger.error("统计前一天周的接口数据异常-->"+e.getMessage());
        }

    }
}
