From 76cd5948e95ddbde9dd4411b466ee75ba20b562e Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期四, 03 九月 2026 17:28:29 +0800
Subject: [PATCH] 实现测试预警异常管理
---
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TTestMapper.java | 130 +++++++++++++++++++++++++++++++-----------
1 files changed, 95 insertions(+), 35 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 2dd1aeb..e5a2f5f 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
@@ -11,10 +11,12 @@
import com.ruoyi.system.domain.TTestPlanStep;
import com.ruoyi.system.domain.TTestResult;
import com.ruoyi.system.domain.TTestWarningThreshold;
-import com.ruoyi.system.domain.TTestCollectorSource;
-import com.ruoyi.system.domain.TTestCollectorExceptionInterval;
-import com.ruoyi.system.domain.TTestReceptionInterval;
+import com.ruoyi.system.domain.TTestWarningException;
+import com.ruoyi.system.domain.TTestLogicStepMapping;
import com.ruoyi.system.domain.TDetectionChannel;
+import com.ruoyi.system.domain.TTestDataRevisionAction;
+import com.ruoyi.system.domain.TTestConsoleImportRecord;
+import com.ruoyi.system.domain.TTestDataOverride;
import com.ruoyi.system.domain.vo.TestBatteryOptionVo;
import com.ruoyi.system.domain.vo.TestChannelOptionVo;
import com.ruoyi.system.domain.vo.TestCollectorOptionVo;
@@ -50,15 +52,53 @@
List<TTestChannelBinding> selectTestChannelBindings(Long testId);
List<TTestCollectorChannel> selectTestCollectorChannels(Long testId);
List<TTestWarningThreshold> selectTestThresholds(Long testId);
- /** 按来源和起始边界顺序返回测试接收区间。 */
- List<TTestReceptionInterval> selectTestReceptionIntervals(Long testId);
+ /** 以测试、指标和阈值规则为开放异常键原子聚合成功接收的超限值。 */
+ int upsertWarningException(@Param("testId") Long testId, @Param("thresholdId") Long thresholdId,
+ @Param("sourceType") String sourceType, @Param("sourceIdentity") String sourceIdentity,
+ @Param("metricCode") String metricCode, @Param("value") java.math.BigDecimal value,
+ @Param("unit") String unit, @Param("ruleSnapshot") String ruleSnapshot,
+ @Param("severity") String severity, @Param("occurredAt") Date occurredAt);
+ /** 查询异常事实;不从设备状态或缺失数据推导异常。 */
+ List<TTestWarningException> selectWarningExceptions(@Param("testId") Long testId,
+ @Param("status") String status);
+ TTestWarningException selectWarningExceptionById(Long exceptionId);
+ /** 仅将开放异常转为已关闭,原始异常事实仍保留。 */
+ int closeWarningException(@Param("exceptionId") Long exceptionId, @Param("handledBy") Long handledBy,
+ @Param("handledByName") String handledByName, @Param("handledAt") Date handledAt,
+ @Param("handlingNote") String handlingNote);
+ /** 查询当前正在接收的测试,供接收调度绑定测试事实。 */
+ 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);
+ String selectLogicStepMappingsJson(Long testId);
+ int updateLogicStepMappings(@Param("testId") Long testId, @Param("mappingsJson") String mappingsJson,
+ @Param("updateBy") String updateBy, @Param("updateTime") Date updateTime);
+ int updateConsoleDetail(@Param("testId") Long testId, @Param("detailJson") String detailJson,
+ @Param("updateBy") String updateBy, @Param("updateTime") Date updateTime);
int countTestTypeEnabled(Long testTypeId);
int countUserEnabled(Long userId);
int countBatteryInEnabledGroup(@Param("groupId") Long groupId, @Param("batteryNo") String batteryNo);
int countRegisteredChannel(Long channelId);
int countCollectorEnabled(Long collectorId);
Integer selectCollectorChannelCount(Long collectorId);
+ String selectCollectorCode(Long collectorId);
List<TestUserOptionVo> selectEnabledUserOptions();
List<TestTypeOptionVo> selectEnabledTestTypeOptions();
List<TestBatteryOptionVo> selectEnabledBatteryOptions();
@@ -70,28 +110,8 @@
/** 锁定检测柜通道的最新可观测事实,供开始接收校验使用。 */
TDetectionChannel selectReceptionChannelForUpdate(Long channelId);
- /** 锁定当前检测柜通道租约;返回空表示可接入。 */
- TTestChannelBinding selectChannelLeaseForUpdate(Long channelId);
- int insertChannelLease(@Param("channelId") Long channelId, @Param("testId") Long testId,
- @Param("bindingId") Long bindingId, @Param("acquiredBy") Long acquiredBy,
- @Param("acquiredAtUtc") Date acquiredAtUtc);
- int insertCollectorChannelLease(@Param("collectorId") Long collectorId, @Param("channelCode") String channelCode,
- @Param("testId") Long testId, @Param("bindingId") Long bindingId,
- @Param("acquiredBy") Long acquiredBy, @Param("acquiredAtUtc") Date acquiredAtUtc);
- /** 为每个绑定来源追加一个开放接收区间;区间关闭后仅保留历史事实。 */
- int insertReceptionInterval(@Param("testId") Long testId, @Param("bindingId") Long bindingId,
- @Param("sourceType") String sourceType, @Param("sourceId") Long sourceId,
- @Param("sourceChannelCode") String sourceChannelCode, @Param("actionAtUtc") Date actionAtUtc,
- @Param("boundaryNote") String boundaryNote);
- /** 在停止动作事务内关闭该测试全部开放区间,返回实际关闭数量。 */
- int closeOpenReceptionIntervals(@Param("testId") Long testId, @Param("endBoundaryAtUtc") Date endBoundaryAtUtc,
- @Param("boundaryNote") String boundaryNote);
- int deleteChannelLeasesByTestId(Long testId);
- int deleteCollectorChannelLeasesByTestId(Long testId);
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,
@@ -101,14 +121,54 @@
int updateReceptionStopped(@Param("testId") Long testId, @Param("updateBy") String updateBy,
@Param("endedAtUtc") Date endedAtUtc);
- /** 查询仍在接收中的采集器来源。 */
- List<TTestCollectorSource> selectReceivingCollectorSources();
- /** 查询来源当前开放的断线区间。 */
- TTestCollectorExceptionInterval selectOpenCollectorException(@Param("testId") Long testId,
- @Param("batteryRelationId") Long batteryRelationId, @Param("collectorId") Long collectorId,
- @Param("channelCode") String channelCode);
- int insertCollectorExceptionInterval(TTestCollectorExceptionInterval interval);
- int closeCollectorExceptionInterval(@Param("intervalId") Long intervalId,
- @Param("recoveredAtUtc") Date recoveredAtUtc, @Param("missingToUtc") Date missingToUtc);
- List<TTestCollectorExceptionInterval> selectCollectorExceptionIntervals(Long testId);
+ String selectBtsSampleContentHash(@Param("channelId") Long channelId, @Param("btsTestId") String btsTestId,
+ @Param("sequenceId") Long sequenceId);
+
+ int insertBtsSample(@Param("testId") Long testId, @Param("bindingId") Long bindingId,
+ @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,
+ @Param("stepNo") Integer stepNo, @Param("stepType") String stepType, @Param("stepName") String stepName,
+ @Param("testTimeMs") Long testTimeMs, @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("contentSha256") byte[] contentSha256);
+ int insertBtsMeasurement(@Param("sampleId") Long sampleId, @Param("metricCode") String metricCode,
+ @Param("metricValue") java.math.BigDecimal metricValue, @Param("unit") String unit,
+ @Param("sourceType") String sourceType);
+ int insertCollectorSample(@Param("testId") Long testId, @Param("bindingId") Long bindingId,
+ @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);
+ String selectCollectorSampleContentHash(@Param("collectorId") Long collectorId,
+ @Param("channelCode") String channelCode, @Param("sequenceId") Long sequenceId,
+ @Param("metricCode") String metricCode);
+ int insertDataRevisionAction(TTestDataRevisionAction action);
+ List<TTestDataRevisionAction> selectDataRevisionActions(TTestDataRevisionAction query);
+ TTestDataRevisionAction selectDataRevisionActionById(Long actionId);
+ 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);
+ Long selectBtsSampleIdByDeviceChannelSequence(@Param("testId") Long testId,
+ @Param("deviceId") Long deviceId, @Param("channelNo") Long channelNo,
+ @Param("sequenceId") Long sequenceId);
+ List<Long> selectBtsSampleIdsByDeviceChannelStep(@Param("testId") Long testId,
+ @Param("deviceId") Long deviceId, @Param("channelNo") Long channelNo,
+ @Param("cycleNo") Integer cycleNo, @Param("stepNo") Integer stepNo);
+ List<Long> selectBtsSampleIdsByDeviceChannelCycle(@Param("testId") Long testId,
+ @Param("deviceId") Long deviceId, @Param("channelNo") Long channelNo,
+ @Param("cycleNo") Integer cycleNo);
+ int insertConsoleImportRecord(TTestConsoleImportRecord record);
+ int insertSampleConflict(@Param("testId") Long testId, @Param("channelId") Long channelId,
+ @Param("detail") String detail);
+ int countTestBatteryNo(@Param("testId") Long testId, @Param("batteryNo") String batteryNo);
}
--
Gitblit v1.7.1