From 6e4ea35877963ef0787830ff61d6351d0baa1359 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期日, 12 四月 2026 17:45:59 +0800
Subject: [PATCH] #日志采集优化

---
 src/main/java/com/zy/core/utils/DeviceLogRedisKeyBuilder.java |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/zy/core/utils/DeviceLogRedisKeyBuilder.java b/src/main/java/com/zy/core/utils/DeviceLogRedisKeyBuilder.java
index 6666a60..4c1dd53 100644
--- a/src/main/java/com/zy/core/utils/DeviceLogRedisKeyBuilder.java
+++ b/src/main/java/com/zy/core/utils/DeviceLogRedisKeyBuilder.java
@@ -2,6 +2,7 @@
 
 import com.zy.asrs.entity.DeviceDataLog;
 import com.zy.core.enums.RedisKeyType;
+import com.zy.core.enums.SlaveType;
 
 import java.util.UUID;
 
@@ -14,10 +15,19 @@
         String deviceNo = deviceDataLog == null || deviceDataLog.getDeviceNo() == null
                 ? "unknown"
                 : String.valueOf(deviceDataLog.getDeviceNo());
+        String stationPart = buildStationPart(deviceDataLog, type);
         long millis = deviceDataLog != null && deviceDataLog.getCreateTime() != null
                 ? deviceDataLog.getCreateTime().getTime()
                 : System.currentTimeMillis();
         String uuid = UUID.randomUUID().toString().replace("-", "");
-        return RedisKeyType.DEVICE_LOG_KEY.key + type + ":" + deviceNo + ":" + millis + ":" + uuid;
+        return RedisKeyType.DEVICE_LOG_KEY.key + type + ":" + deviceNo + stationPart + ":" + millis + ":" + uuid;
+    }
+
+    private static String buildStationPart(DeviceDataLog deviceDataLog, String type) {
+        if (!String.valueOf(SlaveType.Devp).equals(type)) {
+            return "";
+        }
+        Integer stationId = deviceDataLog == null ? null : deviceDataLog.getStationId();
+        return stationId == null ? ":station:unknown" : ":station:" + stationId;
     }
 }

--
Gitblit v1.9.1