From 409b5ac5a3b160eacb1fefa6a10bf97b5f6860d7 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期三, 02 九月 2026 17:41:22 +0800
Subject: [PATCH] 实现采集器实时扩展测量接收

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TestDataQueryServiceImpl.java |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 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 1c8fffb..b8fcfd2 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
@@ -28,7 +28,12 @@
     @Override public List<Map<String, Object>> records(Long testId)
     {
         requireTest(testId);
-        return applyEffectiveData(testId, "REALTIME", mapper.selectPersistedRecords(testId));
+        List<Map<String, Object>> source = new java.util.ArrayList<>();
+        List<Map<String, Object>> cabinet = mapper.selectPersistedRecords(testId);
+        List<Map<String, Object>> collector = mapper.selectPersistedCollectorRecords(testId);
+        if (cabinet != null) source.addAll(cabinet);
+        if (collector != null) source.addAll(collector);
+        return applyEffectiveData(testId, "REALTIME", source);
     }
 
     @Override public List<Map<String, Object>> steps(Long testId)
@@ -96,6 +101,9 @@
 
     private String stableIdentity(String dataType, Map<String, Object> row)
     {
+        if ("REALTIME".equals(dataType) && "COLLECTOR".equals(String.valueOf(row.get("sourceType"))))
+            return String.join(":", "collector", identityPart(row, "collectorId"),
+                    identityPart(row, "channelCode"), value(row, "sequenceId"), identityPart(row, "metricCode"));
         String adapterId = identityPart(row, "adapterId");
         String devtype = identityPart(row, "devtype");
         String deviceId = identityPart(row, "deviceId");

--
Gitblit v1.7.1