package com.njcn.executor.handler;

import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.executor.utils.CommonExecutorUtils;
import com.njcn.prepare.harmonic.api.line.IntegrityFeignClient;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
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.stereotype.Component;

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

/**
 * pqs
 * 稳态自定义监测点报告定时调度任务
 * @author cdf
 * @date 2022/10/24
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class HarmIntegrityJob {

    private final IntegrityFeignClient integrityFeignClient;

    @Deprecated
    @XxlJob("harmIntegrityJob")
    public void harmIntegrityJob(){
        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
        lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
        lineParam.setDataSource(1);
        integrityFeignClient.computeDataIntegrity(lineParam);
    }

    @XxlJob("harmIntegrityJobToMysql")
    public void harmIntegrityJobToMysql(){
        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
        lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
        lineParam.setDataSource(2);
        CommonExecutorUtils.commDefineDate(BizParamConstant.STAT_BIZ_DAY,lineParam);
        integrityFeignClient.dataIntegrity(lineParam);
    }

}
