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: