feat:【IoT 物联网】设备消息查询时,增加 pair 查询
This commit is contained in:
@@ -32,6 +32,10 @@ public enum IotDeviceMessageMethodEnum implements ArrayValuable<String> {
|
||||
|
||||
EVENT_POST("thing.event.post", "事件上报", true),
|
||||
|
||||
// ========== 设备服务调用 ==========
|
||||
|
||||
SERVICE_INVOKE("thing.service.invoke", "服务调用", false),
|
||||
|
||||
;
|
||||
|
||||
public static final String[] ARRAYS = Arrays.stream(values()).map(IotDeviceMessageMethodEnum::getMethod)
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package cn.iocoder.yudao.module.iot.core.util;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.system.SystemUtil;
|
||||
import cn.iocoder.yudao.module.iot.core.enums.IotDeviceMessageMethodEnum;
|
||||
import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* IoT 设备【消息】的工具类
|
||||
*
|
||||
@@ -43,6 +47,23 @@ public class IotDeviceMessageUtils {
|
||||
return message.getCode() != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取消息中的标识符
|
||||
*
|
||||
* @param message 消息
|
||||
* @return 标识符
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static String getIdentifier(IotDeviceMessage message) {
|
||||
if (StrUtil.equalsAny(message.getMethod(), IotDeviceMessageMethodEnum.EVENT_POST.getMethod(),
|
||||
message.getMethod(), IotDeviceMessageMethodEnum.SERVICE_INVOKE.getMethod())
|
||||
&& message.getParams() != null) {
|
||||
Map<String, Object> params = (Map<String, Object>) message.getParams();
|
||||
return MapUtil.getStr(params, "identifier");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// ========== Topic 相关 ==========
|
||||
|
||||
public static String buildMessageBusGatewayDeviceMessageTopic(String serverId) {
|
||||
|
||||
Reference in New Issue
Block a user