From ec5a96479a750b1714b33a53f1b86394c9f87433 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 30 六月 2025 15:00:39 +0800
Subject: [PATCH] #

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

diff --git a/src/main/java/com/zy/common/utils/NavigateUtils.java b/src/main/java/com/zy/common/utils/NavigateUtils.java
index bf19aa9..4074614 100644
--- a/src/main/java/com/zy/common/utils/NavigateUtils.java
+++ b/src/main/java/com/zy/common/utils/NavigateUtils.java
@@ -3,6 +3,7 @@
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.core.common.SpringUtils;
+import com.core.exception.CoolException;
 import com.zy.asrs.utils.Utils;
 import com.zy.common.model.MapNode;
 import com.zy.common.model.NavigateNode;
@@ -187,6 +188,54 @@
         return list;
     }
 
+    //璁$畻甯︽湯绔钀借矾寰�
+    public ArrayList<ArrayList<NavigateNode>> calcEndPath(String startPoint, String endPoint, Integer mapType, List<int[]> shuttlePoints, List<int[]> whites, int lastPathPart) {
+        //璁$畻璺緞
+        List<NavigateNode> navigateNodes = calc(startPoint, endPoint, mapType, shuttlePoints, whites);
+        if (navigateNodes == null) {
+            News.error("{} dash {} can't find navigate path!", startPoint, endPoint);
+            return null;
+        }
+
+        //鑾峰彇鍒嗘璺緞
+        ArrayList<ArrayList<NavigateNode>> partList = this.getSectionPath(navigateNodes);
+        //鏍规嵁浼犲叆鐨勬湯绔钀借矾寰勶紝鎵惧埌鏈鐐逛綅
+        int partResult = partList.size() - lastPathPart;
+        if (partResult == 0) {//璺緞鏁伴噺鐩稿悓鏃犻渶鍒嗗壊
+            return partList;
+        } else if (partResult < 0) {
+            throw new CoolException("鍒嗘璺緞涓庢湯绔矾寰勬暟閲忚绠楀紓甯�");
+        }
+        int pathIdx = partResult - 1;
+        ArrayList<ArrayList<NavigateNode>> filterList = new ArrayList<>();
+        for (int i = 0; i <= pathIdx; i++) {
+            filterList.add(partList.get(i));
+        }
+        return filterList;
+    }
+
+    //璁$畻鏈娈佃惤鍦板潃
+    public String calcEndLocation(String startPoint, String endPoint, Integer mapType, List<int[]> shuttlePoints, List<int[]> whites, int lastPathPart) {
+        ArrayList<ArrayList<NavigateNode>> endPath = calcEndPath(startPoint, endPoint, mapType, shuttlePoints, whites, lastPathPart);
+        if (endPath == null) {
+            return null;
+        }
+
+        return findTargetLocation(endPath);
+    }
+
+    public String findTargetLocation(List<NavigateNode> nodeList) {
+        ArrayList<ArrayList<NavigateNode>> sectionPath = this.getSectionPath(nodeList);
+        return findTargetLocation(sectionPath);
+    }
+
+    public String findTargetLocation(ArrayList<ArrayList<NavigateNode>> partList) {
+        ArrayList<NavigateNode> nodes = partList.get(partList.size() - 1);
+        NavigateNode targetNode = nodes.get(nodes.size() - 1);
+        String locNo = NavigatePositionConvert.nodeToLocNo(targetNode);
+        return locNo;
+    }
+
     //鍒ゆ柇褰撳墠鑺傜偣鍒颁笅涓�涓妭鐐规槸鍚︿负鎷愮偣
     public HashMap<String,Object> searchInflectionPoint(NavigateNode currentNode, NavigateNode fatherNode, NavigateNode nextNode) {
         HashMap<String, Object> map = new HashMap<>();

--
Gitblit v1.9.1