From 402e60b65fc5bed8749d4a0aab9dc03fd974a3a1 Mon Sep 17 00:00:00 2001 From: chenxudong Date: Sun, 27 Apr 2025 10:58:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=96=87=E4=BB=B6=E6=97=B6?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=B4=E6=97=B6=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/serviceimpl/EdFileInfoServiceImpl.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/EdFileInfoServiceImpl.java b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/EdFileInfoServiceImpl.java index 3b13415..0471141 100644 --- a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/EdFileInfoServiceImpl.java +++ b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/EdFileInfoServiceImpl.java @@ -1290,12 +1290,13 @@ public class EdFileInfoServiceImpl extends ServiceImpl preview(String id, HttpServletResponse response, int dataOwnCode) { + String fileSaveTmpPath = null; try { EdFileInfo fileInfo = this.baseMapper.selectById(id); Assert.isTrue(Objects.nonNull(fileInfo), "文件不存在"); String fileDbPath = commonService.getDbPath(fileInfo.getFilePath()); String fileSysPath = commonService.getFileSysPath(fileInfo.getId()); - String fileSaveTmpPath = elePropertyConfig.getEleTmpPath() + File.separator + IdUtil.fastSimpleUUID() + "." + fileInfo.getFileType(); + fileSaveTmpPath = elePropertyConfig.getEleTmpPath() + File.separator + IdUtil.fastSimpleUUID() + "." + fileInfo.getFileType(); FileUtil.copy(fileSysPath, fileSaveTmpPath, true); EleCommonUtil.decryptFile(fileSaveTmpPath, SecureUtil.aes(FILE_SEC_PASSWD.getBytes())); @@ -1314,7 +1315,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl{},错误信息--->{}", id, e.getMessage()); log.error(info, e); throw new BizException(info); + } finally { + FileUtil.del(fileSaveTmpPath); } }