1、任务新增3D图示的文件id字段

2、项目详情中,新增当前阶段字段
This commit is contained in:
2025-12-02 17:23:03 +08:00
parent c8d4b64d24
commit fdbc1bf698
4 changed files with 72 additions and 0 deletions

View File

@@ -157,4 +157,6 @@ public class ProjectNodePo extends NodeAllBase {
private String tag9;
@JsonProperty(value = "tag10")
private String tag10;
private Long imageFileId;
}

View File

@@ -181,4 +181,6 @@ public class TaskNodePo extends NodeAllBase {
@JsonProperty(value = "tag10")
private String tag10;
private Long imageFileId;
}

View File

@@ -94,4 +94,9 @@ public class SpdmNodeDetailVo extends BaseEntity {
private String exeStatus;
/**
* 当前阶段
*/
private String currentPhase;
}

View File

@@ -68,6 +68,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.sql.Wrapper;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -606,6 +607,68 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
}
SpdmNodeDetailVo spdmNodeDetailVo = new SpdmNodeDetailVo();
BeanUtils.copyProperties(projectNode, spdmNodeDetailVo);
// 设置当前阶段
String uuid = spdmNodeDetailVo.getUuid();
List<SimulationNode> phaseNodeList = this.lambdaQuery().eq(SimulationNode::getParentId, uuid).eq(SimulationNode::getNodeType, NodeTypeEnum.PHASE.getValue()).list();
if (CollectionUtils.isEmpty(phaseNodeList)) {
return SdmResponse.success(spdmNodeDetailVo);
}
phaseNodeList = phaseNodeList.stream().filter(phaseNode -> StringUtils.isNotBlank(phaseNode.getBeginTime()) && StringUtils.isNotBlank(phaseNode.getEndTime())).toList();
if (CollectionUtils.isEmpty(phaseNodeList)) {
return SdmResponse.success(spdmNodeDetailVo);
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
phaseNodeList = phaseNodeList.stream().sorted(Comparator.comparingLong(phaseNode -> {
try {
return sdf.parse(phaseNode.getBeginTime()).getTime();
} catch (ParseException e) {
throw new RuntimeException(e);
}
})).toList();
Long currentTime = System.currentTimeMillis();
SimulationNode currentPhaseNode = null;
for (SimulationNode simulationNode : phaseNodeList) {
try {
if (currentTime >= sdf.parse(simulationNode.getBeginTime()).getTime() && currentTime <= sdf.parse(simulationNode.getEndTime()).getTime()) {
currentPhaseNode = simulationNode;
}
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
if (ObjectUtils.isNotEmpty(currentPhaseNode)) {
spdmNodeDetailVo.setCurrentPhase(currentPhaseNode.getNodeName());
return SdmResponse.success(spdmNodeDetailVo);
}
// 开始时间比当前时间小的里面的最大的一个
List<SimulationNode> bigPhaseNodeList = phaseNodeList.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 = phaseNodeList.stream().max(Comparator.comparingLong(phaseNode -> {
try {
return sdf.parse(phaseNode.getBeginTime()).getTime();
} catch (ParseException e) {
throw new RuntimeException(e);
}
})).get();
spdmNodeDetailVo.setCurrentPhase(simulationNode.getNodeName());
return SdmResponse.success(spdmNodeDetailVo);
}
SimulationNode simulationNode = phaseNodeList.stream().min(Comparator.comparingLong(phaseNode -> {
try {
return sdf.parse(phaseNode.getBeginTime()).getTime();
} catch (ParseException e) {
throw new RuntimeException(e);
}
})).get();
spdmNodeDetailVo.setCurrentPhase(simulationNode.getNodeName());
return SdmResponse.success(spdmNodeDetailVo);
}