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.HarmonicGeneralFeignClient;
import com.njcn.prepare.harmonic.api.line.HarmonicMetricFeignClient;
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;

/**
 * pqs
 * 稳态指标评估
 * @author cdf
 * @date 2022/11/11
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class HarmKpiAssessJob {

    private final HarmonicMetricFeignClient harmonicMetricFeignClient;

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

        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);
        harmonicMetricFeignClient.metricData(lineParam);
    }

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