Browse Source

推送设备状态更新消息中增加设备编号

develop
Mr.Wang 10 months ago
parent
commit
3ea7e9d0d8
  1. 7
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java

7
zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java

@ -21,6 +21,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.ParseException; import java.text.ParseException;
@ -79,6 +80,12 @@ public class DeviceMessageHandler {
// 批量更新设备状态 // 批量更新设备状态
dcDeviceService.batchUpdate(dcDevices); dcDeviceService.batchUpdate(dcDevices);
dcDevices.forEach(dcDevice -> {
DcDevice device = redisCache.getCacheMapValue(RedisKeyConstants.DC_DEVICES, dcDevice.getIotDeviceId());
if (!ObjectUtils.isEmpty(device)) {
dcDevice.setId(device.getId());
}
});
WebSocketService.broadcast(DEVICE_STATE, dcDevices); //推送设备状态更新 WebSocketService.broadcast(DEVICE_STATE, dcDevices); //推送设备状态更新
// 批量更新中间库设备状态 // 批量更新中间库设备状态

Loading…
Cancel
Save