package com.njcn.executor.handler;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
import com.njcn.prepare.harmonic.pojo.bo.BaseParam;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * PMS/PQS
 * 算法定时任务
 * @author xuyang
 * @date 2023/11/15
 */

@Slf4j
@Component
@AllArgsConstructor
public class LiteFlowJob {

    private final LiteFlowFeignClient liteFlowFeignClient;

    @XxlJob("measurementPointJob")
    public void measurementPointJob() {
        BaseParam baseParam = new BaseParam();
        baseParam.setFullChain(true);
        baseParam.setRepair(false);
        baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
        liteFlowFeignClient.measurementPointExecutor(baseParam);
    }

    @XxlJob("orgJob")
    public void orgJob() {
        BaseParam baseParam = new BaseParam();
        baseParam.setFullChain(true);
        baseParam.setRepair(false);
        baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
        liteFlowFeignClient.orgPointExecutor(baseParam);
    }

    @XxlJob("substationJob")
    public void substationJob() {
        BaseParam baseParam = new BaseParam();
        baseParam.setFullChain(true);
        baseParam.setRepair(false);
        baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
        liteFlowFeignClient.substationExecutor(baseParam);
    }

    @XxlJob("deviceJob")
    public void deviceJob() {
        BaseParam baseParam = new BaseParam();
        baseParam.setFullChain(true);
        baseParam.setRepair(false);
        baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
        liteFlowFeignClient.deviceExecutor(baseParam);
    }

    @XxlJob("pmsDimJob")
    public void pmsDimJob() {
        BaseParam baseParam = new BaseParam();
        baseParam.setFullChain(true);
        baseParam.setRepair(false);
        baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
        liteFlowFeignClient.pmsDimExecutor(baseParam);
    }

    @XxlJob("generaTrixJob")
    public void generaTrixJob() {
        BaseParam baseParam = new BaseParam();
        baseParam.setFullChain(true);
        baseParam.setRepair(false);
        baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
        liteFlowFeignClient.generaTrixExecutor(baseParam);
    }

}
