From f635f9c3003ae10f7be8e934b81bc480c82617ba Mon Sep 17 00:00:00 2001
From: xiaoxie <hotcoffie@163.com>
Date: 星期三, 20 四月 2022 13:56:30 +0800
Subject: [PATCH] 修复录像列表:实测部分厂家(TP-Link IPC43AW)录像列表接口,返回的xml报文数据中有多余的空格,导致解析String为Integer失败,增加trim修复这个问题

---
 src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

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 5827985..bbf992f 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
@@ -100,10 +100,11 @@
         deviceChannel.setLatitude(gbStream.getLatitude());
         deviceChannel.setDeviceId(deviceGBId);
         deviceChannel.setManufacture("wvp-pro");
-        deviceChannel.setStatus(gbStream.isStatus()?1:0);
+//        deviceChannel.setStatus(gbStream.isStatus()?1:0);
+        deviceChannel.setStatus(1);
         deviceChannel.setParentId(catalogId ==null?gbStream.getCatalogId():catalogId);
         deviceChannel.setRegisterWay(1);
-        deviceChannel.setCivilCode(sipConfig.getDomain());
+        deviceChannel.setCivilCode(deviceGBId.substring(0, 6));
         deviceChannel.setModel("live");
         deviceChannel.setOwner("wvp-pro");
         deviceChannel.setParental(0);
@@ -118,14 +119,14 @@
         TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
         try {
             List<DeviceChannel> deviceChannelList = new ArrayList<>();
+            platformGbStreamMapper.delByAppAndStreamsByPlatformId(gbStreams, platformId);
             for (GbStream gbStream : gbStreams) {
-                platformGbStreamMapper.delByAppAndStreamAndPlatform(gbStream.getApp(), gbStream.getStream(), platformId);
                 DeviceChannel deviceChannel = new DeviceChannel();
                 deviceChannel.setChannelId(gbStream.getGbId());
                 deviceChannelList.add(deviceChannel);
-                eventPublisher.catalogEventPublish(platformId, deviceChannel, CatalogEvent.DEL);
             }
 
+            eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
             dataSourceTransactionManager.commit(transactionStatus);     //鎵嬪姩鎻愪氦
             result = true;
         }catch (Exception e) {
@@ -159,7 +160,9 @@
                 List<ParentPlatform> parentPlatforms = platformGbStreamMapper.selectByAppAndStream(gs.getApp(), gs.getStream());
                 if (parentPlatforms.size() > 0) {
                     for (ParentPlatform parentPlatform : parentPlatforms) {
-                        eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), gs, type);
+                        if (parentPlatform != null) {
+                            eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), gs, type);
+                        }
                     }
                 }
             }

--
Gitblit v1.8.0