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