Browse Source

补充方法:

批量获取用户全量信息
tags/24080901
liuxinxin 1 year ago
parent
commit
a1b0c01a64
2 changed files with 44 additions and 4 deletions
  1. +8
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java
  2. +36
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java

+ 8
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java View File

@@ -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<ExpertFullInfoAllDTO> listExpertUserFullInfoAll(List<Long> userIds);
}


+ 36
- 4
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java View File

@@ -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<ExpertFullInfoAllDTO> listExpertUserFullInfoAll(List<Long> userIds) {
List<ExpertUserFullInfo> expertUserFullInfos = iExpertUserFullInfoService.listByUserIds(userIds);
// 所有专家标签字段
List<ExpertTag> expertTagList = iExpertTagService.list(Wrappers.lambdaQuery(ExpertTag.class)
.in(ExpertTag::getUserId, userIds));
Map<Long, List<ExpertTag>> expertTagListMap = CollUtils.group(expertTagList, ExpertTag::getUserId);
// 所有专家字典字段
List<ExpertDictionary> expertDictionaryList = iExpertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class)
.in(ExpertDictionary::getUserId, userIds));
Map<Long, List<ExpertDictionary>> expertDictMap = CollUtils.group(expertDictionaryList, ExpertDictionary::getUserId);
// 专家履职意向列表
List<ExpertIntentionWorkRegion> expertIntentionWorkRegionList = iExpertIntentionWorkRegionService
.list(Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class)
.in(ExpertIntentionWorkRegion::getUserId, userIds));
Map<Long, List<ExpertIntentionWorkRegion>> intentionRegionMap = CollUtils.group(expertIntentionWorkRegionList, ExpertIntentionWorkRegion::getUserId);
// 专家履职意向申请列表
List<ExpertMetaApply> 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<Long, List<ExpertMetaApply>> metaApplyMap = CollUtils.group(expertMetaApplyList, ExpertMetaApply::getUserId);
// 所有专家回避单位
List<ExpertAvoidCompany> expertAvoidCompanyList = iExpertAvoidCompanyService.list(Wrappers.lambdaQuery(ExpertAvoidCompany.class)
.in(ExpertAvoidCompany::getUserId, userIds));
Map<Long, List<ExpertAvoidCompany>> 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());
}

}

Loading…
Cancel
Save