From 54f683c3fd09dd88fd4520e014b14825f7479c2f Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期四, 03 九月 2026 22:21:51 +0800
Subject: [PATCH] 修正暂停停止后的设备异常展示

---
 ruoyi-admin/src/test/java/com/ruoyi/system/service/impl/TTestLiveServiceImplTest.java |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/ruoyi-admin/src/test/java/com/ruoyi/system/service/impl/TTestLiveServiceImplTest.java b/ruoyi-admin/src/test/java/com/ruoyi/system/service/impl/TTestLiveServiceImplTest.java
index 3277c12..0024f83 100644
--- a/ruoyi-admin/src/test/java/com/ruoyi/system/service/impl/TTestLiveServiceImplTest.java
+++ b/ruoyi-admin/src/test/java/com/ruoyi/system/service/impl/TTestLiveServiceImplTest.java
@@ -59,6 +59,18 @@
         assertEquals(new BigDecimal("2.500"), snapshot.get("capacityAh"));
     }
 
+    @Test
+    void pausedShouldNotExposeUnavailableSourceAsAlarm()
+    {
+        Instant now = Instant.parse("2026-09-02T06:00:00Z");
+        TTest test = test("PAUSED");
+        TTestLiveServiceImpl service = liveService(test, now, false);
+
+        LiveState state = service.current(10L);
+
+        assertTrue(state.exceptions().isEmpty());
+    }
+
     private static TTest test(String receptionStatus)
     {
         TTest test = new TTest();
@@ -81,6 +93,11 @@
 
     private static TTestLiveServiceImpl liveService(TTest test, Instant now)
     {
+        return liveService(test, now, true);
+    }
+
+    private static TTestLiveServiceImpl liveService(TTest test, Instant now, boolean online)
+    {
         DeviceDiscoveryCandidateStore candidates = mock(DeviceDiscoveryCandidateStore.class);
         BtsDevelopmentSimulator simulator = mock(BtsDevelopmentSimulator.class);
         ITTestService tests = mock(ITTestService.class);
@@ -91,7 +108,7 @@
                 new BigDecimal("9.250"), 12L, 12L, "0", now,
                 java.util.Map.of());
         DeviceDiscoveryCandidateStore.ChannelCandidate channel = new DeviceDiscoveryCandidateStore.ChannelCandidate(
-                identity, true, DeviceWorkStatus.WORKING, now, snapshot);
+                identity, online, DeviceWorkStatus.WORKING, now, snapshot);
         DeviceDiscoveryCandidateStore.CabinetCandidate cabinet = new DeviceDiscoveryCandidateStore.CabinetCandidate(
                 "dev-sim", 1L, "dev-sim", 1, 1, "127.0.0.2", "mac", "cabinet", "vendor", "model",
                 List.of(channel), now, now.plusSeconds(60));

--
Gitblit v1.7.1