reactor:【IoT 物联网】将 http component 合并到 gateway 里
This commit is contained in:
@@ -33,6 +33,7 @@ public class IotDeviceDO extends TenantBaseDO {
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
// TODO @芋艿:看看怎么弱化 deviceKey
|
||||
/**
|
||||
* 设备唯一标识符,全局唯一,用于识别设备
|
||||
*
|
||||
|
||||
@@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDevicePropertyDO;
|
||||
*/
|
||||
public interface RedisKeyConstants {
|
||||
|
||||
// TODO @芋艿:弱化 deviceKey;使用 product_key + device_name 替代
|
||||
/**
|
||||
* 设备属性的数据缓存,采用 HASH 结构
|
||||
* <p>
|
||||
@@ -18,6 +19,7 @@ public interface RedisKeyConstants {
|
||||
*/
|
||||
String DEVICE_PROPERTY = "iot:device_property:%s";
|
||||
|
||||
// TODO @芋艿:弱化 deviceKey;使用 product_key + device_name 替代
|
||||
/**
|
||||
* 设备的最后上报时间,采用 ZSET 结构
|
||||
*
|
||||
@@ -29,7 +31,7 @@ public interface RedisKeyConstants {
|
||||
/**
|
||||
* 设备信息的数据缓存,使用 Spring Cache 操作(忽略租户)
|
||||
*
|
||||
* KEY 格式:device_${productKey}_${deviceKey}
|
||||
* KEY 格式:device_${productKey}_${deviceName}
|
||||
* VALUE 数据类型:String(JSON)
|
||||
*/
|
||||
String DEVICE = "iot:device";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cn.iocoder.yudao.module.iot.mq.consumer.device;
|
||||
|
||||
import cn.iocoder.yudao.module.iot.core.messagebus.core.IotMessageBus;
|
||||
import cn.iocoder.yudao.module.iot.core.messagebus.core.IotMessageBusSubscriber;
|
||||
import cn.iocoder.yudao.module.iot.core.messagebus.core.IotMessageSubscriber;
|
||||
import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
|
||||
import cn.iocoder.yudao.module.iot.service.device.data.IotDeviceLogService;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
@@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class IotDeviceLogMessageBusSubscriber implements IotMessageBusSubscriber<IotDeviceMessage> {
|
||||
public class IotDeviceLogMessageSubscriber implements IotMessageSubscriber<IotDeviceMessage> {
|
||||
|
||||
@Resource
|
||||
private IotMessageBus messageBus;
|
||||
@@ -20,7 +20,6 @@ import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@@ -44,9 +43,6 @@ public class IotDeviceDownstreamServiceImpl implements IotDeviceDownstreamServic
|
||||
@Resource
|
||||
private IotDeviceService deviceService;
|
||||
|
||||
@Resource
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@Resource
|
||||
private IotDeviceProducer deviceProducer;
|
||||
@Resource
|
||||
@@ -156,7 +152,7 @@ public class IotDeviceDownstreamServiceImpl implements IotDeviceDownstreamServic
|
||||
cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage message = cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage
|
||||
.of(getProductKey(device, parentDevice), getDeviceName(device, parentDevice), deviceName,
|
||||
null, tenantId);
|
||||
String serverId = "yy";
|
||||
String serverId = "192_168_64_1_8092";
|
||||
deviceMessageProducer.sendGatewayDeviceMessage(serverId, message);
|
||||
// TODO @芋艿:后续可以清理掉
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user