package com.goafanti.common.task;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.goafanti.common.utils.LoggerUtils;
import com.goafanti.order.service.OrderReportService;

@Component
public class MonthReportTask {
	@Resource
	private  OrderReportService	orderReportServiceImpl;

	Logger	logger	= LoggerFactory.getLogger(MonthReportTask.class);
	/**
     * 每月1号7点执行任务
     */
    @Scheduled(cron = "0 0 7 1 * ?")
    //@Scheduled(cron = "0 3 16 * * ?")
    public void testTask(){
    	//新增月数据
    	int count = orderReportServiceImpl.insertOrderStatisticsByMonthTask();
    	//更新年数据
    	int c = orderReportServiceImpl.saveYearReportData();

    	LoggerUtils.debug(logger, "统计上月订单【%s】条。", count);
    	LoggerUtils.debug(logger, "更新年订单【%s】条。", c);
    }
}
