Commit 89244932c6185cd39e9a9f8aa8bf3acf99329335

Authored by panlinlin
2 parents a4ab9a0a f10a9238

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

Showing 36 changed files with 548 additions and 150 deletions
README.md
1 -# wvp-2.0  
2 -在1.0的基础上实现国标级联 1 +# wvp-pro-2.0
3 2
4 WEB VIDEO PLATFORM是一个基于GB28181-2016标准实现的网络视频平台,负责实现核心信令与设备管理后台部分,支持NAT穿透,支持海康、大华、宇视等品牌的IPC、NVR、DVR接入。 3 WEB VIDEO PLATFORM是一个基于GB28181-2016标准实现的网络视频平台,负责实现核心信令与设备管理后台部分,支持NAT穿透,支持海康、大华、宇视等品牌的IPC、NVR、DVR接入。
5 流媒体服务基于ZLMediaKit-https://github.com/xiongziliang/ZLMediaKit 4 流媒体服务基于ZLMediaKit-https://github.com/xiongziliang/ZLMediaKit
@@ -42,7 +41,7 @@ https://gitee.com/18010473990/wvp-GB28181.git @@ -42,7 +41,7 @@ https://gitee.com/18010473990/wvp-GB28181.git
42 19. 支持播放h265, g.711格式的流(需要将closeWaitRTPInfo设为false) 41 19. 支持播放h265, g.711格式的流(需要将closeWaitRTPInfo设为false)
43 20. 报警信息处理,支持向前端推送报警信息 42 20. 报警信息处理,支持向前端推送报警信息
44 43
45 -# 新支持特性 44 +# 2.0新支持特性
46 1. 集成web界面, 不需要单独部署前端服务, 直接利用wvp内置文件服务部署, 随wvp一起部署; 45 1. 集成web界面, 不需要单独部署前端服务, 直接利用wvp内置文件服务部署, 随wvp一起部署;
47 2. 支持平台接入, 针对大平台大量设备的情况进行优化; 46 2. 支持平台接入, 针对大平台大量设备的情况进行优化;
48 3. 支持检索,通道筛选; 47 3. 支持检索,通道筛选;
@@ -102,18 +102,15 @@ @@ -102,18 +102,15 @@
102 <!-- <version>3.11</version>--> 102 <!-- <version>3.11</version>-->
103 <!-- </dependency>--> 103 <!-- </dependency>-->
104 104
105 - <!--Swagger2 --> 105 + <!--Swagger3 -->
106 <!--在线文档 --> 106 <!--在线文档 -->
107 <dependency> 107 <dependency>
108 <groupId>io.springfox</groupId> 108 <groupId>io.springfox</groupId>
109 - <artifactId>springfox-swagger2</artifactId>  
110 - <version>2.9.2</version>  
111 - </dependency>  
112 - <dependency>  
113 - <groupId>io.springfox</groupId>  
114 - <artifactId>springfox-swagger-ui</artifactId>  
115 - <version>2.6.1</version> 109 + <artifactId>springfox-boot-starter</artifactId>
  110 + <version>3.0.0</version>
116 </dependency> 111 </dependency>
  112 +
  113 + <!--参数校验 -->
117 <dependency> 114 <dependency>
118 <groupId>javax.validation</groupId> 115 <groupId>javax.validation</groupId>
119 <artifactId>validation-api</artifactId> 116 <artifactId>validation-api</artifactId>
src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java
@@ -5,8 +5,10 @@ import java.util.logging.LogManager; @@ -5,8 +5,10 @@ import java.util.logging.LogManager;
5 import org.springframework.boot.SpringApplication; 5 import org.springframework.boot.SpringApplication;
6 import org.springframework.boot.autoconfigure.SpringBootApplication; 6 import org.springframework.boot.autoconfigure.SpringBootApplication;
7 import org.springframework.context.ConfigurableApplicationContext; 7 import org.springframework.context.ConfigurableApplicationContext;
  8 +import springfox.documentation.oas.annotations.EnableOpenApi;
8 9
9 @SpringBootApplication 10 @SpringBootApplication
  11 +@EnableOpenApi
