|
@@ -824,15 +824,21 @@ public class ContractMakingServiceImpl implements ContractMakingService {
|
|
|
id = Long.parseLong(split[1]);
|
|
|
}
|
|
|
File newFile = newContractMakingService.createContractDocument(type, id, contractInfo);
|
|
|
+ File renameFile = null;
|
|
|
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);
|
|
|
+ String fileName = newFile.getName().substring(0, newFile.getName().lastIndexOf("."));
|
|
|
+ String extension = newFile.getName().substring(newFile.getName().lastIndexOf("."));
|
|
|
+ renameFile = new File(newFile.getParentFile(), fileName + UUID.randomUUID() + extension);
|
|
|
newFile.renameTo(renameFile);
|
|
|
}
|
|
|
}
|
|
|
- fileList.add(newFile);
|
|
|
+ if (renameFile != null && renameFile.exists()) {
|
|
|
+ fileList.add(renameFile);
|
|
|
+ } else {
|
|
|
+ fileList.add(newFile);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
if (CollectionUtil.isNotEmpty(fileList)) {
|
|
|
// 打包成zip文件
|