From 2e5eef094969da6b2d70d69d11fcf17ba4209e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Fri, 10 Mar 2023 11:20:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=93=E5=AE=B6=E5=BA=93=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/common/model/CommonPage.java | 22 ++++ .../expert/assembler/DictionaryAssembler.java | 29 +++++ .../ExpertAdminExpertManageAssembler.java | 123 ++++++++++++++++++ .../expert/assembler/ExpertUserInfoAssembler.java | 100 +++++++-------- .../pmapi/expert/assembler/TagAssembler.java | 29 +++++ .../pmapi/expert/manage/ExpertAdminManage.java | 21 ++-- .../expert/mapper/ExpertAdminManageMapper.java | 21 ++++ .../expert/mapper/ExpertAdminManageMapper.xml | 117 +++++++++++++++++ .../model/dto/ExpertAdminExpertManageListDTO.java | 138 +++++++++++++++++++++ .../expert/service/ExpertAdminManageService.java | 24 ++++ .../service/impl/ExpertAdminManageServiceImpl.java | 112 +++++++++++++++++ 11 files changed, 678 insertions(+), 58 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/DictionaryAssembler.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertAdminExpertManageAssembler.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/TagAssembler.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertAdminExpertManageListDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertAdminManageService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPage.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPage.java new file mode 100644 index 0000000..7e97c54 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPage.java @@ -0,0 +1,22 @@ +package com.ningdatech.pmapi.common.model; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/4 上午11:34 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CommonPage implements Serializable { + private static final long serialVersionUID = 1L; + private int currentPageNumber; + private Long itemsTotal; + private List items; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/DictionaryAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/DictionaryAssembler.java new file mode 100644 index 0000000..85e7b30 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/DictionaryAssembler.java @@ -0,0 +1,29 @@ +package com.ningdatech.pmapi.expert.assembler; + +import cn.hutool.core.collection.CollectionUtil; +import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; +import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/25 下午4:30 + */ + +public class DictionaryAssembler { + + public static List toDictionaryFieldInfoList(List expertDictionaryList) { + if (CollectionUtil.isEmpty(expertDictionaryList)) { + return new ArrayList<>(); + } + return expertDictionaryList.stream().map(r -> { + DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo(); + dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField()); + dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode()); + return dictionaryFieldInfo; + }).collect(Collectors.toList()); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertAdminExpertManageAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertAdminExpertManageAssembler.java new file mode 100644 index 0000000..ec6924d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertAdminExpertManageAssembler.java @@ -0,0 +1,123 @@ +package com.ningdatech.pmapi.expert.assembler; + +import cn.hutool.core.collection.CollectionUtil; +import com.ningdatech.pmapi.common.helper.RegionCacheHelper; +import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; +import com.ningdatech.pmapi.expert.constant.QueryExpertAccountStatusEnum; +import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; +import com.ningdatech.pmapi.expert.model.TagFieldInfo; +import com.ningdatech.pmapi.expert.model.dto.ExpertAdminExpertManageListDTO; +import com.ningdatech.pmapi.expert.model.vo.ExpertAdminExpertManageListVO; +import com.ningdatech.pmapi.meta.helper.DictionaryCache; +import com.ningdatech.pmapi.meta.helper.impl.TagsCacheImpl; +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; +import com.ningdatech.pmapi.meta.model.dto.TagDTO; +import com.ningdatech.pmapi.sys.model.dto.RegionDTO; +import lombok.RequiredArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/8/5 下午4:32 + */ +@Component +@RequiredArgsConstructor +public class ExpertAdminExpertManageAssembler { + + private final DictionaryCache dictionaryCache; + private final TagsCacheImpl tagCache; + private final RegionCacheHelper regionCache; + + public List toExpertAdminExpertManageListVOList( + List expertManageListDTOList) { + if (CollectionUtil.isEmpty(expertManageListDTOList)) { + return new ArrayList<>(); + } + return expertManageListDTOList.stream().map(r -> { + ExpertAdminExpertManageListVO expertAdminExpertManageListVO = new ExpertAdminExpertManageListVO(); + expertAdminExpertManageListVO.setUserId(r.getUserId()); + expertAdminExpertManageListVO.setExpertName(r.getExpertName()); + expertAdminExpertManageListVO.setPhoneNo(r.getPhoneNo()); + expertAdminExpertManageListVO.setIsDingUser(r.getIsDingUser()); + expertAdminExpertManageListVO.setCompany(r.getCompany()); + expertAdminExpertManageListVO.setLegalEntityCode(r.getLegalEntityCode()); + + if (StringUtils.isNotBlank(r.getExpertAccountStatus())) { + ExpertAccountStatusEnum statusEnum = ExpertAccountStatusEnum.of(r.getExpertAccountStatus()); + switch (statusEnum) { + case FREEZE: + expertAdminExpertManageListVO.setExpertAccountStatus(QueryExpertAccountStatusEnum.FREEZING.getKey()); + break; + case AVAILABLE: + expertAdminExpertManageListVO.setExpertAccountStatus(QueryExpertAccountStatusEnum.NORMAL.getKey()); + break; + default: + break; + } + } + ExpertRegionInfo expertRegionInfo = r.getExpertRegionInfo(); + if (Objects.nonNull(expertRegionInfo)) { + Integer regionLevel = expertRegionInfo.getRegionLevel(); + String regionCode = expertRegionInfo.getRegionCode(); + RegionDTO regionDTO = regionCache.getByCodeAndLevel(regionCode, regionLevel); + if (Objects.nonNull(regionDTO)) { + expertRegionInfo.setRegionCode(regionDTO.getRegionCode()); + expertRegionInfo.setRegionLevel(regionDTO.getRegionLevel()); + expertRegionInfo.setRegionName(regionDTO.getRegionName()); + expertAdminExpertManageListVO.setExpertRegionInfo(expertRegionInfo); + } + } + List expertType = r.getExpertType(); + if (CollectionUtils.isNotEmpty(expertType)) { + expertType = assembleDictionaryName(expertType); + expertAdminExpertManageListVO.setExpertType(expertType); + } + List companyAttribute = r.getCompanyAttribute(); + if (CollectionUtils.isNotEmpty(companyAttribute)) { + companyAttribute = assembleDictionaryName(companyAttribute); + expertAdminExpertManageListVO.setCompanyAttribute(companyAttribute); + } + List titleLevel = r.getTitleLevel(); + if (CollectionUtils.isNotEmpty(titleLevel)) { + titleLevel = assembleDictionaryName(titleLevel); + expertAdminExpertManageListVO.setTitleLevel(titleLevel); + } + + List expertSource = r.getExpertSource(); + if (CollectionUtils.isNotEmpty(expertSource)) { + expertSource = assembleTagName(expertSource); + expertAdminExpertManageListVO.setExpertSource(expertSource); + } + return expertAdminExpertManageListVO; + }).collect(Collectors.toList()); + + } + + public List assembleDictionaryName(List collect) { + return collect.stream().peek(r -> { + DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); + if (Objects.nonNull(dictionaryDTO)) { + r.setDictionaryName(dictionaryDTO.getName()); + } + }).collect(Collectors.toList()); + } + + + public List assembleTagName(List collect) { + return collect.stream().peek(r -> { + TagDTO tagDTO = tagCache.getByTagCode(r.getTagCode()); + if (Objects.nonNull(tagDTO)) { + r.setTagName(tagDTO.getTagName()); + } + }).collect(Collectors.toList()); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java index 9053101..b50e26c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java @@ -404,56 +404,56 @@ public class ExpertUserInfoAssembler { return expertUserFullInfoDTO; } -// public static ExpertAdminExpertManageListDTO buildExpertAdminExpertManageListDTO(ExpertUserFullInfo expertUserFullInfo -// , Map> expertDictionaryMap, Map> expertTagMap) { -// Long userId = expertUserFullInfo.getUserId(); -// ExpertAdminExpertManageListDTO expertAdminExpertManageListDTO = new ExpertAdminExpertManageListDTO(); -// expertAdminExpertManageListDTO.setUserId(expertUserFullInfo.getUserId()); -// expertAdminExpertManageListDTO.setExpertName(expertUserFullInfo.getName()); -// expertAdminExpertManageListDTO.setPhoneNo(expertUserFullInfo.getPhoneNo()); -// expertAdminExpertManageListDTO.setIsDingUser(BoolDisplayEnum.judgeBoolean(expertUserFullInfo.getIsDingUser())); -// expertAdminExpertManageListDTO.setCompany(expertUserFullInfo.getCompany()); -// expertAdminExpertManageListDTO.setLegalEntityCode(expertUserFullInfo.getLegalEntityCode()); -// expertAdminExpertManageListDTO.setExpertAccountStatus(expertUserFullInfo.getExpertAccountStatus()); -// -// // 装配字典数据 -// List userExpertDictionaryList = Objects.isNull(expertDictionaryMap.get(userId)) ? new ArrayList<>() : expertDictionaryMap.get(userId); -// Map> fieldExpertDictionaryMap = userExpertDictionaryList.stream().collect(Collectors.groupingBy(ExpertDictionary::getExpertInfoField)); -// expertAdminExpertManageListDTO.setExpertType( -// DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey()))); -// expertAdminExpertManageListDTO.setCompanyAttribute( -// DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey()))); -// expertAdminExpertManageListDTO.setTitleLevel( -// DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()))); -// // 装配标签数据 -// List expertTagList = Objects.isNull(expertTagMap.get(userId)) ? new ArrayList<>() : expertTagMap.get(userId); -// Map> fieldExpertTagMap = expertTagList.stream().collect(Collectors.groupingBy(ExpertTag::getExpertInfoField)); -// expertAdminExpertManageListDTO.setExpertSource( -// TagAssembler.toTagFieldInfoList(fieldExpertTagMap.get(ExpertTagEnum.EXPERT_SOURCE.getKey()))); -// -// if (StringUtils.isNotBlank(expertUserFullInfo.getRegionCode()) && Objects.nonNull(expertUserFullInfo.getRegionLevel())) { -// ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); -// expertRegionInfo.setRegionLevel(expertUserFullInfo.getRegionLevel()); -// expertRegionInfo.setRegionCode(expertUserFullInfo.getRegionCode()); -// expertAdminExpertManageListDTO.setExpertRegionInfo(expertRegionInfo); -// } -// -// // 以下数据为专家excel导出使用 -// expertAdminExpertManageListDTO.setGender(expertUserFullInfo.getGender()); -// expertAdminExpertManageListDTO.setBirth(expertUserFullInfo.getBirth()); -// expertAdminExpertManageListDTO.setHometown(expertUserFullInfo.getHometown()); -// expertAdminExpertManageListDTO.setNationality(expertUserFullInfo.getNationality()); -// expertAdminExpertManageListDTO.setPolitical( -// DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.POLITICAL.getKey()))); -// expertAdminExpertManageListDTO.setIdCard(expertUserFullInfo.getIdCard()); -// expertAdminExpertManageListDTO.setBankNo(expertUserFullInfo.getBankNo()); -// expertAdminExpertManageListDTO.setEdu( -// DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.EDU.getKey()))); -// expertAdminExpertManageListDTO.setRecommendedWay( -// DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey()))); -// return expertAdminExpertManageListDTO; -// -// } + public static ExpertAdminExpertManageListDTO buildExpertAdminExpertManageListDTO(ExpertUserFullInfo expertUserFullInfo + , Map> expertDictionaryMap, Map> expertTagMap) { + Long userId = expertUserFullInfo.getUserId(); + ExpertAdminExpertManageListDTO expertAdminExpertManageListDTO = new ExpertAdminExpertManageListDTO(); + expertAdminExpertManageListDTO.setUserId(expertUserFullInfo.getUserId()); + expertAdminExpertManageListDTO.setExpertName(expertUserFullInfo.getExpertName()); + expertAdminExpertManageListDTO.setPhoneNo(expertUserFullInfo.getPhoneNo()); + expertAdminExpertManageListDTO.setIsDingUser(BoolDisplayEnum.judgeBoolean(expertUserFullInfo.getIsDingUser())); + expertAdminExpertManageListDTO.setCompany(expertUserFullInfo.getCompany()); + expertAdminExpertManageListDTO.setLegalEntityCode(expertUserFullInfo.getLegalEntityCode()); + expertAdminExpertManageListDTO.setExpertAccountStatus(expertUserFullInfo.getExpertAccountStatus()); + + // 装配字典数据 + List userExpertDictionaryList = Objects.isNull(expertDictionaryMap.get(userId)) ? new ArrayList<>() : expertDictionaryMap.get(userId); + Map> fieldExpertDictionaryMap = userExpertDictionaryList.stream().collect(Collectors.groupingBy(ExpertDictionary::getExpertInfoField)); + expertAdminExpertManageListDTO.setExpertType( + DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey()))); + expertAdminExpertManageListDTO.setCompanyAttribute( + DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey()))); + expertAdminExpertManageListDTO.setTitleLevel( + DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()))); + // 装配标签数据 + List expertTagList = Objects.isNull(expertTagMap.get(userId)) ? new ArrayList<>() : expertTagMap.get(userId); + Map> fieldExpertTagMap = expertTagList.stream().collect(Collectors.groupingBy(ExpertTag::getExpertInfoField)); + expertAdminExpertManageListDTO.setExpertSource( + TagAssembler.toTagFieldInfoList(fieldExpertTagMap.get(ExpertTagEnum.EXPERT_SOURCE.getKey()))); + + if (StringUtils.isNotBlank(expertUserFullInfo.getRegionCode()) && Objects.nonNull(expertUserFullInfo.getRegionLevel())) { + ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); + expertRegionInfo.setRegionLevel(expertUserFullInfo.getRegionLevel()); + expertRegionInfo.setRegionCode(expertUserFullInfo.getRegionCode()); + expertAdminExpertManageListDTO.setExpertRegionInfo(expertRegionInfo); + } + + // 以下数据为专家excel导出使用 + expertAdminExpertManageListDTO.setGender(expertUserFullInfo.getGender()); + expertAdminExpertManageListDTO.setBirth(expertUserFullInfo.getBirth()); + expertAdminExpertManageListDTO.setHometown(expertUserFullInfo.getHometown()); + expertAdminExpertManageListDTO.setNationality(expertUserFullInfo.getNationality()); + expertAdminExpertManageListDTO.setPolitical( + DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.POLITICAL.getKey()))); + expertAdminExpertManageListDTO.setIdCard(expertUserFullInfo.getIdCard()); + expertAdminExpertManageListDTO.setBankNo(expertUserFullInfo.getBankNo()); + expertAdminExpertManageListDTO.setEdu( + DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.EDU.getKey()))); + expertAdminExpertManageListDTO.setRecommendedWay( + DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey()))); + return expertAdminExpertManageListDTO; + + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/TagAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/TagAssembler.java new file mode 100644 index 0000000..4a4c029 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/TagAssembler.java @@ -0,0 +1,29 @@ +package com.ningdatech.pmapi.expert.assembler; + +import cn.hutool.core.collection.CollectionUtil; +import com.ningdatech.pmapi.expert.model.TagFieldInfo; +import com.ningdatech.pmapi.meta.model.entity.ExpertTag; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/25 下午4:30 + */ + +public class TagAssembler { + + public static List toTagFieldInfoList(List expertTagList) { + if (CollectionUtil.isEmpty(expertTagList)) { + return new ArrayList<>(); + } + return expertTagList.stream().map(r -> { + TagFieldInfo dictionaryFieldInfo = new TagFieldInfo(); + dictionaryFieldInfo.setTagFieldName(r.getExpertInfoField()); + dictionaryFieldInfo.setTagCode(r.getTagCode()); + return dictionaryFieldInfo; + }).collect(Collectors.toList()); + } +} 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 e581bd6..4593086 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 @@ -7,6 +7,8 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; import com.ningdatech.pmapi.common.helper.RegionLimitHelper; +import com.ningdatech.pmapi.common.model.CommonPage; +import com.ningdatech.pmapi.expert.assembler.ExpertAdminExpertManageAssembler; import com.ningdatech.pmapi.expert.assembler.ExpertInfoCmdAssembler; import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum; @@ -19,12 +21,14 @@ import com.ningdatech.pmapi.expert.model.*; import com.ningdatech.pmapi.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd; import com.ningdatech.pmapi.expert.model.cmd.ExpertInfoModifyCmd; +import com.ningdatech.pmapi.expert.model.dto.ExpertAdminExpertManageListDTO; import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery; import com.ningdatech.pmapi.expert.model.query.ExpertTagQuery; import com.ningdatech.pmapi.expert.model.req.AdminExpertBasicInfoModifyRequest; import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest; import com.ningdatech.pmapi.expert.model.vo.ExpertAdminExpertManageListVO; import com.ningdatech.pmapi.expert.model.vo.ExpertBasicInfoModifyResultVO; +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.meta.constant.DictExpertInfoTypeEnum; @@ -54,6 +58,8 @@ public class ExpertAdminManage { private final ExpertInfoSensitiveFieldModifyCheckHelper expertInfoSensitiveFieldModifyCheckHelper; private final ExpertInfoService expertInfoService; private final ExpertMetaApplyManage expertMetaApplyManage; + private final ExpertAdminManageService expertAdminManageService; + private final ExpertAdminExpertManageAssembler expertAdminExpertManageAssembler; /** * 专家管理员使用 专家库列表查询 @@ -64,14 +70,13 @@ public class ExpertAdminManage { public PageVo getExpertLibraryList(ExpertAdminExpertManageQuery query) { Long userId = LoginUserUtil.getUserId(); ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd = buildExpertAdminExpertManageQueryCmd(query, userId); -// CommonPage pageResult = -// expertAdminManageService.getExpertLibraryList(expertAdminExpertManageQueryCmd); -// -// PageVo pageVo = new PageVo<>(); -// pageVo.setTotal(pageResult.getItemsTotal()); -// pageVo.setRecords(expertAdminExpertManageAssembler.toExpertAdminExpertManageListVOList(pageResult.getItems())); -// return pageVo; - return null; + CommonPage pageResult = + expertAdminManageService.getExpertLibraryList(expertAdminExpertManageQueryCmd); + + PageVo pageVo = new PageVo<>(); + pageVo.setTotal(pageResult.getItemsTotal()); + pageVo.setRecords(expertAdminExpertManageAssembler.toExpertAdminExpertManageListVOList(pageResult.getItems())); + return pageVo; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.java new file mode 100644 index 0000000..a98abf7 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.expert.mapper; + +import com.ningdatech.pmapi.expert.model.query.ListExpertQuery; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/5 上午10:27 + */ +public interface ExpertAdminManageMapper { + + /** + * 获取所有符合查询条件的专家user_id + * + * @param query + * @return + */ + List listExpertUserId(@Param("query") ListExpertQuery query); +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.xml new file mode 100644 index 0000000..8eceaf9 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAdminManageMapper.xml @@ -0,0 +1,117 @@ + + + + + + SELECT user_id FROM nd_expert_user_full_info + + + AND expert_name LIKE CONCAT('%',#{query.expertName, jdbcType=BIGINT},'%') + + + AND company LIKE CONCAT('%',#{query.company, jdbcType=BIGINT},'%') + + + AND expert_account_status IN + + #{expertAccountStatus} + + + + AND region_code = #{query.regionCode} AND region_level = #{query.regionLevel} + + + AND is_ding_user = 'Y' + + + AND is_ding_user = 'N' + + + AND ( + + (= #{regionContains.parentRegionTreeLevel} AND region_code IN ]]> + #{containsRegionCode} + + ) + + ) + + + -- ORDER BY create_on DESC + + + + + SELECT + user_id + FROM + ( + SELECT DISTINCT + et.user_id, + et.expert_info_field + FROM + expert_tag et + WHERE + + (et.expert_info_field = #{expertTagQuery.expertInfoField} + AND et.tag_code IN + + #{tagCode} + ) + + ) temp + GROUP BY + user_id + HAVING + count( user_id )= ${query.expertTagQueryList.size()} + + + + + SELECT + user_id + FROM + ( + SELECT DISTINCT + ed.user_id, + ed.expert_info_field + FROM + expert_dictionary ed + WHERE + + (ed.expert_info_field = #{expertDictionaryQuery.expertInfoField} + AND ed.dictionary_code IN + + #{dictionaryCode} + ) + + ) temp + GROUP BY + user_id + HAVING + count( user_id )= ${query.expertDictionaryQueryList.size()} + + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertAdminExpertManageListDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertAdminExpertManageListDTO.java new file mode 100644 index 0000000..4de1610 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertAdminExpertManageListDTO.java @@ -0,0 +1,138 @@ +package com.ningdatech.pmapi.expert.model.dto; + + +import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; +import com.ningdatech.pmapi.expert.model.TagFieldInfo; +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/4 上午11:36 + */ +@Data +public class ExpertAdminExpertManageListDTO { + + /** + * 用户id + */ + private Long userId; + + /** + * 专家姓名 + */ + private String expertName; + + /** + * 工作单位 + */ + private String company; + + /** + * 单位属性(字典code) + */ + private List companyAttribute; + + /** + * 专家联系方式 + */ + private String phoneNo; + + /** + * 性别 + */ + private String gender; + + /** + * 出生日期 + */ + private LocalDateTime birth; + + + /** + * 籍贯 + */ + private String hometown; + + /** + * 民族 + */ + private String nationality; + + /** + * 政治面貌(字典code) + */ + private List political; + + /** + * 身份证号码 + */ + private String idCard; + + + /** + * 专家层级 + */ + private ExpertRegionInfo expertRegionInfo; + + + /** + * 银行卡号 + */ + private String bankNo; + + + /** + * 开户银行 + */ + private String bank; + + /** + * 学历(字典code) + */ + private List edu; + + + /** + * 学位(字典code) + */ + private List degree; + + /** + * 职称级别 + */ + private List titleLevel; + + /** + * 推荐方式 + */ + private List recommendedWay; + + /** + * 单位法人编号 + */ + private String legalEntityCode; + + /** + * 专家类型(内外围) + */ + private List expertType; + + /** + * 是否浙政钉用户 + */ + private Boolean isDingUser; + + /** + * 账号状态 + */ + private String expertAccountStatus; + + /** + * 专家来源 + */ + private List expertSource; +} 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 new file mode 100644 index 0000000..d8e0e96 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertAdminManageService.java @@ -0,0 +1,24 @@ +package com.ningdatech.pmapi.expert.service; + + +import com.ningdatech.pmapi.common.model.CommonPage; +import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd; +import com.ningdatech.pmapi.expert.model.dto.ExpertAdminExpertManageListDTO; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/4 上午11:32 + */ +public interface ExpertAdminManageService { + + /** + * 专家库条件筛选(管理员使用) + * + * @param expertAdminExpertManageQueryCmd + * @return + */ + CommonPage getExpertLibraryList(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 new file mode 100644 index 0000000..b72a567 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAdminManageServiceImpl.java @@ -0,0 +1,112 @@ +package com.ningdatech.pmapi.expert.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.pmapi.common.model.CommonPage; +import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler; +import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; +import com.ningdatech.pmapi.expert.constant.ExpertUserInfoStepEnum; +import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; +import com.ningdatech.pmapi.expert.mapper.ExpertAdminManageMapper; +import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd; +import com.ningdatech.pmapi.expert.model.dto.ExpertAdminExpertManageListDTO; +import com.ningdatech.pmapi.expert.model.query.ListExpertQuery; +import com.ningdatech.pmapi.expert.service.ExpertAdminManageService; +import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; +import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; +import com.ningdatech.pmapi.meta.model.entity.ExpertTag; +import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; +import com.ningdatech.pmapi.meta.service.IExpertTagService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/3/10 上午10:37 + */ +@Service +@RequiredArgsConstructor +public class ExpertAdminManageServiceImpl implements ExpertAdminManageService { + + private final IExpertUserFullInfoService iExpertUserFullInfoService; + private final IExpertDictionaryService iExpertDictionaryService; + private final IExpertTagService iExpertTagService; + private final ExpertAdminManageMapper expertAdminManageMapper; + + + @Override + public CommonPage getExpertLibraryList(ExpertAdminExpertManageQueryCmd req) { + ListExpertQuery listExpertQuery = buildListExpertQuery(req); + List userIdList = expertAdminManageMapper.listExpertUserId(listExpertQuery); + + List evidenceHasBeenSubmittedExpertInfoList = iExpertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) + .eq(ExpertUserFullInfo::getUserInfoStep, ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey())); + List evidenceHasBeenSubmittedExpertUserIdList = evidenceHasBeenSubmittedExpertInfoList + .stream().map(ExpertUserFullInfo::getUserId) + .distinct().collect(Collectors.toList()); + + Iterator iterator = userIdList.iterator(); + while (iterator.hasNext()) { + if (!evidenceHasBeenSubmittedExpertUserIdList.contains(iterator.next())) { + userIdList.remove(iterator.next()); + } + } + + CommonPage commonPage = new CommonPage<>(); + commonPage.setCurrentPageNumber(req.getPageNumber()); + commonPage.setItemsTotal((long) userIdList.size()); + + List recordList = new ArrayList<>(); + + if (userIdList.size() != 0) { + List currPageUserIdList = CollUtil.page(req.getPageNumber() - 1, req.getPageSize(), userIdList); + List expertUserList = iExpertUserFullInfoService.listByUserIds(currPageUserIdList); + + // 获取专家字典数据 + LambdaQueryWrapper in = Wrappers.lambdaQuery(ExpertDictionary.class) + .in(ExpertDictionary::getUserId, userIdList); + List expertDictionaryList = iExpertDictionaryService.list(in); + Map> expertDictMap = CollUtils.group(expertDictionaryList, ExpertDictionary::getUserId); + + // 获取专家标签数据 + LambdaQueryWrapper tagIn = Wrappers.lambdaQuery(ExpertTag.class) + .in(ExpertTag::getUserId, userIdList); + List expertTagList = iExpertTagService.list(tagIn); + Map> expertTagMap = CollUtils.group(expertTagList, ExpertTag::getUserId); + for (ExpertUserFullInfo expertUserFullInfo : expertUserList) { + ExpertAdminExpertManageListDTO expertAdminExpertManageListDTO = + ExpertUserInfoAssembler.buildExpertAdminExpertManageListDTO(expertUserFullInfo, expertDictMap, expertTagMap); + recordList.add(expertAdminExpertManageListDTO); + } + } + commonPage.setItems(recordList); + return commonPage; + } + + public ListExpertQuery buildListExpertQuery(ExpertAdminExpertManageQueryCmd queryCmd) { + ListExpertQuery listExpertQuery = new ListExpertQuery(); + listExpertQuery.setExpertName(queryCmd.getExpertName()); + listExpertQuery.setCompany(queryCmd.getCompany()); + listExpertQuery.setExpertDictionaryQueryList(queryCmd.getExpertDictionaryQueryList()); + listExpertQuery.setExpertTagQueryList(queryCmd.getExpertTagQueryList()); + listExpertQuery.setRegionContainsList(queryCmd.getRegionContainsList()); + listExpertQuery.setIsDingUser(queryCmd.getIsDingUser()); + listExpertQuery.setLimit(queryCmd.getLimit()); + listExpertQuery.setOffset(queryCmd.getOffset()); + listExpertQuery.setIsDingUser(queryCmd.getIsDingUser()); + if (CollectionUtils.isNotEmpty(queryCmd.getExpertAccountStatusList())) { + listExpertQuery.setExpertAccountStatusList( + queryCmd.getExpertAccountStatusList().stream().map(ExpertAccountStatusEnum::getKey).collect(Collectors.toList())); + } + return listExpertQuery; + } +}