Browse Source

优化账号集团编码判断逻辑

zhangqiankun 3 years ago
parent
commit
bc52c75f44

+ 1 - 1
saas-account/src/main/java/com/persagy/account/controller/SaasAreaController.java

@@ -100,7 +100,7 @@ public class SaasAreaController {
     		if (StringUtil.isNotBlank(authMap.get(CipherConstants.GROUP_CODE))) {
     			queryVO.setGroupCode(authMap.get(CipherConstants.GROUP_CODE));
     		}
-        	// 添加数据访问控制,账号可见域,0-所有集团项目,1-单集团所有项目(此时,集团编码需存在),2-其他
+        	// 添加数据访问控制,账号可见域,0-所有集团项目,1-单集团所有项目,2-其他
     		String accountType = authMap.get(SaasCommonConstant.ACCOUNT_TYPE);
     		if (SaasCommonConstant.STR_STATUS_2.equals(accountType)) {
     			isAllProjects = false;

+ 1 - 1
saas-account/src/main/java/com/persagy/account/controller/SaasProjectController.java

@@ -188,7 +188,7 @@ public class SaasProjectController {
     		this.saasAreaProjectHandler.queryAllowAreaProjectTree(queryVO, saasGroup, areaList);
     		if (queryVO.isExcludeEmptyArea()) {
     			// 获取未分区下的可见项目
-        		SaasArea areaOne = this.saasAreaService.getAreaOne(null, queryVO.getGroupCode(), SaasCommonConstant.STR_STATUS_MINUS_1, null);
+        		SaasArea areaOne = this.saasAreaService.getAreaOne(null, saasGroup.getGroupCode(), SaasCommonConstant.STR_STATUS_MINUS_1, null);
         		if (areaOne != null) {
         			List<SaasProject> projects = this.saasAuthHandler.getAllowProjectList(queryVO.getAccountId(), queryVO.getGroupCode(), areaOne.getId());
         			saasGroup.setProjects(projects);

+ 5 - 6
saas-account/src/main/java/com/persagy/account/manage/SaasAuthHandler.java

@@ -70,11 +70,10 @@ public class SaasAuthHandler {
     	if (account == null) {
     		throw new BusinessException("账号信息为空");
 		}
-    	// 添加数据访问控制,账号类型,0-所有集团项目,1-单集团所有项目,2-其他
-    	String accountType = account.getAccountType();
-		// 1时,判断是否有权限
+    	// 添加数据访问控制,账号所属,0-系统账号,1-业务账号
+    	String accountBelong = account.getAccountBelong();
     	Map<String, String> result = new HashMap<String, String>(2);
-		if (SaasCommonConstant.STR_STATUS_1.equals(accountType)) {
+		if (SaasCommonConstant.STR_STATUS_1.equals(accountBelong)) {
 			String allowGroupCode = account.getGroupCode();
 			if (StringUtil.isNotBlank(groupCode) && !groupCode.equals(allowGroupCode)) {
 				throw new BusinessException("账号无该集团的访问权限");
@@ -82,8 +81,8 @@ public class SaasAuthHandler {
 			groupCode = allowGroupCode;
 		}
 		result.put(CipherConstants.GROUP_CODE, groupCode);
-		result.put(SaasCommonConstant.ACCOUNT_TYPE, accountType);
-		result.put(SaasCommonConstant.ACCOUNT_BELONG, account.getAccountBelong());
+		result.put(SaasCommonConstant.ACCOUNT_TYPE, account.getAccountType());
+		result.put(SaasCommonConstant.ACCOUNT_BELONG, accountBelong);
 		return result;
     }