package org.eco.als.task;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.eco.als.service.IFaultStatisticsService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 故障定时任务
 *
 * @author wgk
 * @date 2025-2-18
 */
@Slf4j
@Component
@EnableScheduling
@ConditionalOnProperty(prefix = "scheduling", name = "enabled", havingValue = "true")
public class FaultTask {
    @Resource
    private IFaultStatisticsService faultStatisticsService;

    @Scheduled(cron = "0 */30 * * * *")
    public void faultStatisticsTask() {
        log.info("获取ZK故障信息定时任务=========开始");
        faultStatisticsService.getExtraStatistics();
        log.info("获取ZK故障信息定时任务=========结束");
    }
}
