Merge branch 'refs/heads/2.7.1'

dev/abl支持
648540858 2024-06-11 10:14:14 +08:00
commit 2cf7178cb7
6 changed files with 21 additions and 38 deletions

View File

@ -4,7 +4,6 @@ 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.task.ISubscribeTask;
import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeHandlerTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -58,12 +57,19 @@ public class SubscribeHolder {
dynamicTask.stop(taskOverdueKey);
}
public void putMobilePositionSubscribe(String platformId, SubscribeInfo subscribeInfo) {
public void putMobilePositionSubscribe(String platformId, SubscribeInfo subscribeInfo, Runnable gpsTask) {
mobilePositionMap.put(platformId, subscribeInfo);
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "MobilePosition_" + platformId;
// 添加任务处理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;
if (subscribeInfo.getExpires() > 0) {
// 添加任务处理订阅过期

View File

@ -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) {
}
}

View File

@ -1230,6 +1230,8 @@ public class SIPCommander implements ISIPCommander {
subscribePostitionXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n");
if (device.getSubscribeCycleForMobilePosition() > 0) {
subscribePostitionXml.append("<Interval>" + device.getMobilePositionSubmissionInterval() + "</Interval>\r\n");
}else {
subscribePostitionXml.append("<Interval>5</Interval>\r\n");
}
subscribePostitionXml.append("</Query>\r\n");

View File

@ -147,7 +147,9 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
subscribeHolder.removeMobilePositionSubscribe(platformId);
}else {
subscribeInfo.setResponse(response);
subscribeHolder.putMobilePositionSubscribe(platformId, subscribeInfo);
subscribeHolder.putMobilePositionSubscribe(platformId, subscribeInfo, ()->{
platformService.sendNotifyMobilePosition(platformId);
});
}
} catch (SipException | InvalidArgumentException | ParseException e) {

View File

@ -322,6 +322,9 @@ public class DeviceQuery {
public void updateDevice(Device device){
if (device != null && device.getDeviceId() != null) {
if (device.getSubscribeCycleForMobilePosition() > 0 && device.getMobilePositionSubmissionInterval() <= 0) {
device.setMobilePositionSubmissionInterval(5);
}
deviceService.updateCustomDevice(device);
}
}

View File

@ -128,6 +128,9 @@ export default {
this.form.subscribeCycleForCatalog = this.form.subscribeCycleForCatalog||0
this.form.subscribeCycleForMobilePosition = this.form.subscribeCycleForMobilePosition||0
this.form.mobilePositionSubmissionInterval = this.form.mobilePositionSubmissionInterval||0
if (this.form.mobilePositionSubmissionInterval === 0) {
this.form.mobilePositionSubmissionInterval = 5
}
this.$axios({
method: 'post',
url:`/api/device/query/device/${this.isEdit?'update':'add'}/`,