diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java index 6ca67a3..1b17c9d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java @@ -5,6 +5,8 @@ import com.ningdatech.pmapi.expert.model.cmd.ExpertRecommendProofSaveCmd; import com.ningdatech.pmapi.expert.model.cmd.ExpertStorageDealCmd; import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO; +import java.util.List; + /** * @author liuxinxin * @date 2022/7/22 下午4:39 @@ -31,5 +33,11 @@ public interface ExpertInfoService { void expertStorageDeal(ExpertStorageDealCmd cmd); + + + /** + * 批量获取用户全量信息 + **/ + List listExpertUserFullInfoAll(List userIds); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java index 2dab362..e6ba88c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler; import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; @@ -30,10 +31,7 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; /** @@ -371,5 +369,39 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { } + @Override + public List listExpertUserFullInfoAll(List userIds) { + List expertUserFullInfos = iExpertUserFullInfoService.listByUserIds(userIds); + // 所有专家标签字段 + List expertTagList = iExpertTagService.list(Wrappers.lambdaQuery(ExpertTag.class) + .in(ExpertTag::getUserId, userIds)); + Map> expertTagListMap = CollUtils.group(expertTagList, ExpertTag::getUserId); + // 所有专家字典字段 + List expertDictionaryList = iExpertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class) + .in(ExpertDictionary::getUserId, userIds)); + Map> expertDictMap = CollUtils.group(expertDictionaryList, ExpertDictionary::getUserId); + // 专家履职意向列表 + List expertIntentionWorkRegionList = iExpertIntentionWorkRegionService + .list(Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) + .in(ExpertIntentionWorkRegion::getUserId, userIds)); + Map> intentionRegionMap = CollUtils.group(expertIntentionWorkRegionList, ExpertIntentionWorkRegion::getUserId); + // 专家履职意向申请列表 + List expertMetaApplyList = iExpertMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class) + .in(ExpertMetaApply::getUserId, userIds) + .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) + .in(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), ExpertApplyTypeEnum.EXPERT_INTENTION_LEAVE.getKey())); + Map> metaApplyMap = CollUtils.group(expertMetaApplyList, ExpertMetaApply::getUserId); + // 所有专家回避单位 + List expertAvoidCompanyList = iExpertAvoidCompanyService.list(Wrappers.lambdaQuery(ExpertAvoidCompany.class) + .in(ExpertAvoidCompany::getUserId, userIds)); + Map> avoidInfoMap = CollUtils.group(expertAvoidCompanyList, ExpertAvoidCompany::getUserId); + return expertUserFullInfos.stream().map(w -> ExpertUserInfoAssembler.buildExpertFullInfoAllDTO(w, + expertTagListMap.getOrDefault(w.getUserId(), Collections.emptyList()), + expertDictMap.getOrDefault(w.getUserId(), Collections.emptyList()), + intentionRegionMap.getOrDefault(w.getUserId(), Collections.emptyList()), + metaApplyMap.getOrDefault(w.getUserId(), Collections.emptyList()), + avoidInfoMap.getOrDefault(w.getUserId(), Collections.emptyList()))) + .collect(Collectors.toList()); + } }