lyhzzz 2 år sedan
förälder
incheckning
b5f1d3c9d6
1 ändrade filer med 32 tillägg och 28 borttagningar
  1. 32 28
      src/main/java/com/fdkankan/ucenter/service/impl/AppSceneService.java

+ 32 - 28
src/main/java/com/fdkankan/ucenter/service/impl/AppSceneService.java

@@ -104,36 +104,40 @@ public class AppSceneService {
             } else if (record.getStatus() == 500) {
                 record.setStatus(-1);
             }
-            record.setSceneSourceType(record.getUserId().longValue() == param.getUserId() ? 1 : 2);
-            Camera camera = cameraHashMap.get(record.getCameraId());
-            if(ObjectUtils.isEmpty(camera)){
-                continue;
-            }
-            CameraDetail cameraDetail = detailHashMap.get(camera.getId());
-            if(ObjectUtils.isEmpty(cameraDetail)){
-                continue;
-            }
-            record.setChildName(camera.getChildName());
-            record.setSnCode(camera.getSnCode());
-            if(cooperationNumList.contains(record.getNum())){
-                record.setSceneSourceType(2);
-                continue ;
-            }
-            //相机的userId为空,表示相机的场景
-            if (cameraDetail.getUserId() == null || param.getUserId() == null) {
-                record.setSceneSourceType(0);
-            } else if (cameraDetail.getUserId().longValue() == param.getUserId().longValue()) {
-                //相机用户id等于该用户id,既为用户的场景
-                record.setSceneSourceType(1);
-            } else if (camera.getId() != null && cameraDetail.getCameraId().longValue() == camera.getId().longValue()) {
-                if (cameraDetail.getCooperationUser() == null) {
-                    //场景相机id等于该相机id
-                    record.setSceneSourceType(0);
-                } else if (cameraDetail.getCooperationUser().longValue() == param.getUserId().longValue()) {
+            if(record.getCameraId() == null){
+                record.setSceneSourceType(record.getUserId().longValue() == param.getUserId() ? 1 : 2);
+            }else {
+                record.setSceneSourceType(record.getUserId().longValue() == param.getUserId() ? 1 : 2);
+                Camera camera = cameraHashMap.get(record.getCameraId());
+                if(ObjectUtils.isEmpty(camera)){
+                    continue;
+                }
+                CameraDetail cameraDetail = detailHashMap.get(camera.getId());
+                if(ObjectUtils.isEmpty(cameraDetail)){
+                    continue;
+                }
+                record.setChildName(camera.getChildName());
+                record.setSnCode(camera.getSnCode());
+                if(cooperationNumList.contains(record.getNum())){
                     record.setSceneSourceType(2);
+                    continue ;
+                }
+                //相机的userId为空,表示相机的场景
+                if (cameraDetail.getUserId() == null || param.getUserId() == null) {
+                    record.setSceneSourceType(0);
+                } else if (cameraDetail.getUserId().longValue() == param.getUserId().longValue()) {
+                    //相机用户id等于该用户id,既为用户的场景
+                    record.setSceneSourceType(1);
+                } else if (camera.getId() != null && cameraDetail.getCameraId().longValue() == camera.getId().longValue()) {
+                    if (cameraDetail.getCooperationUser() == null) {
+                        //场景相机id等于该相机id
+                        record.setSceneSourceType(0);
+                    } else if (cameraDetail.getCooperationUser().longValue() == param.getUserId().longValue()) {
+                        record.setSceneSourceType(2);
+                    }
+                } else {
+                    record.setSceneSourceType(0);
                 }
-            } else {
-                record.setSceneSourceType(0);
             }
 
         }