package com.gkhy.exam.framework.job;
|
|
import cn.hutool.core.io.FileUtil;
|
import com.gkhy.exam.common.config.FilePathConfig;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
|
import java.io.File;
|
|
/**
|
* 清空上传目录
|
*/
|
@Component
|
public class RemoveUploadJob {
|
@Autowired
|
private FilePathConfig filePathConfig;
|
|
/**
|
* 每天23点执行
|
*/
|
@Scheduled(cron = "0 0 23 * * ?")
|
public void progress(){
|
FileUtil.del(new File(filePathConfig.getBasePath()));
|
FileUtil.del(new File(filePathConfig.getTempPath()));
|
FileUtil.del(new File(filePathConfig.getBigPath()));
|
}
|
}
|