临时提交
parent
6f587bea5d
commit
59a52705cf
|
@ -38,18 +38,18 @@ public class SipPlatformRunner implements CommandLineRunner {
|
||||||
|
|
||||||
for (Platform platform : parentPlatforms) {
|
for (Platform platform : parentPlatforms) {
|
||||||
|
|
||||||
PlatformCatch parentPlatformCatchOld = redisCatchStorage.queryPlatformCatchInfo(platform.getServerGBId());
|
PlatformCatch platformCatchOld = redisCatchStorage.queryPlatformCatchInfo(platform.getServerGBId());
|
||||||
|
|
||||||
// 更新缓存
|
// 更新缓存
|
||||||
PlatformCatch parentPlatformCatch = new PlatformCatch();
|
PlatformCatch platformCatch = new PlatformCatch();
|
||||||
parentPlatformCatch.setPlatform(platform);
|
platformCatch.setPlatform(platform);
|
||||||
parentPlatformCatch.setId(platform.getServerGBId());
|
platformCatch.setId(platform.getServerGBId());
|
||||||
redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
|
redisCatchStorage.updatePlatformCatchInfo(platformCatch);
|
||||||
if (parentPlatformCatchOld != null) {
|
if (platformCatchOld != null) {
|
||||||
// 取消订阅
|
// 取消订阅
|
||||||
try {
|
try {
|
||||||
log.info("[平台主动注销] {}({})", platform.getName(), platform.getServerGBId());
|
log.info("[平台主动注销] {}({})", platform.getName(), platform.getServerGBId());
|
||||||
sipCommanderForPlatform.unregister(platform, parentPlatformCatchOld.getSipTransactionInfo(), null, (eventResult)->{
|
sipCommanderForPlatform.unregister(platform, platformCatchOld.getSipTransactionInfo(), null, (eventResult)->{
|
||||||
platformService.login(platform);
|
platformService.login(platform);
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.genersoft.iot.vmp.gb28181.bean;
|
||||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -24,9 +23,6 @@ public class SubscribeHolder {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserSetting userSetting;
|
private UserSetting userSetting;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private EventPublisher eventPublisher;
|
|
||||||
|
|
||||||
private final String taskOverduePrefix = "subscribe_overdue_";
|
private final String taskOverduePrefix = "subscribe_overdue_";
|
||||||
|
|
||||||
private static ConcurrentHashMap<String, SubscribeInfo> catalogMap = new ConcurrentHashMap<>();
|
private static ConcurrentHashMap<String, SubscribeInfo> catalogMap = new ConcurrentHashMap<>();
|
||||||
|
|
|
@ -12,8 +12,8 @@ import java.util.List;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface DeviceMobilePositionMapper {
|
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)"+
|
@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}, #{longitudeGcj02}, #{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{createTime})")
|
"VALUES (#{deviceId}, #{channelId}, #{deviceName}, #{time}, #{longitude}, #{latitude}, #{altitude}, #{speed}, #{direction}, #{reportSource}, #{createTime})")
|
||||||
int insertNewPosition(MobilePosition mobilePosition);
|
int insertNewPosition(MobilePosition mobilePosition);
|
||||||
|
|
||||||
@Select(value = {" <script>" +
|
@Select(value = {" <script>" +
|
||||||
|
@ -33,31 +33,15 @@ public interface DeviceMobilePositionMapper {
|
||||||
@Delete("DELETE FROM wvp_device_mobile_position WHERE device_id = #{deviceId}")
|
@Delete("DELETE FROM wvp_device_mobile_position WHERE device_id = #{deviceId}")
|
||||||
int clearMobilePositionsByDeviceId(String deviceId);
|
int clearMobilePositionsByDeviceId(String deviceId);
|
||||||
|
|
||||||
|
|
||||||
@Insert("<script> " +
|
|
||||||
"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 " +
|
|
||||||
"<foreach collection='mobilePositions' index='index' item='item' separator=','> " +
|
|
||||||
"(#{item.deviceId}, #{item.channelId}, #{item.deviceName}, #{item.time}, #{item.longitude}, " +
|
|
||||||
"#{item.latitude}, #{item.altitude}, #{item.speed},#{item.direction}," +
|
|
||||||
"#{item.reportSource}, #{item.longitudeGcj02}, #{item.latitudeGcj02}, #{item.longitudeWgs84}, #{item.latitudeWgs84}, " +
|
|
||||||
"#{item.createTime}) " +
|
|
||||||
"</foreach> " +
|
|
||||||
"</script>")
|
|
||||||
void batchadd2(List<MobilePosition> mobilePositions);
|
|
||||||
|
|
||||||
@Insert("<script> " +
|
@Insert("<script> " +
|
||||||
"<foreach collection='mobilePositions' index='index' item='item' separator=';'> " +
|
"<foreach collection='mobilePositions' index='index' item='item' separator=';'> " +
|
||||||
"insert into wvp_device_mobile_position " +
|
"insert into wvp_device_mobile_position " +
|
||||||
"(device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source," +
|
"(device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source," +
|
||||||
"longitude_gcj02,latitude_gcj02,longitude_wgs84,latitude_wgs84,create_time)"+
|
"create_time)"+
|
||||||
"values " +
|
"values " +
|
||||||
"(#{item.deviceId}, #{item.channelId}, #{item.deviceName}, #{item.time}, #{item.longitude}, " +
|
"(#{item.deviceId}, #{item.channelId}, #{item.deviceName}, #{item.time}, #{item.longitude}, " +
|
||||||
"#{item.latitude}, #{item.altitude}, #{item.speed},#{item.direction}," +
|
"#{item.latitude}, #{item.altitude}, #{item.speed},#{item.direction}," +
|
||||||
"#{item.reportSource}, #{item.longitudeGcj02}, #{item.latitudeGcj02}, #{item.longitudeWgs84}, #{item.latitudeWgs84}, " +
|
"#{item.reportSource}, #{item.createTime}) " +
|
||||||
"#{item.createTime}) " +
|
|
||||||
"</foreach> " +
|
"</foreach> " +
|
||||||
"</script>")
|
"</script>")
|
||||||
void batchadd(List<MobilePosition> mobilePositions);
|
void batchadd(List<MobilePosition> mobilePositions);
|
||||||
|
|
|
@ -458,7 +458,7 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (CommonGBChannel channel : channelList) {
|
for (CommonGBChannel channel : channelList) {
|
||||||
GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(channel.getGbId());
|
GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(channel.getGbDeviceId());
|
||||||
// 无最新位置不发送
|
// 无最新位置不发送
|
||||||
if (gpsMsgInfo != null) {
|
if (gpsMsgInfo != null) {
|
||||||
// 经纬度都为0不发送
|
// 经纬度都为0不发送
|
||||||
|
|
|
@ -360,9 +360,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
|
||||||
if (parentPlatform == null) {
|
if (parentPlatform == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (log.isDebugEnabled()) {
|
log.info("[发送 移动位置订阅] {}/{}->{},{}", parentPlatform.getServerGBId(), gpsMsgInfo.getId(), gpsMsgInfo.getLng(), gpsMsgInfo.getLat());
|
||||||
log.info("[发送 移动位置订阅] {}/{}->{},{}", parentPlatform.getServerGBId(), gpsMsgInfo.getChannelId(), gpsMsgInfo.getLng(), gpsMsgInfo.getLat());
|
|
||||||
}
|
|
||||||
|
|
||||||
String characterSet = parentPlatform.getCharacterSet();
|
String characterSet = parentPlatform.getCharacterSet();
|
||||||
StringBuffer deviceStatusXml = new StringBuffer(600);
|
StringBuffer deviceStatusXml = new StringBuffer(600);
|
||||||
|
|
|
@ -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.getLongitude(), mobilePosition.getLatitude(), System.currentTimeMillis() - startTime);
|
||||||
mobilePosition.setReportSource("Mobile Position");
|
mobilePosition.setReportSource("Mobile Position");
|
||||||
|
|
||||||
|
|
|
@ -133,8 +133,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Platform parentPlatform = platformService.queryPlatformByServerGBId(platformId);
|
SIPResponse response = responseXmlAck(request, resultXml.toString(), platform, subscribeInfo.getExpires());
|
||||||
SIPResponse response = responseXmlAck(request, resultXml.toString(), parentPlatform, subscribeInfo.getExpires());
|
|
||||||
if (subscribeInfo.getExpires() == 0) {
|
if (subscribeInfo.getExpires() == 0) {
|
||||||
subscribeHolder.removeMobilePositionSubscribe(platformId);
|
subscribeHolder.removeMobilePositionSubscribe(platformId);
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -7,6 +7,11 @@ import lombok.Data;
|
||||||
@Data
|
@Data
|
||||||
public class GPSMsgInfo {
|
public class GPSMsgInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道国标ID
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通道ID
|
* 通道ID
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
* 接收来自redis的GPS更新通知
|
* 接收来自redis的GPS更新通知
|
||||||
* @author lin
|
* @author lin
|
||||||
* 监听: SUBSCRIBE VM_MSG_GPS
|
* 监听: 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
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
|
|
|
@ -97,7 +97,7 @@ public interface IRedisCatchStorage {
|
||||||
|
|
||||||
void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo);
|
void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo);
|
||||||
|
|
||||||
GPSMsgInfo getGpsMsgInfo(Integer gbId);
|
GPSMsgInfo getGpsMsgInfo(String gbId);
|
||||||
List<GPSMsgInfo> getAllGpsMsgInfo();
|
List<GPSMsgInfo> getAllGpsMsgInfo();
|
||||||
|
|
||||||
Long getSN(String method);
|
Long getSN(String method);
|
||||||
|
|
|
@ -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.MediaInfo;
|
||||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
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.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.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
@ -247,14 +246,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) {
|
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);
|
Duration duration = Duration.ofSeconds(60L);
|
||||||
redisTemplate.opsForValue().set(key, gpsMsgInfo, duration);
|
redisTemplate.opsForValue().set(key, gpsMsgInfo, duration);
|
||||||
// 默认GPS消息保存1分钟
|
// 默认GPS消息保存1分钟
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GPSMsgInfo getGpsMsgInfo(Integer channelId) {
|
public GPSMsgInfo getGpsMsgInfo(String channelId) {
|
||||||
String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + channelId;
|
String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + channelId;
|
||||||
return JsonUtil.redisJsonToObject(redisTemplate, key, GPSMsgInfo.class);
|
return JsonUtil.redisJsonToObject(redisTemplate, key, GPSMsgInfo.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,10 +64,6 @@ create table wvp_device_mobile_position
|
||||||
speed double precision,
|
speed double precision,
|
||||||
direction double precision,
|
direction double precision,
|
||||||
report_source character varying(50),
|
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)
|
create_time character varying(50)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -64,10 +64,6 @@ create table wvp_device_mobile_position
|
||||||
speed double precision,
|
speed double precision,
|
||||||
direction double precision,
|
direction double precision,
|
||||||
report_source character varying(50),
|
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)
|
create_time character varying(50)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue