From 363606d8453c027429ea66a6036c62b01ff8e06c Mon Sep 17 00:00:00 2001
From: 648540858 <456panlinlin>
Date: 星期二, 26 四月 2022 18:29:47 +0800
Subject: [PATCH] 优化级联目录发送

---
 src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 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 bbf992f..b65f826 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
@@ -78,7 +78,7 @@
                 gbStream.setPlatformId(platformId);
                 // TODO 淇敼涓烘壒閲忔彁浜�
                 platformGbStreamMapper.add(gbStream);
-                DeviceChannel deviceChannelListByStream = getDeviceChannelListByStream(gbStream, catalogId, parentPlatform.getDeviceGBId());
+                DeviceChannel deviceChannelListByStream = getDeviceChannelListByStream(gbStream, catalogId, parentPlatform);
                 deviceChannelList.add(deviceChannelListByStream);
             }
             dataSourceTransactionManager.commit(transactionStatus);     //鎵嬪姩鎻愪氦
@@ -92,19 +92,23 @@
     }
 
     @Override
-    public DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, String deviceGBId) {
+    public DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, ParentPlatform platform) {
         DeviceChannel deviceChannel = new DeviceChannel();
         deviceChannel.setChannelId(gbStream.getGbId());
         deviceChannel.setName(gbStream.getName());
         deviceChannel.setLongitude(gbStream.getLongitude());
         deviceChannel.setLatitude(gbStream.getLatitude());
-        deviceChannel.setDeviceId(deviceGBId);
+        deviceChannel.setDeviceId(platform.getDeviceGBId());
         deviceChannel.setManufacture("wvp-pro");
 //        deviceChannel.setStatus(gbStream.isStatus()?1:0);
         deviceChannel.setStatus(1);
         deviceChannel.setParentId(catalogId ==null?gbStream.getCatalogId():catalogId);
         deviceChannel.setRegisterWay(1);
-        deviceChannel.setCivilCode(deviceGBId.substring(0, 6));
+        if (catalogId.length() <= 10) { // 鐖惰妭鐐规槸琛屾斂鍖哄垝,鍒欒缃瓹ivilCode浣跨敤姝よ鏀垮尯鍒�
+            deviceChannel.setCivilCode(catalogId);
+        }else {
+            deviceChannel.setCivilCode(platform.getAdministrativeDivision());
+        }
         deviceChannel.setModel("live");
         deviceChannel.setOwner("wvp-pro");
         deviceChannel.setParental(0);

--
Gitblit v1.8.0