Commit a6e513116b198e27361df6f9434c3c51c3db0fe7
1 parent
bd5a4be2
Exists in
master
设备查询接口对接完成和楼宇管理对接部分接口
Showing
3 changed files
with
172 additions
and
9 deletions
Show diff stats
springboot/src/main/java/com/sincre/springboot/ApiPlatform/YinShiServiceConfig.java
@@ -14,7 +14,7 @@ public class YinShiServiceConfig { | @@ -14,7 +14,7 @@ public class YinShiServiceConfig { | ||
14 | /** | 14 | /** |
15 | * 用于管理员获取accessToken | 15 | * 用于管理员获取accessToken |
16 | */ | 16 | */ |
17 | - public static String AccessToken = ""; | 17 | + public static String AccessToken = "at.81rs7cox2ckxiw4v8t4wrt6k07ehcbw2-6ii49gj6ji-1j6mggg-xnrve0akm"; //测试阶段先写死 |
18 | 18 | ||
19 | 19 | ||
20 | 20 |
springboot/src/main/java/com/sincre/springboot/controller/YinShiController.java
@@ -2,6 +2,8 @@ package com.sincre.springboot.controller; | @@ -2,6 +2,8 @@ package com.sincre.springboot.controller; | ||
2 | 2 | ||
3 | 3 | ||
4 | import com.alibaba.fastjson.JSON; | 4 | import com.alibaba.fastjson.JSON; |
5 | +import com.alibaba.fastjson.JSONArray; | ||
6 | +import com.sincre.springboot.ApiModel.Page; | ||
5 | import com.sincre.springboot.ApiModel.YinShiResResult; | 7 | import com.sincre.springboot.ApiModel.YinShiResResult; |
6 | import com.sincre.springboot.ApiPlatform.YinShiServiceConfig; | 8 | import com.sincre.springboot.ApiPlatform.YinShiServiceConfig; |
7 | import com.sincre.springboot.common.MD5; | 9 | import com.sincre.springboot.common.MD5; |
@@ -329,4 +331,137 @@ public class YinShiController { | @@ -329,4 +331,137 @@ public class YinShiController { | ||
329 | 331 | ||
330 | return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | 332 | return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); |
331 | } | 333 | } |
334 | + | ||
335 | + @ApiOperation(value = "获取摄像头列表") | ||
336 | + @ApiImplicitParams({ | ||
337 | + @ApiImplicitParam(name="pageIndex", value = "分页起始页,从1开始",required = true), | ||
338 | + @ApiImplicitParam(name="pageSize", value = "分页大小,默认为10,最大为50") | ||
339 | + }) | ||
340 | + @GetMapping("getCameraList") | ||
341 | + public ServerResponse getCameraList(@RequestParam("pageIndex") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize) { | ||
342 | + | ||
343 | + pageIndex = pageIndex - 1; | ||
344 | + String url = YinShiServiceConfig.HostUrl + "lapp/camera/list"; | ||
345 | + Map<String, Object> map = new HashMap<>(); | ||
346 | + map.put("accessToken", YinShiServiceConfig.AccessToken); | ||
347 | + map.put("pageStart", pageIndex); | ||
348 | + map.put("pageSize", pageSize); | ||
349 | + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); | ||
350 | + | ||
351 | + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | ||
352 | + | ||
353 | + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | ||
354 | + } | ||
355 | + | ||
356 | + @ApiOperation(value = "获取设备状态信息") | ||
357 | + @ApiImplicitParams({ | ||
358 | + @ApiImplicitParam(name="channelNo",value = "通道号,IPC设备填写1",required = false), | ||
359 | + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true) | ||
360 | + }) | ||
361 | + @GetMapping("getDeviceStatus") | ||
362 | + public ServerResponse getDeviceStatus(@RequestParam(defaultValue = "1") Integer channelNo,@RequestParam String deviceSerial) { | ||
363 | + | ||
364 | + String url = YinShiServiceConfig.HostUrl + "lapp/device/status/get"; | ||
365 | + Map<String, Object> map = new HashMap<>(); | ||
366 | + map.put("accessToken", YinShiServiceConfig.AccessToken); | ||
367 | + map.put("deviceSerial", deviceSerial); | ||
368 | + map.put("channelNo",channelNo); | ||
369 | + | ||
370 | + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); | ||
371 | + | ||
372 | + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | ||
373 | + | ||
374 | + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | ||
375 | + } | ||
376 | + | ||
377 | + @ApiOperation(value = "获取设备的通道信息") | ||
378 | + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true) | ||
379 | + @GetMapping("getDeviceChanNoInfo") | ||
380 | + public ServerResponse getDeviceChanNoInfo(@RequestParam String deviceSerial) { | ||
381 | + | ||
382 | + String url = YinShiServiceConfig.HostUrl + "lapp/device/camera/list"; | ||
383 | + Map<String, Object> map = new HashMap<>(); | ||
384 | + map.put("accessToken", YinShiServiceConfig.AccessToken); | ||
385 | + map.put("deviceSerial", deviceSerial); | ||
386 | + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); | ||
387 | + | ||
388 | + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | ||
389 | + | ||
390 | + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | ||
391 | + } | ||
392 | + | ||
393 | + @ApiOperation(value = "查询设备是否支持萤石协议") | ||
394 | + @ApiImplicitParams({ | ||
395 | + @ApiImplicitParam(name="model",value = "设备型号",required = true), | ||
396 | + @ApiImplicitParam(name="version",value = "设备版本号",required = true) | ||
397 | + }) | ||
398 | + @GetMapping("isSupportEZVIZ") | ||
399 | + public ServerResponse isSupportEZVIZ(@RequestParam String model,@RequestParam String version) { | ||
400 | + | ||
401 | + String url = YinShiServiceConfig.HostUrl + "lapp/device/support/ezviz"; | ||
402 | + Map<String, Object> map = new HashMap<>(); | ||
403 | + map.put("appKey", YinShiServiceConfig.appKey); | ||
404 | + map.put("model", model); | ||
405 | + map.put("version",version); | ||
406 | + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); | ||
407 | + | ||
408 | + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | ||
409 | + | ||
410 | + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | ||
411 | + } | ||
412 | + | ||
413 | + @ApiOperation(value = "根据设备序列号查询设备能力集") | ||
414 | + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true) | ||
415 | + @GetMapping("getDeviceCapacity") | ||
416 | + public ServerResponse getDeviceCapacity(@RequestParam String deviceSerial) { | ||
417 | + | ||
418 | + String url = YinShiServiceConfig.HostUrl + "lapp/device/capacity"; | ||
419 | + Map<String, Object> map = new HashMap<>(); | ||
420 | + map.put("accessToken", YinShiServiceConfig.AccessToken); | ||
421 | + map.put("deviceSerial", deviceSerial); | ||
422 | + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); | ||
423 | + | ||
424 | + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | ||
425 | + | ||
426 | + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | ||
427 | + } | ||
428 | + | ||
429 | + @ApiOperation(value = "根据时间获取存储文件信息") | ||
430 | + @ApiImplicitParams({ | ||
431 | + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true), | ||
432 | + @ApiImplicitParam(name="channelNo",value = "通道号,非必选,默认为1",dataType = "Integer"), | ||
433 | + @ApiImplicitParam(name= "startTime",value = "起始时间,时间格式为:1378345128000。非必选,默认为当天0点",dataType = "Long"), | ||
434 | + @ApiImplicitParam(name= "endTime",value = "结束时间,时间格式为:1378345128000。非必选,默认为当前时间",dataType = "Long"), | ||
435 | + @ApiImplicitParam(name = "recType",value = "回放源,0-系统自动选择,1-云存储,2-本地录像。非必选,默认为0") | ||
436 | + }) | ||
437 | + @GetMapping("getVideoFileByTime") | ||
438 | + public ServerResponse getVideoFileByTime(@RequestParam String deviceSerial, @RequestParam(defaultValue = "1") Integer channelNo, @RequestParam(defaultValue = "0") Long startTime,@RequestParam(defaultValue = "0") Long endTime,@RequestParam(defaultValue = "0") Integer recType) { | ||
439 | + | ||
440 | + String url = YinShiServiceConfig.HostUrl + "lapp/video/by/time"; | ||
441 | + Map<String, Object> map = new HashMap<>(); | ||
442 | + map.put("accessToken", YinShiServiceConfig.AccessToken); | ||
443 | + map.put("deviceSerial", deviceSerial); | ||
444 | + map.put("channelNo",channelNo); | ||
445 | + | ||
446 | + if(startTime > 0) { | ||
447 | + map.put("startTime", startTime); | ||
448 | + } | ||
449 | + if(endTime > 0 ){ | ||
450 | + map.put("endTime",endTime); | ||
451 | + } | ||
452 | + | ||
453 | + map.put("recType",recType); | ||
454 | + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); | ||
455 | + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | ||
456 | + | ||
457 | + yinShiResResult.getData(); | ||
458 | + JSONArray jsonStr = (JSONArray)yinShiResResult.getData(); | ||
459 | + | ||
460 | + if(jsonStr.size()>0){ | ||
461 | + Page page = new Page(); | ||
462 | + page.setTotal(jsonStr.size()); | ||
463 | + yinShiResResult.setPage(page); | ||
464 | + } | ||
465 | + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | ||
466 | + } | ||
332 | } | 467 | } |
springboot/src/main/java/com/sincre/springboot/controller/Yinshi/DeviceControl.java
1 | package com.sincre.springboot.controller.Yinshi; | 1 | package com.sincre.springboot.controller.Yinshi; |
2 | 2 | ||
3 | +import com.alibaba.fastjson.JSON; | ||
4 | +import com.sincre.springboot.ApiModel.YinShiResResult; | ||
3 | import com.sincre.springboot.ApiPlatform.YinShiServiceConfig; | 5 | import com.sincre.springboot.ApiPlatform.YinShiServiceConfig; |
4 | -import com.sincre.springboot.common.MD5; | 6 | +import com.sincre.springboot.common.ServerResponse; |
5 | import com.sincre.springboot.utils.ApiHelper; | 7 | import com.sincre.springboot.utils.ApiHelper; |
8 | +import com.sincre.springboot.utils.ResultUtils; | ||
9 | +import io.swagger.annotations.Api; | ||
10 | +import io.swagger.annotations.ApiImplicitParam; | ||
11 | +import io.swagger.annotations.ApiImplicitParams; | ||
6 | import io.swagger.annotations.ApiOperation; | 12 | import io.swagger.annotations.ApiOperation; |
7 | import org.springframework.web.bind.annotation.GetMapping; | 13 | import org.springframework.web.bind.annotation.GetMapping; |
8 | import org.springframework.web.bind.annotation.RequestMapping; | 14 | import org.springframework.web.bind.annotation.RequestMapping; |
@@ -14,20 +20,42 @@ import java.util.Map; | @@ -14,20 +20,42 @@ import java.util.Map; | ||
14 | 20 | ||
15 | @RestController | 21 | @RestController |
16 | @RequestMapping("/YinShiDevice") | 22 | @RequestMapping("/YinShiDevice") |
23 | +@Api(tags = "设备管理部分接口—楼宇设备") | ||
17 | public class DeviceControl { | 24 | public class DeviceControl { |
18 | 25 | ||
19 | 26 | ||
20 | - @ApiOperation(value = "增加子账号") | ||
21 | - @GetMapping("/addDevice") | ||
22 | - public String addDevice(@RequestParam String deviceSerial, @RequestParam String validateCode) { | 27 | + @ApiOperation(value = "获取通话状态") |
28 | + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true) | ||
29 | + @GetMapping("getDeviceCallStatus") | ||
30 | + public ServerResponse getDeviceCallStatus(@RequestParam String deviceSerial) { | ||
23 | 31 | ||
24 | - String url = YinShiServiceConfig.HostUrl + "lapp/device/add"; | 32 | + String url = YinShiServiceConfig.HostUrl + "lapp/building/device/call/status"; |
25 | Map<String, Object> map = new HashMap<>(); | 33 | Map<String, Object> map = new HashMap<>(); |
26 | map.put("accessToken", YinShiServiceConfig.AccessToken); | 34 | map.put("accessToken", YinShiServiceConfig.AccessToken); |
27 | map.put("deviceSerial", deviceSerial); | 35 | map.put("deviceSerial", deviceSerial); |
28 | - map.put("validateCode", validateCode); | ||
29 | String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); | 36 | String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); |
30 | - System.out.println("result:"+result); | ||
31 | - return result;//ResultUtils.getInstance().resturnResultYingshi(result); | 37 | + |
38 | + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | ||
39 | + | ||
40 | + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | ||
41 | + } | ||
42 | + | ||
43 | + @ApiOperation(value = "该接口用于楼宇可视对讲设备通话操作") | ||
44 | + @ApiImplicitParams({ | ||
45 | + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true), | ||
46 | + @ApiImplicitParam(name = "type",value = "操作类型:2-接听,3-拒接, 4-响铃超时,5-挂断,6-被叫正在通话中",required = true) | ||
47 | + }) | ||
48 | + @GetMapping("setDeviceCall") | ||
49 | + public ServerResponse setDeviceCall(@RequestParam String deviceSerial,@RequestParam Integer type) { | ||
50 | + | ||
51 | + String url = YinShiServiceConfig.HostUrl + "lapp/building/device/call"; | ||
52 | + Map<String, Object> map = new HashMap<>(); | ||
53 | + map.put("accessToken", YinShiServiceConfig.AccessToken); | ||
54 | + map.put("deviceSerial", deviceSerial); | ||
55 | + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); | ||
56 | + | ||
57 | + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | ||
58 | + | ||
59 | + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | ||
32 | } | 60 | } |
33 | } | 61 | } |