AppCameraController.java 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package com.fdkankan.ucenter.controller.app;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.fdkankan.ucenter.common.Result;
  4. import com.fdkankan.ucenter.service.impl.AppCameraService;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.web.bind.annotation.PostMapping;
  7. import org.springframework.web.bind.annotation.RequestBody;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.RestController;
  10. @RestController
  11. @RequestMapping("/app/camera")
  12. public class AppCameraController {
  13. @Autowired
  14. private AppCameraService appCameraService;
  15. @PostMapping("/getCamerasForUser")
  16. public Result getCamerasForUser(@RequestBody JSONObject param ){
  17. String userName = param.get("userName") == null ? null : param.getString("userName");
  18. Integer cameraType = param.get("cameraType") == null ? null : param.getInteger("cameraType");
  19. return Result.success(appCameraService.getCameraForUser(userName,cameraType));
  20. }
  21. /**
  22. * 绑定相机
  23. */
  24. @PostMapping("/bindCamera")
  25. public Result bindCamera(@RequestBody JSONObject param ){
  26. String userName = param.get("userName") == null ? null : param.getString("userName");
  27. String snCode = param.get("snCode") == null ? null : param.getString("snCode");
  28. return Result.success(appCameraService.bindCamera(userName,snCode));
  29. }
  30. /**
  31. * 解绑相机
  32. */
  33. @PostMapping("/unbind")
  34. public Result unbind(@RequestBody JSONObject param ){
  35. String userName = param.get("userName") == null ? null : param.getString("userName");
  36. String childName = param.get("childName") == null ? null : param.getString("childName");
  37. appCameraService.unbindCamera(userName,childName);
  38. return Result.success();
  39. }
  40. /**
  41. * 获取相机信息
  42. */
  43. @PostMapping("/getCameraInfo")
  44. public Result getCameraInfo(@RequestBody JSONObject param ){
  45. String childName = param.get("childName") == null ? null : param.getString("childName");
  46. String childPassword = param.get("childPassword") == null ? null : param.getString("childPassword");
  47. return Result.success(appCameraService.getCameraInfo(childName,childPassword));
  48. }
  49. }