From 641bf75f1b6684ee5b6d13497ad1106b82c59043 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 31 三月 2026 23:13:59 +0800
Subject: [PATCH] #入库同步串行请求

---
 src/main/java/com/zy/common/utils/NavigateUtils.java |   50 ++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/zy/common/utils/NavigateUtils.java b/src/main/java/com/zy/common/utils/NavigateUtils.java
index e867aa7..541c143 100644
--- a/src/main/java/com/zy/common/utils/NavigateUtils.java
+++ b/src/main/java/com/zy/common/utils/NavigateUtils.java
@@ -32,6 +32,7 @@
 import org.springframework.stereotype.Component;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.core.common.SpringUtils;
@@ -1224,18 +1225,46 @@
                     graph.computeIfAbsent(stationId, key -> new LinkedHashSet<>());
                     List<NavigateNode> nextNodeList = navigateSolution.extend_current_node(stationMap, node);
                     for (NavigateNode nextNode : safeList(nextNodeList)) {
-                        Integer nextStationId = extractStationId(nextNode);
-                        if (nextStationId == null || stationId.equals(nextStationId)) {
-                            continue;
+                        for (Integer nextStationId : resolveConnectedStationIds(stationId, nextNode)) {
+                            if (nextStationId == null || stationId.equals(nextStationId)) {
+                                continue;
+                            }
+                            graph.computeIfAbsent(nextStationId, key -> new LinkedHashSet<>());
+                            graph.get(stationId).add(nextStationId);
+                            graph.get(nextStationId).add(stationId);
                         }
-                        graph.computeIfAbsent(nextStationId, key -> new LinkedHashSet<>());
-                        graph.get(stationId).add(nextStationId);
-                        graph.get(nextStationId).add(stationId);
                     }
                 }
             }
         }
         return graph;
+    }
+
+    private Set<Integer> resolveConnectedStationIds(Integer currentStationId, NavigateNode nextNode) {
+        Set<Integer> stationIdSet = new LinkedHashSet<>();
+        if (nextNode == null || nextNode.getNodeValue() == null) {
+            return stationIdSet;
+        }
+        try {
+            JSONObject value = JSON.parseObject(nextNode.getNodeValue());
+            if (value == null) {
+                return stationIdSet;
+            }
+            Integer directStationId = value.getInteger("stationId");
+            if (directStationId != null && !directStationId.equals(currentStationId)) {
+                stationIdSet.add(directStationId);
+            }
+            JSONArray bridgeStationIds = value.getJSONArray("bridgeStationIds");
+            if (bridgeStationIds != null) {
+                for (Integer bridgeStationId : bridgeStationIds.toJavaList(Integer.class)) {
+                    if (bridgeStationId != null && !bridgeStationId.equals(currentStationId)) {
+                        stationIdSet.add(bridgeStationId);
+                    }
+                }
+            }
+        } catch (Exception ignore) {
+        }
+        return stationIdSet;
     }
 
     private List<Integer> loadStationLevList() {
@@ -1965,8 +1994,8 @@
     }
 
     private List<NavigateNode> normalizeStationPath(List<NavigateNode> path) {
-        HashSet<Integer> stationIdSet = new HashSet<>();
         List<NavigateNode> filterList = new ArrayList<>();
+        Integer lastStationId = null;
         for (NavigateNode navigateNode : safeList(path)) {
             if (navigateNode == null) {
                 continue;
@@ -1981,9 +2010,14 @@
                 continue;
             }
             Integer stationId = valueObject.getInteger("stationId");
-            if (stationId == null || !stationIdSet.add(stationId)) {
+            if (stationId == null) {
                 continue;
             }
+            // 浠呭帇缂╄繛缁噸澶嶇珯鐐癸紝淇濈暀鐜嚎閲嶇畻鍦烘櫙涓嬪悗缁啀娆$粡杩囩殑鍚屼竴绔欑偣銆�
+            if (lastStationId != null && lastStationId.equals(stationId)) {
+                continue;
+            }
+            lastStationId = stationId;
             NavigateNode clonedNode = navigateNode.clone();
             if (clonedNode == null) {
                 continue;

--
Gitblit v1.9.1