临时提交

pull/1733/head
648540858 2024-12-23 07:20:48 +08:00
parent 825daad355
commit 19453f7ca9
17 changed files with 101 additions and 59 deletions

View File

@ -0,0 +1,25 @@
package com.genersoft.iot.vmp.common.enums;
import lombok.Getter;
/**
*
*/
public enum ChannelDataType {
GB28181(1,"国标28181"),
STREAM_PUSH(2,"推流设备"),
STREAM_PROXY(3,"拉流代理");
public final int value;
public final String desc;
ChannelDataType(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
}

View File

@ -123,17 +123,14 @@ public class CommonGBChannel {
@Schema(description = "国标-时域编码能力,取值0-不支持;1-1级增强;2-2级增强;3-3级增强(可选)") @Schema(description = "国标-时域编码能力,取值0-不支持;1-1级增强;2-2级增强;3-3级增强(可选)")
private Integer gbSvcTimeSupportMode; private Integer gbSvcTimeSupportMode;
@Schema(description = "关联的国标设备数据库ID")
private Integer gbDeviceDbId;
@Schema(description = "二进制保存的录制计划, 每一位表示每个小时的前半个小时") @Schema(description = "二进制保存的录制计划, 每一位表示每个小时的前半个小时")
private Long recordPLan; private Long recordPLan;
@Schema(description = "关联的推流Id流来源是推流时有效") @Schema(description = "关联的数据类型")
private Integer streamPushId; private Integer dataType;
@Schema(description = "关联的拉流代理Id流来源是拉流代理时有效") @Schema(description = "关联的设备ID")
private Integer streamProxyId; private Integer dataDeviceId;
@Schema(description = "创建时间") @Schema(description = "创建时间")
private String createTime; private String createTime;

View File

@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.gb28181.service.impl; package com.genersoft.iot.vmp.gb28181.service.impl;
import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.InviteInfo; import com.genersoft.iot.vmp.gb28181.bean.InviteInfo;
import com.genersoft.iot.vmp.gb28181.bean.Platform; import com.genersoft.iot.vmp.gb28181.bean.Platform;
@ -33,7 +34,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
@Override @Override
public void start(CommonGBChannel channel, InviteInfo inviteInfo, Platform platform, ErrorCallback<StreamInfo> callback) { public void start(CommonGBChannel channel, InviteInfo inviteInfo, Platform platform, ErrorCallback<StreamInfo> callback) {
if (channel == null || inviteInfo == null || callback == null) { if (channel == null || inviteInfo == null || callback == null || channel.getDataType() == null) {
log.warn("[通用通道点播] 参数异常, channel: {}, inviteInfo: {}, callback: {}", channel != null, inviteInfo != null, callback != null); log.warn("[通用通道点播] 参数异常, channel: {}, inviteInfo: {}, callback: {}", channel != null, inviteInfo != null, callback != null);
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error"); throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
} }
@ -41,14 +42,14 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
if ("Play".equalsIgnoreCase(inviteInfo.getSessionName())) { if ("Play".equalsIgnoreCase(inviteInfo.getSessionName())) {
play(channel, platform, callback); play(channel, platform, callback);
}else if ("Playback".equals(inviteInfo.getSessionName())) { }else if ("Playback".equals(inviteInfo.getSessionName())) {
if (channel.getGbDeviceDbId() != null) { if (channel.getDataType() == ChannelDataType.GB28181.value) {
// 国标通道 // 国标通道
playbackGbDeviceChannel(channel, inviteInfo.getStartTime(), inviteInfo.getStopTime(), callback); playbackGbDeviceChannel(channel, inviteInfo.getStartTime(), inviteInfo.getStopTime(), callback);
} else if (channel.getStreamProxyId() != null) { } else if (channel.getDataType() == ChannelDataType.STREAM_PROXY.value) {
// 拉流代理 // 拉流代理
log.warn("[回放通用通道] 不支持回放拉流代理的录像: {}({})", channel.getGbName(), channel.getGbDeviceId()); log.warn("[回放通用通道] 不支持回放拉流代理的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
throw new PlayException(Response.FORBIDDEN, "forbidden"); throw new PlayException(Response.FORBIDDEN, "forbidden");
} else if (channel.getStreamPushId() != null) { } else if (channel.getDataType() == ChannelDataType.STREAM_PUSH.value) {
// 推流 // 推流
log.warn("[回放通用通道] 不支持回放推流的录像: {}({})", channel.getGbName(), channel.getGbDeviceId()); log.warn("[回放通用通道] 不支持回放推流的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
throw new PlayException(Response.FORBIDDEN, "forbidden"); throw new PlayException(Response.FORBIDDEN, "forbidden");
@ -58,7 +59,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error"); throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
} }
}else if ("Download".equals(inviteInfo.getSessionName())) { }else if ("Download".equals(inviteInfo.getSessionName())) {
if (channel.getGbDeviceDbId() != null) { if (channel.getDataType() == ChannelDataType.GB28181.value) {
int downloadSpeed = 4; int downloadSpeed = 4;
try { try {
if (inviteInfo.getDownloadSpeed() != null){ if (inviteInfo.getDownloadSpeed() != null){
@ -68,11 +69,11 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
// 国标通道 // 国标通道
downloadGbDeviceChannel(channel, inviteInfo.getStartTime(), inviteInfo.getStopTime(), downloadSpeed, callback); downloadGbDeviceChannel(channel, inviteInfo.getStartTime(), inviteInfo.getStopTime(), downloadSpeed, callback);
} else if (channel.getStreamProxyId() != null) { } else if (channel.getDataType() == ChannelDataType.STREAM_PROXY.value) {
// 拉流代理 // 拉流代理
log.warn("[下载通用通道录像] 不支持下载拉流代理的录像: {}({})", channel.getGbName(), channel.getGbDeviceId()); log.warn("[下载通用通道录像] 不支持下载拉流代理的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
throw new PlayException(Response.FORBIDDEN, "forbidden"); throw new PlayException(Response.FORBIDDEN, "forbidden");
} else if (channel.getStreamPushId() != null) { } else if (channel.getDataType() == ChannelDataType.STREAM_PUSH.value) {
// 推流 // 推流
log.warn("[下载通用通道录像] 不支持下载推流的录像: {}({})", channel.getGbName(), channel.getGbDeviceId()); log.warn("[下载通用通道录像] 不支持下载推流的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
throw new PlayException(Response.FORBIDDEN, "forbidden"); throw new PlayException(Response.FORBIDDEN, "forbidden");
@ -90,13 +91,13 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
@Override @Override
public void play(CommonGBChannel channel, Platform platform, ErrorCallback<StreamInfo> callback) { public void play(CommonGBChannel channel, Platform platform, ErrorCallback<StreamInfo> callback) {
if (channel.getGbDeviceDbId() != null) { if (channel.getDataType() == ChannelDataType.GB28181.value) {
// 国标通道 // 国标通道
playGbDeviceChannel(channel, callback); playGbDeviceChannel(channel, callback);
} else if (channel.getStreamProxyId() != null) { } else if (channel.getDataType() == ChannelDataType.STREAM_PROXY.value) {
// 拉流代理 // 拉流代理
playProxy(channel, callback); playProxy(channel, callback);
} else if (channel.getStreamPushId() != null) { } else if (channel.getDataType() == ChannelDataType.STREAM_PUSH.value) {
if (platform != null) { if (platform != null) {
// 推流 // 推流
playPush(channel, platform.getServerGBId(), platform.getName(), callback); playPush(channel, platform.getServerGBId(), platform.getName(), callback);
@ -128,7 +129,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
public void playProxy(CommonGBChannel channel, ErrorCallback<StreamInfo> callback){ public void playProxy(CommonGBChannel channel, ErrorCallback<StreamInfo> callback){
// 拉流代理通道 // 拉流代理通道
try { try {
StreamInfo streamInfo = streamProxyPlayService.start(channel.getStreamProxyId()); StreamInfo streamInfo = streamProxyPlayService.start(channel.getDataDeviceId());
if (streamInfo == null) { if (streamInfo == null) {
callback.run(Response.BUSY_HERE, "busy here", null); callback.run(Response.BUSY_HERE, "busy here", null);
}else { }else {
@ -143,7 +144,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
public void playPush(CommonGBChannel channel, String platformDeviceId, String platformName, ErrorCallback<StreamInfo> callback){ public void playPush(CommonGBChannel channel, String platformDeviceId, String platformName, ErrorCallback<StreamInfo> callback){
// 推流 // 推流
try { try {
streamPushPlayService.start(channel.getStreamPushId(), callback, platformDeviceId, platformName); streamPushPlayService.start(channel.getDataDeviceId(), callback, platformDeviceId, platformName);
}catch (PlayException e) { }catch (PlayException e) {
callback.run(e.getCode(), e.getMsg(), null); callback.run(e.getCode(), e.getMsg(), null);
}catch (Exception e) { }catch (Exception e) {

View File

@ -53,7 +53,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override @Override
public int add(CommonGBChannel commonGBChannel) { public int add(CommonGBChannel commonGBChannel) {
if (commonGBChannel.getStreamPushId() != null && commonGBChannel.getStreamPushId() > 0) { if (commonGBChannel.getDataType() != null && commonGBChannel.getDataDeviceId() > 0) {
CommonGBChannel commonGBChannelInDb = commonGBChannelMapper.queryByStreamPushId(commonGBChannel.getStreamPushId()); CommonGBChannel commonGBChannelInDb = commonGBChannelMapper.queryByStreamPushId(commonGBChannel.getStreamPushId());
if (commonGBChannelInDb != null) { if (commonGBChannelInDb != null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "此推流已经关联通道"); throw new ControllerException(ErrorCode.ERROR100.getCode(), "此推流已经关联通道");

View File

@ -1648,7 +1648,7 @@ public class PlayServiceImpl implements IPlayService {
@Override @Override
public void play(CommonGBChannel channel, ErrorCallback<StreamInfo> callback) { public void play(CommonGBChannel channel, ErrorCallback<StreamInfo> callback) {
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
log.warn("[点播] 未找到通道{}的设备信息", channel); log.warn("[点播] 未找到通道{}的设备信息", channel);
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error"); throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
@ -1668,7 +1668,7 @@ public class PlayServiceImpl implements IPlayService {
throw new PlayException(Response.BAD_REQUEST, "bad request"); throw new PlayException(Response.BAD_REQUEST, "bad request");
} }
// 国标通道 // 国标通道
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
log.warn("[点播] 未找到通道{}的设备信息", channel); log.warn("[点播] 未找到通道{}的设备信息", channel);
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error"); throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
@ -1689,7 +1689,7 @@ public class PlayServiceImpl implements IPlayService {
throw new PlayException(Response.BAD_REQUEST, "bad request"); throw new PlayException(Response.BAD_REQUEST, "bad request");
} }
// 国标通道 // 国标通道
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
log.warn("[点播] 未找到通道{}的设备信息", channel); log.warn("[点播] 未找到通道{}的设备信息", channel);
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error"); throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");

View File

@ -199,7 +199,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
platformService.stopBroadcast(platform, channel, ssrcTransaction.getStream(), false, platformService.stopBroadcast(platform, channel, ssrcTransaction.getStream(), false,
mediaServerService.getOne(mediaServerId)); mediaServerService.getOne(mediaServerId));
DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channel.getGbId()); DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channel.getGbId());
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
playService.stopAudioBroadcast(device, deviceChannel); playService.stopAudioBroadcast(device, deviceChannel);
} }

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.info; package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.info;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
import com.genersoft.iot.vmp.gb28181.service.*; import com.genersoft.iot.vmp.gb28181.service.*;
@ -101,7 +102,7 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
return; return;
} }
// 判断通道类型 // 判断通道类型
if (channel.getGbDeviceDbId() == null) { if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 非国标通道不支持录像回放控制 // 非国标通道不支持录像回放控制
log.warn("[INFO 消息] 非国标通道不支持录像回放控制: 通道ID {}", sendRtpInfo.getChannelId()); log.warn("[INFO 消息] 非国标通道不支持录像回放控制: 通道ID {}", sendRtpInfo.getChannelId());
responseAck(request, Response.FORBIDDEN, ""); responseAck(request, Response.FORBIDDEN, "");
@ -109,7 +110,7 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
} }
// 根据通道ID获取所属设备 // 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
// 不存在则回复404 // 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", sendRtpInfo.getChannelId()); log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", sendRtpInfo.getChannelId());

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.control.cmd; package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.control.cmd;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.common.enums.DeviceControlType; import com.genersoft.iot.vmp.common.enums.DeviceControlType;
import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
@ -134,7 +135,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
* *
*/ */
private void handlePtzCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) { private void handlePtzCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
if (channel.getGbDeviceDbId() == 0) { if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制 // 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的云台控制, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 只支持国标的云台控制, 通道ID {}", channel.getGbId());
try { try {
@ -145,7 +146,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return; return;
} }
// 根据通道ID获取所属设备 // 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
// 不存在则回复404 // 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
@ -184,7 +185,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
* *
*/ */
private void handleIFameCmd(CommonGBChannel channel, SIPRequest request) { private void handleIFameCmd(CommonGBChannel channel, SIPRequest request) {
if (channel.getGbDeviceDbId() == 0) { if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制 // 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的处理强制关键帧, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 只支持国标的处理强制关键帧, 通道ID {}", channel.getGbId());
try { try {
@ -195,7 +196,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return; return;
} }
// 根据通道ID获取所属设备 // 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
// 不存在则回复404 // 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
@ -232,7 +233,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
* *
*/ */
private void handleTeleBootCmd(CommonGBChannel channel, SIPRequest request) { private void handleTeleBootCmd(CommonGBChannel channel, SIPRequest request) {
if (channel.getGbDeviceDbId() == 0) { if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制 // 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的重启命令, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 只支持国标的重启命令, 通道ID {}", channel.getGbId());
try { try {
@ -243,7 +244,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return; return;
} }
// 根据通道ID获取所属设备 // 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
// 不存在则回复404 // 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
@ -267,7 +268,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
* *
*/ */
private void handleDragZoom(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) { private void handleDragZoom(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
if (channel.getGbDeviceDbId() == 0) { if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制 // 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的拉框控制, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 只支持国标的拉框控制, 通道ID {}", channel.getGbId());
try { try {
@ -278,7 +279,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return; return;
} }
// 根据通道ID获取所属设备 // 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
// 不存在则回复404 // 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
@ -330,7 +331,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
* *
*/ */
private void handleHomePositionCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) { private void handleHomePositionCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
if (channel.getGbDeviceDbId() == 0) { if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制 // 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的看守位命令, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 只支持国标的看守位命令, 通道ID {}", channel.getGbId());
try { try {
@ -341,7 +342,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return; return;
} }
// 根据通道ID获取所属设备 // 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
// 不存在则回复404 // 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
@ -382,7 +383,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
* *
*/ */
private void handleAlarmCmd(CommonGBChannel channel, Element rootElement, SIPRequest request) { private void handleAlarmCmd(CommonGBChannel channel, Element rootElement, SIPRequest request) {
if (channel.getGbDeviceDbId() == 0) { if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制 // 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的告警消息, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 只支持国标的告警消息, 通道ID {}", channel.getGbId());
try { try {
@ -393,7 +394,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return; return;
} }
// 根据通道ID获取所属设备 // 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
// 不存在则回复404 // 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
@ -428,7 +429,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
* *
*/ */
private void handleRecordCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) { private void handleRecordCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
if (channel.getGbDeviceDbId() == 0) { if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制 // 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的息录像控制, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 只支持国标的息录像控制, 通道ID {}", channel.getGbId());
try { try {
@ -439,7 +440,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return; return;
} }
// 根据通道ID获取所属设备 // 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
// 不存在则回复404 // 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
@ -480,7 +481,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
* / * /
*/ */
private void handleGuardCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) { private void handleGuardCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
if (channel.getGbDeviceDbId() == 0) { if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制 // 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的报警布防/撤防命令, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 只支持国标的报警布防/撤防命令, 通道ID {}", channel.getGbId());
try { try {
@ -491,7 +492,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return; return;
} }
// 根据通道ID获取所属设备 // 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
// 不存在则回复404 // 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId()); log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.service.*; import com.genersoft.iot.vmp.gb28181.service.*;
@ -106,8 +107,18 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
responseAck(request, Response.NOT_FOUND, "TargetID not found"); responseAck(request, Response.NOT_FOUND, "TargetID not found");
return; return;
} }
if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的语音喊话
log.warn("[INFO 消息] 只支持国标的语音喊话命令, 通道ID {}", channel.getGbId());
try {
responseAck(request, Response.FORBIDDEN, "");
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 错误信息: {}", e.getMessage());
}
return;
}
// 向下级发送语音的喊话请求 // 向下级发送语音的喊话请求
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
responseAck(request, Response.NOT_FOUND, "device not found"); responseAck(request, Response.NOT_FOUND, "device not found");
return; return;

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd; package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.Platform; import com.genersoft.iot.vmp.gb28181.bean.Platform;
@ -93,7 +94,7 @@ public class DeviceInfoQueryMessageHandler extends SIPRequestProcessorParent imp
return; return;
} }
// 判断通道类型 // 判断通道类型
if (channel.getGbDeviceDbId() == null) { if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 非国标通道不支持录像回放控制 // 非国标通道不支持录像回放控制
log.warn("[DeviceInfo] 非国标通道不支持录像回放控制: 通道ID {}", channel.getGbId()); log.warn("[DeviceInfo] 非国标通道不支持录像回放控制: 通道ID {}", channel.getGbId());
try { try {
@ -106,10 +107,10 @@ public class DeviceInfoQueryMessageHandler extends SIPRequestProcessorParent imp
} }
// 根据通道ID获取所属设备 // 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
// 不存在则回复404 // 不存在则回复404
log.warn("[DeviceInfo] 通道所属设备不存在, 通道ID {}", channel.getGbDeviceDbId()); log.warn("[DeviceInfo] 通道所属设备不存在, 通道ID {}", channel.getDataDeviceId());
try { try {
responseAck(request, Response.NOT_FOUND, "device not found "); responseAck(request, Response.NOT_FOUND, "device not found ");

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd; package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
@ -104,8 +105,8 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
} }
return; return;
} }
if (channel.getGbId() == 0 ) { if (channel.getDataType() != ChannelDataType.GB28181.value) {
log.info("[平台查询录像记录] 不支持查询推流和拉流代理的录像数据 {}/{}", platform.getName(), channelId ); log.info("[平台查询录像记录] 只支持查询国标28181的录像数据 {}/{}", platform.getName(), channelId );
try { try {
responseAck(request, Response.NOT_IMPLEMENTED); // 回复未实现 responseAck(request, Response.NOT_IMPLEMENTED); // 回复未实现
} catch (SipException | InvalidArgumentException | ParseException e) { } catch (SipException | InvalidArgumentException | ParseException e) {
@ -113,7 +114,7 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
} }
return; return;
} }
Device device = deviceService.getDevice(channel.getGbDeviceDbId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
log.warn("[平台查询录像记录] 未找到通道对应的设备 {}/{}", platform.getName(), channelId ); log.warn("[平台查询录像记录] 未找到通道对应的设备 {}/{}", platform.getName(), channelId );
try { try {

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.streamProxy.bean; package com.genersoft.iot.vmp.streamProxy.bean;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -72,7 +73,8 @@ public class StreamProxy extends CommonGBChannel {
if (ObjectUtils.isEmpty(this.getGbName())) { if (ObjectUtils.isEmpty(this.getGbName())) {
this.setGbName( app+ "-" +stream); this.setGbName( app+ "-" +stream);
} }
this.setStreamProxyId(this.getId()); this.setDataType(ChannelDataType.STREAM_PROXY.value);
this.setDataDeviceId(this.getId());
return this; return this;
} }
} }

View File

@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.streamPush.bean; package com.genersoft.iot.vmp.streamPush.bean;
import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent; import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.utils.DateUtil;
@ -115,7 +116,8 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
if (ObjectUtils.isEmpty(this.getGbName())) { if (ObjectUtils.isEmpty(this.getGbName())) {
this.setGbName( app+ "-" +stream); this.setGbName( app+ "-" +stream);
} }
this.setStreamPushId(this.getId()); this.setDataType(ChannelDataType.STREAM_PUSH.value);
this.setDataDeviceId(this.getId());
return this; return this;
} }

View File

@ -147,8 +147,8 @@ create table wvp_device_channel
gb_svc_space_support_mod integer, gb_svc_space_support_mod integer,
gb_svc_time_support_mode integer, gb_svc_time_support_mode integer,
record_plan_id integer, record_plan_id integer,
data_type integer, data_type integer not null,
data_device_id integer, data_device_id integer not null,
constraint uk_wvp_device_channel_unique_data unique (data_type, data_device_id), constraint uk_wvp_device_channel_unique_data unique (data_type, data_device_id),
constraint uk_wvp_unique_channel unique (gb_device_id) constraint uk_wvp_unique_channel unique (gb_device_id)
); );

View File

@ -163,8 +163,8 @@ create table wvp_device_channel
gb_svc_space_support_mod integer, gb_svc_space_support_mod integer,
gb_svc_time_support_mode integer, gb_svc_time_support_mode integer,
record_plan_id integer, record_plan_id integer,
data_type integer, data_type integer not null,
data_device_id integer, data_device_id integer not null,
constraint uk_wvp_device_channel_unique_data unique (data_type, data_device_id), constraint uk_wvp_device_channel_unique_data unique (data_type, data_device_id),
constraint uk_wvp_unique_channel unique (gb_device_id) constraint uk_wvp_unique_channel unique (gb_device_id)
); );

View File

@ -3,10 +3,10 @@
*/ */
alter table wvp_device_channel alter table wvp_device_channel
add data_type integer; add data_type integer not null;
alter table wvp_device_channel alter table wvp_device_channel
add data_device_id integer; add data_device_id integer not null;
update wvp_device_channel wdc INNER JOIN update wvp_device_channel wdc INNER JOIN
(SELECT device_db_id from wvp_device_channel where wdc.id = id and device_db_id is not null ) ct (SELECT device_db_id from wvp_device_channel where wdc.id = id and device_db_id is not null ) ct

View File

@ -3,10 +3,10 @@
*/ */
alter table wvp_device_channel alter table wvp_device_channel
add data_type integer; add data_type integer not null;
alter table wvp_device_channel alter table wvp_device_channel
add data_device_id integer; add data_device_id integer not null;
update wvp_device_channel wdc update wvp_device_channel wdc
set data_type = 1, data_device_id = (SELECT device_db_id from wvp_device_channel where device_db_id is not null and id = wdc.id ) where device_db_id is not null; set data_type = 1, data_device_id = (SELECT device_db_id from wvp_device_channel where device_db_id is not null and id = wdc.id ) where device_db_id is not null;