From d357105d7f8edd1d90b4b42787166c7204180829 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 3 Feb 2026 08:34:34 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=88iot=EF=BC=89=EF=BC=9A=E3=80=90?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E6=94=B9=E9=80=A0=E3=80=91=E5=B0=86=20protoc?= =?UTF-8?q?ols=20=E7=9A=84=20type=20=E5=AD=97=E6=AE=B5=EF=BC=8C=E6=94=B9?= =?UTF-8?q?=E6=88=90=20protocol=20=E6=9B=B4=E5=A5=BD=E7=90=86=E8=A7=A3?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/gateway/config/IotGatewayProperties.java | 3 ++- .../iot/gateway/protocol/IotProtocolManager.java | 4 ++-- .../src/main/resources/application.yaml | 12 ++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/config/IotGatewayProperties.java b/yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/config/IotGatewayProperties.java index 8cb6595b55..8b2618aed2 100644 --- a/yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/config/IotGatewayProperties.java +++ b/yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/config/IotGatewayProperties.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.iot.gateway.config; +import cn.iocoder.yudao.module.iot.core.enums.IotProtocolTypeEnum; import cn.iocoder.yudao.module.iot.gateway.protocol.coap.IotCoapConfig; import cn.iocoder.yudao.module.iot.gateway.protocol.http.IotHttpConfig; import cn.iocoder.yudao.module.iot.gateway.protocol.mqtt.IotMqttConfig; @@ -279,7 +280,7 @@ public class IotGatewayProperties { * @see cn.iocoder.yudao.module.iot.core.enums.IotProtocolTypeEnum */ @NotEmpty(message = "协议类型不能为空") - private String type; + private String protocol; /** * 服务端口 */ diff --git a/yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/protocol/IotProtocolManager.java b/yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/protocol/IotProtocolManager.java index 47b41a3e28..b97da74a72 100644 --- a/yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/protocol/IotProtocolManager.java +++ b/yudao-module-iot/yudao-module-iot-gateway/src/main/java/cn/iocoder/yudao/module/iot/gateway/protocol/IotProtocolManager.java @@ -91,9 +91,9 @@ public class IotProtocolManager implements SmartLifecycle { */ @SuppressWarnings({"EnhancedSwitchMigration"}) private IotProtocol createProtocol(IotGatewayProperties.ProtocolInstanceProperties config) { - IotProtocolTypeEnum protocolType = IotProtocolTypeEnum.of(config.getType()); + IotProtocolTypeEnum protocolType = IotProtocolTypeEnum.of(config.getProtocol()); if (protocolType == null) { - log.error("[createProtocol][协议实例 {} 的协议类型 {} 不存在]", config.getId(), config.getType()); + log.error("[createProtocol][协议实例 {} 的协议类型 {} 不存在]", config.getId(), config.getProtocol()); return null; } switch (protocolType) { diff --git a/yudao-module-iot/yudao-module-iot-gateway/src/main/resources/application.yaml b/yudao-module-iot/yudao-module-iot-gateway/src/main/resources/application.yaml index a133d4ffd0..d24a631d5f 100644 --- a/yudao-module-iot/yudao-module-iot-gateway/src/main/resources/application.yaml +++ b/yudao-module-iot/yudao-module-iot-gateway/src/main/resources/application.yaml @@ -48,7 +48,7 @@ yudao: # 针对引入的 HTTP 组件的配置 # ==================================== - id: http-json - type: http + protocol: http port: 8092 enabled: false http: @@ -58,7 +58,7 @@ yudao: # ==================================== - id: tcp-json enabled: false - type: tcp + protocol: tcp port: 8091 serialize: json tcp: @@ -80,7 +80,7 @@ yudao: # ==================================== - id: udp-json enabled: false - type: udp + protocol: udp port: 8093 serialize: json udp: @@ -93,7 +93,7 @@ yudao: # ==================================== - id: websocket-json enabled: true - type: websocket + protocol: websocket port: 8094 serialize: json websocket: @@ -107,7 +107,7 @@ yudao: # ==================================== - id: coap-json enabled: false - type: coap + protocol: coap port: 5683 coap: max-message-size: 1024 # 最大消息大小(字节) @@ -118,7 +118,7 @@ yudao: # ==================================== - id: mqtt-json enabled: true - type: mqtt + protocol: mqtt port: 1883 serialize: json mqtt: