From a01cd9b188ec5e7e16baa5a79a647cd199043c5c Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 19 三月 2025 09:53:42 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/action/ShuttleAction.java |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/zy/core/action/ShuttleAction.java b/src/main/java/com/zy/core/action/ShuttleAction.java
index 67e1a26..f9fffa0 100644
--- a/src/main/java/com/zy/core/action/ShuttleAction.java
+++ b/src/main/java/com/zy/core/action/ShuttleAction.java
@@ -28,6 +28,7 @@
 import com.zy.core.model.command.ShuttleRedisCommand;
 import com.zy.core.model.protocol.ShuttleProtocol;
 import com.zy.core.thread.ShuttleThread;
+import com.zy.system.entity.Config;
 import com.zy.system.service.ConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -318,12 +319,29 @@
             return;
         }
 
-        String currentLocNo = shuttleProtocol.getCurrentLocNo();
-        int lev = Utils.getLev(currentLocNo);
+        boolean demoSwitchLev = false;
+        Config demoSwitchLevConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "demoSwitchLev"));
+        if (demoSwitchLevConfig != null) {
+            if (demoSwitchLevConfig.getValue().equals("Y")) {
+                demoSwitchLev = true;
+            }
+        }
+
+        Config demoRunLevConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "demoRunLev"));
+        if (demoRunLevConfig == null) {
+            return;
+        }
+        List<Integer> levList = JSON.parseArray(demoRunLevConfig.getValue(), Integer.class);
+
+        if (!demoSwitchLev) {
+            String currentLocNo = shuttleProtocol.getCurrentLocNo();
+            levList = new ArrayList<>();
+            levList.add(Utils.getLev(currentLocNo));
+        }
 
         LocMast targetLoc = null;
         EntityWrapper<LocMast> wrapper = new EntityWrapper<>();
-        wrapper.eq("lev1", lev);
+        wrapper.in("lev1", levList);
         wrapper.eq("loc_sts", "O");
         wrapper.last("ORDER BY RAND() LIMIT 1");
         for (int i = 0; i < 3; i++) {
@@ -340,6 +358,7 @@
             }
 
             targetLoc = locMast;
+            break;
         }
 
         if(targetLoc == null) {

--
Gitblit v1.9.1