新增:删除转换后OFFICE、CAD、TIFF、压缩包源文件 默认开启 节约磁盘空间

This commit is contained in:
gaoxiongzaq
2023-04-21 09:56:46 +08:00
parent 57a9dc78ab
commit 61ae49f510
7 changed files with 43 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ import cn.keking.service.FilePreview;
import cn.keking.utils.DownloadUtils;
import cn.keking.service.FileHandlerService;
import cn.keking.service.CompressFileReader;
import cn.keking.utils.KkFileUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.poi.EncryptedDocumentException;
import org.springframework.stereotype.Service;
@@ -59,6 +60,9 @@ public class CompressFilePreviewImpl implements FilePreview {
}
}
if (!ObjectUtils.isEmpty(fileTree)) {
if( ConfigConstants.getdeletesourcefile()){ //是否保留压缩包源文件
KkFileUtils.deleteFileByPath(filePath);
}
if (ConfigConstants.isCacheEnabled()) {
// 加入缓存
fileHandlerService.addConvertedFile(fileName, fileTree);