From c2dd019c1fddaeae412e2b6f44fb86ff0dc635d4 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期三, 02 九月 2026 22:08:16 +0800
Subject: [PATCH] 实现主动轮询完整实时快照

---
 ruoyi-system/src/main/java/com/ruoyi/system/mapper/TTestMapper.java |   39 ++++++++++++++++++++-------------------
 1 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TTestMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TTestMapper.java
index 0bd548a..6374fd2 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TTestMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TTestMapper.java
@@ -51,10 +51,24 @@
     List<TTestChannelBinding> selectTestChannelBindings(Long testId);
     List<TTestCollectorChannel> selectTestCollectorChannels(Long testId);
     List<TTestWarningThreshold> selectTestThresholds(Long testId);
-    /** 按来源和起始边界顺序返回测试接收区间。 */
     /** 查询当前正在接收的测试,供接收调度绑定测试事实。 */
     List<Long> selectReceivingTestIds();
+    int insertRealtimeSnapshot(@Param("testId") Long testId, @Param("bindingId") Long bindingId,
+            @Param("channelId") Long channelId, @Param("collectorId") Long collectorId,
+            @Param("captureSlotUtc") Date captureSlotUtc, @Param("cabinetSequenceId") Long cabinetSequenceId,
+            @Param("cabinetDeviceTimeUtc") Date cabinetDeviceTimeUtc, @Param("cabinetDeviceTimeRaw") String cabinetDeviceTimeRaw,
+            @Param("collectorSequenceId") Long collectorSequenceId, @Param("collectorDeviceTimeUtc") Date collectorDeviceTimeUtc,
+            @Param("collectorDeviceTimeRaw") String collectorDeviceTimeRaw, @Param("serverReceivedAtUtc") Date serverReceivedAtUtc,
+            @Param("cycleNo") Integer cycleNo, @Param("stepNo") Integer stepNo, @Param("stepType") String stepType,
+            @Param("stepName") String stepName, @Param("voltageV") java.math.BigDecimal voltageV,
+            @Param("currentA") java.math.BigDecimal currentA, @Param("capacityAh") java.math.BigDecimal capacityAh,
+            @Param("energyWh") java.math.BigDecimal energyWh, @Param("temperature") java.math.BigDecimal temperature,
+            @Param("positivePotential") java.math.BigDecimal positivePotential,
+            @Param("negativePotential") java.math.BigDecimal negativePotential,
+            @Param("extensionMeasurementsJson") String extensionMeasurementsJson, @Param("contentSha256") byte[] contentSha256);
+    List<java.util.Map<String, Object>> selectPersistedRealtimeSnapshots(@Param("testId") Long testId);
     List<java.util.Map<String, Object>> selectPersistedRecords(@org.apache.ibatis.annotations.Param("testId") Long testId);
+    List<java.util.Map<String, Object>> selectPersistedCollectorRecords(@org.apache.ibatis.annotations.Param("testId") Long testId);
     List<java.util.Map<String, Object>> selectPersistedSteps(@org.apache.ibatis.annotations.Param("testId") Long testId);
     List<java.util.Map<String, Object>> selectPersistedCycles(@org.apache.ibatis.annotations.Param("testId") Long testId);
     List<TTestResult> selectTestResults(TTestResult result);
@@ -79,13 +93,8 @@
 
     /** 锁定检测柜通道的最新可观测事实,供开始接收校验使用。 */
     TDetectionChannel selectReceptionChannelForUpdate(Long channelId);
-    /** 锁定当前检测柜通道租约;返回空表示可接入。 */
-    /** 为每个绑定来源追加一个开放接收区间;区间关闭后仅保留历史事实。 */
-    /** 在停止动作事务内关闭该测试全部开放区间,返回实际关闭数量。 */
     int hasReceivingTestForAdapter(@Param("adapterCode") String adapterCode);
-    int hasPausedOrEndedTestForAdapter(@Param("adapterCode") String adapterCode);
     List<TDetectionChannel> selectReceivingChannelsForAdapter(@Param("adapterCode") String adapterCode);
