package com.njcn.system.timer.tasks;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.njcn.algorithm.pojo.bo.BaseParam;
import com.njcn.algorithm.pojo.liteflow.LiteFlowAlgorithmFeignClient;
import com.njcn.system.timer.TimerTaskRunner;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 有功功率趋势算法执行定时任务
 * @author guofeihu
 * @date 2024/8/21
 */
@Component
@RequiredArgsConstructor
public class SpecialAnalysisTaskRunner implements TimerTaskRunner {

    private final LiteFlowAlgorithmFeignClient liteFlowAlgorithmFeignClient;

    @Override
    public void action(String date) {
        BaseParam baseParam = new BaseParam();
        baseParam.setFullChain(true);
        baseParam.setRepair(false);
        if(StrUtil.isBlank(date)){
            baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
        }else {
            baseParam.setDataDate(date);
        }
        liteFlowAlgorithmFeignClient.specialAnalysisExecutor(baseParam);
    }
}
