临时文件清理 定时任务

This commit is contained in:
cwchen 2026-01-04 13:50:47 +08:00
parent 94436bd6d9
commit 087ef0df53
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
package com.bonus.web.task;
package com.bonus.quartz.task;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@ -7,6 +7,7 @@ import java.io.File;
import java.nio.file.Files;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.concurrent.TimeUnit;
/**
* @className:FileCleanupTask
* @author:cwchen
@ -17,7 +18,7 @@ import java.util.concurrent.TimeUnit;
@Slf4j
@Component
@Component(value = "FileCleanupTask")
public class FileCleanupTask {
// 使用之前定义的临时目录路径
@ -27,7 +28,6 @@ public class FileCleanupTask {
* 每天凌晨 2 点执行清理任务
* cron 表达式:
*/
@Scheduled(cron = "0 0 2 * * ?")
public void cleanupTempFiles() {
log.info("开始执行导出临时文件清理任务...");
File directory = new File(TEMP_PATH);