lyhzzz 1 anno fa
parent
commit
23bdc4e0b0

+ 16 - 16
src/main/java/com/fdkankan/agent/service/impl/SceneProServiceImpl.java

@@ -113,28 +113,28 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             throw new BusinessException(ResultCode.CAMERA_EMPTY);
         }
 
-//        Long needSpace = 0L;
-//        if(scenePro != null){
-//            needSpace = scenePro.getSpace();
-//        }
-//        if(scenePlus != null){
-//            ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
-//            if(scenePlusExt != null && scenePlusExt.getSpace() != null){
-//                needSpace = scenePlusExt.getSpace();
-//            }
-//        }
-//        Boolean checkSpace = cameraDetailService.checkSpace(detailEntity, needSpace);
-//
-//        if(!checkSpace){
-//            throw new BusinessException(ResultCode.CAMERA_SPACE_ERROR);
-//        }
+        Long needSpace = 0L;
+        if(scenePro != null){
+            needSpace = scenePro.getSpace();
+        }
+        if(scenePlus != null){
+            ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
+            if(scenePlusExt != null && scenePlusExt.getSpace() != null){
+                needSpace = scenePlusExt.getSpace();
+            }
+        }
+        Boolean checkSpace = cameraDetailService.checkSpace(detailEntity, needSpace);
+
+        if(!checkSpace){
+            throw new BusinessException(ResultCode.CAMERA_SPACE_ERROR);
+        }
 
         HashMap<String, Object> param = new HashMap<>();
         param.put("num",sceneNum);
         JSONObject jsonObject = fdKKClient.copyScene(param, "m_a_n_a_g_e");
         Integer code = jsonObject.getInteger("code");
         if(code != 0){
-            throw new BusinessException(jsonObject.getInteger("code"),jsonObject.getString("message"));
+            throw new BusinessException(jsonObject.getInteger("code"),jsonObject.getString("msg"));
         }
 
     }