From 5a7b57d603f66184b4172858e76f8c352e44630a Mon Sep 17 00:00:00 2001 From: libertyspy Date: Fri, 13 Mar 2026 10:42:39 +0800 Subject: [PATCH] UPDATE: VERSION-20260313 --- .../web/core/BehaviortreeProcessor.java | 19 ++++++++++++++++--- .../solution/web/core/graph/GraphNode.java | 10 ++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/auto-solution-admin/src/main/java/com/solution/web/core/BehaviortreeProcessor.java b/auto-solution-admin/src/main/java/com/solution/web/core/BehaviortreeProcessor.java index b857905..d91fd67 100644 --- a/auto-solution-admin/src/main/java/com/solution/web/core/BehaviortreeProcessor.java +++ b/auto-solution-admin/src/main/java/com/solution/web/core/BehaviortreeProcessor.java @@ -87,9 +87,12 @@ public class BehaviortreeProcessor { // 插入节点 treenodeinstance Map instanceKeyMap = new HashMap<>(); Map nodeKeyIndexMap = new HashMap<>(); + Map nodesMap = new HashMap<>(); if (graph.hasNodes()) { Long index = 0L; for (GraphNode node : graph.getNodes()) { + nodesMap.put(node.getKey(), node); + Treenodeinstance instance = createNodeInstance(behaviortree, node); treenodeinstanceService.insertTreenodeinstance(instance); instanceKeyMap.put(node.getKey(), instance); @@ -110,16 +113,18 @@ public class BehaviortreeProcessor { // 插入连线 nodeconnection if (graph.hasEdges()) { for (GraphEdge edge : graph.getEdges()) { - Nodeconnection connection = createConnection(behaviortree, edge, instanceKeyMap, nodeKeyIndexMap); + Nodeconnection connection = createConnection(behaviortree, edge, nodesMap, instanceKeyMap, nodeKeyIndexMap); nodeconnectionService.insertNodeconnection(connection); } } } private Nodeconnection createConnection(Behaviortree behaviortree, GraphEdge edge, + Map nodesMap, Map instanceKeyMap, Map nodeKeyIndexMap) { Nodeconnection connection = new Nodeconnection(); + Long orderIndex = 0L; connection.setTreeId(behaviortree.getId()); if (null != instanceKeyMap.get(edge.getSource().getCell())) { Treenodeinstance parent = instanceKeyMap.get(edge.getSource().getCell()); @@ -129,9 +134,17 @@ public class BehaviortreeProcessor { Treenodeinstance children = instanceKeyMap.get(edge.getTarget().getCell()); connection.setChildNodeId(children.getId()); } - if (null != nodeKeyIndexMap.get(edge.getSource().getCell())) { - connection.setOrderIndex(nodeKeyIndexMap.get(edge.getSource().getCell())); + + if (null != nodesMap.get(edge.getTarget().getCell())) { + orderIndex = nodesMap.get(edge.getTarget().getCell()).getOrder(); } + if(null == orderIndex){ + orderIndex = 0L; + } +// if (null != nodeKeyIndexMap.get(edge.getSource().getCell())) { +// connection.setOrderIndex(nodeKeyIndexMap.get(edge.getSource().getCell())); +// } + connection.setOrderIndex(orderIndex); return connection; } diff --git a/auto-solution-admin/src/main/java/com/solution/web/core/graph/GraphNode.java b/auto-solution-admin/src/main/java/com/solution/web/core/graph/GraphNode.java index e94aab3..71f3d2a 100644 --- a/auto-solution-admin/src/main/java/com/solution/web/core/graph/GraphNode.java +++ b/auto-solution-admin/src/main/java/com/solution/web/core/graph/GraphNode.java @@ -23,6 +23,8 @@ public class GraphNode implements Serializable { private String type; + private Long order; + private String key; private String name; @@ -139,4 +141,12 @@ public class GraphNode implements Serializable { this.variables = variables; } + public Long getOrder() { + return order; + } + + public void setOrder(Long order) { + this.order = order; + } + }