修复位置消息发送的BUG
This commit is contained in:
@@ -20,6 +20,11 @@ public class MobilePosition {
|
||||
*/
|
||||
private Integer channelId;
|
||||
|
||||
/**
|
||||
* 通道国标编号
|
||||
*/
|
||||
private String channelDeviceId;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
|
||||
@@ -371,8 +371,6 @@ public interface DeviceChannelMapper {
|
||||
" SET update_time=#{item.updateTime}" +
|
||||
"<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" +
|
||||
"<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" +
|
||||
"<if test='item.gbLongitude != null'>, gb_longitude=#{item.gbLongitude}</if>" +
|
||||
"<if test='item.gbLatitude != null'>, gb_latitude=#{item.gbLatitude}</if>" +
|
||||
"<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</if>" +
|
||||
"<if test='item.id > 0'>WHERE id=#{item.id}</if>" +
|
||||
"<if test='item.id == 0'>WHERE data_type = #{item.dataType} and data_device_id=#{item.dataDeviceId} AND device_id=#{item.deviceId}</if>" +
|
||||
|
||||
@@ -361,6 +361,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
for (DeviceChannel channel : deviceChannels) {
|
||||
// 向关联了该通道并且开启移动位置订阅的上级平台发送移动位置订阅消息
|
||||
mobilePosition.setChannelId(channel.getId());
|
||||
mobilePosition.setChannelDeviceId(channel.getDeviceId());
|
||||
try {
|
||||
eventPublisher.mobilePositionEventPublish(mobilePosition);
|
||||
}catch (Exception e) {
|
||||
|
||||
@@ -180,6 +180,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
MobilePosition mobilePosition = new MobilePosition();
|
||||
mobilePosition.setDeviceId(newChannel.getGbDeviceId());
|
||||
mobilePosition.setChannelId(newChannel.getGbId());
|
||||
mobilePosition.setChannelDeviceId(newChannel.getGbDeviceId());
|
||||
mobilePosition.setDeviceName(newChannel.getGbName());
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
mobilePosition.setTime(DateUtil.getNow());
|
||||
|
||||
@@ -106,6 +106,7 @@ public class NotifyRequestForMobilePositionProcessor extends SIPRequestProcessor
|
||||
deviceChannel = deviceChannelService.getOne(device.getDeviceId(), channelId);
|
||||
if (deviceChannel != null) {
|
||||
mobilePosition.setChannelId(deviceChannel.getId());
|
||||
mobilePosition.setChannelDeviceId(deviceChannel.getDeviceId());
|
||||
}else {
|
||||
log.error("[notify-移动位置] 未找到通道 {}/{}", device.getDeviceId(), channelId);
|
||||
break readDocument;
|
||||
@@ -165,7 +166,7 @@ public class NotifyRequestForMobilePositionProcessor extends SIPRequestProcessor
|
||||
try {
|
||||
eventPublisher.mobilePositionEventPublish(mobilePosition);
|
||||
}catch (Exception e) {
|
||||
log.error("[向上级转发移动位置失败] ", e);
|
||||
log.error("[MobilePositionEvent] 发送失败: ", e);
|
||||
}
|
||||
} catch (DocumentException e) {
|
||||
log.error("[收到移动位置订阅通知] 文档解析异常: \r\n{}", evt.getRequest(), e);
|
||||
|
||||
@@ -154,6 +154,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
}else {
|
||||
MobilePosition mobilePosition = new MobilePosition();
|
||||
mobilePosition.setChannelId(deviceChannel.getId());
|
||||
mobilePosition.setChannelDeviceId(deviceChannel.getDeviceId());
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
|
||||
mobilePosition.setTime(deviceAlarm.getAlarmTime());
|
||||
|
||||
@@ -153,6 +153,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
|
||||
mobilePosition.setChannelId(deviceChannel.getId());
|
||||
mobilePosition.setChannelDeviceId(deviceChannel.getDeviceId());
|
||||
mobilePosition.setTime(deviceAlarm.getAlarmTime());
|
||||
mobilePosition.setLongitude(deviceAlarm.getLongitude());
|
||||
mobilePosition.setLatitude(deviceAlarm.getLatitude());
|
||||
|
||||
@@ -90,6 +90,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
|
||||
mobilePosition.setDeviceId(sipMsgInfo.getDevice().getDeviceId());
|
||||
|
||||
mobilePosition.setChannelId(deviceChannel.getId());
|
||||
mobilePosition.setChannelDeviceId(deviceChannel.getDeviceId());
|
||||
String time = getText(rootElementAfterCharset, "Time");
|
||||
if (ObjectUtils.isEmpty(time)){
|
||||
mobilePosition.setTime(DateUtil.getNow());
|
||||
|
||||
@@ -81,6 +81,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
|
||||
}
|
||||
mobilePosition.setDeviceId(device.getDeviceId());
|
||||
mobilePosition.setChannelId(deviceChannel.getId());
|
||||
mobilePosition.setChannelDeviceId(deviceChannel.getDeviceId());
|
||||
//兼容ISO 8601格式时间
|
||||
String time = getText(rootElement, "Time");
|
||||
if (ObjectUtils.isEmpty(time)){
|
||||
|
||||
@@ -237,13 +237,13 @@ public class CameraChannelService implements CommandLineRunner {
|
||||
CameraChannel cameraChannel = channelMapper.queryCameraChannelById(channelId);
|
||||
|
||||
// 非移动设备类型 不发送
|
||||
if (cameraChannel == null || cameraChannel.getGbPtzType() != 99) {
|
||||
if (cameraChannel == null || cameraChannel.getGbPtzType() == null || cameraChannel.getGbPtzType() != 99) {
|
||||
return;
|
||||
}
|
||||
// 发送redis消息
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("time", mobilePosition.getTime());
|
||||
jsonObject.put("deviceId", mobilePosition.getDeviceId());
|
||||
jsonObject.put("deviceId", mobilePosition.getChannelDeviceId());
|
||||
jsonObject.put("longitude", mobilePosition.getLongitude());
|
||||
jsonObject.put("latitude", mobilePosition.getLatitude());
|
||||
jsonObject.put("altitude", mobilePosition.getAltitude());
|
||||
@@ -251,7 +251,7 @@ public class CameraChannelService implements CommandLineRunner {
|
||||
jsonObject.put("speed", mobilePosition.getSpeed());
|
||||
jsonObject.put("topGroupGAlias", cameraChannel.getTopGroupGAlias());
|
||||
jsonObject.put("groupAlias", cameraChannel.getGroupAlias());
|
||||
log.debug("[redis发送通知] 发送 移动设备位置信息移动位置 {}: {}", REDIS_GPS_MESSAGE, jsonObject.toString());
|
||||
log.info("[redis发送通知] 发送 移动设备位置信息移动位置 {}: {}", REDIS_GPS_MESSAGE, jsonObject.toString());
|
||||
redisTemplate.convertAndSend(REDIS_GPS_MESSAGE, jsonObject);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user