From 825daad3554bf1f3a42796f56e6057e94ae96f8b Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Sun, 22 Dec 2024 08:35:36 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/provider/StreamProxyProvider.java | 2 +- 数据库/2.7.3/初始化-mysql-2.7.3.sql | 13 +++------- .../2.7.3/初始化-postgresql-kingbase-2.7.3.sql | 14 +++-------- 数据库/2.7.3/更新-mysql-2.7.3.sql | 25 +++++++++++++++++++ .../2.7.3/更新-postgresql-kingbase-2.7.3.sql | 22 ++++++++++++++++ 5 files changed, 56 insertions(+), 20 deletions(-) create mode 100644 数据库/2.7.3/更新-mysql-2.7.3.sql create mode 100644 数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql diff --git a/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java b/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java index 6586fc64..071d7d55 100644 --- a/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java +++ b/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java @@ -20,7 +20,7 @@ public class StreamProxyProvider { } public String selectForPushingInMediaServer(Map params ){ - return getBaseSelectSql() + " WHERE st.pulling=1 and st.media_server_id=#{mediaServerId} order by st.create_time desc"; + return getBaseSelectSql() + " WHERE st.pulling=true and st.media_server_id=#{mediaServerId} order by st.create_time desc"; } public String selectOneByAppAndStream(Map params ){ diff --git a/数据库/2.7.3/初始化-mysql-2.7.3.sql b/数据库/2.7.3/初始化-mysql-2.7.3.sql index e12677da..e50b8c60 100644 --- a/数据库/2.7.3/初始化-mysql-2.7.3.sql +++ b/数据库/2.7.3/初始化-mysql-2.7.3.sql @@ -70,7 +70,6 @@ create table wvp_device_mobile_position create table wvp_device_channel ( id serial primary key, - device_db_id integer, device_id character varying(50), name character varying(255), manufacturer character varying(50), @@ -148,16 +147,12 @@ create table wvp_device_channel gb_svc_space_support_mod integer, gb_svc_time_support_mode integer, record_plan_id integer, - stream_push_id integer, - stream_proxy_id integer, - constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id), - constraint uk_wvp_unique_channel unique (gb_device_id), - constraint uk_wvp_unique_stream_push_id unique (stream_push_id), - constraint uk_wvp_unique_stream_proxy_id unique (stream_proxy_id) + data_type integer, + data_device_id integer, + constraint uk_wvp_device_channel_unique_data unique (data_type, data_device_id), + constraint uk_wvp_unique_channel unique (gb_device_id) ); -create index uk_wvp_device_db_id on wvp_device_channel (device_db_id); - create table wvp_media_server ( id character varying(255) primary key, diff --git a/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql b/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql index c632f9a8..054b84ac 100644 --- a/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql +++ b/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql @@ -86,7 +86,6 @@ create table wvp_gb_stream create table wvp_device_channel ( id serial primary key, - device_db_id integer, device_id character varying(50), name character varying(255), manufacturer character varying(50), @@ -164,17 +163,12 @@ create table wvp_device_channel gb_svc_space_support_mod integer, gb_svc_time_support_mode integer, record_plan_id integer, - stream_push_id integer, - stream_proxy_id integer, - constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id), - constraint uk_wvp_unique_channel unique (gb_device_id), - constraint uk_wvp_unique_stream_push_id unique (stream_push_id), - constraint uk_wvp_unique_stream_proxy_id unique (stream_proxy_id) + data_type integer, + data_device_id integer, + constraint uk_wvp_device_channel_unique_data unique (data_type, data_device_id), + constraint uk_wvp_unique_channel unique (gb_device_id) ); -create index uk_wvp_device_db_id on wvp_device_channel (device_db_id); - - create table wvp_media_server ( id character varying(255) primary key, diff --git a/数据库/2.7.3/更新-mysql-2.7.3.sql b/数据库/2.7.3/更新-mysql-2.7.3.sql new file mode 100644 index 00000000..dcce5891 --- /dev/null +++ b/数据库/2.7.3/更新-mysql-2.7.3.sql @@ -0,0 +1,25 @@ +/* +* 20241222 +*/ + +alter table wvp_device_channel + add data_type integer; + +alter table wvp_device_channel + add data_device_id integer; + +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 +set wdc.data_type = 1, wdc.data_device_id = ct.device_db_id where wdc.device_db_id is not null; + +update wvp_device_channel wdc INNER JOIN + (SELECT stream_push_id from wvp_device_channel where wdc.id = id and stream_push_id is not null ) ct +set wdc.data_type = 2, wdc.data_device_id = ct.stream_push_id where wdc.stream_push_id is not null; + +update wvp_device_channel wdc INNER JOIN + (SELECT stream_proxy_id from wvp_device_channel where wdc.id = id and stream_proxy_id is not null ) ct +set wdc.data_type = 3, wdc.data_device_id = ct.stream_proxy_id where wdc.stream_proxy_id is not null; + +alter table wvp_device_channel drop device_db_id; +alter table wvp_device_channel drop stream_push_id; +alter table wvp_device_channel drop stream_proxy_id; \ No newline at end of file diff --git a/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql b/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql new file mode 100644 index 00000000..122549e5 --- /dev/null +++ b/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql @@ -0,0 +1,22 @@ +/* +* 20241222 +*/ + +alter table wvp_device_channel + add data_type integer; + +alter table wvp_device_channel + add data_device_id integer; + +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; + +update wvp_device_channel wdc +set data_type = 2, data_device_id = (SELECT stream_push_id from wvp_device_channel where stream_push_id is not null and id = wdc.id ) where stream_push_id is not null; + +update wvp_device_channel wdc +set data_type = 1, data_device_id = (SELECT stream_proxy_id from wvp_device_channel where stream_proxy_id is not null and id = wdc.id ) where stream_proxy_id is not null; + +alter table wvp_device_channel drop device_db_id; +alter table wvp_device_channel drop stream_push_id; +alter table wvp_device_channel drop stream_proxy_id; \ No newline at end of file From 19453f7ca99b2969a1d7ea2d7dd20baee35df8fe Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 23 Dec 2024 07:20:48 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/common/enums/ChannelDataType.java | 25 ++++++++++++++ .../iot/vmp/gb28181/bean/CommonGBChannel.java | 11 +++---- .../impl/GbChannelPlayServiceImpl.java | 25 +++++++------- .../service/impl/GbChannelServiceImpl.java | 2 +- .../gb28181/service/impl/PlayServiceImpl.java | 6 ++-- .../request/impl/ByeRequestProcessor.java | 2 +- .../impl/info/InfoRequestProcessor.java | 5 +-- .../cmd/DeviceControlQueryMessageHandler.java | 33 ++++++++++--------- .../cmd/BroadcastNotifyMessageHandler.java | 13 +++++++- .../cmd/DeviceInfoQueryMessageHandler.java | 7 ++-- .../cmd/RecordInfoQueryMessageHandler.java | 7 ++-- .../iot/vmp/streamProxy/bean/StreamProxy.java | 4 ++- .../iot/vmp/streamPush/bean/StreamPush.java | 4 ++- 数据库/2.7.3/初始化-mysql-2.7.3.sql | 4 +-- .../2.7.3/初始化-postgresql-kingbase-2.7.3.sql | 4 +-- 数据库/2.7.3/更新-mysql-2.7.3.sql | 4 +-- .../2.7.3/更新-postgresql-kingbase-2.7.3.sql | 4 +-- 17 files changed, 101 insertions(+), 59 deletions(-) create mode 100644 src/main/java/com/genersoft/iot/vmp/common/enums/ChannelDataType.java 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 Date: Mon, 23 Dec 2024 18:37:24 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=AF=B9=E9=80=9A=E9=81=93=E7=B1=BB=E5=9E=8B=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gb28181/dao/CommonGBChannelMapper.java | 2 ++ .../gb28181/dao/provider/ChannelProvider.java | 4 +++ .../service/impl/GbChannelServiceImpl.java | 26 ++++++++----------- .../impl/PlatformChannelServiceImpl.java | 3 +-- .../service/impl/StreamProxyServiceImpl.java | 4 ++- .../controller/StreamPushController.java | 5 ++-- 6 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java index 64f7dad8..0d61060f 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java @@ -550,4 +550,6 @@ public interface CommonGBChannelMapper { @Param("channelType") Integer channelType, @Param("online") Boolean online, @Param("hasLink") Boolean hasLink); + @SelectProvider(type = ChannelProvider.class, method = "queryByDataId") + CommonGBChannel queryByDataId(@Param("dataType") Integer dataType, @Param("dataDeviceId") Integer dataDeviceId); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java index 8a941d3c..16170d76 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java @@ -113,6 +113,10 @@ public class ChannelProvider { return BASE_SQL + " where channel_type = 0 and stream_push_id = #{streamPushId}"; } + public String queryByDataId(Map params ){ + return BASE_SQL + " where data_type = #{dataType} and data_device_id = #{dataDeviceId}"; + } + public String queryByStreamProxyId(Map params ){ return BASE_SQL + " where channel_type = 0 and stream_proxy_id = #{streamProxyId}"; } 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 030253fb..96bda5ce 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 @@ -1,5 +1,6 @@ package com.genersoft.iot.vmp.gb28181.service.impl; +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.dao.CommonGBChannelMapper; @@ -53,17 +54,12 @@ public class GbChannelServiceImpl implements IGbChannelService { @Override public int add(CommonGBChannel commonGBChannel) { - if (commonGBChannel.getDataType() != null && commonGBChannel.getDataDeviceId() > 0) { - CommonGBChannel commonGBChannelInDb = commonGBChannelMapper.queryByStreamPushId(commonGBChannel.getStreamPushId()); - if (commonGBChannelInDb != null) { - throw new ControllerException(ErrorCode.ERROR100.getCode(), "此推流已经关联通道"); - } + if (commonGBChannel.getDataType() == null || commonGBChannel.getDataDeviceId() == null) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "缺少通道数据类型或通道数据关联设备ID"); } - if (commonGBChannel.getStreamProxyId() != null && commonGBChannel.getStreamProxyId() > 0) { - CommonGBChannel commonGBChannelInDb = commonGBChannelMapper.queryByStreamProxyId(commonGBChannel.getStreamProxyId()); - if (commonGBChannelInDb != null) { - throw new ControllerException(ErrorCode.ERROR100.getCode(), "此代理已经关联通道"); - } + CommonGBChannel commonGBChannelInDb = commonGBChannelMapper.queryByDataId(commonGBChannel.getDataType(), commonGBChannel.getDataDeviceId()); + if (commonGBChannelInDb != null) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "此推流已经关联通道"); } commonGBChannel.setCreateTime(DateUtil.getNow()); commonGBChannel.setUpdateTime(DateUtil.getNow()); @@ -113,7 +109,7 @@ public class GbChannelServiceImpl implements IGbChannelService { public int update(CommonGBChannel commonGBChannel) { log.info("[更新通道] 通道ID: {}, ", commonGBChannel.getGbId()); if (commonGBChannel.getGbId() <= 0) { - log.warn("[更新通道] 未找到数据库ID,更新失败, {}", commonGBChannel.getGbDeviceDbId()); + log.warn("[更新通道] 未找到数据库ID,更新失败, {}({})", commonGBChannel.getGbName(), commonGBChannel.getGbDeviceId()); return 0; } commonGBChannel.setUpdateTime(DateUtil.getNow()); @@ -132,7 +128,7 @@ public class GbChannelServiceImpl implements IGbChannelService { @Override public int offline(CommonGBChannel commonGBChannel) { if (commonGBChannel.getGbId() <= 0) { - log.warn("[通道离线] 未找到数据库ID,更新失败, {}", commonGBChannel.getGbDeviceDbId()); + log.warn("[通道离线] 未找到数据库ID,更新失败, {}({})", commonGBChannel.getGbName(), commonGBChannel.getGbDeviceId()); return 0; } int result = commonGBChannelMapper.updateStatusById(commonGBChannel.getGbId(), 0); @@ -186,7 +182,7 @@ public class GbChannelServiceImpl implements IGbChannelService { @Override public int online(CommonGBChannel commonGBChannel) { if (commonGBChannel.getGbId() <= 0) { - log.warn("[通道上线] 未找到数据库ID,更新失败, {}", commonGBChannel.getGbDeviceDbId()); + log.warn("[通道上线] 未找到数据库ID,更新失败, {}({})", commonGBChannel.getGbName(), commonGBChannel.getGbDeviceId()); return 0; } int result = commonGBChannelMapper.updateStatusById(commonGBChannel.getGbId(), 1); @@ -371,12 +367,12 @@ public class GbChannelServiceImpl implements IGbChannelService { log.warn("[重置国标通道] 未找到对应Id的通道: id: {}", id); throw new ControllerException(ErrorCode.ERROR400); } - if (channel.getGbDeviceDbId() <= 0) { + if (channel.getDataType() == ChannelDataType.GB28181.value) { log.warn("[重置国标通道] 非国标下级通道无法重置: id: {}", id); throw new ControllerException(ErrorCode.ERROR100.getCode(), "非国标下级通道无法重置"); } // 这个多加一个参数,为了防止将非国标的通道通过此方法清空内容,导致意外发生 - commonGBChannelMapper.reset(id, channel.getGbDeviceDbId(), DateUtil.getNow()); + commonGBChannelMapper.reset(id, channel.getDataDeviceId(), DateUtil.getNow()); CommonGBChannel channelNew = getOne(id); // 发送通过更新通知 try { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformChannelServiceImpl.java index 2f768f10..15d0142b 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformChannelServiceImpl.java @@ -7,7 +7,6 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; -import com.genersoft.iot.vmp.jt1078.proc.request.Re; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; @@ -432,7 +431,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService { eventPublisher.catalogEventPublish(channel.getPlatformId(), commonGBChannel, CatalogEvent.UPDATE); } catch (Exception e) { log.warn("[自定义通道信息] 发送失败, 平台ID: {}, 通道: {}({})", channel.getPlatformId(), - channel.getGbName(), channel.getGbDeviceDbId(), e); + channel.getGbName(), channel.getId(), e); } } diff --git a/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java index cf1818d9..38751123 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.streamProxy.service.impl; import com.alibaba.fastjson2.JSONObject; import com.baomidou.dynamic.datasource.annotation.DS; import com.genersoft.iot.vmp.common.StreamInfo; +import com.genersoft.iot.vmp.common.enums.ChannelDataType; import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; @@ -179,7 +180,8 @@ public class StreamProxyServiceImpl implements IStreamProxyService { streamProxy.setCreateTime(DateUtil.getNow()); streamProxy.setUpdateTime(DateUtil.getNow()); streamProxyMapper.add(streamProxy); - streamProxy.setStreamProxyId(streamProxy.getId()); + streamProxy.setDataType(ChannelDataType.STREAM_PROXY.value); + streamProxy.setDataDeviceId(streamProxy.getId()); } @Override diff --git a/src/main/java/com/genersoft/iot/vmp/streamPush/controller/StreamPushController.java b/src/main/java/com/genersoft/iot/vmp/streamPush/controller/StreamPushController.java index 1331c93a..ecaa92ee 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamPush/controller/StreamPushController.java +++ b/src/main/java/com/genersoft/iot/vmp/streamPush/controller/StreamPushController.java @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.streamPush.controller; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelReader; import com.alibaba.excel.read.metadata.ReadSheet; +import com.genersoft.iot.vmp.common.enums.ChannelDataType; import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.conf.security.JwtUtils; @@ -28,7 +29,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; @@ -215,7 +215,8 @@ public class StreamPushController { if (!streamPushService.add(stream)) { throw new ControllerException(ErrorCode.ERROR100); } - stream.setStreamPushId(stream.getId()); + stream.setDataType(ChannelDataType.STREAM_PUSH.value); + stream.setDataDeviceId(stream.getId()); return stream; } From f5ae9718d4a210a86fca184cb3c76bd2ae811050 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 23 Dec 2024 18:39:54 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmp/gb28181/dao/CommonGBChannelMapper.java | 6 ------ .../gb28181/dao/provider/ChannelProvider.java | 17 ++++------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java index 0d61060f..507f8dd8 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java @@ -250,12 +250,6 @@ public interface CommonGBChannelMapper { ""}) void batchDelete(List channelListInDb); - @SelectProvider(type = ChannelProvider.class, method = "queryByStreamPushId") - CommonGBChannel queryByStreamPushId(@Param("streamPushId") Integer streamPushId); - - @SelectProvider(type = ChannelProvider.class, method = "queryByStreamProxyId") - CommonGBChannel queryByStreamProxyId(@Param("streamProxyId") Integer streamProxyId); - @SelectProvider(type = ChannelProvider.class, method = "queryListByCivilCode") List queryListByCivilCode(@Param("query") String query, @Param("online") Boolean online, @Param("channelType") Integer channelType, @Param("civilCode") String civilCode); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java index 16170d76..8997dcb6 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java @@ -13,8 +13,8 @@ public class ChannelProvider { public final static String BASE_SQL = "select\n" + " id as gb_id,\n" + " device_db_id as gb_device_db_id,\n" + - " stream_push_id,\n" + - " stream_proxy_id,\n" + + " data_type,\n" + + " data_device_id,\n" + " create_time,\n" + " update_time,\n" + " record_plan_id,\n" + @@ -60,7 +60,7 @@ public class ChannelProvider { " wdc.id as gb_id,\n" + " wdc.device_db_id as gb_device_db_id,\n" + " wdc.stream_push_id,\n" + - " wdc.stream_proxy_id,\n" + + " wdc.data_device_id,\n" + " wdc.create_time,\n" + " wdc.update_time,\n" + " coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" + @@ -109,19 +109,10 @@ public class ChannelProvider { return BASE_SQL + " where channel_type = 0 and id = #{gbId}"; } - public String queryByStreamPushId(Map params ){ - return BASE_SQL + " where channel_type = 0 and stream_push_id = #{streamPushId}"; - } - public String queryByDataId(Map params ){ - return BASE_SQL + " where data_type = #{dataType} and data_device_id = #{dataDeviceId}"; + return BASE_SQL + " where channel_type = 0 and data_type = #{dataType} and data_device_id = #{dataDeviceId}"; } - public String queryByStreamProxyId(Map params ){ - return BASE_SQL + " where channel_type = 0 and stream_proxy_id = #{streamProxyId}"; - } - - public String queryListByCivilCode(Map params ){ StringBuilder sqlBuild = new StringBuilder(); sqlBuild.append(BASE_SQL); From 28961f51f7fd17879de836fd5978ffa56decc7ce Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 23 Dec 2024 23:49:54 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E7=BB=93=E6=9E=84=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/common/enums/ChannelDataType.java | 1 - .../iot/vmp/gb28181/bean/DeviceChannel.java | 6 +- .../vmp/gb28181/controller/DeviceQuery.java | 2 +- .../gb28181/dao/CommonGBChannelMapper.java | 48 +++++------ .../vmp/gb28181/dao/DeviceChannelMapper.java | 83 ++++++++++--------- .../iot/vmp/gb28181/dao/DeviceMapper.java | 22 ++--- .../gb28181/dao/PlatformChannelMapper.java | 31 +++---- .../gb28181/dao/provider/ChannelProvider.java | 40 ++------- .../dao/provider/DeviceChannelProvider.java | 25 ++---- .../impl/DeviceChannelServiceImpl.java | 17 ++-- .../service/impl/DeviceServiceImpl.java | 26 +++--- .../service/impl/GbChannelServiceImpl.java | 14 ++-- .../impl/PlatformChannelServiceImpl.java | 5 +- .../gb28181/service/impl/PlayServiceImpl.java | 2 +- .../NotifyRequestForCatalogProcessor.java | 2 +- .../cmd/CatalogResponseMessageHandler.java | 2 +- .../service/impl/RecordPlanServiceImpl.java | 4 +- .../storager/impl/RedisCatchStorageImpl.java | 1 + .../dao/provider/StreamProxyProvider.java | 7 +- .../iot/vmp/streamPush/bean/StreamPush.java | 2 + .../vmp/streamPush/dao/StreamPushMapper.java | 25 +++--- .../vmp/vmanager/server/ServerController.java | 21 ++++- .../components/common/CommonChannelEdit.vue | 2 +- .../common/channelDataTypeSelect.vue | 63 ++++++++++++++ .../src/components/dialog/GbChannelSelect.vue | 17 ++-- .../components/dialog/linkChannelRecord.vue | 17 ++-- .../src/components/dialog/shareChannelAdd.vue | 17 ++-- web_src/src/components/group.vue | 17 ++-- web_src/src/components/region.vue | 16 ++-- 29 files changed, 284 insertions(+), 251 deletions(-) create mode 100644 web_src/src/components/common/channelDataTypeSelect.vue 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 index 07e3a92a..5ca59025 100644 --- a/src/main/java/com/genersoft/iot/vmp/common/enums/ChannelDataType.java +++ b/src/main/java/com/genersoft/iot/vmp/common/enums/ChannelDataType.java @@ -10,7 +10,6 @@ import lombok.Getter; public enum ChannelDataType { GB28181(1,"国标28181"), - STREAM_PUSH(2,"推流设备"), STREAM_PROXY(3,"拉流代理"); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java index 28eb01a8..924a8ca7 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java @@ -1,5 +1,6 @@ package com.genersoft.iot.vmp.gb28181.bean; +import com.genersoft.iot.vmp.common.enums.ChannelDataType; import com.genersoft.iot.vmp.gb28181.utils.MessageElementForCatalog; import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; import io.swagger.v3.oas.annotations.media.Schema; @@ -20,9 +21,6 @@ public class DeviceChannel extends CommonGBChannel { @Schema(description = "数据库自增ID") private int id; - @Schema(description = "设备的数据库自增ID") - private Integer deviceDbId; - @MessageElementForCatalog("DeviceID") @Schema(description = "编码") private String deviceId; @@ -191,6 +189,8 @@ public class DeviceChannel extends CommonGBChannel { @Schema(description = "通道类型, 默认0, 0: 普通通道,1 行政区划 2 业务分组/虚拟组织") private int channelType; + private Integer dataType = ChannelDataType.GB28181.value; + public void setPtzType(int ptzType) { this.ptzType = ptzType; switch (ptzType) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java index 5e9ee17e..226e51d8 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java @@ -241,7 +241,7 @@ public class DeviceQuery { return deviceChannelPageResult; } - return deviceChannelService.getSubChannels(deviceChannel.getDeviceDbId(), channelId, query, channelType, online, page, count); + return deviceChannelService.getSubChannels(deviceChannel.getDataDeviceId(), channelId, query, channelType, online, page, count); } @Operation(summary = "开启/关闭通道的音频", security = @SecurityRequirement(name = JwtUtils.HEADER)) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java index 507f8dd8..a00ef36e 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java @@ -20,8 +20,8 @@ public interface CommonGBChannelMapper { @Insert(" "}) - void reset(@Param("id") int id, @Param("gbDeviceDbId") int gbDeviceDbId, @Param("updateTime") String updateTime); + void reset(@Param("id") int id, @Param("dataType") Integer dataType, @Param("dataDeviceId") int dataDeviceId, @Param("updateTime") String updateTime); @SelectProvider(type = ChannelProvider.class, method = "queryByIds") @@ -252,13 +252,13 @@ public interface CommonGBChannelMapper { @SelectProvider(type = ChannelProvider.class, method = "queryListByCivilCode") List queryListByCivilCode(@Param("query") String query, @Param("online") Boolean online, - @Param("channelType") Integer channelType, @Param("civilCode") String civilCode); + @Param("dataType") Integer dataType, @Param("civilCode") String civilCode); @SelectProvider(type = ChannelProvider.class, method = "queryListByParentId") List queryListByParentId(@Param("query") String query, @Param("online") Boolean online, - @Param("channelType") Integer channelType, @Param("groupDeviceId") String groupDeviceId); + @Param("dataType") Integer dataType, @Param("groupDeviceId") String groupDeviceId); @@ -311,14 +311,14 @@ public interface CommonGBChannelMapper { List queryByCivilCode(@Param("civilCode") String civilCode); @SelectProvider(type = ChannelProvider.class, method = "queryByGbDeviceIds") - List queryByGbDeviceIds(List deviceIds); + List queryByGbDeviceIds(@Param("dataType") Integer dataType, List deviceIds); @Select(value = {" "}) - List queryByGbDeviceIdsForIds(List deviceIds); + List queryByGbDeviceIdsForIds(@Param("dataType") Integer dataType, List deviceIds); @SelectProvider(type = ChannelProvider.class, method = "queryByGroupList") List queryByGroupList(List groupList); @@ -440,19 +440,20 @@ public interface CommonGBChannelMapper { int updateCivilCodeByChannelList(@Param("civilCode") String civilCode, List channelList); @SelectProvider(type = ChannelProvider.class, method = "queryListByStreamPushList") - List queryListByStreamPushList(List streamPushList); + List queryListByStreamPushList(@Param("dataType") Integer dataType, List streamPushList); @Update(value = {" "}) - void updateGpsByDeviceIdForStreamPush(List channels); + void updateGpsByDeviceIdForStreamPush(@Param("dataType") Integer dataType, List channels); @SelectProvider(type = ChannelProvider.class, method = "queryList") - List queryList(@Param("query") String query, @Param("online") Boolean online, @Param("hasRecordPlan") Boolean hasRecordPlan, @Param("channelType") Integer channelType); + List queryList(@Param("query") String query, @Param("online") Boolean online, + @Param("hasRecordPlan") Boolean hasRecordPlan, @Param("dataType") Integer dataType); @Update(value = {" ") List queryForRecordPlanForWebList(@Param("planId") Integer planId, @Param("query") String query, - @Param("channelType") Integer channelType, @Param("online") Boolean online, + @Param("dataType") Integer dataType, @Param("online") Boolean online, @Param("hasLink") Boolean hasLink); @SelectProvider(type = ChannelProvider.class, method = "queryByDataId") diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java index 068eb4b7..b33a7dc0 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java @@ -21,13 +21,13 @@ public interface DeviceChannelMapper { @Insert(""}) + " ") List queryChaneIdListByDeviceDbIds(List deviceDbIds); - @Delete("DELETE FROM wvp_device_channel WHERE device_db_id=#{deviceId}") - int cleanChannelsByDeviceId(@Param("deviceId") int deviceId); + @Delete("DELETE FROM wvp_device_channel WHERE data_type =1 and data_device_id=#{deviceId}") + int cleanChannelsByDeviceId(@Param("dataDeviceId") int dataDeviceId); @Delete("DELETE FROM wvp_device_channel WHERE id=#{id}") int del(@Param("id") int id); @@ -141,8 +142,8 @@ public interface DeviceChannelMapper { " coalesce(dc.gb_business_group_id, dc.business_group_id) as business_group_id " + " from " + " wvp_device_channel dc " + - " LEFT JOIN wvp_device de ON dc.device_db_id = de.id " + - " WHERE 1=1" + + " LEFT JOIN wvp_device de ON dc.data_device_id = de.id " + + " WHERE dc.data_type = 1 " + " AND de.device_id = #{deviceId} " + " AND (dc.device_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%') " + " AND dc.parent_id=#{parentChannelId} " + @@ -155,7 +156,7 @@ public interface DeviceChannelMapper { " " + "ORDER BY dc.device_id ASC" + " "}) - List queryChannelsWithDeviceInfo(@Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List channelIds); + List queryChannelsWithDeviceInfo( @Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List channelIds); @Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE id=#{channelId}"}) void startPlay(@Param("channelId") Integer channelId, @Param("streamId") String streamId); @@ -172,9 +173,9 @@ public interface DeviceChannelMapper { " pgc.platform_id as platform_id,\n" + " pgc.catalog_id as catalog_id " + " FROM wvp_device_channel dc " + - " LEFT JOIN wvp_device de ON dc.device_db_id = de.id " + + " LEFT JOIN wvp_device de ON dc.data_device_id = de.id " + " LEFT JOIN wvp_platform_channel pgc on pgc.device_channel_id = dc.id " + - " WHERE 1=1 " + + " WHERE dc.data_type = 1 " + " " + "AND " + "(COALESCE(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%') " + @@ -195,14 +196,14 @@ public interface DeviceChannelMapper { @Insert(""}) int batchUpdateForNotify(List updateChannels); @@ -322,9 +325,9 @@ public interface DeviceChannelMapper { " set sub_count = (select *" + " from (select count(0)" + " from wvp_device_channel" + - " where device_db_id = #{deviceDbId} and parent_id = #{channelId}) as temp)" + - " where device_db_id = #{deviceDbId} and device_id = #{channelId}") - int updateChannelSubCount(@Param("deviceDbId") int deviceDbId, @Param("channelId") String channelId); + " where data_type = 1 and data_device_id = #{dataDeviceId} and parent_id = #{channelId}) as temp)" + + " where data_type = 1 and data_device_id = #{dataDeviceId} and device_id = #{channelId}") + int updateChannelSubCount(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId); @Update(value = {" "}) int batchUpdateStatus(List channels); @@ -427,7 +430,7 @@ public interface DeviceChannelMapper { ", latitude=#{item.latitude}" + ", gps_time=#{item.gpsTime}" + "WHERE id=#{item.id}" + - "WHERE device_db_id=#{item.deviceDbId} AND device_id=#{item.deviceId}" + + "WHERE data_type = #{item.dataType} and data_device_id=#{item.dataDeviceId} AND device_id=#{item.deviceId}" + "" + ""}) void batchUpdatePosition(List channelList); @@ -438,7 +441,7 @@ public interface DeviceChannelMapper { @Select(value = {" "}) - DeviceChannel getOneByDeviceIdForSource(@Param("deviceDbId") int deviceDbId, @Param("channelId") String channelId); + DeviceChannel getOneByDeviceIdForSource(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId); @Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE id=#{channelId}"}) @@ -559,7 +562,7 @@ public interface DeviceChannelMapper { "") void updateStreamGPS(List gpsMsgInfoList); - @Update("UPDATE wvp_device_channel SET status=#{status} WHERE device_db_id=#{deviceDbId} AND device_id=#{deviceId}") + @Update("UPDATE wvp_device_channel SET status=#{status} WHERE data_type=#{dataType} and data_device_id=#{dataDeviceId} AND device_id=#{deviceId}") void updateStatus(DeviceChannel channel); @@ -568,7 +571,7 @@ public interface DeviceChannelMapper { " wvp_device_channel" + " SET update_time=#{updateTime}" + ", device_id=#{deviceId}" + - ", device_db_id=#{deviceDbId}" + + ", data_device_id=#{dataDeviceId}" + ", name=#{name}" + ", manufacturer=#{manufacturer}" + ", model=#{model}" + @@ -616,7 +619,7 @@ public interface DeviceChannelMapper { @Select(value = {" "}) - DeviceChannel getOneBySourceChannelId(int deviceDbId, String channelId); + DeviceChannel getOneBySourceChannelId(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java index abac64bb..9eec2a9a 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java @@ -45,9 +45,9 @@ public interface DeviceMapper { "on_line," + "media_server_id," + "broadcast_push_after_ack," + - "(SELECT count(0) FROM wvp_device_channel dc WHERE dc.device_db_id= de.id) as channel_count "+ + "(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = 1 and dc.data_device_id= de.id) as channel_count "+ " FROM wvp_device de WHERE de.device_id = #{deviceId}") - Device getDeviceByDeviceId(String deviceId); + Device getDeviceByDeviceId( @Param("deviceId") String deviceId); @Insert("INSERT INTO wvp_device (" + "device_id, " + @@ -167,13 +167,13 @@ public interface DeviceMapper { "geo_coord_sys,"+ "on_line,"+ "media_server_id,"+ - "(SELECT count(0) FROM wvp_device_channel dc WHERE dc.device_db_id= de.id) as channel_count " + + "(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = #{dataType} and dc.data_device_id= de.id) as channel_count " + "FROM wvp_device de" + - " where de.on_line=${onLine}"+ + " where de.on_line=${online}"+ " order by de.create_time desc "+ " " ) - List getDevices(Boolean onLine); + List getDevices(@Param("dataType") Integer dataType, @Param("online") Boolean online); @Delete("DELETE FROM wvp_device WHERE device_id=#{deviceId}") int del(String deviceId); @@ -326,7 +326,7 @@ public interface DeviceMapper { "geo_coord_sys,"+ "on_line,"+ "media_server_id,"+ - "(SELECT count(0) FROM wvp_device_channel dc WHERE dc.device_db_id= de.id) as channel_count " + + "(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = #{dataType} and dc.data_device_id= de.id) as channel_count " + " FROM wvp_device de" + " where 1 = 1 "+ " AND de.on_line=${status}"+ @@ -337,7 +337,7 @@ public interface DeviceMapper { " " + " order by create_time desc "+ " ") - List getDeviceList(@Param("query") String query, @Param("status") Boolean status); + List getDeviceList(@Param("dataType") Integer dataType, @Param("query") String query, @Param("status") Boolean status); @Select("select * from wvp_device_channel where id = #{id}") DeviceChannel getRawChannel(@Param("id") int id); @@ -345,10 +345,10 @@ public interface DeviceMapper { @Select("select * from wvp_device where id = #{id}") Device query(@Param("id") Integer id); - @Select("select wd.* from wvp_device wd left join wvp_device_channel wdc on wd.id = wdc.device_db_id where wdc.id = #{channelId}") - Device queryByChannelId(@Param("channelId") Integer channelId); + @Select("select wd.* from wvp_device wd left join wvp_device_channel wdc on wdc.data_type = #{dataType} and wd.id = wdc.data_device_id where wdc.id = #{channelId}") + Device queryByChannelId(@Param("dataType") Integer dataType, @Param("channelId") Integer channelId); - @Select("select wd.* from wvp_device wd left join wvp_device_channel wdc on wd.id = wdc.device_db_id where wdc.device_id = #{channelDeviceId}") - Device getDeviceBySourceChannelDeviceId(@Param("channelDeviceId") String channelDeviceId); + @Select("select wd.* from wvp_device wd left join wvp_device_channel wdc on wdc.data_type = #{dataType} and wd.id = wdc.data_device_id where wdc.device_id = #{channelDeviceId}") + Device getDeviceBySourceChannelDeviceId(@Param("dataType") Integer dataType, @Param("channelDeviceId") String channelDeviceId); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java index d23eec4b..52c12936 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java @@ -65,9 +65,8 @@ public interface PlatformChannelMapper { " select " + " wpgc.id ,\n" + " wdc.id as gb_id,\n" + - " wdc.device_db_id as gb_device_db_id,\n" + - " wdc.stream_push_id,\n" + - " wdc.stream_proxy_id,\n" + + " wdc.data_type ,\n" + + " wdc.data_device_id,\n" + " wdc.create_time,\n" + " wdc.update_time,\n" + " wpgc.custom_device_id, \n" + @@ -149,19 +148,16 @@ public interface PlatformChannelMapper { " AND coalesce(wpgc.status, wdc.gb_status, wdc.status) = 'OFF' " + " AND wpgc.platform_id = #{platformId} " + " AND wpgc.platform_id is null " + - " AND wdc.device_db_id is not null " + - " AND wdc.stream_push_id is not null " + - " AND wdc.stream_proxy_id is not null " + + " AND wdc.data_type = #{dataType} " + "") List queryForPlatformForWebList(@Param("platformId") Integer platformId, @Param("query") String query, - @Param("channelType") Integer channelType, @Param("online") Boolean online, + @Param("dataType") Integer dataType, @Param("online") Boolean online, @Param("hasShare") Boolean hasShare); @Select("select\n" + " wdc.id as gb_id,\n" + - " wdc.device_db_id as gb_device_db_id,\n" + - " wdc.stream_push_id,\n" + - " wdc.stream_proxy_id,\n" + + " wdc.data_type,\n" + + " wdc.data_device_id,\n" + " wdc.create_time,\n" + " wdc.update_time,\n" + " coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" + @@ -209,9 +205,8 @@ public interface PlatformChannelMapper { @Select(""}) List selectAll(@Param("query") String query, @Param("pushing") Boolean pushing, @Param("mediaServerId") String mediaServerId); - @Select("SELECT st.*, st.id as stream_push_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on st.id = wdc.stream_push_id WHERE st.app=#{app} AND st.stream=#{stream}") + @Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.app=#{app} AND st.stream=#{stream}") StreamPush selectByAppAndStream(@Param("app") String app, @Param("stream") String stream); @Insert(" + diff --git a/web_src/src/components/dialog/GbChannelSelect.vue b/web_src/src/components/dialog/GbChannelSelect.vue index 258e313e..6c781ce8 100644 --- a/web_src/src/components/dialog/GbChannelSelect.vue +++ b/web_src/src/components/dialog/GbChannelSelect.vue @@ -23,13 +23,7 @@ 类型: - - - - - - + 刷新 确 定 @@ -49,9 +43,9 @@ @@ -86,8 +80,11 @@ - diff --git a/web_src/src/components/dialog/GbChannelSelect.vue b/web_src/src/components/dialog/GbChannelSelect.vue index 6c781ce8..5d3fa934 100644 --- a/web_src/src/components/dialog/GbChannelSelect.vue +++ b/web_src/src/components/dialog/GbChannelSelect.vue @@ -23,7 +23,7 @@ 类型: - + 刷新 确 定 diff --git a/web_src/src/components/dialog/linkChannelRecord.vue b/web_src/src/components/dialog/linkChannelRecord.vue index 38522daf..1568a579 100755 --- a/web_src/src/components/dialog/linkChannelRecord.vue +++ b/web_src/src/components/dialog/linkChannelRecord.vue @@ -22,7 +22,7 @@ 类型: - + 添加 diff --git a/web_src/src/components/dialog/shareChannelAdd.vue b/web_src/src/components/dialog/shareChannelAdd.vue index 976a8a79..574d33b4 100755 --- a/web_src/src/components/dialog/shareChannelAdd.vue +++ b/web_src/src/components/dialog/shareChannelAdd.vue @@ -20,7 +20,7 @@ 类型: - + 添加 diff --git a/web_src/src/components/group.vue b/web_src/src/components/group.vue index 2173b788..8ca43391 100755 --- a/web_src/src/components/group.vue +++ b/web_src/src/components/group.vue @@ -28,7 +28,7 @@ 类型: - + 添加通道 diff --git a/web_src/src/components/region.vue b/web_src/src/components/region.vue index 6f951287..4bfe7c5a 100755 --- a/web_src/src/components/region.vue +++ b/web_src/src/components/region.vue @@ -28,7 +28,7 @@ 类型: - + 添加通道 From 081bb6de18dc51a2ce52d1d471cc4bacca7113e7 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Tue, 24 Dec 2024 23:35:01 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=80=9A=E9=81=93?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B=E7=9A=84=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E4=B8=8E=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/GbChannelServiceImpl.java | 2 +- .../vmp/streamPush/dao/StreamPushMapper.java | 2 +- web_src/src/components/StreamProxyEdit.vue | 1 - web_src/src/components/StreamProxyList.vue | 1 + .../common/channelDataTypeSelect.vue | 41 ------------------- .../src/components/dialog/GbChannelSelect.vue | 10 +++-- .../components/dialog/linkChannelRecord.vue | 11 +++-- .../src/components/dialog/shareChannelAdd.vue | 11 +++-- web_src/src/components/group.vue | 11 +++-- web_src/src/components/region.vue | 10 +++-- 10 files changed, 41 insertions(+), 59 deletions(-) delete mode 100644 web_src/src/components/common/channelDataTypeSelect.vue 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 29d65807..5156c42a 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 @@ -367,7 +367,7 @@ public class GbChannelServiceImpl implements IGbChannelService { log.warn("[重置国标通道] 未找到对应Id的通道: id: {}", id); throw new ControllerException(ErrorCode.ERROR400); } - if (channel.getDataType() == ChannelDataType.GB28181.value) { + if (channel.getDataType() != ChannelDataType.GB28181.value) { log.warn("[重置国标通道] 非国标下级通道无法重置: id: {}", id); throw new ControllerException(ErrorCode.ERROR100.getCode(), "非国标下级通道无法重置"); } diff --git a/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java b/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java index 8c3758ae..ce28fa9b 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java @@ -50,7 +50,7 @@ public interface StreamPushMapper { " LEFT join wvp_device_channel wdc " + " on st.id = wdc.data_device_id " + " WHERE " + - " 1=1 " + + " wdc.data_type = 2 " + " AND (st.app LIKE concat('%',#{query},'%') escape '/' OR st.stream LIKE concat('%',#{query},'%') escape '/' " + " OR wdc.gb_device_id LIKE concat('%',#{query},'%') escape '/' OR wdc.gb_name LIKE concat('%',#{query},'%') escape '/') " + " AND st.pushing=1" + diff --git a/web_src/src/components/StreamProxyEdit.vue b/web_src/src/components/StreamProxyEdit.vue index 12413bfc..b4596941 100644 --- a/web_src/src/components/StreamProxyEdit.vue +++ b/web_src/src/components/StreamProxyEdit.vue @@ -153,7 +153,6 @@ export default { onSubmit: function () { console.log(typeof this.streamProxy.noneReader) this.saveLoading = true; - this.noneReaderHandler(); if (this.streamProxy.id) { this.$axios({ diff --git a/web_src/src/components/StreamProxyList.vue b/web_src/src/components/StreamProxyList.vue index 43eacaae..81b7008d 100755 --- a/web_src/src/components/StreamProxyList.vue +++ b/web_src/src/components/StreamProxyList.vue @@ -204,6 +204,7 @@ // this.$refs.streamProxyEdit.openDialog(null, this.initData) this.streamProxy = { type: "default", + dataType: 3, noneReader: 1, enable: true, enableAudio: true, diff --git a/web_src/src/components/common/channelDataTypeSelect.vue b/web_src/src/components/common/channelDataTypeSelect.vue deleted file mode 100644 index 5e3be93c..00000000 --- a/web_src/src/components/common/channelDataTypeSelect.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - diff --git a/web_src/src/components/dialog/GbChannelSelect.vue b/web_src/src/components/dialog/GbChannelSelect.vue index 5d3fa934..1bc92cd2 100644 --- a/web_src/src/components/dialog/GbChannelSelect.vue +++ b/web_src/src/components/dialog/GbChannelSelect.vue @@ -23,7 +23,13 @@ 类型: - + + + + + + 刷新 确 定 @@ -80,11 +86,9 @@ ") List queryChaneIdListByDeviceDbIds(List deviceDbIds); - @Delete("DELETE FROM wvp_device_channel WHERE data_type =1 and data_device_id=#{deviceId}") + @Delete("DELETE FROM wvp_device_channel WHERE data_type =1 and data_device_id=#{dataDeviceId}") int cleanChannelsByDeviceId(@Param("dataDeviceId") int dataDeviceId); @Delete("DELETE FROM wvp_device_channel WHERE id=#{id}") From 3ea236efdd6aaba11d53268333633c4c12911dfb Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 27 Dec 2024 10:07:22 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 数据库/2.7.3/初始化-mysql-2.7.3.sql | 1 - 数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql | 1 - 数据库/2.7.3/更新-mysql-2.7.3.sql | 12 +++++++++--- 数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql | 7 +++++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/数据库/2.7.3/初始化-mysql-2.7.3.sql b/数据库/2.7.3/初始化-mysql-2.7.3.sql index 09257ebd..17a73f32 100644 --- a/数据库/2.7.3/初始化-mysql-2.7.3.sql +++ b/数据库/2.7.3/初始化-mysql-2.7.3.sql @@ -149,7 +149,6 @@ create table wvp_device_channel record_plan_id integer, data_type integer not null, data_device_id integer not null, - constraint uk_wvp_device_channel_unique_data unique (data_type, data_device_id), constraint uk_wvp_unique_channel unique (gb_device_id) ); diff --git a/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql b/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql index 49d18d07..5a2b7fc8 100644 --- a/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql +++ b/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql @@ -165,7 +165,6 @@ create table wvp_device_channel record_plan_id integer, data_type integer not null, data_device_id integer not null, - constraint uk_wvp_device_channel_unique_data unique (data_type, data_device_id), constraint uk_wvp_unique_channel unique (gb_device_id) ); diff --git a/数据库/2.7.3/更新-mysql-2.7.3.sql b/数据库/2.7.3/更新-mysql-2.7.3.sql index fa288fbc..6d40353a 100644 --- a/数据库/2.7.3/更新-mysql-2.7.3.sql +++ b/数据库/2.7.3/更新-mysql-2.7.3.sql @@ -1,6 +1,12 @@ /* * 20241222 */ +alter table wvp_device_channel + drop index uk_wvp_device_channel_unique_device_channel; +alter table wvp_device_channel + drop index uk_wvp_unique_stream_push_id; +alter table wvp_device_channel + drop index uk_wvp_unique_stream_proxy_id; alter table wvp_device_channel add data_type integer not null; @@ -9,15 +15,15 @@ alter table wvp_device_channel add data_device_id integer not null; 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 id, device_db_id from wvp_device_channel where device_db_id is not null ) ct on ct.id = wdc.id set wdc.data_type = 1, wdc.data_device_id = ct.device_db_id where wdc.device_db_id is not null; update wvp_device_channel wdc INNER JOIN - (SELECT stream_push_id from wvp_device_channel where wdc.id = id and stream_push_id is not null ) ct + (SELECT id, stream_push_id from wvp_device_channel where stream_push_id is not null ) ct on ct.id = wdc.id set wdc.data_type = 2, wdc.data_device_id = ct.stream_push_id where wdc.stream_push_id is not null; update wvp_device_channel wdc INNER JOIN - (SELECT stream_proxy_id from wvp_device_channel where wdc.id = id and stream_proxy_id is not null ) ct + (SELECT id, stream_proxy_id from wvp_device_channel where stream_proxy_id is not null ) ct on ct.id = wdc.id set wdc.data_type = 3, wdc.data_device_id = ct.stream_proxy_id where wdc.stream_proxy_id is not null; alter table wvp_device_channel drop device_db_id; diff --git a/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql b/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql index c8b7d59a..a330045b 100644 --- a/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql +++ b/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql @@ -2,6 +2,13 @@ * 20241222 */ +alter table wvp_device_channel + drop index uk_wvp_device_channel_unique_device_channel; +alter table wvp_device_channel + drop index uk_wvp_unique_stream_push_id; +alter table wvp_device_channel + drop index uk_wvp_unique_stream_proxy_id; + alter table wvp_device_channel add data_type integer not null; From 460f73555e8c8fe484339d2241b4f46070d44e1b Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 27 Dec 2024 10:42:40 +0800 Subject: [PATCH 10/10] =?UTF-8?q?[=E6=8E=A8=E6=B5=81=E8=AE=BE=E5=A4=87]=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8E=A8=E6=B5=81=E4=B8=AD=E9=87=8D=E5=90=AF?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95=E7=BB=A7?= =?UTF-8?q?=E7=BB=AD=E6=92=AD=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/media/bean/MediaInfo.java | 111 +++++++++--------- .../media/zlm/ZLMMediaNodeServerService.java | 16 +-- .../vmp/streamPush/dao/StreamPushMapper.java | 4 +- 3 files changed, 66 insertions(+), 65 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java b/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java index b8da5678..c4a0615b 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java +++ b/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java @@ -106,63 +106,62 @@ public class MediaInfo { } } JSONArray jsonArray = jsonObject.getJSONArray("tracks"); - if (jsonArray.isEmpty()) { - return null; - } - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject trackJson = jsonArray.getJSONObject(i); - Integer channels = trackJson.getInteger("channels"); - Integer codecId = trackJson.getInteger("codec_id"); - Integer codecType = trackJson.getInteger("codec_type"); - Integer sampleRate = trackJson.getInteger("sample_rate"); - Integer height = trackJson.getInteger("height"); - Integer width = trackJson.getInteger("width"); - Integer fps = trackJson.getInteger("fps"); - Integer loss = trackJson.getInteger("loss"); - Integer frames = trackJson.getInteger("frames"); - Long keyFrames = trackJson.getLongValue("key_frames"); - Integer gop_interval_ms = trackJson.getInteger("gop_interval_ms"); - Long gop_size = trackJson.getLongValue("gop_size"); + if (!jsonArray.isEmpty()) { + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject trackJson = jsonArray.getJSONObject(i); + Integer channels = trackJson.getInteger("channels"); + Integer codecId = trackJson.getInteger("codec_id"); + Integer codecType = trackJson.getInteger("codec_type"); + Integer sampleRate = trackJson.getInteger("sample_rate"); + Integer height = trackJson.getInteger("height"); + Integer width = trackJson.getInteger("width"); + Integer fps = trackJson.getInteger("fps"); + Integer loss = trackJson.getInteger("loss"); + Integer frames = trackJson.getInteger("frames"); + Long keyFrames = trackJson.getLongValue("key_frames"); + Integer gop_interval_ms = trackJson.getInteger("gop_interval_ms"); + Long gop_size = trackJson.getLongValue("gop_size"); - Long duration = trackJson.getLongValue("duration"); - if (channels != null) { - mediaInfo.setAudioChannels(channels); - } - if (sampleRate != null) { - mediaInfo.setAudioSampleRate(sampleRate); - } - if (height != null) { - mediaInfo.setHeight(height); - } - if (width != null) { - mediaInfo.setWidth(width); - } - if (fps != null) { - mediaInfo.setFps(fps); - } - if (loss != null) { - mediaInfo.setLoss(loss); - } - if (duration > 0L) { - mediaInfo.setDuration(duration); - } - if (codecId != null) { - switch (codecId) { - case 0: - mediaInfo.setVideoCodec("H264"); - break; - case 1: - mediaInfo.setVideoCodec("H265"); - break; - case 2: - mediaInfo.setAudioCodec("AAC"); - break; - case 3: - mediaInfo.setAudioCodec("G711A"); - break; - case 4: - mediaInfo.setAudioCodec("G711U"); - break; + Long duration = trackJson.getLongValue("duration"); + if (channels != null) { + mediaInfo.setAudioChannels(channels); + } + if (sampleRate != null) { + mediaInfo.setAudioSampleRate(sampleRate); + } + if (height != null) { + mediaInfo.setHeight(height); + } + if (width != null) { + mediaInfo.setWidth(width); + } + if (fps != null) { + mediaInfo.setFps(fps); + } + if (loss != null) { + mediaInfo.setLoss(loss); + } + if (duration > 0L) { + mediaInfo.setDuration(duration); + } + if (codecId != null) { + switch (codecId) { + case 0: + mediaInfo.setVideoCodec("H264"); + break; + case 1: + mediaInfo.setVideoCodec("H265"); + break; + case 2: + mediaInfo.setAudioCodec("AAC"); + break; + case 3: + mediaInfo.setAudioCodec("G711A"); + break; + case 4: + mediaInfo.setAudioCodec("G711U"); + break; + } } } } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java index 802b7eb6..dc665d32 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java @@ -178,15 +178,17 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService { JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaServer, app, stream); if (mediaList != null) { if (mediaList.getInteger("code") == 0) { - JSONArray data = mediaList.getJSONArray("data"); - if (data == null) { + JSONArray dataArray = mediaList.getJSONArray("data"); + if (dataArray == null) { return streamInfoList; } - JSONObject mediaJSON = data.getJSONObject(0); - MediaInfo mediaInfo = MediaInfo.getInstance(mediaJSON, mediaServer, userSetting.getServerId()); - StreamInfo streamInfo = getStreamInfoByAppAndStream(mediaServer, app, stream, mediaInfo, callId, true); - if (streamInfo != null) { - streamInfoList.add(streamInfo); + for (int i = 0; i < dataArray.size(); i++) { + JSONObject mediaJSON = dataArray.getJSONObject(0); + MediaInfo mediaInfo = MediaInfo.getInstance(mediaJSON, mediaServer, userSetting.getServerId()); + StreamInfo streamInfo = getStreamInfoByAppAndStream(mediaServer, mediaInfo.getApp(), mediaInfo.getStream(), mediaInfo, callId, true); + if (streamInfo != null) { + streamInfoList.add(streamInfo); + } } } } diff --git a/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java b/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java index ce28fa9b..dfdb3421 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java @@ -48,9 +48,9 @@ public interface StreamPushMapper { " from " + " wvp_stream_push st " + " LEFT join wvp_device_channel wdc " + - " on st.id = wdc.data_device_id " + + " on wdc.data_type = 2 and st.id = wdc.data_device_id " + " WHERE " + - " wdc.data_type = 2 " + + " 1=1 " + " AND (st.app LIKE concat('%',#{query},'%') escape '/' OR st.stream LIKE concat('%',#{query},'%') escape '/' " + " OR wdc.gb_device_id LIKE concat('%',#{query},'%') escape '/' OR wdc.gb_name LIKE concat('%',#{query},'%') escape '/') " + " AND st.pushing=1" +