From 843475751623d2c88b0bd22dd9ea615bba30b363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Thu, 13 Apr 2023 17:19:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8D=95=E4=BD=8D=E5=88=97=E8=A1=A8fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java | 7 ++++--- .../pmapi/expert/service/ExpertAdminManageService.java | 9 +++++++++ .../expert/service/impl/ExpertAdminManageServiceImpl.java | 6 ++++++ .../organization/controller/DingOrganizationController.java | 2 +- .../pmapi/organization/manage/OrganizationManage.java | 10 ++++++---- 5 files changed, 26 insertions(+), 8 deletions(-) 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 e48dde8..af05a59 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 @@ -29,6 +29,7 @@ import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery; import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest; import com.ningdatech.pmapi.expert.model.vo.ExpertApplyMetaVO; import com.ningdatech.pmapi.expert.model.vo.MetaApplyResultVo; +import com.ningdatech.pmapi.expert.service.ExpertAdminManageService; import com.ningdatech.pmapi.expert.service.ExpertInfoService; import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService; import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; @@ -79,6 +80,8 @@ public class ExpertMetaApplyManage { private final ExpertUserInfoHelper expertUserInfoHelper; + private final ExpertAdminManageService expertAdminManageService; + public PageVo metaApplyListQuery(MetaApplyListQuery req) { Long expertAdminUserId = LoginUserUtil.getUserId(); @@ -86,10 +89,8 @@ public class ExpertMetaApplyManage { List viewRegions = regionLimitHelper.getExpertAdminContainsRegion(expertAdminUserId); ExpertAdminExpertManageQueryCmd queryCmd = buildExpertAdminExpertManageQueryCmd(req, viewRegions); // TODO -// List filterExpertUserIdList = expertAdminManageService.filterExpertUserIdList(queryCmd); - List expertUserFullInfoList = userFullInfoService.list(); + List filterExpertUserIdList = expertAdminManageService.filterExpertUserIdList(queryCmd); // TODO 获取所有的专家审核列表 - List filterExpertUserIdList = expertUserFullInfoList.stream().map(ExpertUserFullInfo::getUserId).distinct().collect(Collectors.toList()); if (CollUtil.isEmpty(filterExpertUserIdList)) { return PageVo.empty(); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertAdminManageService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertAdminManageService.java index d8e0e96..cea8862 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertAdminManageService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertAdminManageService.java @@ -21,4 +21,13 @@ public interface ExpertAdminManageService { */ CommonPage getExpertLibraryList(ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd); + + /** + * 获取所有符合查询条件的专家user_id + * + * @param expertAdminExpertManageQueryCmd + * @return + */ + List filterExpertUserIdList(ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd); + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java index b72a567..cd10d39 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java @@ -109,4 +109,10 @@ public class ExpertAdminManageServiceImpl implements ExpertAdminManageService { } return listExpertQuery; } + + @Override + public List filterExpertUserIdList(ExpertAdminExpertManageQueryCmd queryCmd) { + ListExpertQuery listExpertQuery = buildListExpertQuery(queryCmd); + return expertAdminManageMapper.listExpertUserId(listExpertQuery); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java index f4e66cd..5d7bc7c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java @@ -46,7 +46,7 @@ public class DingOrganizationController { @PostMapping("/get-child-list") @ApiOperation("获取组织架构的树状结构(单位筛选列表)") public List getChildOrganizationList(@RequestParam(value = "parentCode", required = false) String parentCode,@RequestParam(value = "orgName", required = false) String orgName) { - return organizationManage.getChildOrganizationList(parentCode,orgName); + return organizationManage.getChildOrganizationList(parentCode,orgName,false); } @ApiOperation("组织树状列表筛选(前端定制化接口不可复用)") 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 d9d9106..ac4a6f4 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 @@ -92,19 +92,21 @@ public class OrganizationManage { return pageVo; } - public List getChildOrganizationList(String parentCode, String orgName) { + public List getChildOrganizationList(String parentCode, String orgName, Boolean onlyUnit) { List parentCodeList = new ArrayList<>(); List dingOrganizationList = new ArrayList<>(); if (StrUtils.isBlank(parentCode)) { parentCodeList = dingOrganizationProperties.getDeptVisibleScopes(); dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) .like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) + .notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION") .in(DingOrganization::getOrganizationCode, parentCodeList)); } else { parentCodeList = CollectionUtil.toList(parentCode); dingOrganizationList = iDingOrganizationService .list(Wrappers.lambdaQuery(DingOrganization.class) .like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) + .notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION") .in(DingOrganization::getParentCode, parentCodeList)); } @@ -173,7 +175,7 @@ public class OrganizationManage { keyTreeVO.setType("ORGANIZATION"); return keyTreeVO; }).collect(Collectors.toList()); - treeVOList(request.getNeedMember(), orgKeyTreeVOList); + treeVOList(request.getNeedMember(), orgKeyTreeVOList,onlyUnit); return orgKeyTreeVOList; } @@ -232,10 +234,10 @@ public class OrganizationManage { } - public void treeVOList(Boolean needMember, List basicOrgKeyTreeVOList) { + public void treeVOList(Boolean needMember, List basicOrgKeyTreeVOList, Boolean onlyUnit) { for (KeyTreeVO basicOrgKeyTreeVO : basicOrgKeyTreeVOList) { String parentCode = basicOrgKeyTreeVO.getKey(); - List childOrganizationList = getChildOrganizationList(parentCode, null); + List childOrganizationList = getChildOrganizationList(parentCode, null, onlyUnit); List orgKeyTreeVOList = childOrganizationList.stream().map(r -> { KeyTreeVO keyTreeVO = new KeyTreeVO(); 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 2/2] =?UTF-8?q?=E4=B8=93=E5=AE=B6=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E5=88=97=E8=A1=A8=E7=AD=9B=E9=80=89=E9=94=99?= =?UTF-8?q?=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; }