Merge remote-tracking branch 'origin/master'

# Conflicts:
#	auto-solution-admin/src/main/java/com/solution/web/controller/rule/RuleController.java
#	auto-solution-common/src/main/java/com/solution/common/constant/PlatformAndModuleConstants.java
#	pom.xml
This commit is contained in:
MHW
2026-03-13 14:41:41 +08:00
47 changed files with 971 additions and 135 deletions

View File

@@ -87,9 +87,12 @@ public class BehaviortreeProcessor {
// 插入节点 treenodeinstance
Map<String, Treenodeinstance> instanceKeyMap = new HashMap<>();
Map<String, Long> nodeKeyIndexMap = new HashMap<>();
Map<String,GraphNode> 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<String,GraphNode> nodesMap,
Map<String, Treenodeinstance> instanceKeyMap,
Map<String, Long> 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;
}

View File

@@ -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;
}
}