diff --git a/src/main/java/com/genersoft/iot/vmp/common/enums/ChannelDataType.java b/src/main/java/com/genersoft/iot/vmp/common/enums/ChannelDataType.java new file mode 100644 index 00000000..07e3a92a --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/common/enums/ChannelDataType.java @@ -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; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java index ea606692..43c22cb2 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java @@ -123,17 +123,14 @@ public class CommonGBChannel { @Schema(description = "国标-时域编码能力,取值0-不支持;1-1级增强;2-2级增强;3-3级增强(可选)") private Integer gbSvcTimeSupportMode; - @Schema(description = "关联的国标设备数据库ID") - private Integer gbDeviceDbId; - @Schema(description = "二进制保存的录制计划, 每一位表示每个小时的前半个小时") private Long recordPLan; - @Schema(description = "关联的推流Id(流来源是推流时有效)") - private Integer streamPushId; + @Schema(description = "关联的数据类型") + private Integer dataType; - @Schema(description = "关联的拉流代理Id(流来源是拉流代理时有效)") - private Integer streamProxyId; + @Schema(description = "关联的设备ID") + private Integer dataDeviceId; @Schema(description = "创建时间") private String createTime; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelPlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelPlayServiceImpl.java index e0a736c7..4d452454 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelPlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelPlayServiceImpl.java @@ -1,6 +1,7 @@ package com.genersoft.iot.vmp.gb28181.service.impl; 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.InviteInfo; import com.genersoft.iot.vmp.gb28181.bean.Platform; @@ -33,7 +34,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService { @Override public void start(CommonGBChannel channel, InviteInfo inviteInfo, Platform platform, ErrorCallback 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); throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error"); } @@ -41,14 +42,14 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService { if ("Play".equalsIgnoreCase(inviteInfo.getSessionName())) { play(channel, platform, callback); }else if ("Playback".equals(inviteInfo.getSessionName())) { - if (channel.getGbDeviceDbId() != null) { + if (channel.getDataType() == ChannelDataType.GB28181.value) { // 国标通道 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()); 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()); 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"); } }else if ("Download".equals(inviteInfo.getSessionName())) { - if (channel.getGbDeviceDbId() != null) { + if (channel.getDataType() == ChannelDataType.GB28181.value) { int downloadSpeed = 4; try { if (inviteInfo.getDownloadSpeed() != null){ @@ -68,11 +69,11 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService { // 国标通道 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()); 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()); throw new PlayException(Response.FORBIDDEN, "forbidden"); @@ -90,13 +91,13 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService { @Override public void play(CommonGBChannel channel, Platform platform, ErrorCallback callback) { - if (channel.getGbDeviceDbId() != null) { + if (channel.getDataType() == ChannelDataType.GB28181.value) { // 国标通道 playGbDeviceChannel(channel, callback); - } else if (channel.getStreamProxyId() != null) { + } else if (channel.getDataType() == ChannelDataType.STREAM_PROXY.value) { // 拉流代理 playProxy(channel, callback); - } else if (channel.getStreamPushId() != null) { + } else if (channel.getDataType() == ChannelDataType.STREAM_PUSH.value) { if (platform != null) { // 推流 playPush(channel, platform.getServerGBId(), platform.getName(), callback); @@ -128,7 +129,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService { public void playProxy(CommonGBChannel channel, ErrorCallback callback){ // 拉流代理通道 try { - StreamInfo streamInfo = streamProxyPlayService.start(channel.getStreamProxyId()); + StreamInfo streamInfo = streamProxyPlayService.start(channel.getDataDeviceId()); if (streamInfo == null) { callback.run(Response.BUSY_HERE, "busy here", null); }else { @@ -143,7 +144,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService { public void playPush(CommonGBChannel channel, String platformDeviceId, String platformName, ErrorCallback callback){ // 推流 try { - streamPushPlayService.start(channel.getStreamPushId(), callback, platformDeviceId, platformName); + streamPushPlayService.start(channel.getDataDeviceId(), callback, platformDeviceId, platformName); }catch (PlayException e) { callback.run(e.getCode(), e.getMsg(), null); }catch (Exception e) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java index 792fd88b..030253fb 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java @@ -53,7 +53,7 @@ public class GbChannelServiceImpl implements IGbChannelService { @Override 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()); if (commonGBChannelInDb != null) { throw new ControllerException(ErrorCode.ERROR100.getCode(), "此推流已经关联通道"); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayServiceImpl.java index 645a4b94..5533ad8d 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayServiceImpl.java @@ -1648,7 +1648,7 @@ public class PlayServiceImpl implements IPlayService { @Override public void play(CommonGBChannel channel, ErrorCallback callback) { - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); if (device == null) { log.warn("[点播] 未找到通道{}的设备信息", channel); 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"); } // 国标通道 - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); if (device == null) { log.warn("[点播] 未找到通道{}的设备信息", channel); 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"); } // 国标通道 - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); if (device == null) { log.warn("[点播] 未找到通道{}的设备信息", channel); throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error"); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java index c51b570a..5fbe6525 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java @@ -199,7 +199,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In platformService.stopBroadcast(platform, channel, ssrcTransaction.getStream(), false, mediaServerService.getOne(mediaServerId)); DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channel.getGbId()); - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); playService.stopAudioBroadcast(device, deviceChannel); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java index 238cda23..8e2b42c7 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java @@ -1,5 +1,6 @@ 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.event.SipSubscribe; import com.genersoft.iot.vmp.gb28181.service.*; @@ -101,7 +102,7 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I return; } // 判断通道类型 - if (channel.getGbDeviceDbId() == null) { + if (channel.getDataType() != ChannelDataType.GB28181.value) { // 非国标通道不支持录像回放控制 log.warn("[INFO 消息] 非国标通道不支持录像回放控制: 通道ID: {}", sendRtpInfo.getChannelId()); responseAck(request, Response.FORBIDDEN, ""); @@ -109,7 +110,7 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I } // 根据通道ID,获取所属设备 - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); if (device == null) { // 不存在则回复404 log.warn("[INFO 消息] 通道所属设备不存在, 通道ID: {}", sendRtpInfo.getChannelId()); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/cmd/DeviceControlQueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/cmd/DeviceControlQueryMessageHandler.java index cb1cced6..fce5b5e8 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/cmd/DeviceControlQueryMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/cmd/DeviceControlQueryMessageHandler.java @@ -1,5 +1,6 @@ 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.gb28181.bean.*; 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) { - if (channel.getGbDeviceDbId() == 0) { + if (channel.getDataType() != ChannelDataType.GB28181.value) { // 只支持国标的云台控制 log.warn("[INFO 消息] 只支持国标的云台控制, 通道ID: {}", channel.getGbId()); try { @@ -145,7 +146,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent return; } // 根据通道ID,获取所属设备 - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); if (device == null) { // 不存在则回复404 log.warn("[INFO 消息] 通道所属设备不存在, 通道ID: {}", channel.getGbId()); @@ -184,7 +185,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent * 处理强制关键帧 */ private void handleIFameCmd(CommonGBChannel channel, SIPRequest request) { - if (channel.getGbDeviceDbId() == 0) { + if (channel.getDataType() != ChannelDataType.GB28181.value) { // 只支持国标的云台控制 log.warn("[INFO 消息] 只支持国标的处理强制关键帧, 通道ID: {}", channel.getGbId()); try { @@ -195,7 +196,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent return; } // 根据通道ID,获取所属设备 - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); if (device == null) { // 不存在则回复404 log.warn("[INFO 消息] 通道所属设备不存在, 通道ID: {}", channel.getGbId()); @@ -232,7 +233,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent * 处理重启命令 */ private void handleTeleBootCmd(CommonGBChannel channel, SIPRequest request) { - if (channel.getGbDeviceDbId() == 0) { + if (channel.getDataType() != ChannelDataType.GB28181.value) { // 只支持国标的云台控制 log.warn("[INFO 消息] 只支持国标的重启命令, 通道ID: {}", channel.getGbId()); try { @@ -243,7 +244,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent return; } // 根据通道ID,获取所属设备 - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); if (device == null) { // 不存在则回复404 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) { - if (channel.getGbDeviceDbId() == 0) { + if (channel.getDataType() != ChannelDataType.GB28181.value) { // 只支持国标的云台控制 log.warn("[INFO 消息] 只支持国标的拉框控制, 通道ID: {}", channel.getGbId()); try { @@ -278,7 +279,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent return; } // 根据通道ID,获取所属设备 - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); if (device == null) { // 不存在则回复404 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) { - if (channel.getGbDeviceDbId() == 0) { + if (channel.getDataType() != ChannelDataType.GB28181.value) { // 只支持国标的云台控制 log.warn("[INFO 消息] 只支持国标的看守位命令, 通道ID: {}", channel.getGbId()); try { @@ -341,7 +342,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent return; } // 根据通道ID,获取所属设备 - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); if (device == null) { // 不存在则回复404 log.warn("[INFO 消息] 通道所属设备不存在, 通道ID: {}", channel.getGbId()); @@ -382,7 +383,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent * 处理告警消息 */ 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()); try { @@ -393,7 +394,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent return; } // 根据通道ID,获取所属设备 - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); if (device == null) { // 不存在则回复404 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) { - if (channel.getGbDeviceDbId() == 0) { + if (channel.getDataType() != ChannelDataType.GB28181.value) { // 只支持国标的云台控制 log.warn("[INFO 消息] 只支持国标的息录像控制, 通道ID: {}", channel.getGbId()); try { @@ -439,7 +440,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent return; } // 根据通道ID,获取所属设备 - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); if (device == null) { // 不存在则回复404 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) { - if (channel.getGbDeviceDbId() == 0) { + if (channel.getDataType() != ChannelDataType.GB28181.value) { // 只支持国标的云台控制 log.warn("[INFO 消息] 只支持国标的报警布防/撤防命令, 通道ID: {}", channel.getGbId()); try { @@ -491,7 +492,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent return; } // 根据通道ID,获取所属设备 - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); if (device == null) { // 不存在则回复404 log.warn("[INFO 消息] 通道所属设备不存在, 通道ID: {}", channel.getGbId()); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/BroadcastNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/BroadcastNotifyMessageHandler.java index 6dfd72db..c16fc7e0 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/BroadcastNotifyMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/BroadcastNotifyMessageHandler.java @@ -1,5 +1,6 @@ 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.gb28181.bean.*; 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"); 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) { responseAck(request, Response.NOT_FOUND, "device not found"); return; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceInfoQueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceInfoQueryMessageHandler.java index ca577440..ae436681 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceInfoQueryMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceInfoQueryMessageHandler.java @@ -1,5 +1,6 @@ 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.Device; import com.genersoft.iot.vmp.gb28181.bean.Platform; @@ -93,7 +94,7 @@ public class DeviceInfoQueryMessageHandler extends SIPRequestProcessorParent imp return; } // 判断通道类型 - if (channel.getGbDeviceDbId() == null) { + if (channel.getDataType() != ChannelDataType.GB28181.value) { // 非国标通道不支持录像回放控制 log.warn("[DeviceInfo] 非国标通道不支持录像回放控制: 通道ID: {}", channel.getGbId()); try { @@ -106,10 +107,10 @@ public class DeviceInfoQueryMessageHandler extends SIPRequestProcessorParent imp } // 根据通道ID,获取所属设备 - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); if (device == null) { // 不存在则回复404 - log.warn("[DeviceInfo] 通道所属设备不存在, 通道ID: {}", channel.getGbDeviceDbId()); + log.warn("[DeviceInfo] 通道所属设备不存在, 通道ID: {}", channel.getDataDeviceId()); try { responseAck(request, Response.NOT_FOUND, "device not found "); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/RecordInfoQueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/RecordInfoQueryMessageHandler.java index 79deb042..f5cef703 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/RecordInfoQueryMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/RecordInfoQueryMessageHandler.java @@ -1,5 +1,6 @@ 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.Device; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; @@ -104,8 +105,8 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp } return; } - if (channel.getGbId() == 0 ) { - log.info("[平台查询录像记录] 不支持查询推流和拉流代理的录像数据 {}/{}", platform.getName(), channelId ); + if (channel.getDataType() != ChannelDataType.GB28181.value) { + log.info("[平台查询录像记录] 只支持查询国标28181的录像数据 {}/{}", platform.getName(), channelId ); try { responseAck(request, Response.NOT_IMPLEMENTED); // 回复未实现 } catch (SipException | InvalidArgumentException | ParseException e) { @@ -113,7 +114,7 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp } return; } - Device device = deviceService.getDevice(channel.getGbDeviceDbId()); + Device device = deviceService.getDevice(channel.getDataDeviceId()); if (device == null) { log.warn("[平台查询录像记录] 未找到通道对应的设备 {}/{}", platform.getName(), channelId ); try { diff --git a/src/main/java/com/genersoft/iot/vmp/streamProxy/bean/StreamProxy.java b/src/main/java/com/genersoft/iot/vmp/streamProxy/bean/StreamProxy.java index cdb2470f..0ca72a60 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamProxy/bean/StreamProxy.java +++ b/src/main/java/com/genersoft/iot/vmp/streamProxy/bean/StreamProxy.java @@ -1,5 +1,6 @@ package com.genersoft.iot.vmp.streamProxy.bean; +import com.genersoft.iot.vmp.common.enums.ChannelDataType; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -72,7 +73,8 @@ public class StreamProxy extends CommonGBChannel { if (ObjectUtils.isEmpty(this.getGbName())) { this.setGbName( app+ "-" +stream); } - this.setStreamProxyId(this.getId()); + this.setDataType(ChannelDataType.STREAM_PROXY.value); + this.setDataDeviceId(this.getId()); return this; } } diff --git a/src/main/java/com/genersoft/iot/vmp/streamPush/bean/StreamPush.java b/src/main/java/com/genersoft/iot/vmp/streamPush/bean/StreamPush.java index 876188aa..0e7b9165 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamPush/bean/StreamPush.java +++ b/src/main/java/com/genersoft/iot/vmp/streamPush/bean/StreamPush.java @@ -1,6 +1,7 @@ package com.genersoft.iot.vmp.streamPush.bean; 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.media.event.media.MediaArrivalEvent; import com.genersoft.iot.vmp.utils.DateUtil; @@ -115,7 +116,8 @@ public class StreamPush extends CommonGBChannel implements Comparable