From dc3f9cc91759823ce59486f19b138be4b296a0f1 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 28 四月 2026 09:43:28 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/utils/DeviceLogRedisKeyBuilder.java | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 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..23f2627 100644
--- a/src/main/java/com/zy/core/utils/DeviceLogRedisKeyBuilder.java
+++ b/src/main/java/com/zy/core/utils/DeviceLogRedisKeyBuilder.java
@@ -2,8 +2,7 @@
import com.zy.asrs.entity.DeviceDataLog;
import com.zy.core.enums.RedisKeyType;
-
-import java.util.UUID;
+import com.zy.core.enums.SlaveType;
public class DeviceLogRedisKeyBuilder {
@@ -14,10 +13,17 @@
String deviceNo = deviceDataLog == null || deviceDataLog.getDeviceNo() == null
? "unknown"
: String.valueOf(deviceDataLog.getDeviceNo());
- 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;
+ String stationPart = buildStationPart(deviceDataLog, type);
+ // 鏃ュ織鍙戝竷鍣ㄦ寜 lane 鍙繚鐣欐渶鏂板揩鐓э紝Redis key 蹇呴』绋冲畾锛屽惁鍒欎細鎶婃瘡娆¢噰鏍烽兘鍫嗘垚鐙珛 key锛�
+ // 璁� DeviceLogScheduler 鐨勬秷璐归�熷害姘歌繙杩戒笉涓婂啓鍏ラ�熷害锛屾渶缁堟妸 Redis 鍐呭瓨鎵撶垎銆�
+ return RedisKeyType.DEVICE_LOG_KEY.key + type + ":" + deviceNo + stationPart;
+ }
+
+ 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