package com.njcn.system.timer.tasks.cld;

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 xuyang
 * @version 1.0.0
 * @createTime 2025/11/11
 */
@Component
@RequiredArgsConstructor
public class CldMeasurementTaskRunner implements TimerTaskRunner {

    private final LiteFlowAlgorithmFeignClient liteFlowAlgorithmFeignClient;

    @Override
    public void action(String date) {
        BaseParam baseParam = new BaseParam();
        baseParam.setFullChain(true);
        baseParam.setRepair(false);
        // 物联平台
        baseParam.setType(2);
        if(StrUtil.isBlank(date)){
            baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
        }else {
            baseParam.setDataDate(date);
        }
        liteFlowAlgorithmFeignClient.wlMeasurementPointExecutor(baseParam);
    }

}
