Browse Source

Merge branch 'hotfix-28748-20220623' into release

dengsixing 3 years ago
parent
commit
7f2f9b4ba2

+ 17 - 1
4dkankan-center-scene/src/main/java/com/fdkankan/scene/Interceptor/CheckCooperationPermitAspect.java

@@ -2,6 +2,7 @@ package com.fdkankan.scene.Interceptor;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
+import com.fdkankan.common.constant.CommonStatus;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.constant.ServerCode;
 import com.fdkankan.common.exception.BusinessException;
@@ -64,12 +65,27 @@ public class CheckCooperationPermitAspect {
 			throw new BusinessException(ErrorCode.PARAM_REQUIRED);
 		}
 
-
 		//判断是不是场景原用户,如果是,跳出
         ScenePlus scenePlus= scenePlusService.getScenePlusByNum(num);
 		if(Objects.isNull(scenePlus)){
 			throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
 		}
+
+		//判断是否相机登录,是否场景的相机id和相机登录的相机id是否相等,如果都满足,则放行,否则判定为用户登录
+		if(Objects.nonNull(user.getCameraLogin())
+			&& CommonStatus.YES.code().byteValue() == user.getCameraLogin().intValue()){
+			if(scenePlus.getCameraId().equals(user.getCameraId())){
+				return;
+			}else{
+				throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
+			}
+		}
+
+		//走到这里代表是用户账号密码登录,如果查到的场景的userid是空,证明相机解绑了,需要返回无权操作
+		if(Objects.isNull(scenePlus.getUserId())){
+			throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
+		}
+
         if(scenePlus.getUserId().equals(user.getId())){
             return;
         }

+ 8 - 0
4dkankan-common/src/main/java/com/fdkankan/common/model/SSOUser.java

@@ -26,4 +26,12 @@ public class SSOUser implements Serializable {
 
     private Set<String> roleSet;
 
+    /**
+     * 是否相机登录,0-否,1-是
+     */
+    private Integer cameraLogin;
+
+    private Long cameraId;
+
+
 }