Procházet zdrojové kódy

Merge remote-tracking branch 'origin/wvp-28181-2.0' into wvp-28181-2.0

panlinlin před 4 roky
rodič
revize
89244932c6
36 změnil soubory, kde provedl 548 přidání a 150 odebrání
  1. 2 3
      README.md
  2. 5 8
      pom.xml
  3. 2 0
      src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java
  4. 41 0
      src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java
  5. 6 5
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
  6. 1 1
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
  7. 4 0
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
  8. 21 0
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java
  9. 18 0
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
  10. 1 1
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
  11. 3 3
      src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
  12. 58 6
      src/main/java/com/genersoft/iot/vmp/vmanager/MobilePosition/MobilePositionController.java
  13. 35 11
      src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceConfig.java
  14. 54 16
      src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceControl.java
  15. 118 13
      src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceQuery.java
  16. 37 7
      src/main/java/com/genersoft/iot/vmp/vmanager/gbStream/GbStreamController.java
  17. 16 2
      src/main/java/com/genersoft/iot/vmp/vmanager/media/MediaController.java
  18. 18 12
      src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java
  19. 5 5
      src/main/java/com/genersoft/iot/vmp/vmanager/play/PlayController.java
  20. 3 3
      src/main/java/com/genersoft/iot/vmp/vmanager/playback/PlaybackController.java
  21. 56 0
      src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
  22. 7 1
      src/main/resources/application-dev.yml
  23. binární
      src/main/resources/wvp.sqlite
  24. 3 4
      web_src/src/components/DeviceList.vue
  25. 2 2
      web_src/src/components/ParentPlatformList.vue
  26. 0 2
      web_src/src/components/PushVideoList.vue
  27. 4 0
      web_src/src/components/UiHeader.vue
  28. 5 5
      web_src/src/components/channelList.vue
  29. 4 4
      web_src/src/components/devicePosition.vue
  30. 1 1
      web_src/src/components/dialog/StreamProxyEdit.vue
  31. 1 1
      web_src/src/components/dialog/addStreamTOGB.vue
  32. 1 1
      web_src/src/components/dialog/chooseChannel.vue
  33. 4 4
      web_src/src/components/dialog/chooseChannelForGb.vue
  34. 2 1
      web_src/src/components/dialog/chooseChannelForStream.vue
  35. 4 4
      web_src/src/components/dialog/devicePlayer.vue
  36. 6 24
      web_src/src/components/dialog/platformEdit.vue

+ 2 - 3
README.md

@@ -1,5 +1,4 @@
-# wvp-2.0
-在1.0的基础上实现国标级联
+# wvp-pro-2.0
 
 
 WEB VIDEO PLATFORM是一个基于GB28181-2016标准实现的网络视频平台,负责实现核心信令与设备管理后台部分,支持NAT穿透,支持海康、大华、宇视等品牌的IPC、NVR、DVR接入。   
 WEB VIDEO PLATFORM是一个基于GB28181-2016标准实现的网络视频平台,负责实现核心信令与设备管理后台部分,支持NAT穿透,支持海康、大华、宇视等品牌的IPC、NVR、DVR接入。   
 流媒体服务基于ZLMediaKit-https://github.com/xiongziliang/ZLMediaKit
 流媒体服务基于ZLMediaKit-https://github.com/xiongziliang/ZLMediaKit
@@ -42,7 +41,7 @@ https://gitee.com/18010473990/wvp-GB28181.git
 19. 支持播放h265, g.711格式的流(需要将closeWaitRTPInfo设为false)
 19. 支持播放h265, g.711格式的流(需要将closeWaitRTPInfo设为false)
 20. 报警信息处理,支持向前端推送报警信息
 20. 报警信息处理,支持向前端推送报警信息
 
 
-# 新支持特性  
+# 2.0新支持特性  
 1. 集成web界面, 不需要单独部署前端服务, 直接利用wvp内置文件服务部署, 随wvp一起部署;   
 1. 集成web界面, 不需要单独部署前端服务, 直接利用wvp内置文件服务部署, 随wvp一起部署;   
 2. 支持平台接入, 针对大平台大量设备的情况进行优化;  
 2. 支持平台接入, 针对大平台大量设备的情况进行优化;  
 3. 支持检索,通道筛选;  
 3. 支持检索,通道筛选;  

+ 5 - 8
pom.xml

@@ -102,18 +102,15 @@
 <!--			<version>3.11</version>-->
 <!--			<version>3.11</version>-->
 <!--		</dependency>-->
 <!--		</dependency>-->
 
 
-		<!--Swagger2 -->
+		<!--Swagger3 -->
 		<!--在线文档 -->
 		<!--在线文档 -->
 		<dependency>
 		<dependency>
 			<groupId>io.springfox</groupId>
 			<groupId>io.springfox</groupId>
-			<artifactId>springfox-swagger2</artifactId>
-			<version>2.9.2</version>
-		</dependency>
-		<dependency>
-			<groupId>io.springfox</groupId>
-			<artifactId>springfox-swagger-ui</artifactId>
-			<version>2.6.1</version>
+			<artifactId>springfox-boot-starter</artifactId>
+			<version>3.0.0</version>
 		</dependency>
 		</dependency>
+
+		<!--参数校验 -->
 		<dependency>
 		<dependency>
 			<groupId>javax.validation</groupId>
 			<groupId>javax.validation</groupId>
 			<artifactId>validation-api</artifactId>
 			<artifactId>validation-api</artifactId>

+ 2 - 0
src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java

@@ -5,8 +5,10 @@ import java.util.logging.LogManager;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.ConfigurableApplicationContext;
+import springfox.documentation.oas.annotations.EnableOpenApi;
 
 
 @SpringBootApplication
 @SpringBootApplication
