package com.njcn.executor.handler;

import cn.hutool.core.date.DateUtil;
import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.executor.utils.CommonExecutorUtils;
import com.njcn.prepare.harmonic.api.line.PollutionFeignClient;
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;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;

/**
 * 污区数据
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class HarmPollutionJob {

    private final PollutionFeignClient pollutionFeignClient;

    @XxlJob("harmPollutionJob")
    public void harmPollutionJob(){
        String command = XxlJobHelper.getJobParam();
        LineParam lineParam = new LineParam();
        lineParam.setType(Integer.valueOf(command));
        lineParam.setDataSource(1);
        String date = CommonExecutorUtils.prepareTimeDeal(command);
        log.info("执行日期harmPollutionJob。。。。。。。。。。"+date);
        CommonExecutorUtils.commDefineDate(command,lineParam);

        //测试数据部署时注释
        //date = "2022-10-21";
        lineParam.setDataDate(date);
        CommonExecutorUtils.commDefineDate(command,lineParam);

        pollutionFeignClient.processPollutionData(lineParam);
    }

}
