Merge branch '2.7.3'
# Conflicts: # src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java # src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceServiceImpl.java # src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPSender.java
This commit is contained in:
@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPlatformService;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||
@@ -55,6 +56,9 @@ public class RedisAlarmMsgListener implements MessageListener {
|
||||
@Autowired
|
||||
private IPlatformService platformService;
|
||||
|
||||
@Autowired
|
||||
private IPlatformChannelService platformChannelService;
|
||||
|
||||
private final ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
|
||||
|
||||
@Autowired
|
||||
@@ -129,7 +133,6 @@ public class RedisAlarmMsgListener implements MessageListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 获取开启了消息推送的设备和平台
|
||||
List<Device> devices = channelService.queryDeviceWithAsMessageChannel();
|
||||
@@ -143,24 +146,26 @@ public class RedisAlarmMsgListener implements MessageListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
Device device = deviceService.getDeviceByDeviceId(gbId);
|
||||
Platform platform = platformService.queryPlatformByServerGBId(gbId);
|
||||
if (device != null && platform == null) {
|
||||
// 获取该通道ID是属于设备还是对应的上级平台
|
||||
Device device = deviceService.getDeviceBySourceChannelDeviceId(gbId);
|
||||
List<Platform> platforms = platformChannelService.queryByPlatformBySharChannelId(gbId);
|
||||
if (device != null && (platforms == null || platforms.isEmpty())) {
|
||||
try {
|
||||
commander.sendAlarmMessage(device, deviceAlarm);
|
||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
log.error("[命令发送失败] 发送报警: {}", e.getMessage());
|
||||
}
|
||||
} else if (device == null && platform != null) {
|
||||
try {
|
||||
commanderForPlatform.sendAlarmMessage(platform, deviceAlarm);
|
||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
log.error("[命令发送失败] 发送报警: {}", e.getMessage());
|
||||
} else if (device == null && (platforms != null && !platforms.isEmpty())) {
|
||||
for (Platform platform : platforms) {
|
||||
try {
|
||||
commanderForPlatform.sendAlarmMessage(platform, deviceAlarm);
|
||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
log.error("[命令发送失败] 发送报警: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.warn("无法确定" + gbId + "是平台还是设备");
|
||||
log.warn("[REDIS的ALARM通知] 未查询到" + gbId + "所属的平台或设备");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -231,6 +231,9 @@ public class RedisRpcServiceImpl implements IRedisRpcService {
|
||||
RedisRpcRequest request = buildRequest("platform/update", platform);
|
||||
request.setToId(serverId);
|
||||
RedisRpcResponse response = redisRpcConfig.request(request, 40, TimeUnit.MILLISECONDS);
|
||||
if(response == null) {
|
||||
return false;
|
||||
}
|
||||
return Boolean.parseBoolean(response.getBody().toString());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user