1、查询算例树接口中返回任务的拓展属性

This commit is contained in:
2026-03-13 18:36:34 +08:00
parent 1154f6982c
commit 03faed2e49

View File

@@ -35,6 +35,7 @@ import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
import com.sdm.common.entity.resp.data.SimulationTaskResultCurveResp; import com.sdm.common.entity.resp.data.SimulationTaskResultCurveResp;
import com.sdm.common.entity.resp.flowable.ProcessInstanceDetailResponse; import com.sdm.common.entity.resp.flowable.ProcessInstanceDetailResponse;
import com.sdm.common.entity.resp.flowable.ProcessInstanceResp; import com.sdm.common.entity.resp.flowable.ProcessInstanceResp;
import com.sdm.common.entity.resp.project.TaskNodeExtraPo;
import com.sdm.common.entity.resp.system.CIDUserResp; import com.sdm.common.entity.resp.system.CIDUserResp;
import com.sdm.common.feign.impl.capability.SimulationFlowFeignClientImpl; import com.sdm.common.feign.impl.capability.SimulationFlowFeignClientImpl;
import com.sdm.common.feign.impl.capability.SimulationReportFeignClientImpl; import com.sdm.common.feign.impl.capability.SimulationReportFeignClientImpl;
@@ -221,7 +222,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
return currentNodeDepth; return currentNodeDepth;
} }
private void generateTaskTree(ProjectNodePo projectNodePo, List<ProjectNodePo> taskTreeNodeList, List<TaskNodePo> taskTreeTaskList, List<TaskNodeTag> taskTreeTagMap, String firstNodeTag, String lastNodeTag, Map<String, String> taskTreeNodeTypeTagMap, List<RunNodePo> taskTreeRunList) { private void generateTaskTree(ProjectNodePo projectNodePo, List<ProjectNodePo> taskTreeNodeList, List<TaskNodePo> taskTreeTaskList, List<TaskNodeTag> taskTreeTagMap, String firstNodeTag, String lastNodeTag, Map<String, String> taskTreeNodeTypeTagMap, List<RunNodePo> taskTreeRunList,Map<String,List<TaskNodeExtraPo>> taskExtraMap) {
String currentNodeType = projectNodePo.getNodeType(); String currentNodeType = projectNodePo.getNodeType();
String currentTag = taskTreeNodeTypeTagMap.get(currentNodeType); String currentTag = taskTreeNodeTypeTagMap.get(currentNodeType);
TaskNodeTag nextNodeTag = getNextNodeTag(currentTag, taskTreeTagMap); TaskNodeTag nextNodeTag = getNextNodeTag(currentTag, taskTreeTagMap);
@@ -379,7 +380,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
if (CollectionUtils.isNotEmpty(sameTypeNodeList)) { if (CollectionUtils.isNotEmpty(sameTypeNodeList)) {
// 递归 // 递归
for (ProjectNodePo nodePo : sameTypeNodeList) { for (ProjectNodePo nodePo : sameTypeNodeList) {
generateTaskTree(nodePo, taskTreeNodeList, taskTreeTaskList, taskTreeTagMap, firstNodeTag, lastNodeTag, taskTreeNodeTypeTagMap, taskTreeRunList); generateTaskTree(nodePo, taskTreeNodeList, taskTreeTaskList, taskTreeTagMap, firstNodeTag, lastNodeTag, taskTreeNodeTypeTagMap, taskTreeRunList,taskExtraMap);
} }
if (CollectionUtils.isNotEmpty(sameTypeNodeList)) { if (CollectionUtils.isNotEmpty(sameTypeNodeList)) {
children.addAll(sameTypeNodeList); children.addAll(sameTypeNodeList);
@@ -395,7 +396,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
if (CollectionUtils.isNotEmpty(childrenTypeNodeList)) { if (CollectionUtils.isNotEmpty(childrenTypeNodeList)) {
// 递归 // 递归
for (ProjectNodePo nodePo : childrenTypeNodeList) { for (ProjectNodePo nodePo : childrenTypeNodeList) {
generateTaskTree(nodePo, taskTreeNodeList, taskTreeTaskList, taskTreeTagMap, firstNodeTag, lastNodeTag, taskTreeNodeTypeTagMap, taskTreeRunList); generateTaskTree(nodePo, taskTreeNodeList, taskTreeTaskList, taskTreeTagMap, firstNodeTag, lastNodeTag, taskTreeNodeTypeTagMap, taskTreeRunList,taskExtraMap);
} }
children.addAll(childrenTypeNodeList); children.addAll(childrenTypeNodeList);
} }
@@ -419,7 +420,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
if (CollectionUtils.isNotEmpty(otherChildrenNodeList)) { if (CollectionUtils.isNotEmpty(otherChildrenNodeList)) {
// 递归 // 递归
for (ProjectNodePo nodePo : otherChildrenNodeList) { for (ProjectNodePo nodePo : otherChildrenNodeList) {
generateTaskTree(nodePo, taskTreeNodeList, taskTreeTaskList, taskTreeTagMap, firstNodeTag, lastNodeTag, taskTreeNodeTypeTagMap, taskTreeRunList); generateTaskTree(nodePo, taskTreeNodeList, taskTreeTaskList, taskTreeTagMap, firstNodeTag, lastNodeTag, taskTreeNodeTypeTagMap, taskTreeRunList,taskExtraMap);
} }
children.addAll(otherChildrenNodeList); children.addAll(otherChildrenNodeList);
} }
@@ -431,6 +432,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
task.setNodeCode(task.getTaskCode()); task.setNodeCode(task.getTaskCode());
task.setSection(task.getSectionName()); task.setSection(task.getSectionName());
task.setGroup(task.getGroupName()); task.setGroup(task.getGroupName());
task.setExtras(taskExtraMap.get(task.getUuid()));
}); });
children.addAll(currentNodeAssociatedTaskList); children.addAll(currentNodeAssociatedTaskList);
} }
@@ -576,12 +578,16 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
} }
List<RunNodePo> taskTreeRunList = new ArrayList<>(); List<RunNodePo> taskTreeRunList = new ArrayList<>();
List<TaskNodePo> taskTreeTaskList = mapper.getTaskListByTag(taskTreeReq); List<TaskNodePo> taskTreeTaskList = mapper.getTaskListByTag(taskTreeReq);
Map<String,List<TaskNodeExtraPo>> taskExtraMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(taskTreeTaskList)) { if (CollectionUtils.isNotEmpty(taskTreeTaskList)) {
taskTreeTaskList.forEach(task -> task.setNodeType(NodeTypeEnum.TASK.getValue())); taskTreeTaskList.forEach(task -> task.setNodeType(NodeTypeEnum.TASK.getValue()));
taskTreeRunList = mapper.getRunListByNodeIdList(taskTreeTaskList.stream().map(TaskNodePo::getUuid).toList()); taskTreeRunList = mapper.getRunListByNodeIdList(taskTreeTaskList.stream().map(TaskNodePo::getUuid).toList());
if (CollectionUtils.isNotEmpty(taskTreeRunList)) { if (CollectionUtils.isNotEmpty(taskTreeRunList)) {
taskTreeRunList.forEach(run -> run.setNodeType(NodeTypeEnum.RUN.getValue())); taskTreeRunList.forEach(run -> run.setNodeType(NodeTypeEnum.RUN.getValue()));
} }
taskExtraMap = Optional.ofNullable(taskMapper.getTaskExtraList(
taskTreeTaskList.stream().map(TaskNodePo::getUuid).toList()
)).orElse(Collections.emptyList()).stream().collect(Collectors.groupingBy(TaskNodeExtraPo::getTaskId));
} }
List<TaskNodeTag> taskTreeTagMap = req.getTagMap(); List<TaskNodeTag> taskTreeTagMap = req.getTagMap();
String firstNodeTag = taskTreeTagMap.get(0).getValue(); String firstNodeTag = taskTreeTagMap.get(0).getValue();
@@ -604,7 +610,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
String realFirstTaskNodeType = taskTreeTagNodeTypeMap.get(realFirstTaskNodeTag.getValue()); String realFirstTaskNodeType = taskTreeTagNodeTypeMap.get(realFirstTaskNodeTag.getValue());
List<ProjectNodePo> realTopProjectNodeList = taskTreeNodeList.stream().filter(node -> node.getNodeType().equals(realFirstTaskNodeType)).toList(); List<ProjectNodePo> realTopProjectNodeList = taskTreeNodeList.stream().filter(node -> node.getNodeType().equals(realFirstTaskNodeType)).toList();
for (ProjectNodePo projectNodePo : realTopProjectNodeList) { for (ProjectNodePo projectNodePo : realTopProjectNodeList) {
generateTaskTree(projectNodePo, taskTreeNodeList, taskTreeTaskList, taskTreeTagMap, firstNodeTag, lastNodeTag, taskTreeNodeTypeTagMap, taskTreeRunList); generateTaskTree(projectNodePo, taskTreeNodeList, taskTreeTaskList, taskTreeTagMap, firstNodeTag, lastNodeTag, taskTreeNodeTypeTagMap, taskTreeRunList,taskExtraMap);
} }
// 对工位进行排序,-M工位顺序排第一个 // 对工位进行排序,-M工位顺序排第一个
if (lyricFlag == 1) { if (lyricFlag == 1) {