Browse Source

feat(资方管理):修改

Wangyafan 6 months ago
parent
commit
5cd41d67ac

+ 2 - 12
src/main/java/com/sunxung/factoring/service/fundmanagement/impl/FinancialInstitutionServiceImpl.java

@@ -1176,18 +1176,8 @@ public class FinancialInstitutionServiceImpl extends ServiceImpl<FinancialInstit
             FileModuleDict.ChildEnum childEnum = FileModuleDict.ChildEnum.FINANCIAL_EXPENDITURE_ATTACHMENT_FILE;
             if (CollectionUtil.isNotEmpty(contractFileList)) {
                 contractFileList.forEach(contractFile -> {
-                    String fileName = contractFile.getOriginalName().substring(0, contractFile.getOriginalName().lastIndexOf("."));
-                    String localFilePath = FileUtil.getAbsolutePath(fileName, contractFile.getType(), childEnum);
-                    File destFile = new File(localFilePath);
-                    if (!destFile.getParentFile().exists()) {
-                        destFile.getParentFile().mkdirs();
-                    }
-                    //新建FileStorage
-                    FileStorage newFileStorage = new FileStorage(contractFile, localFilePath, childEnum);
-                    fileStorageService.add(newFileStorage);
-                    //新建关联关系
-                    AttachmentDto attachmentDto = AttachmentDto.builder().setEntityId(customerExpenditureInfoId).setChildEnum(childEnum).build();
-                    sysAttachmentRefService.saveRef(Arrays.asList(newFileStorage.getId()), attachmentDto);
+                    sysAttachmentRefService.copyFile(contractFile, FileModuleDict.ChildEnum.FINANCIAL_EXPENDITURE_DOWNSTREAM_SETTLEMENT_FILE,
+                            AttachmentDto.builder().setEntityId(customerExpenditureInfoId).build());
                 });
             }
         }