From e0f9af2d9eba4cfd7a6df0a17d96ea9b0047af8e Mon Sep 17 00:00:00 2001 From: gulongcheng <474084054@qq.com> Date: Wed, 12 Nov 2025 11:01:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=AF=E5=8A=A8=E8=84=9A=E6=9C=AC+=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=80=BB=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/dataSources.xml | 17 +++ .idea/data_source_mapping.xml | 6 + .../com/sdm/common/entity/enums/NodeType.java | 43 ------- .../sdm/common/entity/enums/NodeTypeEnum.java | 5 + .../common/entity/req/system/UserListReq.java | 3 +- .../entity/req/system/UserQueryReq.java | 2 +- .../impl/data/DataClientFeignClientImpl.java | 16 +-- .../project/ISimulationNodeFeignClient.java | 2 +- .../controller/DataOverviewController.java | 12 +- .../sdm/data/dao/FileMetadataInfoMapper.java | 2 +- .../model/req/GetSimulationNodeTreeReq.java | 12 +- .../model/req/ListSimulationNodeTreeReq.java | 12 -- .../service/IDimensionTemplateService.java | 5 +- .../service/IFileMetadataInfoService.java | 2 +- .../impl/DimensionTemplateServiceImpl.java | 111 ++++++++++-------- .../impl/FileMetadataInfoServiceImpl.java | 4 +- .../impl/MinioFileIDataFileServiceImpl.java | 16 +++ data/src/main/resources/application.yml | 2 +- data/src/main/resources/bin/start.sh | 2 +- .../mapper/FileMetadataInfoMapper.xml | 14 +-- gateway2/src/main/resources/application.yml | 2 +- gateway2/src/main/resources/bin/start.sh | 2 +- .../controller/SimulationNodeController.java | 4 +- .../project/service/impl/NodeServiceImpl.java | 5 +- .../service/impl/ProjectServiceImpl.java | 11 +- project/src/main/resources/application.yml | 2 +- project/src/main/resources/bin/start.sh | 2 +- .../system/controller/SysRoleController.java | 12 +- .../system/controller/SysUserController.java | 4 +- .../system/model/req/role/QueryRoleReq.java | 3 +- .../system/model/req/user/GroupQueryReq.java | 3 +- .../model/req/user/QueryGroupDetailReq.java | 2 +- .../sdm/system/service/ISysRoleService.java | 8 +- .../sdm/system/service/ISysUserService.java | 2 +- .../impl/CID/CIDISysUserServiceImpl.java | 9 +- .../impl/CID/CIDSysRoleServiceImpl.java | 14 ++- .../service/impl/LocalSysRoleServiceImpl.java | 6 +- .../service/impl/LocalUserServiceImpl.java | 2 +- system/src/main/resources/bin/start.sh | 2 +- system/src/main/resources/logback.xml | 10 +- task/src/main/resources/bin/start.sh | 2 +- task/src/main/resources/logback.xml | 8 ++ 42 files changed, 204 insertions(+), 199 deletions(-) create mode 100644 .idea/dataSources.xml create mode 100644 .idea/data_source_mapping.xml delete mode 100644 common/src/main/java/com/sdm/common/entity/enums/NodeType.java diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 00000000..a6ced4e2 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,17 @@ + + + + + mysql.8 + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://192.168.65.161:3306/spdm_baseline?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai + + + + + + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/.idea/data_source_mapping.xml b/.idea/data_source_mapping.xml new file mode 100644 index 00000000..9025c06c --- /dev/null +++ b/.idea/data_source_mapping.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/common/src/main/java/com/sdm/common/entity/enums/NodeType.java b/common/src/main/java/com/sdm/common/entity/enums/NodeType.java deleted file mode 100644 index 227671e8..00000000 --- a/common/src/main/java/com/sdm/common/entity/enums/NodeType.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.sdm.common.entity.enums; - -import com.sdm.common.entity.data.IData; - -public enum NodeType { - PHASE( "阶段", 1, IData.DATA_TYPE.PHASE), - DISCIPLINE("学科", 2, IData.DATA_TYPE.DISCIPLINE), - SYSTEM("系统", 3, IData.DATA_TYPE.SYSTEM), - TASK_GROUP("任务组", 4, IData.DATA_TYPE.TASK_GROUP); - - private final String name; - private final int code; - private final IData.DATA_TYPE dataType; - private NodeType(String name, int code, IData.DATA_TYPE dataType) { - this.dataType = dataType; - this.name = name; - this.code = code; - } - - public String getName() { - return name; - } - - public int getCode() { - return code; - } - - public IData.DATA_TYPE getDataType() { - return dataType; - } - - public static IData.DATA_TYPE getDataTypeByCode(int code) { - IData.DATA_TYPE dataType = null; - switch (code) { - case 1 -> dataType = IData.DATA_TYPE.PHASE; - case 2 -> dataType = IData.DATA_TYPE.DISCIPLINE; - case 3 -> dataType = IData.DATA_TYPE.SYSTEM; - case 4 -> dataType = IData.DATA_TYPE.TASK_GROUP; - default -> dataType = IData.DATA_TYPE.INHERIT_TYPE; - } - return dataType; - } -} diff --git a/common/src/main/java/com/sdm/common/entity/enums/NodeTypeEnum.java b/common/src/main/java/com/sdm/common/entity/enums/NodeTypeEnum.java index 8cb07d85..dd1910d5 100644 --- a/common/src/main/java/com/sdm/common/entity/enums/NodeTypeEnum.java +++ b/common/src/main/java/com/sdm/common/entity/enums/NodeTypeEnum.java @@ -3,6 +3,11 @@ package com.sdm.common.entity.enums; public enum NodeTypeEnum { NODE("node"), + PROJECT("project"), + PHASE("phase"), + DISCIPLINE("discipline"), + MACHINE("machine"), + WORKSPACE("workspace"), TASK("task"), RUN("run"), PERFORMANCE("performance"); diff --git a/common/src/main/java/com/sdm/common/entity/req/system/UserListReq.java b/common/src/main/java/com/sdm/common/entity/req/system/UserListReq.java index b9ee1ac9..f1faa4f4 100644 --- a/common/src/main/java/com/sdm/common/entity/req/system/UserListReq.java +++ b/common/src/main/java/com/sdm/common/entity/req/system/UserListReq.java @@ -9,8 +9,7 @@ import lombok.Data; @Data public class UserListReq extends BaseReq { @Schema(description = "租户ID") - @NotNull(message = "租户ID不能为空") - private Long tenantId = 1979091834410176514L; + private Long tenantId; @Schema(description = "用户ID") private Long userId; diff --git a/common/src/main/java/com/sdm/common/entity/req/system/UserQueryReq.java b/common/src/main/java/com/sdm/common/entity/req/system/UserQueryReq.java index 73f41d6e..9e3782a0 100644 --- a/common/src/main/java/com/sdm/common/entity/req/system/UserQueryReq.java +++ b/common/src/main/java/com/sdm/common/entity/req/system/UserQueryReq.java @@ -26,5 +26,5 @@ public class UserQueryReq { @Schema(description = "用户IDS") private List userIds; - private Long tenantId = 1979091834410176514L; + private Long tenantId; } \ No newline at end of file diff --git a/common/src/main/java/com/sdm/common/feign/impl/data/DataClientFeignClientImpl.java b/common/src/main/java/com/sdm/common/feign/impl/data/DataClientFeignClientImpl.java index b6a68c97..535b2e3e 100644 --- a/common/src/main/java/com/sdm/common/feign/impl/data/DataClientFeignClientImpl.java +++ b/common/src/main/java/com/sdm/common/feign/impl/data/DataClientFeignClientImpl.java @@ -23,9 +23,7 @@ public class DataClientFeignClientImpl implements IDataFeignClient { SdmResponse > response; try { response = dataClient.listDir(dirType,parentDirId); - if (!response.isSuccess()) { - return SdmResponse.failed("创建文件夹失败"); - } + log.info("查询文件夹列表响应:"+ response); return response; } catch (Exception e) { log.error("创建文件夹失败", e); @@ -37,9 +35,7 @@ public class DataClientFeignClientImpl implements IDataFeignClient { SdmResponse response; try { response = dataClient.createDir(req); - if (!response.isSuccess()) { - return SdmResponse.failed("创建文件夹失败"); - } + log.info("创建文响应件夹:"+ response); return response; } catch (Exception e) { log.error("创建文件夹失败", e); @@ -52,9 +48,7 @@ public class DataClientFeignClientImpl implements IDataFeignClient { SdmResponse response; try { response = dataClient.renameDirNew(req); - if (!response.isSuccess()) { - return SdmResponse.failed("重命名文件夹失败"); - } + log.info("重命名文件夹响应:"+ response); return response; } catch (Exception e) { log.error("重命名文件夹失败", e); @@ -67,9 +61,7 @@ public class DataClientFeignClientImpl implements IDataFeignClient { SdmResponse response; try { response = dataClient.delDir(req); - if (!response.isSuccess()) { - return SdmResponse.failed("删除文件夹失败"); - } + log.info("删除文件夹响应:"+ response); return response; } catch (Exception e) { log.error("删除文件夹失败", e); diff --git a/common/src/main/java/com/sdm/common/feign/inter/project/ISimulationNodeFeignClient.java b/common/src/main/java/com/sdm/common/feign/inter/project/ISimulationNodeFeignClient.java index 02fc702b..e75f639f 100644 --- a/common/src/main/java/com/sdm/common/feign/inter/project/ISimulationNodeFeignClient.java +++ b/common/src/main/java/com/sdm/common/feign/inter/project/ISimulationNodeFeignClient.java @@ -36,7 +36,7 @@ public interface ISimulationNodeFeignClient { SdmResponse delteNode(@RequestBody DelNodeReq req); // 项目列表 - @GetMapping("/list") + @GetMapping("/node/list") SdmResponse list(@RequestBody SpdmNodeListReq req); diff --git a/data/src/main/java/com/sdm/data/controller/DataOverviewController.java b/data/src/main/java/com/sdm/data/controller/DataOverviewController.java index 4908f2c3..c994250a 100644 --- a/data/src/main/java/com/sdm/data/controller/DataOverviewController.java +++ b/data/src/main/java/com/sdm/data/controller/DataOverviewController.java @@ -3,17 +3,21 @@ package com.sdm.data.controller; import com.sdm.common.common.SdmResponse; import com.sdm.common.entity.req.data.CreateDirReq; +import com.sdm.data.model.entity.FileMetadataInfo; import com.sdm.data.model.req.*; import com.sdm.data.service.IDimensionTemplateService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * 数据总览 * @@ -35,7 +39,7 @@ public class DataOverviewController { */ @PostMapping("/getSimulationNodeTree") @Operation(summary = "根据数据显示维度展示左侧节点树") - public SdmResponse getSimulationNodeTree(@RequestBody GetSimulationNodeTreeReq req) { + public SdmResponse> getSimulationNodeTree(@RequestBody GetSimulationNodeTreeReq req) { return dimensionTemplateService.getSimulationNodeTree(req); } @@ -43,7 +47,7 @@ public class DataOverviewController { * 根据数据显示维度查询当前节点下的文件夹和文件 */ @PostMapping("/listSimulationNodeFiles") - @Operation(summary = "dimensionTemplateId+chooseUuid+chooseNodeType根据数据显示维度查询当前节点下的文件夹和文件,dimensionTemplateId+fileId支持进入普通文件夹和节点文件夹查询下一层,支持分页查询") + @Operation(summary = "dimensionTemplateId+fileId支持进入文件夹和节点文件夹查询下一层,支持分页查询") public SdmResponse listSimulationNodeFiles(@RequestBody ListSimulationNodeTreeReq req) { return dimensionTemplateService.listSimulationNodeFiles(req); } @@ -60,9 +64,9 @@ public class DataOverviewController { /** * 数据总览上传文件到节点文件夹 */ - @PostMapping("/uploadSimulationNodeFiles") + @PostMapping(value = "/uploadSimulationNodeFiles",consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @Operation(summary = "数据总览上传文件到节点文件夹") - public SdmResponse uploadSimulationNodeFiles(@RequestBody UploadFilesReq req) { + public SdmResponse uploadSimulationNodeFiles(UploadFilesReq req) { return dimensionTemplateService.uploadSimulationNodeFiles(req); } diff --git a/data/src/main/java/com/sdm/data/dao/FileMetadataInfoMapper.java b/data/src/main/java/com/sdm/data/dao/FileMetadataInfoMapper.java index 327d20a7..b41487de 100644 --- a/data/src/main/java/com/sdm/data/dao/FileMetadataInfoMapper.java +++ b/data/src/main/java/com/sdm/data/dao/FileMetadataInfoMapper.java @@ -15,6 +15,6 @@ import java.util.List; * @since 2025-09-05 */ public interface FileMetadataInfoMapper extends BaseMapper { - List listSimulationNodeFiles(@Param("parentId") Long parentId,@Param("uuids") List uuids); + List listSimulationNodeFiles(@Param("parentId") Long parentId,@Param("fileIds") List fileIds); } diff --git a/data/src/main/java/com/sdm/data/model/req/GetSimulationNodeTreeReq.java b/data/src/main/java/com/sdm/data/model/req/GetSimulationNodeTreeReq.java index 694998d2..840cd791 100644 --- a/data/src/main/java/com/sdm/data/model/req/GetSimulationNodeTreeReq.java +++ b/data/src/main/java/com/sdm/data/model/req/GetSimulationNodeTreeReq.java @@ -14,15 +14,7 @@ public class GetSimulationNodeTreeReq { private Long dimensionTemplateId; /** - * 选择的节点ID + * 文件ID */ - @Schema(description = "选择的节点ID,选中节点时,才同时传chooseNodeId和chooseNodeType") - private String chooseUuid; - - /** - * 选择的节点类型 - */ - @Schema(description = "选择的节点类型,选中节点时,才同时传chooseNodeId和chooseNodeType") - private String chooseNodeType; - + private Long fileId; } diff --git a/data/src/main/java/com/sdm/data/model/req/ListSimulationNodeTreeReq.java b/data/src/main/java/com/sdm/data/model/req/ListSimulationNodeTreeReq.java index ee7b2edb..a0d1a67d 100644 --- a/data/src/main/java/com/sdm/data/model/req/ListSimulationNodeTreeReq.java +++ b/data/src/main/java/com/sdm/data/model/req/ListSimulationNodeTreeReq.java @@ -13,18 +13,6 @@ public class ListSimulationNodeTreeReq extends BaseReq { @NotEmpty(message = "数据展示维度模版ID不能为空") private Long dimensionTemplateId; - /** - * 选择的节点ID - */ - @Schema(description = "选择的节点ID,选中节点时,才同时传chooseNodeId和chooseNodeType") - private String chooseUuid; - - /** - * 选择的节点类型 - */ - @Schema(description = "选择的节点类型,选中节点时,才同时传chooseNodeId和chooseNodeType") - private String chooseNodeType; - /** * 文件夹ID */ diff --git a/data/src/main/java/com/sdm/data/service/IDimensionTemplateService.java b/data/src/main/java/com/sdm/data/service/IDimensionTemplateService.java index 1d4b3ed3..a424edde 100644 --- a/data/src/main/java/com/sdm/data/service/IDimensionTemplateService.java +++ b/data/src/main/java/com/sdm/data/service/IDimensionTemplateService.java @@ -4,9 +4,12 @@ import com.sdm.common.common.SdmResponse; import com.sdm.common.entity.req.data.CreateDirReq; import com.sdm.data.model.entity.DimensionTemplate; import com.baomidou.mybatisplus.extension.service.IService; +import com.sdm.data.model.entity.FileMetadataInfo; import com.sdm.data.model.req.*; import com.sdm.data.model.req.dimensionTemplate.TemplateCreationRequest; +import java.util.List; + /** *