10 public class VManageBootstrap extends LogManager { 12 public class VManageBootstrap extends LogManager {
11 private static String[] args; 13 private static String[] args;
12 private static ConfigurableApplicationContext context; 14 private static ConfigurableApplicationContext context;
src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java 0 → 100644
  1 +package com.genersoft.iot.vmp.conf;
  2 +
  3 +import io.swagger.annotations.ApiOperation;
  4 +import org.springframework.context.annotation.Bean;
  5 +import org.springframework.context.annotation.Configuration;
  6 +import springfox.documentation.builders.ApiInfoBuilder;
  7 +import springfox.documentation.builders.PathSelectors;
  8 +import springfox.documentation.builders.RequestHandlerSelectors;
  9 +import springfox.documentation.builders.RequestParameterBuilder;
  10 +import springfox.documentation.schema.ScalarType;
  11 +import springfox.documentation.service.ApiInfo;
  12 +import springfox.documentation.service.Contact;
  13 +import springfox.documentation.spi.DocumentationType;
  14 +import springfox.documentation.spring.web.plugins.Docket;
  15 +
  16 +import java.util.ArrayList;
  17 +import java.util.List;
  18 +
  19 +@Configuration
  20 +public class Swagger3Config {
  21 +
  22 + @Bean
  23 + public Docket createRestApi() {
  24 + return new Docket(DocumentationType.OAS_30)
  25 + .apiInfo(apiInfo())
  26 + .select()
  27 + .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager"))
  28 + .paths(PathSelectors.any())
  29 + .build()
  30 + .pathMapping("/");
  31 + }
  32 +
  33 + private ApiInfo apiInfo() {
  34 + return new ApiInfoBuilder()
  35 + .title("WVP-PRO 接口文档")
  36 + .description("更多请咨询服务开发者(18010473990@@163.com)。")
  37 + .contact(new Contact("Ray。", "http://www.ruiyeclub.cn", "ruiyeclub@foxmail.com"))
  38 + .version("1.0")
  39 + .build();
  40 + }
  41 +}
src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
@@ -81,7 +81,7 @@ public class ParentPlatform { @@ -81,7 +81,7 @@ public class ParentPlatform {
81 /** 81 /**
82 * 允许云台控制 82 * 允许云台控制
83 */ 83 */
84 - private boolean PTZEnable; 84 + private boolean ptz;
85 85
86 /** 86 /**
87 * RTCP流保活 87 * RTCP流保活
@@ -220,12 +220,12 @@ public class ParentPlatform { @@ -220,12 +220,12 @@ public class ParentPlatform {
220 this.characterSet = characterSet; 220 this.characterSet = characterSet;
221 } 221 }
222 222
223 - public boolean isPTZEnable() {  
224 - return PTZEnable; 223 + public boolean isPtz() {
  224 + return ptz;
225 } 225 }
226 226
227 - public void setPTZEnable(boolean PTZEnable) {  
228 - this.PTZEnable = PTZEnable; 227 + public void setPtz(boolean ptz) {
  228 + this.ptz = ptz;
229 } 229 }
230 230
231 public boolean isRtcp() { 231 public boolean isRtcp() {
@@ -251,4 +251,5 @@ public class ParentPlatform { @@ -251,4 +251,5 @@ public class ParentPlatform {
251 public void setChannelCount(int channelCount) { 251 public void setChannelCount(int channelCount) {
252 this.channelCount = channelCount; 252 this.channelCount = channelCount;
253 } 253 }
  254 +
254 } 255 }
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
@@ -341,7 +341,7 @@ public class SIPCommander implements ISIPCommander { @@ -341,7 +341,7 @@ public class SIPCommander implements ISIPCommander {
341 @Override 341 @Override
342 public void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event, SipSubscribe.Event errorEvent) { 342 public void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event, SipSubscribe.Event errorEvent) {
343 try { 343 try {
344 - 344 + if (device == null) return;
345 String ssrc = streamSession.createPlaySsrc(); 345 String ssrc = streamSession.createPlaySsrc();
346 String streamId = null; 346 String streamId = null;
347 if (rtpEnable) { 347 if (rtpEnable) {
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -118,6 +118,10 @@ public class ZLMHttpHookListener { @@ -118,6 +118,10 @@ public class ZLMHttpHookListener {
118 if (logger.isDebugEnabled()) { 118 if (logger.isDebugEnabled()) {
119 logger.debug("ZLM HOOK on_play API调用,参数:" + json.toString()); 119 logger.debug("ZLM HOOK on_play API调用,参数:" + json.toString());
120 } 120 }
  121 + ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_play, json);
  122 + if (subscribe != null ) {
  123 + subscribe.response(json);
  124 + }
121 JSONObject ret = new JSONObject(); 125 JSONObject ret = new JSONObject();
122 ret.put("code", 0); 126 ret.put("code", 0);
123 ret.put("msg", "success"); 127 ret.put("msg", "success");
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java
@@ -70,6 +70,27 @@ public class ZLMHttpHookSubscribe { @@ -70,6 +70,27 @@ public class ZLMHttpHookSubscribe {
70 return event; 70 return event;
71 } 71 }
72 72
  73 + public void removeSubscribe(HookType type, JSONObject hookResponse) {
  74 + Map<JSONObject, Event> eventMap = allSubscribes.get(type);
  75 + if (eventMap == null) {
  76 + return;
  77 + }
  78 + for (JSONObject key : eventMap.keySet()) {
  79 + Boolean result = null;
  80 + for (String s : key.keySet()) {
  81 + if (result == null) {
  82 + result = key.getString(s).equals(hookResponse.getString(s));
  83 + }else {
  84 + result = result && key.getString(s).equals(hookResponse.getString(s));
  85 + }
  86 +
  87 + }
  88 + if (result) {
  89 + eventMap.remove(key);
  90 + }
  91 + }
  92 + }
  93 +
73 /** 94 /**
74 * 获取某个类型的所有的订阅 95 * 获取某个类型的所有的订阅
75 * @param type 96 * @param type
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
@@ -42,6 +42,9 @@ public class ZLMMediaListManager { @@ -42,6 +42,9 @@ public class ZLMMediaListManager {
42 @Autowired 42 @Autowired
43 private IStreamPushService streamPushService; 43 private IStreamPushService streamPushService;
44 44
  45 + @Autowired
  46 + private ZLMHttpHookSubscribe subscribe;
  47 +
45 48
46 public void updateMediaList() { 49 public void updateMediaList() {
47 storager.clearMediaList(); 50 storager.clearMediaList();
@@ -66,6 +69,15 @@ public class ZLMMediaListManager { @@ -66,6 +69,15 @@ public class ZLMMediaListManager {
66 69
67 if (streamPushItems != null) { 70 if (streamPushItems != null) {
68 storager.updateMediaList(streamPushItems); 71 storager.updateMediaList(streamPushItems);
  72 + for (StreamPushItem streamPushItem : streamPushItems) {
  73 + JSONObject jsonObject = new JSONObject();
  74 + jsonObject.put("app", streamPushItem.getApp());
  75 + jsonObject.put("stream", streamPushItem.getStream());
  76 + subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_play,jsonObject,(response)->{
  77 + System.out.println(1222211111);
  78 + updateMedia(response.getString("app"), response.getString("stream"));
  79 + });
  80 + }
69 } 81 }
70 })); 82 }));
71 83
@@ -73,6 +85,12 @@ public class ZLMMediaListManager { @@ -73,6 +85,12 @@ public class ZLMMediaListManager {
73 85
74 public void addMedia(String app, String streamId) { 86 public void addMedia(String app, String streamId) {
75 //使用异步更新推流 87 //使用异步更新推流
  88 + updateMedia(app, streamId);
  89 + }
  90 +
  91 +
  92 + public void updateMedia(String app, String streamId) {
  93 + //使用异步更新推流
76 zlmresTfulUtils.getMediaList(app, streamId, "rtmp", json->{ 94 zlmresTfulUtils.getMediaList(app, streamId, "rtmp", json->{
77 95
78 if (json == null) return; 96 if (json == null) return;
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
@@ -123,7 +123,7 @@ public class ZLMRunner implements CommandLineRunner { @@ -123,7 +123,7 @@ public class ZLMRunner implements CommandLineRunner {
123 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"); 123 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");
124 param.put("hook.enable","1"); 124 param.put("hook.enable","1");
125 param.put("hook.on_flow_report",""); 125 param.put("hook.on_flow_report","");
126 - param.put("hook.on_play",""); 126 + param.put("hook.on_play",String.format("%s/on_play", hookPrex));
127 param.put("hook.on_http_access",""); 127 param.put("hook.on_http_access","");
128 param.put("hook.on_publish",String.format("%s/on_publish", hookPrex)); 128 param.put("hook.on_publish",String.format("%s/on_publish", hookPrex));
129 param.put("hook.on_record_mp4",""); 129 param.put("hook.on_record_mp4","");
src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
@@ -14,10 +14,10 @@ import java.util.List; @@ -14,10 +14,10 @@ import java.util.List;
14 public interface ParentPlatformMapper { 14 public interface ParentPlatformMapper {
15 15
16 @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + 16 @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " +
17 - " devicePort, username, password, expires, keepTimeout, transport, characterSet, PTZEnable, rtcp, " + 17 + " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " +
18 " status) " + 18 " status) " +
19 " VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " + 19 " VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " +
20 - " '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${PTZEnable}, ${rtcp}, " + 20 + " '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " +
21 " ${status})") 21 " ${status})")
22 int addParentPlatform(ParentPlatform parentPlatform); 22 int addParentPlatform(ParentPlatform parentPlatform);
23 23
@@ -36,7 +36,7 @@ public interface ParentPlatformMapper { @@ -36,7 +36,7 @@ public interface ParentPlatformMapper {
36 "keepTimeout=#{keepTimeout}, " + 36 "keepTimeout=#{keepTimeout}, " +
37 "transport=#{transport}, " + 37 "transport=#{transport}, " +
38 "characterSet=#{characterSet}, " + 38 "characterSet=#{characterSet}, " +
39 - "PTZEnable=#{PTZEnable}, " + 39 + "ptz=#{ptz}, " +
40 "rtcp=#{rtcp}, " + 40 "rtcp=#{rtcp}, " +
41 "status=#{status} " + 41 "status=#{status} " +
42 "WHERE serverGBId=#{serverGBId}") 42 "WHERE serverGBId=#{serverGBId}")
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; @@ -12,6 +12,10 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
12 import com.genersoft.iot.vmp.storager.IVideoManagerStorager; 12 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
13 import com.github.pagehelper.util.StringUtil; 13 import com.github.pagehelper.util.StringUtil;
14 14
  15 +import io.swagger.annotations.Api;
  16 +import io.swagger.annotations.ApiImplicitParam;
  17 +import io.swagger.annotations.ApiImplicitParams;
  18 +import io.swagger.annotations.ApiOperation;
15 import org.slf4j.Logger; 19 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory; 20 import org.slf4j.LoggerFactory;
17 import org.springframework.beans.factory.annotation.Autowired; 21 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,9 +29,13 @@ import org.springframework.web.bind.annotation.RequestParam; @@ -25,9 +29,13 @@ import org.springframework.web.bind.annotation.RequestParam;
25 import org.springframework.web.bind.annotation.RestController; 29 import org.springframework.web.bind.annotation.RestController;
26 import org.springframework.web.context.request.async.DeferredResult; 30 import org.springframework.web.context.request.async.DeferredResult;
27 31
  32 +/**
  33 + * 位置信息管理
  34 + */
  35 +@Api(tags = "位置信息管理")
28 @CrossOrigin 36 @CrossOrigin
29 @RestController 37 @RestController
30 -@RequestMapping("/api") 38 +@RequestMapping("/api/position")
31 public class MobilePositionController { 39 public class MobilePositionController {
32 40
33 private final static Logger logger = LoggerFactory.getLogger(MobilePositionController.class); 41 private final static Logger logger = LoggerFactory.getLogger(MobilePositionController.class);
@@ -40,8 +48,21 @@ public class MobilePositionController { @@ -40,8 +48,21 @@ public class MobilePositionController {
40 48
41 @Autowired 49 @Autowired
42 private DeferredResultHolder resultHolder; 50 private DeferredResultHolder resultHolder;
43 -  
44 - @GetMapping("/positions/{deviceId}/history") 51 +
  52 + /**
  53 + * 查询历史轨迹
  54 + * @param deviceId 设备ID
  55 + * @param start 开始时间
  56 + * @param end 结束时间
  57 + * @return
  58 + */
  59 + @ApiOperation("查询历史轨迹")
  60 + @ApiImplicitParams({
  61 + @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
  62 + @ApiImplicitParam(name = "start", value = "开始时间", required = true),
  63 + @ApiImplicitParam(name = "end", value = "结束时间", required = true),
  64 + })
  65 + @GetMapping("/history/{deviceId}")
45 public ResponseEntity<List<MobilePosition>> positions(@PathVariable String deviceId, 66 public ResponseEntity<List<MobilePosition>> positions(@PathVariable String deviceId,
46 @RequestParam(required = false) String start, 67 @RequestParam(required = false) String start,
47 @RequestParam(required = false) String end) { 68 @RequestParam(required = false) String end) {
@@ -60,7 +81,16 @@ public class MobilePositionController { @@ -60,7 +81,16 @@ public class MobilePositionController {
60 return new ResponseEntity<>(result, HttpStatus.OK); 81 return new ResponseEntity<>(result, HttpStatus.OK);
61 } 82 }
62 83
63 - @GetMapping("/positions/{deviceId}/latest") 84 + /**
  85 + * 查询设备最新位置
  86 + * @param deviceId 设备ID
  87 + * @return
  88 + */
  89 + @ApiOperation("查询设备最新位置")
  90 + @ApiImplicitParams({
  91 + @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
  92 + })
  93 + @GetMapping("/latest/{deviceId}")
64 public ResponseEntity<MobilePosition> latestPosition(@PathVariable String deviceId) { 94 public ResponseEntity<MobilePosition> latestPosition(@PathVariable String deviceId) {
65 if (logger.isDebugEnabled()) { 95 if (logger.isDebugEnabled()) {
66 logger.debug("查询设备" + deviceId + "的最新位置"); 96 logger.debug("查询设备" + deviceId + "的最新位置");
@@ -69,7 +99,16 @@ public class MobilePositionController { @@ -69,7 +99,16 @@ public class MobilePositionController {
69 return new ResponseEntity<>(result, HttpStatus.OK); 99 return new ResponseEntity<>(result, HttpStatus.OK);
70 } 100 }
71 101
72 - @GetMapping("/positions/{deviceId}/realtime") 102 + /**
  103 + * 获取移动位置信息
  104 + * @param deviceId 设备ID
  105 + * @return
  106 + */
  107 + @ApiOperation("获取移动位置信息")
  108 + @ApiImplicitParams({
  109 + @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
  110 + })
  111 + @GetMapping("/realtime/{deviceId}")
73 public DeferredResult<ResponseEntity<MobilePosition>> realTimePosition(@PathVariable String deviceId) { 112 public DeferredResult<ResponseEntity<MobilePosition>> realTimePosition(@PathVariable String deviceId) {
74 Device device = storager.queryVideoDevice(deviceId); 113 Device device = storager.queryVideoDevice(deviceId);
75 cmder.mobilePostitionQuery(device, event -> { 114 cmder.mobilePostitionQuery(device, event -> {
@@ -92,7 +131,20 @@ public class MobilePositionController { @@ -92,7 +131,20 @@ public class MobilePositionController {
92 return result; 131 return result;
93 } 132 }
94 133
95 - @GetMapping("/positions/{deviceId}/subscribe") 134 + /**
  135 + * 订阅位置信息
  136 + * @param deviceId 设备ID
  137 + * @param expires 订阅超时时间
  138 + * @param interval 上报时间间隔
  139 + * @return true = 命令发送成功
  140 + */
  141 + @ApiOperation("订阅位置信息")
  142 + @ApiImplicitParams({
  143 + @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
  144 + @ApiImplicitParam(name = "expires", value = "订阅超时时间"),
  145 + @ApiImplicitParam(name = "interval", value = "上报时间间隔"),
  146 + })
  147 + @GetMapping("/subscribe/{deviceId}")
96 public ResponseEntity<String> positionSubscribe(@PathVariable String deviceId, 148 public ResponseEntity<String> positionSubscribe(@PathVariable String deviceId,
97 @RequestParam String expires, 149 @RequestParam String expires,
98 @RequestParam String interval) { 150 @RequestParam String interval) {
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; @@ -17,16 +17,22 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
17 import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; 17 import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
18 import com.genersoft.iot.vmp.storager.IVideoManagerStorager; 18 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
19 19
  20 +import io.swagger.annotations.Api;
  21 +import io.swagger.annotations.ApiImplicitParam;
  22 +import io.swagger.annotations.ApiImplicitParams;
  23 +import io.swagger.annotations.ApiOperation;
20 import org.slf4j.Logger; 24 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory; 25 import org.slf4j.LoggerFactory;
22 import org.springframework.beans.factory.annotation.Autowired; 26 import org.springframework.beans.factory.annotation.Autowired;
  27 +import org.springframework.http.HttpRequest;
23 import org.springframework.http.ResponseEntity; 28 import org.springframework.http.ResponseEntity;
24 import org.springframework.web.bind.annotation.*; 29 import org.springframework.web.bind.annotation.*;
25 import org.springframework.web.context.request.async.DeferredResult; 30 import org.springframework.web.context.request.async.DeferredResult;
26 31
  32 +@Api(tags = "国标设备配置")
27 @CrossOrigin 33 @CrossOrigin
28 @RestController 34 @RestController
29 -@RequestMapping("/api") 35 +@RequestMapping("/api/device/config")
30 public class DeviceConfig { 36 public class DeviceConfig {
31 37
32 private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); 38 private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class);
@@ -42,14 +48,24 @@ public class DeviceConfig { @@ -42,14 +48,24 @@ public class DeviceConfig {
42 48
43 /** 49 /**
44 * 看守位控制命令API接口 50 * 看守位控制命令API接口
45 - *  
46 - * @param deviceId  
47 - * @param enabled 看守位使能1:开启,0:关闭  
48 - * @param resetTime 自动归位时间间隔(可选)  
49 - * @param presetIndex 调用预置位编号(可选)  
50 - * @param channelId 通道编码(可选) 51 + * @param deviceId 设备ID
  52 + * @param channelId 通道ID
  53 + * @param name 名称
  54 + * @param expiration 到期时间
  55 + * @param heartBeatInterval 心跳间隔
  56 + * @param heartBeatCount 心跳计数
  57 + * @return
51 */ 58 */
52 - @GetMapping("/config/{deviceId}/basicParam") 59 + @ApiOperation("看守位控制命令")
  60 + @GetMapping("/basicParam/{deviceId}")
  61 + @ApiImplicitParams({
  62 + @ApiImplicitParam(name = "deviceId", value ="设备ID" ),
  63 + @ApiImplicitParam(name = "channelId", value ="通道ID" ),
  64 + @ApiImplicitParam(name = "name", value ="名称" ),
  65 + @ApiImplicitParam(name = "expiration", value ="到期时间" ),
  66 + @ApiImplicitParam(name = "heartBeatInterval", value ="心跳间隔" ),
  67 + @ApiImplicitParam(name = "heartBeatCount", value ="心跳计数" ),
  68 + })
53 public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId, 69 public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId,
54 @RequestParam(required = false) String channelId, 70 @RequestParam(required = false) String channelId,
55 @RequestParam(required = false) String name, 71 @RequestParam(required = false) String name,
@@ -86,10 +102,18 @@ public class DeviceConfig { @@ -86,10 +102,18 @@ public class DeviceConfig {
86 102
87 /** 103 /**
88 * 设备配置查询请求API接口 104 * 设备配置查询请求API接口
89 - *  
90 - * @param deviceId 105 + * @param deviceId 设备ID
  106 + * @param configType 配置类型
  107 + * @param channelId 通道ID
  108 + * @return
91 */ 109 */
92 - @GetMapping("/config/{deviceId}/query/{configType}") 110 + @ApiOperation("设备配置查询请求")
  111 + @ApiImplicitParams({
  112 + @ApiImplicitParam(name = "deviceId", value ="设备ID" ),
  113 + @ApiImplicitParam(name = "channelId", value ="通道ID" ),
  114 + @ApiImplicitParam(name = "configType", value ="配置类型" ),
  115 + })
  116 + @GetMapping("/query/{deviceId}/{configType}")
93 public DeferredResult<ResponseEntity<String>> configDownloadApi(@PathVariable String deviceId, 117 public DeferredResult<ResponseEntity<String>> configDownloadApi(@PathVariable String deviceId,
94 @PathVariable String configType, 118 @PathVariable String configType,
95 @RequestParam(required = false) String channelId) { 119 @RequestParam(required = false) String channelId) {
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; @@ -17,6 +17,10 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
17 import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; 17 import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
18 import com.genersoft.iot.vmp.storager.IVideoManagerStorager; 18 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
19 19
  20 +import io.swagger.annotations.Api;
  21 +import io.swagger.annotations.ApiImplicitParam;
  22 +import io.swagger.annotations.ApiImplicitParams;
  23 +import io.swagger.annotations.ApiOperation;
20 import org.slf4j.Logger; 24 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory; 25 import org.slf4j.LoggerFactory;
22 import org.springframework.beans.factory.annotation.Autowired; 26 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,9 +29,10 @@ import org.springframework.http.ResponseEntity; @@ -25,9 +29,10 @@ import org.springframework.http.ResponseEntity;
25 import org.springframework.web.bind.annotation.*; 29 import org.springframework.web.bind.annotation.*;
26 import org.springframework.web.context.request.async.DeferredResult; 30 import org.springframework.web.context.request.async.DeferredResult;
27 31
  32 +@Api(tags = "国标设备控制")
28 @CrossOrigin 33 @CrossOrigin
29 @RestController 34 @RestController
30 -@RequestMapping("/api") 35 +@RequestMapping("/api/device/control")
31 public class DeviceControl { 36 public class DeviceControl {
32 37
33 private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); 38 private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class);
@@ -44,10 +49,13 @@ public class DeviceControl { @@ -44,10 +49,13 @@ public class DeviceControl {
44 /** 49 /**
45 * 远程启动控制命令API接口 50 * 远程启动控制命令API接口
46 * 51 *
47 - * @param deviceId 52 + * @param deviceId 设备ID
48 */ 53 */
49 - @GetMapping("/control/{deviceId}/teleboot")  
50 - @PostMapping("/control/{deviceId}/teleboot") 54 + @ApiOperation("远程启动控制命令")
  55 + @ApiImplicitParams({
  56 + @ApiImplicitParam(name = "deviceId", value ="设备ID", required = true),
  57 + })
  58 + @GetMapping("/teleboot/{deviceId}")
51 public ResponseEntity<String> teleBootApi(@PathVariable String deviceId) { 59 public ResponseEntity<String> teleBootApi(@PathVariable String deviceId) {
52 if (logger.isDebugEnabled()) { 60 if (logger.isDebugEnabled()) {
53 logger.debug("设备远程启动API调用"); 61 logger.debug("设备远程启动API调用");
@@ -68,11 +76,18 @@ public class DeviceControl { @@ -68,11 +76,18 @@ public class DeviceControl {
68 /** 76 /**
69 * 录像控制命令API接口 77 * 录像控制命令API接口
70 * 78 *
71 - * @param deviceId 79 + * @param deviceId 设备ID
72 * @param recordCmdStr Record:手动录像,StopRecord:停止手动录像 80 * @param recordCmdStr Record:手动录像,StopRecord:停止手动录像
73 * @param channelId 通道编码(可选) 81 * @param channelId 通道编码(可选)
74 */ 82 */
75 - @GetMapping("/control/{deviceId}/record/{recordCmdStr}") 83 + @ApiOperation("录像控制命令")
  84 + @ApiImplicitParams({
  85 + @ApiImplicitParam(name = "deviceId", value ="设备ID", required = true),
  86 + @ApiImplicitParam(name = "channelId", value ="通道编码"),
  87 + @ApiImplicitParam(name = "recordCmdStr", value ="命令, 可选值:Record(手动录像),StopRecord(停止手动录像)",
  88 + required = true),
  89 + })
  90 + @GetMapping("/record/{deviceId}/{recordCmdStr}")
76 public DeferredResult<ResponseEntity<String>> recordApi(@PathVariable String deviceId, 91 public DeferredResult<ResponseEntity<String>> recordApi(@PathVariable String deviceId,
77 @PathVariable String recordCmdStr, @RequestParam(required = false) String channelId) { 92 @PathVariable String recordCmdStr, @RequestParam(required = false) String channelId) {
78 if (logger.isDebugEnabled()) { 93 if (logger.isDebugEnabled()) {
@@ -102,10 +117,15 @@ public class DeviceControl { @@ -102,10 +117,15 @@ public class DeviceControl {
102 /** 117 /**
103 * 报警布防/撤防命令API接口 118 * 报警布防/撤防命令API接口
104 * 119 *
105 - * @param deviceId 120 + * @param deviceId 设备ID
106 * @param guardCmdStr SetGuard:布防,ResetGuard:撤防 121 * @param guardCmdStr SetGuard:布防,ResetGuard:撤防
107 */ 122 */
108 - @GetMapping("/control/{deviceId}/guard/{guardCmdStr}") 123 + @ApiOperation("录像控制命令")
  124 + @ApiImplicitParams({
  125 + @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
  126 + @ApiImplicitParam(name = "guardCmdStr", value ="命令, 可选值:SetGuard(布防),ResetGuard(撤防)", required = true)
  127 + })
  128 + @GetMapping("/guard/{deviceId}/{guardCmdStr}")
109 public DeferredResult<ResponseEntity<String>> guardApi(@PathVariable String deviceId, @PathVariable String guardCmdStr) { 129 public DeferredResult<ResponseEntity<String>> guardApi(@PathVariable String deviceId, @PathVariable String guardCmdStr) {
110 if (logger.isDebugEnabled()) { 130 if (logger.isDebugEnabled()) {
111 logger.debug("布防/撤防API调用"); 131 logger.debug("布防/撤防API调用");
@@ -134,11 +154,17 @@ public class DeviceControl { @@ -134,11 +154,17 @@ public class DeviceControl {
134 /** 154 /**
135 * 报警复位API接口 155 * 报警复位API接口
136 * 156 *
137 - * @param deviceId 157 + * @param deviceId 设备ID
138 * @param alarmMethod 报警方式(可选) 158 * @param alarmMethod 报警方式(可选)
139 * @param alarmType 报警类型(可选) 159 * @param alarmType 报警类型(可选)
140 */ 160 */
141 - @GetMapping("/control/{deviceId}/resetAlarm") 161 + @ApiOperation("报警复位")
  162 + @ApiImplicitParams({
  163 + @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
  164 + @ApiImplicitParam(name = "alarmMethod", value ="报警方式"),
  165 + @ApiImplicitParam(name = "alarmType", value ="报警类型"),
  166 + })
  167 + @GetMapping("/reset_alarm/{deviceId}")
142 public DeferredResult<ResponseEntity<String>> resetAlarmApi(@PathVariable String deviceId, 168 public DeferredResult<ResponseEntity<String>> resetAlarmApi(@PathVariable String deviceId,
143 @RequestParam(required = false) String alarmMethod, 169 @RequestParam(required = false) String alarmMethod,
144 @RequestParam(required = false) String alarmType) { 170 @RequestParam(required = false) String alarmType) {
@@ -169,11 +195,15 @@ public class DeviceControl { @@ -169,11 +195,15 @@ public class DeviceControl {
169 /** 195 /**
170 * 强制关键帧API接口 196 * 强制关键帧API接口
171 * 197 *
172 - * @param deviceId  
173 - * @param channelId 198 + * @param deviceId 设备ID
  199 + * @param channelId 通道ID
174 */ 200 */
175 - @GetMapping("/control/{deviceId}/iFrame")  
176 - @PostMapping("/control/{deviceId}/iFrame") 201 + @ApiOperation("强制关键帧")
  202 + @ApiImplicitParams({
  203 + @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
  204 + @ApiImplicitParam(name = "channelId", value ="通道ID", required = true),
  205 + })
  206 + @GetMapping("/i_frame/{deviceId}")
177 public ResponseEntity<String> iFrame(@PathVariable String deviceId, 207 public ResponseEntity<String> iFrame(@PathVariable String deviceId,
178 @RequestParam(required = false) String channelId) { 208 @RequestParam(required = false) String channelId) {
179 if (logger.isDebugEnabled()) { 209 if (logger.isDebugEnabled()) {
@@ -196,13 +226,21 @@ public class DeviceControl { @@ -196,13 +226,21 @@ public class DeviceControl {
196 /** 226 /**
197 * 看守位控制命令API接口 227 * 看守位控制命令API接口
198 * 228 *
199 - * @param deviceId 229 + * @param deviceId 设备ID
200 * @param enabled 看守位使能1:开启,0:关闭 230 * @param enabled 看守位使能1:开启,0:关闭
201 * @param resetTime 自动归位时间间隔(可选) 231 * @param resetTime 自动归位时间间隔(可选)
202 * @param presetIndex 调用预置位编号(可选) 232 * @param presetIndex 调用预置位编号(可选)
203 * @param channelId 通道编码(可选) 233 * @param channelId 通道编码(可选)
204 */ 234 */
205 - @GetMapping("/control/{deviceId}/homePosition/{enabled}") 235 + @ApiOperation("看守位控制")
  236 + @ApiImplicitParams({
  237 + @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
  238 + @ApiImplicitParam(name = "enabled", value = "是否开启看守位 1:开启,0:关闭", required = true),
  239 + @ApiImplicitParam(name = "resetTime", value = "自动归位时间间隔"),
  240 + @ApiImplicitParam(name = "presetIndex", value = "调用预置位编号"),
  241 + @ApiImplicitParam(name = "channelId", value ="通道ID"),
  242 + })
  243 + @GetMapping("/home_position/{deviceId}/{enabled}")
206 public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId, 244 public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId,
207 @PathVariable String enabled, 245 @PathVariable String enabled,
208 @RequestParam(required = false) String resetTime, 246 @RequestParam(required = false) String resetTime,
src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceQuery.java
@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.vmanager.device; @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.vmanager.device;
3 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; 3 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
4 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; 4 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
5 import com.github.pagehelper.PageInfo; 5 import com.github.pagehelper.PageInfo;
  6 +import io.swagger.annotations.*;
6 import org.slf4j.Logger; 7 import org.slf4j.Logger;
7 import org.slf4j.LoggerFactory; 8 import org.slf4j.LoggerFactory;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,10 +22,11 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorager; @@ -21,10 +22,11 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
21 22
22 import javax.sip.message.Response; 23 import javax.sip.message.Response;
23 24
  25 +@Api(tags = "国标设备查询1", value = "国标设备查询")
24 @SuppressWarnings("rawtypes") 26 @SuppressWarnings("rawtypes")
25 @CrossOrigin 27 @CrossOrigin
26 @RestController 28 @RestController
27 -@RequestMapping("/api") 29 +@RequestMapping("/api/device/query")
28 public class DeviceQuery { 30 public class DeviceQuery {
29 31
30 private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); 32 private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class);
@@ -40,7 +42,16 @@ public class DeviceQuery { @@ -40,7 +42,16 @@ public class DeviceQuery {
40 42
41 @Autowired 43 @Autowired
42 private DeviceOffLineDetector offLineDetector; 44 private DeviceOffLineDetector offLineDetector;
43 - 45 +
  46 + /**
  47 + * 使用ID查询国标设备
  48 + * @param deviceId 国标ID
  49 + * @return 国标设备
  50 + */
  51 + @ApiOperation("使用ID查询国标设备")
  52 + @ApiImplicitParams({
  53 + @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true),
  54 + })
44 @GetMapping("/devices/{deviceId}") 55 @GetMapping("/devices/{deviceId}")
45 public ResponseEntity<Device> devices(@PathVariable String deviceId){ 56 public ResponseEntity<Device> devices(@PathVariable String deviceId){
46 57
@@ -51,7 +62,18 @@ public class DeviceQuery { @@ -51,7 +62,18 @@ public class DeviceQuery {
51 Device device = storager.queryVideoDevice(deviceId); 62 Device device = storager.queryVideoDevice(deviceId);
52 return new ResponseEntity<>(device,HttpStatus.OK); 63 return new ResponseEntity<>(device,HttpStatus.OK);
53 } 64 }
54 - 65 +
  66 + /**
  67 + * 分页查询国标设备
  68 + * @param page 当前页
  69 + * @param count 每页查询数量
  70 + * @return 分页国标列表
  71 + */
  72 + @ApiOperation("分页查询国标设备")
  73 + @ApiImplicitParams({
  74 + @ApiImplicitParam(name = "page", value = "当前页", required = true),
  75 + @ApiImplicitParam(name = "count", value = "每页查询数量", required = true),
  76 + })
55 @GetMapping("/devices") 77 @GetMapping("/devices")
56 public PageInfo<Device> devices(int page, int count){ 78 public PageInfo<Device> devices(int page, int count){
57 79
@@ -73,7 +95,16 @@ public class DeviceQuery { @@ -73,7 +95,16 @@ public class DeviceQuery {
73 * @param channelType 设备 false/子目录 true 95 * @param channelType 设备 false/子目录 true
74 * @return 通道列表 96 * @return 通道列表
75 */ 97 */
  98 + @ApiOperation("分页查询通道")
76 @GetMapping("/devices/{deviceId}/channels") 99 @GetMapping("/devices/{deviceId}/channels")
  100 + @ApiImplicitParams({
  101 + @ApiImplicitParam(name="deviceId", value = "设备id", required = true),
  102 + @ApiImplicitParam(name="page", value = "当前页", required = true),
  103 + @ApiImplicitParam(name="count", value = "每页查询数量", required = true),
  104 + @ApiImplicitParam(name="query", value = "查询内容"),
  105 + @ApiImplicitParam(name="online", value = "是否在线"),
  106 + @ApiImplicitParam(name="channelType", value = "设备/子目录-> false/true"),
  107 + })
77 public ResponseEntity<PageInfo> channels(@PathVariable String deviceId, 108 public ResponseEntity<PageInfo> channels(@PathVariable String deviceId,
78 int page, int count, 109 int page, int count,
79 @RequestParam(required = false) String query, 110 @RequestParam(required = false) String query,
@@ -89,7 +120,16 @@ public class DeviceQuery { @@ -89,7 +120,16 @@ public class DeviceQuery {
89 PageInfo pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count); 120 PageInfo pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count);
90 return new ResponseEntity<>(pageResult,HttpStatus.OK); 121 return new ResponseEntity<>(pageResult,HttpStatus.OK);
91 } 122 }
92 - 123 +
  124 + /**
  125 + * 同步设备通道
  126 + * @param deviceId 设备id
  127 + * @return
  128 + */
  129 + @ApiOperation("同步设备通道")
  130 + @ApiImplicitParams({
  131 + @ApiImplicitParam(name="deviceId", value = "设备id", required = true),
  132 + })
93 @PostMapping("/devices/{deviceId}/sync") 133 @PostMapping("/devices/{deviceId}/sync")
94 public DeferredResult<ResponseEntity<Device>> devicesSync(@PathVariable String deviceId){ 134 public DeferredResult<ResponseEntity<Device>> devicesSync(@PathVariable String deviceId){
95 135
@@ -117,8 +157,17 @@ public class DeviceQuery { @@ -117,8 +157,17 @@ public class DeviceQuery {
117 resultHolder.put(DeferredResultHolder.CALLBACK_CMD_CATALOG+deviceId, result); 157 resultHolder.put(DeferredResultHolder.CALLBACK_CMD_CATALOG+deviceId, result);
118 return result; 158 return result;
119 } 159 }
120 -  
121 - @PostMapping("/devices/{deviceId}/delete") 160 +
  161 + /**
  162 + * 移除设备
  163 + * @param deviceId 设备id
  164 + * @return
  165 + */
  166 + @ApiOperation("移除设备")
  167 + @ApiImplicitParams({
  168 + @ApiImplicitParam(name="deviceId", value = "设备id", required = true),
  169 + })
  170 + @DeleteMapping("/devices/{deviceId}/delete")
122 public ResponseEntity<String> delete(@PathVariable String deviceId){ 171 public ResponseEntity<String> delete(@PathVariable String deviceId){
123 172
124 if (logger.isDebugEnabled()) { 173 if (logger.isDebugEnabled()) {
@@ -140,13 +189,27 @@ public class DeviceQuery { @@ -140,13 +189,27 @@ public class DeviceQuery {
140 } 189 }
141 190
142 /** 191 /**
143 - * 分页查询通道数 192 + * 分页查询子目录通道
  193 + * @param deviceId 通道id
144 * @param channelId 通道id 194 * @param channelId 通道id
145 * @param page 当前页 195 * @param page 当前页
146 * @param count 每页条数 196 * @param count 每页条数
  197 + * @param query 查询内容
  198 + * @param online 是否在线
  199 + * @param channelType 通道类型
147 * @return 子通道列表 200 * @return 子通道列表
148 */ 201 */
149 - @GetMapping("/subChannels/{deviceId}/{channelId}/channels") 202 + @ApiOperation("分页查询子目录通道")
  203 + @ApiImplicitParams({
  204 + @ApiImplicitParam(name="deviceId", value = "设备id", required = true),
  205 + @ApiImplicitParam(name="channelId", value = "通道id", required = true),
  206 + @ApiImplicitParam(name="page", value = "当前页", required = true),
  207 + @ApiImplicitParam(name="count", value = "每页条数", required = true),
  208 + @ApiImplicitParam(name="query", value = "查询内容"),
  209 + @ApiImplicitParam(name="online", value = "是否在线"),
  210 + @ApiImplicitParam(name="channelType", value = "通道类型, 子目录"),
  211 + })
  212 + @GetMapping("/sub_channels/{deviceId}/{channelId}/channels")
150 public ResponseEntity<PageInfo> subChannels(@PathVariable String deviceId, 213 public ResponseEntity<PageInfo> subChannels(@PathVariable String deviceId,
151 @PathVariable String channelId, 214 @PathVariable String channelId,
152 int page, 215 int page,
@@ -168,14 +231,36 @@ public class DeviceQuery { @@ -168,14 +231,36 @@ public class DeviceQuery {
168 return new ResponseEntity<>(pageResult,HttpStatus.OK); 231 return new ResponseEntity<>(pageResult,HttpStatus.OK);
169 } 232 }
170 233
  234 + /**
  235 + * 更新通道信息
  236 + * @param deviceId 设备id
  237 + * @param channel 通道
  238 + * @return
  239 + */
  240 + @ApiOperation("更新通道信息")
  241 + @ApiImplicitParams({
  242 + @ApiImplicitParam(name="deviceId", value = "设备id", required = true),
  243 + @ApiImplicitParam(name="channel", value = "通道", required = true),
  244 + })
171 @PostMapping("/channel/update/{deviceId}") 245 @PostMapping("/channel/update/{deviceId}")
172 public ResponseEntity<PageInfo> updateChannel(@PathVariable String deviceId,DeviceChannel channel){ 246 public ResponseEntity<PageInfo> updateChannel(@PathVariable String deviceId,DeviceChannel channel){
173 storager.updateChannel(deviceId, channel); 247 storager.updateChannel(deviceId, channel);
174 return new ResponseEntity<>(null,HttpStatus.OK); 248 return new ResponseEntity<>(null,HttpStatus.OK);
175 } 249 }
176 250
177 - @GetMapping("/devices/{deviceId}/transport/{streamMode}")  
178 - @PostMapping("/devices/{deviceId}/transport/{streamMode}") 251 + /**
  252 + * 修改数据流传输模式
  253 + * @param deviceId 设备id
  254 + * @param streamMode 数据流传输模式
  255 + * @return
  256 + */
  257 + @ApiOperation("修改数据流传输模式")
  258 + @ApiImplicitParams({
  259 + @ApiImplicitParam(name = "deviceId", value = "设备id", required = true),
  260 + @ApiImplicitParam(name = "streamMode", value = "数据流传输模式, 取值:" +
  261 + "UDP(udp传输),TCP-ACTIVE(tcp主动模式,暂不支持),TCP-PASSIVE(tcp被动模式)"),
  262 + })
  263 + @PostMapping("/transport/{deviceId}/{streamMode}")
179 public ResponseEntity<PageInfo> updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){ 264 public ResponseEntity<PageInfo> updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){
180 Device device = storager.queryVideoDevice(deviceId); 265 Device device = storager.queryVideoDevice(deviceId);
181 device.setStreamMode(streamMode); 266 device.setStreamMode(streamMode);
@@ -186,8 +271,12 @@ public class DeviceQuery { @@ -186,8 +271,12 @@ public class DeviceQuery {
186 /** 271 /**
187 * 设备状态查询请求API接口 272 * 设备状态查询请求API接口
188 * 273 *
189 - * @param deviceId 274 + * @param deviceId 设备id
190 */ 275 */
  276 + @ApiOperation("设备状态查询")
  277 + @ApiImplicitParams({
  278 + @ApiImplicitParam(name = "deviceId", value = "设备id", required = true),
  279 + })
191 @GetMapping("/devices/{deviceId}/status") 280 @GetMapping("/devices/{deviceId}/status")
192 public DeferredResult<ResponseEntity<String>> deviceStatusApi(@PathVariable String deviceId) { 281 public DeferredResult<ResponseEntity<String>> deviceStatusApi(@PathVariable String deviceId) {
193 if (logger.isDebugEnabled()) { 282 if (logger.isDebugEnabled()) {
@@ -216,9 +305,25 @@ public class DeviceQuery { @@ -216,9 +305,25 @@ public class DeviceQuery {
216 305
217 /** 306 /**
218 * 设备报警查询请求API接口 307 * 设备报警查询请求API接口
219 - *  
220 - * @param deviceId 308 + * @param deviceId 设备id
  309 + * @param startPriority 报警起始级别(可选)
  310 + * @param endPriority 报警终止级别(可选)
  311 + * @param alarmMethod 报警方式条件(可选)
  312 + * @param alarmType 报警类型
  313 + * @param startTime 报警发生起始时间(可选)
  314 + * @param endTime 报警发生终止时间(可选)
  315 + * @return true = 命令发送成功
221 */ 316 */
  317 + @ApiOperation("设备报警查询")
  318 + @ApiImplicitParams({
  319 + @ApiImplicitParam(name = "deviceId", value = "设备id", required = true),
  320 + @ApiImplicitParam(name = "startPriority", value = "报警起始级别"),
  321 + @ApiImplicitParam(name = "endPriority", value = "报警终止级别"),
  322 + @ApiImplicitParam(name = "alarmMethod", value = "报警方式条件"),
  323 + @ApiImplicitParam(name = "alarmType", value = "报警类型"),
  324 + @ApiImplicitParam(name = "startTime", value = "报警发生起始时间"),
  325 + @ApiImplicitParam(name = "endTime", value = "报警发生终止时间"),
  326 + })
222 @GetMapping("/alarm/{deviceId}") 327 @GetMapping("/alarm/{deviceId}")
223 public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId, 328 public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId,
224 @RequestParam(required = false) String startPriority, 329 @RequestParam(required = false) String startPriority,
src/main/java/com/genersoft/iot/vmp/vmanager/gbStream/GbStreamController.java
@@ -5,11 +5,16 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorager; @@ -5,11 +5,16 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
5 import com.genersoft.iot.vmp.vmanager.gbStream.bean.GbStreamParam; 5 import com.genersoft.iot.vmp.vmanager.gbStream.bean.GbStreamParam;
6 import com.genersoft.iot.vmp.service.IGbStreamService; 6 import com.genersoft.iot.vmp.service.IGbStreamService;
7 import com.github.pagehelper.PageInfo; 7 import com.github.pagehelper.PageInfo;
  8 +import io.swagger.annotations.Api;
  9 +import io.swagger.annotations.ApiImplicitParam;
  10 +import io.swagger.annotations.ApiImplicitParams;
  11 +import io.swagger.annotations.ApiOperation;
8 import org.slf4j.Logger; 12 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory; 13 import org.slf4j.LoggerFactory;
10 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.web.bind.annotation.*; 15 import org.springframework.web.bind.annotation.*;
12 16
  17 +@Api(tags = "视频流关联到级联平台")
13 @CrossOrigin 18 @CrossOrigin
14 @RestController 19 @RestController
15 @RequestMapping("/api/gbStream") 20 @RequestMapping("/api/gbStream")
@@ -24,7 +29,18 @@ public class GbStreamController { @@ -24,7 +29,18 @@ public class GbStreamController {
24 private IVideoManagerStorager storager; 29 private IVideoManagerStorager storager;
25 30
26 31
27 - @RequestMapping(value = "/list") 32 + /**
  33 + * 查询国标通道
  34 + * @param page 当前页
  35 + * @param count 每页条数
  36 + * @return
  37 + */
  38 + @ApiOperation("查询国标通道")
  39 + @ApiImplicitParams({
  40 + @ApiImplicitParam(name = "page", value = "当前页", required = true ),
  41 + @ApiImplicitParam(name = "count", value = "每页条数", required = true ),
  42 + })
  43 + @GetMapping(value = "/list")
28 @ResponseBody 44 @ResponseBody
29 public PageInfo<GbStream> list(@RequestParam(required = false)Integer page, 45 public PageInfo<GbStream> list(@RequestParam(required = false)Integer page,
30 @RequestParam(required = false)Integer count){ 46 @RequestParam(required = false)Integer count){
@@ -33,11 +49,18 @@ public class GbStreamController { @@ -33,11 +49,18 @@ public class GbStreamController {
33 } 49 }
34 50
35 51
36 - @RequestMapping(value = "/del") 52 + /**
  53 + * 移除国标关联
  54 + * @param gbStreamParam
  55 + * @return
  56 + */
  57 + @ApiOperation("移除国标关联")
  58 + @ApiImplicitParams({
  59 + @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true ),
  60 + })
  61 + @DeleteMapping(value = "/del")
37 @ResponseBody 62 @ResponseBody
38 public Object del(@RequestBody GbStreamParam gbStreamParam){ 63 public Object del(@RequestBody GbStreamParam gbStreamParam){
39 - System.out.println(2222);  
40 - System.out.println(gbStreamParam.getGbStreams().size());  
41 if (gbStreamService.delPlatformInfo(gbStreamParam.getGbStreams())) { 64 if (gbStreamService.delPlatformInfo(gbStreamParam.getGbStreams())) {
42 return "success"; 65 return "success";
43 }else { 66 }else {
@@ -46,11 +69,18 @@ public class GbStreamController { @@ -46,11 +69,18 @@ public class GbStreamController {
46 69
47 } 70 }
48 71
49 - @RequestMapping(value = "/add") 72 + /**
  73 + * 保存国标关联
  74 + * @param gbStreamParam
  75 + * @return
  76 + */
  77 + @ApiOperation("保存国标关联")
  78 + @ApiImplicitParams({
  79 + @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true ),
  80 + })
  81 + @PostMapping(value = "/add")
50 @ResponseBody 82 @ResponseBody
51 public Object add(@RequestBody GbStreamParam gbStreamParam){ 83 public Object add(@RequestBody GbStreamParam gbStreamParam){
52 - System.out.println(3333);  
53 - System.out.println(gbStreamParam.getGbStreams().size());  
54 if (gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId())) { 84 if (gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId())) {
55 return "success"; 85 return "success";
56 }else { 86 }else {
src/main/java/com/genersoft/iot/vmp/vmanager/media/MediaController.java
@@ -9,6 +9,10 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage; @@ -9,6 +9,10 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
9 import com.genersoft.iot.vmp.service.IMediaService; 9 import com.genersoft.iot.vmp.service.IMediaService;
10 import com.genersoft.iot.vmp.service.IStreamProxyService; 10 import com.genersoft.iot.vmp.service.IStreamProxyService;
11 import com.genersoft.iot.vmp.storager.IVideoManagerStorager; 11 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
  12 +import io.swagger.annotations.Api;
  13 +import io.swagger.annotations.ApiImplicitParam;
  14 +import io.swagger.annotations.ApiImplicitParams;
  15 +import io.swagger.annotations.ApiOperation;
12 import org.slf4j.Logger; 16 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory; 17 import org.slf4j.LoggerFactory;
14 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,6 +20,7 @@ import org.springframework.stereotype.Controller; @@ -16,6 +20,7 @@ import org.springframework.stereotype.Controller;
16 import org.springframework.web.bind.annotation.*; 20 import org.springframework.web.bind.annotation.*;
17 21
18 22
  23 +@Api(tags = "媒体流相关")
19 @Controller 24 @Controller
20 @CrossOrigin 25 @CrossOrigin
21 @RequestMapping(value = "/api/media") 26 @RequestMapping(value = "/api/media")
@@ -33,8 +38,17 @@ public class MediaController { @@ -33,8 +38,17 @@ public class MediaController {
33 private IMediaService mediaService; 38 private IMediaService mediaService;
34 39
35 40
36 -  
37 - 41 + /**
  42 + * 根据应用名和流id获取播放地址
  43 + * @param app 应用名
  44 + * @param stream 流id
  45 + * @return
  46 + */
  47 + @ApiOperation("根据应用名和流id获取播放地址")
  48 + @ApiImplicitParams({
  49 + @ApiImplicitParam(name = "app", value = "应用名"),
  50 + @ApiImplicitParam(name = "stream", value = "流id"),
  51 + })
38 @RequestMapping(value = "/getStreamInfoByAppAndStream") 52 @RequestMapping(value = "/getStreamInfoByAppAndStream")
39 @ResponseBody 53 @ResponseBody
40 public StreamInfo getStreamInfoByAppAndStream(String app, String stream){ 54 public StreamInfo getStreamInfoByAppAndStream(String app, String stream){
src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java
@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorager; @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
8 import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce; 8 import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
9 import com.genersoft.iot.vmp.vmanager.platform.bean.UpdateChannelParam; 9 import com.genersoft.iot.vmp.vmanager.platform.bean.UpdateChannelParam;
10 import com.github.pagehelper.PageInfo; 10 import com.github.pagehelper.PageInfo;
  11 +import io.swagger.annotations.Api;
11 import org.slf4j.Logger; 12 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory; 13 import org.slf4j.LoggerFactory;
13 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,9 +18,13 @@ import org.springframework.util.StringUtils; @@ -17,9 +18,13 @@ import org.springframework.util.StringUtils;
17 import org.springframework.web.bind.annotation.*; 18 import org.springframework.web.bind.annotation.*;
18 import com.genersoft.iot.vmp.conf.SipConfig; 19 import com.genersoft.iot.vmp.conf.SipConfig;
19 20
  21 +/**
  22 + * 级联平台管理
  23 + */
  24 +@Api("级联平台管理")
20 @CrossOrigin 25 @CrossOrigin
21 @RestController 26 @RestController
22 -@RequestMapping("/api") 27 +@RequestMapping("/api/platform")
23 public class PlatformController { 28 public class PlatformController {
24 29
25 private final static Logger logger = LoggerFactory.getLogger(PlatformController.class); 30 private final static Logger logger = LoggerFactory.getLogger(PlatformController.class);
@@ -36,7 +41,7 @@ public class PlatformController { @@ -36,7 +41,7 @@ public class PlatformController {
36 @Autowired 41 @Autowired
37 private SipConfig sipConfig; 42 private SipConfig sipConfig;
38 43
39 - @GetMapping("/platforms/serverconfig") 44 + @GetMapping("/server_config")
40 public ResponseEntity<JSONObject> serverConfig() { 45 public ResponseEntity<JSONObject> serverConfig() {
41 JSONObject result = new JSONObject(); 46 JSONObject result = new JSONObject();
42 result.put("deviceIp", sipConfig.getSipIp()); 47 result.put("deviceIp", sipConfig.getSipIp());
@@ -46,7 +51,7 @@ public class PlatformController { @@ -46,7 +51,7 @@ public class PlatformController {
46 return new ResponseEntity<>(result, HttpStatus.OK); 51 return new ResponseEntity<>(result, HttpStatus.OK);
47 } 52 }
48 53
49 - @GetMapping("/platforms/{count}/{page}") 54 + @GetMapping("/query/{count}/{page}")
50 public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count){ 55 public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count){
51 56
52 if (logger.isDebugEnabled()) { 57 if (logger.isDebugEnabled()) {
@@ -55,7 +60,7 @@ public class PlatformController { @@ -55,7 +60,7 @@ public class PlatformController {
55 return storager.queryParentPlatformList(page, count); 60 return storager.queryParentPlatformList(page, count);
56 } 61 }
57 62
58 - @RequestMapping("/platforms/save") 63 + @PostMapping("/save")
59 @ResponseBody 64 @ResponseBody
60 public ResponseEntity<String> savePlatform(@RequestBody ParentPlatform parentPlatform){ 65 public ResponseEntity<String> savePlatform(@RequestBody ParentPlatform parentPlatform){
61 66
@@ -98,18 +103,19 @@ public class PlatformController { @@ -98,18 +103,19 @@ public class PlatformController {
98 } 103 }
99 } 104 }
100 105
101 - @RequestMapping("/platforms/delete") 106 + @DeleteMapping("/delete/{serverGBId}")
102 @ResponseBody 107 @ResponseBody
103 - public ResponseEntity<String> deletePlatform(@RequestBody ParentPlatform parentPlatform){ 108 + public ResponseEntity<String> deletePlatform(@PathVariable String serverGBId){
104 109
105 if (logger.isDebugEnabled()) { 110 if (logger.isDebugEnabled()) {
106 logger.debug("删除上级平台API调用"); 111 logger.debug("删除上级平台API调用");
107 } 112 }
108 - if (StringUtils.isEmpty(parentPlatform.getServerGBId()) 113 + if (StringUtils.isEmpty(serverGBId)
109 ){ 114 ){
110 return new ResponseEntity<>("missing parameters", HttpStatus.BAD_REQUEST); 115 return new ResponseEntity<>("missing parameters", HttpStatus.BAD_REQUEST);
111 } 116 }
112 - 117 + ParentPlatform parentPlatform = storager.queryParentPlatById(serverGBId);
  118 + if (parentPlatform == null) return new ResponseEntity<>("fail", HttpStatus.OK);
113 // 发送离线消息,无论是否成功都删除缓存 119 // 发送离线消息,无论是否成功都删除缓存
114 commanderForPlatform.unregister(parentPlatform, (event -> { 120 commanderForPlatform.unregister(parentPlatform, (event -> {
115 // 清空redis缓存 121 // 清空redis缓存
@@ -133,7 +139,7 @@ public class PlatformController { @@ -133,7 +139,7 @@ public class PlatformController {
133 } 139 }
134 } 140 }
135 141
136 - @RequestMapping("/platforms/exit/{deviceGbId}") 142 + @GetMapping("/exit/{deviceGbId}")
137 @ResponseBody 143 @ResponseBody
138 public ResponseEntity<String> exitPlatform(@PathVariable String deviceGbId){ 144 public ResponseEntity<String> exitPlatform(@PathVariable String deviceGbId){
139 145
@@ -144,7 +150,7 @@ public class PlatformController { @@ -144,7 +150,7 @@ public class PlatformController {
144 return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK); 150 return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK);
145 } 151 }
146 152
147 - @RequestMapping("/platforms/channelList") 153 + @GetMapping("/channel_list")
148 @ResponseBody 154 @ResponseBody
149 public PageInfo<ChannelReduce> channelList(int page, int count, 155 public PageInfo<ChannelReduce> channelList(int page, int count,
150 @RequestParam(required = false) String platformId, 156 @RequestParam(required = false) String platformId,
@@ -167,7 +173,7 @@ public class PlatformController { @@ -167,7 +173,7 @@ public class PlatformController {
167 } 173 }
168 174
169 175
170 - @RequestMapping("/platforms/updateChannelForGB") 176 + @PostMapping("/update_channel_for_gb")
171 @ResponseBody 177 @ResponseBody
172 public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param){ 178 public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param){
173 179
@@ -179,7 +185,7 @@ public class PlatformController { @@ -179,7 +185,7 @@ public class PlatformController {
179 return new ResponseEntity<>(String.valueOf(result > 0), HttpStatus.OK); 185 return new ResponseEntity<>(String.valueOf(result > 0), HttpStatus.OK);
180 } 186 }
181 187
182 - @RequestMapping("/platforms/delChannelForGB") 188 + @DeleteMapping("/del_channel_for_gb")
183 @ResponseBody 189 @ResponseBody
184 public ResponseEntity<String> delChannelForGB(@RequestBody UpdateChannelParam param){ 190 public ResponseEntity<String> delChannelForGB(@RequestBody UpdateChannelParam param){
185 191
src/main/java/com/genersoft/iot/vmp/vmanager/play/PlayController.java
@@ -33,7 +33,7 @@ import javax.sip.message.Response; @@ -33,7 +33,7 @@ import javax.sip.message.Response;
33 33
34 @CrossOrigin 34 @CrossOrigin
35 @RestController 35 @RestController
36 -@RequestMapping("/api") 36 +@RequestMapping("/api/play")
37 public class PlayController { 37 public class PlayController {
38 38
39 private final static Logger logger = LoggerFactory.getLogger(PlayController.class); 39 private final static Logger logger = LoggerFactory.getLogger(PlayController.class);
@@ -59,7 +59,7 @@ public class PlayController { @@ -59,7 +59,7 @@ public class PlayController {
59 @Autowired 59 @Autowired
60 private IMediaService mediaService; 60 private IMediaService mediaService;
61 61
62 - @GetMapping("/play/{deviceId}/{channelId}") 62 + @GetMapping("/start/{deviceId}/{channelId}")
63 public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, 63 public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId,
64 @PathVariable String channelId) { 64 @PathVariable String channelId) {
65 65
@@ -79,7 +79,7 @@ public class PlayController { @@ -79,7 +79,7 @@ public class PlayController {
79 return playResult.getResult(); 79 return playResult.getResult();
80 } 80 }
81 81
82 - @PostMapping("/play/{streamId}/stop") 82 + @PostMapping("/stop/{streamId}")
83 public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String streamId) { 83 public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String streamId) {
84 84
85 logger.debug(String.format("设备预览/回放停止API调用,streamId:%s", streamId)); 85 logger.debug(String.format("设备预览/回放停止API调用,streamId:%s", streamId));
@@ -139,7 +139,7 @@ public class PlayController { @@ -139,7 +139,7 @@ public class PlayController {
139 * @param streamId 流ID 139 * @param streamId 流ID
140 * @return 140 * @return
141 */ 141 */
142 - @PostMapping("/play/{streamId}/convert") 142 + @PostMapping("/convert/{streamId}")
143 public ResponseEntity<String> playConvert(@PathVariable String streamId) { 143 public ResponseEntity<String> playConvert(@PathVariable String streamId) {
144 StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId); 144 StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
145 if (streamInfo == null) { 145 if (streamInfo == null) {
@@ -179,7 +179,7 @@ public class PlayController { @@ -179,7 +179,7 @@ public class PlayController {
179 * @param key 179 * @param key
180 * @return 180 * @return
181 */ 181 */
182 - @PostMapping("/play/convert/stop/{key}") 182 + @PostMapping("/convertStop/{key}")
183 public ResponseEntity<String> playConvertStop(@PathVariable String key) { 183 public ResponseEntity<String> playConvertStop(@PathVariable String key) {
184 184
185 JSONObject jsonObject = zlmresTfulUtils.delFFmpegSource(key); 185 JSONObject jsonObject = zlmresTfulUtils.delFFmpegSource(key);
src/main/java/com/genersoft/iot/vmp/vmanager/playback/PlaybackController.java
@@ -28,7 +28,7 @@ import java.util.UUID; @@ -28,7 +28,7 @@ import java.util.UUID;
28 28
29 @CrossOrigin 29 @CrossOrigin
30 @RestController 30 @RestController
31 -@RequestMapping("/api") 31 +@RequestMapping("/api/playback")
32 public class PlaybackController { 32 public class PlaybackController {
33 33
34 private final static Logger logger = LoggerFactory.getLogger(PlaybackController.class); 34 private final static Logger logger = LoggerFactory.getLogger(PlaybackController.class);
@@ -51,7 +51,7 @@ public class PlaybackController { @@ -51,7 +51,7 @@ public class PlaybackController {
51 @Autowired 51 @Autowired
52 private DeferredResultHolder resultHolder; 52 private DeferredResultHolder resultHolder;
53 53
54 - @GetMapping("/playback/{deviceId}/{channelId}") 54 + @GetMapping("/start/{deviceId}/{channelId}")
55 public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, @PathVariable String channelId, String startTime, 55 public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, @PathVariable String channelId, String startTime,
56 String endTime) { 56 String endTime) {
57 57
@@ -89,7 +89,7 @@ public class PlaybackController { @@ -89,7 +89,7 @@ public class PlaybackController {
89 return result; 89 return result;
90 } 90 }
91 91
92 - @RequestMapping("/playback/{ssrc}/stop") 92 + @RequestMapping("/stop/{ssrc}")
93 public ResponseEntity<String> playStop(@PathVariable String ssrc) { 93 public ResponseEntity<String> playStop(@PathVariable String ssrc) {
94 94
95 cmder.streamByeCmd(ssrc); 95 cmder.streamByeCmd(ssrc);
src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java 0 → 100644
  1 +package com.genersoft.iot.vmp.vmanager.server;
  2 +
  3 +import com.genersoft.iot.vmp.VManageBootstrap;
  4 +import com.genersoft.iot.vmp.utils.SpringBeanFactory;
  5 +import com.genersoft.iot.vmp.vmanager.gbStream.bean.GbStreamParam;
  6 +import gov.nist.javax.sip.SipStackImpl;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.context.ConfigurableApplicationContext;
  9 +import org.springframework.web.bind.annotation.*;
  10 +
  11 +import javax.sip.ListeningPoint;
  12 +import javax.sip.ObjectInUseException;
  13 +import javax.sip.SipProvider;
  14 +import java.util.Iterator;
  15 +
  16 +@CrossOrigin
  17 +@RestController
  18 +@RequestMapping("/api/server")
  19 +public class ServerController {
  20 +
  21 + @Autowired
  22 + private ConfigurableApplicationContext context;
  23 +
  24 +
  25 + @RequestMapping(value = "/restart")
  26 + @ResponseBody
  27 + public Object restart(){
  28 + Thread restartThread = new Thread(new Runnable() {
  29 + @Override
  30 + public void run() {
  31 + try {
  32 + Thread.sleep(3000);
  33 + SipProvider up = (SipProvider) SpringBeanFactory.getBean("udpSipProvider");
  34 + SipStackImpl stack = (SipStackImpl)up.getSipStack();
  35 + stack.stop();
  36 + Iterator listener = stack.getListeningPoints();
  37 + while (listener.hasNext()) {
  38 + stack.deleteListeningPoint((ListeningPoint) listener.next());
  39 + }
  40 + Iterator providers = stack.getSipProviders();
  41 + while (providers.hasNext()) {
  42 + stack.deleteSipProvider((SipProvider) providers.next());
  43 + }
  44 + VManageBootstrap.restart();
  45 + } catch (InterruptedException ignored) {
  46 + } catch (ObjectInUseException e) {
  47 + e.printStackTrace();
  48 + }
  49 + }
  50 + });
  51 +
  52 + restartThread.setDaemon(false);
  53 + restartThread.start();
  54 + return "success";
  55 + }
  56 +}
src/main/resources/application-dev.yml
@@ -96,4 +96,10 @@ logging: @@ -96,4 +96,10 @@ logging:
96 # [根据业务需求配置] 96 # [根据业务需求配置]
97 userSettings: 97 userSettings:
98 # 保存移动位置历史轨迹:true:保留历史数据,false:仅保留最后的位置(默认) 98 # 保存移动位置历史轨迹:true:保留历史数据,false:仅保留最后的位置(默认)
99 - savePositionHistory: false  
100 \ No newline at end of file 99 \ No newline at end of file
  100 + savePositionHistory: false
  101 +
  102 +# 在线文档: swagger-ui(生产环境建议关闭)
  103 +springfox:
  104 + documentation:
  105 + swagger-ui:
  106 + enabled: true
101 \ No newline at end of file 107 \ No newline at end of file
src/main/resources/wvp.sqlite
No preview for this file type
web_src/src/components/DeviceList.vue
@@ -136,7 +136,7 @@ @@ -136,7 +136,7 @@
136 getDeviceList: function() { 136 getDeviceList: function() {
137 let that = this; 137 let that = this;
138 this.getDeviceListLoading = true; 138 this.getDeviceListLoading = true;
139 - this.$axios.get(`/api/devices`,{ 139 + this.$axios.get(`/api/device/query/devices`,{
140 params: { 140 params: {
141 page: that.currentPage, 141 page: that.currentPage,
142 count: that.count 142 count: that.count
@@ -167,13 +167,12 @@ @@ -167,13 +167,12 @@
167 //gb28181平台对接 167 //gb28181平台对接
168 //刷新设备信息 168 //刷新设备信息
169 refDevice: function(itemData) { 169 refDevice: function(itemData) {
170 - ///api/devices/{deviceId}/sync  
171 console.log("刷新对应设备:" + itemData.deviceId); 170 console.log("刷新对应设备:" + itemData.deviceId);
172 var that = this; 171 var that = this;
173 that.$refs[itemData.deviceId + 'refbtn' ].loading = true; 172 that.$refs[itemData.deviceId + 'refbtn' ].loading = true;
174 this.$axios({ 173 this.$axios({
175 method: 'post', 174 method: 'post',
176 - url: '/api/devices/' + itemData.deviceId + '/sync' 175 + url: '/api/device/query/devices/' + itemData.deviceId + '/sync'
177 }).then(function(res) { 176 }).then(function(res) {
178 console.log("刷新设备结果:"+JSON.stringify(res)); 177 console.log("刷新设备结果:"+JSON.stringify(res));
179 if (!res.data.deviceId) { 178 if (!res.data.deviceId) {
@@ -217,7 +216,7 @@ @@ -217,7 +216,7 @@
217 let that = this; 216 let that = this;
218 this.$axios({ 217 this.$axios({
219 method: 'get', 218 method: 'get',
220 - url: '/api/devices/' + row.deviceId + '/transport/' + row.streamMode 219 + url: '/api/device/query/transport' + row.deviceId + '/' + row.streamMode
221 }).then(function(res) { 220 }).then(function(res) {
222 221
223 }).catch(function(e) { 222 }).catch(function(e) {
web_src/src/components/ParentPlatformList.vue
@@ -121,7 +121,7 @@ export default { @@ -121,7 +121,7 @@ export default {
121 }, 121 },
122 deletePlatformCommit: function(platform) { 122 deletePlatformCommit: function(platform) {
123 var that = this; 123 var that = this;
124 - that.$axios.post(`/api/platforms/delete`, platform) 124 + that.$axios.delete(`/api/platform/delete/${platform.serverGBId}`)
125 .then(function (res) { 125 .then(function (res) {
126 if (res.data == "success") { 126 if (res.data == "success") {
127 that.$message({ 127 that.$message({
@@ -155,7 +155,7 @@ export default { @@ -155,7 +155,7 @@ export default {
155 getPlatformList: function() { 155 getPlatformList: function() {
156 let that = this; 156 let that = this;
157 157
158 - this.$axios.get(`/api/platforms/${that.count}/${that.currentPage}`) 158 + this.$axios.get(`/api/platform/query/${that.count}/${that.currentPage}`)
159 .then(function (res) { 159 .then(function (res) {
160 that.total = res.data.total; 160 that.total = res.data.total;
161 that.platformList = res.data.list; 161 that.platformList = res.data.list;
web_src/src/components/PushVideoList.vue
@@ -15,8 +15,6 @@ @@ -15,8 +15,6 @@
15 </el-table-column> 15 </el-table-column>
16 <el-table-column prop="stream" label="流ID" width="240" align="center"> 16 <el-table-column prop="stream" label="流ID" width="240" align="center">
17 </el-table-column> 17 </el-table-column>
18 - <el-table-column prop="totalReaderCount" label="在线人数" width="240" align="center">  
19 - </el-table-column>  
20 <el-table-column prop="gbId" label="国标编码" width="150" align="center"> 18 <el-table-column prop="gbId" label="国标编码" width="150" align="center">
21 </el-table-column> 19 </el-table-column>
22 <el-table-column label="开始时间" align="center" > 20 <el-table-column label="开始时间" align="center" >
web_src/src/components/UiHeader.vue
@@ -71,6 +71,10 @@ export default { @@ -71,6 +71,10 @@ export default {
71 }, 71 },
72 destroyed() { 72 destroyed() {
73 window.removeEventListener('beforeunload', e => this.beforeunloadHandler(e)) 73 window.removeEventListener('beforeunload', e => this.beforeunloadHandler(e))
  74 + this.sseSource.removeEventListener('open', null);
  75 + this.sseSource.removeEventListener('message', null);
  76 + this.sseSource.removeEventListener('error', null);
  77 + this.sseSource.close();
74 // window.removeEventListener('unload', e => this.unloadHandler(e)) 78 // window.removeEventListener('unload', e => this.unloadHandler(e))
75 }, 79 },
76 } 80 }
web_src/src/components/channelList.vue
@@ -154,7 +154,7 @@ export default { @@ -154,7 +154,7 @@ export default {
154 getDeviceChannelList: function () { 154 getDeviceChannelList: function () {
155 let that = this; 155 let that = this;
156 156
157 - this.$axios.get(`/api/devices/${this.$route.params.deviceId}/channels`, { 157 + this.$axios.get(`/api/device/query/devices/${this.$route.params.deviceId}/channels`, {
158 params: { 158 params: {
159 page: that.currentPage, 159 page: that.currentPage,
160 count: that.count, 160 count: that.count,
@@ -188,7 +188,7 @@ export default { @@ -188,7 +188,7 @@ export default {
188 let that = this; 188 let that = this;
189 this.$axios({ 189 this.$axios({
190 method: 'get', 190 method: 'get',
191 - url: '/api/play/' + deviceId + '/' + channelId 191 + url: '/api/play/start/' + deviceId + '/' + channelId
192 }).then(function (res) { 192 }).then(function (res) {
193 console.log(res.data) 193 console.log(res.data)
194 let streamId = res.data.streamId; 194 let streamId = res.data.streamId;
@@ -216,7 +216,7 @@ export default { @@ -216,7 +216,7 @@ export default {
216 var that = this; 216 var that = this;
217 this.$axios({ 217 this.$axios({
218 method: 'post', 218 method: 'post',
219 - url: '/api/play/' + itemData.streamId + '/stop' 219 + url: '/api/play/stop/' + itemData.streamId
220 }).then(function (res) { 220 }).then(function (res) {
221 console.log(JSON.stringify(res)); 221 console.log(JSON.stringify(res));
222 that.initData(); 222 that.initData();
@@ -251,7 +251,7 @@ export default { @@ -251,7 +251,7 @@ export default {
251 showSubchannels: function (channelId) { 251 showSubchannels: function (channelId) {
252 let that = this; 252 let that = this;
253 253
254 - this.$axios.get(`/api/subChannels/${this.deviceId}/${this.parentChannelId}/channels`, { 254 + this.$axios.get(`/api/device/query/sub_channels/${this.deviceId}/${this.parentChannelId}/channels`, {
255 params: { 255 params: {
256 page: that.currentPage, 256 page: that.currentPage,
257 count: that.count, 257 count: that.count,
@@ -282,7 +282,7 @@ export default { @@ -282,7 +282,7 @@ export default {
282 console.log(row) 282 console.log(row)
283 this.$axios({ 283 this.$axios({
284 method: 'post', 284 method: 'post',
285 - url: `/api/channel/update/${this.deviceId}`, 285 + url: `/api/device/query/channel/update/${this.deviceId}`,
286 params: row 286 params: row
287 }).then(function (res) { 287 }).then(function (res) {
288 console.log(JSON.stringify(res)); 288 console.log(JSON.stringify(res));
web_src/src/components/devicePosition.vue
@@ -171,7 +171,7 @@ export default { @@ -171,7 +171,7 @@ export default {
171 this.endTime = null; 171 this.endTime = null;
172 } 172 }
173 let self = this; 173 let self = this;
174 - this.$axios.get(`/api/positions/${this.deviceId}/history`, { 174 + this.$axios.get(`/api/position/history/${this.deviceId}`, {
175 params: { 175 params: {
176 start: self.startTime, 176 start: self.startTime,
177 end: self.endTime, 177 end: self.endTime,
@@ -202,7 +202,7 @@ export default { @@ -202,7 +202,7 @@ export default {
202 this.mapPointList = []; 202 this.mapPointList = [];
203 this.mobilePositionList = []; 203 this.mobilePositionList = [];
204 let self = this; 204 let self = this;
205 - this.$axios.get(`/api/positions/${this.deviceId}/latest`) 205 + this.$axios.get(`/api/position/latest/${this.deviceId}`)
206 .then(function (res) { 206 .then(function (res) {
207 console.log(res.data); 207 console.log(res.data);
208 self.total = res.data.length; 208 self.total = res.data.length;
@@ -226,7 +226,7 @@ export default { @@ -226,7 +226,7 @@ export default {
226 }, 226 },
227 subscribeMobilePosition: function() { 227 subscribeMobilePosition: function() {
228 let self = this; 228 let self = this;
229 - this.$axios.get(`/api/positions/${this.deviceId}/subscribe`, { 229 + this.$axios.get(`/api/position/subscribe/${this.deviceId}`, {
230 params: { 230 params: {
231 expires: self.expired, 231 expires: self.expired,
232 interval: self.interval, 232 interval: self.interval,
@@ -241,7 +241,7 @@ export default { @@ -241,7 +241,7 @@ export default {
241 }, 241 },
242 unSubscribeMobilePosition: function() { 242 unSubscribeMobilePosition: function() {
243 let self = this; 243 let self = this;
244 - this.$axios.get(`/api/positions/${this.deviceId}/subscribe`, { 244 + this.$axios.get(`/api/position/subscribe/${this.deviceId}`, {
245 params: { 245 params: {
246 expires: 0, 246 expires: 0,
247 interval: self.interval, 247 interval: self.interval,
web_src/src/components/dialog/StreamProxyEdit.vue
@@ -176,7 +176,7 @@ export default { @@ -176,7 +176,7 @@ export default {
176 var result = false; 176 var result = false;
177 var that = this; 177 var that = this;
178 await that.$axios 178 await that.$axios
179 - .post(`/api/platforms/exit/${deviceGbId}`) 179 + .post(`/api/platform/exit/${deviceGbId}`)
180 .then(function (res) { 180 .then(function (res) {
181 result = res.data; 181 result = res.data;
182 }) 182 })
web_src/src/components/dialog/addStreamTOGB.vue
@@ -119,7 +119,7 @@ export default { @@ -119,7 +119,7 @@ export default {
119 var result = false; 119 var result = false;
120 var that = this; 120 var that = this;
121 await that.$axios 121 await that.$axios
122 - .post(`/api/platforms/exit/${deviceGbId}`) 122 + .post(`/api/platform/exit/${deviceGbId}`)
123 .then(function (res) { 123 .then(function (res) {
124 result = res.data; 124 result = res.data;
125 }) 125 })
web_src/src/components/dialog/chooseChannel.vue
@@ -72,7 +72,7 @@ export default { @@ -72,7 +72,7 @@ export default {
72 72
73 this.$axios({ 73 this.$axios({
74 method:"post", 74 method:"post",
75 - url:"/api/platforms/updateChannelForGB", 75 + url:"/api/platform/update_channel_for_gb",
76 data:{ 76 data:{
77 platformId: that.platformId, 77 platformId: that.platformId,
78 channelReduces: that.chooseData 78 channelReduces: that.chooseData
web_src/src/components/dialog/chooseChannelForGb.vue
@@ -149,7 +149,7 @@ export default { @@ -149,7 +149,7 @@ export default {
149 if (Object.keys(addData).length >0) { 149 if (Object.keys(addData).length >0) {
150 that.$axios({ 150 that.$axios({
151 method:"post", 151 method:"post",
152 - url:"/api/platforms/updateChannelForGB", 152 + url:"/api/platform/update_channel_for_gb",
153 data:{ 153 data:{
154 platformId: that.platformId, 154 platformId: that.platformId,
155 channelReduces: addData 155 channelReduces: addData
@@ -162,8 +162,8 @@ export default { @@ -162,8 +162,8 @@ export default {
162 } 162 }
163 if (Object.keys(delData).length >0) { 163 if (Object.keys(delData).length >0) {
164 that.$axios({ 164 that.$axios({
165 - method:"post",  
166 - url:"/api/platforms/delChannelForGB", 165 + method:"delete",
  166 + url:"/api/platform/del_channel_for_gb",
167 data:{ 167 data:{
168 platformId: that.platformId, 168 platformId: that.platformId,
169 channelReduces: delData 169 channelReduces: delData
@@ -182,7 +182,7 @@ export default { @@ -182,7 +182,7 @@ export default {
182 getChannelList: function () { 182 getChannelList: function () {
183 let that = this; 183 let that = this;
184 184
185 - this.$axios.get(`/api/platforms/channelList`, { 185 + this.$axios.get(`/api/platform/channel_list`, {
186 params: { 186 params: {
187 page: that.currentPage, 187 page: that.currentPage,
188 count: that.count, 188 count: that.count,
web_src/src/components/dialog/chooseChannelForStream.vue
@@ -142,7 +142,7 @@ export default { @@ -142,7 +142,7 @@ export default {
142 if (Object.keys(delData).length >0) { 142 if (Object.keys(delData).length >0) {
143 console.log(delData) 143 console.log(delData)
144 that.$axios({ 144 that.$axios({
145 - method:"post", 145 + method:"delete",
146 url:"/api/gbStream/del", 146 url:"/api/gbStream/del",
147 data:{ 147 data:{
148 gbStreams: delData, 148 gbStreams: delData,
@@ -152,6 +152,7 @@ export default { @@ -152,6 +152,7 @@ export default {
152 }).catch(function (error) { 152 }).catch(function (error) {
153 console.log(error); 153 console.log(error);
154 }); 154 });
  155 +
155 } 156 }
156 157
157 }, 158 },
web_src/src/components/dialog/devicePlayer.vue
@@ -261,7 +261,7 @@ export default { @@ -261,7 +261,7 @@ export default {
261 this.$refs.videoPlayer.pause() 261 this.$refs.videoPlayer.pause()
262 that.$axios({ 262 that.$axios({
263 method: 'post', 263 method: 'post',
264 - url: '/api/play/' + that.streamId + '/convert' 264 + url: '/api/play/convert/' + that.streamId
265 }).then(function (res) { 265 }).then(function (res) {
266 if (res.data.code == 0) { 266 if (res.data.code == 0) {
267 that.convertKey = res.data.key; 267 that.convertKey = res.data.key;
@@ -298,7 +298,7 @@ export default { @@ -298,7 +298,7 @@ export default {
298 that.$refs.videoPlayer.pause() 298 that.$refs.videoPlayer.pause()
299 this.$axios({ 299 this.$axios({
300 method: 'post', 300 method: 'post',
301 - url: '/api/play/convert/stop/' + this.convertKey 301 + url: '/api/play/convertStop/' + this.convertKey
302 }).then(function (res) { 302 }).then(function (res) {
303 if (res.data.code == 0) { 303 if (res.data.code == 0) {
304 console.log(res.data.msg) 304 console.log(res.data.msg)
@@ -393,7 +393,7 @@ export default { @@ -393,7 +393,7 @@ export default {
393 } else { 393 } else {
394 this.$axios({ 394 this.$axios({
395 method: 'get', 395 method: 'get',
396 - url: '/api/playback/' + this.deviceId + '/' + this.channelId + '?startTime=' + row.startTime + '&endTime=' + 396 + url: '/api/playback/start/' + this.deviceId + '/' + this.channelId + '?startTime=' + row.startTime + '&endTime=' +
397 row.endTime 397 row.endTime
398 }).then(function (res) { 398 }).then(function (res) {
399 var streamInfo = res.data; 399 var streamInfo = res.data;
@@ -408,7 +408,7 @@ export default { @@ -408,7 +408,7 @@ export default {
408 this.videoUrl = ''; 408 this.videoUrl = '';
409 this.$axios({ 409 this.$axios({
410 method: 'get', 410 method: 'get',
411 - url: '/api/playback/' + this.streamId + '/stop' 411 + url: '/api/playback/stop/' + this.streamId
412 }).then(function (res) { 412 }).then(function (res) {
413 if (callback) callback() 413 if (callback) callback()
414 }); 414 });
web_src/src/components/dialog/platformEdit.vue
@@ -75,7 +75,7 @@ @@ -75,7 +75,7 @@
75 </el-form-item> 75 </el-form-item>
76 <el-form-item label="其他选项"> 76 <el-form-item label="其他选项">
77 <el-checkbox label="启用" v-model="platform.enable" @change="checkExpires"></el-checkbox> 77 <el-checkbox label="启用" v-model="platform.enable" @change="checkExpires"></el-checkbox>
78 - <el-checkbox label="云台控制" v-model="platform.PTZEnable"></el-checkbox> 78 + <el-checkbox label="云台控制" v-model="platform.ptz"></el-checkbox>
79 <el-checkbox label="RTCP保活" v-model="platform.rtcp"></el-checkbox> 79 <el-checkbox label="RTCP保活" v-model="platform.rtcp"></el-checkbox>
80 </el-form-item> 80 </el-form-item>
81 <el-form-item> 81 <el-form-item>
@@ -120,28 +120,10 @@ export default { @@ -120,28 +120,10 @@ export default {
120 showDialog: false, 120 showDialog: false,
121 isLoging: false, 121 isLoging: false,
122 onSubmit_text: "立即创建", 122 onSubmit_text: "立即创建",
123 - // platform: {  
124 - // enable: false,  
125 - // PTZEnable: true,  
126 - // rtcp: false,  
127 - // name: null,  
128 - // serverGBId: null,  
129 - // serverGBDomain: null,  
130 - // serverIP: null,  
131 - // serverPort: null,  
132 - // deviceGBId: null,  
133 - // deviceIp: null,  
134 - // devicePort: null,  
135 - // username: null,  
136 - // password: null,  
137 - // expires: 300,  
138 - // keepTimeout: 60,  
139 - // transport: "UDP",  
140 - // characterSet: "GB2312",  
141 - // }, 123 +
142 platform: { 124 platform: {
143 enable: true, 125 enable: true,
144 - PTZEnable: true, 126 + ptz: true,
145 rtcp: false, 127 rtcp: false,
146 name: "测试001", 128 name: "测试001",
147 serverGBId: "34020000002000000001", 129 serverGBId: "34020000002000000001",
@@ -182,7 +164,7 @@ export default { @@ -182,7 +164,7 @@ export default {
182 openDialog: function (platform, callback) { 164 openDialog: function (platform, callback) {
183 var that = this; 165 var that = this;
184 this.$axios 166 this.$axios
185 - .get(`/api/platforms/serverconfig`) 167 + .get(`/api/platform/server_config`)
186 .then(function (res) { 168 .then(function (res) {
187 console.log(res); 169 console.log(res);
188 that.platform.deviceGBId = res.data.username; 170 that.platform.deviceGBId = res.data.username;
@@ -207,7 +189,7 @@ export default { @@ -207,7 +189,7 @@ export default {
207 console.log("onSubmit"); 189 console.log("onSubmit");
208 var that = this; 190 var that = this;
209 that.$axios 191 that.$axios
210 - .post(`/api/platforms/save`, that.platform) 192 + .post(`/api/platform/save`, that.platform)
211 .then(function (res) { 193 .then(function (res) {
212 console.log(res); 194 console.log(res);
213 console.log(res.data == "success"); 195 console.log(res.data == "success");
@@ -237,7 +219,7 @@ export default { @@ -237,7 +219,7 @@ export default {
237 var result = false; 219 var result = false;
238 var that = this; 220 var that = this;
239 await that.$axios 221 await that.$axios
240 - .post(`/api/platforms/exit/${deviceGbId}`) 222 + .post(`/api/platform/exit/${deviceGbId}`)
241 .then(function (res) { 223 .then(function (res) {
242 result = res.data; 224 result = res.data;
243 }) 225 })