优化数据总览

This commit is contained in:
2025-11-25 16:16:23 +08:00
parent 2a135df92f
commit dfc9647064
12 changed files with 161 additions and 46 deletions

2
.idea/compiler.xml generated
View File

@@ -16,6 +16,7 @@
<module name="common" />
<module name="data" />
<module name="submit" />
<module name="flowable" />
<module name="approve" />
<module name="project" />
</profile>
@@ -31,6 +32,7 @@
<module name="capability" options="-parameters" />
<module name="common" options="-parameters" />
<module name="data" options="-parameters" />
<module name="flowable" options="-parameters" />
<module name="gateway" options="-parameters" />
<module name="gateway2" options="-parameters" />
<module name="pbs" options="-parameters" />

1
.idea/encodings.xml generated
View File

@@ -5,6 +5,7 @@
<file url="file://$PROJECT_DIR$/capability/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/common/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/data/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/flowable/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gateway/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gateway2/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/pbs/src/main/java" charset="UTF-8" />

1
.idea/misc.xml generated
View File

@@ -5,6 +5,7 @@
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
<option value="$PROJECT_DIR$/flowable/pom.xml" />
</list>
</option>
<option name="ignoredFiles">

17
.idea/modules.xml generated
View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/approve/approve.iml" filepath="$PROJECT_DIR$/approve/approve.iml" />
<module fileurl="file://$PROJECT_DIR$/capability/capability.iml" filepath="$PROJECT_DIR$/capability/capability.iml" />
<module fileurl="file://$PROJECT_DIR$/common/common.iml" filepath="$PROJECT_DIR$/common/common.iml" />
<module fileurl="file://$PROJECT_DIR$/data/data.iml" filepath="$PROJECT_DIR$/data/data.iml" />
<module fileurl="file://$PROJECT_DIR$/gateway2/gateway2.iml" filepath="$PROJECT_DIR$/gateway2/gateway2.iml" />
<module fileurl="file://$PROJECT_DIR$/pbs/pbs.iml" filepath="$PROJECT_DIR$/pbs/pbs.iml" />
<module fileurl="file://$PROJECT_DIR$/performance/performance.iml" filepath="$PROJECT_DIR$/performance/performance.iml" />
<module fileurl="file://$PROJECT_DIR$/project/project.iml" filepath="$PROJECT_DIR$/project/project.iml" />
<module fileurl="file://$PROJECT_DIR$/system/system.iml" filepath="$PROJECT_DIR$/system/system.iml" />
<module fileurl="file://$PROJECT_DIR$/task/task.iml" filepath="$PROJECT_DIR$/task/task.iml" />
</modules>
</component>
</project>

View File

@@ -20,4 +20,13 @@ public enum NodeTypeEnum {
public String getValue() {
return value;
}
/**
* 是否节点类型
*/
public static boolean isNodeType(String value) {
return PROJECT.getValue().equals(value) || PHASE.getValue().equals(value)
|| DISCIPLINE.getValue().equals(value) || MACHINE.getValue().equals(value)
|| WORKSPACE.getValue().equals(value);
}
}

View File