* 维度模板主表 服务类 @@ -26,7 +29,7 @@ public interface IDimensionTemplateService extends IService { SdmResponse deleteTemplateWithHierarchies(Long id); - SdmResponse getSimulationNodeTree(GetSimulationNodeTreeReq req); + SdmResponse> getSimulationNodeTree(GetSimulationNodeTreeReq req); /** * 根据数据显示维度展示左侧节点树 diff --git a/data/src/main/java/com/sdm/data/service/IFileMetadataInfoService.java b/data/src/main/java/com/sdm/data/service/IFileMetadataInfoService.java index d242eaed..bac07dbd 100644 --- a/data/src/main/java/com/sdm/data/service/IFileMetadataInfoService.java +++ b/data/src/main/java/com/sdm/data/service/IFileMetadataInfoService.java @@ -16,5 +16,5 @@ import java.util.List; * @since 2025-09-05 */ public interface IFileMetadataInfoService extends IService { - List listSimulationNodeFiles(Long parentId,List uuids); + List listSimulationNodeFiles(Long parentId,List fileIds); } diff --git a/data/src/main/java/com/sdm/data/service/impl/DimensionTemplateServiceImpl.java b/data/src/main/java/com/sdm/data/service/impl/DimensionTemplateServiceImpl.java index e38eee7c..8d3bd67a 100644 --- a/data/src/main/java/com/sdm/data/service/impl/DimensionTemplateServiceImpl.java +++ b/data/src/main/java/com/sdm/data/service/impl/DimensionTemplateServiceImpl.java @@ -5,15 +5,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.sdm.common.common.SdmResponse; -import com.sdm.common.entity.constants.NumberConstants; import com.sdm.common.entity.enums.DataTypeEnum; import com.sdm.common.entity.enums.DirTypeEnum; -import com.sdm.common.entity.enums.FileIsLastEnum; import com.sdm.common.entity.req.data.CreateDirReq; import com.sdm.common.entity.req.data.DelDirReq; import com.sdm.common.entity.req.project.DelNodeReq; import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp; -import com.sdm.common.entity.resp.PageDataResp; import com.sdm.common.feign.impl.project.SimulationNodeFeignClientImpl; import com.sdm.common.utils.PageUtils; import com.sdm.data.model.entity.DimensionTemplate; @@ -161,16 +158,16 @@ public class DimensionTemplateServiceImpl extends ServiceImpl> getSimulationNodeTree(GetSimulationNodeTreeReq req) { // 根据展示维度获取展示节点类型顺序 Long dimensionTemplateId = req.getDimensionTemplateId(); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(DimensionTemplateHierarchy::getTemplateId, dimensionTemplateId).orderByAsc(DimensionTemplateHierarchy::getSortOrder); List dimensionNodeTyepOrderList = dimensionTemplateHierarchyService.list(queryWrapper).stream().map(DimensionTemplateHierarchy::getDisplayName).toList(); - String chooseUuid = req.getChooseUuid(); - String chooseNodeType = req.getChooseNodeType(); - if (ObjectUtils.isEmpty(chooseUuid)) { + List uuids = null; + List resultDir = new ArrayList<>(); + if (ObjectUtils.isEmpty(req.getFileId())) { // 选中维度了,没有选节点,按照模版,展示模版的第一层节点数据 String rootNodeType = dimensionNodeTyepOrderList.get(0); SdmResponse> allNodeByNodeTypeResponse = simuluationNodeFeignClient.getAllNodeByNodeType(null, rootNodeType); @@ -179,28 +176,57 @@ public class DimensionTemplateServiceImpl extends ServiceImpl dirInfos = fileMetadataInfoService + .lambdaQuery() + .eq(FileMetadataInfo::getParentId, fileId) + .eq(FileMetadataInfo::getDataType, DataTypeEnum.DIRECTORY.getValue()) + .isNull(FileMetadataInfo::getRelatedResourceUuid) + .list(); + + resultDir.addAll(dirInfos); + + // 再获取节点文件夹 + FileMetadataInfo nodeDirInfo = fileMetadataInfoService.getById(fileId); + String chooseUuid = nodeDirInfo.getRelatedResourceUuid(); + String chooseNodeType = nodeDirInfo.getRelatedResourceUuidOwnType(); + + // chooseUuid和chooseNodeType不为空才是节点文件夹,才需要查询子节点文件夹文件 + if (ObjectUtils.isNotEmpty(chooseUuid) && ObjectUtils.isNotEmpty(chooseNodeType)) { + // 从dimensionNodeTyepOrderList中获取chooseNodeType下一个位置的数据,有可能chooseNodeType所在位置就是最后一层节点,SdmResponse返回空数据 + int index = dimensionNodeTyepOrderList.indexOf(chooseNodeType); + if (index == -1) { + return SdmResponse.failed("选中节点类型不在数据展示维度中"); + } + + if (index == dimensionNodeTyepOrderList.size() - 1) { + //尾节点,直接返回空数据 + return SdmResponse.success(); + } - // 获取dimensionNodeTyepOrderList的index+1位置的节点类型 - String nextNodeType = dimensionNodeTyepOrderList.get(index + 1); - SdmResponse> allNodeByProjectIdAndType = simuluationNodeFeignClient.getAllNodeByProjectIdAndType(chooseUuid, nextNodeType); - if (!allNodeByProjectIdAndType.isSuccess()) { - return SdmResponse.success(); + // 获取dimensionNodeTyepOrderList的index+1位置的节点类型 + String nextNodeType = dimensionNodeTyepOrderList.get(index + 1); + SdmResponse> allNodeByProjectIdAndType = simuluationNodeFeignClient.getAllNodeByProjectIdAndType(chooseUuid, nextNodeType); + if (!allNodeByProjectIdAndType.isSuccess()) { + return SdmResponse.success(); + } + uuids = allNodeByProjectIdAndType.getData().stream().map(AllNodeByProjectIdAndTypeResp::getUuid).toList(); } - return allNodeByProjectIdAndType; } + + if (ObjectUtils.isEmpty(uuids)) { + return SdmResponse.success(resultDir); + } + + List nodeDirInfos = fileMetadataInfoService.lambdaQuery().in(FileMetadataInfo::getRelatedResourceUuid, uuids).list(); + resultDir.addAll(nodeDirInfos); + return SdmResponse.success(resultDir); } @Override @@ -208,48 +234,31 @@ public class DimensionTemplateServiceImpl extends ServiceImpl uuids = null; - String relatedResourceUuid = null; - String relatedResourceUuidOwnType = null; + Long parentDirId; + List dirInfos = null; if (ObjectUtils.isNotEmpty(req.getFileId())) { //fileId 不为空,是右侧点击进入文件夹下一层级查询 - parentId = req.getFileId(); - Optional parentDirInfo = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getId, parentId).oneOpt(); + parentDirId = req.getFileId(); + Optional parentDirInfo = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getId, parentDirId).oneOpt(); if (!parentDirInfo.isPresent()) { return SdmResponse.failed("父文件夹不存在"); } - relatedResourceUuid = parentDirInfo.get().getRelatedResourceUuid(); - relatedResourceUuidOwnType = parentDirInfo.get().getRelatedResourceUuidOwnType(); - - } else if (ObjectUtils.isNotEmpty(req.getChooseUuid()) && ObjectUtils.isNotEmpty(req.getChooseNodeType())) { - // chooseUuid 和 chooseNodeType不为空,是左侧点击树节点后,查询当前节点文件下的文件信息 - relatedResourceUuid = req.getChooseUuid(); - relatedResourceUuidOwnType = req.getChooseNodeType(); - Optional parentDirInfo = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getRelatedResourceUuid, relatedResourceUuid).oneOpt(); - if (!parentDirInfo.isPresent()) { - return SdmResponse.failed("父文件夹不存在"); - } - parentId = parentDirInfo.get().getId(); } else { return SdmResponse.success(); } // relatedResourceUuid和relatedResourceUuidOwnType不为空才是节点文件夹,才需要查询子节点文件夹文件 - if (ObjectUtils.isNotEmpty(relatedResourceUuid) && ObjectUtils.isNotEmpty(relatedResourceUuidOwnType)) { - GetSimulationNodeTreeReq getSimulationNodeTreeReq = new GetSimulationNodeTreeReq(); - getSimulationNodeTreeReq.setDimensionTemplateId(req.getDimensionTemplateId()); - getSimulationNodeTreeReq.setChooseUuid(relatedResourceUuid); - getSimulationNodeTreeReq.setChooseNodeType(relatedResourceUuidOwnType); - SdmResponse> allNodeByProjectIdAndType = getSimulationNodeTree(getSimulationNodeTreeReq); - if (allNodeByProjectIdAndType.isSuccess() && ObjectUtils.isNotEmpty(allNodeByProjectIdAndType.getData())) { - uuids = allNodeByProjectIdAndType.getData().stream().map(AllNodeByProjectIdAndTypeResp::getUuid).toList(); - } + GetSimulationNodeTreeReq getSimulationNodeTreeReq = new GetSimulationNodeTreeReq(); + getSimulationNodeTreeReq.setDimensionTemplateId(req.getDimensionTemplateId()); + getSimulationNodeTreeReq.setFileId(parentDirId); + SdmResponse> nodeDirInfos = getSimulationNodeTree(getSimulationNodeTreeReq); + if (nodeDirInfos.isSuccess() && ObjectUtils.isNotEmpty(nodeDirInfos.getData())) { + dirInfos = nodeDirInfos.getData().stream().map(FileMetadataInfo::getId).toList(); } PageHelper.startPage(req.getCurrent(), req.getSize()); - List fileMetadataInfos = fileMetadataInfoService.listSimulationNodeFiles(parentId, uuids); + List fileMetadataInfos = fileMetadataInfoService.listSimulationNodeFiles(parentDirId, dirInfos); PageInfo page = new PageInfo<>(fileMetadataInfos); return PageUtils.getJsonObjectSdmResponse(fileMetadataInfos, page); diff --git a/data/src/main/java/com/sdm/data/service/impl/FileMetadataInfoServiceImpl.java b/data/src/main/java/com/sdm/data/service/impl/FileMetadataInfoServiceImpl.java index a751474b..f2b6a8d1 100644 --- a/data/src/main/java/com/sdm/data/service/impl/FileMetadataInfoServiceImpl.java +++ b/data/src/main/java/com/sdm/data/service/impl/FileMetadataInfoServiceImpl.java @@ -22,7 +22,7 @@ import java.util.List; @Service public class FileMetadataInfoServiceImpl extends ServiceImpl implements IFileMetadataInfoService { @Override - public List listSimulationNodeFiles(Long parentId, List uuids) { - return this.baseMapper.listSimulationNodeFiles(parentId,uuids); + public List listSimulationNodeFiles(Long parentId, List fileIds) { + return this.baseMapper.listSimulationNodeFiles(parentId,fileIds); } } diff --git a/data/src/main/java/com/sdm/data/service/impl/MinioFileIDataFileServiceImpl.java b/data/src/main/java/com/sdm/data/service/impl/MinioFileIDataFileServiceImpl.java index 15583e82..65cb644d 100644 --- a/data/src/main/java/com/sdm/data/service/impl/MinioFileIDataFileServiceImpl.java +++ b/data/src/main/java/com/sdm/data/service/impl/MinioFileIDataFileServiceImpl.java @@ -121,14 +121,17 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService { @Transactional(rollbackFor = Exception.class) public SdmResponse createDir(CreateDirReq req) { if (req == null || !StringUtils.hasText(req.getDirName())) { + log.error("创建目录失败, 目录名称为空"); return SdmResponse.failed("目录名称不能为空"); } try { // 处理根目录创建逻辑(知识库根目录创建逻辑和项目节点目录创建) if (ObjectUtils.isEmpty(req.getParDirId()) && ObjectUtils.isEmpty(req.getParentUuId())) { + log.info("创建根目录"); return createRootDir(req); } else { // 处理子目录创建逻辑 + log.info("创建子目录"); return createChildDir(req); } } catch (Exception e) { @@ -243,11 +246,13 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService { public SdmResponse createRootDir(CreateDirReq req) { if(ObjectUtils.isEmpty(req.getDirType())){ + log.error("请选择目录类型:1 知识库文件夹,2 项目节点文件夹,3 头像库文件夹,4 仿真参数库文件夹,5 训练模型文件夹"); return SdmResponse.failed("请选择目录类型:1 知识库文件夹,2 项目节点文件夹,3 头像库文件夹,4 仿真参数库文件夹,5 训练模型文件夹"); } DirTypeEnum dirTypeByValue = DirTypeEnum.getDirTypeByValue(req.getDirType()); if (dirTypeByValue == null) { + log.error("请选择正确的目录类型:1 知识库文件夹,2 项目节点文件夹,3 头像库文件夹,4 仿真参数库文件夹,5 训练模型文件夹"); return SdmResponse.failed("请选择正确的目录类型:1 知识库文件夹,2 项目节点文件夹,3 头像库文件夹,4 仿真参数库文件夹,5 训练模型文件夹"); } @@ -256,6 +261,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService { Optional fileMetadataInfoByObjectKey = getFileMetadataInfoByObjectKey(rootDirMinioObjectKey); // 检查目录是否已存在 if (!fileMetadataInfoByObjectKey.isPresent()) { + log.error("知识库、项目根目录不存在,等待initSystemDirectory 初始化完成"); return SdmResponse.failed("知识库、项目根目录不存在,等待initSystemDirectory 初始化完成"); } @@ -271,6 +277,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService { try { // 检查目录是否已存在 if (getFileMetadataInfoByObjectKey(dirMinioObjectKey).isPresent()) { + log.error("目录已存在"); return SdmResponse.failed("目录已存在"); } @@ -284,6 +291,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService { // 创建默认权限记录 createDirectoryPermission(dirInfo.getId()); + log.error("根目录创建成功"); return SdmResponse.success("根目录创建成功"); } catch (Exception dbException) { log.error("创建根目录失败", dbException); @@ -307,6 +315,10 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService { Long parDirId = null; if (req.getParentUuId() != null) { FileMetadataInfo node = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getRelatedResourceUuid, req.getParentUuId()).one(); + if (ObjectUtils.isEmpty(node)) { + log.error("上级节点目录不存在"); + return SdmResponse.failed("上级节点目录不存在"); + } parDirId = node.getId(); } else { parDirId = req.getParDirId(); @@ -314,6 +326,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService { FileMetadataInfo parDirInfo = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getId, parDirId).one(); if (ObjectUtils.isEmpty(parDirInfo)) { + log.error("上级目录不存在"); return SdmResponse.failed("上级目录不存在"); } @@ -322,11 +335,13 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService { // 检查子目录是否已存在 if (getFileMetadataInfoByObjectKey(childDirMinioObjectKey).isPresent()) { + log.error("目录已存在"); return SdmResponse.failed("目录已存在"); } boolean hasWritePermission = fileUserPermissionService.hasFilePermission(parDirId, ThreadLocalContext.getUserId(), FilePermissionEnum.WRITE); if (!hasWritePermission) { + log.error("没有写入权限"); return SdmResponse.failed("没有写入权限"); } @@ -341,6 +356,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService { // 创建默认权限记录 createDirectoryPermission(dirInfo.getId()); + log.info("子目录创建成功"); return SdmResponse.success("子目录创建成功"); } catch (Exception dbException) { diff --git a/data/src/main/resources/application.yml b/data/src/main/resources/application.yml index caf4dfcd..ef46c2ad 100644 --- a/data/src/main/resources/application.yml +++ b/data/src/main/resources/application.yml @@ -1,3 +1,3 @@ spring: profiles: - active: dev \ No newline at end of file + active: local \ No newline at end of file diff --git a/data/src/main/resources/bin/start.sh b/data/src/main/resources/bin/start.sh index 1ac22eb9..c0777950 100644 --- a/data/src/main/resources/bin/start.sh +++ b/data/src/main/resources/bin/start.sh @@ -42,4 +42,4 @@ fi # 启动项目 echo "正在启动项目..." -nohup java ${JVM_OPTS} -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & \ No newline at end of file +nohup java ${JVM_OPTS} -Dspring.profiles.active=dev -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 & \ No newline at end of file diff --git a/data/src/main/resources/mapper/FileMetadataInfoMapper.xml b/data/src/main/resources/mapper/FileMetadataInfoMapper.xml index 298b8f84..639d898e 100644 --- a/data/src/main/resources/mapper/FileMetadataInfoMapper.xml +++ b/data/src/main/resources/mapper/FileMetadataInfoMapper.xml @@ -2,22 +2,22 @@