mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-25 14:37:53 +08:00
Merge branch 'refs/heads/master' into 1078
This commit is contained in:
commit
e0adc7306b
@ -74,6 +74,8 @@ public class UserSetting {
|
|||||||
|
|
||||||
private boolean registerKeepIntDialog = false;
|
private boolean registerKeepIntDialog = false;
|
||||||
|
|
||||||
|
private int gbDeviceOnline = 0;
|
||||||
|
|
||||||
public Boolean getSavePositionHistory() {
|
public Boolean getSavePositionHistory() {
|
||||||
return savePositionHistory;
|
return savePositionHistory;
|
||||||
}
|
}
|
||||||
@ -325,4 +327,12 @@ public class UserSetting {
|
|||||||
public void setDocEnable(Boolean docEnable) {
|
public void setDocEnable(Boolean docEnable) {
|
||||||
this.docEnable = docEnable;
|
this.docEnable = docEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getGbDeviceOnline() {
|
||||||
|
return gbDeviceOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGbDeviceOnline(int gbDeviceOnline) {
|
||||||
|
this.gbDeviceOnline = gbDeviceOnline;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,6 @@ 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.task.ISubscribeTask;
|
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
||||||
import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeHandlerTask;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -58,12 +57,19 @@ public class SubscribeHolder {
|
|||||||
dynamicTask.stop(taskOverdueKey);
|
dynamicTask.stop(taskOverdueKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void putMobilePositionSubscribe(String platformId, SubscribeInfo subscribeInfo) {
|
public void putMobilePositionSubscribe(String platformId, SubscribeInfo subscribeInfo, Runnable gpsTask) {
|
||||||
mobilePositionMap.put(platformId, subscribeInfo);
|
mobilePositionMap.put(platformId, subscribeInfo);
|
||||||
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "MobilePosition_" + platformId;
|
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "MobilePosition_" + platformId;
|
||||||
// 添加任务处理GPS定时推送
|
// 添加任务处理GPS定时推送
|
||||||
dynamicTask.startCron(key, new MobilePositionSubscribeHandlerTask(platformId),
|
|
||||||
subscribeInfo.getGpsInterval() * 1000);
|
int cycleForCatalog;
|
||||||
|
if (subscribeInfo.getGpsInterval() <= 0) {
|
||||||
|
cycleForCatalog = 5;
|
||||||
|
}else {
|
||||||
|
cycleForCatalog = subscribeInfo.getGpsInterval();
|
||||||
|
}
|
||||||
|
dynamicTask.startCron(key, gpsTask,
|
||||||
|
cycleForCatalog * 1000);
|
||||||
String taskOverdueKey = taskOverduePrefix + "MobilePosition_" + platformId;
|
String taskOverdueKey = taskOverduePrefix + "MobilePosition_" + platformId;
|
||||||
if (subscribeInfo.getExpires() > 0) {
|
if (subscribeInfo.getExpires() > 0) {
|
||||||
// 添加任务处理订阅过期
|
// 添加任务处理订阅过期
|
||||||
|
|||||||
@ -79,7 +79,7 @@ public class EventPublisher {
|
|||||||
// 数据去重
|
// 数据去重
|
||||||
Set<String> gbIdSet = new HashSet<>();
|
Set<String> gbIdSet = new HashSet<>();
|
||||||
for (DeviceChannel deviceChannel : deviceChannels) {
|
for (DeviceChannel deviceChannel : deviceChannels) {
|
||||||
if (!gbIdSet.contains(deviceChannel.getChannelId())) {
|
if (deviceChannel != null && deviceChannel.getChannelId() != null && !gbIdSet.contains(deviceChannel.getChannelId())) {
|
||||||
gbIdSet.add(deviceChannel.getChannelId());
|
gbIdSet.add(deviceChannel.getChannelId());
|
||||||
channels.add(deviceChannel);
|
channels.add(deviceChannel);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,33 +0,0 @@
|
|||||||
package com.genersoft.iot.vmp.gb28181.task.impl;
|
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.common.CommonCallback;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
|
||||||
import com.genersoft.iot.vmp.service.IPlatformService;
|
|
||||||
import com.genersoft.iot.vmp.utils.SpringBeanFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 向已经订阅(移动位置)的上级发送MobilePosition消息
|
|
||||||
* @author lin
|
|
||||||
*/
|
|
||||||
public class MobilePositionSubscribeHandlerTask implements ISubscribeTask {
|
|
||||||
|
|
||||||
|
|
||||||
private IPlatformService platformService;
|
|
||||||
private String platformId;
|
|
||||||
|
|
||||||
|
|
||||||
public MobilePositionSubscribeHandlerTask(String platformId) {
|
|
||||||
this.platformService = SpringBeanFactory.getBean("platformServiceImpl");
|
|
||||||
this.platformId = platformId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
platformService.sendNotifyMobilePosition(this.platformId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stop(CommonCallback<Boolean> callback) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1230,6 +1230,8 @@ public class SIPCommander implements ISIPCommander {
|
|||||||
subscribePostitionXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n");
|
subscribePostitionXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n");
|
||||||
if (device.getSubscribeCycleForMobilePosition() > 0) {
|
if (device.getSubscribeCycleForMobilePosition() > 0) {
|
||||||
subscribePostitionXml.append("<Interval>" + device.getMobilePositionSubmissionInterval() + "</Interval>\r\n");
|
subscribePostitionXml.append("<Interval>" + device.getMobilePositionSubmissionInterval() + "</Interval>\r\n");
|
||||||
|
}else {
|
||||||
|
subscribePostitionXml.append("<Interval>5</Interval>\r\n");
|
||||||
}
|
}
|
||||||
subscribePostitionXml.append("</Query>\r\n");
|
subscribePostitionXml.append("</Query>\r\n");
|
||||||
|
|
||||||
|
|||||||
@ -147,7 +147,9 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
|
|||||||
subscribeHolder.removeMobilePositionSubscribe(platformId);
|
subscribeHolder.removeMobilePositionSubscribe(platformId);
|
||||||
}else {
|
}else {
|
||||||
subscribeInfo.setResponse(response);
|
subscribeInfo.setResponse(response);
|
||||||
subscribeHolder.putMobilePositionSubscribe(platformId, subscribeInfo);
|
subscribeHolder.putMobilePositionSubscribe(platformId, subscribeInfo, ()->{
|
||||||
|
platformService.sendNotifyMobilePosition(platformId);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
|
|||||||
@ -62,7 +62,10 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
|||||||
}
|
}
|
||||||
SIPRequest request = (SIPRequest) evt.getRequest();
|
SIPRequest request = (SIPRequest) evt.getRequest();
|
||||||
logger.info("[收到心跳] device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId());
|
logger.info("[收到心跳] device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId());
|
||||||
|
if (userSetting.getGbDeviceOnline() == 0 && !device.isOnLine()) {
|
||||||
|
logger.warn("[收到心跳] 设备离线,心跳不进行回复, device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 回复200 OK
|
// 回复200 OK
|
||||||
try {
|
try {
|
||||||
responseAck(request, Response.OK);
|
responseAck(request, Response.OK);
|
||||||
@ -101,9 +104,10 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
|||||||
if (device.isOnLine()) {
|
if (device.isOnLine()) {
|
||||||
deviceService.updateDevice(device);
|
deviceService.updateDevice(device);
|
||||||
}else {
|
}else {
|
||||||
// 对于已经离线的设备判断他的注册是否已经过期
|
if (userSetting.getGbDeviceOnline() == 1) {
|
||||||
if (!deviceService.expire(device)){
|
// 对于已经离线的设备判断他的注册是否已经过期
|
||||||
device.setOnLine(false);
|
device.setOnLine(true);
|
||||||
|
device.setRegisterTime(DateUtil.getNow());
|
||||||
deviceService.online(device, null);
|
deviceService.online(device, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1003,6 +1003,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||||||
dynamicTask.stop(downLoadTimeOutTaskKey);
|
dynamicTask.stop(downLoadTimeOutTaskKey);
|
||||||
callback.run(InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getCode(),
|
callback.run(InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getCode(),
|
||||||
String.format("录像下载失败, 错误码: %s, %s", event.statusCode, event.msg), null);
|
String.format("录像下载失败, 错误码: %s, %s", event.statusCode, event.msg), null);
|
||||||
|
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||||
streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
|
streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
|
||||||
inviteStreamService.removeInviteInfo(inviteInfo);
|
inviteStreamService.removeInviteInfo(inviteInfo);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.common.StreamInfo;
|
|||||||
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.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||||
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;
|
||||||
@ -531,7 +532,16 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateStatus(boolean status, String app, String stream) {
|
public int updateStatus(boolean status, String app, String stream) {
|
||||||
return streamProxyMapper.updateStatus(app, stream, status);
|
// 状态变化时推送到国标上级
|
||||||
|
StreamProxyItem streamProxyItem = streamProxyMapper.selectOne(app, stream);
|
||||||
|
if (streamProxyItem == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int result = streamProxyMapper.updateStatus(app, stream, status);
|
||||||
|
if (!ObjectUtils.isEmpty(streamProxyItem.getGbId())) {
|
||||||
|
gbStreamService.sendCatalogMsg(streamProxyItem, status?CatalogEvent.ON:CatalogEvent.OFF);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncPullStream(String mediaServerId){
|
private void syncPullStream(String mediaServerId){
|
||||||
|
|||||||
@ -322,6 +322,9 @@ public class DeviceQuery {
|
|||||||
public void updateDevice(Device device){
|
public void updateDevice(Device device){
|
||||||
|
|
||||||
if (device != null && device.getDeviceId() != null) {
|
if (device != null && device.getDeviceId() != null) {
|
||||||
|
if (device.getSubscribeCycleForMobilePosition() > 0 && device.getMobilePositionSubmissionInterval() <= 0) {
|
||||||
|
device.setMobilePositionSubmissionInterval(5);
|
||||||
|
}
|
||||||
deviceService.updateCustomDevice(device);
|
deviceService.updateCustomDevice(device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -247,6 +247,10 @@ user-settings:
|
|||||||
allowed-origins:
|
allowed-origins:
|
||||||
- http://localhost:8008
|
- http://localhost:8008
|
||||||
- http://192.168.1.3:8008
|
- http://192.168.1.3:8008
|
||||||
|
# 国标设备离线后的上线策略,
|
||||||
|
# 0: 国标标准实现,设备离线后不回复心跳,直到设备重新注册上线,
|
||||||
|
# 1: 对于离线设备,收到心跳就把设备设置为上线,并更新注册时间为上次这次心跳的时间。防止过期时间判断异常
|
||||||
|
gb-device-online: 0
|
||||||
|
|
||||||
# 关闭在线文档(生产环境建议关闭)
|
# 关闭在线文档(生产环境建议关闭)
|
||||||
springdoc:
|
springdoc:
|
||||||
|
|||||||
@ -128,6 +128,9 @@ export default {
|
|||||||
this.form.subscribeCycleForCatalog = this.form.subscribeCycleForCatalog||0
|
this.form.subscribeCycleForCatalog = this.form.subscribeCycleForCatalog||0
|
||||||
this.form.subscribeCycleForMobilePosition = this.form.subscribeCycleForMobilePosition||0
|
this.form.subscribeCycleForMobilePosition = this.form.subscribeCycleForMobilePosition||0
|
||||||
this.form.mobilePositionSubmissionInterval = this.form.mobilePositionSubmissionInterval||0
|
this.form.mobilePositionSubmissionInterval = this.form.mobilePositionSubmissionInterval||0
|
||||||
|
if (this.form.mobilePositionSubmissionInterval === 0) {
|
||||||
|
this.form.mobilePositionSubmissionInterval = 5
|
||||||
|
}
|
||||||
this.$axios({
|
this.$axios({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url:`/api/device/query/device/${this.isEdit?'update':'add'}/`,
|
url:`/api/device/query/device/${this.isEdit?'update':'add'}/`,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user