liuj месяцев назад: 5
Родитель
Сommit
96e6c1a4bb

+ 11 - 2
src/main/java/com/sunxung/factoring/service/financing/contract/impl/ContractMakingServiceImpl.java

@@ -823,12 +823,21 @@ public class ContractMakingServiceImpl implements ContractMakingService {
             if (split.length == 2) {
                 id = Long.parseLong(split[1]);
             }
-            File file = newContractMakingService.createContractDocument(type, id, contractInfo);
-            fileList.add(file);
+            File newFile = newContractMakingService.createContractDocument(type, id, contractInfo);
+            for (File file : fileList) {
+                if (file.getName().equals(newFile.getName())) {
+                    String fileName = newFile.getName().substring(newFile.getName().lastIndexOf("."));
+                    String extension = newFile.getName().substring(newFile.getName().lastIndexOf(".") + 1);
+                    File renameFile = new File(newFile.getParentFile(), fileName + UUID.randomUUID() + extension);
+                    newFile.renameTo(renameFile);
+                }
+            }
+            fileList.add(newFile);
         }
         if (CollectionUtil.isNotEmpty(fileList)) {
             // 打包成zip文件
             File file = downloadZip(fileList, "线上签署合同模板", FileModuleDict.ChildEnum.CONTRACT_FILE_PREVIEW);
+
             fileStorageService.downloadFile(response, file);
         }
     }