package com.njcn.system.timer.tasks.cld;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.njcn.csdevice.api.IcdFeignClient;
import com.njcn.csdevice.param.IcdBzParam;
import com.njcn.system.timer.TimerTaskRunner;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * @author xy
 */
@Component
@RequiredArgsConstructor
public class BzEventFileTaskRunner implements TimerTaskRunner {

    private final IcdFeignClient icdFeignClient;

    @Override
    public void action(String date) {
        if(StrUtil.isBlank(date)){
            date = DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN);
        }
        IcdBzParam param = new IcdBzParam();
        param.setStartTime(date);
        param.setEndTime(date);
        icdFeignClient.bzFile(param);
    }
}
