package com.njcn.executor.handler;

import com.njcn.prepare.harmonic.api.device.DeviceAbnormalFeignClient;
import com.njcn.prepare.harmonic.pojo.param.DeviceAbnormaStatisticsParam;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@Slf4j
@Component
@AllArgsConstructor
/**
 * 终端装置异常告警每日统计
 * @date 2023/4/18
 */
public class DeviceAbnormalStatisticsJob {
    private final DeviceAbnormalFeignClient deviceAbnormalFeignClient;

    @XxlJob("deviceAbnormalStatisticsJob")
    public void deviceAbnormalStatisticsJob () {
        String time = LocalDateTime.now().minusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        log.info("执行日期deviceAbnormalStatisticsJob===============>"+time);
        DeviceAbnormaStatisticsParam param =new DeviceAbnormaStatisticsParam();
        param.setTime(time);
        deviceAbnormalFeignClient.dailyDeviceAbnormaStatistics(param);
    }
}
