package com.njcn.product.diagram.job;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import com.njcn.product.advance.harmonicUp.service.HarmonicUpService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

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

/**
 * @Author: cdf
 * @CreateTime: 2025-09-19
 * @Description: 定时任务
 */
@Component
@EnableScheduling
@RequiredArgsConstructor
@Slf4j
public class CustomJob {

    private final HarmonicUpService harmonicUpService;

    // 每天凌晨4:30执行
    @Scheduled(cron = "0 30 4 * * ?")
    public void UpHarmonicJob(){
        log.info("开始执行谐波放大调度任务--------------------------------");
        String date = LocalDate.now().minusDays(1).format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
        harmonicUpService.analyzePreData(date);
        log.info("执行谐波放大调度任务结束--------------------------------");
    }



}
