数据总览
This commit is contained in:
@@ -27,6 +27,7 @@ public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient
|
||||
public SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getAllNodeByNodeType(Long nodeId, String nodeType) {
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> response;
|
||||
try {
|
||||
log.info("根据节点类型和节点ID获取所有节点信息请求参数:nodeId={}, nodeType={}", nodeId, nodeType);
|
||||
response = ISimulationNodeFeignClient.getAllNodeByNodeType(nodeId, nodeType);
|
||||
if (!response.isSuccess() || response.getData() == null || response.getData().isEmpty()) {
|
||||
return SdmResponse.failed("获取节点信息失败");
|
||||
@@ -48,6 +49,7 @@ public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient
|
||||
public SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getAllNodeByProjectIdAndType(String uuid, String nextNodeType) {
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> response;
|
||||
try {
|
||||
log.info("根据项目ID和节点类型获取所有节点信息请求参数:uuid={}, nextNodeType={}", uuid, nextNodeType);
|
||||
response = ISimulationNodeFeignClient.getAllNodeByProjectIdAndType(uuid, nextNodeType);
|
||||
if (!response.isSuccess() || response.getData() == null || response.getData().isEmpty()) {
|
||||
return SdmResponse.failed("获取节点信息失败");
|
||||
@@ -60,13 +62,19 @@ public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse renameNode(RenameNodeReq req) {
|
||||
return ISimulationNodeFeignClient.renameNode(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse delteNode(DelNodeReq req) {
|
||||
return ISimulationNodeFeignClient.delteNode(req);
|
||||
SdmResponse response;
|
||||
try {
|
||||
log.info("删除节点请求参数:{}", req);
|
||||
response = ISimulationNodeFeignClient.delteNode(req);
|
||||
if (!response.isSuccess()) {
|
||||
return SdmResponse.failed("删除节点失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("删除节点失败", e);
|
||||
return SdmResponse.failed("删除节点失败");
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,9 +33,6 @@ public interface ISimulationNodeFeignClient {
|
||||
@GetMapping("/node/getAllNodeByProjectIdAndType")
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getAllNodeByProjectIdAndType(@RequestParam(value = "chooseNodeId") String uuid, @RequestParam(value = "nextNodeType") String nextNodeType);
|
||||
|
||||
@PostMapping("/node/renameNode")
|
||||
SdmResponse renameNode(@RequestBody RenameNodeReq req);
|
||||
|
||||
@PostMapping("/node/delteNode")
|
||||
public SdmResponse delteNode(@RequestBody DelNodeReq req);
|
||||
@PostMapping("node/delteNode")
|
||||
SdmResponse delteNode(@RequestBody DelNodeReq req);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ package com.sdm.data.controller;
|
||||
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.data.model.req.GetSimulationNodeTreeReq;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
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;
|
||||
@@ -37,4 +38,50 @@ public class DataOverviewController {
|
||||
public SdmResponse getSimulationNodeTree(@RequestBody GetSimulationNodeTreeReq req) {
|
||||
return dimensionTemplateService.getSimulationNodeTree(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据数据显示维度查询当前节点下的文件夹和文件
|
||||
*/
|
||||
@PostMapping("/listSimulationNodeFiles")
|
||||
@Operation(summary = "dimensionTemplateId+chooseUuid+chooseNodeType根据数据显示维度查询当前节点下的文件夹和文件,dimensionTemplateId+fileId支持进入普通文件夹和节点文件夹查询下一层,支持分页查询")
|
||||
public SdmResponse listSimulationNodeFiles(@RequestBody ListSimulationNodeTreeReq req) {
|
||||
return dimensionTemplateService.listSimulationNodeFiles(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据总览创建文件夹
|
||||
*/
|
||||
@PostMapping("/createSimulationNodeDir")
|
||||
@Operation(summary = "数据总览创建文件夹")
|
||||
public SdmResponse createSimulationNodeDir(@RequestBody CreateDirReq req) {
|
||||
return dimensionTemplateService.createSimulationNodeDir(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据总览上传文件到节点文件夹
|
||||
*/
|
||||
@PostMapping("/uploadSimulationNodeFiles")
|
||||
@Operation(summary = "数据总览上传文件到节点文件夹")
|
||||
public SdmResponse uploadSimulationNodeFiles(@RequestBody UploadFilesReq req) {
|
||||
return dimensionTemplateService.uploadSimulationNodeFiles(req);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除项目节点下的普通文件夹、文件、或者节点文件夹
|
||||
*/
|
||||
@PostMapping("/deleteSimulationNodeFiles")
|
||||
@Operation(summary = "删除项目节点下的普通文件夹、文件、或者节点文件夹")
|
||||
public SdmResponse deleteSimulationNodeFiles(@RequestBody DeleteSimulationNodeFilesReq req) {
|
||||
return dimensionTemplateService.deleteSimulationNodeFiles(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索项目节点下的文件
|
||||
*/
|
||||
@PostMapping("/searchSimulationNodeFiles")
|
||||
@Operation(summary = "搜索项目节点下的文件")
|
||||
public SdmResponse searchSimulationNodeFiles(@RequestBody FileSearchReq req) {
|
||||
return dimensionTemplateService.searchSimulationNodeFiles(req);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.sdm.data.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sdm.data.model.entity.FileMetadataInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -12,4 +15,6 @@ import com.sdm.data.model.entity.FileMetadataInfo;
|
||||
* @since 2025-09-05
|
||||
*/
|
||||
public interface FileMetadataInfoMapper extends BaseMapper<FileMetadataInfo> {
|
||||
List<FileMetadataInfo> listSimulationNodeFiles(@Param("parentId") Long parentId,@Param("uuids") List<String> uuids);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.sdm.data.model.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DeleteSimulationNodeFilesReq {
|
||||
@Schema(description = "要删除的ID")
|
||||
private Long deleteId;
|
||||
|
||||
@Schema(description = "数据类型,1:文件夹,2:文件")
|
||||
@NotNull(message = "文件夹类型不能为空:1:文件夹,2:文件")
|
||||
private int dataType;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sdm.data.model.req;
|
||||
|
||||
import com.sdm.common.entity.enums.FileBizTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -65,8 +66,8 @@ public class FileSearchReq extends BaseReq {
|
||||
@Schema(description = "文件创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "文件业务类型(1:模型文件 2:仿真报告、3:计算文件、4:曲线文件、5:云图文件,6:网格文件,7:计算过程文件)")
|
||||
private String fileBizType;
|
||||
@Schema(description = "文件业务类型(1:模型文件 2:仿真报告、3:计算文件、4:曲线文件、5:云图文件,6:网格文件,7:计算过程文件)",implementation = FileBizTypeEnum.class)
|
||||
private Integer fileBizType;
|
||||
|
||||
/**
|
||||
* 是否过滤空数据
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.sdm.data.model.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
@Data
|
||||
public class ListSimulationNodeTreeReq extends BaseReq {
|
||||
/**
|
||||
* 数据展示维度模版ID
|
||||
*/
|
||||
@Schema(description = "数据展示维度模版ID")
|
||||
@NotEmpty(message = "数据展示维度模版ID不能为空")
|
||||
private Long dimensionTemplateId;
|
||||
|
||||
/**
|
||||
* 选择的节点ID
|
||||
*/
|
||||
@Schema(description = "选择的节点ID,选中节点时,才同时传chooseNodeId和chooseNodeType")
|
||||
private String chooseUuid;
|
||||
|
||||
/**
|
||||
* 选择的节点类型
|
||||
*/
|
||||
@Schema(description = "选择的节点类型,选中节点时,才同时传chooseNodeId和chooseNodeType")
|
||||
private String chooseNodeType;
|
||||
|
||||
/**
|
||||
* 文件夹ID
|
||||
*/
|
||||
@Schema(description = "文件夹ID")
|
||||
Long fileId;
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.sdm.data.service;
|
||||
|
||||
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.req.GetSimulationNodeTreeReq;
|
||||
import com.sdm.data.model.req.*;
|
||||
import com.sdm.data.model.req.dimensionTemplate.TemplateCreationRequest;
|
||||
|
||||
/**
|
||||
@@ -27,4 +28,23 @@ public interface IDimensionTemplateService extends IService<DimensionTemplate> {
|
||||
|
||||
SdmResponse getSimulationNodeTree(GetSimulationNodeTreeReq req);
|
||||
|
||||
/**
|
||||
* 根据数据显示维度展示左侧节点树
|
||||
* dimensionTemplateId+chooseUuid+chooseNodeType根据数据显示维度查询当前节点下的文件夹和文件,
|
||||
* dimensionTemplateId+fileId支持进入普通文件夹和节点文件夹查询下一层,
|
||||
* 支持分页查询
|
||||
*
|
||||
* @param req 获取模拟节点树的请求参数
|
||||
* @return SdmResponse 响应对象,包含模拟节点树数据或错误信息
|
||||
*/
|
||||
SdmResponse listSimulationNodeFiles(ListSimulationNodeTreeReq req);
|
||||
|
||||
SdmResponse createSimulationNodeDir(CreateDirReq req);
|
||||
|
||||
SdmResponse uploadSimulationNodeFiles(UploadFilesReq req);
|
||||
|
||||
SdmResponse deleteSimulationNodeFiles(DeleteSimulationNodeFilesReq req);
|
||||
|
||||
SdmResponse searchSimulationNodeFiles(FileSearchReq req);
|
||||
|
||||
}
|
||||
|
||||
@@ -16,4 +16,5 @@ import java.util.List;
|
||||
* @since 2025-09-05
|
||||
*/
|
||||
public interface IFileMetadataInfoService extends IService<FileMetadataInfo> {
|
||||
List<FileMetadataInfo> listSimulationNodeFiles(Long parentId,List<String> uuids);
|
||||
}
|
||||
|
||||
@@ -2,27 +2,44 @@ package com.sdm.data.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
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;
|
||||
import com.sdm.data.dao.DimensionTemplateMapper;
|
||||
import com.sdm.data.model.entity.DimensionTemplateHierarchy;
|
||||
import com.sdm.data.model.req.GetSimulationNodeTreeReq;
|
||||
import com.sdm.data.model.entity.FileMetadataInfo;
|
||||
import com.sdm.data.model.req.*;
|
||||
import com.sdm.data.model.req.dimensionTemplate.DimensionTemplateHierarchyReq;
|
||||
import com.sdm.data.model.req.dimensionTemplate.TemplateCreationRequest;
|
||||
import com.sdm.data.service.IDataFileService;
|
||||
import com.sdm.data.service.IDimensionTemplateHierarchyService;
|
||||
import com.sdm.data.service.IDimensionTemplateService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sdm.data.service.IFileMetadataInfoService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -40,10 +57,17 @@ public class DimensionTemplateServiceImpl extends ServiceImpl<DimensionTemplateM
|
||||
@Autowired
|
||||
SimulationNodeFeignClientImpl simuluationNodeFeignClient;
|
||||
|
||||
@Resource
|
||||
@Qualifier("dataFileService")
|
||||
private IDataFileService dataFileService;
|
||||
|
||||
@Autowired
|
||||
IFileMetadataInfoService fileMetadataInfoService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SdmResponse saveDimensionTemplateWithHierarchies(TemplateCreationRequest request) {
|
||||
if(lambdaQuery().eq(DimensionTemplate::getTemplateName, request.getTemplate().getTemplateName()).exists()){
|
||||
if (lambdaQuery().eq(DimensionTemplate::getTemplateName, request.getTemplate().getTemplateName()).exists()) {
|
||||
return SdmResponse.failed("模版已存在");
|
||||
}
|
||||
// 保存模板信息
|
||||
@@ -80,7 +104,8 @@ public class DimensionTemplateServiceImpl extends ServiceImpl<DimensionTemplateM
|
||||
|
||||
/**
|
||||
* 为模板保存层级信息
|
||||
* @param templateId 模板ID
|
||||
*
|
||||
* @param templateId 模板ID
|
||||
* @param hierarchyReqs 层级请求列表
|
||||
*/
|
||||
private void saveHierarchiesForTemplate(Long templateId, List<DimensionTemplateHierarchyReq> hierarchyReqs) {
|
||||
@@ -145,24 +170,24 @@ public class DimensionTemplateServiceImpl extends ServiceImpl<DimensionTemplateM
|
||||
|
||||
String chooseUuid = req.getChooseUuid();
|
||||
String chooseNodeType = req.getChooseNodeType();
|
||||
if(ObjectUtils.isEmpty(chooseUuid)){
|
||||
if (ObjectUtils.isEmpty(chooseUuid)) {
|
||||
// 选中维度了,没有选节点,按照模版,展示模版的第一层节点数据
|
||||
String rootNodeType = dimensionNodeTyepOrderList.get(0);
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> allNodeByNodeTypeResponse = simuluationNodeFeignClient.getAllNodeByNodeType(null,rootNodeType);
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> allNodeByNodeTypeResponse = simuluationNodeFeignClient.getAllNodeByNodeType(null, rootNodeType);
|
||||
|
||||
if(!allNodeByNodeTypeResponse.isSuccess()){
|
||||
if (!allNodeByNodeTypeResponse.isSuccess()) {
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
return allNodeByNodeTypeResponse;
|
||||
}else {
|
||||
} else {
|
||||
// 从dimensionNodeTyepOrderList中获取chooseNodeType下一个位置的数据,有可能chooseNodeType所在位置就是最后一层节点,SdmResponse返回空数据
|
||||
int index = dimensionNodeTyepOrderList.indexOf(chooseNodeType);
|
||||
if (index == -1){
|
||||
if (index == -1) {
|
||||
return SdmResponse.failed("选中节点类型不在数据展示维度中");
|
||||
}
|
||||
|
||||
if(index == dimensionNodeTyepOrderList.size() - 1) {
|
||||
if (index == dimensionNodeTyepOrderList.size() - 1) {
|
||||
//尾节点,直接返回空数据
|
||||
return SdmResponse.success();
|
||||
}
|
||||
@@ -171,10 +196,109 @@ public class DimensionTemplateServiceImpl extends ServiceImpl<DimensionTemplateM
|
||||
// 获取dimensionNodeTyepOrderList的index+1位置的节点类型
|
||||
String nextNodeType = dimensionNodeTyepOrderList.get(index + 1);
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> allNodeByProjectIdAndType = simuluationNodeFeignClient.getAllNodeByProjectIdAndType(chooseUuid, nextNodeType);
|
||||
if(!allNodeByProjectIdAndType.isSuccess()){
|
||||
if (!allNodeByProjectIdAndType.isSuccess()) {
|
||||
return SdmResponse.success();
|
||||
}
|
||||
return allNodeByProjectIdAndType;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse listSimulationNodeFiles(ListSimulationNodeTreeReq req) {
|
||||
// 按照显示维度展示后,会打乱原本的文件夹父子关系,需要重新构建父子关系:
|
||||
// 1、先调用 getSimulationNodeTree 按照维度查询项目子节点node,根据node-uuid获取fileId
|
||||
// 2、再查询原本的普通文件夹信息,需要isProjectDimension=true 只查询普通文件夹,不查询节点文件夹,union all 查询node的fileId 后 分页查询
|
||||
Long parentId;
|
||||
List<String> uuids = null;
|
||||
String relatedResourceUuid = null;
|
||||
String relatedResourceUuidOwnType = null;
|
||||
if (ObjectUtils.isNotEmpty(req.getFileId())) {
|
||||
//fileId 不为空,是右侧点击进入文件夹下一层级查询
|
||||
parentId = req.getFileId();
|
||||
Optional<FileMetadataInfo> parentDirInfo = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getId, parentId).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<FileMetadataInfo> 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<List<AllNodeByProjectIdAndTypeResp>> allNodeByProjectIdAndType = getSimulationNodeTree(getSimulationNodeTreeReq);
|
||||
if (allNodeByProjectIdAndType.isSuccess() && ObjectUtils.isNotEmpty(allNodeByProjectIdAndType.getData())) {
|
||||
uuids = allNodeByProjectIdAndType.getData().stream().map(AllNodeByProjectIdAndTypeResp::getUuid).toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PageHelper.startPage(req.getCurrent(), req.getSize());
|
||||
List<FileMetadataInfo> fileMetadataInfos = fileMetadataInfoService.listSimulationNodeFiles(parentId, uuids);
|
||||
|
||||
PageInfo<FileMetadataInfo> page = new PageInfo<>(fileMetadataInfos);
|
||||
return PageUtils.getJsonObjectSdmResponse(fileMetadataInfos, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse createSimulationNodeDir(CreateDirReq req) {
|
||||
req.setDirType(DirTypeEnum.PROJECT_NODE_DIR.getValue());
|
||||
return dataFileService.createDir(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse uploadSimulationNodeFiles(UploadFilesReq req) {
|
||||
return dataFileService.uploadFiles(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse deleteSimulationNodeFiles(DeleteSimulationNodeFilesReq req) {
|
||||
if (DataTypeEnum.FILE.getValue() == req.getDataType() && ObjectUtils.isNotEmpty(req.getDeleteId())) {
|
||||
DelFileReq delFileReq = new DelFileReq();
|
||||
delFileReq.setDelFileId(req.getDeleteId());
|
||||
dataFileService.delFile(delFileReq);
|
||||
}
|
||||
|
||||
if (DataTypeEnum.DIRECTORY.getValue() == req.getDataType() && ObjectUtils.isNotEmpty(req.getDeleteId())) {
|
||||
FileMetadataInfo dirInfo = fileMetadataInfoService.getById(req.getDeleteId());
|
||||
if (ObjectUtils.isEmpty(dirInfo)) {
|
||||
return SdmResponse.failed("要删除的文件夹不存在");
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(dirInfo.getRelatedResourceUuid())) {
|
||||
// 删除节点文件夹
|
||||
DelNodeReq delNodeReq = new DelNodeReq();
|
||||
delNodeReq.setUuid(dirInfo.getRelatedResourceUuid());
|
||||
delNodeReq.setUuidOwnType(dirInfo.getRelatedResourceUuidOwnType());
|
||||
return simuluationNodeFeignClient.delteNode(delNodeReq);
|
||||
} else {
|
||||
// 删除普通文件夹
|
||||
DelDirReq delDirReq = new DelDirReq();
|
||||
delDirReq.setDelDirId(req.getDeleteId());
|
||||
return dataFileService.delDir(delDirReq);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse searchSimulationNodeFiles(FileSearchReq req) {
|
||||
return dataFileService.fileSearch(req);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.sdm.data.model.dto.NodeSizeDTO;
|
||||
import com.sdm.data.model.dto.UserTotalFileSizeDTO;
|
||||
import com.sdm.data.model.entity.FileMetadataInfo;
|
||||
import com.sdm.data.service.IFileMetadataInfoService;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -20,4 +21,8 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
public class FileMetadataInfoServiceImpl extends ServiceImpl<FileMetadataInfoMapper, FileMetadataInfo> implements IFileMetadataInfoService {
|
||||
@Override
|
||||
public List<FileMetadataInfo> listSimulationNodeFiles(Long parentId, List<String> uuids) {
|
||||
return this.baseMapper.listSimulationNodeFiles(parentId,uuids);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -511,13 +511,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
fileStorageService.lambdaUpdate().eq(FileStorage::getDirId, deleteDirId).remove();
|
||||
// minio文件系统批量删除文件
|
||||
minioService.deleteDirectoryRecursively(dirMinioObjectKey);
|
||||
|
||||
if (ObjectUtils.isNotEmpty(deleteDirMetadataInfo.getRelatedResourceUuid()) && ObjectUtils.isNotEmpty(deleteDirMetadataInfo.getRelatedResourceUuidOwnType())) {
|
||||
DelNodeReq delNodeReq = new DelNodeReq();
|
||||
delNodeReq.setUuid(deleteDirMetadataInfo.getRelatedResourceUuid());
|
||||
delNodeReq.setUuidOwnType(deleteDirMetadataInfo.getRelatedResourceUuidOwnType());
|
||||
simulationNodeFeignClient.delteNode(delNodeReq);
|
||||
}
|
||||
log.info("删除目录文件元数据和Minio文件成功: " + dirMinioObjectKey);
|
||||
} catch (Exception e) {
|
||||
log.error("删除目录失败", e);
|
||||
// 重新抛出异常,确保事务回滚
|
||||
@@ -594,7 +588,6 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
List<Long> fileIdList = data.stream().map(FileStorage::getFileId).toList();
|
||||
|
||||
|
||||
// 查询当前文件夹和子文件下的文件,使用 dirObjectKey%
|
||||
List<FileMetadataInfo> files = fileMetadataInfoService
|
||||
.lambdaQuery()
|
||||
.in(FileMetadataInfo::getId, fileIdList)
|
||||
@@ -652,7 +645,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
.eq(FileMetadataInfo::getIsLatest, FileIsLastEnum.YES.getValue())
|
||||
.eq(FileMetadataInfo::getApproveType, NumberConstants.ZERO)
|
||||
.list();
|
||||
if (ObjectUtils.isEmpty(list)) {
|
||||
if (ObjectUtils.isNotEmpty(list)) {
|
||||
list.forEach(fileMetadataInfo -> {
|
||||
Long creatorId = fileMetadataInfo.getCreatorId();
|
||||
});
|
||||
@@ -868,14 +861,6 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
try {
|
||||
minioService.renameFile(oldDirMinioObjectKey, newDirMinioObjectKey);
|
||||
fileMetadataInfoService.lambdaUpdate().set(FileMetadataInfo::getObjectKey, newDirMinioObjectKey).set(FileMetadataInfo::getOriginalName, req.getNewName()).eq(FileMetadataInfo::getId, dirMetadataInfo.getId()).update();
|
||||
|
||||
if (ObjectUtils.isNotEmpty(req.getUuid()) && ObjectUtils.isNotEmpty(req.getUuIdOwnType())) {
|
||||
RenameNodeReq renameNodeReq = new RenameNodeReq();
|
||||
renameNodeReq.setUuid(req.getUuid());
|
||||
renameNodeReq.setUuidOwnType(req.getUuIdOwnType());
|
||||
renameNodeReq.setNewName(req.getNewName());
|
||||
simulationNodeFeignClient.renameNode(renameNodeReq);
|
||||
}
|
||||
return SdmResponse.success("重命名目录成功");
|
||||
} catch (Exception e) {
|
||||
log.error("重命名目录失败", e);
|
||||
|
||||
@@ -64,4 +64,13 @@
|
||||
<appender-ref ref="INFO_FILE" /> <!-- INFO及以上输出到running.log -->
|
||||
<appender-ref ref="DEBUG_FILE" /> <!-- 仅DEBUG输出到running_debug.log -->
|
||||
</root>
|
||||
|
||||
<!-- local环境使用DEBUG级别 -->
|
||||
<springProfile name="local">
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="STDOUT" /> <!-- 控制台输出DEBUG及以上 -->
|
||||
<appender-ref ref="INFO_FILE" /> <!-- INFO及以上输出到running.log -->
|
||||
<appender-ref ref="DEBUG_FILE" /> <!-- 仅DEBUG输出到running_debug.log -->
|
||||
</root>
|
||||
</springProfile>
|
||||
</configuration>
|
||||
@@ -1,4 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sdm.data.dao.FileMetadataInfoMapper">
|
||||
</mapper>
|
||||
<select id="listSimulationNodeFiles" resultType="com.sdm.data.model.entity.FileMetadataInfo">
|
||||
<!-- 第一个子查询(必执行) -->
|
||||
SELECT *
|
||||
FROM file_metadata_info
|
||||
WHERE parentId = #{parentId}
|
||||
AND relatedResourceUuid IS NULL
|
||||
AND isLatest = true
|
||||
|
||||
<!-- 动态判断:uuids 不为空且有元素时,才拼接 UNION ALL + 第二个子查询 -->
|
||||
<if test="uuids != null">
|
||||
UNION ALL
|
||||
(
|
||||
SELECT *
|
||||
FROM file_metadata_info
|
||||
WHERE relatedResourceUuid IN (
|
||||
<foreach collection="uuids" item="uuid" separator=",">
|
||||
#{uuid}
|
||||
</foreach>
|
||||
)
|
||||
)
|
||||
</if>
|
||||
|
||||
<!-- 排序:无论是否联合,都对最终结果排序 -->
|
||||
ORDER BY originalName
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -938,6 +938,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
|
||||
@Override
|
||||
public SdmResponse delteNode(DelNodeReq req) {
|
||||
log.info("开始删除节点: {}", req);
|
||||
SpdmDeleteProjectDetailReq deleteNode = new SpdmDeleteProjectDetailReq();
|
||||
deleteNode.setNodeType(req.getUuidOwnType());
|
||||
deleteNode.setUuid(req.getUuid());
|
||||
|
||||
@@ -39,8 +39,16 @@
|
||||
</appender>
|
||||
|
||||
<!-- 日志输出级别 -->
|
||||
<root level="DEBUG">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
|
||||
<!-- local环境使用DEBUG级别 -->
|
||||
<springProfile name="local">
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
</springProfile>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user