From 0371f5a96e8be9067b796c7b93ecf4d3bbdb99dc Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 15 Jan 2024 15:31:20 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BD=E6=A0=87?= =?UTF-8?q?=E7=BA=A7=E8=81=94=E5=85=A8=E9=83=A8=E6=B7=BB=E5=8A=A0=E4=B8=8E?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/gb28181/transmit/SIPSender.java | 4 ++-- .../cmd/impl/SIPCommanderFroPlatform.java | 1 + .../vmp/service/impl/GbStreamServiceImpl.java | 22 +++++++++---------- .../impl/PlatformChannelServiceImpl.java | 9 ++++---- .../storager/dao/PlatformChannelMapper.java | 5 ++++- .../storager/dao/PlatformGbStreamMapper.java | 9 +++++--- .../gb28181/gbStream/GbStreamController.java | 4 ++-- 7 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPSender.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPSender.java index e8066b75..ce1074bd 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPSender.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPSender.java @@ -66,17 +66,17 @@ public class SIPSender { // 添加错误订阅 if (errorEvent != null) { sipSubscribe.addErrorSubscribe(callIdHeader.getCallId(), (eventResult -> { - errorEvent.response(eventResult); sipSubscribe.removeErrorSubscribe(eventResult.callId); sipSubscribe.removeOkSubscribe(eventResult.callId); + errorEvent.response(eventResult); })); } // 添加订阅 if (okEvent != null) { sipSubscribe.addOkSubscribe(callIdHeader.getCallId(), eventResult -> { - okEvent.response(eventResult); sipSubscribe.removeOkSubscribe(eventResult.callId); sipSubscribe.removeErrorSubscribe(eventResult.callId); + okEvent.response(eventResult); }); } if ("TCP".equals(transport)) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java index 07fb78ca..189934b0 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java @@ -579,6 +579,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { sendNotify(parentPlatform, catalogXmlContent, subscribeInfo, eventResult -> { logger.error("发送NOTIFY通知消息失败。错误:{} {}", eventResult.statusCode, eventResult.msg); }, (eventResult -> { + logger.info("[发送NOTIFY通知]类型: {},发送成功: {}", type, channels.size()); try { sendNotifyForCatalogAddOrUpdate(type, parentPlatform, deviceChannels, subscribeInfo, finalIndex + parentPlatform.getCatalogGroup()); diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java index 86e033c2..49e4a3c6 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java @@ -77,8 +77,6 @@ public class GbStreamServiceImpl implements IGbStreamService { } try { List deviceChannelList = new ArrayList<>(); - - for (int i = 0; i < gbStreams.size(); i++) { GbStream gbStream = gbStreams.get(i); gbStream.setCatalogId(catalogId); @@ -250,16 +248,18 @@ public class GbStreamServiceImpl implements IGbStreamService { if (platform == null) { return ; } - if (platformGbStreamMapper.delByPlatformAndCatalogId(platformId, catalogId) > 0) { - List gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId); - List deviceChannelList = new ArrayList<>(); - for (GbStream gbStream : gbStreams) { - DeviceChannel deviceChannel = new DeviceChannel(); - deviceChannel.setChannelId(gbStream.getGbId()); - deviceChannelList.add(deviceChannel); - } - eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL); + if (ObjectUtils.isEmpty(catalogId)) { + catalogId = null; } + List gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId); + List deviceChannelList = new ArrayList<>(); + for (GbStream gbStream : gbStreams) { + DeviceChannel deviceChannel = new DeviceChannel(); + deviceChannel.setChannelId(gbStream.getGbId()); + deviceChannelList.add(deviceChannel); + } + eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL); + platformGbStreamMapper.delByPlatformAndCatalogId(platformId, catalogId); } @Override diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java index 9f2b5e05..bda08e86 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java @@ -165,10 +165,9 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService { catalogId = null; } - if ((result = platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId)) > 0) { - List deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId); - eventPublisher.catalogEventPublish(platformId, deviceChannels, CatalogEvent.DEL); - } - return result; + List deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId); + eventPublisher.catalogEventPublish(platformId, deviceChannels, CatalogEvent.DEL); + + return platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId); } } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java index f363f66f..f7976019 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java @@ -58,7 +58,10 @@ public interface PlatformChannelMapper { @Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id=#{channelId} and pgc.platform_id=#{platformId}") List queryChannelInParentPlatform(@Param("platformId") String platformId, @Param("channelId") String channelId); - @Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}") + @Select("") List queryAllChannelInCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId); @Select(" select dc.channel_id as id, dc.name as name, pgc.platform_id as platform_id, pgc.catalog_id as parent_id, 0 as children_count, 1 as type " + diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java index 5f6d7848..e4fc3568 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java @@ -53,11 +53,14 @@ public interface PlatformGbStreamMapper { "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{platformId}") StreamProxyItem selectOne(@Param("app") String app, @Param("stream") String stream, @Param("platformId") String platformId); - @Select("select gs.* \n" + - "from wvp_gb_stream gs\n" + + @Select("") List queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId); @Select("select gs.gb_id as id, gs.name as name, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id , 0 as children_count, 2 as type\n" + diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java index 3bdee76e..d49ab6a2 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java @@ -84,7 +84,7 @@ public class GbStreamController { @ResponseBody public void del(@RequestBody GbStreamParam gbStreamParam){ - if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) { + if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().isEmpty()) { if (gbStreamParam.isAll()) { gbStreamService.delAllPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId()); } @@ -103,7 +103,7 @@ public class GbStreamController { @PostMapping(value = "/add") @ResponseBody public void add(@RequestBody GbStreamParam gbStreamParam){ - if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) { + if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().isEmpty()) { if (gbStreamParam.isAll()) { List allGBChannels = gbStreamService.getAllGBChannels(gbStreamParam.getPlatformId()); gbStreamService.addPlatformInfo(allGBChannels, gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId()); From 13e2a96daeb4d751e559ae846e94e0a647800f96 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 15 Jan 2024 15:39:28 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E9=80=9A=E9=81=93=E6=97=B6=E9=80=9A=E7=9F=A5=E7=9A=84=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java index 189934b0..369a32ef 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java @@ -579,7 +579,6 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { sendNotify(parentPlatform, catalogXmlContent, subscribeInfo, eventResult -> { logger.error("发送NOTIFY通知消息失败。错误:{} {}", eventResult.statusCode, eventResult.msg); }, (eventResult -> { - logger.info("[发送NOTIFY通知]类型: {},发送成功: {}", type, channels.size()); try { sendNotifyForCatalogAddOrUpdate(type, parentPlatform, deviceChannels, subscribeInfo, finalIndex + parentPlatform.getCatalogGroup()); @@ -681,6 +680,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { }else { channels = deviceChannels.subList(index, deviceChannels.size()); } + logger.info("[发送NOTIFY通知]类型: {},发送数量: {}", type, channels.size()); Integer finalIndex = index; String catalogXmlContent = getCatalogXmlContentForCatalogOther(parentPlatform, channels, type); sendNotify(parentPlatform, catalogXmlContent, subscribeInfo, eventResult -> { From 9b62fbe467a19ae202aee045a6133900b807b1d9 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 15 Jan 2024 18:36:31 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java | 2 +- web_src/src/components/dialog/deviceEdit.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java index 4f3f2a16..107ebde6 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java @@ -277,7 +277,7 @@ public class DeviceServiceImpl implements IDeviceService { // 设置最小值为30 int subscribeCycleForCatalog = Math.max(device.getSubscribeCycleForMobilePosition(),30); // 刷新订阅 - dynamicTask.startCron(device.getDeviceId() + "mobile_position" , mobilePositionSubscribeTask, (subscribeCycleForCatalog) * 1000); + dynamicTask.startCron(device.getDeviceId() + "mobile_position" , mobilePositionSubscribeTask, subscribeCycleForCatalog * 1000); return true; } diff --git a/web_src/src/components/dialog/deviceEdit.vue b/web_src/src/components/dialog/deviceEdit.vue index d833b132..5fb506ec 100755 --- a/web_src/src/components/dialog/deviceEdit.vue +++ b/web_src/src/components/dialog/deviceEdit.vue @@ -20,7 +20,7 @@ - +