package com.jjt.task;

import com.jjt.calc.service.ITwinCalcDayService;
import com.jjt.calc.service.ITwinCalcHourService;
import com.jjt.common.utils.DateUtils;
import com.jjt.emp.service.ITwinEmpCalcService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.time.LocalDate;

/**
 * 统计定时任务
 *
 * @author wukai
 * @date 2025-1-17 23:27:26
 */
@Component("calc")
public class CalcTask {
    @Resource
    private ITwinCalcHourService calcHourService;
    @Resource
    private ITwinCalcDayService dayService;
    @Resource
    private ITwinEmpCalcService empCalcService;

    /**
     * 统计上一时段数据
     */
    public void last() {
        calcHourService.last();
    }

    /**
     * 统计昨日数据
     */

    public void day() {
        LocalDate localDate = LocalDate.now().minusDays(1);
        dayService.day(localDate);
        empCalcService.calc(DateUtils.toDate(localDate));
    }

}
