【代码优化】IoT:实现 IotDeviceEventReportVertxHandler 事件上行

This commit is contained in:
YunaiV
2025-01-31 21:16:01 +08:00
parent 2512f2dde8
commit a74459e94e
7 changed files with 91 additions and 9 deletions

View File

@@ -4,7 +4,7 @@ import cn.iocoder.yudao.module.iot.controller.admin.device.vo.control.IotDeviceS
import jakarta.validation.Valid;
/**
* 设备下行 Service 接口
* IoT 设备下行 Service 接口
*
* 目的:服务端 -> 插件 -> 设备
*

View File

@@ -35,7 +35,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DEVICE_DOWNSTREAM_FAILED;
/**
* 设备下行 Service 实现类
* IoT 设备下行 Service 实现类
*
* @author 芋道源码
*/

View File

@@ -7,7 +7,7 @@ import cn.iocoder.yudao.module.iot.controller.admin.device.vo.control.IotDeviceS
import jakarta.validation.Valid;
/**
* 设备上行 Service 接口
* IoT 设备上行 Service 接口
*
* 目的:设备 -> 插件 -> 服务端
*

View File

@@ -31,7 +31,7 @@ import java.util.Map;
import java.util.Objects;
/**
* 设备上行 Service 实现类
* IoT 设备上行 Service 实现类
*
* @author 芋道源码
*/
@@ -123,11 +123,11 @@ public class IotDeviceUpstreamServiceImpl implements IotDeviceUpstreamService {
@Override
public void reportDeviceProperty(IotDevicePropertyReportReqDTO reportReqDTO) {
// 1.1 获得设备
log.info("[reportDevicePropertyData][上报设备属性: {}]", reportReqDTO);
log.info("[reportDeviceProperty][上报设备属性: {}]", reportReqDTO);
IotDeviceDO device = deviceService.getDeviceByProductKeyAndDeviceNameFromCache(
reportReqDTO.getProductKey(), reportReqDTO.getDeviceName());
if (device == null) {
log.error("[reportDevicePropertyData][设备({}/{})不存在]",
log.error("[reportDeviceProperty][设备({}/{})不存在]",
reportReqDTO.getProductKey(), reportReqDTO.getDeviceName());
return;
}
@@ -145,11 +145,11 @@ public class IotDeviceUpstreamServiceImpl implements IotDeviceUpstreamService {
@Override
public void reportDeviceEvent(IotDeviceEventReportReqDTO reportReqDTO) {
// 1.1 获得设备
log.info("[reportDeviceEventData][上报设备事件: {}]", reportReqDTO);
log.info("[reportDeviceEvent][上报设备事件: {}]", reportReqDTO);
IotDeviceDO device = deviceService.getDeviceByProductKeyAndDeviceNameFromCache(
reportReqDTO.getProductKey(), reportReqDTO.getDeviceName());
if (device == null) {
log.error("[reportDeviceEventData][设备({}/{})不存在]",
log.error("[reportDeviceEvent][设备({}/{})不存在]",
reportReqDTO.getProductKey(), reportReqDTO.getDeviceName());
return;
}