+@EnableOpenApi
 public class VManageBootstrap extends LogManager {
 public class VManageBootstrap extends LogManager {
 	private static String[] args;
 	private static String[] args;
 	private static ConfigurableApplicationContext context;
 	private static ConfigurableApplicationContext context;

+ 41 - 0
src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java

@@ -0,0 +1,41 @@
+package com.genersoft.iot.vmp.conf;
+
+import io.swagger.annotations.ApiOperation;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.builders.RequestParameterBuilder;
+import springfox.documentation.schema.ScalarType;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Configuration
+public class Swagger3Config {
+
+    @Bean
+    public Docket createRestApi() {
+        return new Docket(DocumentationType.OAS_30)
+                .apiInfo(apiInfo())
+                .select()
+                .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager"))
+                .paths(PathSelectors.any())
+                .build()
+                .pathMapping("/");
+    }
+
+    private ApiInfo apiInfo() {
+        return new ApiInfoBuilder()
+                .title("WVP-PRO 接口文档")
+                .description("更多请咨询服务开发者(18010473990@@163.com)。")
+                .contact(new Contact("Ray。", "http://www.ruiyeclub.cn", "ruiyeclub@foxmail.com"))
+                .version("1.0")
+                .build();
+    }
+}

+ 6 - 5
src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java

@@ -81,7 +81,7 @@ public class ParentPlatform {
     /**
     /**
      * 允许云台控制
      * 允许云台控制
      */
      */
-    private boolean PTZEnable;
+    private boolean ptz;
 
 
     /**
     /**
      * RTCP流保活
      * RTCP流保活
@@ -220,12 +220,12 @@ public class ParentPlatform {
         this.characterSet = characterSet;
         this.characterSet = characterSet;
     }
     }
 
 
-    public boolean isPTZEnable() {
-        return PTZEnable;
+    public boolean isPtz() {
+        return ptz;
     }
     }
 
 
-    public void setPTZEnable(boolean PTZEnable) {
-        this.PTZEnable = PTZEnable;
+    public void setPtz(boolean ptz) {
+        this.ptz = ptz;
     }
     }
 
 
     public boolean isRtcp() {
     public boolean isRtcp() {
@@ -251,4 +251,5 @@ public class ParentPlatform {
     public void setChannelCount(int channelCount) {
     public void setChannelCount(int channelCount) {
         this.channelCount = channelCount;
         this.channelCount = channelCount;
     }
     }
+
 }
 }

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java

@@ -341,7 +341,7 @@ public class SIPCommander implements ISIPCommander {
 	@Override
 	@Override
 	public void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event, SipSubscribe.Event errorEvent) {
 	public void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event, SipSubscribe.Event errorEvent) {
 		try {
 		try {
-
+			if (device == null) return;
 			String ssrc = streamSession.createPlaySsrc();
 			String ssrc = streamSession.createPlaySsrc();
 			String streamId = null;
 			String streamId = null;
 			if (rtpEnable) {
 			if (rtpEnable) {

+ 4 - 0
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java

@@ -118,6 +118,10 @@ public class ZLMHttpHookListener {
 		if (logger.isDebugEnabled()) {
 		if (logger.isDebugEnabled()) {
 			logger.debug("ZLM HOOK on_play API调用,参数:" + json.toString());
 			logger.debug("ZLM HOOK on_play API调用,参数:" + json.toString());
 		}
 		}
+		ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_play, json);
+		if (subscribe != null ) {
+			subscribe.response(json);
+		}
 		JSONObject ret = new JSONObject();
 		JSONObject ret = new JSONObject();
 		ret.put("code", 0);
 		ret.put("code", 0);
 		ret.put("msg", "success");
 		ret.put("msg", "success");

+ 21 - 0
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java

@@ -70,6 +70,27 @@ public class ZLMHttpHookSubscribe {
         return event;
         return event;
     }
     }
 
 
+    public void removeSubscribe(HookType type, JSONObject hookResponse) {
+        Map<JSONObject, Event> eventMap = allSubscribes.get(type);
+        if (eventMap == null) {
+            return;
+        }
+        for (JSONObject key : eventMap.keySet()) {
+            Boolean result = null;
+            for (String s : key.keySet()) {
+                if (result == null) {
+                    result = key.getString(s).equals(hookResponse.getString(s));
+                }else {
+                    result = result && key.getString(s).equals(hookResponse.getString(s));
+                }
+
+            }
+            if (result) {
+                eventMap.remove(key);
+            }
+        }
+    }
+
     /**
     /**
      * 获取某个类型的所有的订阅
      * 获取某个类型的所有的订阅
      * @param type
      * @param type

+ 18 - 0
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java

@@ -42,6 +42,9 @@ public class ZLMMediaListManager {
     @Autowired
     @Autowired
     private IStreamPushService streamPushService;
     private IStreamPushService streamPushService;
 
 
+    @Autowired
+    private ZLMHttpHookSubscribe subscribe;
+
 
 
     public void updateMediaList() {
     public void updateMediaList() {
         storager.clearMediaList();
         storager.clearMediaList();
@@ -66,12 +69,27 @@ public class ZLMMediaListManager {
 
 
             if (streamPushItems != null) {
             if (streamPushItems != null) {
                 storager.updateMediaList(streamPushItems);
                 storager.updateMediaList(streamPushItems);
+                for (StreamPushItem streamPushItem : streamPushItems) {
+                    JSONObject jsonObject = new JSONObject();
+                    jsonObject.put("app", streamPushItem.getApp());
+                    jsonObject.put("stream", streamPushItem.getStream());
+                    subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_play,jsonObject,(response)->{
+                        System.out.println(1222211111);
+                        updateMedia(response.getString("app"), response.getString("stream"));
+                    });
+                }
             }
             }
         }));
         }));
 
 
     }
     }
 
 
     public void addMedia(String app, String streamId) {
     public void addMedia(String app, String streamId) {
+        //使用异步更新推流
+        updateMedia(app, streamId);
+    }
+
+
+    public void updateMedia(String app, String streamId) {
         //使用异步更新推流
         //使用异步更新推流
         zlmresTfulUtils.getMediaList(app, streamId, "rtmp", json->{
         zlmresTfulUtils.getMediaList(app, streamId, "rtmp", json->{
 
 

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java

@@ -123,7 +123,7 @@ public class ZLMRunner implements CommandLineRunner {
         param.put("ffmpeg.cmd","%s -fflags nobuffer -rtsp_transport tcp -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264  -f flv %s");
         param.put("ffmpeg.cmd","%s -fflags nobuffer -rtsp_transport tcp -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264  -f flv %s");
         param.put("hook.enable","1");
         param.put("hook.enable","1");
         param.put("hook.on_flow_report","");
         param.put("hook.on_flow_report","");
-        param.put("hook.on_play","");
+        param.put("hook.on_play",String.format("%s/on_play", hookPrex));
         param.put("hook.on_http_access","");
         param.put("hook.on_http_access","");
         param.put("hook.on_publish",String.format("%s/on_publish", hookPrex));
         param.put("hook.on_publish",String.format("%s/on_publish", hookPrex));
         param.put("hook.on_record_mp4","");
         param.put("hook.on_record_mp4","");

+ 3 - 3
src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java

@@ -14,10 +14,10 @@ import java.util.List;
 public interface ParentPlatformMapper {
 public interface ParentPlatformMapper {
 
 
     @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp,  " +
     @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp,  " +
-            "            devicePort, username, password, expires, keepTimeout, transport, characterSet, PTZEnable, rtcp, " +
+            "            devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " +
             "            status) " +
             "            status) " +
             "            VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " +
             "            VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " +
-            "            '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${PTZEnable}, ${rtcp}, " +
+            "            '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " +
             "            ${status})")
             "            ${status})")
     int addParentPlatform(ParentPlatform parentPlatform);
     int addParentPlatform(ParentPlatform parentPlatform);
 
 
@@ -36,7 +36,7 @@ public interface ParentPlatformMapper {
             "keepTimeout=#{keepTimeout}, " +
             "keepTimeout=#{keepTimeout}, " +
             "transport=#{transport}, " +
             "transport=#{transport}, " +
             "characterSet=#{characterSet}, " +
             "characterSet=#{characterSet}, " +
-            "PTZEnable=#{PTZEnable}, " +
+            "ptz=#{ptz}, " +
             "rtcp=#{rtcp}, " +
             "rtcp=#{rtcp}, " +
             "status=#{status} " +
             "status=#{status} " +
             "WHERE serverGBId=#{serverGBId}")
             "WHERE serverGBId=#{serverGBId}")

+ 58 - 6
src/main/java/com/genersoft/iot/vmp/vmanager/MobilePosition/MobilePositionController.java

@@ -12,6 +12,10 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
 import com.github.pagehelper.util.StringUtil;
 import com.github.pagehelper.util.StringUtil;
 
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,9 +29,13 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.context.request.async.DeferredResult;
 import org.springframework.web.context.request.async.DeferredResult;
 
 
+/**
+ *  位置信息管理
+ */
+@Api(tags = "位置信息管理")
 @CrossOrigin
 @CrossOrigin
 @RestController
 @RestController
-@RequestMapping("/api")
+@RequestMapping("/api/position")
 public class MobilePositionController {
 public class MobilePositionController {
 
 
     private final static Logger logger = LoggerFactory.getLogger(MobilePositionController.class);
     private final static Logger logger = LoggerFactory.getLogger(MobilePositionController.class);
@@ -40,8 +48,21 @@ public class MobilePositionController {
 	
 	
 	@Autowired
 	@Autowired
 	private DeferredResultHolder resultHolder;
 	private DeferredResultHolder resultHolder;
-	
-    @GetMapping("/positions/{deviceId}/history")
+
+    /**
+     *  查询历史轨迹
+     * @param deviceId 设备ID
+     * @param start 开始时间
+     * @param end 结束时间
+     * @return
+     */
+    @ApiOperation("查询历史轨迹")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
+            @ApiImplicitParam(name = "start", value = "开始时间", required = true),
+            @ApiImplicitParam(name = "end", value = "结束时间", required = true),
+    })
+    @GetMapping("/history/{deviceId}")
     public ResponseEntity<List<MobilePosition>> positions(@PathVariable String deviceId,
     public ResponseEntity<List<MobilePosition>> positions(@PathVariable String deviceId,
                                                     @RequestParam(required = false) String start,
                                                     @RequestParam(required = false) String start,
                                                     @RequestParam(required = false) String end) {
                                                     @RequestParam(required = false) String end) {
@@ -60,7 +81,16 @@ public class MobilePositionController {
         return new ResponseEntity<>(result, HttpStatus.OK);
         return new ResponseEntity<>(result, HttpStatus.OK);
     }
     }
 
 
-    @GetMapping("/positions/{deviceId}/latest")
+    /**
+     *  查询设备最新位置
+     * @param deviceId 设备ID
+     * @return
+     */
+    @ApiOperation("查询设备最新位置")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
+    })
+    @GetMapping("/latest/{deviceId}")
     public ResponseEntity<MobilePosition> latestPosition(@PathVariable String deviceId) {
     public ResponseEntity<MobilePosition> latestPosition(@PathVariable String deviceId) {
         if (logger.isDebugEnabled()) {
         if (logger.isDebugEnabled()) {
             logger.debug("查询设备" + deviceId + "的最新位置");
             logger.debug("查询设备" + deviceId + "的最新位置");
@@ -69,7 +99,16 @@ public class MobilePositionController {
         return new ResponseEntity<>(result, HttpStatus.OK);
         return new ResponseEntity<>(result, HttpStatus.OK);
     }
     }
 
 
-    @GetMapping("/positions/{deviceId}/realtime")
+    /**
+     *  获取移动位置信息
+     * @param deviceId 设备ID
+     * @return
+     */
+    @ApiOperation("获取移动位置信息")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
+    })
+    @GetMapping("/realtime/{deviceId}")
     public DeferredResult<ResponseEntity<MobilePosition>> realTimePosition(@PathVariable String deviceId) {
     public DeferredResult<ResponseEntity<MobilePosition>> realTimePosition(@PathVariable String deviceId) {
         Device device = storager.queryVideoDevice(deviceId);
         Device device = storager.queryVideoDevice(deviceId);
         cmder.mobilePostitionQuery(device, event -> {
         cmder.mobilePostitionQuery(device, event -> {
@@ -92,7 +131,20 @@ public class MobilePositionController {
         return result;
         return result;
     }
     }
 
 
-    @GetMapping("/positions/{deviceId}/subscribe")
+    /**
+     * 订阅位置信息
+     * @param deviceId 设备ID
+     * @param expires 订阅超时时间
+     * @param interval 上报时间间隔
+     * @return true = 命令发送成功
+     */
+    @ApiOperation("订阅位置信息")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
+            @ApiImplicitParam(name = "expires", value = "订阅超时时间"),
+            @ApiImplicitParam(name = "interval", value = "上报时间间隔"),
+    })
+    @GetMapping("/subscribe/{deviceId}")
     public ResponseEntity<String> positionSubscribe(@PathVariable String deviceId,
     public ResponseEntity<String> positionSubscribe(@PathVariable String deviceId,
                                                     @RequestParam String expires,
                                                     @RequestParam String expires,
                                                     @RequestParam String interval) {
                                                     @RequestParam String interval) {

+ 35 - 11
src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceConfig.java

@@ -17,16 +17,22 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
 import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
 import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
 
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpRequest;
 import org.springframework.http.ResponseEntity;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.context.request.async.DeferredResult;
 import org.springframework.web.context.request.async.DeferredResult;
 
 
+@Api(tags = "国标设备配置")
 @CrossOrigin
 @CrossOrigin
 @RestController
 @RestController
-@RequestMapping("/api")
+@RequestMapping("/api/device/config")
 public class DeviceConfig {
 public class DeviceConfig {
 
 
     private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class);
     private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class);
@@ -42,14 +48,24 @@ public class DeviceConfig {
 
 
 	/**
 	/**
 	 * 看守位控制命令API接口
 	 * 看守位控制命令API接口
-	 * 
-	 * @param deviceId
-	 * @param enabled       看守位使能1:开启,0:关闭
-	 * @param resetTime     自动归位时间间隔(可选)
-     * @param presetIndex   调用预置位编号(可选)
-     * @param channelId     通道编码(可选)
+	 * @param deviceId 设备ID
+	 * @param channelId 通道ID
+	 * @param name 名称
+	 * @param expiration 到期时间
+	 * @param heartBeatInterval 心跳间隔
+	 * @param heartBeatCount 心跳计数
+	 * @return
 	 */
 	 */
-	@GetMapping("/config/{deviceId}/basicParam")
+	@ApiOperation("看守位控制命令")
+	@GetMapping("/basicParam/{deviceId}")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "deviceId", value ="设备ID" ),
+			@ApiImplicitParam(name = "channelId", value ="通道ID" ),
+			@ApiImplicitParam(name = "name", value ="名称" ),
+			@ApiImplicitParam(name = "expiration", value ="到期时间" ),
+			@ApiImplicitParam(name = "heartBeatInterval", value ="心跳间隔" ),
+			@ApiImplicitParam(name = "heartBeatCount", value ="心跳计数" ),
+	})
 	public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId,
 	public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId,
                                                                 @RequestParam(required = false) String channelId,
                                                                 @RequestParam(required = false) String channelId,
                                                                 @RequestParam(required = false) String name,
                                                                 @RequestParam(required = false) String name,
@@ -86,10 +102,18 @@ public class DeviceConfig {
 
 
 	/**
 	/**
 	 * 设备配置查询请求API接口
 	 * 设备配置查询请求API接口
-	 * 
-	 * @param deviceId
+	 * @param deviceId 设备ID
+	 * @param configType 配置类型
+	 * @param channelId 通道ID
+	 * @return
 	 */
 	 */
-	@GetMapping("/config/{deviceId}/query/{configType}")
+	@ApiOperation("设备配置查询请求")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "deviceId", value ="设备ID" ),
+			@ApiImplicitParam(name = "channelId", value ="通道ID" ),
+			@ApiImplicitParam(name = "configType", value ="配置类型" ),
+	})
+	@GetMapping("/query/{deviceId}/{configType}")
     public DeferredResult<ResponseEntity<String>> configDownloadApi(@PathVariable String deviceId, 
     public DeferredResult<ResponseEntity<String>> configDownloadApi(@PathVariable String deviceId, 
                                                                 @PathVariable String configType,
                                                                 @PathVariable String configType,
                                                                 @RequestParam(required = false) String channelId) {
                                                                 @RequestParam(required = false) String channelId) {

+ 54 - 16
src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceControl.java

@@ -17,6 +17,10 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
 import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
 import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
 
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,9 +29,10 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.context.request.async.DeferredResult;
 import org.springframework.web.context.request.async.DeferredResult;
 
 
+@Api(tags = "国标设备控制")
 @CrossOrigin
 @CrossOrigin
 @RestController
 @RestController
-@RequestMapping("/api")
+@RequestMapping("/api/device/control")
 public class DeviceControl {
 public class DeviceControl {
 
 
     private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class);
     private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class);
@@ -44,10 +49,13 @@ public class DeviceControl {
     /**
     /**
      * 远程启动控制命令API接口
      * 远程启动控制命令API接口
      * 
      * 
-     * @param deviceId
+     * @param deviceId 设备ID
      */
      */
-    @GetMapping("/control/{deviceId}/teleboot")
-    @PostMapping("/control/{deviceId}/teleboot")
+	@ApiOperation("远程启动控制命令")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "deviceId", value ="设备ID", required = true),
+	})
+    @GetMapping("/teleboot/{deviceId}")
     public ResponseEntity<String> teleBootApi(@PathVariable String deviceId) {
     public ResponseEntity<String> teleBootApi(@PathVariable String deviceId) {
         if (logger.isDebugEnabled()) {
         if (logger.isDebugEnabled()) {
             logger.debug("设备远程启动API调用");
             logger.debug("设备远程启动API调用");
@@ -68,11 +76,18 @@ public class DeviceControl {
     /**
     /**
      * 录像控制命令API接口
      * 录像控制命令API接口
      * 
      * 
-     * @param deviceId
+     * @param deviceId 设备ID
      * @param recordCmdStr  Record:手动录像,StopRecord:停止手动录像
      * @param recordCmdStr  Record:手动录像,StopRecord:停止手动录像
      * @param channelId     通道编码(可选)
      * @param channelId     通道编码(可选)
      */
      */
-    @GetMapping("/control/{deviceId}/record/{recordCmdStr}")
+    @ApiOperation("录像控制命令")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "deviceId", value ="设备ID", required = true),
+			@ApiImplicitParam(name = "channelId", value ="通道编码"),
+			@ApiImplicitParam(name = "recordCmdStr", value ="命令, 可选值:Record(手动录像),StopRecord(停止手动录像)",
+					required = true),
+	})
+    @GetMapping("/record/{deviceId}/{recordCmdStr}")
     public DeferredResult<ResponseEntity<String>> recordApi(@PathVariable String deviceId,
     public DeferredResult<ResponseEntity<String>> recordApi(@PathVariable String deviceId,
             @PathVariable String recordCmdStr, @RequestParam(required = false) String channelId) {
             @PathVariable String recordCmdStr, @RequestParam(required = false) String channelId) {
         if (logger.isDebugEnabled()) {
         if (logger.isDebugEnabled()) {
@@ -102,10 +117,15 @@ public class DeviceControl {
 	/**
 	/**
 	 * 报警布防/撤防命令API接口
 	 * 报警布防/撤防命令API接口
 	 * 
 	 * 
-	 * @param	deviceId
+	 * @param	deviceId 设备ID
 	 * @param	guardCmdStr SetGuard:布防,ResetGuard:撤防
 	 * @param	guardCmdStr SetGuard:布防,ResetGuard:撤防
 	 */
 	 */
-	@GetMapping("/control/{deviceId}/guard/{guardCmdStr}")
+	@ApiOperation("录像控制命令")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
+			@ApiImplicitParam(name = "guardCmdStr", value ="命令, 可选值:SetGuard(布防),ResetGuard(撤防)", required = true)
+	})
+	@GetMapping("/guard/{deviceId}/{guardCmdStr}")
 	public DeferredResult<ResponseEntity<String>> guardApi(@PathVariable String deviceId, @PathVariable String guardCmdStr) {
 	public DeferredResult<ResponseEntity<String>> guardApi(@PathVariable String deviceId, @PathVariable String guardCmdStr) {
 		if (logger.isDebugEnabled()) {
 		if (logger.isDebugEnabled()) {
 			logger.debug("布防/撤防API调用");
 			logger.debug("布防/撤防API调用");
@@ -134,11 +154,17 @@ public class DeviceControl {
 	/**
 	/**
 	 * 报警复位API接口
 	 * 报警复位API接口
 	 * 
 	 * 
-	 * @param	deviceId
+	 * @param	deviceId 设备ID
 	 * @param	alarmMethod 报警方式(可选)
 	 * @param	alarmMethod 报警方式(可选)
 	 * @param	alarmType   报警类型(可选)
 	 * @param	alarmType   报警类型(可选)
 	 */
 	 */
-	@GetMapping("/control/{deviceId}/resetAlarm")
+	@ApiOperation("报警复位")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
+			@ApiImplicitParam(name = "alarmMethod", value ="报警方式"),
+			@ApiImplicitParam(name = "alarmType", value ="报警类型"),
+	})
+	@GetMapping("/reset_alarm/{deviceId}")
 	public DeferredResult<ResponseEntity<String>> resetAlarmApi(@PathVariable String deviceId, 
 	public DeferredResult<ResponseEntity<String>> resetAlarmApi(@PathVariable String deviceId, 
 																@RequestParam(required = false) String alarmMethod,
 																@RequestParam(required = false) String alarmMethod,
 																@RequestParam(required = false) String alarmType) {
 																@RequestParam(required = false) String alarmType) {
@@ -169,11 +195,15 @@ public class DeviceControl {
 	/**
 	/**
 	 * 强制关键帧API接口
 	 * 强制关键帧API接口
 	 * 
 	 * 
-	 * @param	deviceId
-	 * @param	channelId 
+	 * @param	deviceId 设备ID
+	 * @param	channelId  通道ID
 	 */
 	 */
-	@GetMapping("/control/{deviceId}/iFrame")
-	@PostMapping("/control/{deviceId}/iFrame")
+	@ApiOperation("强制关键帧")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
+			@ApiImplicitParam(name = "channelId", value ="通道ID", required = true),
+	})
+	@GetMapping("/i_frame/{deviceId}")
 	public ResponseEntity<String> iFrame(@PathVariable String deviceId,
 	public ResponseEntity<String> iFrame(@PathVariable String deviceId,
 										@RequestParam(required = false) String channelId) {
 										@RequestParam(required = false) String channelId) {
 		if (logger.isDebugEnabled()) {
 		if (logger.isDebugEnabled()) {
@@ -196,13 +226,21 @@ public class DeviceControl {
 	/**
 	/**
 	 * 看守位控制命令API接口
 	 * 看守位控制命令API接口
 	 * 
 	 * 
-	 * @param deviceId
+	 * @param deviceId 设备ID
 	 * @param enabled       看守位使能1:开启,0:关闭
 	 * @param enabled       看守位使能1:开启,0:关闭
 	 * @param resetTime     自动归位时间间隔(可选)
 	 * @param resetTime     自动归位时间间隔(可选)
      * @param presetIndex   调用预置位编号(可选)
      * @param presetIndex   调用预置位编号(可选)
      * @param channelId     通道编码(可选)
      * @param channelId     通道编码(可选)
 	 */
 	 */
-	@GetMapping("/control/{deviceId}/homePosition/{enabled}")
+	@ApiOperation("看守位控制")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
+			@ApiImplicitParam(name = "enabled", value = "是否开启看守位 1:开启,0:关闭", required = true),
+			@ApiImplicitParam(name = "resetTime", value = "自动归位时间间隔"),
+			@ApiImplicitParam(name = "presetIndex", value = "调用预置位编号"),
+			@ApiImplicitParam(name = "channelId", value ="通道ID"),
+	})
+	@GetMapping("/home_position/{deviceId}/{enabled}")
 	public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId,
 	public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId,
 																@PathVariable String enabled,
 																@PathVariable String enabled,
 																@RequestParam(required = false) String resetTime,
 																@RequestParam(required = false) String resetTime,

+ 118 - 13
src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceQuery.java

@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.vmanager.device;
 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.*;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,10 +22,11 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
 
 
 import javax.sip.message.Response;
 import javax.sip.message.Response;
 
 
+@Api(tags = "国标设备查询1", value = "国标设备查询")
 @SuppressWarnings("rawtypes")
 @SuppressWarnings("rawtypes")
 @CrossOrigin
 @CrossOrigin
 @RestController
 @RestController
-@RequestMapping("/api")
+@RequestMapping("/api/device/query")
 public class DeviceQuery {
 public class DeviceQuery {
 	
 	
 	private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class);
 	private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class);
@@ -40,7 +42,16 @@ public class DeviceQuery {
 	
 	
 	@Autowired
 	@Autowired
 	private DeviceOffLineDetector offLineDetector;
 	private DeviceOffLineDetector offLineDetector;
-	
+
+	/**
+	 * 使用ID查询国标设备
+	 * @param deviceId 国标ID
+	 * @return 国标设备
+	 */
+	@ApiOperation("使用ID查询国标设备")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
+	})
 	@GetMapping("/devices/{deviceId}")
 	@GetMapping("/devices/{deviceId}")
 	public ResponseEntity<Device> devices(@PathVariable String deviceId){
 	public ResponseEntity<Device> devices(@PathVariable String deviceId){
 		
 		
@@ -51,7 +62,18 @@ public class DeviceQuery {
 		Device device = storager.queryVideoDevice(deviceId);
 		Device device = storager.queryVideoDevice(deviceId);
 		return new ResponseEntity<>(device,HttpStatus.OK);
 		return new ResponseEntity<>(device,HttpStatus.OK);
 	}
 	}
-	
+
+	/**
+	 * 分页查询国标设备
+	 * @param page 当前页
+	 * @param count 每页查询数量
+	 * @return 分页国标列表
+	 */
+	@ApiOperation("分页查询国标设备")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "page", value = "当前页", required = true),
+			@ApiImplicitParam(name = "count", value = "每页查询数量", required = true),
+	})
 	@GetMapping("/devices")
 	@GetMapping("/devices")
 	public PageInfo<Device> devices(int page, int count){
 	public PageInfo<Device> devices(int page, int count){
 		
 		
@@ -73,7 +95,16 @@ public class DeviceQuery {
 	 * @param channelType 设备 false/子目录 true
 	 * @param channelType 设备 false/子目录 true
 	 * @return 通道列表
 	 * @return 通道列表
 	 */
 	 */
+	@ApiOperation("分页查询通道")
 	@GetMapping("/devices/{deviceId}/channels")
 	@GetMapping("/devices/{deviceId}/channels")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name="deviceId", value = "设备id", required = true),
+			@ApiImplicitParam(name="page", value = "当前页", required = true),
+			@ApiImplicitParam(name="count", value = "每页查询数量", required = true),
+			@ApiImplicitParam(name="query", value = "查询内容"),
+			@ApiImplicitParam(name="online", value = "是否在线"),
+			@ApiImplicitParam(name="channelType", value = "设备/子目录-> false/true"),
+	})
 	public ResponseEntity<PageInfo> channels(@PathVariable String deviceId,
 	public ResponseEntity<PageInfo> channels(@PathVariable String deviceId,
 											   int page, int count,
 											   int page, int count,
 											   @RequestParam(required = false) String query,
 											   @RequestParam(required = false) String query,
@@ -89,7 +120,16 @@ public class DeviceQuery {
 		PageInfo pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count);
 		PageInfo pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count);
 		return new ResponseEntity<>(pageResult,HttpStatus.OK);
 		return new ResponseEntity<>(pageResult,HttpStatus.OK);
 	}
 	}
-	
+
+	/**
+	 * 同步设备通道
+	 * @param deviceId 设备id
+	 * @return
+	 */
+	@ApiOperation("同步设备通道")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name="deviceId", value = "设备id", required = true),
+	})
 	@PostMapping("/devices/{deviceId}/sync")
 	@PostMapping("/devices/{deviceId}/sync")
 	public DeferredResult<ResponseEntity<Device>> devicesSync(@PathVariable String deviceId){
 	public DeferredResult<ResponseEntity<Device>> devicesSync(@PathVariable String deviceId){
 		
 		
@@ -117,8 +157,17 @@ public class DeviceQuery {
         resultHolder.put(DeferredResultHolder.CALLBACK_CMD_CATALOG+deviceId, result);
         resultHolder.put(DeferredResultHolder.CALLBACK_CMD_CATALOG+deviceId, result);
         return result;
         return result;
 	}
 	}
-	
-	@PostMapping("/devices/{deviceId}/delete")
+
+	/**
+	 * 移除设备
+	 * @param deviceId 设备id
+	 * @return
+	 */
+	@ApiOperation("移除设备")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name="deviceId", value = "设备id", required = true),
+	})
+	@DeleteMapping("/devices/{deviceId}/delete")
 	public ResponseEntity<String> delete(@PathVariable String deviceId){
 	public ResponseEntity<String> delete(@PathVariable String deviceId){
 		
 		
 		if (logger.isDebugEnabled()) {
 		if (logger.isDebugEnabled()) {
@@ -140,13 +189,27 @@ public class DeviceQuery {
 	}
 	}
 
 
 	/**
 	/**
-	 * 分页查询通道数
+	 * 分页查询子目录通道
+	 * @param deviceId 通道id
 	 * @param channelId 通道id
 	 * @param channelId 通道id
 	 * @param page 当前页
 	 * @param page 当前页
 	 * @param count 每页条数
 	 * @param count 每页条数
+	 * @param query 查询内容
+	 * @param online 是否在线
+	 * @param channelType 通道类型
 	 * @return 子通道列表
 	 * @return 子通道列表
 	 */
 	 */
-	@GetMapping("/subChannels/{deviceId}/{channelId}/channels")
+	@ApiOperation("分页查询子目录通道")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name="deviceId", value = "设备id", required = true),
+			@ApiImplicitParam(name="channelId", value = "通道id", required = true),
+			@ApiImplicitParam(name="page", value = "当前页", required = true),
+			@ApiImplicitParam(name="count", value = "每页条数", required = true),
+			@ApiImplicitParam(name="query", value = "查询内容"),
+			@ApiImplicitParam(name="online", value = "是否在线"),
+			@ApiImplicitParam(name="channelType", value = "通道类型, 子目录"),
+	})
+	@GetMapping("/sub_channels/{deviceId}/{channelId}/channels")
 	public ResponseEntity<PageInfo> subChannels(@PathVariable String deviceId,
 	public ResponseEntity<PageInfo> subChannels(@PathVariable String deviceId,
 												  @PathVariable String channelId,
 												  @PathVariable String channelId,
 												  int page,
 												  int page,
@@ -168,14 +231,36 @@ public class DeviceQuery {
 		return new ResponseEntity<>(pageResult,HttpStatus.OK);
 		return new ResponseEntity<>(pageResult,HttpStatus.OK);
 	}
 	}
 
 
+	/**
+	 * 更新通道信息
+	 * @param deviceId 设备id
+	 * @param channel 通道
+	 * @return
+	 */
+	@ApiOperation("更新通道信息")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name="deviceId", value = "设备id", required = true),
+			@ApiImplicitParam(name="channel", value = "通道", required = true),
+	})
 	@PostMapping("/channel/update/{deviceId}")
 	@PostMapping("/channel/update/{deviceId}")
 	public ResponseEntity<PageInfo> updateChannel(@PathVariable String deviceId,DeviceChannel channel){
 	public ResponseEntity<PageInfo> updateChannel(@PathVariable String deviceId,DeviceChannel channel){
 		storager.updateChannel(deviceId, channel);
 		storager.updateChannel(deviceId, channel);
 		return new ResponseEntity<>(null,HttpStatus.OK);
 		return new ResponseEntity<>(null,HttpStatus.OK);
 	}
 	}
 
 
-	@GetMapping("/devices/{deviceId}/transport/{streamMode}")
-	@PostMapping("/devices/{deviceId}/transport/{streamMode}")
+	/**
+	 * 修改数据流传输模式
+	 * @param deviceId 设备id
+	 * @param streamMode 数据流传输模式
+	 * @return
+	 */
+	@ApiOperation("修改数据流传输模式")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "deviceId", value = "设备id", required = true),
+			@ApiImplicitParam(name = "streamMode", value = "数据流传输模式, 取值:" +
+					"UDP(udp传输),TCP-ACTIVE(tcp主动模式,暂不支持),TCP-PASSIVE(tcp被动模式)"),
+	})
+	@PostMapping("/transport/{deviceId}/{streamMode}")
 	public ResponseEntity<PageInfo> updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){
 	public ResponseEntity<PageInfo> updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){
 		Device device = storager.queryVideoDevice(deviceId);
 		Device device = storager.queryVideoDevice(deviceId);
 		device.setStreamMode(streamMode);
 		device.setStreamMode(streamMode);
@@ -186,8 +271,12 @@ public class DeviceQuery {
 	/**
 	/**
 	 * 设备状态查询请求API接口
 	 * 设备状态查询请求API接口
 	 * 
 	 * 
-	 * @param deviceId
+	 * @param deviceId 设备id
 	 */
 	 */
+	@ApiOperation("设备状态查询")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "deviceId", value = "设备id", required = true),
+	})
 	@GetMapping("/devices/{deviceId}/status")
 	@GetMapping("/devices/{deviceId}/status")
 	public DeferredResult<ResponseEntity<String>> deviceStatusApi(@PathVariable String deviceId) {
 	public DeferredResult<ResponseEntity<String>> deviceStatusApi(@PathVariable String deviceId) {
 		if (logger.isDebugEnabled()) {
 		if (logger.isDebugEnabled()) {
@@ -216,9 +305,25 @@ public class DeviceQuery {
 
 
 	/**
 	/**
 	 * 设备报警查询请求API接口
 	 * 设备报警查询请求API接口
-	 * 
-	 * @param deviceId
+	 * @param deviceId 设备id
+	 * @param startPriority	报警起始级别(可选)
+	 * @param endPriority	报警终止级别(可选)
+	 * @param alarmMethod	报警方式条件(可选)
+	 * @param alarmType		报警类型
+	 * @param startTime		报警发生起始时间(可选)
+	 * @param endTime		报警发生终止时间(可选)
+	 * @return				true = 命令发送成功
 	 */
 	 */
+	@ApiOperation("设备报警查询")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "deviceId", value = "设备id", required = true),
+			@ApiImplicitParam(name = "startPriority", value = "报警起始级别"),
+			@ApiImplicitParam(name = "endPriority", value = "报警终止级别"),
+			@ApiImplicitParam(name = "alarmMethod", value = "报警方式条件"),
+			@ApiImplicitParam(name = "alarmType", value = "报警类型"),
+			@ApiImplicitParam(name = "startTime", value = "报警发生起始时间"),
+			@ApiImplicitParam(name = "endTime", value = "报警发生终止时间"),
+	})
 	@GetMapping("/alarm/{deviceId}")
 	@GetMapping("/alarm/{deviceId}")
 	public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId,
 	public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId,
 														@RequestParam(required = false) String startPriority, 
 														@RequestParam(required = false) String startPriority, 

+ 37 - 7
src/main/java/com/genersoft/iot/vmp/vmanager/gbStream/GbStreamController.java

@@ -5,11 +5,16 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
 import com.genersoft.iot.vmp.vmanager.gbStream.bean.GbStreamParam;
 import com.genersoft.iot.vmp.vmanager.gbStream.bean.GbStreamParam;
 import com.genersoft.iot.vmp.service.IGbStreamService;
 import com.genersoft.iot.vmp.service.IGbStreamService;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+@Api(tags = "视频流关联到级联平台")
 @CrossOrigin
 @CrossOrigin
 @RestController
 @RestController
 @RequestMapping("/api/gbStream")
 @RequestMapping("/api/gbStream")
@@ -24,7 +29,18 @@ public class GbStreamController {
     private IVideoManagerStorager storager;
     private IVideoManagerStorager storager;
 
 
 
 
-    @RequestMapping(value = "/list")
+    /**
+     * 查询国标通道
+     * @param page 当前页
+     * @param count 每页条数
+     * @return
+     */
+    @ApiOperation("查询国标通道")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "page", value = "当前页", required = true ),
+            @ApiImplicitParam(name = "count", value = "每页条数", required = true ),
+    })
+    @GetMapping(value = "/list")
     @ResponseBody
     @ResponseBody
     public PageInfo<GbStream> list(@RequestParam(required = false)Integer page,
     public PageInfo<GbStream> list(@RequestParam(required = false)Integer page,
                                    @RequestParam(required = false)Integer count){
                                    @RequestParam(required = false)Integer count){
@@ -33,11 +49,18 @@ public class GbStreamController {
     }
     }
 
 
 
 
-    @RequestMapping(value = "/del")
+    /**
+     * 移除国标关联
+     * @param gbStreamParam
+     * @return
+     */
+    @ApiOperation("移除国标关联")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true ),
+    })
+    @DeleteMapping(value = "/del")
     @ResponseBody
     @ResponseBody
     public Object del(@RequestBody GbStreamParam gbStreamParam){
     public Object del(@RequestBody GbStreamParam gbStreamParam){
-        System.out.println(2222);
-        System.out.println(gbStreamParam.getGbStreams().size());
         if (gbStreamService.delPlatformInfo(gbStreamParam.getGbStreams())) {
         if (gbStreamService.delPlatformInfo(gbStreamParam.getGbStreams())) {
             return "success";
             return "success";
         }else {
         }else {
@@ -46,11 +69,18 @@ public class GbStreamController {
 
 
     }
     }
 
 
-    @RequestMapping(value = "/add")
+    /**
+     * 保存国标关联
+     * @param gbStreamParam
+     * @return
+     */
+    @ApiOperation("保存国标关联")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true ),
+    })
+    @PostMapping(value = "/add")
     @ResponseBody
     @ResponseBody
     public Object add(@RequestBody GbStreamParam gbStreamParam){
     public Object add(@RequestBody GbStreamParam gbStreamParam){
-        System.out.println(3333);
-        System.out.println(gbStreamParam.getGbStreams().size());
         if (gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId())) {
         if (gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId())) {
             return "success";
             return "success";
         }else {
         }else {

+ 16 - 2
src/main/java/com/genersoft/iot/vmp/vmanager/media/MediaController.java

@@ -9,6 +9,10 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.service.IMediaService;
 import com.genersoft.iot.vmp.service.IMediaService;
 import com.genersoft.iot.vmp.service.IStreamProxyService;
 import com.genersoft.iot.vmp.service.IStreamProxyService;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,6 +20,7 @@ import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 
 
+@Api(tags = "媒体流相关")
 @Controller
 @Controller
 @CrossOrigin
 @CrossOrigin
 @RequestMapping(value = "/api/media")
 @RequestMapping(value = "/api/media")
@@ -33,8 +38,17 @@ public class MediaController {
     private IMediaService mediaService;
     private IMediaService mediaService;
 
 
 
 
-
-
+    /**
+     * 根据应用名和流id获取播放地址
+     * @param app 应用名
+     * @param stream 流id
+     * @return
+     */
+    @ApiOperation("根据应用名和流id获取播放地址")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "app", value = "应用名"),
+            @ApiImplicitParam(name = "stream", value = "流id"),
+    })
     @RequestMapping(value = "/getStreamInfoByAppAndStream")
     @RequestMapping(value = "/getStreamInfoByAppAndStream")
     @ResponseBody
     @ResponseBody
     public StreamInfo getStreamInfoByAppAndStream(String app, String stream){
     public StreamInfo getStreamInfoByAppAndStream(String app, String stream){

+ 18 - 12
src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java

@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
 import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
 import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
 import com.genersoft.iot.vmp.vmanager.platform.bean.UpdateChannelParam;
 import com.genersoft.iot.vmp.vmanager.platform.bean.UpdateChannelParam;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,9 +18,13 @@ import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 import com.genersoft.iot.vmp.conf.SipConfig;
 import com.genersoft.iot.vmp.conf.SipConfig;
 
 
+/**
+ * 级联平台管理
+ */
+@Api("级联平台管理")
 @CrossOrigin
 @CrossOrigin
 @RestController
 @RestController
-@RequestMapping("/api")
+@RequestMapping("/api/platform")
 public class PlatformController {
 public class PlatformController {
 
 
     private final static Logger logger = LoggerFactory.getLogger(PlatformController.class);
     private final static Logger logger = LoggerFactory.getLogger(PlatformController.class);
@@ -36,7 +41,7 @@ public class PlatformController {
 	@Autowired
 	@Autowired
 	private SipConfig sipConfig;
 	private SipConfig sipConfig;
 
 
-    @GetMapping("/platforms/serverconfig")
+    @GetMapping("/server_config")
     public ResponseEntity<JSONObject> serverConfig() {
     public ResponseEntity<JSONObject> serverConfig() {
         JSONObject result = new JSONObject();
         JSONObject result = new JSONObject();
         result.put("deviceIp", sipConfig.getSipIp());
         result.put("deviceIp", sipConfig.getSipIp());
@@ -46,7 +51,7 @@ public class PlatformController {
         return new ResponseEntity<>(result, HttpStatus.OK);
         return new ResponseEntity<>(result, HttpStatus.OK);
     }
     }
 
 
-    @GetMapping("/platforms/{count}/{page}")
+    @GetMapping("/query/{count}/{page}")
     public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count){
     public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count){
 
 
         if (logger.isDebugEnabled()) {
         if (logger.isDebugEnabled()) {
@@ -55,7 +60,7 @@ public class PlatformController {
         return storager.queryParentPlatformList(page, count);
         return storager.queryParentPlatformList(page, count);
     }
     }
 
 
-    @RequestMapping("/platforms/save")
+    @PostMapping("/save")
     @ResponseBody
     @ResponseBody
     public ResponseEntity<String> savePlatform(@RequestBody ParentPlatform parentPlatform){
     public ResponseEntity<String> savePlatform(@RequestBody ParentPlatform parentPlatform){
 
 
@@ -98,18 +103,19 @@ public class PlatformController {
         }
         }
     }
     }
 
 
-    @RequestMapping("/platforms/delete")
+    @DeleteMapping("/delete/{serverGBId}")
     @ResponseBody
     @ResponseBody
-    public ResponseEntity<String> deletePlatform(@RequestBody ParentPlatform parentPlatform){
+    public ResponseEntity<String> deletePlatform(@PathVariable String serverGBId){
 
 
         if (logger.isDebugEnabled()) {
         if (logger.isDebugEnabled()) {
             logger.debug("删除上级平台API调用");
             logger.debug("删除上级平台API调用");
         }
         }
-        if (StringUtils.isEmpty(parentPlatform.getServerGBId())
+        if (StringUtils.isEmpty(serverGBId)
         ){
         ){
             return new ResponseEntity<>("missing parameters", HttpStatus.BAD_REQUEST);
             return new ResponseEntity<>("missing parameters", HttpStatus.BAD_REQUEST);
         }
         }
-
+        ParentPlatform parentPlatform = storager.queryParentPlatById(serverGBId);
+        if (parentPlatform == null) return new ResponseEntity<>("fail", HttpStatus.OK);
         // 发送离线消息,无论是否成功都删除缓存
         // 发送离线消息,无论是否成功都删除缓存
         commanderForPlatform.unregister(parentPlatform, (event -> {
         commanderForPlatform.unregister(parentPlatform, (event -> {
             // 清空redis缓存
             // 清空redis缓存
@@ -133,7 +139,7 @@ public class PlatformController {
         }
         }
     }
     }
 
 
-    @RequestMapping("/platforms/exit/{deviceGbId}")
+    @GetMapping("/exit/{deviceGbId}")
     @ResponseBody
     @ResponseBody
     public ResponseEntity<String> exitPlatform(@PathVariable String deviceGbId){
     public ResponseEntity<String> exitPlatform(@PathVariable String deviceGbId){
 
 
@@ -144,7 +150,7 @@ public class PlatformController {
         return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK);
         return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK);
     }
     }
 
 
-    @RequestMapping("/platforms/channelList")
+    @GetMapping("/channel_list")
     @ResponseBody
     @ResponseBody
     public PageInfo<ChannelReduce> channelList(int page, int count,
     public PageInfo<ChannelReduce> channelList(int page, int count,
                                               @RequestParam(required = false) String platformId,
                                               @RequestParam(required = false) String platformId,
@@ -167,7 +173,7 @@ public class PlatformController {
     }
     }
 
 
 
 
-    @RequestMapping("/platforms/updateChannelForGB")
+    @PostMapping("/update_channel_for_gb")
     @ResponseBody
     @ResponseBody
     public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param){
     public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param){
 
 
@@ -179,7 +185,7 @@ public class PlatformController {
         return new ResponseEntity<>(String.valueOf(result > 0), HttpStatus.OK);
         return new ResponseEntity<>(String.valueOf(result > 0), HttpStatus.OK);
     }
     }
 
 
-    @RequestMapping("/platforms/delChannelForGB")
+    @DeleteMapping("/del_channel_for_gb")
     @ResponseBody
     @ResponseBody
     public ResponseEntity<String> delChannelForGB(@RequestBody UpdateChannelParam param){
     public ResponseEntity<String> delChannelForGB(@RequestBody UpdateChannelParam param){
 
 

+ 5 - 5
src/main/java/com/genersoft/iot/vmp/vmanager/play/PlayController.java

@@ -33,7 +33,7 @@ import javax.sip.message.Response;
 
 
 @CrossOrigin
 @CrossOrigin
 @RestController
 @RestController
-@RequestMapping("/api")
+@RequestMapping("/api/play")
 public class PlayController {
 public class PlayController {
 
 
 	private final static Logger logger = LoggerFactory.getLogger(PlayController.class);
 	private final static Logger logger = LoggerFactory.getLogger(PlayController.class);
@@ -59,7 +59,7 @@ public class PlayController {
 	@Autowired
 	@Autowired
 	private IMediaService mediaService;
 	private IMediaService mediaService;
 
 
-	@GetMapping("/play/{deviceId}/{channelId}")
+	@GetMapping("/start/{deviceId}/{channelId}")
 	public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId,
 	public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId,
 													   @PathVariable String channelId) {
 													   @PathVariable String channelId) {
 
 
@@ -79,7 +79,7 @@ public class PlayController {
 		return playResult.getResult();
 		return playResult.getResult();
 	}
 	}
 
 
-	@PostMapping("/play/{streamId}/stop")
+	@PostMapping("/stop/{streamId}")
 	public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String streamId) {
 	public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String streamId) {
 
 
 		logger.debug(String.format("设备预览/回放停止API调用,streamId:%s", streamId));
 		logger.debug(String.format("设备预览/回放停止API调用,streamId:%s", streamId));
@@ -139,7 +139,7 @@ public class PlayController {
 	 * @param streamId 流ID
 	 * @param streamId 流ID
 	 * @return
 	 * @return
 	 */
 	 */
-	@PostMapping("/play/{streamId}/convert")
+	@PostMapping("/convert/{streamId}")
 	public ResponseEntity<String> playConvert(@PathVariable String streamId) {
 	public ResponseEntity<String> playConvert(@PathVariable String streamId) {
 		StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
 		StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
 		if (streamInfo == null) {
 		if (streamInfo == null) {
@@ -179,7 +179,7 @@ public class PlayController {
 	 * @param key
 	 * @param key
 	 * @return
 	 * @return
 	 */
 	 */
-	@PostMapping("/play/convert/stop/{key}")
+	@PostMapping("/convertStop/{key}")
 	public ResponseEntity<String> playConvertStop(@PathVariable String key) {
 	public ResponseEntity<String> playConvertStop(@PathVariable String key) {
 
 
 		JSONObject jsonObject = zlmresTfulUtils.delFFmpegSource(key);
 		JSONObject jsonObject = zlmresTfulUtils.delFFmpegSource(key);

+ 3 - 3
src/main/java/com/genersoft/iot/vmp/vmanager/playback/PlaybackController.java

@@ -28,7 +28,7 @@ import java.util.UUID;
 
 
 @CrossOrigin
 @CrossOrigin
 @RestController
 @RestController
-@RequestMapping("/api")
+@RequestMapping("/api/playback")
 public class PlaybackController {
 public class PlaybackController {
 
 
 	private final static Logger logger = LoggerFactory.getLogger(PlaybackController.class);
 	private final static Logger logger = LoggerFactory.getLogger(PlaybackController.class);
@@ -51,7 +51,7 @@ public class PlaybackController {
 	@Autowired
 	@Autowired
 	private DeferredResultHolder resultHolder;
 	private DeferredResultHolder resultHolder;
 
 
-	@GetMapping("/playback/{deviceId}/{channelId}")
+	@GetMapping("/start/{deviceId}/{channelId}")
 	public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, @PathVariable String channelId, String startTime,
 	public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, @PathVariable String channelId, String startTime,
 													   String endTime) {
 													   String endTime) {
 
 
@@ -89,7 +89,7 @@ public class PlaybackController {
 		return result;
 		return result;
 	}
 	}
 
 
-	@RequestMapping("/playback/{ssrc}/stop")
+	@RequestMapping("/stop/{ssrc}")
 	public ResponseEntity<String> playStop(@PathVariable String ssrc) {
 	public ResponseEntity<String> playStop(@PathVariable String ssrc) {
 
 
 		cmder.streamByeCmd(ssrc);
 		cmder.streamByeCmd(ssrc);

+ 56 - 0
src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java

@@ -0,0 +1,56 @@
+package com.genersoft.iot.vmp.vmanager.server;
+
+import com.genersoft.iot.vmp.VManageBootstrap;
+import com.genersoft.iot.vmp.utils.SpringBeanFactory;
+import com.genersoft.iot.vmp.vmanager.gbStream.bean.GbStreamParam;
+import gov.nist.javax.sip.SipStackImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.web.bind.annotation.*;
+
+import javax.sip.ListeningPoint;
+import javax.sip.ObjectInUseException;
+import javax.sip.SipProvider;
+import java.util.Iterator;
+
+@CrossOrigin
+@RestController
+@RequestMapping("/api/server")
+public class ServerController {
+
+    @Autowired
+    private ConfigurableApplicationContext context;
+
+
+    @RequestMapping(value = "/restart")
+    @ResponseBody
+    public Object restart(){
+        Thread restartThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    Thread.sleep(3000);
+                    SipProvider up = (SipProvider) SpringBeanFactory.getBean("udpSipProvider");
+                    SipStackImpl stack = (SipStackImpl)up.getSipStack();
+                    stack.stop();
+                    Iterator listener = stack.getListeningPoints();
+                    while (listener.hasNext()) {
+                        stack.deleteListeningPoint((ListeningPoint) listener.next());
+                    }
+                    Iterator providers = stack.getSipProviders();
+                    while (providers.hasNext()) {
+                        stack.deleteSipProvider((SipProvider) providers.next());
+                    }
+                    VManageBootstrap.restart();
+                } catch (InterruptedException ignored) {
+                } catch (ObjectInUseException e) {
+                    e.printStackTrace();
+                }
+            }
+        });
+
+        restartThread.setDaemon(false);
+        restartThread.start();
+        return "success";
+    }
+}

+ 7 - 1
src/main/resources/application-dev.yml

@@ -96,4 +96,10 @@ logging:
 # [根据业务需求配置]
 # [根据业务需求配置]
 userSettings:
 userSettings:
     # 保存移动位置历史轨迹:true:保留历史数据,false:仅保留最后的位置(默认)
     # 保存移动位置历史轨迹:true:保留历史数据,false:仅保留最后的位置(默认)
-    savePositionHistory: false
+    savePositionHistory: false
+
+# 在线文档: swagger-ui(生产环境建议关闭)
+springfox:
+    documentation:
+        swagger-ui:
+            enabled: true

binární
src/main/resources/wvp.sqlite


+ 3 - 4
web_src/src/components/DeviceList.vue

@@ -136,7 +136,7 @@
 			getDeviceList: function() {
 			getDeviceList: function() {
 				let that = this;
 				let that = this;
 				this.getDeviceListLoading = true;
 				this.getDeviceListLoading = true;
-				this.$axios.get(`/api/devices`,{
+				this.$axios.get(`/api/device/query/devices`,{
 					params: {
 					params: {
 						page: that.currentPage,
 						page: that.currentPage,
 						count: that.count
 						count: that.count
@@ -167,13 +167,12 @@
 			//gb28181平台对接
 			//gb28181平台对接
 			//刷新设备信息
 			//刷新设备信息
 			refDevice: function(itemData) {
 			refDevice: function(itemData) {
-				///api/devices/{deviceId}/sync
 				console.log("刷新对应设备:" + itemData.deviceId);
 				console.log("刷新对应设备:" + itemData.deviceId);
 				var that = this;
 				var that = this;
 				that.$refs[itemData.deviceId + 'refbtn' ].loading = true;
 				that.$refs[itemData.deviceId + 'refbtn' ].loading = true;
 				this.$axios({
 				this.$axios({
 					method: 'post',
 					method: 'post',
-					url: '/api/devices/' + itemData.deviceId + '/sync'
+					url: '/api/device/query/devices/' + itemData.deviceId + '/sync'
 				}).then(function(res) {
 				}).then(function(res) {
 					console.log("刷新设备结果:"+JSON.stringify(res));
 					console.log("刷新设备结果:"+JSON.stringify(res));
 					if (!res.data.deviceId) {
 					if (!res.data.deviceId) {
@@ -217,7 +216,7 @@
         let that = this;
         let that = this;
         this.$axios({
         this.$axios({
           method: 'get',
           method: 'get',
-          url: '/api/devices/' + row.deviceId + '/transport/' + row.streamMode
+          url: '/api/device/query/transport' + row.deviceId + '/' + row.streamMode
         }).then(function(res) {
         }).then(function(res) {
 
 
         }).catch(function(e) {
         }).catch(function(e) {

+ 2 - 2
web_src/src/components/ParentPlatformList.vue

@@ -121,7 +121,7 @@ export default {
     },
     },
     deletePlatformCommit: function(platform) {
     deletePlatformCommit: function(platform) {
         var that = this;
         var that = this;
-        that.$axios.post(`/api/platforms/delete`, platform)
+        that.$axios.delete(`/api/platform/delete/${platform.serverGBId}`)
             .then(function (res) {
             .then(function (res) {
                 if (res.data == "success") {
                 if (res.data == "success") {
                     that.$message({
                     that.$message({
@@ -155,7 +155,7 @@ export default {
     getPlatformList: function() {
     getPlatformList: function() {
       let that = this;
       let that = this;
 
 
-      this.$axios.get(`/api/platforms/${that.count}/${that.currentPage}`)
+      this.$axios.get(`/api/platform/query/${that.count}/${that.currentPage}`)
         .then(function (res) {
         .then(function (res) {
           that.total = res.data.total;
           that.total = res.data.total;
           that.platformList = res.data.list;
           that.platformList = res.data.list;

+ 0 - 2
web_src/src/components/PushVideoList.vue

@@ -15,8 +15,6 @@
 					</el-table-column>
 					</el-table-column>
 					<el-table-column prop="stream" label="流ID" width="240" align="center">
 					<el-table-column prop="stream" label="流ID" width="240" align="center">
 					</el-table-column>
 					</el-table-column>
-					<el-table-column prop="totalReaderCount" label="在线人数" width="240" align="center">
-					</el-table-column>
 					<el-table-column prop="gbId" label="国标编码" width="150" align="center">
 					<el-table-column prop="gbId" label="国标编码" width="150" align="center">
 					</el-table-column>
 					</el-table-column>
 					<el-table-column label="开始时间" align="center" >
 					<el-table-column label="开始时间" align="center" >

+ 4 - 0
web_src/src/components/UiHeader.vue

@@ -71,6 +71,10 @@ export default {
     },
     },
     destroyed() {
     destroyed() {
         window.removeEventListener('beforeunload', e => this.beforeunloadHandler(e))
         window.removeEventListener('beforeunload', e => this.beforeunloadHandler(e))
+        this.sseSource.removeEventListener('open', null);
+        this.sseSource.removeEventListener('message', null);
+        this.sseSource.removeEventListener('error', null);
+        this.sseSource.close();
         // window.removeEventListener('unload', e => this.unloadHandler(e))
         // window.removeEventListener('unload', e => this.unloadHandler(e))
     },
     },
  }
  }

+ 5 - 5
web_src/src/components/channelList.vue

@@ -154,7 +154,7 @@ export default {
         getDeviceChannelList: function () {
         getDeviceChannelList: function () {
             let that = this;
             let that = this;
 
 
-            this.$axios.get(`/api/devices/${this.$route.params.deviceId}/channels`, {
+            this.$axios.get(`/api/device/query/devices/${this.$route.params.deviceId}/channels`, {
                     params: {
                     params: {
                         page: that.currentPage,
                         page: that.currentPage,
                         count: that.count,
                         count: that.count,
@@ -188,7 +188,7 @@ export default {
             let that = this;
             let that = this;
             this.$axios({
             this.$axios({
                 method: 'get',
                 method: 'get',
-                url: '/api/play/' + deviceId + '/' + channelId
+                url: '/api/play/start/' + deviceId + '/' + channelId
             }).then(function (res) {
             }).then(function (res) {
                 console.log(res.data)
                 console.log(res.data)
                 let streamId = res.data.streamId;
                 let streamId = res.data.streamId;
@@ -216,7 +216,7 @@ export default {
             var that = this;
             var that = this;
             this.$axios({
             this.$axios({
                 method: 'post',
                 method: 'post',
-                url: '/api/play/' + itemData.streamId + '/stop'
+                url: '/api/play/stop/' + itemData.streamId 
             }).then(function (res) {
             }).then(function (res) {
                 console.log(JSON.stringify(res));
                 console.log(JSON.stringify(res));
                 that.initData();
                 that.initData();
@@ -251,7 +251,7 @@ export default {
         showSubchannels: function (channelId) {
         showSubchannels: function (channelId) {
             let that = this;
             let that = this;
 
 
-            this.$axios.get(`/api/subChannels/${this.deviceId}/${this.parentChannelId}/channels`, {
+            this.$axios.get(`/api/device/query/sub_channels/${this.deviceId}/${this.parentChannelId}/channels`, {
                     params: {
                     params: {
                         page: that.currentPage,
                         page: that.currentPage,
                         count: that.count,
                         count: that.count,
@@ -282,7 +282,7 @@ export default {
             console.log(row)
             console.log(row)
             this.$axios({
             this.$axios({
                 method: 'post',
                 method: 'post',
-                url: `/api/channel/update/${this.deviceId}`,
+                url: `/api/device/query/channel/update/${this.deviceId}`,
                 params: row
                 params: row
             }).then(function (res) {
             }).then(function (res) {
                 console.log(JSON.stringify(res));
                 console.log(JSON.stringify(res));

+ 4 - 4
web_src/src/components/devicePosition.vue

@@ -171,7 +171,7 @@ export default {
                 this.endTime = null;
                 this.endTime = null;
             }
             }
             let self = this;
             let self = this;
-            this.$axios.get(`/api/positions/${this.deviceId}/history`, {
+            this.$axios.get(`/api/position/history/${this.deviceId}`, {
                 params: {
                 params: {
                     start: self.startTime,
                     start: self.startTime,
                     end: self.endTime,
                     end: self.endTime,
@@ -202,7 +202,7 @@ export default {
             this.mapPointList = [];
             this.mapPointList = [];
             this.mobilePositionList = [];
             this.mobilePositionList = [];
             let self = this;
             let self = this;
-            this.$axios.get(`/api/positions/${this.deviceId}/latest`)
+            this.$axios.get(`/api/position/latest/${this.deviceId}`)
             .then(function (res) {
             .then(function (res) {
                 console.log(res.data);
                 console.log(res.data);
                 self.total = res.data.length;
                 self.total = res.data.length;
@@ -226,7 +226,7 @@ export default {
         },
         },
         subscribeMobilePosition: function() {
         subscribeMobilePosition: function() {
             let self = this;
             let self = this;
-            this.$axios.get(`/api/positions/${this.deviceId}/subscribe`, {
+            this.$axios.get(`/api/position/subscribe/${this.deviceId}`, {
                 params: {
                 params: {
                     expires: self.expired,
                     expires: self.expired,
                     interval: self.interval,
                     interval: self.interval,
@@ -241,7 +241,7 @@ export default {
         },
         },
         unSubscribeMobilePosition: function() {
         unSubscribeMobilePosition: function() {
             let self = this;
             let self = this;
-            this.$axios.get(`/api/positions/${this.deviceId}/subscribe`, {
+            this.$axios.get(`/api/position/subscribe/${this.deviceId}`, {
                 params: {
                 params: {
                     expires: 0,
                     expires: 0,
                     interval: self.interval,
                     interval: self.interval,

+ 1 - 1
web_src/src/components/dialog/StreamProxyEdit.vue

@@ -176,7 +176,7 @@ export default {
       var result = false;
       var result = false;
       var that = this;
       var that = this;
       await that.$axios
       await that.$axios
-        .post(`/api/platforms/exit/${deviceGbId}`)
+        .post(`/api/platform/exit/${deviceGbId}`)
         .then(function (res) {
         .then(function (res) {
           result = res.data;
           result = res.data;
         })
         })

+ 1 - 1
web_src/src/components/dialog/addStreamTOGB.vue

@@ -119,7 +119,7 @@ export default {
       var result = false;
       var result = false;
       var that = this;
       var that = this;
       await that.$axios
       await that.$axios
-        .post(`/api/platforms/exit/${deviceGbId}`)
+        .post(`/api/platform/exit/${deviceGbId}`)
         .then(function (res) {
         .then(function (res) {
           result = res.data;
           result = res.data;
         })
         })

+ 1 - 1
web_src/src/components/dialog/chooseChannel.vue

@@ -72,7 +72,7 @@ export default {
 
 
             this.$axios({
             this.$axios({
                 method:"post",
                 method:"post",
-                url:"/api/platforms/updateChannelForGB",
+                url:"/api/platform/update_channel_for_gb",
                 data:{
                 data:{
                     platformId:  that.platformId,
                     platformId:  that.platformId,
                     channelReduces:  that.chooseData
                     channelReduces:  that.chooseData

+ 4 - 4
web_src/src/components/dialog/chooseChannelForGb.vue

@@ -149,7 +149,7 @@ export default {
             if (Object.keys(addData).length >0) {
             if (Object.keys(addData).length >0) {
                 that.$axios({
                 that.$axios({
                     method:"post",
                     method:"post",
-                    url:"/api/platforms/updateChannelForGB",
+                    url:"/api/platform/update_channel_for_gb",
                     data:{
                     data:{
                         platformId:  that.platformId,
                         platformId:  that.platformId,
                         channelReduces: addData
                         channelReduces: addData
@@ -162,8 +162,8 @@ export default {
             }
             }
             if (Object.keys(delData).length >0) {
             if (Object.keys(delData).length >0) {
                  that.$axios({
                  that.$axios({
-                    method:"post",
-                    url:"/api/platforms/delChannelForGB",
+                    method:"delete",
+                    url:"/api/platform/del_channel_for_gb",
                     data:{
                     data:{
                         platformId:  that.platformId,
                         platformId:  that.platformId,
                         channelReduces: delData
                         channelReduces: delData
@@ -182,7 +182,7 @@ export default {
         getChannelList: function () {
         getChannelList: function () {
             let that = this;
             let that = this;
 
 
-            this.$axios.get(`/api/platforms/channelList`, {
+            this.$axios.get(`/api/platform/channel_list`, {
                     params: {
                     params: {
                         page: that.currentPage,
                         page: that.currentPage,
                         count: that.count,
                         count: that.count,

+ 2 - 1
web_src/src/components/dialog/chooseChannelForStream.vue

@@ -142,7 +142,7 @@ export default {
             if (Object.keys(delData).length >0) {
             if (Object.keys(delData).length >0) {
                 console.log(delData)
                 console.log(delData)
                  that.$axios({
                  that.$axios({
-                    method:"post",
+                    method:"delete",
                     url:"/api/gbStream/del",
                     url:"/api/gbStream/del",
                     data:{
                     data:{
                         gbStreams:  delData,
                         gbStreams:  delData,
@@ -152,6 +152,7 @@ export default {
                 }).catch(function (error) {
                 }).catch(function (error) {
                     console.log(error);
                     console.log(error);
                 });
                 });
+
             }
             }
 
 
         },
         },

+ 4 - 4
web_src/src/components/dialog/devicePlayer.vue

@@ -261,7 +261,7 @@ export default {
             this.$refs.videoPlayer.pause()
             this.$refs.videoPlayer.pause()
             that.$axios({
             that.$axios({
                 method: 'post',
                 method: 'post',
-                url: '/api/play/' + that.streamId + '/convert'
+                url: '/api/play/convert/' + that.streamId
                 }).then(function (res) {
                 }).then(function (res) {
                     if (res.data.code == 0) {
                     if (res.data.code == 0) {
                         that.convertKey = res.data.key;
                         that.convertKey = res.data.key;
@@ -298,7 +298,7 @@ export default {
             that.$refs.videoPlayer.pause()
             that.$refs.videoPlayer.pause()
             this.$axios({
             this.$axios({
                 method: 'post',
                 method: 'post',
-                url: '/api/play/convert/stop/' + this.convertKey
+                url: '/api/play/convertStop/' + this.convertKey
               }).then(function (res) {
               }).then(function (res) {
                 if (res.data.code == 0) {
                 if (res.data.code == 0) {
                   console.log(res.data.msg)
                   console.log(res.data.msg)
@@ -393,7 +393,7 @@ export default {
             } else {
             } else {
                 this.$axios({
                 this.$axios({
                     method: 'get',
                     method: 'get',
-                    url: '/api/playback/' + this.deviceId + '/' + this.channelId + '?startTime=' + row.startTime + '&endTime=' +
+                    url: '/api/playback/start/' + this.deviceId + '/' + this.channelId + '?startTime=' + row.startTime + '&endTime=' +
                         row.endTime
                         row.endTime
                 }).then(function (res) {
                 }).then(function (res) {
                     var streamInfo = res.data;
                     var streamInfo = res.data;
@@ -408,7 +408,7 @@ export default {
             this.videoUrl = '';
             this.videoUrl = '';
             this.$axios({
             this.$axios({
                 method: 'get',
                 method: 'get',
-                url: '/api/playback/' + this.streamId + '/stop'
+                url: '/api/playback/stop/' + this.streamId
             }).then(function (res) {
             }).then(function (res) {
                 if (callback) callback()
                 if (callback) callback()
             });
             });

+ 6 - 24
web_src/src/components/dialog/platformEdit.vue

@@ -75,7 +75,7 @@
               </el-form-item>
               </el-form-item>
               <el-form-item label="其他选项">
               <el-form-item label="其他选项">
                 <el-checkbox label="启用" v-model="platform.enable" @change="checkExpires"></el-checkbox>
                 <el-checkbox label="启用" v-model="platform.enable" @change="checkExpires"></el-checkbox>
-                <el-checkbox label="云台控制" v-model="platform.PTZEnable"></el-checkbox>
+                <el-checkbox label="云台控制" v-model="platform.ptz"></el-checkbox>
                 <el-checkbox label="RTCP保活" v-model="platform.rtcp"></el-checkbox>
                 <el-checkbox label="RTCP保活" v-model="platform.rtcp"></el-checkbox>
               </el-form-item>
               </el-form-item>
               <el-form-item>
               <el-form-item>
@@ -120,28 +120,10 @@ export default {
       showDialog: false,
       showDialog: false,
       isLoging: false,
       isLoging: false,
       onSubmit_text: "立即创建",
       onSubmit_text: "立即创建",
-      // platform: {
-      //     enable: false,
-      //     PTZEnable: true,
-      //     rtcp: false,
-      //     name: null,
-      //     serverGBId: null,
-      //     serverGBDomain: null,
-      //     serverIP: null,
-      //     serverPort: null,
-      //     deviceGBId: null,
-      //     deviceIp: null,
-      //     devicePort: null,
-      //     username: null,
-      //     password: null,
-      //     expires: 300,
-      //     keepTimeout: 60,
-      //     transport: "UDP",
-      //     characterSet: "GB2312",
-      // },
+
       platform: {
       platform: {
         enable: true,
         enable: true,
-        PTZEnable: true,
+        ptz: true,
         rtcp: false,
         rtcp: false,
         name: "测试001",
         name: "测试001",
         serverGBId: "34020000002000000001",
         serverGBId: "34020000002000000001",
@@ -182,7 +164,7 @@ export default {
     openDialog: function (platform, callback) {
     openDialog: function (platform, callback) {
       var that = this;
       var that = this;
       this.$axios
       this.$axios
-        .get(`/api/platforms/serverconfig`)
+        .get(`/api/platform/server_config`)
         .then(function (res) {
         .then(function (res) {
           console.log(res);
           console.log(res);
           that.platform.deviceGBId = res.data.username;
           that.platform.deviceGBId = res.data.username;
@@ -207,7 +189,7 @@ export default {
       console.log("onSubmit");
       console.log("onSubmit");
       var that = this;
       var that = this;
       that.$axios
       that.$axios
-        .post(`/api/platforms/save`, that.platform)
+        .post(`/api/platform/save`, that.platform)
         .then(function (res) {
         .then(function (res) {
           console.log(res);
           console.log(res);
           console.log(res.data == "success");
           console.log(res.data == "success");
@@ -237,7 +219,7 @@ export default {
       var result = false;
       var result = false;
       var that = this;
       var that = this;
       await that.$axios
       await that.$axios
-        .post(`/api/platforms/exit/${deviceGbId}`)
+        .post(`/api/platform/exit/${deviceGbId}`)
         .then(function (res) {
         .then(function (res) {
           result = res.data;
           result = res.data;
         })
         })