diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/request/NodeMoveRequest.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/request/NodeMoveRequest.java index fd9bbebc2b..624db14828 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/request/NodeMoveRequest.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/request/NodeMoveRequest.java @@ -1,24 +1,20 @@ package io.metersphere.sdk.dto.request; -import io.metersphere.sdk.constants.ModuleConstants; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotEmpty; import lombok.Data; @Data public class NodeMoveRequest { - @Schema(description = "模块ID", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "被拖拽的节点", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty(message = "{node.not_blank}") - private String nodeId; + private String dragNodeId; - @Schema(description = "父模块ID", requiredMode = Schema.RequiredMode.REQUIRED) - @NotEmpty(message = "{parent.node.not_blank}") - private String parentId = ModuleConstants.ROOT_NODE_PARENT_ID; + @Schema(description = "放入的节点", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "{node.not_blank}") + private String dropNodeId; - @Schema(description = "前一个节点ID", requiredMode = Schema.RequiredMode.REQUIRED) - private String previousNodeId; - - @Schema(description = "后一个节点ID", requiredMode = Schema.RequiredMode.REQUIRED) - private String nextNodeId; + @Schema(description = "放入的位置(取值:-1,,0,,1。 -1:dropNodeId节点之前。 0:dropNodeId节点内。 1:dropNodeId节点后)", requiredMode = Schema.RequiredMode.REQUIRED) + private int dropPosition; } diff --git a/backend/framework/sdk/src/main/resources/i18n/project.properties b/backend/framework/sdk/src/main/resources/i18n/project.properties index 5c8ef86610..a884cfde91 100644 --- a/backend/framework/sdk/src/main/resources/i18n/project.properties +++ b/backend/framework/sdk/src/main/resources/i18n/project.properties @@ -414,6 +414,7 @@ resource_pool_not_exist=资源池不存在 #file management file_module.not.exist=文件模块不存在 +file_module.parent.not.exist=文件模块父节点不存在 upload.file.error=上传文件失败 file.not.exist=文件不存在 old.file.not.exist=旧文件不存在 diff --git a/backend/framework/sdk/src/main/resources/i18n/project_en_US.properties b/backend/framework/sdk/src/main/resources/i18n/project_en_US.properties index 6de778de8e..1b3a6969f1 100644 --- a/backend/framework/sdk/src/main/resources/i18n/project_en_US.properties +++ b/backend/framework/sdk/src/main/resources/i18n/project_en_US.properties @@ -450,6 +450,7 @@ resource_pool_not_exist=Resource pool does not exist #file management file_module.not.exist=File module does not exist +file_module.parent.not.exist=File module parent does not exist upload.file.error=Upload file error file.not.exist=File does not exist old.file.not.exist=Old file does not exist diff --git a/backend/framework/sdk/src/main/resources/i18n/project_zh_CN.properties b/backend/framework/sdk/src/main/resources/i18n/project_zh_CN.properties index 094b5d08a2..e4a7d9fefd 100644 --- a/backend/framework/sdk/src/main/resources/i18n/project_zh_CN.properties +++ b/backend/framework/sdk/src/main/resources/i18n/project_zh_CN.properties @@ -449,6 +449,7 @@ resource_pool_not_exist=资源池不存在 #file management file_module.not.exist=文件模块不存在 +file_module.parent.not.exist=文件模块父节点不存在 upload.file.error=上传文件失败 file.not.exist=文件不存在 old.file.not.exist=旧文件不存在 diff --git a/backend/framework/sdk/src/main/resources/i18n/project_zh_TW.properties b/backend/framework/sdk/src/main/resources/i18n/project_zh_TW.properties index 34ffc5f5e6..b26100b71a 100644 --- a/backend/framework/sdk/src/main/resources/i18n/project_zh_TW.properties +++ b/backend/framework/sdk/src/main/resources/i18n/project_zh_TW.properties @@ -450,6 +450,7 @@ message.domain.schedule_enable=是否開啟 resource_pool_not_exist=資源池不存在 #file management file_module.not.exist=文件模塊不存在 +file_module.parent.not.exist=文件模塊父節點不存在 upload.file.error=上傳文件失敗 file.not.exist=文件不存在 old.file.not.exist=舊文件不存在 diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/controller/FileManagementController.java b/backend/services/project-management/src/main/java/io/metersphere/project/controller/FileManagementController.java index e3f7672b29..3dcad981f3 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/controller/FileManagementController.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/controller/FileManagementController.java @@ -31,6 +31,13 @@ public class FileManagementController { @Resource private FileManagementService fileManagementService; + @GetMapping(value = "/type/{projectId}") + @Operation(summary = "项目管理-文件管理-获取已存在的文件类型") + @RequiresPermissions(PermissionConstants.PROJECT_FILE_MANAGEMENT_READ) + public List getFileType(@PathVariable String projectId) { + return fileMetadataService.getFileType(projectId); + } + @PostMapping("/page") @Operation(summary = "项目管理-文件管理-表格分页查询文件") @RequiresPermissions(PermissionConstants.PROJECT_FILE_MANAGEMENT_READ) @@ -38,6 +45,7 @@ public class FileManagementController { return fileMetadataService.page(request); } + @PostMapping("/module/count") @Operation(summary = "项目管理-文件管理-表格分页查询文件") @RequiresPermissions(PermissionConstants.PROJECT_FILE_MANAGEMENT_READ) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/controller/FileModuleController.java b/backend/services/project-management/src/main/java/io/metersphere/project/controller/FileModuleController.java index e035b6b7ab..2e01ad0f04 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/controller/FileModuleController.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/controller/FileModuleController.java @@ -60,12 +60,7 @@ public class FileModuleController { @PostMapping("/move") @Operation(summary = "项目管理-文件管理-模块-移动模块") @RequiresPermissions(PermissionConstants.PROJECT_FILE_MANAGEMENT_READ_UPDATE) - public void moveNode(@RequestBody NodeMoveRequest request) { - /** - * 拖拽操作。 两种:同级移动 和 跨级移动 - * 1.判断移动后的parentID,判断是否是移动到其余的目录下 - * 2.拖拽后的前后ID。 用于排序。 - */ + public void moveNode(@Validated @RequestBody NodeMoveRequest request) { fileModuleService.moveNode(request, SessionUtils.getUserId()); } } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/dto/NodeSortDTO.java b/backend/services/project-management/src/main/java/io/metersphere/project/dto/NodeSortDTO.java new file mode 100644 index 0000000000..f2a9f3bfcd --- /dev/null +++ b/backend/services/project-management/src/main/java/io/metersphere/project/dto/NodeSortDTO.java @@ -0,0 +1,29 @@ +package io.metersphere.project.dto; + +import io.metersphere.sdk.dto.BaseModule; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class NodeSortDTO { + + @Schema(description = "模块ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{file_module.not.exist}") + private BaseModule node; + + @Schema(description = "父模块ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{file_module.parent.not.exist}") + private BaseModule parent; + + @Schema(description = "前一个节点") + private BaseModule previousNode; + + @Schema(description = "后一个节点") + private BaseModule nextNode; +} + diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileMetadataMapper.java b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileMetadataMapper.java index 5b088f802e..953c10d225 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileMetadataMapper.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileMetadataMapper.java @@ -26,4 +26,5 @@ public interface ExtFileMetadataMapper { List selectRefIdByModuleIds(@Param("moduleIds") List moduleIds); + List selectFileTypeByProjectId(String projectId); } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileMetadataMapper.xml b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileMetadataMapper.xml index a8eed50f42..4afeaa9880 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileMetadataMapper.xml +++ b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileMetadataMapper.xml @@ -117,6 +117,11 @@ #{item} + \ No newline at end of file diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileModuleMapper.java b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileModuleMapper.java index 3f80fbdb86..2fa918897f 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileModuleMapper.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileModuleMapper.java @@ -1,5 +1,6 @@ package io.metersphere.project.mapper; +import io.metersphere.project.domain.FileModule; import io.metersphere.sdk.dto.BaseTreeNode; import org.apache.ibatis.annotations.Param; @@ -19,4 +20,10 @@ public interface ExtFileModuleMapper { Integer getMaxPosByParentId(String parentId); List selectIdsByProjectId(String projectId); + + FileModule getLastModuleByParentId(String id); + + FileModule getNextModuleInParentId(@Param("parentId") String parentId, @Param("pos") int pos); + + FileModule getPreviousModuleInParentId(@Param("parentId") String parentId, @Param("pos") int pos); } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileModuleMapper.xml b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileModuleMapper.xml index b06a362cd9..17f94dc8ad 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileModuleMapper.xml +++ b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileModuleMapper.xml @@ -37,5 +37,29 @@ SELECT id FROM file_module WHERE parent_id = #{0} ORDER BY pos ASC + + + \ No newline at end of file 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 04a23858b5..0787895a31 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 @@ -294,14 +294,14 @@ public class FileMetadataService { //获取模块统计 public Map moduleCount(FileMetadataTableRequest request, String operator) { - //查出每个模块节点下的资源数量 + //查出每个模块节点下的资源数量。 不需要按照模块进行筛选 FileManagementPageDTO pageDTO = new FileManagementPageDTO(request); + pageDTO.setModuleIds(null); List moduleCountDTOList = extFileMetadataMapper.countModuleIdByKeywordAndFileType(pageDTO); long allCount = fileModuleService.getAllCount(moduleCountDTOList); - + //查出我的文件数量 pageDTO.setOperator(operator); long myFileCount = extFileMetadataMapper.countMyFile(pageDTO); - Map moduleCountMap = fileModuleService.getModuleCountMap(request.getProjectId(), moduleCountDTOList); moduleCountMap.put(FILE_MODULE_COUNT_MY, myFileCount); moduleCountMap.put(FILE_MODULE_COUNT_ALL, allCount); @@ -331,4 +331,8 @@ public class FileMetadataService { .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + this.getFileName(fileMetadata.getName(), fileMetadata.getType()) + "\"") .body(bytes); } + + public List getFileType(String projectId) { + return extFileMetadataMapper.selectFileTypeByProjectId(projectId); + } } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/FileModuleLogService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/FileModuleLogService.java index 5b066d31e2..f4b62c279d 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/FileModuleLogService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/FileModuleLogService.java @@ -2,12 +2,13 @@ package io.metersphere.project.service; import io.metersphere.project.domain.FileModule; import io.metersphere.project.domain.Project; +import io.metersphere.project.dto.NodeSortDTO; import io.metersphere.project.mapper.FileModuleMapper; import io.metersphere.project.mapper.ProjectMapper; import io.metersphere.sdk.constants.HttpMethodConstants; +import io.metersphere.sdk.dto.BaseModule; import io.metersphere.sdk.dto.LogDTO; import io.metersphere.sdk.dto.builder.LogDTOBuilder; -import io.metersphere.sdk.dto.request.NodeMoveRequest; import io.metersphere.sdk.util.JSON; import io.metersphere.sdk.util.Translator; import io.metersphere.system.log.constants.OperationLogModule; @@ -16,6 +17,7 @@ import io.metersphere.system.log.service.OperationLogService; import jakarta.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; @Service @Transactional(rollbackFor = Exception.class) @@ -79,24 +81,11 @@ public class FileModuleLogService { operationLogService.add(dto); } - public void saveMoveLog(NodeMoveRequest request, String operator) { - FileModule moveNode; - FileModule previousNode = null; - FileModule nextNode = null; - FileModule parentModule; - moveNode = fileModuleMapper.selectByPrimaryKey(request.getNodeId()); - if (request.getPreviousNodeId() != null) { - previousNode = fileModuleMapper.selectByPrimaryKey(request.getPreviousNodeId()); - } - if (request.getNextNodeId() != null) { - nextNode = fileModuleMapper.selectByPrimaryKey(request.getNextNodeId()); - } - - parentModule = fileModuleMapper.selectByPrimaryKey(request.getParentId()); - if (parentModule == null) { - parentModule = new FileModule(); - parentModule.setName(Translator.get("file.module.root")); - } + public void saveMoveLog(@Validated NodeSortDTO request, String operator) { + BaseModule moveNode = request.getNode(); + BaseModule previousNode = request.getPreviousNode(); + BaseModule nextNode = request.getNextNode(); + BaseModule parentModule = request.getParent(); Project project = projectMapper.selectByPrimaryKey(moveNode.getProjectId()); String logContent; diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/FileModuleService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/FileModuleService.java index 365d8860a6..db9554b344 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/FileModuleService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/FileModuleService.java @@ -3,6 +3,7 @@ package io.metersphere.project.service; import io.metersphere.project.domain.FileModule; import io.metersphere.project.domain.FileModuleExample; import io.metersphere.project.dto.ModuleCountDTO; +import io.metersphere.project.dto.NodeSortDTO; import io.metersphere.project.mapper.ExtFileModuleMapper; import io.metersphere.project.mapper.FileModuleMapper; import io.metersphere.project.request.filemanagement.FileModuleCreateRequest; @@ -43,13 +44,13 @@ public class FileModuleService extends ModuleTreeService implements CleanupProje public List getTree(String projectId) { List fileModuleList = extFileModuleMapper.selectBaseByProjectId(projectId); - return this.traverseToBuildTree(fileModuleList, true); + return super.buildTreeAndCountResource(fileModuleList, true); } - //节点内容只有Id和parentId public List getTreeOnlyIdsAndResourceCount(String projectId, List moduleCountDTOList) { + //节点内容只有Id和parentId List fileModuleList = extFileModuleMapper.selectIdAndParentIdByProjectId(projectId); - return this.traverseToBuildTree(fileModuleList, moduleCountDTOList, true); + return super.buildTreeAndCountResource(fileModuleList, moduleCountDTOList, true); } public String add(FileModuleCreateRequest request, String operator) { @@ -150,28 +151,92 @@ public class FileModuleService extends ModuleTreeService implements CleanupProje } public void moveNode(NodeMoveRequest request, String currentUser) { + BaseModule module; + BaseModule parentModule; + BaseModule previousNode = null; + BaseModule nextNode = null; + + FileModule dragNode = fileModuleMapper.selectByPrimaryKey(request.getDragNodeId()); + if (dragNode == null) { + throw new MSException("file_module.not.exist:" + request.getDragNodeId()); + } else { + module = new BaseModule(dragNode.getId(), dragNode.getName(), dragNode.getPos(), dragNode.getProjectId(), dragNode.getParentId()); + } + + if (StringUtils.equals(request.getDragNodeId(), request.getDropNodeId())) { + //两种节点不能一样 + throw new MSException(Translator.get("invalid_parameter")); + } + + FileModule dropNode = fileModuleMapper.selectByPrimaryKey(request.getDropNodeId()); + if (dropNode == null) { + throw new MSException("file_module.not.exist:" + request.getDropNodeId()); + } + + if (request.getDropPosition() == 0) { + //dropPosition=0: 放到dropNode节点内,最后一个节点之后 + parentModule = new BaseModule(dropNode.getId(), dropNode.getName(), dropNode.getPos(), dropNode.getProjectId(), dropNode.getParentId()); + FileModule previousModule = extFileModuleMapper.getLastModuleByParentId(parentModule.getId()); + if (previousModule != null) { + previousNode = new BaseModule(previousModule.getId(), previousModule.getName(), previousModule.getPos(), previousModule.getProjectId(), previousModule.getParentId()); + } + } else { + if (StringUtils.equals(dropNode.getParentId(), ModuleConstants.ROOT_NODE_PARENT_ID)) { + parentModule = new BaseModule(ModuleConstants.ROOT_NODE_PARENT_ID, ModuleConstants.ROOT_NODE_PARENT_ID, 0, module.getProjectId(), ModuleConstants.ROOT_NODE_PARENT_ID); + } else { + FileModule parent = fileModuleMapper.selectByPrimaryKey(dropNode.getParentId()); + parentModule = new BaseModule(parent.getId(), parent.getName(), parent.getPos(), parent.getProjectId(), parent.getParentId()); + } + + if (request.getDropPosition() == 1) { + //dropPosition=1: 放到dropNode节点后,原dropNode后面的节点之前 + previousNode = new BaseModule(dropNode.getId(), dropNode.getName(), dropNode.getPos(), dropNode.getProjectId(), dropNode.getParentId()); + FileModule nextModule = extFileModuleMapper.getNextModuleInParentId(previousNode.getParentId(), previousNode.getPos()); + if (nextModule != null) { + nextNode = new BaseModule(nextModule.getId(), nextModule.getName(), nextModule.getPos(), nextModule.getProjectId(), nextModule.getParentId()); + } + } else if (request.getDropPosition() == -1) { + //dropPosition=-1: 放到dropNode节点前,原dropNode前面的节点之后 + nextNode = new BaseModule(dropNode.getId(), dropNode.getName(), dropNode.getPos(), dropNode.getProjectId(), dropNode.getParentId()); + FileModule previousModule = extFileModuleMapper.getPreviousModuleInParentId(nextNode.getParentId(), nextNode.getPos()); + if (previousModule != null) { + previousNode = new BaseModule(previousModule.getId(), previousModule.getName(), previousModule.getPos(), previousModule.getProjectId(), previousModule.getParentId()); + } + } else { + throw new MSException(Translator.get("invalid_parameter")); + } + } + FileModuleExample example = new FileModuleExample(); - example.createCriteria().andParentIdEqualTo(request.getParentId()).andIdEqualTo(request.getNodeId()); + example.createCriteria().andParentIdEqualTo(parentModule.getId()).andIdEqualTo(module.getId()); + //节点换到了别的节点下,要先更新parent节点. if (fileModuleMapper.countByExample(example) == 0) { - //节点换到了别的节点下 FileModule fileModule = new FileModule(); - fileModule.setId(request.getNodeId()); - fileModule.setParentId(request.getParentId()); + fileModule.setId(module.getId()); + fileModule.setParentId(parentModule.getId()); fileModuleMapper.updateByPrimaryKeySelective(fileModule); } - this.sort(request); + + NodeSortDTO nodeMoveDTO = new NodeSortDTO(module, parentModule, previousNode, nextNode); + super.sort(nodeMoveDTO); //记录日志 - fileModuleLogService.saveMoveLog(request, currentUser); + fileModuleLogService.saveMoveLog(nodeMoveDTO, currentUser); } + /** + * 查找当前项目下模块每个节点对应的资源统计 + * + * @param projectId + * @param moduleCountDTOList + * @return + */ public Map getModuleCountMap(String projectId, List moduleCountDTOList) { - //构建模块树,然后统计每个节点下的所有数量(包含子节点) - List treeNodeList = this.getTreeOnlyIdsAndResourceCount(projectId, moduleCountDTOList); Map returnMap = new HashMap<>(); - - List whileList = new ArrayList<>(treeNodeList); + //构建模块树,并计算每个节点下的所有数量(包含子节点) + List treeNodeList = this.getTreeOnlyIdsAndResourceCount(projectId, moduleCountDTOList); //通过广度遍历的方式构建返回值 + List whileList = new ArrayList<>(treeNodeList); while (CollectionUtils.isNotEmpty(whileList)) { List childList = new ArrayList<>(); for (BaseTreeNode treeNode : whileList) { @@ -183,15 +248,6 @@ public class FileModuleService extends ModuleTreeService implements CleanupProje return returnMap; } - @Override - public BaseModule getNode(String id) { - FileModule module = fileModuleMapper.selectByPrimaryKey(id); - if (module == null) { - return null; - } else { - return new BaseModule(module.getId(), module.getName(), module.getPos(), module.getProjectId(), module.getParentId()); - } - } @Override public void updatePos(String id, int pos) { diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/ModuleTreeService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/ModuleTreeService.java index a8af40e2a4..a0abad6a17 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/ModuleTreeService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/ModuleTreeService.java @@ -1,14 +1,15 @@ package io.metersphere.project.service; import io.metersphere.project.dto.ModuleCountDTO; +import io.metersphere.project.dto.NodeSortDTO; import io.metersphere.sdk.constants.ModuleConstants; import io.metersphere.sdk.dto.BaseModule; import io.metersphere.sdk.dto.BaseTreeNode; -import io.metersphere.sdk.dto.request.NodeMoveRequest; import io.metersphere.sdk.util.Translator; import jakarta.validation.constraints.NotNull; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.validation.annotation.Validated; import java.util.ArrayList; import java.util.HashMap; @@ -26,9 +27,13 @@ public abstract class ModuleTreeService { } - public List traverseToBuildTree(List traverseList, @NotNull List moduleCountDTOList, boolean haveVirtualRootNode) { - List baseTreeNodeList = this.traverseToBuildTree(traverseList, haveVirtualRootNode); + //构建树结构,并为每个节点计算资源数量 + public List buildTreeAndCountResource(List traverseList, @NotNull List moduleCountDTOList, boolean haveVirtualRootNode) { + //构建模块树 + List baseTreeNodeList = this.buildTreeAndCountResource(traverseList, haveVirtualRootNode); + //构建模块节点统计的数据结构 Map resourceCountMap = moduleCountDTOList.stream().collect(Collectors.toMap(ModuleCountDTO::getModuleId, ModuleCountDTO::getDataCount)); + //为每个节点赋值资源数量 this.sumModuleResourceCount(baseTreeNodeList, resourceCountMap); return baseTreeNodeList; } @@ -38,9 +43,8 @@ public abstract class ModuleTreeService { * * @param traverseList 要遍历的节点集合(会被清空) * @param haveVirtualRootNode 是否包含虚拟跟节点 - * @return */ - public List traverseToBuildTree(List traverseList, boolean haveVirtualRootNode) { + public List buildTreeAndCountResource(List traverseList, boolean haveVirtualRootNode) { List baseTreeNodeList = new ArrayList<>(); if (haveVirtualRootNode) { BaseTreeNode defaultNode = this.getDefaultModule(); @@ -78,13 +82,14 @@ public abstract class ModuleTreeService { /** * 模块树排序 */ - public void sort(NodeMoveRequest nodeMoveRequest) { + public void sort(@Validated NodeSortDTO nodeMoveDTO) { // 获取相邻节点 - BaseModule previousNode = getNode(nodeMoveRequest.getPreviousNodeId()); - BaseModule nextNode = getNode(nodeMoveRequest.getNextNodeId()); + BaseModule previousNode = nodeMoveDTO.getPreviousNode(); + BaseModule nextNode = nodeMoveDTO.getNextNode(); + if (previousNode == null && nextNode == null) { // 没有相邻节点,pos为0 - updatePos(nodeMoveRequest.getNodeId(), 0); + updatePos(nodeMoveDTO.getNode().getId(), 0); } else { boolean refreshPos = false; int pos; @@ -103,24 +108,19 @@ public abstract class ModuleTreeService { pos = previousNode.getPos() + quantityDifference; } - updatePos(nodeMoveRequest.getNodeId(), pos); + updatePos(nodeMoveDTO.getNode().getId(), pos); if (refreshPos) { - refreshPos(nodeMoveRequest.getParentId()); + refreshPos(nodeMoveDTO.getParent().getId()); } } } - public abstract BaseModule getNode(String id); - public abstract void updatePos(String id, int pos); public abstract void refreshPos(String parentId); /** - * 通过深度遍历的方式,将资源数量复制到节点上,并将子节点上的资源数量统计到父节点上 - * - * @param baseTreeNodeList - * @param resourceCountMap + * 通过深度遍历的方式,在为节点赋值资源统计数量的同时,同步计算其子节点的资源数量,并添加到父节点上 */ private void sumModuleResourceCount(List baseTreeNodeList, Map resourceCountMap) { for (BaseTreeNode node : baseTreeNodeList) { 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 f3a13228e4..1bae3c05f8 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 @@ -114,6 +114,17 @@ public class FileManagementControllerTests extends BaseTest { Assertions.assertEquals(result.getCurrent(), request.getCurrent()); //返回的数据量不超过规定要返回的数据量相同 Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(result.getList())).size() <= request.getPageSize()); + + //此时该接口数量应该为空 + List fileTypes = this.getFileType(); + Assertions.assertTrue(fileTypes.isEmpty()); + } + + private List getFileType() throws Exception { + MvcResult fileTypeResult = this.requestGetWithOkAndReturn(String.format(FileManagementRequestUtils.URL_FILE_TYPE, project.getId())); + String returnData = fileTypeResult.getResponse().getContentAsString(StandardCharsets.UTF_8); + ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class); + return JSON.parseArray(JSON.toJSONString(resultHolder.getData()), String.class); } @Test @@ -362,6 +373,8 @@ public class FileManagementControllerTests extends BaseTest { public void fileUploadTestSuccess() throws Exception { this.preliminaryData(); + List uploadedFileTypes = new ArrayList<>(); + FileUploadRequest fileUploadRequest = new FileUploadRequest(); fileUploadRequest.setProjectId(project.getId()); @@ -375,6 +388,14 @@ public class FileManagementControllerTests extends BaseTest { String returnId = JSON.parseObject(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData().toString(); checkLog(returnId, OperationLogType.ADD, FileManagementRequestUtils.URL_FILE_UPLOAD); FILE_ID_PATH.put(returnId, filePath); + uploadedFileTypes.add("JPG"); + + //检查文件类型获取接口有没有获取到数据 + List fileTypes = this.getFileType(); + Assertions.assertEquals(fileTypes.size(), uploadedFileTypes.size()); + for (String fileType : fileTypes) { + Assertions.assertTrue(uploadedFileTypes.contains(fileType)); + } //文件上传到a1-a1节点 BaseTreeNode a1a1Node = FileManagementBaseUtils.getNodeByName(preliminaryTreeNodes, "a1-a1"); @@ -382,7 +403,7 @@ public class FileManagementControllerTests extends BaseTest { fileUploadRequest.setProjectId(project.getId()); fileUploadRequest.setModuleId(a1a1Node.getId()); filePath = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/txtFile.txt")).getPath(); - file = new MockMultipartFile("file", "txtFile.JPG", MediaType.APPLICATION_OCTET_STREAM_VALUE, FileManagementBaseUtils.getFileBytes(filePath)); + file = new MockMultipartFile("file", "txtFile.txt", MediaType.APPLICATION_OCTET_STREAM_VALUE, FileManagementBaseUtils.getFileBytes(filePath)); paramMap = new LinkedMultiValueMap<>(); paramMap.add("file", file); paramMap.add("request", JSON.toJSONString(fileUploadRequest)); @@ -390,6 +411,15 @@ public class FileManagementControllerTests extends BaseTest { returnId = JSON.parseObject(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData().toString(); checkLog(returnId, OperationLogType.ADD, FileManagementRequestUtils.URL_FILE_UPLOAD); FILE_ID_PATH.put(returnId, filePath); + uploadedFileTypes.add("txt"); + + //检查文件类型获取接口有没有获取到数据 + fileTypes = this.getFileType(); + Assertions.assertEquals(fileTypes.size(), uploadedFileTypes.size()); + for (String fileType : fileTypes) { + Assertions.assertTrue(uploadedFileTypes.contains(fileType)); + } + //没后缀的文件 (同时上传到a1-a1节点) filePath = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/noSuffixFile")).getPath(); file = new MockMultipartFile("file", "noSuffixFile", MediaType.APPLICATION_OCTET_STREAM_VALUE, FileManagementBaseUtils.getFileBytes(filePath)); @@ -400,6 +430,14 @@ public class FileManagementControllerTests extends BaseTest { returnId = JSON.parseObject(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData().toString(); checkLog(returnId, OperationLogType.ADD, FileManagementRequestUtils.URL_FILE_UPLOAD); FILE_ID_PATH.put(returnId, filePath); + uploadedFileTypes.add(StringUtils.EMPTY); + + //检查文件类型获取接口有没有获取到数据 + fileTypes = this.getFileType(); + Assertions.assertEquals(fileTypes.size(), uploadedFileTypes.size()); + for (String fileType : fileTypes) { + Assertions.assertTrue(uploadedFileTypes.contains(fileType)); + } } @Test @@ -888,18 +926,18 @@ public class FileManagementControllerTests extends BaseTest { //父节点内移动-移动到首位 a1挪到a3后面 NodeMoveRequest request = new NodeMoveRequest(); { - request.setNodeId(a1Node.getId()); - request.setPreviousNodeId(a3Node.getId()); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(a1Node.getId()); + request.setDropNodeId(a3Node.getId()); + request.setDropPosition(1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a3Node.getId(), a1Node.getId(), null, false); } //父节点内移动-移动到末位 在上面的基础上,a1挪到a2上面 { request = new NodeMoveRequest(); - request.setNodeId(a1Node.getId()); - request.setNextNodeId(a2Node.getId()); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(a1Node.getId()); + request.setDropNodeId(a2Node.getId()); + request.setDropPosition(-1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a1Node.getId(), a2Node.getId(), null, false); } @@ -907,17 +945,16 @@ public class FileManagementControllerTests extends BaseTest { //父节点内移动-移动到中位 a1移动到a2-a3中间 { request = new NodeMoveRequest(); - request.setNodeId(a1Node.getId()); - request.setPreviousNodeId(a2Node.getId()); - request.setNextNodeId(a3Node.getId()); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(a1Node.getId()); + request.setDropNodeId(a2Node.getId()); + request.setDropPosition(1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a2Node.getId(), a1Node.getId(), a3Node.getId(), false); //移动回去 request = new NodeMoveRequest(); - request.setNodeId(a1Node.getId()); - request.setNextNodeId(a2Node.getId()); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(a1Node.getId()); + request.setDropNodeId(a2Node.getId()); + request.setDropPosition(-1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a1Node.getId(), a2Node.getId(), null, false); } @@ -925,16 +962,16 @@ public class FileManagementControllerTests extends BaseTest { //跨节点移动-移动到首位 a3移动到a1-b1前面,然后移动回来; { request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setNextNodeId(a1b1Node.getId()); - request.setParentId(a1Node.getId()); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a1b1Node.getId()); + request.setDropPosition(-1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a3Node.getId(), a1b1Node.getId(), null, false); //移动回去 request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setPreviousNodeId(a2Node.getId()); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a2Node.getId()); + request.setDropPosition(1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a2Node.getId(), a3Node.getId(), null, false); } @@ -942,16 +979,16 @@ public class FileManagementControllerTests extends BaseTest { //跨节点移动-移动到末尾 a3移动到a1-a1后面,然后移动回来; { request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setPreviousNodeId(a1a1Node.getId()); - request.setParentId(a1Node.getId()); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a1a1Node.getId()); + request.setDropPosition(1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a1a1Node.getId(), a3Node.getId(), null, false); //移动回去 request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setPreviousNodeId(a2Node.getId()); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a2Node.getId()); + request.setDropPosition(1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a2Node.getId(), a3Node.getId(), null, false); } @@ -959,17 +996,16 @@ public class FileManagementControllerTests extends BaseTest { //跨节点移动-移动到中位 a3移动到a1-b1和a1-a1中间,然后移动回来; { request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setPreviousNodeId(a1b1Node.getId()); - request.setNextNodeId(a1a1Node.getId()); - request.setParentId(a1Node.getId()); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a1b1Node.getId()); + request.setDropPosition(1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a1b1Node.getId(), a3Node.getId(), a1a1Node.getId(), false); //移动回去 request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setPreviousNodeId(a2Node.getId()); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a2Node.getId()); + request.setDropPosition(1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a2Node.getId(), a3Node.getId(), null, false); } @@ -984,17 +1020,17 @@ public class FileManagementControllerTests extends BaseTest { //开始移动 request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setNextNodeId(a1Node.getId()); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a1Node.getId()); + request.setDropPosition(-1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a3Node.getId(), a1Node.getId(), null, true); //移动回去 request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setPreviousNodeId(a2Node.getId()); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a2Node.getId()); + request.setDropPosition(1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a2Node.getId(), a3Node.getId(), null, false); } @@ -1012,18 +1048,17 @@ public class FileManagementControllerTests extends BaseTest { //开始移动 request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setPreviousNodeId(a1Node.getId()); - request.setNextNodeId(a2Node.getId()); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a1Node.getId()); + request.setDropPosition(1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a1Node.getId(), a3Node.getId(), a2Node.getId(), true); //移动回去 request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setPreviousNodeId(a2Node.getId()); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a2Node.getId()); + request.setDropPosition(1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a2Node.getId(), a3Node.getId(), null, false); } @@ -1037,17 +1072,17 @@ public class FileManagementControllerTests extends BaseTest { //开始移动 request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setNextNodeId(a1b1Node.getId()); - request.setParentId(a1Node.getId()); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a1b1Node.getId()); + request.setDropPosition(-1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a3Node.getId(), a1b1Node.getId(), null, true); //移动回去 request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setPreviousNodeId(a2Node.getId()); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a2Node.getId()); + request.setDropPosition(1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a2Node.getId(), a3Node.getId(), null, false); } @@ -1064,18 +1099,17 @@ public class FileManagementControllerTests extends BaseTest { //开始移动 request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setPreviousNodeId(a1b1Node.getId()); - request.setNextNodeId(a1a1Node.getId()); - request.setParentId(a1Node.getId()); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a1a1Node.getId()); + request.setDropPosition(-1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a1b1Node.getId(), a3Node.getId(), a1a1Node.getId(), true); //移动回去 request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setPreviousNodeId(a2Node.getId()); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a2Node.getId()); + request.setDropPosition(1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a2Node.getId(), a3Node.getId(), null, false); } @@ -1083,17 +1117,18 @@ public class FileManagementControllerTests extends BaseTest { { //开始移动 request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setParentId(a2Node.getId()); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a2Node.getId()); + request.setDropPosition(0); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); FileModule a3Module = fileModuleMapper.selectByPrimaryKey(a3Node.getId()); Assertions.assertEquals(a3Module.getParentId(), a2Node.getId()); //移动回去 request = new NodeMoveRequest(); - request.setNodeId(a3Node.getId()); - request.setPreviousNodeId(a2Node.getId()); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(a3Node.getId()); + request.setDropNodeId(a2Node.getId()); + request.setDropPosition(1); this.requestPostWithOk(FileManagementRequestUtils.URL_MODULE_MOVE, request); this.checkModulePos(a2Node.getId(), a3Node.getId(), null, false); } @@ -1102,6 +1137,60 @@ public class FileManagementControllerTests extends BaseTest { checkLog(a3Node.getId(), OperationLogType.UPDATE, FileManagementRequestUtils.URL_MODULE_MOVE); } + @Test + @Order(81) + public void moveTestError() throws Exception { + this.preliminaryData(); + BaseTreeNode a1Node = FileManagementBaseUtils.getNodeByName(preliminaryTreeNodes, "a1"); + BaseTreeNode a2Node = FileManagementBaseUtils.getNodeByName(preliminaryTreeNodes, "a2"); + //drag节点为空 + NodeMoveRequest request = new NodeMoveRequest(); + request.setDragNodeId(null); + request.setDropNodeId(a1Node.getId()); + request.setDropPosition(1); + this.requestPost(FileManagementRequestUtils.URL_MODULE_MOVE, request).andExpect(status().isBadRequest()); + //drag节点不存在 + request = new NodeMoveRequest(); + request.setDragNodeId(IDGenerator.nextStr()); + request.setDropNodeId(a1Node.getId()); + request.setDropPosition(1); + this.requestPost(FileManagementRequestUtils.URL_MODULE_MOVE, request).andExpect(status().is5xxServerError()); + + //drop节点为空 + request = new NodeMoveRequest(); + request.setDragNodeId(a1Node.getId()); + request.setDropNodeId(null); + request.setDropPosition(1); + this.requestPost(FileManagementRequestUtils.URL_MODULE_MOVE, request).andExpect(status().isBadRequest()); + + //drop节点不存在 + request = new NodeMoveRequest(); + request.setDragNodeId(a1Node.getId()); + request.setDropNodeId(IDGenerator.nextStr()); + request.setDropPosition(1); + this.requestPost(FileManagementRequestUtils.URL_MODULE_MOVE, request).andExpect(status().is5xxServerError()); + + //position为0的时候节点不存在 + request = new NodeMoveRequest(); + request.setDragNodeId(a1Node.getId()); + request.setDropNodeId(IDGenerator.nextStr()); + request.setDropPosition(0); + this.requestPost(FileManagementRequestUtils.URL_MODULE_MOVE, request).andExpect(status().is5xxServerError()); + + //dragNode和dropNode一样 + request = new NodeMoveRequest(); + request.setDragNodeId(a1Node.getId()); + request.setDropNodeId(a1Node.getId()); + request.setDropPosition(1); + this.requestPost(FileManagementRequestUtils.URL_MODULE_MOVE, request).andExpect(status().is5xxServerError()); + + //position不是-1 0 1 + request = new NodeMoveRequest(); + request.setDragNodeId(a1Node.getId()); + request.setDropNodeId(a2Node.getId()); + request.setDropPosition(4); + this.requestPost(FileManagementRequestUtils.URL_MODULE_MOVE, request).andExpect(status().is5xxServerError()); + } @Test @Order(90) public void deleteModuleTestSuccess() throws Exception { @@ -1126,6 +1215,9 @@ public class FileManagementControllerTests extends BaseTest { //service层判断:测试删除空集合 fileModuleService.deleteModule(new ArrayList<>()); + + //service层判断:测试删除项目 + fileModuleService.deleteResources(project.getId()); } private void checkModuleIsEmpty(String id) { diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementPermissionControllerTests.java b/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementPermissionControllerTests.java index 26194597d8..e4a42a5ebd 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementPermissionControllerTests.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementPermissionControllerTests.java @@ -130,8 +130,10 @@ public class FileManagementPermissionControllerTests extends BaseTest { { NodeMoveRequest request = new NodeMoveRequest(); - request.setNodeId(TEST_ID); - request.setParentId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDragNodeId(TEST_ID); + request.setDropNodeId(ModuleConstants.ROOT_NODE_PARENT_ID); + request.setDropPosition(0); + this.requestPostPermissionTest(PermissionConstants.PROJECT_FILE_MANAGEMENT_READ_UPDATE, FileManagementRequestUtils.URL_MODULE_MOVE, request); } } diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/utils/FileManagementRequestUtils.java b/backend/services/project-management/src/test/java/io/metersphere/project/utils/FileManagementRequestUtils.java index 16c9cbd8b3..3e849fb57c 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/utils/FileManagementRequestUtils.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/utils/FileManagementRequestUtils.java @@ -14,6 +14,8 @@ public class FileManagementRequestUtils { //文件上传 public static final String URL_FILE_UPLOAD = "/project/file/upload"; + //获取文件类型 + public static final String URL_FILE_TYPE = "/project/file/type/%s"; //文件列表查询 public static final String URL_FILE_PAGE = "/project/file/page"; //文件列表查询对应的模块统计