package com.inspect.metadata.mqtt.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@EnableScheduling
@Component
@Slf4j
public class HrTask {
    @Autowired
    private IHrNestService nestService;

    @Scheduled(cron = "${hua-ruan.mqtt.clean.corn: 0 0 1 ? * 5}")
    public void cleanNest() {
        // 默认清理三天之前的所有数据
        int cleanDays = 7;
        int deletedCount = nestService.deleteBeforeDaysAgo(cleanDays);
        log.info("[HR NEST CLEAN] count: {} ", deletedCount);
    }
}
