package com.njcn.executor.handler;

import com.njcn.process.api.SupvStatisticReportMFeignClient;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Component;

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

/**
 * pqs
 * 技术监督计划问题月报统计
 * @author cdf
 * @date 2023/6/29
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class SupvStatisticReportJob {

    private final SupvStatisticReportMFeignClient supvStatisticReportMFeignClient;

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