diff --git a/src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java b/src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java index 37d5c4bc..e6a9006a 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java @@ -38,18 +38,18 @@ public class SipPlatformRunner implements CommandLineRunner { for (Platform platform : parentPlatforms) { - PlatformCatch parentPlatformCatchOld = redisCatchStorage.queryPlatformCatchInfo(platform.getServerGBId()); + PlatformCatch platformCatchOld = redisCatchStorage.queryPlatformCatchInfo(platform.getServerGBId()); // 更新缓存 - PlatformCatch parentPlatformCatch = new PlatformCatch(); - parentPlatformCatch.setPlatform(platform); - parentPlatformCatch.setId(platform.getServerGBId()); - redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch); - if (parentPlatformCatchOld != null) { + PlatformCatch platformCatch = new PlatformCatch(); + platformCatch.setPlatform(platform); + platformCatch.setId(platform.getServerGBId()); + redisCatchStorage.updatePlatformCatchInfo(platformCatch); + if (platformCatchOld != null) { // 取消订阅 try { log.info("[平台主动注销] {}({})", platform.getName(), platform.getServerGBId()); - sipCommanderForPlatform.unregister(platform, parentPlatformCatchOld.getSipTransactionInfo(), null, (eventResult)->{ + sipCommanderForPlatform.unregister(platform, platformCatchOld.getSipTransactionInfo(), null, (eventResult)->{ platformService.login(platform); }); } catch (Exception e) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java index 01619939..a15de224 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java @@ -3,7 +3,6 @@ package com.genersoft.iot.vmp.gb28181.bean; import com.genersoft.iot.vmp.common.VideoManagerConstants; import com.genersoft.iot.vmp.conf.DynamicTask; import com.genersoft.iot.vmp.conf.UserSetting; -import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -24,9 +23,6 @@ public class SubscribeHolder { @Autowired private UserSetting userSetting; - @Autowired - private EventPublisher eventPublisher; - private final String taskOverduePrefix = "subscribe_overdue_"; private static ConcurrentHashMap catalogMap = new ConcurrentHashMap<>(); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMobilePositionMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMobilePositionMapper.java index d5059c5e..3e09df8c 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMobilePositionMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMobilePositionMapper.java @@ -12,8 +12,8 @@ import java.util.List; @Mapper public interface DeviceMobilePositionMapper { - @Insert("INSERT INTO wvp_device_mobile_position (device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source,longitude_gcj02,latitude_gcj02,longitude_wgs84,latitude_wgs84,create_time)"+ - "VALUES (#{deviceId}, #{channelId}, #{deviceName}, #{time}, #{longitude}, #{latitude}, #{altitude}, #{speed}, #{direction}, #{reportSource}, #{longitudeGcj02}, #{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{createTime})") + @Insert("INSERT INTO wvp_device_mobile_position (device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source,create_time)"+ + "VALUES (#{deviceId}, #{channelId}, #{deviceName}, #{time}, #{longitude}, #{latitude}, #{altitude}, #{speed}, #{direction}, #{reportSource}, #{createTime})") int insertNewPosition(MobilePosition mobilePosition); @Select(value = {" ") - void batchadd2(List mobilePositions); - @Insert("") void batchadd(List mobilePositions); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java index 720b8789..b89c239e 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java @@ -458,7 +458,7 @@ public class PlatformServiceImpl implements IPlatformService { return; } for (CommonGBChannel channel : channelList) { - GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(channel.getGbId()); + GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(channel.getGbDeviceId()); // 无最新位置不发送 if (gpsMsgInfo != null) { // 经纬度都为0不发送 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java index d1d9a5be..adc1e638 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java @@ -360,9 +360,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform { if (parentPlatform == null) { return; } - if (log.isDebugEnabled()) { - log.info("[发送 移动位置订阅] {}/{}->{},{}", parentPlatform.getServerGBId(), gpsMsgInfo.getChannelId(), gpsMsgInfo.getLng(), gpsMsgInfo.getLat()); - } + log.info("[发送 移动位置订阅] {}/{}->{},{}", parentPlatform.getServerGBId(), gpsMsgInfo.getId(), gpsMsgInfo.getLng(), gpsMsgInfo.getLat()); String characterSet = parentPlatform.getCharacterSet(); StringBuffer deviceStatusXml = new StringBuffer(600); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForMobilePositionProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForMobilePositionProcessor.java index f294bfcb..5d376689 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForMobilePositionProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForMobilePositionProcessor.java @@ -143,7 +143,7 @@ public class NotifyRequestForMobilePositionProcessor extends SIPRequestProcessor } } - log.debug("[收到移动位置订阅通知]:{}/{}->{}.{}, 时间: {}", mobilePosition.getDeviceId(), mobilePosition.getChannelId(), + log.info("[收到移动位置订阅通知]:{}/{}->{}.{}, 时间: {}", mobilePosition.getDeviceId(), mobilePosition.getChannelId(), mobilePosition.getLongitude(), mobilePosition.getLatitude(), System.currentTimeMillis() - startTime); mobilePosition.setReportSource("Mobile Position"); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java index 730e8c0f..39d04c13 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java @@ -133,8 +133,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme } try { - Platform parentPlatform = platformService.queryPlatformByServerGBId(platformId); - SIPResponse response = responseXmlAck(request, resultXml.toString(), parentPlatform, subscribeInfo.getExpires()); + SIPResponse response = responseXmlAck(request, resultXml.toString(), platform, subscribeInfo.getExpires()); if (subscribeInfo.getExpires() == 0) { subscribeHolder.removeMobilePositionSubscribe(platformId); }else { diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java b/src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java index c3a90101..7156985c 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java +++ b/src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java @@ -7,6 +7,11 @@ import lombok.Data; @Data public class GPSMsgInfo { + /** + * 通道国标ID + */ + private String id; + /** * 通道ID */ diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGpsMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGpsMsgListener.java index aa8c6c7a..32dddddf 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGpsMsgListener.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGpsMsgListener.java @@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; * 接收来自redis的GPS更新通知 * @author lin * 监听: SUBSCRIBE VM_MSG_GPS - * 发布 PUBLISH VM_MSG_GPS '' + * 发布 PUBLISH VM_MSG_GPS '{"messageId":"1727228507555","id":"24212345671381000047","lng":116.30307666666667,"lat":40.03295833333333,"time":"2024-09-25T09:41:47","direction":"56.0","speed":0.0,"altitude":60.0,"unitNo":"100000000","memberNo":"10000047"}' */ @Slf4j @Component diff --git a/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java b/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java index 82f94a79..6d705101 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java @@ -97,7 +97,7 @@ public interface IRedisCatchStorage { void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo); - GPSMsgInfo getGpsMsgInfo(Integer gbId); + GPSMsgInfo getGpsMsgInfo(String gbId); List getAllGpsMsgInfo(); Long getSN(String method); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java index d9a1c483..81c8b3da 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java @@ -11,7 +11,6 @@ import com.genersoft.iot.vmp.gb28181.dao.DeviceMapper; import com.genersoft.iot.vmp.media.bean.MediaInfo; import com.genersoft.iot.vmp.media.bean.MediaServer; import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; -import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; @@ -247,14 +246,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @Override public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) { - String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gpsMsgInfo.getChannelId(); + String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gpsMsgInfo.getId(); Duration duration = Duration.ofSeconds(60L); redisTemplate.opsForValue().set(key, gpsMsgInfo, duration); // 默认GPS消息保存1分钟 } @Override - public GPSMsgInfo getGpsMsgInfo(Integer channelId) { + public GPSMsgInfo getGpsMsgInfo(String channelId) { String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + channelId; return JsonUtil.redisJsonToObject(redisTemplate, key, GPSMsgInfo.class); } diff --git a/数据库/2.7.2-重构/初始化-mysql-2.7.2.sql b/数据库/2.7.2-重构/初始化-mysql-2.7.2.sql index b9fd774b..2da33cae 100644 --- a/数据库/2.7.2-重构/初始化-mysql-2.7.2.sql +++ b/数据库/2.7.2-重构/初始化-mysql-2.7.2.sql @@ -64,10 +64,6 @@ create table wvp_device_mobile_position speed double precision, direction double precision, report_source character varying(50), - longitude_gcj02 double precision, - latitude_gcj02 double precision, - longitude_wgs84 double precision, - latitude_wgs84 double precision, create_time character varying(50) ); diff --git a/数据库/2.7.2-重构/初始化-postgresql-kingbase-2.7.2.sql b/数据库/2.7.2-重构/初始化-postgresql-kingbase-2.7.2.sql index 7debbf15..ef5af143 100644 --- a/数据库/2.7.2-重构/初始化-postgresql-kingbase-2.7.2.sql +++ b/数据库/2.7.2-重构/初始化-postgresql-kingbase-2.7.2.sql @@ -64,10 +64,6 @@ create table wvp_device_mobile_position speed double precision, direction double precision, report_source character varying(50), - longitude_gcj02 double precision, - latitude_gcj02 double precision, - longitude_wgs84 double precision, - latitude_wgs84 double precision, create_time character varying(50) );