@@ -11,16 +11,6 @@ import java.util.List; | |||||
*/ | */ | ||||
public interface RegionLimitHelper { | 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); | RegionContainsBO getContainsRegionBo(Integer regionLevel, String regionCode); | ||||
/** | |||||
* 根据专家管理员用户id 获取专家管理员管辖区域列表 | |||||
* | |||||
* @param expertAdminUserId 专家管理员用户id | |||||
* @return / | |||||
*/ | |||||
List<RegionContainsBO> getExpertAdminContainsRegion(Long expertAdminUserId); | |||||
} | } |
@@ -3,7 +3,6 @@ package com.ningdatech.pmapi.common.helper.impl; | |||||
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; | import com.ningdatech.pmapi.common.helper.RegionCacheHelper; | ||||
import com.ningdatech.pmapi.common.helper.basic.AbstractRegionLimitHelper; | import com.ningdatech.pmapi.common.helper.basic.AbstractRegionLimitHelper; | ||||
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; | import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; | ||||
import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; | |||||
import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; | import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; | ||||
import org.apache.commons.collections4.CollectionUtils; | import org.apache.commons.collections4.CollectionUtils; | ||||
import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
@@ -40,13 +39,6 @@ public class RegionLimitHelperImpl extends AbstractRegionLimitHelper { | |||||
} | } | ||||
@Override | @Override | ||||
public Boolean regionContainsCheck(Long expertUserId, Long expertAdminUserId) { | |||||
List<RegionContainsBO> expertAdminContainsRegion = getExpertAdminContainsRegion(expertAdminUserId); | |||||
ExpertRegionInfo expertRegionInfo = getExpertRegionInfo(expertUserId); | |||||
return regionContains(expertAdminContainsRegion, expertRegionInfo.getRegionCode(), expertRegionInfo.getRegionLevel()); | |||||
} | |||||
@Override | |||||
public Boolean regionContains(List<RegionContainsBO> regionContainsBOList, String regionCode, Integer regionLevel) { | public Boolean regionContains(List<RegionContainsBO> regionContainsBOList, String regionCode, Integer regionLevel) { | ||||
for (RegionContainsBO regionContainsBO : regionContainsBOList) { | for (RegionContainsBO regionContainsBO : regionContainsBOList) { | ||||
Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel(); | Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel(); | ||||
@@ -96,27 +88,5 @@ public class RegionLimitHelperImpl extends AbstractRegionLimitHelper { | |||||
return regionContains; | return regionContains; | ||||
} | } | ||||
@Override | |||||
public List<RegionContainsBO> getExpertAdminContainsRegion(Long expertAdminUserId) { | |||||
if (Objects.isNull(expertAdminUserId)) { | |||||
logger.error("getExpertAdminContainsRegion expertAdminUserId is null"); | |||||
return new ArrayList<>(); | |||||
} | |||||
// TODO | |||||
/*LambdaQueryWrapper<ExpertAdminRegion> expertAdminRegionEq = Wrappers.lambdaQuery(ExpertAdminRegion.class) | |||||
.eq(ExpertAdminRegion::getUserId, expertAdminUserId); | |||||
List<ExpertAdminRegion> expertAdminRegionList = iExpertAdminRegionService.list(expertAdminRegionEq); | |||||
List<RegionContainsBO> regionContainsBOList = new ArrayList<>(); | |||||
for (ExpertAdminRegion expertAdminRegion : expertAdminRegionList) { | |||||
List<String> regionCodes = regionCacheHelper | |||||
.getAllChildrenRegionCodeList(expertAdminRegion.getRegionCode(), expertAdminRegion.getRegionLevel()); | |||||
RegionContainsBO regionContainsBO = new RegionContainsBO(); | |||||
regionContainsBO.setContainsRegionCodeList(regionCodes); | |||||
regionContainsBO.setParentRegionTreeLevel(expertAdminRegion.getRegionLevel()); | |||||
regionContainsBOList.add(regionContainsBO); | |||||
}*/ | |||||
return new ArrayList<>(); | |||||
} | |||||
} | } |
@@ -25,16 +25,4 @@ public class RegionWrapperAssembler { | |||||
} | } | ||||
} | } | ||||
} | } | ||||
public static void expertMetaApplyRegionContainsWrapperAssembler(LambdaQueryWrapper<ExpertMetaApply> wrapperQuery, List<RegionContainsBO> containsRegionList) { | |||||
for (RegionContainsBO regionContainsBO : containsRegionList) { | |||||
List<String> 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); | |||||
} | |||||
} | } |
@@ -153,10 +153,6 @@ public class ExpertAdminManage { | |||||
List<RegionContainsBO> expertAdminContainsRegionList = new ArrayList<>(); | List<RegionContainsBO> expertAdminContainsRegionList = new ArrayList<>(); | ||||
// 如果为超级管理员,可以查看所有的专家,包括没有层级的专家 | |||||
if (!permissionCheckHelper.isSuperAdmin()) { | |||||
expertAdminContainsRegionList = regionLimitHelper.getExpertAdminContainsRegion(userId); | |||||
} | |||||
List<RegionContainsBO> containsRegion = new ArrayList<>(); | List<RegionContainsBO> containsRegion = new ArrayList<>(); | ||||
if (Objects.nonNull(query.getExpertRegionInfo())) { | if (Objects.nonNull(query.getExpertRegionInfo())) { | ||||
RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegionInfo().getRegionLevel() | RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegionInfo().getRegionLevel() | ||||
@@ -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.req.MetaApplyResultRequest; | ||||
import com.ningdatech.pmapi.expert.model.vo.ExpertApplyMetaVO; | import com.ningdatech.pmapi.expert.model.vo.ExpertApplyMetaVO; | ||||
import com.ningdatech.pmapi.expert.model.vo.MetaApplyResultVo; | 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.ExpertInfoService; | ||||
import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService; | import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService; | ||||
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; | import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; | ||||
@@ -79,25 +80,21 @@ public class ExpertMetaApplyManage { | |||||
private final ExpertUserInfoHelper expertUserInfoHelper; | private final ExpertUserInfoHelper expertUserInfoHelper; | ||||
private final ExpertAdminManageService expertAdminManageService; | |||||
public PageVo<ExpertApplyMetaVO> metaApplyListQuery(MetaApplyListQuery req) { | public PageVo<ExpertApplyMetaVO> metaApplyListQuery(MetaApplyListQuery req) { | ||||
Long expertAdminUserId = LoginUserUtil.getUserId(); | Long expertAdminUserId = LoginUserUtil.getUserId(); | ||||
// 查找符合专家条件的用户id | // 查找符合专家条件的用户id | ||||
List<RegionContainsBO> viewRegions = regionLimitHelper.getExpertAdminContainsRegion(expertAdminUserId); | |||||
ExpertAdminExpertManageQueryCmd queryCmd = buildExpertAdminExpertManageQueryCmd(req, viewRegions); | |||||
// TODO | |||||
// List<Long> filterExpertUserIdList = expertAdminManageService.filterExpertUserIdList(queryCmd); | |||||
List<ExpertUserFullInfo> expertUserFullInfoList = userFullInfoService.list(); | |||||
ExpertAdminExpertManageQueryCmd queryCmd = buildExpertAdminExpertManageQueryCmd(req); | |||||
List<Long> filterExpertUserIdList = expertAdminManageService.filterExpertUserIdList(queryCmd); | |||||
// TODO 获取所有的专家审核列表 | // TODO 获取所有的专家审核列表 | ||||
List<Long> filterExpertUserIdList = expertUserFullInfoList.stream().map(ExpertUserFullInfo::getUserId).distinct().collect(Collectors.toList()); | |||||
if (CollUtil.isEmpty(filterExpertUserIdList)) { | if (CollUtil.isEmpty(filterExpertUserIdList)) { | ||||
return PageVo.empty(); | return PageVo.empty(); | ||||
} | } | ||||
LambdaQueryWrapper<ExpertMetaApply> expertMetaApplyListQuery = | LambdaQueryWrapper<ExpertMetaApply> expertMetaApplyListQuery = | ||||
buildMetaApplyListQueryWrapper(req, filterExpertUserIdList, viewRegions); | |||||
RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions); | |||||
buildMetaApplyListQueryWrapper(req, filterExpertUserIdList); | |||||
Page<ExpertMetaApply> pageResult = iMetaApplyService.page(req.page(), expertMetaApplyListQuery); | Page<ExpertMetaApply> pageResult = iMetaApplyService.page(req.page(), expertMetaApplyListQuery); | ||||
PageVo<ExpertApplyMetaVO> result = new PageVo<>(); | PageVo<ExpertApplyMetaVO> result = new PageVo<>(); | ||||
result.setTotal(pageResult.getTotal()); | result.setTotal(pageResult.getTotal()); | ||||
@@ -370,7 +367,7 @@ public class ExpertMetaApplyManage { | |||||
return applyTypeList; | return applyTypeList; | ||||
} | } | ||||
private ExpertAdminExpertManageQueryCmd buildExpertAdminExpertManageQueryCmd(MetaApplyListQuery query, List<RegionContainsBO> expertAdminContainsRegionList) { | |||||
private ExpertAdminExpertManageQueryCmd buildExpertAdminExpertManageQueryCmd(MetaApplyListQuery query) { | |||||
ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd = new ExpertAdminExpertManageQueryCmd(); | ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd = new ExpertAdminExpertManageQueryCmd(); | ||||
expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); | expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); | ||||
expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); | expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); | ||||
@@ -388,13 +385,11 @@ public class ExpertMetaApplyManage { | |||||
expertDictionaryQueryList.add(expertDictionaryQuery); | expertDictionaryQueryList.add(expertDictionaryQuery); | ||||
} | } | ||||
List<RegionContainsBO> containsRegion; | |||||
List<RegionContainsBO> containsRegion = null; | |||||
if (Objects.nonNull(query.getExpertRegion())) { | if (Objects.nonNull(query.getExpertRegion())) { | ||||
RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegion().getRegionLevel() | RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegion().getRegionLevel() | ||||
, query.getExpertRegion().getRegionCode()); | , query.getExpertRegion().getRegionCode()); | ||||
containsRegion = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); | |||||
} else { | |||||
containsRegion = expertAdminContainsRegionList; | |||||
containsRegion = CollUtil.toList(containsRegionBo); | |||||
} | } | ||||
expertAdminExpertManageQueryCmd.setExpertDictionaryQueryList(expertDictionaryQueryList); | expertAdminExpertManageQueryCmd.setExpertDictionaryQueryList(expertDictionaryQueryList); | ||||
@@ -464,8 +459,7 @@ public class ExpertMetaApplyManage { | |||||
} | } | ||||
private LambdaQueryWrapper<ExpertMetaApply> buildMetaApplyListQueryWrapper(MetaApplyListQuery applyListReq, | private LambdaQueryWrapper<ExpertMetaApply> buildMetaApplyListQueryWrapper(MetaApplyListQuery applyListReq, | ||||
List<Long> expertIdList, | |||||
List<RegionContainsBO> viewRegions) { | |||||
List<Long> expertIdList) { | |||||
// 审核类型 | // 审核类型 | ||||
List<String> applyTypeList = new ArrayList<>(); | List<String> applyTypeList = new ArrayList<>(); | ||||
if (CollUtil.isNotEmpty(applyListReq.getApplyTypeList())) { | if (CollUtil.isNotEmpty(applyListReq.getApplyTypeList())) { | ||||
@@ -495,7 +489,6 @@ public class ExpertMetaApplyManage { | |||||
.ne(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.REVOKED.getKey()) | .ne(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.REVOKED.getKey()) | ||||
.orderByDesc(ExpertMetaApply::getCreateOn); | .orderByDesc(ExpertMetaApply::getCreateOn); | ||||
RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions); | |||||
return expertMetaApplyListQuery; | return expertMetaApplyListQuery; | ||||
} | } | ||||
@@ -21,4 +21,13 @@ public interface ExpertAdminManageService { | |||||
*/ | */ | ||||
CommonPage<ExpertAdminExpertManageListDTO> getExpertLibraryList(ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd); | CommonPage<ExpertAdminExpertManageListDTO> getExpertLibraryList(ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd); | ||||
/** | |||||
* 获取所有符合查询条件的专家user_id | |||||
* | |||||
* @param expertAdminExpertManageQueryCmd | |||||
* @return | |||||
*/ | |||||
List<Long> filterExpertUserIdList(ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd); | |||||
} | } |
@@ -109,4 +109,10 @@ public class ExpertAdminManageServiceImpl implements ExpertAdminManageService { | |||||
} | } | ||||
return listExpertQuery; | return listExpertQuery; | ||||
} | } | ||||
@Override | |||||
public List<Long> filterExpertUserIdList(ExpertAdminExpertManageQueryCmd queryCmd) { | |||||
ListExpertQuery listExpertQuery = buildListExpertQuery(queryCmd); | |||||
return expertAdminManageMapper.listExpertUserId(listExpertQuery); | |||||
} | |||||
} | } |
@@ -46,7 +46,7 @@ public class DingOrganizationController { | |||||
@PostMapping("/get-child-list") | @PostMapping("/get-child-list") | ||||
@ApiOperation("获取组织架构的树状结构(单位筛选列表)") | @ApiOperation("获取组织架构的树状结构(单位筛选列表)") | ||||
public List<OrganizationTreeVO> getChildOrganizationList(@RequestParam(value = "parentCode", required = false) String parentCode,@RequestParam(value = "orgName", required = false) String orgName) { | public List<OrganizationTreeVO> 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("组织树状列表筛选(前端定制化接口不可复用)") | @ApiOperation("组织树状列表筛选(前端定制化接口不可复用)") | ||||
@@ -92,19 +92,21 @@ public class OrganizationManage { | |||||
return pageVo; | return pageVo; | ||||
} | } | ||||
public List<OrganizationTreeVO> getChildOrganizationList(String parentCode, String orgName) { | |||||
public List<OrganizationTreeVO> getChildOrganizationList(String parentCode, String orgName, Boolean onlyUnit) { | |||||
List<String> parentCodeList = new ArrayList<>(); | List<String> parentCodeList = new ArrayList<>(); | ||||
List<DingOrganization> dingOrganizationList = new ArrayList<>(); | List<DingOrganization> dingOrganizationList = new ArrayList<>(); | ||||
if (StrUtils.isBlank(parentCode)) { | if (StrUtils.isBlank(parentCode)) { | ||||
parentCodeList = dingOrganizationProperties.getDeptVisibleScopes(); | parentCodeList = dingOrganizationProperties.getDeptVisibleScopes(); | ||||
dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | ||||
.like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) | .like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) | ||||
.notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION") | |||||
.in(DingOrganization::getOrganizationCode, parentCodeList)); | .in(DingOrganization::getOrganizationCode, parentCodeList)); | ||||
} else { | } else { | ||||
parentCodeList = CollectionUtil.toList(parentCode); | parentCodeList = CollectionUtil.toList(parentCode); | ||||
dingOrganizationList = iDingOrganizationService | dingOrganizationList = iDingOrganizationService | ||||
.list(Wrappers.lambdaQuery(DingOrganization.class) | .list(Wrappers.lambdaQuery(DingOrganization.class) | ||||
.like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) | .like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) | ||||
.notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION") | |||||
.in(DingOrganization::getParentCode, parentCodeList)); | .in(DingOrganization::getParentCode, parentCodeList)); | ||||
} | } | ||||
@@ -173,7 +175,7 @@ public class OrganizationManage { | |||||
keyTreeVO.setType("ORGANIZATION"); | keyTreeVO.setType("ORGANIZATION"); | ||||
return keyTreeVO; | return keyTreeVO; | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
treeVOList(request.getNeedMember(), orgKeyTreeVOList); | |||||
treeVOList(request.getNeedMember(), orgKeyTreeVOList, onlyUnit); | |||||
return orgKeyTreeVOList; | return orgKeyTreeVOList; | ||||
} | } | ||||
@@ -232,10 +234,10 @@ public class OrganizationManage { | |||||
} | } | ||||
public void treeVOList(Boolean needMember, List<KeyTreeVO> basicOrgKeyTreeVOList) { | |||||
public void treeVOList(Boolean needMember, List<KeyTreeVO> basicOrgKeyTreeVOList, Boolean onlyUnit) { | |||||
for (KeyTreeVO basicOrgKeyTreeVO : basicOrgKeyTreeVOList) { | for (KeyTreeVO basicOrgKeyTreeVO : basicOrgKeyTreeVOList) { | ||||
String parentCode = basicOrgKeyTreeVO.getKey(); | String parentCode = basicOrgKeyTreeVO.getKey(); | ||||
List<OrganizationTreeVO> childOrganizationList = getChildOrganizationList(parentCode, null); | |||||
List<OrganizationTreeVO> childOrganizationList = getChildOrganizationList(parentCode, null, onlyUnit); | |||||
List<KeyTreeVO> orgKeyTreeVOList = childOrganizationList.stream().map(r -> { | List<KeyTreeVO> orgKeyTreeVOList = childOrganizationList.stream().map(r -> { | ||||
KeyTreeVO keyTreeVO = new KeyTreeVO(); | KeyTreeVO keyTreeVO = new KeyTreeVO(); | ||||