From 22efd0f56c20e1aedb18fa7b9bcdc48007fcc954 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 20 十二月 2021 09:51:51 +0800
Subject: [PATCH] 添加心跳到期时验证zlm是否真的离线。

---
 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java |   36 +++++++++++++++++-------------------
 1 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
index ce476f7..5af0837 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
@@ -52,10 +52,10 @@
     @GetMapping("/server_config")
     public ResponseEntity<JSONObject> serverConfig() {
         JSONObject result = new JSONObject();
-        result.put("deviceIp", sipConfig.getSipIp());
-        result.put("devicePort", sipConfig.getSipPort());
-        result.put("username", sipConfig.getSipId());
-        result.put("password", sipConfig.getSipPassword());
+        result.put("deviceIp", sipConfig.getIp());
+        result.put("devicePort", sipConfig.getPort());
+        result.put("username", sipConfig.getId());
+        result.put("password", sipConfig.getPassword());
         return new ResponseEntity<>(result, HttpStatus.OK);
     }
 
@@ -73,9 +73,9 @@
     })
     public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count){
 
-        if (logger.isDebugEnabled()) {
-            logger.debug("鏌ヨ鎵�鏈変笂绾ц澶嘇PI璋冪敤");
-        }
+//        if (logger.isDebugEnabled()) {
+//            logger.debug("鏌ヨ鎵�鏈変笂绾ц澶嘇PI璋冪敤");
+//        }
         return storager.queryParentPlatformList(page, count);
     }
 
@@ -111,7 +111,7 @@
         // TODO 妫�鏌ユ槸鍚﹀凡缁忓瓨鍦�,涓旀敞鍐屾垚鍔�, 濡傛灉娉ㄥ唽鎴愬姛,闇�瑕佸厛娉ㄩ攢涔嬪墠鍐�,淇敼骞舵敞鍐�
 
         // ParentPlatform parentPlatformOld = storager.queryParentPlatById(parentPlatform.getDeviceGBId());
-        ParentPlatform parentPlatformOld = storager.queryParentPlatById(parentPlatform.getServerGBId());
+        ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId());
 
         boolean updateResult = storager.updateParentPlatform(parentPlatform);
 
@@ -119,12 +119,10 @@
             // 淇濆瓨鏃跺惎鐢ㄥ氨鍙戦�佹敞鍐�
             if (parentPlatform.isEnable()) {
                 //  鍙淇濆瓨灏卞彂閫佹敞鍐�
-                commanderForPlatform.register(parentPlatform);
+                commanderForPlatform.register(parentPlatform, null, null);
             } else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()){ // 鍏抽棴鍚敤鏃舵敞閿�
                 commanderForPlatform.unregister(parentPlatform, null, null);
             }
-
-
             return new ResponseEntity<>("success", HttpStatus.OK);
         } else {
             return new ResponseEntity<>("fail", HttpStatus.OK);
@@ -151,7 +149,7 @@
         ){
             return new ResponseEntity<>("missing parameters", HttpStatus.BAD_REQUEST);
         }
-        ParentPlatform parentPlatform = storager.queryParentPlatById(serverGBId);
+        ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
         if (parentPlatform == null) return new ResponseEntity<>("fail", HttpStatus.OK);
         // 鍙戦�佺绾挎秷鎭�,鏃犺鏄惁鎴愬姛閮藉垹闄ょ紦瀛�
         commanderForPlatform.unregister(parentPlatform, (event -> {
@@ -189,10 +187,10 @@
     @ResponseBody
     public ResponseEntity<String> exitPlatform(@PathVariable String serverGBId){
 
-        if (logger.isDebugEnabled()) {
-            logger.debug("鏌ヨ涓婄骇骞冲彴鏄惁瀛樺湪API璋冪敤锛�" + serverGBId);
-        }
-        ParentPlatform parentPlatform = storager.queryParentPlatById(serverGBId);
+//        if (logger.isDebugEnabled()) {
+//            logger.debug("鏌ヨ涓婄骇骞冲彴鏄惁瀛樺湪API璋冪敤锛�" + serverGBId);
+//        }
+        ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
         return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK);
     }
 
@@ -226,9 +224,9 @@
                                               @RequestParam(required = false) Boolean choosed,
                                               @RequestParam(required = false) Boolean channelType){
 
-        if (logger.isDebugEnabled()) {
-            logger.debug("鏌ヨ鎵�鏈夋墍鏈夐�氶亾API璋冪敤");
-        }
+//        if (logger.isDebugEnabled()) {
+//            logger.debug("鏌ヨ鎵�鏈夋墍鏈夐�氶亾API璋冪敤");
+//        }
         PageInfo<ChannelReduce> channelReduces = null;
         if (platformId != null ) {
             channelReduces = storager.queryAllChannelList(page, count, query, online, channelType, platformId, choosed);

--
Gitblit v1.8.0