From d8575129c475edf77775c8f5330f4786aeccc7e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Thu, 13 Apr 2023 17:40:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=93=E5=AE=B6=E5=AE=A1=E6=A0=B8=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E5=88=97=E8=A1=A8=E7=AD=9B=E9=80=89=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/helper/RegionLimitHelper.java | 17 ------------ .../common/helper/impl/RegionLimitHelperImpl.java | 30 ---------------------- .../expert/assembler/RegionWrapperAssembler.java | 12 --------- .../pmapi/expert/manage/ExpertAdminManage.java | 4 --- .../pmapi/expert/manage/ExpertMetaApplyManage.java | 20 +++++---------- .../organization/manage/OrganizationManage.java | 2 +- 6 files changed, 7 insertions(+), 78 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionLimitHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionLimitHelper.java index d264cd9..08cf986 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionLimitHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionLimitHelper.java @@ -11,16 +11,6 @@ import java.util.List; */ public interface RegionLimitHelper { - - /** - * 管理员 是否包含 专家层级校验 - * - * @param expertUserId / - * @param expertAdminUserId / - * @return / - */ - Boolean regionContainsCheck(Long expertUserId, Long expertAdminUserId); - /** * 校验层级包含关系 * @@ -49,11 +39,4 @@ public interface RegionLimitHelper { */ RegionContainsBO getContainsRegionBo(Integer regionLevel, String regionCode); - /** - * 根据专家管理员用户id 获取专家管理员管辖区域列表 - * - * @param expertAdminUserId 专家管理员用户id - * @return / - */ - List getExpertAdminContainsRegion(Long expertAdminUserId); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java index 674b112..9834280 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java @@ -3,7 +3,6 @@ package com.ningdatech.pmapi.common.helper.impl; import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.common.helper.basic.AbstractRegionLimitHelper; import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; -import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; import org.apache.commons.collections4.CollectionUtils; import org.slf4j.Logger; @@ -40,13 +39,6 @@ public class RegionLimitHelperImpl extends AbstractRegionLimitHelper { } @Override - public Boolean regionContainsCheck(Long expertUserId, Long expertAdminUserId) { - List expertAdminContainsRegion = getExpertAdminContainsRegion(expertAdminUserId); - ExpertRegionInfo expertRegionInfo = getExpertRegionInfo(expertUserId); - return regionContains(expertAdminContainsRegion, expertRegionInfo.getRegionCode(), expertRegionInfo.getRegionLevel()); - } - - @Override public Boolean regionContains(List regionContainsBOList, String regionCode, Integer regionLevel) { for (RegionContainsBO regionContainsBO : regionContainsBOList) { Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel(); @@ -96,27 +88,5 @@ public class RegionLimitHelperImpl extends AbstractRegionLimitHelper { return regionContains; } - @Override - public List getExpertAdminContainsRegion(Long expertAdminUserId) { - if (Objects.isNull(expertAdminUserId)) { - logger.error("getExpertAdminContainsRegion expertAdminUserId is null"); - return new ArrayList<>(); - } - // TODO - /*LambdaQueryWrapper expertAdminRegionEq = Wrappers.lambdaQuery(ExpertAdminRegion.class) - .eq(ExpertAdminRegion::getUserId, expertAdminUserId); - List expertAdminRegionList = iExpertAdminRegionService.list(expertAdminRegionEq); - List regionContainsBOList = new ArrayList<>(); - for (ExpertAdminRegion expertAdminRegion : expertAdminRegionList) { - List regionCodes = regionCacheHelper - .getAllChildrenRegionCodeList(expertAdminRegion.getRegionCode(), expertAdminRegion.getRegionLevel()); - RegionContainsBO regionContainsBO = new RegionContainsBO(); - regionContainsBO.setContainsRegionCodeList(regionCodes); - regionContainsBO.setParentRegionTreeLevel(expertAdminRegion.getRegionLevel()); - regionContainsBOList.add(regionContainsBO); - }*/ - return new ArrayList<>(); - } - } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/RegionWrapperAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/RegionWrapperAssembler.java index 7ce5890..e7f67ce 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/RegionWrapperAssembler.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/RegionWrapperAssembler.java @@ -25,16 +25,4 @@ public class RegionWrapperAssembler { } } } - - public static void expertMetaApplyRegionContainsWrapperAssembler(LambdaQueryWrapper wrapperQuery, List containsRegionList) { - for (RegionContainsBO regionContainsBO : containsRegionList) { - List containsRegionCodeList = regionContainsBO.getContainsRegionCodeList(); - Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel(); - if (CollectionUtils.isNotEmpty(containsRegionCodeList)) { - wrapperQuery.and(wrapper -> wrapper.in(ExpertMetaApply::getRegionCode, containsRegionCodeList) - .ge(ExpertMetaApply::getRegionLevel, parentRegionTreeLevel)); - } - } - wrapperQuery.orderByDesc(ExpertMetaApply::getUpdateOn); - } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertAdminManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertAdminManage.java index 183d0c4..41b4cdb 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertAdminManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertAdminManage.java @@ -153,10 +153,6 @@ public class ExpertAdminManage { List expertAdminContainsRegionList = new ArrayList<>(); - // 如果为超级管理员,可以查看所有的专家,包括没有层级的专家 - if (!permissionCheckHelper.isSuperAdmin()) { - expertAdminContainsRegionList = regionLimitHelper.getExpertAdminContainsRegion(userId); - } List containsRegion = new ArrayList<>(); if (Objects.nonNull(query.getExpertRegionInfo())) { RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegionInfo().getRegionLevel() diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java index af05a59..4f9af1c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java @@ -86,9 +86,7 @@ public class ExpertMetaApplyManage { public PageVo metaApplyListQuery(MetaApplyListQuery req) { Long expertAdminUserId = LoginUserUtil.getUserId(); // 查找符合专家条件的用户id - List viewRegions = regionLimitHelper.getExpertAdminContainsRegion(expertAdminUserId); - ExpertAdminExpertManageQueryCmd queryCmd = buildExpertAdminExpertManageQueryCmd(req, viewRegions); - // TODO + ExpertAdminExpertManageQueryCmd queryCmd = buildExpertAdminExpertManageQueryCmd(req); List filterExpertUserIdList = expertAdminManageService.filterExpertUserIdList(queryCmd); // TODO 获取所有的专家审核列表 if (CollUtil.isEmpty(filterExpertUserIdList)) { @@ -96,9 +94,7 @@ public class ExpertMetaApplyManage { } LambdaQueryWrapper expertMetaApplyListQuery = - buildMetaApplyListQueryWrapper(req, filterExpertUserIdList, viewRegions); - - RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions); + buildMetaApplyListQueryWrapper(req, filterExpertUserIdList); Page pageResult = iMetaApplyService.page(req.page(), expertMetaApplyListQuery); PageVo result = new PageVo<>(); result.setTotal(pageResult.getTotal()); @@ -371,7 +367,7 @@ public class ExpertMetaApplyManage { return applyTypeList; } - private ExpertAdminExpertManageQueryCmd buildExpertAdminExpertManageQueryCmd(MetaApplyListQuery query, List expertAdminContainsRegionList) { + private ExpertAdminExpertManageQueryCmd buildExpertAdminExpertManageQueryCmd(MetaApplyListQuery query) { ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd = new ExpertAdminExpertManageQueryCmd(); expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); @@ -389,13 +385,11 @@ public class ExpertMetaApplyManage { expertDictionaryQueryList.add(expertDictionaryQuery); } - List containsRegion; + List containsRegion = null; if (Objects.nonNull(query.getExpertRegion())) { RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegion().getRegionLevel() , query.getExpertRegion().getRegionCode()); - containsRegion = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); - } else { - containsRegion = expertAdminContainsRegionList; + containsRegion = CollUtil.toList(containsRegionBo); } expertAdminExpertManageQueryCmd.setExpertDictionaryQueryList(expertDictionaryQueryList); @@ -465,8 +459,7 @@ public class ExpertMetaApplyManage { } private LambdaQueryWrapper buildMetaApplyListQueryWrapper(MetaApplyListQuery applyListReq, - List expertIdList, - List viewRegions) { + List expertIdList) { // 审核类型 List applyTypeList = new ArrayList<>(); if (CollUtil.isNotEmpty(applyListReq.getApplyTypeList())) { @@ -496,7 +489,6 @@ public class ExpertMetaApplyManage { .ne(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.REVOKED.getKey()) .orderByDesc(ExpertMetaApply::getCreateOn); - RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions); return expertMetaApplyListQuery; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java index ac4a6f4..5f7e37d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java @@ -175,7 +175,7 @@ public class OrganizationManage { keyTreeVO.setType("ORGANIZATION"); return keyTreeVO; }).collect(Collectors.toList()); - treeVOList(request.getNeedMember(), orgKeyTreeVOList,onlyUnit); + treeVOList(request.getNeedMember(), orgKeyTreeVOList, onlyUnit); return orgKeyTreeVOList; }