|
|
@@ -525,16 +525,21 @@ public class IotServiceImpl extends SuperService {
|
|
|
realIotTopic = realIotTopic.replaceAll(Pattern.quote("${deviceId}"), deviceId);
|
|
|
replyRealIotTopic = replyRealIotTopic.replaceAll(Pattern.quote("${deviceId}"), deviceId);
|
|
|
|
|
|
+ String gateWayId = "";
|
|
|
DeviceInfo deviceInfo = deviceInfoDao.findTopByDeviceId(deviceId);
|
|
|
if (ObjectUtils.isNotEmpty(deviceInfo)) {
|
|
|
- GateWay2Device gateWay2Device = gateWay2DeviceDao.findTopByDeviceInfoOrderByUpdateTimeDesc(deviceInfo);
|
|
|
- if (ObjectUtils.isNotEmpty(gateWay2Device) && gateWay2Device.getGateWayInfo() != null) {
|
|
|
- String gateWayId = gateWay2Device.getGateWayInfo().getDeviceId();
|
|
|
- realIotTopic = realIotTopic.replaceAll(Pattern.quote("${gateWayId}"), gateWayId);
|
|
|
- replyRealIotTopic = replyRealIotTopic.replaceAll(Pattern.quote("${gateWayId}"), gateWayId);
|
|
|
- iotMain.setGateWayId(gateWayId);
|
|
|
+ if (deviceInfo.getDeviceCategory() == DeviceCategory.GW) {
|
|
|
+ gateWayId = deviceInfo.getDeviceId();
|
|
|
+ } else {
|
|
|
+ GateWay2Device gateWay2Device = gateWay2DeviceDao.findTopByDeviceInfoOrderByUpdateTimeDesc(deviceInfo);
|
|
|
+ if (ObjectUtils.isNotEmpty(gateWay2Device) && gateWay2Device.getGateWayInfo() != null) {
|
|
|
+ gateWayId = gateWay2Device.getGateWayInfo().getDeviceId();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ realIotTopic = realIotTopic.replaceAll(Pattern.quote("${gateWayId}"), gateWayId);
|
|
|
+ replyRealIotTopic = replyRealIotTopic.replaceAll(Pattern.quote("${gateWayId}"), gateWayId);
|
|
|
+ iotMain.setGateWayId(gateWayId);
|
|
|
|
|
|
if (deviceInfo.getDeviceCategory() == DeviceCategory.GW) {
|
|
|
realIotTopic = realIotTopic.replaceAll(Pattern.quote("${gateWayId}"), deviceInfo.getDeviceId());
|