|
@@ -44,33 +44,33 @@ public class FdUserCameraController extends BaseController {
|
|
/**
|
|
/**
|
|
* 用户添加设备
|
|
* 用户添加设备
|
|
*/
|
|
*/
|
|
-// @RequestMapping(value = "/add", method = RequestMethod.POST)
|
|
|
|
-// public Result addCamera(@RequestBody JSONObject param) throws Exception {
|
|
|
|
-// if(ObjectUtils.isEmpty(param.getString("snCode"))){
|
|
|
|
-// throw new BusinessException(-1,"缺少必要参数");
|
|
|
|
-// }
|
|
|
|
-// String snCode = param.getString("snCode");
|
|
|
|
-// Camera cameraEntity = cameraService.getBySnCode(snCode);
|
|
|
|
-// if(ObjectUtils.isEmpty(cameraEntity)){
|
|
|
|
-// throw new BusinessException(CameraConstant.FAILURE_CODE_6020,CameraConstant.FAILURE_MSG_6020);
|
|
|
|
-// }
|
|
|
|
-// CameraDetail cameraDetailEntity = cameraDetailService.getByCameraId(cameraEntity.getId());
|
|
|
|
-// if(ObjectUtils.isEmpty(cameraDetailEntity)){
|
|
|
|
-// throw new BusinessException(CameraConstant.FAILURE_CODE_6020,CameraConstant.FAILURE_MSG_6020);
|
|
|
|
-// }
|
|
|
|
-// if (ObjectUtils.isEmpty(cameraDetailEntity.getCompanyId())) {
|
|
|
|
-// throw new BusinessException(CameraConstant.FAILURE_CODE_6005, CameraConstant.FAILURE_MSG_6005);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// if(cameraDetailEntity.getUserId() != null){
|
|
|
|
-// throw new BusinessException(AppConstant.FAILURE_CODE_4011, AppConstant.FAILURE_MSG_4011);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// // 绑定相机
|
|
|
|
-// cameraService.bind(cameraDetailEntity.getType(),cameraEntity.getSnCode(), JwtUtil.getUsername(getToken()));
|
|
|
|
-//
|
|
|
|
-// return Result.success();
|
|
|
|
-// }
|
|
|
|
|
|
+ @RequestMapping(value = "/add", method = RequestMethod.POST)
|
|
|
|
+ public Result addCamera(@RequestBody JSONObject param) throws Exception {
|
|
|
|
+ if(ObjectUtils.isEmpty(param.getString("snCode"))){
|
|
|
|
+ throw new BusinessException(-1,"缺少必要参数");
|
|
|
|
+ }
|
|
|
|
+ String snCode = param.getString("snCode");
|
|
|
|
+ Camera cameraEntity = cameraService.getBySnCode(snCode);
|
|
|
|
+ if(ObjectUtils.isEmpty(cameraEntity)){
|
|
|
|
+ throw new BusinessException(CameraConstant.FAILURE_CODE_6020,CameraConstant.FAILURE_MSG_6020);
|
|
|
|
+ }
|
|
|
|
+ CameraDetail cameraDetailEntity = cameraDetailService.getByCameraId(cameraEntity.getId());
|
|
|
|
+ if(ObjectUtils.isEmpty(cameraDetailEntity)){
|
|
|
|
+ throw new BusinessException(CameraConstant.FAILURE_CODE_6020,CameraConstant.FAILURE_MSG_6020);
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtils.isEmpty(cameraDetailEntity.getCompanyId())) {
|
|
|
|
+ throw new BusinessException(CameraConstant.FAILURE_CODE_6005, CameraConstant.FAILURE_MSG_6005);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(cameraDetailEntity.getUserId() != null){
|
|
|
|
+ throw new BusinessException(AppConstant.FAILURE_CODE_4011, AppConstant.FAILURE_MSG_4011);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 绑定相机
|
|
|
|
+ cameraService.bind(cameraDetailEntity.getType(),cameraEntity.getSnCode(), JwtUtil.getUsername(getToken()));
|
|
|
|
+
|
|
|
|
+ return Result.success();
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取用户设备
|
|
* 获取用户设备
|