diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/CommonChannelController.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/CommonChannelController.java index 55552d9f..bb6d2fd3 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/CommonChannelController.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/CommonChannelController.java @@ -148,7 +148,6 @@ public class CommonChannelController { @Parameter(name = "query", description = "查询内容") @Parameter(name = "online", description = "是否在线") @Parameter(name = "channelType", description = "通道类型, 0:国标设备,1:推流设备,2:拉流代理") - @Parameter(name = "civilCode", description = "行政区划") @GetMapping("/civilCode/unusual/list") public PageInfo queryListByCivilCodeForUnusual(int page, int count, @RequestParam(required = false) String query, @@ -160,6 +159,24 @@ public class CommonChannelController { return channelService.queryListByCivilCodeForUnusual(page, count, query, online, channelType); } + + @Operation(summary = "存在父节点编号但无法挂载的通道列表", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "page", description = "当前页", required = true) + @Parameter(name = "count", description = "每页查询数量", required = true) + @Parameter(name = "query", description = "查询内容") + @Parameter(name = "online", description = "是否在线") + @Parameter(name = "channelType", description = "通道类型, 0:国标设备,1:推流设备,2:拉流代理") + @GetMapping("/parent/unusual/list") + public PageInfo queryListByParentForUnusual(int page, int count, + @RequestParam(required = false) String query, + @RequestParam(required = false) Boolean online, + @RequestParam(required = false) Integer channelType){ + if (ObjectUtils.isEmpty(query)){ + query = null; + } + return channelService.queryListByParentForUnusual(page, count, query, online, channelType); + } + @Operation(summary = "清除存在行政区划但无法挂载的通道列表", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "param", description = "清理参数, all为true清理所有异常数据。 否则按照传入的设备Id清理", required = true) @PostMapping("/civilCode/unusual/clear") @@ -167,6 +184,13 @@ public class CommonChannelController { channelService.clearChannelCivilCode(param.getAll(), param.getChannelIds()); } + @Operation(summary = "清除存在分组节点但无法挂载的通道列表", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "param", description = "清理参数, all为true清理所有异常数据。 否则按照传入的设备Id清理", required = true) + @PostMapping("/parent/unusual/clear") + public void clearChannelParent(@RequestBody ChannelToRegionParam param){ + channelService.clearChannelParent(param.getAll(), param.getChannelIds()); + } + @Operation(summary = "获取关联业务分组通道列表", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "page", description = "当前页", required = true) @Parameter(name = "count", description = "每页查询数量", required = true) 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 aad0c274..3b71eb1d 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 @@ -556,7 +556,20 @@ public interface CommonGBChannelMapper { @SelectProvider(type = ChannelProvider.class, method = "queryListByCivilCodeForUnusual") List queryListByCivilCodeForUnusual(@Param("query") String query, @Param("online") Boolean online, @Param("dataType")Integer dataType); - @SelectProvider(type = ChannelProvider.class, method = "queryAllForUnusual") - List queryAllForUnusual(); + @SelectProvider(type = ChannelProvider.class, method = "queryAllForUnusualCivilCode") + List queryAllForUnusualCivilCode(); + @SelectProvider(type = ChannelProvider.class, method = "queryListByParentForUnusual") + List queryListByParentForUnusual(@Param("query") String query, @Param("online") Boolean online, @Param("dataType")Integer dataType); + + @SelectProvider(type = ChannelProvider.class, method = "queryAllForUnusualParent") + List queryAllForUnusualParent(); + + @Update(value = {" "}) + void removeParentIdByChannelIds(List channelIdsForClear); } 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 018e77b0..8509e072 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 @@ -432,7 +432,30 @@ public class ChannelProvider { return sqlBuild.toString(); } - public String queryAllForUnusual(Map params ){ + public String queryListByParentForUnusual(Map params ){ + StringBuilder sqlBuild = new StringBuilder(); + sqlBuild.append(BASE_SQL_TABLE_NAME); + sqlBuild.append(" left join (select wcg.device_id from wvp_common_group wcg) temp on temp.device_id = coalesce(wdc.gb_parent_id, wdc.parent_id)" + + " where coalesce(wdc.gb_parent_id, wdc.parent_id) is not null and temp.device_id is null "); + sqlBuild.append(" AND wdc.channel_type = 0 "); + if (params.get("query") != null) { + sqlBuild.append(" AND (coalesce(wdc.gb_device_id, wdc.device_id) LIKE concat('%',#{query},'%') escape '/'" + + " OR coalesce(wdc.gb_name, wdc.name) LIKE concat('%',#{query},'%') escape '/' )") + ; + } + if (params.get("online") != null && (Boolean)params.get("online")) { + sqlBuild.append(" AND coalesce(wdc.gb_status, wdc.status) = 'ON'"); + } + if (params.get("online") != null && !(Boolean)params.get("online")) { + sqlBuild.append(" AND coalesce(wdc.gb_status, wdc.status) = 'OFF'"); + } + if (params.get("dataType") != null) { + sqlBuild.append(" AND wdc.data_type = #{dataType}"); + } + return sqlBuild.toString(); + } + + public String queryAllForUnusualCivilCode(Map params ){ StringBuilder sqlBuild = new StringBuilder(); sqlBuild.append("select wdc.id from wvp_device_channel wdc "); sqlBuild.append(" left join (select wcr.device_id from wvp_common_region wcr) temp on temp.device_id = coalesce(wdc.gb_civil_code, wdc.civil_code)" + @@ -440,4 +463,13 @@ public class ChannelProvider { sqlBuild.append(" AND wdc.channel_type = 0 "); return sqlBuild.toString(); } + + public String queryAllForUnusualParent(Map params ){ + StringBuilder sqlBuild = new StringBuilder(); + sqlBuild.append("select wdc.id from wvp_device_channel wdc "); + sqlBuild.append(" left join (select wcg.device_id from wvp_common_group wcg) temp on temp.device_id = coalesce(wdc.gb_parent_id, wdc.parent_id)" + + " where coalesce(wdc.gb_parent_id, wdc.parent_id) is not null and temp.device_id is null "); + sqlBuild.append(" AND wdc.channel_type = 0 "); + return sqlBuild.toString(); + } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelService.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelService.java index 6550d8bb..82c9b406 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelService.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelService.java @@ -93,4 +93,8 @@ public interface IGbChannelService { PageInfo queryListByCivilCodeForUnusual(int page, int count, String query, Boolean online, Integer channelType); void clearChannelCivilCode(Boolean all, List channelIds); + + PageInfo queryListByParentForUnusual(int page, int count, String query, Boolean online, Integer channelType); + + void clearChannelParent(Boolean all, List channelIds); } 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 d4068d75..aaceab22 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 @@ -768,10 +768,33 @@ public class GbChannelServiceImpl implements IGbChannelService { List channelIdsForClear; if (all != null && all) { - channelIdsForClear = commonGBChannelMapper.queryAllForUnusual(); + channelIdsForClear = commonGBChannelMapper.queryAllForUnusualCivilCode(); }else { channelIdsForClear = channelIds; } commonGBChannelMapper.removeCivilCodeByChannelIds(channelIdsForClear); } + + @Override + public PageInfo queryListByParentForUnusual(int page, int count, String query, Boolean online, Integer channelType) { + PageHelper.startPage(page, count); + if (query != null) { + query = query.replaceAll("/", "//") + .replaceAll("%", "/%") + .replaceAll("_", "/_"); + } + List all = commonGBChannelMapper.queryListByParentForUnusual(query, online, channelType); + return new PageInfo<>(all); + } + + @Override + public void clearChannelParent(Boolean all, List channelIds) { + List channelIdsForClear; + if (all != null && all) { + channelIdsForClear = commonGBChannelMapper.queryAllForUnusualParent(); + }else { + channelIdsForClear = channelIds; + } + commonGBChannelMapper.removeParentIdByChannelIds(channelIdsForClear); + } } diff --git a/web_src/src/components/dialog/UnusualGroupChannelSelect.vue b/web_src/src/components/dialog/UnusualGroupChannelSelect.vue new file mode 100644 index 00000000..6d395061 --- /dev/null +++ b/web_src/src/components/dialog/UnusualGroupChannelSelect.vue @@ -0,0 +1,261 @@ + + + diff --git a/web_src/src/components/group.vue b/web_src/src/components/group.vue index 03574826..311474cb 100755 --- a/web_src/src/components/group.vue +++ b/web_src/src/components/group.vue @@ -42,6 +42,9 @@ 移除通道 + + 异常挂载通道 + @@ -88,6 +91,7 @@ + @@ -96,6 +100,7 @@ import uiHeader from '../layout/UiHeader.vue' import DeviceService from "./service/DeviceService"; import GroupTree from "./common/GroupTree.vue"; import GbChannelSelect from "./dialog/GbChannelSelect.vue"; +import UnusualGroupChannelSelect from "./dialog/UnusualGroupChannelSelect.vue"; import RegionTree from "./common/RegionTree.vue"; export default { @@ -103,6 +108,7 @@ export default { components: { RegionTree, GbChannelSelect, + UnusualGroupChannelSelect, uiHeader, GroupTree, }, @@ -323,6 +329,9 @@ export default { onChannelChange: function (deviceId) { // }, + showUnusualChanel: function () { + this.$refs.unusualGroupChannelSelect.openDialog() + }, } };