From 4220194f54535388daad46136f8da0452441b806 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期三, 02 九月 2026 14:09:58 +0800
Subject: [PATCH] 补齐控制台来源身份与时间字段

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TestDataQueryServiceImpl.java |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TestDataQueryServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TestDataQueryServiceImpl.java
index c0184c6..51fcfb8 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TestDataQueryServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TestDataQueryServiceImpl.java
@@ -81,18 +81,27 @@
 
     private String stableIdentity(String dataType, Map<String, Object> row)
     {
-        String deviceId = value(row, "deviceId");
-        String channelId = value(row, "channelId");
+        String adapterId = identityPart(row, "adapterId");
+        String devtype = identityPart(row, "devtype");
+        String deviceId = identityPart(row, "deviceId");
+        String subdevid = identityPart(row, "subdevid");
+        String channelId = identityPart(row, "channelId");
         String cycleNo = value(row, "cycleNo");
-        if ("REALTIME".equals(dataType)) return deviceId + ":" + channelId + ":" + value(row, "sequenceId");
-        if ("STEP".equals(dataType)) return "step:" + deviceId + ":" + channelId + ":" + cycleNo + ":" + value(row, "stepNo");
-        return "cycle:" + deviceId + ":" + channelId + ":" + cycleNo;
+        String channelIdentity = String.join(":", adapterId, devtype, deviceId, subdevid, channelId);
+        if ("REALTIME".equals(dataType)) return channelIdentity + ":" + value(row, "sequenceId");
+        if ("STEP".equals(dataType)) return "step:" + channelIdentity + ":" + cycleNo + ":" + value(row, "stepNo");
+        return "cycle:" + channelIdentity + ":" + cycleNo;
+    }
+
+    private String identityPart(Map<String, Object> row, String key)
+    {
+        Object value = row == null ? null : row.get(key);
+        return value == null ? "" : String.valueOf(value);
     }
 
     private String value(Map<String, Object> row, String key)
     {
-        Object value = row == null ? null : row.get(key);
-        return value == null ? "" : String.valueOf(value);
+        return identityPart(row, key);
     }
 
     private void requireTest(Long testId)

--
Gitblit v1.7.1