From 56859d09df8d4226882d43934acf32d60a3b51d7 Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期二, 30 三月 2021 18:46:34 +0800
Subject: [PATCH] 添加推流列表和拉流代理,下一步与国标关联

---
 src/main/java/com/genersoft/iot/vmp/web/ApiDeviceController.java |   44 ++++++++++++++++++++------------------------
 1 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/web/ApiDeviceController.java b/src/main/java/com/genersoft/iot/vmp/web/ApiDeviceController.java
index 57b102c..b58a3c5 100644
--- a/src/main/java/com/genersoft/iot/vmp/web/ApiDeviceController.java
+++ b/src/main/java/com/genersoft/iot/vmp/web/ApiDeviceController.java
@@ -1,22 +1,17 @@
 package com.genersoft.iot.vmp.web;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.genersoft.iot.vmp.common.PageResult;
 import com.genersoft.iot.vmp.gb28181.bean.Device;
 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
-import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector;
-import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
-import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
+// import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector;
+// import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
+// import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
-import com.genersoft.iot.vmp.vmanager.device.DeviceController;
+import com.github.pagehelper.PageInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
@@ -24,6 +19,7 @@
 /**
  * 鍏煎LiveGBS鐨凙PI锛氳澶囦俊鎭�
  */
+@SuppressWarnings("unchecked")
 @CrossOrigin
 @RestController
 @RequestMapping(value = "/api/v1/device")
@@ -34,14 +30,14 @@
     @Autowired
     private IVideoManagerStorager storager;
 
-    @Autowired
-    private SIPCommander cmder;
+    // @Autowired
+    // private SIPCommander cmder;
 
-    @Autowired
-    private DeferredResultHolder resultHolder;
+    // @Autowired
+    // private DeferredResultHolder resultHolder;
 
-    @Autowired
-    private DeviceOffLineDetector offLineDetector;
+    // @Autowired
+    // private DeviceOffLineDetector offLineDetector;
 
     /**
      * 鍒嗛〉鑾峰彇璁惧鍒楄〃 TODO 鐜板湪鐩存帴杩斿洖锛屽皻鏈疄鐜板垎椤�
@@ -65,12 +61,12 @@
         JSONObject result = new JSONObject();
         List<Device> devices;
         if (start == null || limit ==null) {
-            devices = storager.queryVideoDeviceList(null);
+            devices = storager.queryVideoDeviceList();
             result.put("DeviceCount", devices.size());
         }else {
-            PageResult<Device> deviceList = storager.queryVideoDeviceList(null, start, limit);
+            PageInfo<Device> deviceList = storager.queryVideoDeviceList(start/limit, limit);
             result.put("DeviceCount", deviceList.getTotal());
-            devices = deviceList.getData();
+            devices = deviceList.getList();
         }
 
         JSONArray deviceJSONList = new JSONArray();
@@ -86,8 +82,8 @@
             deviceJsonObject.put("Online", device.getOnline() == 1);
             deviceJsonObject.put("Password", "");
             deviceJsonObject.put("MediaTransport", device.getTransport());
-            deviceJsonObject.put("RemoteIP", device.getHost().getIp());
-            deviceJsonObject.put("RemotePort", device.getHost().getPort());
+            deviceJsonObject.put("RemoteIP", device.getIp());
+            deviceJsonObject.put("RemotePort", device.getPort());
             deviceJsonObject.put("LastRegisterAt", "");
             deviceJsonObject.put("LastKeepaliveAt", "");
             deviceJsonObject.put("UpdatedAt", "");
@@ -123,9 +119,9 @@
             deviceChannels = storager.queryChannelsByDeviceId(serial);
             result.put("ChannelCount", deviceChannels.size());
         }else {
-            PageResult<DeviceChannel> pageResult = storager.queryChannelsByDeviceId(serial, start, limit);
+            PageInfo<DeviceChannel> pageResult = storager.queryChannelsByDeviceId(serial, null, null, null,start/limit, limit);
             result.put("ChannelCount", pageResult.getTotal());
-            deviceChannels = pageResult.getData();
+            deviceChannels = pageResult.getList();
         }
 
         JSONArray channleJSONList = new JSONArray();
@@ -139,7 +135,7 @@
             deviceJOSNChannel.put("Name", deviceChannel.getName());
             deviceJOSNChannel.put("Custom", false);
             deviceJOSNChannel.put("CustomName", "");
-            deviceJOSNChannel.put("SubCount", 0); // TODO ? 瀛愯妭鐐规暟, SubCount > 0 琛ㄧず璇ラ�氶亾涓哄瓙鐩綍
+            deviceJOSNChannel.put("SubCount", deviceChannel.getSubCount()); // TODO ? 瀛愯妭鐐规暟, SubCount > 0 琛ㄧず璇ラ�氶亾涓哄瓙鐩綍
             deviceJOSNChannel.put("SnapURL", "");
             deviceJOSNChannel.put("Manufacturer ", deviceChannel.getManufacture());
             deviceJOSNChannel.put("Model", deviceChannel.getModel());
@@ -159,7 +155,7 @@
             deviceJOSNChannel.put("PTZType ", deviceChannel.getPTZType()); // 浜戝彴绫诲瀷, 0 - 鏈煡, 1 - 鐞冩満, 2 - 鍗婄悆,
                                                                             //   3 - 鍥哄畾鏋満, 4 - 閬ユ帶鏋満
             deviceJOSNChannel.put("CustomPTZType", "");
-            deviceJOSNChannel.put("StreamID", deviceChannel.getSsrc()); // StreamID 鐩存挱娴両D, 鏈夊�艰〃绀烘鍦ㄧ洿鎾�
+            deviceJOSNChannel.put("StreamID", deviceChannel.getStreamId()); // StreamID 鐩存挱娴両D, 鏈夊�艰〃绀烘鍦ㄧ洿鎾�
             deviceJOSNChannel.put("NumOutputs ", -1); // 鐩存挱鍦ㄧ嚎浜烘暟
             channleJSONList.add(deviceJOSNChannel);
         }

--
Gitblit v1.8.0