Commit fa4996ff66952ea08dff656ce36f31999ab931d5
1 parent
41b4900a
Exists in
master
萤石设备管理接口对接和部分查询接口对接
Showing
2 changed files
with
129 additions
and
5 deletions
Show diff stats
springboot/src/main/java/com/sincre/springboot/controller/YinShiController.java
@@ -195,11 +195,135 @@ public class YinShiController { | @@ -195,11 +195,135 @@ public class YinShiController { | ||
195 | public ServerResponse getChildAccountToken(@RequestParam String accountId) { | 195 | public ServerResponse getChildAccountToken(@RequestParam String accountId) { |
196 | 196 | ||
197 | String url = YinShiServiceConfig.HostUrl + "lapp/ram/token/get"; | 197 | String url = YinShiServiceConfig.HostUrl + "lapp/ram/token/get"; |
198 | - Map<String, Object> map1 = new HashMap<>(); | 198 | + Map<String, Object> map = new HashMap<>(); |
199 | + | ||
200 | + map.put("accessToken", YinShiServiceConfig.AccessToken); | ||
201 | + map.put("accountId", accountId); | ||
202 | + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); | ||
203 | + | ||
204 | + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | ||
205 | + | ||
206 | + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | ||
207 | + } | ||
208 | + | ||
209 | + | ||
199 | 210 | ||
200 | - map1.put("accessToken", YinShiServiceConfig.AccessToken); | ||
201 | - map1.put("accountId", accountId); | ||
202 | - String result = ApiHelper.doPost(url, new HashMap<String, String>(), map1); | 211 | + @ApiOperation(value = "添加设备到账号下") |
212 | + @ApiImplicitParams({ | ||
213 | + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true), | ||
214 | + @ApiImplicitParam(name="validateCode",value = "备验证码,设备机身上的六位大写字母,如OLZKQU",required = true) | ||
215 | + }) | ||
216 | + @GetMapping("addAccountDevice") | ||
217 | + public ServerResponse addAccountDevice(@RequestParam String deviceSerial,@RequestParam String validateCode) { | ||
218 | + | ||
219 | + String url = YinShiServiceConfig.HostUrl + "lapp/device/add"; | ||
220 | + Map<String, Object> map = new HashMap<>(); | ||
221 | + | ||
222 | + map.put("accessToken", YinShiServiceConfig.AccessToken); | ||
223 | + map.put("deviceSerial", deviceSerial); | ||
224 | + map.put("validateCode", validateCode); | ||
225 | + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); | ||
226 | + | ||
227 | + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | ||
228 | + | ||
229 | + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | ||
230 | + } | ||
231 | + | ||
232 | + @ApiOperation(value = "修改设备的名称") | ||
233 | + @ApiImplicitParams({ | ||
234 | + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true), | ||
235 | + @ApiImplicitParam(name="deviceName",value = "设备名称,长度不大于50字节,不能包含特殊字符",required = true) | ||
236 | + }) | ||
237 | + @GetMapping("updateDeviceName") | ||
238 | + public ServerResponse updateDeviceName(@RequestParam String deviceName,@RequestParam String deviceSerial) { | ||
239 | + | ||
240 | + String url = YinShiServiceConfig.HostUrl + "lapp/device/name/update"; | ||
241 | + Map<String, Object> map = new HashMap<>(); | ||
242 | + | ||
243 | + map.put("accessToken", YinShiServiceConfig.AccessToken); | ||
244 | + map.put("deviceSerial", deviceSerial); | ||
245 | + map.put("deviceName", deviceName); | ||
246 | + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); | ||
247 | + | ||
248 | + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | ||
249 | + | ||
250 | + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | ||
251 | + } | ||
252 | + | ||
253 | + @ApiOperation(value = "删除设备") | ||
254 | + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true) | ||
255 | + @GetMapping("deleteDevice") | ||
256 | + public ServerResponse deleteDevice(@RequestParam String deviceSerial) { | ||
257 | + | ||
258 | + String url = YinShiServiceConfig.HostUrl + "lapp/device/delete"; | ||
259 | + Map<String, Object> map = new HashMap<>(); | ||
260 | + map.put("accessToken", YinShiServiceConfig.AccessToken); | ||
261 | + map.put("deviceSerial", deviceSerial); | ||
262 | + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); | ||
263 | + | ||
264 | + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | ||
265 | + | ||
266 | + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | ||
267 | + } | ||
268 | + | ||
269 | + @ApiOperation(value = "设备抓拍图片") | ||
270 | + @ApiImplicitParams({ | ||
271 | + @ApiImplicitParam(name="channelNo",value = "通道号,IPC设备填写1",required = true), | ||
272 | + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true) | ||
273 | + }) | ||
274 | + @GetMapping("deviceCapture") | ||
275 | + public ServerResponse deviceCapture(@RequestParam Integer channelNo,@RequestParam String deviceSerial) { | ||
276 | + | ||
277 | + String url = YinShiServiceConfig.HostUrl + "lapp/device/capture"; | ||
278 | + Map<String, Object> map = new HashMap<>(); | ||
279 | + map.put("accessToken", YinShiServiceConfig.AccessToken); | ||
280 | + map.put("deviceSerial", deviceSerial); | ||
281 | + map.put("channelNo",channelNo); | ||
282 | + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); | ||
283 | + | ||
284 | + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | ||
285 | + | ||
286 | + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | ||
287 | + } | ||
288 | + | ||
289 | + | ||
290 | + | ||
291 | + | ||
292 | + | ||
293 | + | ||
294 | + | ||
295 | + @ApiOperation(value = "获取设备列表") | ||
296 | + @ApiImplicitParams({ | ||
297 | + @ApiImplicitParam(name="pageIndex", value = "分页起始页,从1开始",required = true), | ||
298 | + @ApiImplicitParam(name="pageSize", value = "分页大小,默认为10,最大为50") | ||
299 | + }) | ||
300 | + @GetMapping("getDeviceList") | ||
301 | + public ServerResponse getDeviceList(@RequestParam("pageIndex") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize) { | ||
302 | + | ||
303 | + pageIndex = pageIndex - 1; | ||
304 | + String url = YinShiServiceConfig.HostUrl + "lapp/device/list"; | ||
305 | + Map<String, Object> map = new HashMap<>(); | ||
306 | + | ||
307 | + map.put("accessToken", YinShiServiceConfig.AccessToken); | ||
308 | + map.put("pageStart", pageIndex); | ||
309 | + map.put("pageSize", pageSize); | ||
310 | + String result = ApiHelper.doPost(url, new HashMap<String,String>(), map); | ||
311 | + | ||
312 | + YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | ||
313 | + | ||
314 | + return ResultUtils.getInstance().returnResultYingshi(yinShiResResult); | ||
315 | + } | ||
316 | + | ||
317 | + @ApiOperation(value = "获取单个设备信息") | ||
318 | + @ApiImplicitParam(name="deviceSerial",value = "设备序列号",required = true) | ||
319 | + @GetMapping("getDeviceInfo") | ||
320 | + public ServerResponse getDeviceInfo(@RequestParam String deviceSerial) { | ||
321 | + | ||
322 | + String url = YinShiServiceConfig.HostUrl + "lapp/device/info"; | ||
323 | + Map<String, Object> map = new HashMap<>(); | ||
324 | + map.put("accessToken", YinShiServiceConfig.AccessToken); | ||
325 | + map.put("deviceSerial", deviceSerial); | ||
326 | + String result = ApiHelper.doPost(url, new HashMap<String, String>(), map); | ||
203 | 327 | ||
204 | YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); | 328 | YinShiResResult yinShiResResult = JSON.parseObject(result,YinShiResResult.class); |
205 | 329 |
springboot/src/main/java/com/sincre/springboot/utils/ResultUtils.java
@@ -60,7 +60,7 @@ public class ResultUtils { | @@ -60,7 +60,7 @@ public class ResultUtils { | ||
60 | return ServerResponse.createByErrorMessage("服务器内部处理出错!"); | 60 | return ServerResponse.createByErrorMessage("服务器内部处理出错!"); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | - | 63 | + |
64 | /** | 64 | /** |
65 | * 涂鸦云返回结果 | 65 | * 涂鸦云返回结果 |
66 | * @param | 66 | * @param |