package com.ghy.order.quartz;

import com.ghy.common.utils.DateUtils;
import com.ghy.order.service.OrderMasterService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @Date: 2024-09-21 00:23
 * @Author: 但星霖
 * @Version: v1.0
 * @Description: 订单统计定时任务
 */
@Slf4j
@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class OrderMasterStatisticsTask {

    private final OrderMasterService orderMasterService;

//    @Scheduled(cron = "0 0/5 * * * ?")
//    public void orderMasterStatistics() {
//        log.info("{}开始全部主订单统计任务。", DateUtils.timeFormat(new Date()));
//        orderMasterService.orderStatisticsDispose();
//    }

    @Scheduled(cron = "0 0/5 * * * ?")
    public void orderMasterStatisticsByNow() {
        log.info("{}开始当天主订单统计任务。", DateUtils.timeFormat(new Date()));
        orderMasterService.orderStatisticsDisposeByNow();
    }
}
