From 89244932c6185cd39e9a9f8aa8bf3acf99329335 Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: 星期日, 11 四月 2021 15:00:52 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/wvp-28181-2.0' into wvp-28181-2.0 --- src/main/java/com/genersoft/iot/vmp/vmanager/play/PlayController.java | 10 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java | 2 web_src/src/components/PushVideoList.vue | 2 pom.xml | 13 web_src/src/components/dialog/chooseChannelForGb.vue | 8 src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java | 41 +++ web_src/src/components/devicePosition.vue | 8 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java | 21 + src/main/java/com/genersoft/iot/vmp/vmanager/gbStream/GbStreamController.java | 44 +++ web_src/src/components/dialog/devicePlayer.vue | 8 src/main/java/com/genersoft/iot/vmp/vmanager/MobilePosition/MobilePositionController.java | 64 ++++ src/main/resources/application-dev.yml | 8 web_src/src/components/UiHeader.vue | 4 web_src/src/components/dialog/StreamProxyEdit.vue | 2 web_src/src/components/DeviceList.vue | 7 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java | 2 web_src/src/components/dialog/platformEdit.vue | 30 -- src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java | 11 src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceConfig.java | 46 ++ src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java | 2 src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceQuery.java | 131 +++++++++- web_src/src/components/ParentPlatformList.vue | 4 src/main/java/com/genersoft/iot/vmp/vmanager/media/MediaController.java | 18 + src/main/resources/wvp.sqlite | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java | 6 src/main/java/com/genersoft/iot/vmp/vmanager/playback/PlaybackController.java | 6 src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java | 56 ++++ README.md | 5 web_src/src/components/dialog/chooseChannelForStream.vue | 3 web_src/src/components/dialog/chooseChannel.vue | 2 web_src/src/components/channelList.vue | 10 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java | 4 web_src/src/components/dialog/addStreamTOGB.vue | 2 src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceControl.java | 70 ++++- src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java | 30 +- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java | 18 + 36 files changed, 548 insertions(+), 150 deletions(-) diff --git a/README.md b/README.md index fa9fe03..a404a7e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -# wvp-2.0 -鍦�1.0鐨勫熀纭�涓婂疄鐜板浗鏍囩骇鑱� +# wvp-pro-2.0 WEB VIDEO PLATFORM鏄竴涓熀浜嶨B28181-2016鏍囧噯瀹炵幇鐨勭綉缁滆棰戝钩鍙帮紝璐熻矗瀹炵幇鏍稿績淇′护涓庤澶囩鐞嗗悗鍙伴儴鍒嗭紝鏀寔NAT绌块�忥紝鏀寔娴峰悍銆佸ぇ鍗庛�佸畤瑙嗙瓑鍝佺墝鐨処PC銆丯VR銆丏VR鎺ュ叆銆� 娴佸獟浣撴湇鍔″熀浜嶼LMediaKit-https://github.com/xiongziliang/ZLMediaKit @@ -42,7 +41,7 @@ 19. 鏀寔鎾斁h265, g.711鏍煎紡鐨勬祦(闇�瑕佸皢closeWaitRTPInfo璁句负false) 20. 鎶ヨ淇℃伅澶勭悊锛屾敮鎸佸悜鍓嶇鎺ㄩ�佹姤璀︿俊鎭� -# 鏂版敮鎸佺壒鎬� +# 2.0鏂版敮鎸佺壒鎬� 1. 闆嗘垚web鐣岄潰, 涓嶉渶瑕佸崟鐙儴缃插墠绔湇鍔�, 鐩存帴鍒╃敤wvp鍐呯疆鏂囦欢鏈嶅姟閮ㄧ讲, 闅弚vp涓�璧烽儴缃�; 2. 鏀寔骞冲彴鎺ュ叆, 閽堝澶у钩鍙板ぇ閲忚澶囩殑鎯呭喌杩涜浼樺寲; 3. 鏀寔妫�绱�,閫氶亾绛涢��; diff --git a/pom.xml b/pom.xml index c2f5d82..dda226d 100644 --- a/pom.xml +++ b/pom.xml @@ -102,18 +102,15 @@ <!-- <version>3.11</version>--> <!-- </dependency>--> - <!--Swagger2 --> + <!--Swagger3 --> <!--鍦ㄧ嚎鏂囨。 --> <dependency> <groupId>io.springfox</groupId> - <artifactId>springfox-swagger2</artifactId> - <version>2.9.2</version> + <artifactId>springfox-boot-starter</artifactId> + <version>3.0.0</version> </dependency> - <dependency> - <groupId>io.springfox</groupId> - <artifactId>springfox-swagger-ui</artifactId> - <version>2.6.1</version> - </dependency> + + <!--鍙傛暟鏍¢獙 --> <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> diff --git a/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java b/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java index d237b16..89de84e 100644 --- a/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java +++ b/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java @@ -5,8 +5,10 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ConfigurableApplicationContext; +import springfox.documentation.oas.annotations.EnableOpenApi; @SpringBootApplication +@EnableOpenApi public class VManageBootstrap extends LogManager { private static String[] args; private static ConfigurableApplicationContext context; diff --git a/src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java b/src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java new file mode 100644 index 0000000..70be188 --- /dev/null +++ b/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(); + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java index 0aec885..56d5e9c 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java @@ -81,7 +81,7 @@ /** * 鍏佽浜戝彴鎺у埗 */ - private boolean PTZEnable; + private boolean ptz; /** * RTCP娴佷繚娲� @@ -220,12 +220,12 @@ 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() { @@ -251,4 +251,5 @@ public void setChannelCount(int channelCount) { this.channelCount = channelCount; } + } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java index 579e168..27402ba 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java @@ -341,7 +341,7 @@ @Override public void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event, SipSubscribe.Event errorEvent) { try { - + if (device == null) return; String ssrc = streamSession.createPlaySsrc(); String streamId = null; if (rtpEnable) { diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java index 878e016..ade4f46 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java @@ -118,6 +118,10 @@ if (logger.isDebugEnabled()) { 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(); ret.put("code", 0); ret.put("msg", "success"); diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java index 5aee00c..1633f43 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java @@ -70,6 +70,27 @@ 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 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java index 1bf5162..659502e 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java @@ -42,6 +42,9 @@ @Autowired private IStreamPushService streamPushService; + @Autowired + private ZLMHttpHookSubscribe subscribe; + public void updateMediaList() { storager.clearMediaList(); @@ -66,6 +69,15 @@ if (streamPushItems != null) { 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")); + }); + } } })); @@ -73,6 +85,12 @@ public void addMedia(String app, String streamId) { //浣跨敤寮傛鏇存柊鎺ㄦ祦 + updateMedia(app, streamId); + } + + + public void updateMedia(String app, String streamId) { + //浣跨敤寮傛鏇存柊鎺ㄦ祦 zlmresTfulUtils.getMediaList(app, streamId, "rtmp", json->{ if (json == null) return; diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java index edce411..6e0bc60 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java @@ -123,7 +123,7 @@ 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.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_publish",String.format("%s/on_publish", hookPrex)); param.put("hook.on_record_mp4",""); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java index 257ca9e..3049e5b 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java @@ -14,10 +14,10 @@ public interface ParentPlatformMapper { @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) " + " 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})") int addParentPlatform(ParentPlatform parentPlatform); @@ -36,7 +36,7 @@ "keepTimeout=#{keepTimeout}, " + "transport=#{transport}, " + "characterSet=#{characterSet}, " + - "PTZEnable=#{PTZEnable}, " + + "ptz=#{ptz}, " + "rtcp=#{rtcp}, " + "status=#{status} " + "WHERE serverGBId=#{serverGBId}") diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/MobilePosition/MobilePositionController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/MobilePosition/MobilePositionController.java index 92806b1..c284fe9 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/MobilePosition/MobilePositionController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/MobilePosition/MobilePositionController.java @@ -12,6 +12,10 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorager; 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.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -25,9 +29,13 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.request.async.DeferredResult; +/** + * 浣嶇疆淇℃伅绠$悊 + */ +@Api(tags = "浣嶇疆淇℃伅绠$悊") @CrossOrigin @RestController -@RequestMapping("/api") +@RequestMapping("/api/position") public class MobilePositionController { private final static Logger logger = LoggerFactory.getLogger(MobilePositionController.class); @@ -40,8 +48,21 @@ @Autowired 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, @RequestParam(required = false) String start, @RequestParam(required = false) String end) { @@ -60,7 +81,16 @@ 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) { if (logger.isDebugEnabled()) { logger.debug("鏌ヨ璁惧" + deviceId + "鐨勬渶鏂颁綅缃�"); @@ -69,7 +99,16 @@ 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) { Device device = storager.queryVideoDevice(deviceId); cmder.mobilePostitionQuery(device, event -> { @@ -92,7 +131,20 @@ 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, @RequestParam String expires, @RequestParam String interval) { diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceConfig.java b/src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceConfig.java index d046c0d..a988550 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceConfig.java @@ -17,16 +17,22 @@ import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; 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.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpRequest; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.context.request.async.DeferredResult; +@Api(tags = "鍥芥爣璁惧閰嶇疆") @CrossOrigin @RestController -@RequestMapping("/api") +@RequestMapping("/api/device/config") public class DeviceConfig { private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); @@ -42,14 +48,24 @@ /** * 鐪嬪畧浣嶆帶鍒跺懡浠PI鎺ュ彛 - * - * @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, @RequestParam(required = false) String channelId, @RequestParam(required = false) String name, @@ -86,10 +102,18 @@ /** * 璁惧閰嶇疆鏌ヨ璇锋眰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, @PathVariable String configType, @RequestParam(required = false) String channelId) { diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceControl.java b/src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceControl.java index 7221359..ae517af 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceControl.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceControl.java @@ -17,6 +17,10 @@ import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; 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.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -25,9 +29,10 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.context.request.async.DeferredResult; +@Api(tags = "鍥芥爣璁惧鎺у埗") @CrossOrigin @RestController -@RequestMapping("/api") +@RequestMapping("/api/device/control") public class DeviceControl { private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); @@ -44,10 +49,13 @@ /** * 杩滅▼鍚姩鎺у埗鍛戒护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) { if (logger.isDebugEnabled()) { logger.debug("璁惧杩滅▼鍚姩API璋冪敤"); @@ -68,11 +76,18 @@ /** * 褰曞儚鎺у埗鍛戒护API鎺ュ彛 * - * @param deviceId + * @param deviceId 璁惧ID * @param recordCmdStr Record锛氭墜鍔ㄥ綍鍍忥紝StopRecord锛氬仠姝㈡墜鍔ㄥ綍鍍� * @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锛堟墜鍔ㄥ綍鍍忥級锛孲topRecord锛堝仠姝㈡墜鍔ㄥ綍鍍忥級", + required = true), + }) + @GetMapping("/record/{deviceId}/{recordCmdStr}") public DeferredResult<ResponseEntity<String>> recordApi(@PathVariable String deviceId, @PathVariable String recordCmdStr, @RequestParam(required = false) String channelId) { if (logger.isDebugEnabled()) { @@ -102,10 +117,15 @@ /** * 鎶ヨ甯冮槻/鎾ら槻鍛戒护API鎺ュ彛 * - * @param deviceId + * @param deviceId 璁惧ID * @param guardCmdStr SetGuard锛氬竷闃诧紝ResetGuard锛氭挙闃� */ - @GetMapping("/control/{deviceId}/guard/{guardCmdStr}") + @ApiOperation("褰曞儚鎺у埗鍛戒护") + @ApiImplicitParams({ + @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true), + @ApiImplicitParam(name = "guardCmdStr", value ="鍛戒护锛� 鍙�夊�硷細SetGuard锛堝竷闃诧級锛孯esetGuard锛堟挙闃诧級", required = true) + }) + @GetMapping("/guard/{deviceId}/{guardCmdStr}") public DeferredResult<ResponseEntity<String>> guardApi(@PathVariable String deviceId, @PathVariable String guardCmdStr) { if (logger.isDebugEnabled()) { logger.debug("甯冮槻/鎾ら槻API璋冪敤"); @@ -134,11 +154,17 @@ /** * 鎶ヨ澶嶄綅API鎺ュ彛 * - * @param deviceId + * @param deviceId 璁惧ID * @param alarmMethod 鎶ヨ鏂瑰紡锛堝彲閫夛級 * @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, @RequestParam(required = false) String alarmMethod, @RequestParam(required = false) String alarmType) { @@ -169,11 +195,15 @@ /** * 寮哄埗鍏抽敭甯PI鎺ュ彛 * - * @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, @RequestParam(required = false) String channelId) { if (logger.isDebugEnabled()) { @@ -196,13 +226,21 @@ /** * 鐪嬪畧浣嶆帶鍒跺懡浠PI鎺ュ彛 * - * @param deviceId + * @param deviceId 璁惧ID * @param enabled 鐪嬪畧浣嶄娇鑳�1:寮�鍚�,0:鍏抽棴 * @param resetTime 鑷姩褰掍綅鏃堕棿闂撮殧锛堝彲閫夛級 * @param presetIndex 璋冪敤棰勭疆浣嶇紪鍙凤紙鍙�夛級 * @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, @PathVariable String enabled, @RequestParam(required = false) String resetTime, diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceQuery.java b/src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceQuery.java index 997a43b..bded1b9 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceQuery.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceQuery.java @@ -3,6 +3,7 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; import com.github.pagehelper.PageInfo; +import io.swagger.annotations.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -21,10 +22,11 @@ import javax.sip.message.Response; +@Api(tags = "鍥芥爣璁惧鏌ヨ1", value = "鍥芥爣璁惧鏌ヨ") @SuppressWarnings("rawtypes") @CrossOrigin @RestController -@RequestMapping("/api") +@RequestMapping("/api/device/query") public class DeviceQuery { private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); @@ -40,7 +42,16 @@ @Autowired private DeviceOffLineDetector offLineDetector; - + + /** + * 浣跨敤ID鏌ヨ鍥芥爣璁惧 + * @param deviceId 鍥芥爣ID + * @return 鍥芥爣璁惧 + */ + @ApiOperation("浣跨敤ID鏌ヨ鍥芥爣璁惧") + @ApiImplicitParams({ + @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true), + }) @GetMapping("/devices/{deviceId}") public ResponseEntity<Device> devices(@PathVariable String deviceId){ @@ -51,7 +62,18 @@ Device device = storager.queryVideoDevice(deviceId); 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") public PageInfo<Device> devices(int page, int count){ @@ -73,7 +95,16 @@ * @param channelType 璁惧 false/瀛愮洰褰� true * @return 閫氶亾鍒楄〃 */ + @ApiOperation("鍒嗛〉鏌ヨ閫氶亾") @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, int page, int count, @RequestParam(required = false) String query, @@ -89,7 +120,16 @@ PageInfo pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count); return new ResponseEntity<>(pageResult,HttpStatus.OK); } - + + /** + * 鍚屾璁惧閫氶亾 + * @param deviceId 璁惧id + * @return + */ + @ApiOperation("鍚屾璁惧閫氶亾") + @ApiImplicitParams({ + @ApiImplicitParam(name="deviceId", value = "璁惧id", required = true), + }) @PostMapping("/devices/{deviceId}/sync") public DeferredResult<ResponseEntity<Device>> devicesSync(@PathVariable String deviceId){ @@ -117,8 +157,17 @@ resultHolder.put(DeferredResultHolder.CALLBACK_CMD_CATALOG+deviceId, 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){ if (logger.isDebugEnabled()) { @@ -140,13 +189,27 @@ } /** - * 鍒嗛〉鏌ヨ閫氶亾鏁� + * 鍒嗛〉鏌ヨ瀛愮洰褰曢�氶亾 + * @param deviceId 閫氶亾id * @param channelId 閫氶亾id * @param page 褰撳墠椤� * @param count 姣忛〉鏉℃暟 + * @param query 鏌ヨ鍐呭 + * @param online 鏄惁鍦ㄧ嚎 + * @param channelType 閫氶亾绫诲瀷 * @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, @PathVariable String channelId, int page, @@ -168,14 +231,36 @@ 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}") public ResponseEntity<PageInfo> updateChannel(@PathVariable String deviceId,DeviceChannel channel){ storager.updateChannel(deviceId, channel); 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锛坲dp浼犺緭锛夛紝TCP-ACTIVE锛坱cp涓诲姩妯″紡,鏆備笉鏀寔锛夛紝TCP-PASSIVE锛坱cp琚姩妯″紡锛�"), + }) + @PostMapping("/transport/{deviceId}/{streamMode}") public ResponseEntity<PageInfo> updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){ Device device = storager.queryVideoDevice(deviceId); device.setStreamMode(streamMode); @@ -186,8 +271,12 @@ /** * 璁惧鐘舵�佹煡璇㈣姹侫PI鎺ュ彛 * - * @param deviceId + * @param deviceId 璁惧id */ + @ApiOperation("璁惧鐘舵�佹煡璇�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "deviceId", value = "璁惧id", required = true), + }) @GetMapping("/devices/{deviceId}/status") public DeferredResult<ResponseEntity<String>> deviceStatusApi(@PathVariable String deviceId) { if (logger.isDebugEnabled()) { @@ -216,9 +305,25 @@ /** * 璁惧鎶ヨ鏌ヨ璇锋眰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}") public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId, @RequestParam(required = false) String startPriority, diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gbStream/GbStreamController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gbStream/GbStreamController.java index 787a094..64e4567 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gbStream/GbStreamController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gbStream/GbStreamController.java @@ -5,11 +5,16 @@ import com.genersoft.iot.vmp.vmanager.gbStream.bean.GbStreamParam; import com.genersoft.iot.vmp.service.IGbStreamService; 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.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +@Api(tags = "瑙嗛娴佸叧鑱斿埌绾ц仈骞冲彴") @CrossOrigin @RestController @RequestMapping("/api/gbStream") @@ -24,7 +29,18 @@ 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 public PageInfo<GbStream> list(@RequestParam(required = false)Integer page, @RequestParam(required = false)Integer count){ @@ -33,11 +49,18 @@ } - @RequestMapping(value = "/del") + /** + * 绉婚櫎鍥芥爣鍏宠仈 + * @param gbStreamParam + * @return + */ + @ApiOperation("绉婚櫎鍥芥爣鍏宠仈") + @ApiImplicitParams({ + @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true ), + }) + @DeleteMapping(value = "/del") @ResponseBody public Object del(@RequestBody GbStreamParam gbStreamParam){ - System.out.println(2222); - System.out.println(gbStreamParam.getGbStreams().size()); if (gbStreamService.delPlatformInfo(gbStreamParam.getGbStreams())) { return "success"; }else { @@ -46,11 +69,18 @@ } - @RequestMapping(value = "/add") + /** + * 淇濆瓨鍥芥爣鍏宠仈 + * @param gbStreamParam + * @return + */ + @ApiOperation("淇濆瓨鍥芥爣鍏宠仈") + @ApiImplicitParams({ + @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true ), + }) + @PostMapping(value = "/add") @ResponseBody public Object add(@RequestBody GbStreamParam gbStreamParam){ - System.out.println(3333); - System.out.println(gbStreamParam.getGbStreams().size()); if (gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId())) { return "success"; }else { diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/media/MediaController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/media/MediaController.java index e01b06e..a195cc9 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/media/MediaController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/media/MediaController.java @@ -9,6 +9,10 @@ import com.genersoft.iot.vmp.service.IMediaService; import com.genersoft.iot.vmp.service.IStreamProxyService; 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.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -16,6 +20,7 @@ import org.springframework.web.bind.annotation.*; +@Api(tags = "濯掍綋娴佺浉鍏�") @Controller @CrossOrigin @RequestMapping(value = "/api/media") @@ -33,8 +38,17 @@ private IMediaService mediaService; - - + /** + * 鏍规嵁搴旂敤鍚嶅拰娴乮d鑾峰彇鎾斁鍦板潃 + * @param app 搴旂敤鍚� + * @param stream 娴乮d + * @return + */ + @ApiOperation("鏍规嵁搴旂敤鍚嶅拰娴乮d鑾峰彇鎾斁鍦板潃") + @ApiImplicitParams({ + @ApiImplicitParam(name = "app", value = "搴旂敤鍚�"), + @ApiImplicitParam(name = "stream", value = "娴乮d"), + }) @RequestMapping(value = "/getStreamInfoByAppAndStream") @ResponseBody public StreamInfo getStreamInfoByAppAndStream(String app, String stream){ diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java index 279a031..834c00b 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce; import com.genersoft.iot.vmp.vmanager.platform.bean.UpdateChannelParam; import com.github.pagehelper.PageInfo; +import io.swagger.annotations.Api; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -17,9 +18,13 @@ import org.springframework.web.bind.annotation.*; import com.genersoft.iot.vmp.conf.SipConfig; +/** + * 绾ц仈骞冲彴绠$悊 + */ +@Api("绾ц仈骞冲彴绠$悊") @CrossOrigin @RestController -@RequestMapping("/api") +@RequestMapping("/api/platform") public class PlatformController { private final static Logger logger = LoggerFactory.getLogger(PlatformController.class); @@ -36,7 +41,7 @@ @Autowired private SipConfig sipConfig; - @GetMapping("/platforms/serverconfig") + @GetMapping("/server_config") public ResponseEntity<JSONObject> serverConfig() { JSONObject result = new JSONObject(); result.put("deviceIp", sipConfig.getSipIp()); @@ -46,7 +51,7 @@ return new ResponseEntity<>(result, HttpStatus.OK); } - @GetMapping("/platforms/{count}/{page}") + @GetMapping("/query/{count}/{page}") public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count){ if (logger.isDebugEnabled()) { @@ -55,7 +60,7 @@ return storager.queryParentPlatformList(page, count); } - @RequestMapping("/platforms/save") + @PostMapping("/save") @ResponseBody public ResponseEntity<String> savePlatform(@RequestBody ParentPlatform parentPlatform){ @@ -98,18 +103,19 @@ } } - @RequestMapping("/platforms/delete") + @DeleteMapping("/delete/{serverGBId}") @ResponseBody - public ResponseEntity<String> deletePlatform(@RequestBody ParentPlatform parentPlatform){ + public ResponseEntity<String> deletePlatform(@PathVariable String serverGBId){ if (logger.isDebugEnabled()) { logger.debug("鍒犻櫎涓婄骇骞冲彴API璋冪敤"); } - if (StringUtils.isEmpty(parentPlatform.getServerGBId()) + if (StringUtils.isEmpty(serverGBId) ){ 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 -> { // 娓呯┖redis缂撳瓨 @@ -133,7 +139,7 @@ } } - @RequestMapping("/platforms/exit/{deviceGbId}") + @GetMapping("/exit/{deviceGbId}") @ResponseBody public ResponseEntity<String> exitPlatform(@PathVariable String deviceGbId){ @@ -144,7 +150,7 @@ return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK); } - @RequestMapping("/platforms/channelList") + @GetMapping("/channel_list") @ResponseBody public PageInfo<ChannelReduce> channelList(int page, int count, @RequestParam(required = false) String platformId, @@ -167,7 +173,7 @@ } - @RequestMapping("/platforms/updateChannelForGB") + @PostMapping("/update_channel_for_gb") @ResponseBody public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param){ @@ -179,7 +185,7 @@ return new ResponseEntity<>(String.valueOf(result > 0), HttpStatus.OK); } - @RequestMapping("/platforms/delChannelForGB") + @DeleteMapping("/del_channel_for_gb") @ResponseBody public ResponseEntity<String> delChannelForGB(@RequestBody UpdateChannelParam param){ diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/play/PlayController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/play/PlayController.java index d104b85..df16dd8 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/play/PlayController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/play/PlayController.java @@ -33,7 +33,7 @@ @CrossOrigin @RestController -@RequestMapping("/api") +@RequestMapping("/api/play") public class PlayController { private final static Logger logger = LoggerFactory.getLogger(PlayController.class); @@ -59,7 +59,7 @@ @Autowired private IMediaService mediaService; - @GetMapping("/play/{deviceId}/{channelId}") + @GetMapping("/start/{deviceId}/{channelId}") public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, @PathVariable String channelId) { @@ -79,7 +79,7 @@ return playResult.getResult(); } - @PostMapping("/play/{streamId}/stop") + @PostMapping("/stop/{streamId}") public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String streamId) { logger.debug(String.format("璁惧棰勮/鍥炴斁鍋滄API璋冪敤锛宻treamId锛�%s", streamId)); @@ -139,7 +139,7 @@ * @param streamId 娴両D * @return */ - @PostMapping("/play/{streamId}/convert") + @PostMapping("/convert/{streamId}") public ResponseEntity<String> playConvert(@PathVariable String streamId) { StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId); if (streamInfo == null) { @@ -179,7 +179,7 @@ * @param key * @return */ - @PostMapping("/play/convert/stop/{key}") + @PostMapping("/convertStop/{key}") public ResponseEntity<String> playConvertStop(@PathVariable String key) { JSONObject jsonObject = zlmresTfulUtils.delFFmpegSource(key); diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/playback/PlaybackController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/playback/PlaybackController.java index 9ce2672..e816562 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/playback/PlaybackController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/playback/PlaybackController.java @@ -28,7 +28,7 @@ @CrossOrigin @RestController -@RequestMapping("/api") +@RequestMapping("/api/playback") public class PlaybackController { private final static Logger logger = LoggerFactory.getLogger(PlaybackController.class); @@ -51,7 +51,7 @@ @Autowired private DeferredResultHolder resultHolder; - @GetMapping("/playback/{deviceId}/{channelId}") + @GetMapping("/start/{deviceId}/{channelId}") public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, @PathVariable String channelId, String startTime, String endTime) { @@ -89,7 +89,7 @@ return result; } - @RequestMapping("/playback/{ssrc}/stop") + @RequestMapping("/stop/{ssrc}") public ResponseEntity<String> playStop(@PathVariable String ssrc) { cmder.streamByeCmd(ssrc); diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java new file mode 100644 index 0000000..675fc01 --- /dev/null +++ b/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"; + } +} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index e45bfb5..d4abf20 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -96,4 +96,10 @@ # [鏍规嵁涓氬姟闇�姹傞厤缃甝 userSettings: # 淇濆瓨绉诲姩浣嶇疆鍘嗗彶杞ㄨ抗锛歵rue:淇濈暀鍘嗗彶鏁版嵁锛宖alse:浠呬繚鐣欐渶鍚庣殑浣嶇疆(榛樿) - savePositionHistory: false \ No newline at end of file + savePositionHistory: false + +# 鍦ㄧ嚎鏂囨。锛� swagger-ui锛堢敓浜х幆澧冨缓璁叧闂級 +springfox: + documentation: + swagger-ui: + enabled: true \ No newline at end of file diff --git a/src/main/resources/wvp.sqlite b/src/main/resources/wvp.sqlite index 3cb64cf..2e73cdb 100644 --- a/src/main/resources/wvp.sqlite +++ b/src/main/resources/wvp.sqlite Binary files differ diff --git a/web_src/src/components/DeviceList.vue b/web_src/src/components/DeviceList.vue index 8a3f1c0..21e02aa 100644 --- a/web_src/src/components/DeviceList.vue +++ b/web_src/src/components/DeviceList.vue @@ -136,7 +136,7 @@ getDeviceList: function() { let that = this; this.getDeviceListLoading = true; - this.$axios.get(`/api/devices`,{ + this.$axios.get(`/api/device/query/devices`,{ params: { page: that.currentPage, count: that.count @@ -167,13 +167,12 @@ //gb28181骞冲彴瀵规帴 //鍒锋柊璁惧淇℃伅 refDevice: function(itemData) { - ///api/devices/{deviceId}/sync console.log("鍒锋柊瀵瑰簲璁惧:" + itemData.deviceId); var that = this; that.$refs[itemData.deviceId + 'refbtn' ].loading = true; this.$axios({ method: 'post', - url: '/api/devices/' + itemData.deviceId + '/sync' + url: '/api/device/query/devices/' + itemData.deviceId + '/sync' }).then(function(res) { console.log("鍒锋柊璁惧缁撴灉锛�"+JSON.stringify(res)); if (!res.data.deviceId) { @@ -217,7 +216,7 @@ let that = this; this.$axios({ method: 'get', - url: '/api/devices/' + row.deviceId + '/transport/' + row.streamMode + url: '/api/device/query/transport' + row.deviceId + '/' + row.streamMode }).then(function(res) { }).catch(function(e) { diff --git a/web_src/src/components/ParentPlatformList.vue b/web_src/src/components/ParentPlatformList.vue index 1121f6e..ee0d342 100644 --- a/web_src/src/components/ParentPlatformList.vue +++ b/web_src/src/components/ParentPlatformList.vue @@ -121,7 +121,7 @@ }, deletePlatformCommit: function(platform) { var that = this; - that.$axios.post(`/api/platforms/delete`, platform) + that.$axios.delete(`/api/platform/delete/${platform.serverGBId}`) .then(function (res) { if (res.data == "success") { that.$message({ @@ -155,7 +155,7 @@ getPlatformList: function() { 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) { that.total = res.data.total; that.platformList = res.data.list; diff --git a/web_src/src/components/PushVideoList.vue b/web_src/src/components/PushVideoList.vue index 6e73f37..1199a39 100644 --- a/web_src/src/components/PushVideoList.vue +++ b/web_src/src/components/PushVideoList.vue @@ -15,8 +15,6 @@ </el-table-column> <el-table-column prop="stream" label="娴両D" width="240" align="center"> </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> <el-table-column label="寮�濮嬫椂闂�" align="center" > diff --git a/web_src/src/components/UiHeader.vue b/web_src/src/components/UiHeader.vue index ae0780b..85bb230 100644 --- a/web_src/src/components/UiHeader.vue +++ b/web_src/src/components/UiHeader.vue @@ -71,6 +71,10 @@ }, destroyed() { 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)) }, } diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue index b06ce25..ebb4318 100644 --- a/web_src/src/components/channelList.vue +++ b/web_src/src/components/channelList.vue @@ -154,7 +154,7 @@ getDeviceChannelList: function () { 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: { page: that.currentPage, count: that.count, @@ -188,7 +188,7 @@ let that = this; this.$axios({ method: 'get', - url: '/api/play/' + deviceId + '/' + channelId + url: '/api/play/start/' + deviceId + '/' + channelId }).then(function (res) { console.log(res.data) let streamId = res.data.streamId; @@ -216,7 +216,7 @@ var that = this; this.$axios({ method: 'post', - url: '/api/play/' + itemData.streamId + '/stop' + url: '/api/play/stop/' + itemData.streamId }).then(function (res) { console.log(JSON.stringify(res)); that.initData(); @@ -251,7 +251,7 @@ showSubchannels: function (channelId) { 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: { page: that.currentPage, count: that.count, @@ -282,7 +282,7 @@ console.log(row) this.$axios({ method: 'post', - url: `/api/channel/update/${this.deviceId}`, + url: `/api/device/query/channel/update/${this.deviceId}`, params: row }).then(function (res) { console.log(JSON.stringify(res)); diff --git a/web_src/src/components/devicePosition.vue b/web_src/src/components/devicePosition.vue index 4a52c74..dfee0b1 100644 --- a/web_src/src/components/devicePosition.vue +++ b/web_src/src/components/devicePosition.vue @@ -171,7 +171,7 @@ this.endTime = null; } let self = this; - this.$axios.get(`/api/positions/${this.deviceId}/history`, { + this.$axios.get(`/api/position/history/${this.deviceId}`, { params: { start: self.startTime, end: self.endTime, @@ -202,7 +202,7 @@ this.mapPointList = []; this.mobilePositionList = []; let self = this; - this.$axios.get(`/api/positions/${this.deviceId}/latest`) + this.$axios.get(`/api/position/latest/${this.deviceId}`) .then(function (res) { console.log(res.data); self.total = res.data.length; @@ -226,7 +226,7 @@ }, subscribeMobilePosition: function() { let self = this; - this.$axios.get(`/api/positions/${this.deviceId}/subscribe`, { + this.$axios.get(`/api/position/subscribe/${this.deviceId}`, { params: { expires: self.expired, interval: self.interval, @@ -241,7 +241,7 @@ }, unSubscribeMobilePosition: function() { let self = this; - this.$axios.get(`/api/positions/${this.deviceId}/subscribe`, { + this.$axios.get(`/api/position/subscribe/${this.deviceId}`, { params: { expires: 0, interval: self.interval, diff --git a/web_src/src/components/dialog/StreamProxyEdit.vue b/web_src/src/components/dialog/StreamProxyEdit.vue index 63a7bf6..bdde9db 100644 --- a/web_src/src/components/dialog/StreamProxyEdit.vue +++ b/web_src/src/components/dialog/StreamProxyEdit.vue @@ -176,7 +176,7 @@ var result = false; var that = this; await that.$axios - .post(`/api/platforms/exit/${deviceGbId}`) + .post(`/api/platform/exit/${deviceGbId}`) .then(function (res) { result = res.data; }) diff --git a/web_src/src/components/dialog/addStreamTOGB.vue b/web_src/src/components/dialog/addStreamTOGB.vue index 0b908f8..d5373fb 100644 --- a/web_src/src/components/dialog/addStreamTOGB.vue +++ b/web_src/src/components/dialog/addStreamTOGB.vue @@ -119,7 +119,7 @@ var result = false; var that = this; await that.$axios - .post(`/api/platforms/exit/${deviceGbId}`) + .post(`/api/platform/exit/${deviceGbId}`) .then(function (res) { result = res.data; }) diff --git a/web_src/src/components/dialog/chooseChannel.vue b/web_src/src/components/dialog/chooseChannel.vue index 31ef4b7..a6b9b44 100644 --- a/web_src/src/components/dialog/chooseChannel.vue +++ b/web_src/src/components/dialog/chooseChannel.vue @@ -72,7 +72,7 @@ this.$axios({ method:"post", - url:"/api/platforms/updateChannelForGB", + url:"/api/platform/update_channel_for_gb", data:{ platformId: that.platformId, channelReduces: that.chooseData diff --git a/web_src/src/components/dialog/chooseChannelForGb.vue b/web_src/src/components/dialog/chooseChannelForGb.vue index 22b6032..28b3d58 100644 --- a/web_src/src/components/dialog/chooseChannelForGb.vue +++ b/web_src/src/components/dialog/chooseChannelForGb.vue @@ -149,7 +149,7 @@ if (Object.keys(addData).length >0) { that.$axios({ method:"post", - url:"/api/platforms/updateChannelForGB", + url:"/api/platform/update_channel_for_gb", data:{ platformId: that.platformId, channelReduces: addData @@ -162,8 +162,8 @@ } if (Object.keys(delData).length >0) { that.$axios({ - method:"post", - url:"/api/platforms/delChannelForGB", + method:"delete", + url:"/api/platform/del_channel_for_gb", data:{ platformId: that.platformId, channelReduces: delData @@ -182,7 +182,7 @@ getChannelList: function () { let that = this; - this.$axios.get(`/api/platforms/channelList`, { + this.$axios.get(`/api/platform/channel_list`, { params: { page: that.currentPage, count: that.count, diff --git a/web_src/src/components/dialog/chooseChannelForStream.vue b/web_src/src/components/dialog/chooseChannelForStream.vue index ff65532..514ac3e 100644 --- a/web_src/src/components/dialog/chooseChannelForStream.vue +++ b/web_src/src/components/dialog/chooseChannelForStream.vue @@ -142,7 +142,7 @@ if (Object.keys(delData).length >0) { console.log(delData) that.$axios({ - method:"post", + method:"delete", url:"/api/gbStream/del", data:{ gbStreams: delData, @@ -152,6 +152,7 @@ }).catch(function (error) { console.log(error); }); + } }, diff --git a/web_src/src/components/dialog/devicePlayer.vue b/web_src/src/components/dialog/devicePlayer.vue index 9edd504..30de142 100644 --- a/web_src/src/components/dialog/devicePlayer.vue +++ b/web_src/src/components/dialog/devicePlayer.vue @@ -261,7 +261,7 @@ this.$refs.videoPlayer.pause() that.$axios({ method: 'post', - url: '/api/play/' + that.streamId + '/convert' + url: '/api/play/convert/' + that.streamId }).then(function (res) { if (res.data.code == 0) { that.convertKey = res.data.key; @@ -298,7 +298,7 @@ that.$refs.videoPlayer.pause() this.$axios({ method: 'post', - url: '/api/play/convert/stop/' + this.convertKey + url: '/api/play/convertStop/' + this.convertKey }).then(function (res) { if (res.data.code == 0) { console.log(res.data.msg) @@ -393,7 +393,7 @@ } else { this.$axios({ 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 }).then(function (res) { var streamInfo = res.data; @@ -408,7 +408,7 @@ this.videoUrl = ''; this.$axios({ method: 'get', - url: '/api/playback/' + this.streamId + '/stop' + url: '/api/playback/stop/' + this.streamId }).then(function (res) { if (callback) callback() }); diff --git a/web_src/src/components/dialog/platformEdit.vue b/web_src/src/components/dialog/platformEdit.vue index 4a916e8..34ee27d 100644 --- a/web_src/src/components/dialog/platformEdit.vue +++ b/web_src/src/components/dialog/platformEdit.vue @@ -75,7 +75,7 @@ </el-form-item> <el-form-item label="鍏朵粬閫夐」"> <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-form-item> <el-form-item> @@ -120,28 +120,10 @@ showDialog: false, isLoging: false, 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: { enable: true, - PTZEnable: true, + ptz: true, rtcp: false, name: "娴嬭瘯001", serverGBId: "34020000002000000001", @@ -182,7 +164,7 @@ openDialog: function (platform, callback) { var that = this; this.$axios - .get(`/api/platforms/serverconfig`) + .get(`/api/platform/server_config`) .then(function (res) { console.log(res); that.platform.deviceGBId = res.data.username; @@ -207,7 +189,7 @@ console.log("onSubmit"); var that = this; that.$axios - .post(`/api/platforms/save`, that.platform) + .post(`/api/platform/save`, that.platform) .then(function (res) { console.log(res); console.log(res.data == "success"); @@ -237,7 +219,7 @@ var result = false; var that = this; await that.$axios - .post(`/api/platforms/exit/${deviceGbId}`) + .post(`/api/platform/exit/${deviceGbId}`) .then(function (res) { result = res.data; }) -- Gitblit v1.8.0