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.HarmOverLimitFeignClient;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 类的介绍：
 *
 * @author xuyang
 * @version 1.0.0
 * @createTime 2023/5/10 14:29
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class HarmOverLimitJob {

    private final HarmOverLimitFeignClient harmOverLimitFeignClient;

    @XxlJob("harmonicDetailDay1Job")
    public void harmonicDetailDay1Job(){
        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
        //lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
        //lineParam.setDataSource(2);
        CommonExecutorUtils.commDefineDate(BizParamConstant.STAT_BIZ_DAY,lineParam);
        log.info("任务：harmonicDetailDay1Job"+lineParam.getBeginTime()+"-------》"+lineParam.getEndTime());
        harmOverLimitFeignClient.harmonicDetailDay1(lineParam);
    }

    @XxlJob("harmonicDetailDay2Job")
    public void harmonicDetailDay2Job(){
        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
        //lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
        //lineParam.setDataSource(2);
        CommonExecutorUtils.commDefineDate(BizParamConstant.STAT_BIZ_DAY,lineParam);
        log.info("任务：harmonicDetailDay2Job"+lineParam.getBeginTime()+"-------》"+lineParam.getEndTime());
        harmOverLimitFeignClient.harmonicDetailDay2(lineParam);
    }

    @XxlJob("harmonicDetailMonth1Job")
    public void harmonicDetailMonth1Job(){
        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
        //lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
        //lineParam.setDataSource(2);
        CommonExecutorUtils.commDefineDate(BizParamConstant.STAT_BIZ_MONTH,lineParam);
        log.info("任务：harmonicDetailMonth1Job"+lineParam.getBeginTime()+"-------》"+lineParam.getEndTime());

        harmOverLimitFeignClient.harmonicDetailMonth1(lineParam);
    }

    @XxlJob("harmonicDetailMonth2Job")
    public void harmonicDetailMonth2Job(){
        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
        //lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
        //lineParam.setDataSource(2);
        CommonExecutorUtils.commDefineDate(BizParamConstant.STAT_BIZ_MONTH,lineParam);
        log.info("任务：harmonicDetailMonth2Job"+lineParam.getBeginTime()+"-------》"+lineParam.getEndTime());

        harmOverLimitFeignClient.harmonicDetailMonth2(lineParam);
    }

    @XxlJob("harmonicThdDayJob")
    public void harmonicThdDayJob(){
        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
        //lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
        //lineParam.setDataSource(2);
        CommonExecutorUtils.commDefineDate(BizParamConstant.STAT_BIZ_DAY,lineParam);
        log.info("任务：harmonicThdDayJob"+lineParam.getBeginTime()+"-------》"+lineParam.getEndTime());

        harmOverLimitFeignClient.harmonicThdDay(lineParam);
    }
}
