From f686c2e91993ec7d4685dde60785ce97ec76624f Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 25 May 2020 09:52:15 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=93=8D=E4=BD=9C=E5=8A=9F=E8=83=BD=E6=9D=83?= =?UTF-8?q?=E9=99=90=E8=8C=83=E5=9B=B4=E5=B8=B8=E9=87=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constant/OperationScopeConstant.java | 5 +++ .../epmet/service/impl/AccessServiceImpl.java | 43 +++++++++---------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/constant/OperationScopeConstant.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/constant/OperationScopeConstant.java index 02dd6664ff..f4aba15fbc 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/constant/OperationScopeConstant.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/constant/OperationScopeConstant.java @@ -39,6 +39,11 @@ public class OperationScopeConstant { //"本组织" public static final String SCOPE_ORG_CURR = "org_curr"; + //"本组织的上级" + public static final String SCOPE_ORG_CURR_SUP = "org_curr_sup"; + //"本组织及上级" + public static final String SCOPE_ORG_CURR_AND_SUP = "org_curr_and_sup"; + //我创建的 public static final String SCOPE_I_CREATED = "i_created"; //网格内 diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index b5ec4bd689..a56b4740fe 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -3,7 +3,6 @@ package com.epmet.service.impl; import cn.hutool.core.collection.CollectionUtil; import com.epmet.bean.OpeScopeFilterResultBean; import com.epmet.commons.tools.constant.AppClientConstant; -import com.epmet.commons.tools.constant.OpeScopeConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; @@ -175,7 +174,7 @@ public class AccessServiceImpl implements AccessService { Set switchScopes = effectiveOpeScopes.getSwitchScopes(); // 生成组织上下级关系系列的sql过滤片段 - if (!CollectionUtil.isEmpty(orgLevelScopes) && !orgLevelScopes.contains(OpeScopeConstant.ORG_ALL)) { + if (!CollectionUtil.isEmpty(orgLevelScopes) && !orgLevelScopes.contains(OperationScopeConstant.SCOPE_ORG_ALL)) { genOrgLevelScopeSqlFilter(sb, orgLevelScopes, userDetails.getOrgIdPath(), form.getTableAlias()); } @@ -316,7 +315,7 @@ public class AccessServiceImpl implements AccessService { for (RoleOpeScopeResultDTO scope : scopeDTOS) { - if (OpeScopeConstant.ALL.equals(scope.getScopeKey())) { + if (OperationScopeConstant.SCOPE_ALL.equals(scope.getScopeKey())) { all = true; break; } @@ -327,7 +326,7 @@ public class AccessServiceImpl implements AccessService { } String scopeIndex = scope.getScopeIndex(); - if (OpeScopeConstant.ORG_ALL.equals(scope.getScopeKey())) { + if (OperationScopeConstant.SCOPE_ORG_ALL.equals(scope.getScopeKey())) { // 该操作具有org_all的权限,直接放入 orgLevelScopes.put(scopeIndex, scope); continue; @@ -378,7 +377,7 @@ public class AccessServiceImpl implements AccessService { for (String scope : scopes) { switch (scope) { // 当前单位(可以用ORG_ID_PATH,也可以用ORG_ID判断) - case OpeScopeConstant.ORG_CURR: + case OperationScopeConstant.SCOPE_ORG_CURR: if (StringUtils.isBlank(tableAlias)) { sb.append(" ORG_ID_PATH = '").append(orgIdPath).append("' OR "); //sb.append(" ORG_ID = '").append(currOrgID).append("' OR "); @@ -388,7 +387,7 @@ public class AccessServiceImpl implements AccessService { } break; // 本单位及其子级单位 - case OpeScopeConstant.ORG_CURR_AND_SUB: + case OperationScopeConstant.SCOPE_ORG_CURR_AND_SUB: if (StringUtils.isBlank(tableAlias)) { sb.append(" ORG_ID_PATH like '").append(orgIdPath).append("%' OR "); } else { @@ -396,7 +395,7 @@ public class AccessServiceImpl implements AccessService { } break; // 本单位的子级单位 - case OpeScopeConstant.ORG_CURR_SUB: + case OperationScopeConstant.SCOPE_ORG_CURR_SUB: if (StringUtils.isBlank(tableAlias)) { sb.append(" ORG_ID_PATH like '").append(orgIdPath).append(":%' OR "); } else { @@ -404,7 +403,7 @@ public class AccessServiceImpl implements AccessService { } break; //当前单位的父级单位 - case OpeScopeConstant.ORG_CURR_SUP: + case OperationScopeConstant.SCOPE_ORG_CURR_SUP: if (StringUtils.isBlank(tableAlias)) { sb.append(" '").append(orgIdPath).append("' like CONCAT(").append("ORG_ID_PATH,':%') OR "); } else { @@ -412,30 +411,30 @@ public class AccessServiceImpl implements AccessService { } break; // 当前单位及其父级单位 - case OpeScopeConstant.ORG_CURR_AND_SUP: + case OperationScopeConstant.SCOPE_ORG_CURR_AND_SUP: if (StringUtils.isBlank(tableAlias)) { sb.append(" '").append(orgIdPath).append("' like CONCAT(").append("ORG_ID_PATH,'%') OR "); } else { sb.append(" '").append(orgIdPath).append("' like CONCAT(").append(tableAlias).append(".ORG_ID_PATH,'%' ) OR "); } break; - case OpeScopeConstant.ORG_EQUAL: + case OperationScopeConstant.SCOPE_ORG_EQUAL: // todo 同级 //sb.append(" OR "); break; - case OpeScopeConstant.ORG_EQUAL_AND_SUB: + case OperationScopeConstant.SCOPE_ORG_EQUAL_AND_SUB: // todo 同级及其子级 //sb.append(" OR "); break; - case OpeScopeConstant.ORG_EQUAL_SUB: + case OperationScopeConstant.SCOPE_ORG_EQUAL_SUB: // todo 同级的子级 //sb.append(" OR "); break; - case OpeScopeConstant.ORG_EQUAL_AND_SUP: + case OperationScopeConstant.SCOPE_ORG_EQUAL_AND_SUP: // todo 同级及其上级 //sb.append(" OR "); break; - case OpeScopeConstant.ORG_EQUAL_SUP: + case OperationScopeConstant.SCOPE_ORG_EQUAL_SUP: // todo 同级的上级 //sb.append(" OR "); break; @@ -539,7 +538,7 @@ public class AccessServiceImpl implements AccessService { HashSet opeKeys = new HashSet<>(); for (RoleOpeScopeResultDTO opeScope : roleOperations) { String scopeKey = opeScope.getScopeKey(); - if (OpeScopeConstant.ORG_ALL.equals(scopeKey) || OpeScopeConstant.ALL.equals(scopeKey)) { + if (OperationScopeConstant.SCOPE_ORG_ALL.equals(scopeKey) || OperationScopeConstant.SCOPE_ALL.equals(scopeKey)) { // 如果该操作的范围是org_all或者all,不需要根据上下级关系判断,直接返回即可。 opeKeys.add(opeScope.getOperationKey()); continue; @@ -553,21 +552,21 @@ public class AccessServiceImpl implements AccessService { switch (currOrgRelation) { case ORG_RELATION_SAME:// 就在所在机构下 - if (OpeScopeConstant.ORG_CURR.equals(scopeKey) - || OpeScopeConstant.ORG_CURR_AND_SUB.equals(scopeKey) - || OpeScopeConstant.ORG_CURR_AND_SUP.equals(scopeKey)) { + if (OperationScopeConstant.SCOPE_ORG_CURR.equals(scopeKey) + || OperationScopeConstant.SCOPE_ORG_CURR_AND_SUB.equals(scopeKey) + || OperationScopeConstant.SCOPE_ORG_CURR_AND_SUP.equals(scopeKey)) { opeKeys.add(opeScope.getOperationKey()); } break; case ORG_RELATION_SUB:// 所在机构的子级 - if (OpeScopeConstant.ORG_CURR_SUB.equals(scopeKey) - || OpeScopeConstant.ORG_CURR_AND_SUB.equals(scopeKey)) { + if (OperationScopeConstant.SCOPE_ORG_CURR_SUB.equals(scopeKey) + || OperationScopeConstant.SCOPE_ORG_CURR_AND_SUB.equals(scopeKey)) { opeKeys.add(opeScope.getOperationKey()); } break; case ORG_RELATION_SUP:// 所在机构的上级 - if (OpeScopeConstant.ORG_CURR_SUP.equals(scopeKey) - || OpeScopeConstant.ORG_CURR_AND_SUP.equals(scopeKey)) { + if (OperationScopeConstant.SCOPE_ORG_CURR_SUP.equals(scopeKey) + || OperationScopeConstant.SCOPE_ORG_CURR_AND_SUP.equals(scopeKey)) { opeKeys.add(opeScope.getOperationKey()); } break;