From dba661c914c9877b28061d5a9ffe1d3e16fc3f2b Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 21 Jul 2022 18:33:12 +0800 Subject: [PATCH] =?UTF-8?q?perf(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E5=9C=B0=E5=9B=BE=E5=9D=90=E6=A0=87=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E5=B7=B2=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/map/service/MapTransferService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/dataease/map/service/MapTransferService.java b/backend/src/main/java/io/dataease/map/service/MapTransferService.java index 34a4becd44..32f21ccc29 100644 --- a/backend/src/main/java/io/dataease/map/service/MapTransferService.java +++ b/backend/src/main/java/io/dataease/map/service/MapTransferService.java @@ -85,7 +85,10 @@ public class MapTransferService { files.forEach(file -> { String fileName = file.getName(); String newFilePath = dirPath + GLOBAL_CHINA_PREFIX + FILE_SEPARATOR + GLOBAL_CHINA_PREFIX + fileName; - FileUtil.move(file, new File(newFilePath), false); + File target = new File(newFilePath); + if(!target.exists()) { + FileUtil.move(file, target, true); + } }); }); } @@ -104,8 +107,10 @@ public class MapTransferService { String targetPath = targetDirPath + fileName; File targetFile = new File(targetPath); + if (!targetFile.exists()) { + FileUtil.move(sourceFile, targetFile, true); + } - FileUtil.move(sourceFile, targetFile, false); }