fix[project]: 调整新增待办调用的listNoPermission设置当前阶段逻辑

This commit is contained in:
2026-04-16 13:58:24 +08:00
parent 7213e95f67
commit 1070711827

View File

@@ -2473,18 +2473,48 @@ public class LyricInternalServiceImpl implements ILyricInternalService {
.collect(Collectors.toList());
// 查找当前时间落在【开始时间, 结束时间】内的阶段节点
SimulationNode currentPhaseNode = sortedPhaseNodeList.stream()
List<SimulationNode> currentPhaseNodeList = sortedPhaseNodeList.stream()
.filter(phaseNode -> isCurrentTimeInRange(phaseNode, currentTime, sdf))
.findFirst()
.orElse(null);
.toList();
SpdmNodeVo projectNode = nodeList.stream()
.filter(node -> projectNodeId.equals(node.getUuid())).findFirst().orElse(null);
if (projectNode != null) {
// 找到当前阶段回写至对应的SpdmNodeVo
if (CollectionUtils.isNotEmpty(currentPhaseNodeList)) {
// 开始时间比当前时间小的里面的最大的一个
List<SimulationNode> bigPhaseNodeList = currentPhaseNodeList.stream().filter(phaseNode -> {
try {
return currentTime <= sdf.parse(phaseNode.getBeginTime()).getTime();
} catch (ParseException e) {
throw new RuntimeException(e);
}
}).toList();
if (CollectionUtils.isEmpty(bigPhaseNodeList)) {
SimulationNode simulationNode = currentPhaseNodeList.stream().max(Comparator.comparingLong(phaseNode -> {
try {
return sdf.parse(phaseNode.getBeginTime()).getTime();
} catch (ParseException e) {
throw new RuntimeException(e);
}
})).get();
projectNode.setCurrentPhase(simulationNode.getNodeName());
} else {
SimulationNode simulationNode = phaseNodeList.stream().min(Comparator.comparingLong(phaseNode -> {
try {
return sdf.parse(phaseNode.getBeginTime()).getTime();
} catch (ParseException e) {
throw new RuntimeException(e);
}
})).get();
projectNode.setCurrentPhase(simulationNode.getNodeName());
}
// 找到当前阶段回写至对应的SpdmNodeVo
if (Objects.nonNull(currentPhaseNode)) {
nodeList.stream()
.filter(node -> projectNodeId.equals(node.getUuid()))
.findFirst()
.ifPresent(node -> node.setCurrentPhase(currentPhaseNode.getNodeName()));
} else {
// 如果没有落在【开始时间, 结束时间】内的阶段节点就选beginTime最大的阶段作为当前阶段
projectNode.setCurrentPhase(sortedPhaseNodeList.get(sortedPhaseNodeList.size() - 1).getNodeName());
}
}
});
}