Junjie
1 天以前 e0cee09916a315d6012b8d44b4c493c4f3adc5d1
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,13 +1225,14 @@
                    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);
                    }
                }
            }
@@ -1238,6 +1240,33 @@
        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() {
        List<Integer> levList = new ArrayList<>();
        if (basStationService == null) {