From 14ac9c2a2384f1e55b4c01eb7a104033b589d1e0 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期六, 29 八月 2026 16:47:05 +0800
Subject: [PATCH] 增加模拟器设备总开关
---
ruoyi-device/src/main/java/com/ruoyi/device/bts/BtsDevelopmentSimulator.java | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/ruoyi-device/src/main/java/com/ruoyi/device/bts/BtsDevelopmentSimulator.java b/ruoyi-device/src/main/java/com/ruoyi/device/bts/BtsDevelopmentSimulator.java
index 707cc65..751124a 100644
--- a/ruoyi-device/src/main/java/com/ruoyi/device/bts/BtsDevelopmentSimulator.java
+++ b/ruoyi-device/src/main/java/com/ruoyi/device/bts/BtsDevelopmentSimulator.java
@@ -183,9 +183,36 @@
replaceCollector(DevelopmentCollectorSimulation.configureChannel(current, channelCode, metrics));
}
+ /** 模拟现场人工统一开关机;只改变模拟设备事实,不代表系统具备真实设备控制能力。 */
+ public synchronized void setAllDevicesPoweredOn(boolean poweredOn)
+ {
+ List<DeviceState> devices = state.devices().stream()
+ .map(device -> new DeviceState(device.deviceId(), device.ip(), poweredOn,
+ device.channels().stream()
+ .map(channel -> new ChannelState(channel.channelId(), poweredOn,
+ DeviceWorkStatus.STOPPED))
+ .toList()))
+ .toList();
+ Instant changedAt = Instant.now();
+ List<CollectorState> collectors = state.collectors().stream()
+ .map(collector -> DevelopmentCollectorSimulation.resize(collector, collector.ip(),
+ collector.channelCount(), poweredOn, changedAt))
+ .toList();
+ persist(new SimulatorState(state.version(), devices, collectors, state.nextDeviceId(),
+ state.nextCollectorId(), state.tombstones()));
+ }
+
/** 按每台采集器自己的频率推进实时和历史采样。 */
public synchronized void advanceCollectors(Instant now)
{
+ boolean hasOnlineCollector = false;
+ for (CollectorState collector : state.collectors())
+ {
+ if (!collector.online()) continue;
+ hasOnlineCollector = true;
+ break;
+ }
+ if (!hasOnlineCollector) return;
List<CollectorState> collectors = new ArrayList<>(state.collectors().size());
List<CollectorHistoryAppend> historyAppends = new ArrayList<>();
for (CollectorState collector : state.collectors())
--
Gitblit v1.7.1