增加设备和平台在线状态不同的同步策略
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
/**
|
||||
* 国标类型编码,国标编码中11-13位为类型编码
|
||||
* 详见 附 录 D 编码规则 A
|
||||
* @author lin
|
||||
*/
|
||||
public class ChannelIdType {
|
||||
/**
|
||||
* 中心信令控制服务器编码
|
||||
*/
|
||||
public final static String CENTRAL_SIGNALING_CONTROL_SERVER = "200";
|
||||
|
||||
/**
|
||||
* 业务分组编码
|
||||
*/
|
||||
public final static String BUSINESS_GROUP = "215";
|
||||
|
||||
/**
|
||||
* 虚拟组织编码
|
||||
*/
|
||||
public final static String VIRTUAL_ORGANIZATION = "216";
|
||||
}
|
||||
@@ -666,4 +666,8 @@ public interface DeviceChannelMapper {
|
||||
" where data_type = 1 and data_device_id=#{dataDeviceId} and device_id = #{channelId}" +
|
||||
" </script>"})
|
||||
DeviceChannel getOneBySourceChannelId(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId);
|
||||
|
||||
@Update(value = {"UPDATE wvp_device_channel SET status = 'OFF' WHERE data_type = 1 and data_device_id=#{deviceId}"})
|
||||
void offlineByDeviceId(@Param("deviceId") int deviceId);
|
||||
|
||||
}
|
||||
|
||||
@@ -161,7 +161,10 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
log.error("[命令发送失败] 查询设备信息: {}", e.getMessage());
|
||||
}
|
||||
sync(device);
|
||||
// TODO 如果设备下的通道级联到了其他平台,那么需要发送事件或者notify给上级平台
|
||||
}else {
|
||||
if (!isPlatform(device.getDeviceId())) {
|
||||
sync(device);
|
||||
}
|
||||
}
|
||||
// 上线添加订阅
|
||||
if (device.getSubscribeCycleForCatalog() > 0) {
|
||||
@@ -224,9 +227,11 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
device.setOnLine(false);
|
||||
redisCatchStorage.updateDevice(device);
|
||||
deviceMapper.update(device);
|
||||
if (device.getDeviceType() )
|
||||
//进行通道离线
|
||||
// deviceChannelMapper.offlineByDeviceId(deviceId);
|
||||
if (!isPlatform(deviceId)) {
|
||||
// 进行通道离线
|
||||
deviceChannelMapper.offlineByDeviceId(device.getId());
|
||||
}
|
||||
|
||||
// 离线释放所有ssrc
|
||||
List<SsrcTransaction> ssrcTransactions = sessionManager.getSsrcTransactionByDeviceId(deviceId);
|
||||
if (ssrcTransactions != null && !ssrcTransactions.isEmpty()) {
|
||||
@@ -256,7 +261,14 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean is
|
||||
private boolean isPlatform(String deviceId) {
|
||||
GbCode decode = GbCode.decode(deviceId);
|
||||
if (decode == null) {
|
||||
return true;
|
||||
}
|
||||
int code = Integer.parseInt(decode.getTypeCode());
|
||||
return code <= 199;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addCatalogSubscribe(Device device) {
|
||||
|
||||
@@ -131,6 +131,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
||||
Element itemDevice = deviceListIterator.next();
|
||||
Element channelDeviceElement = itemDevice.element("DeviceID");
|
||||
if (channelDeviceElement == null) {
|
||||
// 总数减一, 避免最后总数不对 无法确定问题
|
||||
continue;
|
||||
}
|
||||
// 从xml解析内容到 DeviceChannel 对象
|
||||
|
||||
Reference in New Issue
Block a user