增加word转pdf的缓存。

This commit is contained in:
chenxudong 2025-03-25 12:04:41 +08:00
parent a5766b31d3
commit 21ee580fc7
2 changed files with 4 additions and 1 deletions

View File

@ -1308,7 +1308,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
EleCommonUtil.decryptFile(fileSaveTmpPath, SecureUtil.aes(FILE_SEC_PASSWD.getBytes())); EleCommonUtil.decryptFile(fileSaveTmpPath, SecureUtil.aes(FILE_SEC_PASSWD.getBytes()));
if (Arrays.asList("doc", "docx").contains(fileInfo.getFileType())) { if (Arrays.asList("doc", "docx").contains(fileInfo.getFileType())) {
String pdfTmpPath = elePropertyConfig.getEleTmpPath() + File.separator + fileInfo.getFileName() + "_" + IdUtil.fastSimpleUUID() + ".pdf"; String pdfTmpPath = elePropertyConfig.getEleTmpPath() + File.separator + fileInfo.getId()+ ".pdf";
OfficeFileUtil.doc2pdf(fileSaveTmpPath, pdfTmpPath); OfficeFileUtil.doc2pdf(fileSaveTmpPath, pdfTmpPath);
fileSaveTmpPath = pdfTmpPath; fileSaveTmpPath = pdfTmpPath;
} }

View File

@ -36,6 +36,9 @@ import java.util.Objects;
public class OfficeFileUtil { public class OfficeFileUtil {
public static void doc2pdf(String wordPath, String pdfPath) { public static void doc2pdf(String wordPath, String pdfPath) {
if (FileUtil.exist(pdfPath)) {
return;
}
log.info("Start convert word file to pdf, word path: {}, pdf path: {}", wordPath, pdfPath); log.info("Start convert word file to pdf, word path: {}, pdf path: {}", wordPath, pdfPath);
if (EleCommonUtil.isWinOs()) { if (EleCommonUtil.isWinOs()) {
File inputWord = new File(wordPath); File inputWord = new File(wordPath);