From 2228c6fa1bec43a5269eafdd9e74ab06268c51a5 Mon Sep 17 00:00:00 2001 From: maven <2163098428@qq.com> Date: 星期五, 05 九月 2025 10:46:27 +0800 Subject: [PATCH] yys --- src/main/java/com/ruoyi/other/service/impl/TempFileServiceImpl.java | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/ruoyi/other/service/impl/TempFileServiceImpl.java b/src/main/java/com/ruoyi/other/service/impl/TempFileServiceImpl.java index ea7b188..40098d5 100644 --- a/src/main/java/com/ruoyi/other/service/impl/TempFileServiceImpl.java +++ b/src/main/java/com/ruoyi/other/service/impl/TempFileServiceImpl.java @@ -85,9 +85,10 @@ * * @param businessId 涓氬姟ID锛堥攢鍞彴璐D锛� * @param tempFileIds 涓存椂鏂囦欢ID鍒楄〃 + * @param fileType 鏂囦欢绫诲瀷(鏉ヨ嚜FileNameType) * @throws IOException 鏂囦欢鎿嶄綔寮傚父 */ - private void migrateTempFilesToFormal(Long businessId, List<String> tempFileIds,Integer fileType) throws IOException { + public void migrateTempFilesToFormal(Long businessId, List<String> tempFileIds, Integer fileType) throws IOException { if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isEmpty(tempFileIds)) { return; } @@ -122,12 +123,15 @@ try { // 鎵ц鏂囦欢杩佺Щ锛堜娇鐢ㄥ師瀛愭搷浣滅‘淇濆畨鍏ㄦ�э級 - Files.move( - Paths.get(tempFile.getTempPath()), - formalFilePath, - StandardCopyOption.REPLACE_EXISTING, - StandardCopyOption.ATOMIC_MOVE - ); +// Files.move( +// Paths.get(tempFile.getTempPath()), +// formalFilePath, +// StandardCopyOption.REPLACE_EXISTING, +// StandardCopyOption.ATOMIC_MOVE +// ); + // 鍘熷瓙绉诲姩澶辫触锛屼娇鐢ㄥ鍒�+鍒犻櫎 + Files.copy(Paths.get(tempFile.getTempPath()), formalFilePath, StandardCopyOption.REPLACE_EXISTING); + Files.deleteIfExists(Paths.get(tempFile.getTempPath())); log.info("鏂囦欢杩佺Щ鎴愬姛: {} -> {}", tempFile.getTempPath(), formalFilePath); // 鏇存柊鏂囦欢璁板綍锛堝叧鑱斿埌涓氬姟ID锛� -- Gitblit v1.9.3