From c4b6b51afdd3374735ed5f358457987eaa6e476f Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期五, 05 九月 2025 16:55:20 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/utils/NavigatePositionConvert.java |   59 +++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/zy/common/utils/NavigatePositionConvert.java b/src/main/java/com/zy/common/utils/NavigatePositionConvert.java
index ac71260..b6a473c 100644
--- a/src/main/java/com/zy/common/utils/NavigatePositionConvert.java
+++ b/src/main/java/com/zy/common/utils/NavigatePositionConvert.java
@@ -6,6 +6,9 @@
 import com.zy.asrs.service.LocMastService;
 import com.zy.asrs.utils.Utils;
 import com.zy.common.model.NavigateNode;
+import com.zy.core.enums.RedisKeyType;
+
+import java.util.HashMap;
 
 /**
  * 搴撲綅缂栧彿鍜孉*绠楁硶鐨剎y杞磋浆鎹㈠伐鍏风被
@@ -14,29 +17,53 @@
 
     public static String xyToPosition(int x, int y, int z) {
         String locNo = Utils.getLocNo(x, y, z);
+        String code = null;
 
-        //搴撲綅鍙疯浆灏忚溅浜岀淮鐮�
-        LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
-        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
-                .eq("loc_no", locNo)
-                .eq("status", 1));
-        if (locMast == null) {
-            return null;
+        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
+        Object object = redisUtil.get(RedisKeyType.POINT_MAP.key);
+
+        if(object == null) {
+            //搴撲綅鍙疯浆灏忚溅浜岀淮鐮�
+            LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
+            LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
+                    .eq("loc_no", locNo)
+                    .eq("status", 1));
+            if (locMast == null) {
+                return null;
+            }
+
+            code = locMast.getQrCodeValue();
+        }else {
+            HashMap<String, String> cache = (HashMap<String, String>) object;
+            code = cache.get(locNo);
         }
-        return locMast.getQrCodeValue();
+        return code;
     }
 
     //灏忚溅鏉″舰鐮佽浆璺緞绠楁硶鑺傜偣
     public static NavigateNode codeToNode(String code) {
-        LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
-        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
-                .eq("qr_code_value", code)
-                .eq("status", 1));
-        if (locMast == null) {
-            return null;
+        NavigateNode node = null;
+
+        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
+        Object object = redisUtil.get(RedisKeyType.LOC_MAP.key);
+
+        if (object == null) {
+            LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
+            LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
+                    .eq("qr_code_value", code)
+                    .eq("status", 1));
+            if (locMast == null) {
+                return null;
+            }
+            node = new NavigateNode(locMast.getRow1(), locMast.getBay1());
+            node.setZ(locMast.getLev1());
+        } else {
+            HashMap<String, String> cache = (HashMap<String, String>) object;
+            String locNo = cache.get(code);
+
+            node = new NavigateNode(Utils.getRow(locNo), Utils.getBay(locNo));
+            node.setZ(Utils.getLev(locNo));
         }
-        NavigateNode node = new NavigateNode(locMast.getRow1(), locMast.getBay1());
-        node.setZ(locMast.getLev1());
         return node;
     }
 

--
Gitblit v1.9.1