瀏覽代碼

编辑权限校验改为调用管理后台的接口

dsx 1 年之前
父節點
當前提交
8f195b1784

+ 16 - 22
src/main/java/com/fdkankan/scene/Interceptor/CheckPermitAspect.java

@@ -1,6 +1,9 @@
 package com.fdkankan.scene.Interceptor;
 
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.HttpResponse;
+import cn.hutool.http.HttpUtil;
+import com.alibaba.fastjson.JSON;
 import com.fdkankan.common.constant.CommonStatus;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.constant.SceneStatus;
@@ -15,6 +18,8 @@ import com.fdkankan.scene.service.IJyUserService;
 import com.fdkankan.scene.service.ISceneCooperationService;
 import com.fdkankan.scene.service.IScenePlusService;
 import com.fdkankan.scene.util.JmgaSSOLoginHelper;
+import com.fdkankan.scene.vo.CheckNumAuthVo;
+import com.fdkankan.web.response.ResultData;
 import com.fdkankan.web.user.SSOLoginHelper;
 import com.fdkankan.web.user.SSOUser;
 import com.fdkankan.web.util.WebUtil;
@@ -27,6 +32,7 @@ import org.aspectj.lang.annotation.Aspect;
 import org.aspectj.lang.annotation.Before;
 import org.aspectj.lang.annotation.Pointcut;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.core.annotation.Order;
 import org.springframework.stereotype.Component;
 import org.springframework.web.context.request.RequestContextHolder;
@@ -38,6 +44,9 @@ import org.springframework.web.context.request.ServletRequestAttributes;
 @Order(101)
 public class CheckPermitAspect {
 
+	@Value("4dkk.v4fdService.basePath")
+	private String host;
+
 	@Autowired
 	private JmgaSSOLoginHelper jmgaSSOLoginHelper;
 	@Autowired
@@ -97,29 +106,14 @@ public class CheckPermitAspect {
 		}
 
 		//当前用户与场景用户id相同,则拥有最高权限,可以编辑
-		JyUser jyUser = jyUserService.getBySysUserId(user.getId().intValue());
-		if(Objects.nonNull(scenePlus.getUserId()) && Objects.nonNull(jyUser) && scenePlus.getUserId().intValue() == jyUser.getUserId()){
-			return;
-		}
-
-		//查询当前场景是否是业务授权场景
-		if(jySceneUserAuthService.checkEditBizAuth(num, user.getId().intValue())){
-			return;
+		String url = host.concat("/service/manage/inner/checkNumAuth/").concat(num);
+		String body = HttpUtil.createGet(url).header("token", request.getHeader("token")).execute().body();
+		log.info("checkNumAuth:{}", body);
+		ResultData resultData = JSON.parseObject(body, ResultData.class);
+		CheckNumAuthVo data = (CheckNumAuthVo) resultData.getData();
+		if(!data.isEditAuth()){
+			throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
 		}
-
-		//如果不是用户自己的场景,判断是否有协作权限
-        Long userId = null;
-		SceneCooperation sceneCooperation = sceneCooperationService.getByNum(num);
-		if(Objects.nonNull(sceneCooperation)){
-			userId = sceneCooperation.getUserId();
-		}
-
-		if(Objects.isNull(userId)){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
-        }
-        if(!userId.equals(user.getId())){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
-        }
 	}
 
 

+ 10 - 0
src/main/java/com/fdkankan/scene/vo/CheckNumAuthVo.java

@@ -0,0 +1,10 @@
+package com.fdkankan.scene.vo;
+
+import lombok.Data;
+
+@Data
+public class CheckNumAuthVo {
+
+    private boolean viewAuth;
+    private boolean editAuth;
+}