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

/**
 * pqs
 * 变电站指标统计
 * @author zbj
 * @date 2023/07/04
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class RStatSubstationJob {

    private final RStatSubstationFeignClient rStatSubstationFeignClient;

    @XxlJob("rStartSubstationDHandler")
    public void  rStartSubstationDHandler(){
        OrgParam orgParam = new OrgParam();
        orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
        orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
        rStatSubstationFeignClient.rStartSubstationHandler(orgParam);
    }

    @XxlJob("rStartSubstationMHandler")
    public void  rStartSubstationMHandler(){
        OrgParam orgParam = new OrgParam();
        orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
        orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
        rStatSubstationFeignClient.rStartSubstationHandler(orgParam);
    }

    @XxlJob("rStartSubstationQHandler")
    public void  rStartSubstationQHandler(){
        OrgParam orgParam = new OrgParam();
        orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_QUARTER));
        orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_QUARTER));
        rStatSubstationFeignClient.rStartSubstationHandler(orgParam);
    }

    @XxlJob("rStartSubstationYHandler")
    public void  rStartSubstationYHandler(){
        OrgParam orgParam = new OrgParam();
        orgParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_YEAR));
        orgParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_YEAR));
        rStatSubstationFeignClient.rStartSubstationHandler(orgParam);
    }

}
