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 e7e4b0a..3dd09fb 100644 --- a/springboot/src/main/java/com/sincre/springboot/controller/YinShiController.java +++ b/springboot/src/main/java/com/sincre/springboot/controller/YinShiController.java @@ -195,11 +195,135 @@ public class YinShiController { public ServerResponse getChildAccountToken(@RequestParam String accountId) { String url = YinShiServiceConfig.HostUrl + "lapp/ram/token/get"; - Map map1 = new HashMap<>(); + Map map = new HashMap<>(); + + map.put("accessToken", YinShiServiceConfig.AccessToken); + map.put("accountId", accountId); + String result = ApiHelper.doPost(url, new HashMap(), map); + + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); + + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); + } + + - map1.put("accessToken", YinShiServiceConfig.AccessToken); - map1.put("accountId", accountId); - String result = ApiHelper.doPost(url, new HashMap(), map1); + @ApiOperation(value = "添加设备到账号下") + @ApiImplicitParams({ + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true), + @ApiImplicitParam(name="validateCode",value = "备验证码,设备机身上的六位大写字母,如OLZKQU",required = true) + }) + @GetMapping("addAccountDevice") + public ServerResponse addAccountDevice(@RequestParam String deviceSerial,@RequestParam String validateCode) { + + String url = YinShiServiceConfig.HostUrl + "lapp/device/add"; + 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); + + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); + + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); + } + + @ApiOperation(value = "修改设备的名称") + @ApiImplicitParams({ + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true), + @ApiImplicitParam(name="deviceName",value = "设备名称,长度不大于50字节,不能包含特殊字符",required = true) + }) + @GetMapping("updateDeviceName") + public ServerResponse updateDeviceName(@RequestParam String deviceName,@RequestParam String deviceSerial) { + + String url = YinShiServiceConfig.HostUrl + "lapp/device/name/update"; + Map map = new HashMap<>(); + + map.put("accessToken", YinShiServiceConfig.AccessToken); + map.put("deviceSerial", deviceSerial); + map.put("deviceName", deviceName); + 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("deleteDevice") + public ServerResponse deleteDevice(@RequestParam String deviceSerial) { + + String url = YinShiServiceConfig.HostUrl + "lapp/device/delete"; + 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="channelNo",value = "通道号,IPC设备填写1",required = true), + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true) + }) + @GetMapping("deviceCapture") + public ServerResponse deviceCapture(@RequestParam Integer channelNo,@RequestParam String deviceSerial) { + + String url = YinShiServiceConfig.HostUrl + "lapp/device/capture"; + 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 = "获取设备列表") + @ApiImplicitParams({ + @ApiImplicitParam(name="pageIndex", value = "分页起始页,从1开始",required = true), + @ApiImplicitParam(name="pageSize", value = "分页大小,默认为10,最大为50") + }) + @GetMapping("getDeviceList") + public ServerResponse getDeviceList(@RequestParam("pageIndex") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize) { + + pageIndex = pageIndex - 1; + String url = YinShiServiceConfig.HostUrl + "lapp/device/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 = "获取单个设备信息") + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true) + @GetMapping("getDeviceInfo") + public ServerResponse getDeviceInfo(@RequestParam String deviceSerial) { + + String url = YinShiServiceConfig.HostUrl + "lapp/device/info"; + 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); diff --git a/springboot/src/main/java/com/sincre/springboot/utils/ResultUtils.java b/springboot/src/main/java/com/sincre/springboot/utils/ResultUtils.java index e1ce2f2..4886847 100644 --- a/springboot/src/main/java/com/sincre/springboot/utils/ResultUtils.java +++ b/springboot/src/main/java/com/sincre/springboot/utils/ResultUtils.java @@ -60,7 +60,7 @@ public class ResultUtils { return ServerResponse.createByErrorMessage("服务器内部处理出错!"); } } - + /** * 涂鸦云返回结果 * @param -- libgit2 0.21.0