@@ -63,6 +63,40 @@ public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient
}
@Override
public SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getNodeTaskList(String uuid) {
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> response;
try {
log.info("获取节点下的task列表请求参数uuid={}", uuid);
response = ISimulationNodeFeignClient.getNodeTaskList(uuid);
if (!response.isSuccess() || response.getData() == null || response.getData().isEmpty()) {
return SdmResponse.failed("获取节点下的task列表失败");
}
} catch (Exception e) {
log.error("获取节点下的task列表失败", e);
return SdmResponse.failed("获取节点下的task列表失败");
}
return response;
}
@Override
public SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getTaskRunList(String uuid) {
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> response;
try {
log.info("获取task下的run请求参数uuid={}", uuid);
response = ISimulationNodeFeignClient.getTaskRunList(uuid);
if (!response.isSuccess() || response.getData() == null || response.getData().isEmpty()) {
return SdmResponse.failed("获取task下的run失败");
}
} catch (Exception e) {
log.error("获取task下的run失败", e);
return SdmResponse.failed("获取task下的run失败");
}
return response;
}
@Override
public SdmResponse delteNode(DelNodeReq req) {
SdmResponse response;

View File

@@ -5,6 +5,7 @@ import com.sdm.common.entity.req.project.DelNodeReq;
import com.sdm.common.entity.req.project.SpdmNodeListReq;
import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp;
import com.sdm.common.entity.resp.project.SimulationNodeResp;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -33,6 +34,18 @@ public interface ISimulationNodeFeignClient {
@GetMapping("/node/getAllNodeByProjectIdAndType")
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getAllNodeByProjectIdAndType(@RequestParam(value = "chooseNodeId") String uuid, @RequestParam(value = "nextNodeType") String nextNodeType);
/**
* 获取节点下的task列表
*/
@GetMapping("/node/getNodeTaskList")
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getNodeTaskList(@RequestParam(value = "uuid") String uuid);
/**
* 获取task下的run
*/
@GetMapping("/node/getNodeTaskRunList")
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getTaskRunList(@RequestParam(value = "uuid") String uuid);
@PostMapping("node/delteNode")
SdmResponse delteNode(@RequestBody DelNodeReq req);

View File

@@ -7,6 +7,7 @@ import com.github.pagehelper.PageInfo;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.enums.DataTypeEnum;
import com.sdm.common.entity.enums.DirTypeEnum;
import com.sdm.common.entity.enums.NodeTypeEnum;
import com.sdm.common.entity.req.data.CreateDirReq;
import com.sdm.common.entity.req.data.DelDirReq;
import com.sdm.common.entity.req.data.UploadFilesReq;
@@ -26,6 +27,8 @@ 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 lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -38,6 +41,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
/**
* <p>
@@ -47,6 +51,7 @@ import java.util.Optional;
* @author author
* @since 2025-09-04
*/
@Slf4j
@Service
public class DimensionTemplateServiceImpl extends ServiceImpl<DimensionTemplateMapper, DimensionTemplate> implements IDimensionTemplateService {
@Autowired
@@ -166,7 +171,7 @@ public class DimensionTemplateServiceImpl extends ServiceImpl<DimensionTemplateM
queryWrapper.eq(DimensionTemplateHierarchy::getTemplateId, dimensionTemplateId).orderByAsc(DimensionTemplateHierarchy::getSortOrder);
List<String> dimensionNodeTyepOrderList = dimensionTemplateHierarchyService.list(queryWrapper).stream().map(DimensionTemplateHierarchy::getDisplayName).toList();
List<String> uuids = null;
List<String> uuids = new ArrayList<>();
List<FileMetadataInfo> resultDir = new ArrayList<>();
if (ObjectUtils.isEmpty(req.getFileId())) {
// 选中维度了,没有选节点,按照模版,展示模版的第一层节点数据
@@ -174,15 +179,16 @@ public class DimensionTemplateServiceImpl extends ServiceImpl<DimensionTemplateM
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> allNodeByNodeTypeResponse = simuluationNodeFeignClient.getAllNodeByNodeType(null, rootNodeType);
if (!allNodeByNodeTypeResponse.isSuccess()) {
log.error("获取节点信息失败");
return SdmResponse.success();
}
uuids = allNodeByNodeTypeResponse.getData().stream().map(AllNodeByProjectIdAndTypeResp::getUuid).toList();
uuids.addAll(allNodeByNodeTypeResponse.getData().stream().map(AllNodeByProjectIdAndTypeResp::getUuid).toList());
} else {
// 选中维度了,也选中了节点,按照模版,展示该节点的下一层节点文件夹和普通文件夹
// 选中维度了,也选中了节点,按照模版,展示该节点下的普通文件夹、任务、算列、按照展示模版指定的下一层节点文件夹
Long fileId = req.getFileId();
// 先获取普通文件夹
// 1、先获取普通文件夹
List<FileMetadataInfo> dirInfos = fileMetadataInfoService
.lambdaQuery()
.eq(FileMetadataInfo::getParentId, fileId)
@@ -192,36 +198,46 @@ public class DimensionTemplateServiceImpl extends ServiceImpl<DimensionTemplateM
resultDir.addAll(dirInfos);
// 再获取节点文件夹
// 2、再获取节点文件夹
FileMetadataInfo nodeDirInfo = fileMetadataInfoService.getById(fileId);
String chooseUuid = nodeDirInfo.getRelatedResourceUuid();
String chooseNodeType = nodeDirInfo.getRelatedResourceUuidOwnType();
// chooseUuid和chooseNodeType不为空才是节点文件夹才需要查询子节点文件夹文件
if (ObjectUtils.isNotEmpty(chooseUuid) && ObjectUtils.isNotEmpty(chooseNodeType)) {
// chooseUuid和chooseNodeType不为空,并且是node节点类型才是节点文件夹,才需要查询子节点文件夹文件
if (ObjectUtils.isNotEmpty(chooseUuid) && ObjectUtils.isNotEmpty(chooseNodeType) && NodeTypeEnum.isNodeType(chooseNodeType)) {
// 从dimensionNodeTyepOrderList中获取chooseNodeType下一个位置的数据有可能chooseNodeType所在位置就是最后一层节点,SdmResponse返回空数据
int index = dimensionNodeTyepOrderList.indexOf(chooseNodeType);
if (index == -1) {
return SdmResponse.failed("选中节点类型不在数据展示维度中");
}
if (index == dimensionNodeTyepOrderList.size() - 1) {
//尾节点,直接返回空数据
return SdmResponse.success();
// 判断是否是最后一层节点,如果是最后一层节点,则不需要查询子节点文件
if (index != dimensionNodeTyepOrderList.size() - 1) {
// 获取dimensionNodeTyepOrderList的index+1位置的节点类型
String nextNodeType = dimensionNodeTyepOrderList.get(index + 1);
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> allNodeByProjectIdAndType = simuluationNodeFeignClient.getAllNodeByProjectIdAndType(chooseUuid, nextNodeType);
if (!allNodeByProjectIdAndType.isSuccess()) {
return SdmResponse.success();
}
uuids.addAll(allNodeByProjectIdAndType.getData().stream().map(AllNodeByProjectIdAndTypeResp::getUuid).toList());
}
}
// 3、获取当前节点下的任务、算列
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> nodeTaskList = simuluationNodeFeignClient.getNodeTaskList(chooseUuid);
if (nodeTaskList.isSuccess()) {
uuids.addAll(nodeTaskList.getData().stream().map(AllNodeByProjectIdAndTypeResp::getUuid).toList());
log.info("获取节点下task的uudis:{}", uuids);
}
// 获取dimensionNodeTyepOrderList的index+1位置的节点类型
String nextNodeType = dimensionNodeTyepOrderList.get(index + 1);
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> allNodeByProjectIdAndType = simuluationNodeFeignClient.getAllNodeByProjectIdAndType(chooseUuid, nextNodeType);
if (!allNodeByProjectIdAndType.isSuccess()) {
return SdmResponse.success();
}
uuids = allNodeByProjectIdAndType.getData().stream().map(AllNodeByProjectIdAndTypeResp::getUuid).toList();
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> taskRunList = simuluationNodeFeignClient.getTaskRunList(chooseUuid);
if (taskRunList.isSuccess()) {
uuids.addAll(taskRunList.getData().stream().map(AllNodeByProjectIdAndTypeResp::getUuid).toList());
log.info("获取节点下taskRun的uudis:{}", uuids);
}
}
if (ObjectUtils.isEmpty(uuids)) {
if (CollectionUtils.isEmpty(uuids)) {
return SdmResponse.success(resultDir);
}

12
pom.xml
View File

@@ -21,6 +21,7 @@
<module>system</module>
<module>submit</module>
<module>common</module>
<module>flowable</module>
</modules>
<!--引入Spring Boot项目子项目都是这个版本-->
@@ -37,7 +38,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>3.3.5</spring-boot.version>
<java.version>17</java.version>
<mybatis.plus.version>3.5.3.1</mybatis.plus.version>
<mybatis-plus-boot.version>3.5.9</mybatis-plus-boot.version>
<mysql.version>8.4.0</mysql.version>
<fastjson.version>2.0.50</fastjson.version>
@@ -50,11 +50,6 @@
<!-- 对子项目依赖进行版本管理 子模块引用无需声明版本号 -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>${mybatis.plus.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
@@ -121,11 +116,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- mybatis-plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>

View File

@@ -141,6 +141,24 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
return nodeService.getAllNodeByProjectIdAndType(uuid, nextNodeType);
}
/**
* 获取节点下的task列表
*/
@GetMapping("/getNodeTaskList")
@Operation(summary = "获取节点下的task列表", description = "获取节点下的task列表")
public SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getNodeTaskList(@RequestParam(value = "uuid") String uuid) {
return nodeService.getNodeTaskList(uuid);
}
/**
* 获取task下的run
*/
@GetMapping("/getNodeTaskRunList")
@Operation(summary = "获取task下的run", description = "获取task下的run")
public SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getTaskRunList(@RequestParam(value = "uuid") String uuid) {
return nodeService.getTaskRunList(uuid);
}
/**
* 用户组项目统计

View File

@@ -11,6 +11,7 @@ import com.sdm.common.entity.resp.project.SimulationNodeResp;
import com.sdm.project.model.entity.SimulationNode;
import com.sdm.project.model.req.*;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -35,6 +36,10 @@ public interface INodeService extends IService<SimulationNode> {
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getAllNodeByProjectIdAndType(String uuid, String nextNodeType);
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getNodeTaskList(String uuid);
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getTaskRunList(String uuid);
SdmResponse getUserGroupProjectStatistics(Long userGroupId, Long userId);
SdmResponse getUserGroupTaskCompleteStatistics(GetUserGroupTaskCompleteStatisticsReq req);

View File

@@ -756,6 +756,49 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
return SdmResponse.success(allNodeByProjectIdAndTypeRespList);
}
@Override
public SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getNodeTaskList(String uuid) {
if(ObjectUtils.isEmpty(uuid)){
return SdmResponse.success();
}
List<SimulationTask> simulationTasks = simulationTaskService.lambdaQuery().eq(SimulationTask::getNodeId, uuid).list();
if(CollectionUtils.isEmpty(simulationTasks)){
return SdmResponse.success();
}
List<AllNodeByProjectIdAndTypeResp> allNodeByProjectIdAndTypeRespList = new ArrayList<>();
simulationTasks.forEach(simulationTask -> {
AllNodeByProjectIdAndTypeResp allNodeByProjectIdAndTypeResp = new AllNodeByProjectIdAndTypeResp();
allNodeByProjectIdAndTypeResp.setId(simulationTask.getId().longValue());
allNodeByProjectIdAndTypeResp.setUuid(simulationTask.getUuid());
allNodeByProjectIdAndTypeResp.setNodeName(simulationTask.getTaskName());
allNodeByProjectIdAndTypeResp.setNodeType(NodeTypeEnum.TASK.getValue());
allNodeByProjectIdAndTypeRespList.add(allNodeByProjectIdAndTypeResp);
});
return SdmResponse.success(allNodeByProjectIdAndTypeRespList);
}
@Override
public SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getTaskRunList(String uuid) {
if(ObjectUtils.isEmpty(uuid)){
return SdmResponse.success();
}
List<SimulationRun> simulationRunList = simulationRunService.lambdaQuery().eq(SimulationRun::getTaskId, uuid).list();
if(CollectionUtils.isEmpty(simulationRunList)){
return SdmResponse.success();
}
List<AllNodeByProjectIdAndTypeResp> allNodeByProjectIdAndTypeRespList = new ArrayList<>();
simulationRunList.forEach(simulationRun -> {
AllNodeByProjectIdAndTypeResp allNodeByProjectIdAndTypeResp = new AllNodeByProjectIdAndTypeResp();
allNodeByProjectIdAndTypeResp.setId(simulationRun.getId().longValue());
allNodeByProjectIdAndTypeResp.setUuid(simulationRun.getUuid());
allNodeByProjectIdAndTypeResp.setNodeName(simulationRun.getRunName());
allNodeByProjectIdAndTypeResp.setNodeType(NodeTypeEnum.RUN.getValue());
allNodeByProjectIdAndTypeRespList.add(allNodeByProjectIdAndTypeResp);
});
return SdmResponse.success(allNodeByProjectIdAndTypeRespList);
}
public static void setTagProperty(Object obj, String propertyName, Object value) throws Exception {
Class<?> clazz = obj.getClass();
Field field = clazz.getDeclaredField(propertyName);