From 14ac9c2a2384f1e55b4c01eb7a104033b589d1e0 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期六, 29 八月 2026 16:47:05 +0800
Subject: [PATCH] 增加模拟器设备总开关

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/device/BtsDevelopmentSimulatorController.java |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/device/BtsDevelopmentSimulatorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/device/BtsDevelopmentSimulatorController.java
index 7563d63..855f830 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/device/BtsDevelopmentSimulatorController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/device/BtsDevelopmentSimulatorController.java
@@ -63,6 +63,16 @@
         return simulator.snapshot();
     }
 
+    /** 模拟现场人工统一开关全部检测柜和采集器,不发送任何设备控制命令。 */
+    @PostMapping("/dev/bts-simulator/power")
+    public StateSnapshot setPower(@RequestBody SimulatorPowerCommand command)
+    {
+        if (command == null || command.poweredOn() == null)
+            throw badRequest(new IllegalArgumentException("poweredOn must be true or false"));
+        simulator.setAllDevicesPoweredOn(command.poweredOn());
+        return simulator.snapshot();
+    }
+
     /** 添加一台虚拟设备。 */
     @PostMapping("/dev/bts-simulator/devices")
     public StateSnapshot createDevice(@RequestBody CreateDeviceCommand command)
@@ -243,6 +253,8 @@
 
     public record CreateDeviceCommand(String ip, int channelCount) { }
 
+    public record SimulatorPowerCommand(Boolean poweredOn) { }
+
     public record DeviceStateCommand(String ip, int channelCount, boolean online) { }
 
     public record ChannelStateCommand(boolean online, DeviceWorkStatus workStatus) { }

--
Gitblit v1.7.1