1、修改任务树列表接口

This commit is contained in:
2026-01-13 19:19:54 +08:00
parent 731ea866fe
commit 2f7fbdd5d7
2 changed files with 16 additions and 6 deletions

View File

@@ -2634,9 +2634,6 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
ProjectTreeTagReq req = buildProjectTreeTagReq(idMap, tagMap);
// 获取任务树数据
List<NodeAllBase> nodeAllBaseList = getTaskTreeData(req);
if (CollectionUtils.isEmpty(nodeAllBaseList)) {
return SdmResponse.success(Collections.emptyList());
}
// 查询节点信息
List<String> nodeIds = Arrays.asList(projectNodeId, phaseNodeId);
List<ProjectNodePo> nodeList = mapper.getNodeListByNodeIdList(nodeIds);
@@ -2645,7 +2642,8 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
return SdmResponse.success(Collections.emptyList());
}
// 流式过滤+Optional处理
ProjectNodePo projectNode = nodeList.stream().filter(node -> NODE_TYPE_PROJECT.equals(node.getNodeType())).findFirst().orElse(null);
ProjectNodePo projectNode = nodeList.stream().filter(node -> NODE_TYPE_PROJECT.equals(node.getNodeType()) &&
"1".equals(node.getExeStatus())).findFirst().orElse(null);
ProjectNodePo phaseNode = nodeList.stream().filter(node -> NODE_TYPE_PHASE.equals(node.getNodeType())).findFirst().orElse(null);
if (projectNode == null || phaseNode == null) {
log.error("【双ID查询】未匹配到对应类型节点, projectNodeId={}, phaseNodeId={}", projectNodeId, phaseNodeId);
@@ -2653,7 +2651,9 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
}
// 组装树形结构 + 【批量赋值扩展信息】仅1次查询
batchSetNodeExtras(Arrays.asList(projectNode, phaseNode));
phaseNode.setChildren(nodeAllBaseList);
if (CollectionUtils.isNotEmpty(nodeAllBaseList)) {
phaseNode.setChildren(nodeAllBaseList);
}
projectNode.setChildren(Collections.singletonList(phaseNode));
return SdmResponse.success(Collections.singletonList(projectNode));
}
@@ -2704,6 +2704,11 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
log.error("【仅阶段查询】未查询到关联项目节点, projectIdList={}", projectIdList);
return SdmResponse.success(Collections.emptyList());
}
projectNodeList = projectNodeList.stream().filter(node -> "1".equals(node.getExeStatus())).toList();
if (CollectionUtils.isEmpty(projectNodeList)) {
log.error("【仅阶段查询】未查询到进行中的项目节点, projectIdList={}", projectIdList);
return SdmResponse.success(Collections.emptyList());
}
Map<String, ProjectNodePo> projectNodeMap = projectNodeList.stream()
.collect(Collectors.toMap(ProjectNodePo::getUuid, p -> p, (k1, k2) -> k1)); // 解决重复key问题
// 批量设置所有节点的扩展信息
@@ -2737,6 +2742,11 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
log.error("【仅项目查询】未查询到项目节点, projectNodeId={}", projectNodeId);
return SdmResponse.success(Collections.emptyList());
}
projectNodeList = projectNodeList.stream().filter(node -> "1".equals(node.getExeStatus())).toList();
if (CollectionUtils.isEmpty(projectNodeList)) {
log.error("【仅项目查询】未查询到进行中的项目节点, projectNodeId={}", projectNodeId);
return SdmResponse.success(Collections.emptyList());
}
// 批量设置扩展信息
batchSetNodeExtras(projectNodeList);
projectNodeList.forEach(projectNode -> {

View File

@@ -720,7 +720,7 @@
<foreach collection='nodeTypeList' item='nodeType' index='index' separator=','>
#{nodeType}
</foreach>
)
) and exe_status = '1'
</select>
<!-- <select id="getTaskList" resultType="com.sdm.project.entity.vo.SpdmTaskVo">-->