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.TargetWarnFeignClient;
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 TargetWarnJob {

    private final TargetWarnFeignClient targetWarnFeignClient;

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

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

    @XxlJob("alarmMonthJob")
    public void alarmMonthJob(){
        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
        lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
        lineParam.setDataSource(2);
        targetWarnFeignClient.alarmMonth(lineParam);
    }
}
