1
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.yunhai.bschclassmanage.scheduler;
|
||||
|
||||
import com.yunhai.bschclassmanage.service.ISysOperationLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SysOperationLogCleanupTask {
|
||||
|
||||
@Autowired
|
||||
private ISysOperationLogService sysOperationLogService;
|
||||
|
||||
@Scheduled(cron = "0 30 3 * * ?") // 每日 03:30(与业务零点任务错峰)
|
||||
public void run() {
|
||||
try {
|
||||
long deleted = sysOperationLogService.cleanupExpired();
|
||||
log.info("审计日志定时清理完成, 删除{}条", deleted);
|
||||
} catch (Exception e) {
|
||||
log.error("审计日志定时清理失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user