package net.northking.cctp.device.schedule;

import net.northking.cctp.device.db.service.CdDeviceUsageLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class DeviceLogSchedule {

    @Autowired
    private CdDeviceUsageLogService cdDeviceUsageLogService;

    private final static Logger logger = LoggerFactory.getLogger(DeviceLogSchedule.class);

    @Scheduled(cron = "0 5 0 * * *")
    public void deleteUsageLog(){
        logger.info("删除30天之前的使用记录==============================>start");
        cdDeviceUsageLogService.deleteUsageLog();
        logger.info("删除30天之前的使用记录==============================>end");
    }
}
