diff --git a/springboot/src/main/java/com/sincre/springboot/ApiPlatform/YinShiServiceConfig.java b/springboot/src/main/java/com/sincre/springboot/ApiPlatform/YinShiServiceConfig.java index 911454f..8fd1eac 100644 --- a/springboot/src/main/java/com/sincre/springboot/ApiPlatform/YinShiServiceConfig.java +++ b/springboot/src/main/java/com/sincre/springboot/ApiPlatform/YinShiServiceConfig.java @@ -14,7 +14,7 @@ public class YinShiServiceConfig { /** * 用于管理员获取accessToken */ - public static String AccessToken = ""; + public static String AccessToken = "at.81rs7cox2ckxiw4v8t4wrt6k07ehcbw2-6ii49gj6ji-1j6mggg-xnrve0akm"; //测试阶段先写死 diff --git a/springboot/src/main/java/com/sincre/springboot/controller/YinShiController.java b/springboot/src/main/java/com/sincre/springboot/controller/YinShiController.java index 3dd09fb..3710acf 100644 --- a/springboot/src/main/java/com/sincre/springboot/controller/YinShiController.java +++ b/springboot/src/main/java/com/sincre/springboot/controller/YinShiController.java @@ -2,6 +2,8 @@ package com.sincre.springboot.controller; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.sincre.springboot.ApiModel.Page; import com.sincre.springboot.ApiModel.YinShiResResult; import com.sincre.springboot.ApiPlatform.YinShiServiceConfig; import com.sincre.springboot.common.MD5; @@ -329,4 +331,137 @@ public class YinShiController { return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); } + + @ApiOperation(value = "获取摄像头列表") + @ApiImplicitParams({ + @ApiImplicitParam(name="pageIndex", value = "分页起始页,从1开始",required = true), + @ApiImplicitParam(name="pageSize", value = "分页大小,默认为10,最大为50") + }) + @GetMapping("getCameraList") + public ServerResponse getCameraList(@RequestParam("pageIndex") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize) { + + pageIndex = pageIndex - 1; + String url = YinShiServiceConfig.HostUrl + "lapp/camera/list"; + Map map = new HashMap<>(); + map.put("accessToken", YinShiServiceConfig.AccessToken); + map.put("pageStart", pageIndex); + map.put("pageSize", pageSize); + String result = ApiHelper.doPost(url, new HashMap(), map); + + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); + + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); + } + + @ApiOperation(value = "获取设备状态信息") + @ApiImplicitParams({ + @ApiImplicitParam(name="channelNo",value = "通道号,IPC设备填写1",required = false), + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true) + }) + @GetMapping("getDeviceStatus") + public ServerResponse getDeviceStatus(@RequestParam(defaultValue = "1") Integer channelNo,@RequestParam String deviceSerial) { + + String url = YinShiServiceConfig.HostUrl + "lapp/device/status/get"; + Map map = new HashMap<>(); + map.put("accessToken", YinShiServiceConfig.AccessToken); + map.put("deviceSerial", deviceSerial); + map.put("channelNo",channelNo); + + String result = ApiHelper.doPost(url, new HashMap(), map); + + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); + + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); + } + + @ApiOperation(value = "获取设备的通道信息") + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true) + @GetMapping("getDeviceChanNoInfo") + public ServerResponse getDeviceChanNoInfo(@RequestParam String deviceSerial) { + + String url = YinShiServiceConfig.HostUrl + "lapp/device/camera/list"; + Map map = new HashMap<>(); + map.put("accessToken", YinShiServiceConfig.AccessToken); + map.put("deviceSerial", deviceSerial); + String result = ApiHelper.doPost(url, new HashMap(), map); + + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); + + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); + } + + @ApiOperation(value = "查询设备是否支持萤石协议") + @ApiImplicitParams({ + @ApiImplicitParam(name="model",value = "设备型号",required = true), + @ApiImplicitParam(name="version",value = "设备版本号",required = true) + }) + @GetMapping("isSupportEZVIZ") + public ServerResponse isSupportEZVIZ(@RequestParam String model,@RequestParam String version) { + + String url = YinShiServiceConfig.HostUrl + "lapp/device/support/ezviz"; + Map map = new HashMap<>(); + map.put("appKey", YinShiServiceConfig.appKey); + map.put("model", model); + map.put("version",version); + String result = ApiHelper.doPost(url, new HashMap(), map); + + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); + + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); + } + + @ApiOperation(value = "根据设备序列号查询设备能力集") + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true) + @GetMapping("getDeviceCapacity") + public ServerResponse getDeviceCapacity(@RequestParam String deviceSerial) { + + String url = YinShiServiceConfig.HostUrl + "lapp/device/capacity"; + Map map = new HashMap<>(); + map.put("accessToken", YinShiServiceConfig.AccessToken); + map.put("deviceSerial", deviceSerial); + String result = ApiHelper.doPost(url, new HashMap(), map); + + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); + + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); + } + + @ApiOperation(value = "根据时间获取存储文件信息") + @ApiImplicitParams({ + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true), + @ApiImplicitParam(name="channelNo",value = "通道号,非必选,默认为1",dataType = "Integer"), + @ApiImplicitParam(name= "startTime",value = "起始时间,时间格式为:1378345128000。非必选,默认为当天0点",dataType = "Long"), + @ApiImplicitParam(name= "endTime",value = "结束时间,时间格式为:1378345128000。非必选,默认为当前时间",dataType = "Long"), + @ApiImplicitParam(name = "recType",value = "回放源,0-系统自动选择,1-云存储,2-本地录像。非必选,默认为0") + }) + @GetMapping("getVideoFileByTime") + 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) { + + String url = YinShiServiceConfig.HostUrl + "lapp/video/by/time"; + Map map = new HashMap<>(); + map.put("accessToken", YinShiServiceConfig.AccessToken); + map.put("deviceSerial", deviceSerial); + map.put("channelNo",channelNo); + + if(startTime > 0) { + map.put("startTime", startTime); + } + if(endTime > 0 ){ + map.put("endTime",endTime); + } + + map.put("recType",recType); + String result = ApiHelper.doPost(url, new HashMap(), map); + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); + + yinShiResResult.getData(); + JSONArray jsonStr = (JSONArray)yinShiResResult.getData(); + + if(jsonStr.size()>0){ + Page page = new Page(); + page.setTotal(jsonStr.size()); + yinShiResResult.setPage(page); + } + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); + } } diff --git a/springboot/src/main/java/com/sincre/springboot/controller/Yinshi/DeviceControl.java b/springboot/src/main/java/com/sincre/springboot/controller/Yinshi/DeviceControl.java index 0f62c7e..a199f46 100644 --- a/springboot/src/main/java/com/sincre/springboot/controller/Yinshi/DeviceControl.java +++ b/springboot/src/main/java/com/sincre/springboot/controller/Yinshi/DeviceControl.java @@ -1,8 +1,14 @@ package com.sincre.springboot.controller.Yinshi; +import com.alibaba.fastjson.JSON; +import com.sincre.springboot.ApiModel.YinShiResResult; import com.sincre.springboot.ApiPlatform.YinShiServiceConfig; -import com.sincre.springboot.common.MD5; +import com.sincre.springboot.common.ServerResponse; import com.sincre.springboot.utils.ApiHelper; +import com.sincre.springboot.utils.ResultUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -14,20 +20,42 @@ import java.util.Map; @RestController @RequestMapping("/YinShiDevice") +@Api(tags = "设备管理部分接口—楼宇设备") public class DeviceControl { - @ApiOperation(value = "增加子账号") - @GetMapping("/addDevice") - public String addDevice(@RequestParam String deviceSerial, @RequestParam String validateCode) { + @ApiOperation(value = "获取通话状态") + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true) + @GetMapping("getDeviceCallStatus") + public ServerResponse getDeviceCallStatus(@RequestParam String deviceSerial) { - String url = YinShiServiceConfig.HostUrl + "lapp/device/add"; + String url = YinShiServiceConfig.HostUrl + "lapp/building/device/call/status"; Map map = new HashMap<>(); map.put("accessToken", YinShiServiceConfig.AccessToken); map.put("deviceSerial", deviceSerial); - map.put("validateCode", validateCode); String result = ApiHelper.doPost(url, new HashMap(), map); - System.out.println("result:"+result); - return result;//ResultUtils.getInstance().resturnResultYingshi(result); + + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); + + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); + } + + @ApiOperation(value = "该接口用于楼宇可视对讲设备通话操作") + @ApiImplicitParams({ + @ApiImplicitParam(name = "deviceSerial", value = "设备序列号", required = true), + @ApiImplicitParam(name = "type",value = "操作类型:2-接听,3-拒接, 4-响铃超时,5-挂断,6-被叫正在通话中",required = true) + }) + @GetMapping("setDeviceCall") + public ServerResponse setDeviceCall(@RequestParam String deviceSerial,@RequestParam Integer type) { + + String url = YinShiServiceConfig.HostUrl + "lapp/building/device/call"; + Map map = new HashMap<>(); + map.put("accessToken", YinShiServiceConfig.AccessToken); + map.put("deviceSerial", deviceSerial); + String result = ApiHelper.doPost(url, new HashMap(), map); + + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); + + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); } } -- libgit2 0.21.0