-    boolean collectorOnline(Long collectorId);
     int updateReceptionStarted(@Param("testId") Long testId, @Param("startedAtUtc") Date startedAtUtc,
             @Param("runtimeAttach") boolean runtimeAttach, @Param("updateBy") String updateBy);
     int updateReceptionPaused(@Param("testId") Long testId, @Param("updateBy") String updateBy,
@@ -95,18 +104,11 @@
     int updateReceptionStopped(@Param("testId") Long testId, @Param("updateBy") String updateBy,
             @Param("endedAtUtc") Date endedAtUtc);
 
-    /** 查询仍在接收中的采集器来源。 */
-    /** 查询来源当前开放的断线区间。 */
     String selectBtsSampleContentHash(@Param("channelId") Long channelId, @Param("btsTestId") String btsTestId,
             @Param("sequenceId") Long sequenceId);
 
-    /** 查询需要自然结束或继续补采的测试。 */
-    /** 按稳定来源身份锁定补采游标,避免应用重启重复推进。 */
-    /** 按测试事实查询通道序号,避免补采重复写入已即时接收的采样。 */
-    String selectTestSampleContentHash(@Param("testId") Long testId, @Param("channelId") Long channelId,
-            @Param("sequenceId") Long sequenceId);
     int insertBtsSample(@Param("testId") Long testId, @Param("bindingId") Long bindingId,
-            @Param("channelId") Long channelId, @Param("intervalId") Long intervalId,
+            @Param("channelId") Long channelId,
             @Param("btsTestId") String btsTestId, @Param("sequenceId") Long sequenceId,
             @Param("deviceTimeUtc") Date deviceTimeUtc, @Param("deviceTimeRaw") String deviceTimeRaw,
             @Param("receivedAtUtc") Date receivedAtUtc, @Param("cycleNo") Integer cycleNo,
@@ -117,17 +119,14 @@
     int insertBtsMeasurement(@Param("sampleId") Long sampleId, @Param("metricCode") String metricCode,
             @Param("metricValue") java.math.BigDecimal metricValue, @Param("unit") String unit,
             @Param("sourceType") String sourceType);
-    Long selectBtsSampleId(@Param("channelId") Long channelId, @Param("btsTestId") String btsTestId,
-            @Param("sequenceId") Long sequenceId);
     int insertCollectorSample(@Param("testId") Long testId, @Param("bindingId") Long bindingId,
-            @Param("intervalId") Long intervalId, @Param("collectorId") Long collectorId,
+            @Param("collectorId") Long collectorId,
+            @Param("adapterCode") String adapterCode,
             @Param("channelCode") String channelCode,
             @Param("sequenceId") Long sequenceId, @Param("deviceTimeUtc") Date deviceTimeUtc,
             @Param("deviceTimeRaw") String deviceTimeRaw, @Param("receivedAtUtc") Date receivedAtUtc,
             @Param("metricCode") String metricCode, @Param("metricValue") java.math.BigDecimal metricValue,
             @Param("unit") String unit, @Param("contentSha256") byte[] contentSha256);
-    Long selectCollectorSampleId(@Param("collectorId") Long collectorId, @Param("channelCode") String channelCode,
-            @Param("sequenceId") Long sequenceId, @Param("metricCode") String metricCode);
     String selectCollectorSampleContentHash(@Param("collectorId") Long collectorId,
             @Param("channelCode") String channelCode, @Param("sequenceId") Long sequenceId,
             @Param("metricCode") String metricCode);
@@ -137,6 +136,8 @@
     int upsertDataOverride(TTestDataOverride override);
     List<TTestDataOverride> selectDataOverrides(@Param("testId") Long testId,
             @Param("dataType") String dataType);
+    List<java.util.Map<String, Object>> selectConsoleImportRecords(@Param("testId") Long testId,
+            @Param("dataType") String dataType);
     int deleteBtsSamplesByIds(@Param("testId") Long testId, @Param("sampleIds") List<Long> sampleIds);
     int deleteBtsMeasurementsBySampleIds(@Param("sampleIds") List<Long> sampleIds);
     int deleteCollectorSamplesByIds(@Param("testId") Long testId, @Param("sampleIds") List<Long> sampleIds);

--
Gitblit v1.7.1