package com.njcn.executor.handler;


import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.executor.utils.CommonExecutorUtils;
import com.njcn.prepare.harmonic.api.line.DayDataFeignClient;
import com.njcn.prepare.harmonic.pojo.param.LimitRateHanlderParam;
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.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;

/**
 * pqs
 * 稳态自定义监测点报告定时调度任务
 * @author cdf
 * @date 2022/10/24
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class HarmDateToDayJob {

    private final DayDataFeignClient dayDataFeignClient;

    @Deprecated
    @XxlJob("harmDateToDayJob")
    public void harmDateToDayJob(){


        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
        lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));

        //下面测试数据部署需删除
        //lineParam.setDataDate("2022-10-27");
        lineParam.setDataSource(1);
        dayDataFeignClient.dayDataHanlder(lineParam);
    }

    @XxlJob("harmDateToDayJobToMysql")
    public void harmDateToDayJobToMysql(){
        log.info(LocalDateTime.now()+"data转day数据调度开始------------------------");
        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY));
        lineParam.setDataDate(CommonExecutorUtils.prepareTimeDeal(BizParamConstant.STAT_BIZ_DAY));
        lineParam.setDataSource(2);
        dayDataFeignClient.dataToDayHandler(lineParam);
    }

}
