|
@@ -38,9 +38,9 @@ import com.xunmei.host.websocket.enums.DeviceCacheEnum;
|
|
|
import com.xunmei.host.websocket.enums.DeviceNetStatusEnum;
|
|
import com.xunmei.host.websocket.enums.DeviceNetStatusEnum;
|
|
|
import com.xunmei.host.websocket.enums.ProductEnums;
|
|
import com.xunmei.host.websocket.enums.ProductEnums;
|
|
|
import com.xunmei.host.websocket.enums.TopicTypeEnums;
|
|
import com.xunmei.host.websocket.enums.TopicTypeEnums;
|
|
|
|
|
+import com.xunmei.host.websocket.redis.WebsocketPublisher;
|
|
|
import com.xunmei.host.websocket.service.RouterService;
|
|
import com.xunmei.host.websocket.service.RouterService;
|
|
|
import com.xunmei.host.websocket.utils.IotServerUtils;
|
|
import com.xunmei.host.websocket.utils.IotServerUtils;
|
|
|
-import com.xunmei.host.websocket.utils.WebSocketUtils;
|
|
|
|
|
import com.xunmei.system.api.domain.iot.IotDeviceInfo;
|
|
import com.xunmei.system.api.domain.iot.IotDeviceInfo;
|
|
|
import com.xunmei.system.api.domain.iot.IotDeviceInfoExtend;
|
|
import com.xunmei.system.api.domain.iot.IotDeviceInfoExtend;
|
|
|
import com.xunmei.system.api.util.LogUtils;
|
|
import com.xunmei.system.api.util.LogUtils;
|
|
@@ -81,6 +81,8 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
|
|
|
@Lazy
|
|
@Lazy
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IotDeviceStatusService deviceStatusService;
|
|
private IotDeviceStatusService deviceStatusService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private WebsocketPublisher websocketPublisher;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 根据设备类型和设备编码,获取设备信息
|
|
* 根据设备类型和设备编码,获取设备信息
|
|
@@ -830,7 +832,7 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
|
|
|
final JSONObject object = new JSONObject();
|
|
final JSONObject object = new JSONObject();
|
|
|
object.put("dataType", eto.getDataType());
|
|
object.put("dataType", eto.getDataType());
|
|
|
final WebsocketResult result = IotServerUtils.invokeHostServer(topic, new JSONObject(), WebSocketConstants.DO_WORK, object);
|
|
final WebsocketResult result = IotServerUtils.invokeHostServer(topic, new JSONObject(), WebSocketConstants.DO_WORK, object);
|
|
|
- WebSocketUtils.sendMessage(iotCode, JacksonUtils.toJSONString(result));
|
|
|
|
|
|
|
+ websocketPublisher.publishMsg(iotCode, result);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -858,7 +860,6 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
|
|
|
}
|
|
}
|
|
|
final String topic = TopicTypeEnums.formatUrl(TopicTypeEnums.PRODUCT_SERVICE_INVOKE.getUrl(), WebSocketConstants.DETECTION_HOST, WebSocketConstants.DETECTION_HOST_DEVICE);
|
|
final String topic = TopicTypeEnums.formatUrl(TopicTypeEnums.PRODUCT_SERVICE_INVOKE.getUrl(), WebSocketConstants.DETECTION_HOST, WebSocketConstants.DETECTION_HOST_DEVICE);
|
|
|
final WebsocketResult result = IotServerUtils.invokeHostServer(topic, new JSONObject(), WebSocketConstants.CHANGE_DEVICE, eto);
|
|
final WebsocketResult result = IotServerUtils.invokeHostServer(topic, new JSONObject(), WebSocketConstants.CHANGE_DEVICE, eto);
|
|
|
- WebSocketUtils.sendMessage(iotCode, JacksonUtils.toJSONString(result));
|
|
|
|
|
-
|
|
|
|
|
|
|
+ websocketPublisher.publishMsg(iotCode, result);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|