fix[project]: getTaskRunTree、getChildrenNodeList利元亨排序工位兼容待字母的情况

This commit is contained in:
2026-03-30 13:30:28 +08:00
parent 0783cf188b
commit a00bc60443
2 changed files with 22 additions and 2 deletions

View File

@@ -1822,6 +1822,16 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
}
}
public static boolean isInteger(String str) {
if (str == null || str.trim().isEmpty()) return false;
try {
Long.parseLong(str); // 支持前导零
return true;
} catch (NumberFormatException e) {
return false;
}
}
public List<ProjectNodePo> sortWorkspaceNode(List<ProjectNodePo> workspaceNodeList) {
// 对工位进行排序,-M工位顺序排第一个
List<ProjectNodePo> sortWorkspaceNodeList = workspaceNodeList.stream().filter(node -> !node.getNodeCode().contains("-M")).collect(Collectors.toList());
@@ -1829,7 +1839,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
String[] workspaceNode1 = o1.getNodeCode().split("-");
String[] workspaceNode2 = o2.getNodeCode().split("-");
if (o1.getNodeCode().contains("-M") || o2.getNodeCode().contains("-M")) {
if (!isInteger(o1.getNodeCode()) || !isInteger(o2.getNodeCode())) {
return 0;
}

View File

@@ -672,6 +672,16 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
return false;
}
public static boolean isInteger(String str) {
if (str == null || str.trim().isEmpty()) return false;
try {
Long.parseLong(str); // 支持前导零
return true;
} catch (NumberFormatException e) {
return false;
}
}
private void sortWorkspaceNode(ProjectNodePo projectNodePo) {
List<NodeAllBase> children = projectNodePo.getChildren();
if (CollectionUtils.isEmpty(children)) {
@@ -718,7 +728,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
workspaceNodeList.sort((o1, o2) -> {
if (o1.getNodeCode().contains("-M") || o2.getNodeCode().contains("-M")) {
if (!isInteger(o1.getNodeCode()) || !isInteger(o2.getNodeCode())) {
return 0;
}