diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/ApiTransferRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/ApiTransferRequest.java index 61eac9fb6d..7e05b627ec 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/ApiTransferRequest.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/ApiTransferRequest.java @@ -14,4 +14,8 @@ public class ApiTransferRequest extends ApiFileRequest { @Schema(description = "转存的模块id", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{functional_case.module_id.not_blank}") private String moduleId; + + @Schema(description = "原始文件名", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank + private String originalName; } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiCommonService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiCommonService.java index 44127a70ff..f78bdc68fe 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiCommonService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiCommonService.java @@ -105,7 +105,13 @@ public class ApiCommonService { private void setLinkFileInfo(String resourceId, List apiFiles) { List linkFiles = apiFiles.stream() - .filter(file -> !file.getLocal() && !file.getDelete()) + .filter(file -> { + if (file.getLocal()) { + // 本地文件设置文件别名,方便前端展示 + file.setFileAlias(file.getFileName()); + } + return !file.getLocal() && !file.getDelete(); + }) .toList(); List linkFileIds = linkFiles.stream() .map(ApiFile::getFileId) @@ -116,20 +122,25 @@ public class ApiCommonService { return; } - Map fileNameMap = fileMetadataService.selectByList(linkFileIds) + Map fileNameMap = fileMetadataService.selectByList(linkFileIds) .stream() - .collect(Collectors.toMap(FileMetadata::getId, FileMetadata::getName)); + .collect(Collectors.toMap(FileMetadata::getId, Function.identity())); for (ApiFile linkFile : linkFiles) { - String fileName = fileNameMap.get(linkFile.getFileId()); - if (StringUtils.isBlank(fileName)) { - // fileName 为空,则文件被删除,设置为已删除,并且设置文件名 + FileMetadata fileMetadata = fileNameMap.get(linkFile.getFileId()); + if (fileMetadata == null) { + // fileMetadata null ,则文件被删除,设置为已删除,并且设置文件名 linkFile.setDelete(true); List fileAssociations = fileAssociationService.getByFileIdAndSourceId(resourceId, linkFile.getFileId()); if (CollectionUtils.isNotEmpty(fileAssociations)) { linkFile.setFileAlias(fileAssociations.get(0).getDeletedFileName()); } } else { + String fileName = fileMetadata.getName() + fileMetadata.getType(); + if (StringUtils.isNotBlank(fileMetadata.getType())) { + // 前端展示别名加后缀 + fileName += "." + fileMetadata.getType(); + } linkFile.setFileAlias(fileName); } } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiFileResourceService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiFileResourceService.java index 584ccd3618..65975eb0f0 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiFileResourceService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiFileResourceService.java @@ -422,7 +422,7 @@ public class ApiFileResourceService { throw new MSException("download file error!"); } try { - fileId = fileMetadataService.transferFile(request.getFileName(), request.getProjectId(), request.getModuleId(), currentUser, bytes); + fileId = fileMetadataService.transferFile(request.getFileName(), request.getOriginalName(), request.getProjectId(), request.getModuleId(), currentUser, bytes); } catch (Exception e) { throw new MSException(Translator.get("file.transfer.failed")); } diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDebugControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDebugControllerTests.java index 36ed3e52ce..7931b5c6bc 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDebugControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDebugControllerTests.java @@ -709,11 +709,13 @@ public class ApiDebugControllerTests extends BaseTest { request.setLocal(true); uploadFileId = doUploadTempFile(getMockMultipartFile("test-debug-file.txt")); request.setFileId(uploadFileId); - request.setFileName("test-debug-file.txt"); + request.setFileName("test-debug-file"); + request.setOriginalName("test-debug-file.txt"); this.requestPost(TRANSFER, request).andExpect(status().isOk()); //文件不存在 request.setFileId("111"); - request.setFileName("test-debug-file.txt"); + request.setFileName("test-debug-file"); + request.setOriginalName("test-debug-file.txt"); this.requestPost(TRANSFER, request).andExpect(status().is5xxServerError()); //文件已经上传 ApiDebugAddRequest addRequest = new ApiDebugAddRequest(); @@ -739,7 +741,8 @@ public class ApiDebugControllerTests extends BaseTest { request.setSourceId(resultData.getId()); request.setProjectId(DEFAULT_PROJECT_ID); request.setModuleId("root"); - request.setFileName("test-debug-file1.txt"); + request.setFileName("test-debug-file1"); + request.setOriginalName("test-debug-file1.txt"); request.setFileId(apiFileResources.get(0).getFileId()); this.requestPost(TRANSFER, request).andExpect(status().isOk()); } diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java index 9541aef113..803d899286 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java @@ -244,7 +244,8 @@ public class ApiDefinitionControllerTests extends BaseTest { apiTransferRequest.setLocal(true); String uploadFileId = doUploadTempFile(getMockMultipartFile("api-file_upload.JPG")); apiTransferRequest.setFileId(uploadFileId); - apiTransferRequest.setFileName("api-file_upload.JPG"); + apiTransferRequest.setFileName(StringUtils.EMPTY); + apiTransferRequest.setOriginalName("api-file_upload.JPG"); this.requestPost("transfer", apiTransferRequest).andExpect(status().isOk()); //文件不存在 apiTransferRequest.setFileId("111"); @@ -255,7 +256,8 @@ public class ApiDefinitionControllerTests extends BaseTest { List apiFileResources = apiFileResourceMapper.selectByExample(apiFileResourceExample); Assertions.assertFalse(apiFileResources.isEmpty()); apiTransferRequest.setFileId(apiFileResources.get(0).getFileId()); - apiTransferRequest.setFileName("test-file_upload.JPG"); + apiTransferRequest.setFileName("test-file_upload"); + apiTransferRequest.setOriginalName("test-file_upload.JPG"); this.requestPost("transfer", apiTransferRequest).andExpect(status().isOk()); // 再插入一条数据,便于修改时重名校验 diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java index 8fcfdfa12c..acb7f639cf 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java @@ -815,7 +815,8 @@ public class ApiScenarioControllerTests extends BaseTest { apiTransferRequest.setProjectId(DEFAULT_PROJECT_ID); apiTransferRequest.setModuleId("root"); apiTransferRequest.setLocal(true); - apiTransferRequest.setFileName("test-scenario-file.txt"); + apiTransferRequest.setFileName("test-scenario-file"); + apiTransferRequest.setOriginalName("test-scenario-file.txt"); String uploadFileId = doUploadTempFile(getMockMultipartFile()); apiTransferRequest.setFileId(uploadFileId); this.requestPost("transfer", apiTransferRequest).andExpect(status().isOk()); @@ -828,7 +829,8 @@ public class ApiScenarioControllerTests extends BaseTest { List apiFileResources = apiFileResourceMapper.selectByExample(apiFileResourceExample); Assertions.assertFalse(apiFileResources.isEmpty()); apiTransferRequest.setFileId(apiFileResources.get(0).getFileId()); - apiTransferRequest.setFileName("test-scenario-file-1.txt"); + apiTransferRequest.setFileName("test-scenario-file-1"); + apiTransferRequest.setOriginalName("test-scenario-file-1.txt"); this.requestPost("transfer", apiTransferRequest).andExpect(status().isOk()); } diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java index 595f63f72f..e3d63d013a 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java @@ -728,7 +728,8 @@ public class ApiTestCaseControllerTests extends BaseTest { apiTransferRequest.setLocal(true); String uploadFileId = doUploadTempFile(getMockMultipartFile()); apiTransferRequest.setFileId(uploadFileId); - apiTransferRequest.setFileName("test-api-test-case.txt"); + apiTransferRequest.setFileName("test-api-test-case"); + apiTransferRequest.setOriginalName("test-api-test-case.txt"); this.requestPost("transfer", apiTransferRequest).andExpect(status().isOk()); //文件不存在 apiTransferRequest.setFileId("111"); @@ -739,7 +740,8 @@ public class ApiTestCaseControllerTests extends BaseTest { List apiFileResources = apiFileResourceMapper.selectByExample(apiFileResourceExample); Assertions.assertFalse(apiFileResources.isEmpty()); apiTransferRequest.setFileId(apiFileResources.get(0).getFileId()); - apiTransferRequest.setFileName("test-api-test-case-1.txt"); + apiTransferRequest.setFileName("test-api-test-case-1"); + apiTransferRequest.setOriginalName("test-api-test-case-1.txt"); this.requestPost("transfer", apiTransferRequest).andExpect(status().isOk()); } diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/dto/request/BugFileTransferRequest.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/dto/request/BugFileTransferRequest.java index c8a7c33acb..50d54d11a1 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/dto/request/BugFileTransferRequest.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/dto/request/BugFileTransferRequest.java @@ -12,4 +12,8 @@ public class BugFileTransferRequest extends BugFileSourceRequest{ @Schema(description = "转存的模块id",requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{functional_case.module_id.not_blank}") private String moduleId; + + + @Schema(description = "文件别名", requiredMode = Schema.RequiredMode.REQUIRED) + private String fileName; } diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugAttachmentService.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugAttachmentService.java index 9b27b92cf4..168e228fdf 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugAttachmentService.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugAttachmentService.java @@ -213,7 +213,7 @@ public class BugAttachmentService { byte[] bytes = getLocalFileBytes(attachment, request.getProjectId(), request.getBugId()); String fileId; try { - FileAssociationDTO association = new FileAssociationDTO(attachment.getFileName(), bytes, attachment.getBugId(), + FileAssociationDTO association = new FileAssociationDTO(request.getFileName(), attachment.getFileName(), bytes, attachment.getBugId(), FileAssociationSourceUtil.SOURCE_TYPE_BUG, createFileLogRecord(currentUser, request.getProjectId())); association.setModuleId(request.getModuleId()); fileId = fileAssociationService.transferAndAssociation(association); diff --git a/backend/services/bug-management/src/test/java/io/metersphere/bug/controller/BugAttachmentControllerTests.java b/backend/services/bug-management/src/test/java/io/metersphere/bug/controller/BugAttachmentControllerTests.java index fc64c98adb..2396460768 100644 --- a/backend/services/bug-management/src/test/java/io/metersphere/bug/controller/BugAttachmentControllerTests.java +++ b/backend/services/bug-management/src/test/java/io/metersphere/bug/controller/BugAttachmentControllerTests.java @@ -28,6 +28,7 @@ import java.io.File; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Objects; +import java.util.UUID; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -143,6 +144,7 @@ public class BugAttachmentControllerTests extends BaseTest { request.setModuleId("root"); request.setAssociated(false); request.setFileId("not-exist-file-id"); + request.setFileName(UUID.randomUUID().toString()); this.requestPost(BUG_ATTACHMENT_TRANSFER, request).andExpect(status().is5xxServerError()); List files = getBugFiles("default-attachment-bug-id"); files.stream().filter(BugFileDTO::getLocal).forEach(file -> { diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseAttachmentController.java b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseAttachmentController.java index 1ebdc1c3ef..71cb3eece4 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseAttachmentController.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseAttachmentController.java @@ -135,7 +135,7 @@ public class FunctionalCaseAttachmentController { String fileId = null; try { - FileAssociationDTO fileAssociationDTO = new FileAssociationDTO(attachment.getFileName(), fileByte, attachment.getCaseId(), FileAssociationSourceUtil.SOURCE_TYPE_FUNCTIONAL_CASE, fileLogRecord); + FileAssociationDTO fileAssociationDTO = new FileAssociationDTO(request.getFileName(), attachment.getFileName(), fileByte, attachment.getCaseId(), FileAssociationSourceUtil.SOURCE_TYPE_FUNCTIONAL_CASE, fileLogRecord); fileAssociationDTO.setModuleId(request.getModuleId()); fileId = fileAssociationService.transferAndAssociation(fileAssociationDTO); functionalCaseAttachmentService.deleteCaseAttachment(Arrays.asList(request.getFileId()), request.getCaseId(), request.getProjectId()); diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/AttachmentTransferRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/AttachmentTransferRequest.java index f6b19390d1..e8147109d0 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/AttachmentTransferRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/AttachmentTransferRequest.java @@ -14,4 +14,8 @@ public class AttachmentTransferRequest extends FunctionalCaseFileRequest{ @Schema(description = "转存的模块id",requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{functional_case.module_id.not_blank}") private String moduleId; + + + @Schema(description = "文件别名", requiredMode = Schema.RequiredMode.REQUIRED) + private String fileName; } diff --git a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseAttachmentControllerTests.java b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseAttachmentControllerTests.java index 24bf29496e..edf784ac92 100644 --- a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseAttachmentControllerTests.java +++ b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseAttachmentControllerTests.java @@ -185,6 +185,7 @@ public class FunctionalCaseAttachmentControllerTests extends BaseTest { request.setProjectId(DEFAULT_PROJECT_ID); request.setFileId(FILE_ID); request.setCaseId("TEST_FUNCTIONAL_CASE_ATTACHMENT_ID"); + request.setFileName(UUID.randomUUID().toString()); request.setModuleId("root"); this.requestPost(ATTACHMENT_TRANSFER_URL, request); request.setFileId("TEST_ATTACHMENT_FILE_ID"); diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/FileAssociationDTO.java b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/FileAssociationDTO.java index f8906ab0d7..d1f8b6d705 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/FileAssociationDTO.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/FileAssociationDTO.java @@ -16,6 +16,9 @@ public class FileAssociationDTO { @NotBlank private String fileName; + @NotBlank + private String originalName; + @NotBlank private String sourceId; @@ -29,8 +32,9 @@ public class FileAssociationDTO { private FileLogRecord fileLogRecord; - public FileAssociationDTO(String fileName, byte[] fileBytes, String sourceId, String sourceType, FileLogRecord fileLogRecord) { + public FileAssociationDTO(String fileName, String originalName, byte[] fileBytes, String sourceId, String sourceType, FileLogRecord fileLogRecord) { this.fileName = fileName; + this.originalName = originalName; this.sourceId = sourceId; this.sourceType = sourceType; this.fileBytes = fileBytes; diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/FileAssociationService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/FileAssociationService.java index f849684c31..29fab94028 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/FileAssociationService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/FileAssociationService.java @@ -321,6 +321,7 @@ public class FileAssociationService { this.validateSourceName(source); String fileId = fileMetadataService.transferFile( fileAssociationDTO.getFileName(), + fileAssociationDTO.getOriginalName(), fileAssociationDTO.getFileLogRecord().getProjectId(), fileAssociationDTO.getModuleId(), fileAssociationDTO.getFileLogRecord().getOperator(), diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/FileMetadataService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/FileMetadataService.java index fdff50b10e..a993ba521a 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/FileMetadataService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/FileMetadataService.java @@ -203,22 +203,25 @@ public class FileMetadataService { return fileMetadata.getId(); } - /** * 文件转存 * * @param fileName 文件名 + * @param originFileName 原始文件名 * @param projectId 项目ID * @param operator 操作人 * @param fileBytes 文件字节 * @return * @throws Exception */ - public String transferFile(String fileName, String projectId, String moduleId, String operator, byte[] fileBytes) throws Exception { - if (StringUtils.isBlank(fileName)) { + public String transferFile(String fileName, String originFileName, String projectId, String moduleId, String operator, byte[] fileBytes) throws Exception { + if (StringUtils.isBlank(originFileName)) { throw new MSException(Translator.get("file.name.cannot.be.empty")); } - FileMetadata fileMetadata = this.genFileMetadata(fileName, StorageType.MINIO.name(), fileBytes.length, false, projectId, moduleId, operator); + FileMetadata fileMetadata = this.genFileMetadata(originFileName, StorageType.MINIO.name(), fileBytes.length, false, projectId, moduleId, operator); + if (StringUtils.isNotBlank(fileName)) { + fileMetadata.setName(fileName); + } FileRequest uploadFileRequest = new FileRequest(); uploadFileRequest.setFileName(fileMetadata.getId()); uploadFileRequest.setFolder(this.generateMinIOFilePath(projectId)); diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementControllerTests.java b/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementControllerTests.java index 07f2bd6d9f..5cb500e9e4 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementControllerTests.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementControllerTests.java @@ -1770,28 +1770,28 @@ public class FileManagementControllerTests extends BaseTest { .build(); //关联正常文件 String filePath = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/file_upload.JPG")).getPath(); - String fileID = fileAssociationService.transferAndAssociation(new FileAssociationDTO("testTransferFile.jpg", TempFileUtils.getFile(filePath), "sty-file-association-bug-id-4", FileAssociationSourceUtil.SOURCE_TYPE_BUG, fileLogRecord)); + String fileID = fileAssociationService.transferAndAssociation(new FileAssociationDTO("testTransferFile", "testTransferFile.jpg", TempFileUtils.getFile(filePath), "sty-file-association-bug-id-4", FileAssociationSourceUtil.SOURCE_TYPE_BUG, fileLogRecord)); FileMetadataExample example = new FileMetadataExample(); example.createCriteria().andIdEqualTo(fileID).andNameEqualTo("testTransferFile").andTypeEqualTo("JPG"); Assertions.assertEquals(fileMetadataMapper.countByExample(example), 1); //重复转存检查是否报错 boolean error = false; try { - fileID = fileAssociationService.transferAndAssociation(new FileAssociationDTO("testTransferFile.jpg", TempFileUtils.getFile(filePath), "sty-file-association-bug-id-4", FileAssociationSourceUtil.SOURCE_TYPE_BUG, fileLogRecord)); + fileID = fileAssociationService.transferAndAssociation(new FileAssociationDTO("testTransferFile", "testTransferFile.jpg", TempFileUtils.getFile(filePath), "sty-file-association-bug-id-4", FileAssociationSourceUtil.SOURCE_TYPE_BUG, fileLogRecord)); } catch (Exception e) { error = true; } Assertions.assertTrue(error); //测试没有后缀的文件名 - fileID = fileAssociationService.transferAndAssociation(new FileAssociationDTO("testTransfer", TempFileUtils.getFile(filePath), "sty-file-association-bug-id-4", FileAssociationSourceUtil.SOURCE_TYPE_BUG, fileLogRecord)); + fileID = fileAssociationService.transferAndAssociation(new FileAssociationDTO("testTransfer", "testTransfer", TempFileUtils.getFile(filePath), "sty-file-association-bug-id-4", FileAssociationSourceUtil.SOURCE_TYPE_BUG, fileLogRecord)); example.clear(); example.createCriteria().andIdEqualTo(fileID).andNameEqualTo("testTransfer"); Assertions.assertEquals(fileMetadataMapper.countByExample(example), 1); //资源不存在 error = false; try { - fileAssociationService.transferAndAssociation(new FileAssociationDTO("testTransferFile.jpg", TempFileUtils.getFile(filePath), IDGenerator.nextStr(), FileAssociationSourceUtil.SOURCE_TYPE_BUG, fileLogRecord)); + fileAssociationService.transferAndAssociation(new FileAssociationDTO("testTransferFile", "testTransferFile.jpg", TempFileUtils.getFile(filePath), IDGenerator.nextStr(), FileAssociationSourceUtil.SOURCE_TYPE_BUG, fileLogRecord)); } catch (Exception e) { error = true; } @@ -1799,7 +1799,7 @@ public class FileManagementControllerTests extends BaseTest { //文件名称不合法 error = false; try { - fileAssociationService.transferAndAssociation(new FileAssociationDTO("testTransfer/File.jpg", TempFileUtils.getFile(filePath), IDGenerator.nextStr(), FileAssociationSourceUtil.SOURCE_TYPE_BUG, fileLogRecord)); + fileAssociationService.transferAndAssociation(new FileAssociationDTO("testTransfer/File", "testTransfer/File.jpg", TempFileUtils.getFile(filePath), IDGenerator.nextStr(), FileAssociationSourceUtil.SOURCE_TYPE_BUG, fileLogRecord)); } catch (Exception e) { error = true; } @@ -1808,7 +1808,7 @@ public class FileManagementControllerTests extends BaseTest { //文件名称非法 error = false; try { - fileMetadataService.transferFile("", null, null, null, null); + fileMetadataService.transferFile(StringUtils.EMPTY, StringUtils.EMPTY, null, null, null, null); } catch (Exception e) { error = true; }