From 9bd8e752b5d7ba7177fa16d74565b741699f5c22 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期一, 31 八月 2026 00:43:06 +0800
Subject: [PATCH] 实现 Ticket14 区间完整性检查与检测完成

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestLiveServiceImpl.java |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestLiveServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestLiveServiceImpl.java
index 0671ed2..8433e22 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestLiveServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestLiveServiceImpl.java
@@ -85,7 +85,13 @@
                 .toList());
         boolean abnormal = persisted.stream().anyMatch(item -> "OPEN".equals(item.getIntervalStatus()));
         String testStatus = abnormal && "RUNNING".equals(test.getTestStatus()) ? "RUNNING_ABNORMAL" : test.getTestStatus();
-        return new LiveState(testId, testStatus, test.getReceptionStatus(), Instant.now(), sources, exceptions);
+        List<com.ruoyi.system.domain.TTestIntegrityIssue> integrity = new ArrayList<>();
+        List<com.ruoyi.system.domain.TTestIntegrityIssue> persistedIntegrity = testMapper.selectIntegrityIssues(testId);
+        if (persistedIntegrity != null) integrity.addAll(persistedIntegrity);
+        List<com.ruoyi.system.domain.TTestIntegrityIssue> persistedExceptions = testMapper.selectTestExceptionFacts(testId);
+        if (persistedExceptions != null) integrity.addAll(persistedExceptions);
+        return new LiveState(testId, testStatus, test.getReceptionStatus(), Instant.now(), sources, exceptions,
+                integrity == null ? List.of() : integrity);
     }
 
     private LiveSource snapshotFor(Long testId, LiveSource fresh, boolean freeze)
@@ -136,6 +142,7 @@
         emitter.send(SseEmitter.event().name("reception-status").data(Map.of("testId", testId, "receptionStatus", state.receptionStatus())));
         emitter.send(SseEmitter.event().name("test-status").data(Map.of("testId", testId, "testStatus", state.testStatus())));
         emitter.send(SseEmitter.event().name("exception").data(state.exceptions()));
+        emitter.send(SseEmitter.event().name("integrity").data(state.integrityIssues()));
         emitter.send(SseEmitter.event().name("heartbeat").data(Map.of("at", state.updatedAt())));
     }
 

--
Gitblit v1.7.1