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.LimitTargetFeignClient;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
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 HarmLimitTargetJob {

    private final LimitTargetFeignClient limitTargetFeignClient;

    @Deprecated
    @XxlJob("harmLimitTargetJob")
    public void harmLimitTargetJob(){
        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
        lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));

        //lineParam.setDataDate("2022-10-27");
        lineParam.setDataSource(1);
        limitTargetFeignClient.getLimitTargetData(lineParam);
    }

    @XxlJob("harmLimitTargetJobToMysql")
    public void harmLimitTargetJobToMysql(){
        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);

        limitTargetFeignClient.limitTargetData(lineParam);
    }

}
