package com.njcn.executor.handler;

import com.njcn.system.api.AuditFeignClient;
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;

/**
 * @author wr
 * @description
 * @date 2023/5/17 19:48
 */
@Slf4j
@Component
@AllArgsConstructor
public class AuditJob {
    private final AuditFeignClient auditFeignClient;

    @XxlJob("clearHistoryLogJob")
    public void clearHistoryLogJob() {
        try {
            String time = LocalDateTime.now().minusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
            log.info("执行日期deviceAbnormalStatisticsJob===============>"+time);
            auditFeignClient.clearHistoryLog();
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}
