支持配置设备上线时自动更新查询通道,修复通道刷新进度展示
parent
1983b8b0a7
commit
1469971102
|
@ -41,6 +41,8 @@ public class UserSetting {
|
|||
|
||||
private Boolean gbSendStreamStrict = Boolean.FALSE;
|
||||
|
||||
private Boolean syncChannelOnDeviceOnline = Boolean.FALSE;
|
||||
|
||||
private String serverId = "000000";
|
||||
|
||||
private String thirdPartyGBIdReg = "[\\s\\S]*";
|
||||
|
@ -186,4 +188,12 @@ public class UserSetting {
|
|||
public void setGbSendStreamStrict(Boolean gbSendStreamStrict) {
|
||||
this.gbSendStreamStrict = gbSendStreamStrict;
|
||||
}
|
||||
|
||||
public Boolean getSyncChannelOnDeviceOnline() {
|
||||
return syncChannelOnDeviceOnline;
|
||||
}
|
||||
|
||||
public void setSyncChannelOnDeviceOnline(Boolean syncChannelOnDeviceOnline) {
|
||||
this.syncChannelOnDeviceOnline = syncChannelOnDeviceOnline;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.genersoft.iot.vmp.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
|
||||
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
||||
|
@ -12,7 +13,6 @@ import com.genersoft.iot.vmp.service.IDeviceChannelService;
|
|||
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.PlatformChannelMapper;
|
||||
|
@ -78,7 +78,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
TransactionDefinition transactionDefinition;
|
||||
|
||||
@Autowired
|
||||
private IVideoManagerStorage storage;
|
||||
private UserSetting userSetting;
|
||||
|
||||
@Autowired
|
||||
private ISIPCommander commander;
|
||||
|
@ -120,16 +120,18 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
if(device.getOnline() == 0){
|
||||
device.setOnline(1);
|
||||
device.setCreateTime(now);
|
||||
logger.info("[设备上线,离线状态下重新注册]: {},查询设备信息以及通道信息", device.getDeviceId());
|
||||
deviceMapper.update(device);
|
||||
redisCatchStorage.updateDevice(device);
|
||||
try {
|
||||
commander.deviceInfoQuery(device);
|
||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
logger.error("[命令发送失败] 查询设备信息: {}", e.getMessage());
|
||||
if (userSetting.getSyncChannelOnDeviceOnline()) {
|
||||
logger.info("[设备上线,离线状态下重新注册]: {},查询设备信息以及通道信息", device.getDeviceId());
|
||||
try {
|
||||
commander.deviceInfoQuery(device);
|
||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
logger.error("[命令发送失败] 查询设备信息: {}", e.getMessage());
|
||||
}
|
||||
sync(device);
|
||||
// TODO 如果设备下的通道级联到了其他平台,那么需要发送事件或者notify给上级平台
|
||||
}
|
||||
sync(device);
|
||||
// TODO 如果设备下的通道级联到了其他平台,那么需要发送事件或者notify给上级平台
|
||||
}else {
|
||||
if (deviceChannelMapper.queryAllChannels(device.getDeviceId()).size() == 0) {
|
||||
logger.info("[设备上线]: {},通道数为0,查询通道信息", device.getDeviceId());
|
||||
|
|
|
@ -195,6 +195,8 @@ user-settings:
|
|||
# 国标级联发流严格模式,严格模式会使用与sdp信息中一致的端口发流,端口共享media.rtp.port-range,这会损失一些性能,
|
||||
# 非严格模式使用随机端口发流,性能更好, 默认关闭
|
||||
gb-send-stream-strict: false
|
||||
# 设备上线时是否自动同步通道
|
||||
sync-channel-on-device-online: false
|
||||
|
||||
# 关闭在线文档(生产环境建议关闭)
|
||||
springdoc:
|
||||
|
|
|
@ -63,37 +63,29 @@ export default {
|
|||
}
|
||||
|
||||
if (res.data.data != null) {
|
||||
if (res.data.syncIng) {
|
||||
if (res.data.data.syncIng) {
|
||||
if (res.data.data.total == 0) {
|
||||
if (res.data.data.errorMsg !== null ){
|
||||
this.msg = res.data.data.errorMsg;
|
||||
this.syncStatus = "exception"
|
||||
}else {
|
||||
this.msg = `等待同步中`;
|
||||
this.timmer = setTimeout(this.getProgress, 300)
|
||||
}
|
||||
}else {
|
||||
if (res.data.data.total == res.data.data.current) {
|
||||
this.syncStatus = "success"
|
||||
this.percentage = 100;
|
||||
this.msg = '同步成功';
|
||||
}else {
|
||||
if (res.data.data.errorMsg !== null ){
|
||||
this.msg = res.data.data.errorMsg;
|
||||
this.syncStatus = "exception"
|
||||
}else {
|
||||
this.total = res.data.data.total;
|
||||
this.current = res.data.data.current;
|
||||
this.percentage = Math.floor(Number(res.data.data.current)/Number(res.data.data.total)* 10000)/100;
|
||||
this.msg = `同步中...[${res.data.data.current}/${res.data.data.total}]`;
|
||||
this.timmer = setTimeout(this.getProgress, 300)
|
||||
}
|
||||
}
|
||||
this.msg = `等待同步中`;
|
||||
this.timmer = setTimeout(this.getProgress, 300)
|
||||
}else {
|
||||
this.total = res.data.data.total;
|
||||
this.current = res.data.data.current;
|
||||
this.percentage = Math.floor(Number(res.data.data.current)/Number(res.data.data.total)* 10000)/100;
|
||||
this.msg = `同步中...[${res.data.data.current}/${res.data.data.total}]`;
|
||||
this.timmer = setTimeout(this.getProgress, 300)
|
||||
}
|
||||
}else {
|
||||
this.syncStatus = "success"
|
||||
this.percentage = 100;
|
||||
this.msg = '同步成功';
|
||||
if (res.data.data.errorMsg){
|
||||
this.msg = res.data.data.errorMsg;
|
||||
this.syncStatus = "exception"
|
||||
}else {
|
||||
this.syncStatus = "success"
|
||||
this.percentage = 100;
|
||||
this.msg = '同步成功';
|
||||
setTimeout(()=>{
|
||||
this.showDialog = false;
|
||||
}, 3000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
|
|
Loading…
Reference in New Issue