From a68bf17ab81df98882e19b79628e6876bb260468 Mon Sep 17 00:00:00 2001
From: zc <zc@123>
Date: 星期三, 18 六月 2025 10:04:26 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/fyxc_shuttle_wcs' into fyxc_shuttle_wcs

---
 src/main/java/com/zy/common/utils/NavigateUtils.java |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/zy/common/utils/NavigateUtils.java b/src/main/java/com/zy/common/utils/NavigateUtils.java
index 6528cc3..f2ec05d 100644
--- a/src/main/java/com/zy/common/utils/NavigateUtils.java
+++ b/src/main/java/com/zy/common/utils/NavigateUtils.java
@@ -10,12 +10,16 @@
 import com.zy.core.News;
 import com.zy.core.enums.MapNodeType;
 import com.zy.core.model.PythonSimilarityResult;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
 
 /**
  * A*绠楁硶浣跨敤宸ュ叿
@@ -25,9 +29,10 @@
 
     @Value("${pythonCalcPath}")
     private String pythonCalcPath;
-
     @Value("${pythonCalcSimilarity}")
     private String pythonCalcSimilarity;
+    @Autowired
+    private NavigateMapData navigateMapData;
 
     public List<NavigateNode> calc(String startPoint, String endPoint, Integer mapType, List<int[]> shuttlePoints, List<int[]> whites) {
         return calcJava(startPoint, endPoint, mapType, shuttlePoints, whites);
@@ -46,14 +51,17 @@
 
         //鑾峰彇褰撳墠鑺傜偣璁$畻鐨勫眰楂橈紝骞惰祴鍊煎埌姣忎竴涓妭鐐逛腑
         int lev = Utils.getLev(startPoint);
+        NavigateSolution solution = new NavigateSolution(mapType, lev, whiteList, shuttlePoints);
+        int[][] map = solution.map;
 
         //鍒濆鍖栧紑濮嬭妭鐐�
         NavigateNode start = new NavigateNode(startArr[0], startArr[1]);
         //寮�濮嬭妭鐐规棤鐖惰妭鐐�
         start.setFather(null);
+        start.setNodeValue(map[startArr[0]][startArr[1]]);
 
         NavigateNode end = new NavigateNode(endArr[0], endArr[1]);
-        NavigateSolution solution = new NavigateSolution(mapType, lev, whiteList, shuttlePoints);
+        end.setNodeValue(map[endArr[0]][endArr[1]]);
         //寮�濮嬭妭鐐癸紝涓嶇撼鍏ョ鐢ㄨ妭鐐瑰唴璁$畻
 
         NavigateNode res_node = solution.astarSearchJava(start, end);
@@ -116,14 +124,17 @@
 
         //鑾峰彇褰撳墠鑺傜偣璁$畻鐨勫眰楂橈紝骞惰祴鍊煎埌姣忎竴涓妭鐐逛腑
         int lev = Utils.getLev(startPoint);
+        NavigateSolution solution = new NavigateSolution(mapType, lev, whiteList, shuttlePoints);
+        int[][] map = solution.map;
 
         //鍒濆鍖栧紑濮嬭妭鐐�
         NavigateNode start = new NavigateNode(startArr[0], startArr[1]);
+        start.setNodeValue(map[startArr[0]][startArr[1]]);
         //寮�濮嬭妭鐐规棤鐖惰妭鐐�
         start.setFather(null);
 
         NavigateNode end = new NavigateNode(endArr[0], endArr[1]);
-        NavigateSolution solution = new NavigateSolution(mapType, lev, whiteList, shuttlePoints);
+        end.setNodeValue(map[endArr[0]][endArr[1]]);
         //寮�濮嬭妭鐐癸紝涓嶇撼鍏ョ鐢ㄨ妭鐐瑰唴璁$畻
 
         String pathStr = solution.astarSearchPython(start, end, pythonCalcPath);
@@ -180,7 +191,7 @@
     }
 
     //鍒ゆ柇褰撳墠鑺傜偣鍒颁笅涓�涓妭鐐规槸鍚︿负鎷愮偣
-    public HashMap<String,Object> searchInflectionPoint(NavigateNode currentNode, NavigateNode fatherNode, NavigateNode nextNode) {
+    public HashMap<String, Object> searchInflectionPoint(NavigateNode currentNode, NavigateNode fatherNode, NavigateNode nextNode) {
         HashMap<String, Object> map = new HashMap<>();
         map.put("result", false);//鏄惁涓烘嫄鐐癸紝true锛氭嫄鐐癸紝false锛氱洿绾�
         // 绗竴涓偣鎴栫洿绾跨偣
@@ -210,7 +221,7 @@
             if (currentNode.getX() - fatherNode.getX() > 0) {
                 //澶т簬0锛屾柟鍚憈op
                 direction = "top";
-            }else {
+            } else {
                 //灏忎簬0锛屾柟鍚慴ottom
                 direction = "bottom";
             }
@@ -222,7 +233,7 @@
             if (currentNode.getY() - fatherNode.getY() > 0) {
                 //澶т簬0锛屾柟鍚憀eft
                 direction = "left";
-            }else {
+            } else {
                 //灏忎簬0锛屾柟鍚憆ight
                 direction = "right";
             }
@@ -346,8 +357,7 @@
      * 妫�娴嬭矾寰勬槸鍚﹀彲鐢�(鍙蛋)
      */
     public boolean checkPathIsAvailable(List<NavigateNode> path, Integer shuttleNo, Integer lev) {
-        NavigateSolution solution = new NavigateSolution(NavigationMapType.DFX.id, lev, null, Utils.getShuttlePoints(shuttleNo, lev));//鑾峰彇鏃犵櫧鍚嶅崟鍦板浘(璇ュ湴鍥惧寘鍚皬杞﹀潗鏍�)
-        int[][] map = solution.map;
+        int[][] map = navigateMapData.getDataFromRedis(lev, NavigationMapType.DFX.id, null, Utils.getShuttlePoints(shuttleNo, lev));
         for (NavigateNode node : path) {
             int value = map[node.getX()][node.getY()];
             if (value != MapNodeType.NORMAL_PATH.id && value != MapNodeType.MAIN_PATH.id && value != MapNodeType.CHARGE.id && value != MapNodeType.CONVEYOR_CAR_GO.id) {//姣嶈建閬�3銆佸瓙杞ㄩ亾0銆佸厖鐢垫々5銆佸皬杞﹀彲璧拌緭閫佺珯

--
Gitblit v1.9.1