package com.njcn.executor.handler;

import cn.hutool.core.date.LocalDateTimeUtil;
import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.executor.utils.CommonExecutorUtils;
import com.njcn.prepare.harmonic.api.line.LimitrateFeignClient;
import com.njcn.prepare.harmonic.pojo.param.LimitRateHanlderParam;
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.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * pqs
 * 每日监测点超标次数
 * @author cdf
 * @date 2022/10/24
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class HarmLimitRateJob {

    private final LimitrateFeignClient limitrateFeignClient;

    @Deprecated
    @XxlJob("harmLimitRateJob")
    public void harmLimitRateJob(){


        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
        lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));

        //下面测试数据部署需删除
        //lineParam.setDataDate("2022-10-26");
        lineParam.setDataSource(1);
        limitrateFeignClient.limitRateHanlder(lineParam);
    }

    @XxlJob("harmLimitRateJobToMysql")
    public void harmLimitRateJobToMysql(){
        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
        lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
        lineParam.setDataSource(2);
        limitrateFeignClient.limitRate(lineParam);
    }

}
