From 9c0fd80309b277420c492180ae9f98f779f0f5c8 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期日, 30 八月 2026 23:29:33 +0800
Subject: [PATCH] 实现设备自然结束与区间补采恢复

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestServiceImpl.java |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestServiceImpl.java
index 329d523..c2dac75 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestServiceImpl.java
@@ -236,6 +236,8 @@
         Date actionAt = new Date();
         if (testMapper.updateReceptionPaused(testId, updateBy, actionAt) != 1)
             throw new ServiceException("测试状态已变更,请刷新后重试");
+        // 暂停边界不属于本次测试的确认接收区间,继续时由新的区间重新开始计时。
+        testMapper.closeOpenReceptionIntervals(testId, actionAt, "RECEPTION_PAUSED");
         testMapper.insertTestAudit(testId, "RECEPTION_PAUSED", operatorId, updateBy, null,
                 JSON.toJSONString(Map.of("receptionStatus", "PAUSED", "polling", "STOPPED")));
         return 1;
@@ -254,6 +256,15 @@
         Date actionAt = new Date();
         if (testMapper.updateReceptionResumed(testId, updateBy, actionAt) != 1)
             throw new ServiceException("测试状态已变更,请刷新后重试");
+        for (TTestBattery battery : current.getBatteries())
+        {
+            TTestChannelBinding binding = battery.getBinding();
+            testMapper.insertReceptionInterval(testId, binding.getBindingId(), "CABINET_CHANNEL",
+                    binding.getChannelId(), null, actionAt, "RECEPTION_RESUMED");
+            for (TTestCollectorChannel mapping : mutable(battery.getCollectorChannels()))
+                testMapper.insertReceptionInterval(testId, binding.getBindingId(), "COLLECTOR_CHANNEL",
+                        battery.getCollectorId(), mapping.getChannelCode(), actionAt, "RECEPTION_RESUMED");
+        }
         testMapper.insertTestAudit(testId, "RECEPTION_RESUMED", operatorId, updateBy, null,
                 JSON.toJSONString(Map.of("receptionStatus", "RECEIVING", "polling", "RESUMED")));
         return 1;

--
Gitblit v1.7.1