From 1c25f2f190c09eb6d7c283f5ec72fc9b05ddbae0 Mon Sep 17 00:00:00 2001 From: xiaoQQya Date: Thu, 26 Jun 2025 11:46:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=9B=BD=E6=A0=87?= =?UTF-8?q?=E6=94=B6=E6=B5=81=E9=80=9A=E9=81=93=E5=88=97=E8=A1=A8=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/gb28181/bean/DeviceChannel.java | 6 + .../vmp/gb28181/controller/DeviceQuery.java | 13 ++ .../vmp/gb28181/dao/DeviceChannelMapper.java | 7 +- .../dao/provider/DeviceChannelProvider.java | 23 ++- .../service/IDeviceChannelService.java | 6 +- .../impl/DeviceChannelServiceImpl.java | 16 +- web/src/api/device.js | 13 ++ web/src/store/modules/device.js | 25 ++- .../dashboard/console/ConsoleNodeLoad.vue | 21 ++- web/src/views/dialog/devicePlayer.vue | 1 + web/src/views/dialog/hasStreamChannel.vue | 149 ++++++++++++++++++ 11 files changed, 257 insertions(+), 23 deletions(-) create mode 100644 web/src/views/dialog/hasStreamChannel.vue 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 ab35ac51a..aee8eaba5 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 @@ -21,6 +21,12 @@ public class DeviceChannel extends CommonGBChannel { @Schema(description = "数据库自增ID") private int id; + @Schema(description = "父设备编码") + private String parentDeviceId; + + @Schema(description = "父设备名称") + private String parentName; + @MessageElementForCatalog("DeviceID") @Schema(description = "编码") private String deviceId; 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 9f4cebf3d..63585fb75 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 @@ -113,6 +113,19 @@ public class DeviceQuery { return deviceChannelService.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count); } + @GetMapping("/streams") + @Operation(summary = "分页查询存在流的通道", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "page", description = "当前页", required = true) + @Parameter(name = "count", description = "每页查询数量", required = true) + @Parameter(name = "query", description = "查询内容") + public PageInfo streamChannels(int page, int count, + @RequestParam(required = false) String query) { + if (ObjectUtils.isEmpty(query)) { + query = null; + } + + return deviceChannelService.queryChannels(query, true, null, null, true, page, count); + } @Operation(summary = "同步设备通道", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "deviceId", description = "设备国标编号", required = true) 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 8c02a1084..b696e2347 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 @@ -86,10 +86,11 @@ public interface DeviceChannelMapper { int update(DeviceChannel channel); @SelectProvider(type = DeviceChannelProvider.class, method = "queryChannels") - List queryChannels(@Param("dataDeviceId") int dataDeviceId, @Param("civilCode") String civilCode, + List queryChannels(@Param("dataDeviceId") Integer dataDeviceId, @Param("civilCode") String civilCode, @Param("businessGroupId") String businessGroupId, @Param("parentChannelId") String parentChannelId, - @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, - @Param("online") Boolean online, @Param("channelIds") List channelIds); + @Param("query") String query, @Param("queryParent") Boolean queryParent, + @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, + @Param("channelIds") List channelIds, @Param("hasStream") Boolean hasStream); @SelectProvider(type = DeviceChannelProvider.class, method = "queryChannelsByDeviceDbId") List queryChannelsByDeviceDbId(@Param("dataDeviceId") int dataDeviceId); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java index 6cfafb7c7..8f1526599 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java @@ -20,6 +20,8 @@ public class DeviceChannelProvider { " dc.gps_time,\n" + " dc.stream_identification,\n" + " dc.channel_type,\n" + + " d.device_id as parent_device_id,\n" + + " coalesce(d.custom_name, d.name) as parent_name,\n" + " coalesce(dc.gb_device_id, dc.device_id) as device_id,\n" + " coalesce(dc.gb_name, dc.name) as name,\n" + " coalesce(dc.gb_manufacturer, dc.manufacturer) as manufacturer,\n" + @@ -55,13 +57,17 @@ public class DeviceChannelProvider { " coalesce(dc.gb_svc_space_support_mod, dc.svc_space_support_mod) as svc_space_support_mod,\n" + " coalesce(dc.gb_svc_time_support_mode,dc.svc_time_support_mode) as svc_time_support_mode\n" + " from " + - " wvp_device_channel dc " + " wvp_device_channel dc " + + " left join wvp_device d on d.id = dc.data_device_id " ; } public String queryChannels(Map params ){ StringBuilder sqlBuild = new StringBuilder(); sqlBuild.append(getBaseSelectSql()); - sqlBuild.append(" where data_type = " + ChannelDataType.GB28181.value + " and dc.data_device_id = #{dataDeviceId} "); + sqlBuild.append(" where data_type = " + ChannelDataType.GB28181.value); + if (params.get("dataDeviceId") != null) { + sqlBuild.append(" AND dc.data_device_id = #{dataDeviceId} "); + } if (params.get("businessGroupId") != null ) { sqlBuild.append(" AND coalesce(dc.gb_business_group_id, dc.business_group_id)=#{businessGroupId} AND coalesce(dc.gb_parent_id, dc.parent_id) is null"); }else if (params.get("parentChannelId") != null ) { @@ -73,8 +79,15 @@ public class DeviceChannelProvider { } if (params.get("query") != null && !ObjectUtils.isEmpty(params.get("query"))) { sqlBuild.append(" AND (coalesce(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%') escape '/'" + - " OR coalesce(dc.gb_name, dc.name) LIKE concat('%',#{query},'%') escape '/')") - ; + " OR coalesce(dc.gb_name, dc.name) LIKE concat('%',#{query},'%') escape '/'"); + if (params.get("queryParent") != null && (Boolean) params.get("queryParent")) { + sqlBuild.append(" OR d.device_id LIKE concat('%',#{query},'%') escape '/'"); + sqlBuild.append(" OR coalesce(d.custom_name, d.name) LIKE concat('%',#{query},'%') escape '/'"); + } + sqlBuild.append(")"); + } + if (params.get("hasStream") != null && (Boolean) params.get("hasStream")) { + sqlBuild.append(" AND dc.stream_id IS NOT NULL"); } if (params.get("online") != null && (Boolean)params.get("online")) { sqlBuild.append(" AND coalesce(gb_status, status) = 'ON'"); @@ -101,7 +114,7 @@ public class DeviceChannelProvider { } sqlBuild.append(" )"); } - sqlBuild.append(" ORDER BY device_id"); + sqlBuild.append(" ORDER BY d.device_id, dc.device_id"); return sqlBuild.toString(); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IDeviceChannelService.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IDeviceChannelService.java index 6cc39f760..27fdf0415 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IDeviceChannelService.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IDeviceChannelService.java @@ -1,10 +1,7 @@ package com.genersoft.iot.vmp.gb28181.service; -import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.common.enums.DeviceControlType; -import com.genersoft.iot.vmp.gb28181.bean.Device; -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; -import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; +import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce; import com.genersoft.iot.vmp.service.bean.ErrorCallback; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo; @@ -104,6 +101,7 @@ public interface IDeviceChannelService { PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean channelType, Boolean online, int page, int count); + PageInfo queryChannels(String query, Boolean queryParent, Boolean channelType, Boolean online, Boolean hasStream, int page, int count); List queryDeviceWithAsMessageChannel(); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java index 7cecf7826..cceae23e8 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java @@ -696,7 +696,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { .replaceAll("%", "/%") .replaceAll("_", "/_"); } - List all = channelMapper.queryChannels(deviceDbId, civilCode, businessGroupId, parentId, query, channelType, online,null); + List all = channelMapper.queryChannels(deviceDbId, civilCode, businessGroupId, parentId, query, false, channelType, online, null, null); return new PageInfo<>(all); } @@ -717,7 +717,19 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { .replaceAll("_", "/_"); } PageHelper.startPage(page, count); - List all = channelMapper.queryChannels(device.getId(), null,null, null, query, hasSubChannel, online,null); + List all = channelMapper.queryChannels(device.getId(), null, null, null, query, false, hasSubChannel, online, null, null); + return new PageInfo<>(all); + } + + @Override + public PageInfo queryChannels(String query, Boolean queryParent, Boolean hasSubChannel, Boolean online, Boolean hasStream, int page, int count) { + PageHelper.startPage(page, count); + if (query != null) { + query = query.replaceAll("/", "//") + .replaceAll("%", "/%") + .replaceAll("_", "/_"); + } + List all = channelMapper.queryChannels(null, null, null, null, query, queryParent, hasSubChannel, online, null, hasStream); return new PageInfo<>(all); } diff --git a/web/src/api/device.js b/web/src/api/device.js index c5e8d8486..3d0ac77ca 100644 --- a/web/src/api/device.js +++ b/web/src/api/device.js @@ -118,6 +118,19 @@ export function queryChannels(deviceId, params) { }) } +export function queryHasStreamChannels(params) { + const {page, count, query} = params + return request({ + method: 'get', + url: `/api/device/query/streams`, + params: { + page: page, + count: count, + query: query + } + }) +} + export function deviceRecord(params) { const { deviceId, channelId, recordCmdStr } = params return request({ diff --git a/web/src/store/modules/device.js b/web/src/store/modules/device.js index a4b6286c2..d9265249a 100644 --- a/web/src/store/modules/device.js +++ b/web/src/store/modules/device.js @@ -1,17 +1,24 @@ import { - add, changeChannelAudio, + add, + changeChannelAudio, deleteDevice, deviceRecord, queryBasicParam, queryChannelOne, - queryChannels, queryChannelTree, queryDeviceOne, + queryChannels, + queryChannelTree, + queryDeviceOne, queryDevices, - queryDeviceSyncStatus, queryDeviceTree, + queryDeviceSyncStatus, + queryDeviceTree, + queryHasStreamChannels, resetGuard, setGuard, subscribeCatalog, subscribeMobilePosition, - sync, update, updateChannelStreamIdentification, + sync, + update, + updateChannelStreamIdentification, updateDeviceTransport } from '@/api/device' @@ -126,6 +133,16 @@ const actions = { }) }) }, + queryHasStreamChannels({commit}, params) { + return new Promise((resolve, reject) => { + queryHasStreamChannels(params).then(response => { + const {data} = response + resolve(data) + }).catch(error => { + reject(error) + }) + }) + }, deviceRecord({ commit }, params) { return new Promise((resolve, reject) => { deviceRecord(params).then(response => { diff --git a/web/src/views/dashboard/console/ConsoleNodeLoad.vue b/web/src/views/dashboard/console/ConsoleNodeLoad.vue index de2f5b04f..598661dc1 100755 --- a/web/src/views/dashboard/console/ConsoleNodeLoad.vue +++ b/web/src/views/dashboard/console/ConsoleNodeLoad.vue @@ -1,17 +1,21 @@ diff --git a/web/src/views/dialog/devicePlayer.vue b/web/src/views/dialog/devicePlayer.vue index 3d38da44a..fa1c5b143 100755 --- a/web/src/views/dialog/devicePlayer.vue +++ b/web/src/views/dialog/devicePlayer.vue @@ -6,6 +6,7 @@ v-el-drag-dialog title="视频播放" top="0" + append-to-body :close-on-click-modal="false" :visible.sync="showVideoDialog" @close="close()" diff --git a/web/src/views/dialog/hasStreamChannel.vue b/web/src/views/dialog/hasStreamChannel.vue new file mode 100644 index 000000000..be808366b --- /dev/null +++ b/web/src/views/dialog/hasStreamChannel.vue @@ -0,0 +1,149 @@ + + +