From 6b3732b8c43165342b7521b1e3ea788e471d58e8 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 19 六月 2023 20:19:31 +0800
Subject: [PATCH] Merge branch '2.6.8' into wvp-28181-2.0

---
 src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java |   43 ++++++++++++++++---------------------------
 1 files changed, 16 insertions(+), 27 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 0cde5fe..3fb2f93 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
@@ -113,20 +113,15 @@
         deviceChannel.setStatus(gbStream.isStatus());
 
         deviceChannel.setRegisterWay(1);
-        deviceChannel.setCivilCode(platform.getAdministrativeDivision());
 
-        if (platform.getTreeType().equals(TreeType.CIVIL_CODE)){
-            deviceChannel.setCivilCode(catalogId);
-        }else if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)){
-            PlatformCatalog catalog = catalogMapper.select(catalogId);
-            if (catalog == null) {
-                deviceChannel.setParentId(platform.getDeviceGBId());
-                deviceChannel.setBusinessGroupId(null);
-            }else {
-                deviceChannel.setParentId(catalog.getId());
-                deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
-            }
-
+        PlatformCatalog catalog = catalogMapper.select(catalogId);
+        if (catalog != null) {
+            deviceChannel.setCivilCode(catalog.getCivilCode());
+            deviceChannel.setParentId(catalog.getParentId());
+            deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
+        }else {
+            deviceChannel.setCivilCode(platform.getAdministrativeDivision());
+            deviceChannel.setParentId(platform.getDeviceGBId());
         }
 
         deviceChannel.setModel("live");
@@ -221,20 +216,14 @@
         deviceChannel.setStatus(status != null && status);
 
         deviceChannel.setRegisterWay(1);
-        deviceChannel.setCivilCode(platform.getAdministrativeDivision());
-
-        if (platform.getTreeType().equals(TreeType.CIVIL_CODE)){
-            deviceChannel.setCivilCode(catalogId);
-        }else if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)){
-            PlatformCatalog catalog = catalogMapper.select(catalogId);
-            if (catalog == null) {
-                deviceChannel.setParentId(platform.getDeviceGBId());
-                deviceChannel.setBusinessGroupId(null);
-            }else {
-                deviceChannel.setParentId(catalog.getId());
-                deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
-            }
-
+        PlatformCatalog catalog = catalogMapper.select(catalogId);
+        if (catalog != null) {
+            deviceChannel.setCivilCode(catalog.getCivilCode());
+            deviceChannel.setParentId(catalog.getParentId());
+            deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
+        }else {
+            deviceChannel.setCivilCode(platform.getAdministrativeDivision());
+            deviceChannel.setParentId(platform.getDeviceGBId());
         }
 
         deviceChannel.setModel("live");

--
Gitblit v1.8.0