From 1c26cdb81070af7f29df4462d3bfc1ae588ff8f3 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期日, 30 八月 2026 14:11:34 +0800
Subject: [PATCH] 模拟器优化

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/device/BtsDevelopmentSimulatorController.java |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 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 855f830..3938123 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
@@ -79,7 +79,10 @@
     {
         try
         {
-            simulator.addDevice(command.ip(), command.channelCount());
+            if (command.model() == null || command.model().isBlank())
+                simulator.addDevice(command.ip(), command.channelCount());
+            else
+                simulator.addNewareDevice(command.ip(), command.model());
             return simulator.snapshot();
         }
         catch (IllegalArgumentException exception)
@@ -95,6 +98,8 @@
         try
         {
             simulator.updateDevice(deviceId, command.ip(), command.channelCount(), command.online());
+            if (command.model() != null && !command.model().isBlank())
+                simulator.configureNewareProfile(deviceId, command.model());
             return simulator.snapshot();
         }
         catch (IllegalArgumentException exception)
@@ -251,11 +256,23 @@
         return new ResponseStatusException(HttpStatus.BAD_REQUEST, exception.getMessage(), exception);
     }
 
-    public record CreateDeviceCommand(String ip, int channelCount) { }
+    public record CreateDeviceCommand(String ip, int channelCount, String model)
+    {
+        public CreateDeviceCommand(String ip, int channelCount)
+        {
+            this(ip, channelCount, null);
+        }
+    }
 
     public record SimulatorPowerCommand(Boolean poweredOn) { }
 
-    public record DeviceStateCommand(String ip, int channelCount, boolean online) { }
+    public record DeviceStateCommand(String ip, int channelCount, boolean online, String model)
+    {
+        public DeviceStateCommand(String ip, int channelCount, boolean online)
+        {
+            this(ip, channelCount, online, null);
+        }
+    }
 
     public record ChannelStateCommand(boolean online, DeviceWorkStatus workStatus) { }
 

--
Gitblit v1.7.1