lyhzzz 2 rokov pred
rodič
commit
e5f3d60914

+ 14 - 6
src/main/java/com/fdkankan/manage/service/impl/SceneProServiceImpl.java

@@ -247,6 +247,10 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         if((scenePro == null || scenePro.getCameraId() == null ) && (scenePlus== null || scenePlus.getCameraId() == null)){
         if((scenePro == null || scenePro.getCameraId() == null ) && (scenePlus== null || scenePlus.getCameraId() == null)){
             throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
             throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
         }
         }
+        Integer status =  scenePro == null ? scenePlus.getSceneStatus() : scenePro.getStatus();
+        if(status == 0){
+            throw new BusinessException(SceneConstant.FAILURE_CODE_5037, SceneConstant.FAILURE_MSG_5037);
+        }
 
 
         Long cameraId = scenePro == null ? scenePlus.getCameraId() : scenePro.getCameraId();
         Long cameraId = scenePro == null ? scenePlus.getCameraId() : scenePro.getCameraId();
         Long space = scenePro == null ? 0 :scenePro.getSpace();
         Long space = scenePro == null ? 0 :scenePro.getSpace();
@@ -282,14 +286,18 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         cameraDetailService.updateById(cameraDetail);
         cameraDetailService.updateById(cameraDetail);
 
 
         if(scenePro!=null){
         if(scenePro!=null){
-            scenePro.setCameraId(camera.getId());
-            scenePro.setUserId(cameraDetail.getUserId());
-            this.updateById(scenePro);
+            LambdaUpdateWrapper<ScenePro> wrapper = new LambdaUpdateWrapper<>();
+            wrapper.eq(ScenePro::getId,scenePro.getId());
+            wrapper.set(ScenePro::getCameraId,camera.getId());
+            wrapper.set(ScenePro::getUserId,cameraDetail.getUserId());
+            this.update(wrapper);
         }
         }
         if(scenePlus!=null){
         if(scenePlus!=null){
-            scenePlus.setCameraId(camera.getId());
-            scenePlus.setUserId(cameraDetail.getUserId());
-            scenePlusService.updateById(scenePlus);
+            LambdaUpdateWrapper<ScenePlus> wrapper = new LambdaUpdateWrapper<>();
+            wrapper.eq(ScenePlus::getId,scenePlus.getId());
+            wrapper.set(ScenePlus::getCameraId,camera.getId());
+            wrapper.set(ScenePlus::getUserId,cameraDetail.getUserId());
+            scenePlusService.update(wrapper);
         }
         }
         if(cameraDetail.getType() == 10){       //深时场景
         if(cameraDetail.getType() == 10){       //深时场景
             laserService.move(param.getNum(),oldCamera.getSnCode(),camera.getSnCode());
             laserService.move(param.getNum(),oldCamera.getSnCode(),camera.getSnCode());