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.RStatHarmonicFeignClient;
import com.njcn.prepare.harmonic.pojo.param.OrgParam;
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;

/**
 * 类的介绍：
 *
 * @author xuyang
 * @version 1.0.0
 * @createTime 2023/7/25 11:05
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class RStatHarmonicJob {

    private final RStatHarmonicFeignClient rStatHarmonicFeignClient;

    @XxlJob("rStatHarmonicDay")
    public void rStatHarmonicDay(){
        log.info(LocalDateTime.now()+"单位监测点稳态指标日统计调度开始------------------------");
        OrgParam orgParam = new OrgParam();
        orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
        orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
        rStatHarmonicFeignClient.handler(orgParam);
    }

    @XxlJob("rStatHarmonicMonth")
    public void rStatHarmonicMonth(){
        log.info(LocalDateTime.now()+"单位监测点稳态指标月统计调度开始------------------------");
        OrgParam orgParam = new OrgParam();
        orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
        orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
        rStatHarmonicFeignClient.handler(orgParam);
    }

}
