From f953070108efe8d06ccd0c04b92c51a78f03d349 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 07 七月 2025 16:41:42 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/fake/FakeNyShuttleThread.java |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/fake/FakeNyShuttleThread.java b/src/main/java/com/zy/core/thread/fake/FakeNyShuttleThread.java
index c0de4e0..5fd0464 100644
--- a/src/main/java/com/zy/core/thread/fake/FakeNyShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/fake/FakeNyShuttleThread.java
@@ -2,8 +2,8 @@
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.zy.common.Cools;
 import com.zy.common.SpringUtils;
-import com.zy.common.exception.CoolException;
 import com.zy.common.utils.RedisUtil;
 import com.zy.core.News;
 import com.zy.core.ThreadHandler;
@@ -27,7 +27,7 @@
 
 
     private RedisUtil redisUtil;
-    private JSONObject fakeStatusDemo = JSONObject.parseObject("{\"mode\":1,\"extend\":{\"countQuantity\":400,\"suspendState\":0,\"minCellVoltage\":3279,\"chargeCycleTimes\":0,\"maxCellVoltage\":3281,\"surplusQuantity\":204,\"voltage\":5248},\"hasLift\":false,\"hasPallet\":false,\"batteryVoltage\":5248,\"runDirection\":\"2\",\"currentCode\":\"{\\\"x\\\":12,\\\"y\\\":37,\\\"z\\\":3}\",\"errorCode\":\"0\",\"hasCharge\":false,\"batteryPower\":\"51\",\"speed\":0,\"deviceStatus\":1}");
+    private JSONObject fakeStatusDemo = JSONObject.parseObject("{\"mode\":1,\"extend\":{\"countQuantity\":400,\"suspendState\":0,\"minCellVoltage\":3279,\"chargeCycleTimes\":0,\"maxCellVoltage\":3281,\"surplusQuantity\":204,\"voltage\":5248},\"hasLift\":false,\"hasPallet\":false,\"batteryVoltage\":5248,\"runDirection\":\"2\",\"currentCode\":\"{\\\"x\\\":19,\\\"y\\\":11,\\\"z\\\":2}\",\"errorCode\":\"0\",\"hasCharge\":false,\"batteryPower\":\"51\",\"speed\":0,\"deviceStatus\":1}");
     private HashMap<String, Socket> fakeServerMap = new HashMap();
     private HashMap<String, JSONObject> fakeStatusMap = new HashMap();
 
@@ -77,8 +77,14 @@
                     try {
                         ServerSocket serverSocket = new ServerSocket(device.getPort());
                         Socket fakeSocket = serverSocket.accept();
+
+                        String fakeStatus = JSON.toJSONString(fakeStatusDemo);
+                        if (!Cools.isEmpty(device.getFakeInitStatus())) {
+                            fakeStatus = device.getFakeInitStatus();
+                        }
+
                         fakeServerMap.put(String.valueOf(SlaveType.Shuttle) + device.getDeviceNo(), fakeSocket);
-                        fakeStatusMap.put(String.valueOf(SlaveType.Shuttle) + device.getDeviceNo(), JSON.parseObject(JSON.toJSONString(fakeStatusDemo)));
+                        fakeStatusMap.put(String.valueOf(SlaveType.Shuttle) + device.getDeviceNo(), JSON.parseObject(fakeStatus));
                         while (true) {
                             if(fakeSocket == null) {
                                 fakeServerMap.remove(String.valueOf(SlaveType.Shuttle) + device.getDeviceNo());

--
Gitblit v1.9.1