package com.njcn.system.timer.tasks;

import com.njcn.process.api.SupvStatisticReportMFeignClient;
import com.njcn.system.timer.TimerTaskRunner;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * 类的介绍：第二技术监督月上送报告统计-定时任务
 *
 * @author xuyang
 * @version 1.0.0
 * @createTime 2023/12/08 11:35
 */
@Component
@RequiredArgsConstructor
@Slf4j
public class StatisticReportTaskRunner implements TimerTaskRunner {
    private final SupvStatisticReportMFeignClient supvStatisticReportMFeignClient;

    @Override
    public void action(String date) {
        log.info(LocalDateTime.now()+"技术监督计划问题月报统计调用成功");
        LocalDate yesterday = LocalDate.now().plusDays(-1);
        supvStatisticReportMFeignClient.statisticReport(yesterday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
    }
}
