package com.njcn.executor.handler;

import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.executor.utils.CommonExecutorUtils;
import com.njcn.prepare.harmonic.api.newalgorithm.PmsStatisticsSpecialMonitorFeignClient;
import com.njcn.prepare.harmonic.api.newalgorithm.RQualityParameterMFeignClient;
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;


/**
 * @Description: pms算法
 * @Author: wr
 * @Date: 2023/10/13 15:02
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class RQualityParameterMJob {

    private final RQualityParameterMFeignClient rQualityParameterMFeignClient;
    private final PmsStatisticsSpecialMonitorFeignClient pmsStatisticsSpecialMonitorFeignClient;

    @XxlJob("rQualityParameterM")
    public void rQualityParameterM(){
        log.info(LocalDateTime.now()+"监测指标数据质量问题汇总统计调度开始------------------------");
        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
        lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
        lineParam.setDataSource(2);
        CommonExecutorUtils.commDefineDate(BizParamConstant.STAT_BIZ_MONTH,lineParam);
        rQualityParameterMFeignClient.handlerMonitorAbnormal(lineParam);
    }

    @XxlJob("pmsStatisticsSpecialMonitor")
    public void pmsStatisticsSpecialMonitorHandler(){
        log.info(LocalDateTime.now()+"专项分析-台账统计调度开始------------------------");
        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
        lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
        lineParam.setDataSource(2);
        CommonExecutorUtils.commDefineDate(BizParamConstant.STAT_BIZ_MONTH,lineParam);
        pmsStatisticsSpecialMonitorFeignClient.pmsStatisticsSpecialMonitorHandler(lineParam);
    }
}
