package com.njcn.system.timer.tasks;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.harmonic.api.PqTypicalSourceFeignClient;
import com.njcn.harmonic.pojo.param.UploadParam;
import com.njcn.system.timer.TimerTaskRunner;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;


/**
 * 典型源荷指标统计数据
 */
@Component
@RequiredArgsConstructor
@Deprecated
public class PqTypicalSourceTaskMRunner implements TimerTaskRunner {

    private final PqTypicalSourceFeignClient pqTypicalSourceFeignClient;


    @Override
    public void action(String date) {


        //月
        UploadParam param=new UploadParam();
        param.setTime(DateUtil.yesterday().toString(DatePattern.NORM_MONTH_PATTERN));
        String code = pqTypicalSourceFeignClient.send(param).getCode();
        if(code.equals("A0002")){
            throw new BusinessException("失败");
        }
        //年
        param.setTime(DateUtil.yesterday().toString(DatePattern.NORM_YEAR_PATTERN));
        String code2 = pqTypicalSourceFeignClient.send(param).getCode();
        if(code2.equals("A0002")){
            throw new BusinessException("失败");
        }
    }
}
