Преглед изворни кода

优化专家信息封装

master
WendyYang пре 1 година
родитељ
комит
5f56363c72
2 измењених фајлова са 65 додато и 65 уклоњено
  1. +64
    -64
      pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java

+ 64
- 64
pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java Прегледај датотеку

@@ -25,7 +25,6 @@ import com.ningdatech.pmapi.meta.model.dto.TagDTO;
import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary;
import com.ningdatech.pmapi.meta.model.entity.ExpertTag;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

@@ -48,31 +47,31 @@ public class ExpertUserInfoAssembler {
public ExpertFullInfoVO buildExpertFullInfoVO(List<AttachFileVo> attachFiles, ExpertFullInfoAllDTO expertFullInfoAll) {
ExpertUserFullInfoDTO expertUserInfo = expertFullInfoAll.getExpertUserInfoDTO();
// 字典字典段map
Map<String, List<DictionaryFieldInfo>> dictFieldInfoMap = buildDictionaryFieldInfoMap(expertFullInfoAll.getExpertDictionaryList());
Map<String, List<DictionaryFieldInfo>> dictInfoMap = buildDictInfoMap(expertFullInfoAll.getExpertDictionaryList());
// 专家文件资料map
Map<Long, FileBasicInfo> fileBasicInfoMap = buildFileBasicInfoMap(attachFiles);
Map<Long, FileBasicInfo> fileInfoMap = buildFileBasicInfoMap(attachFiles);
// 专家标签字段map
Map<String, List<TagFieldInfo>> tagFieldInfoMap = buildTagFieldInfoMap(expertFullInfoAll.getExpertTagList());
Map<String, List<TagFieldInfo>> tagInfoMap = buildTagFieldInfoMap(expertFullInfoAll.getExpertTagList());
// 专家履职意向地
List<ExpertRegionDTO> expertIntentionWorkRegionInfo = expertFullInfoAll.getExpertIntentionWorkRegionInfo();
List<ExpertRegionDTO> intentionWorkRegion = expertFullInfoAll.getExpertIntentionWorkRegionInfo();
// 专家回避单位列表
List<ExpertAvoidCompanyDTO> expertAvoidCompanyList = expertFullInfoAll.getExpertAvoidCompanyList();
// 基本信息
ExpertBasicInfo basicInfo = buildExpertBasicInfo(expertUserInfo, dictFieldInfoMap, tagFieldInfoMap, expertIntentionWorkRegionInfo, fileBasicInfoMap);
ExpertBasicInfo basicInfo = buildExpertBasicInfo(expertUserInfo, dictInfoMap, tagInfoMap, intentionWorkRegion, fileInfoMap);
// 学历信息
ExpertEduInfo eduInfo = buildExpertEduInfo(expertUserInfo, dictFieldInfoMap, fileBasicInfoMap);
ExpertEduInfo eduInfo = buildExpertEduInfo(expertUserInfo, dictInfoMap, fileInfoMap);
// 职业信息
ExpertJobInfo jobInfo = buildExpertJobInfo(expertUserInfo, dictFieldInfoMap);
ExpertJobInfo jobInfo = buildExpertJobInfo(expertUserInfo, dictInfoMap);
// 专业信息
ExpertProfessionalInfo professionalInfo = buildExpertProfessionalInfo(expertUserInfo, dictFieldInfoMap
, tagFieldInfoMap, fileBasicInfoMap, expertAvoidCompanyList);
ExpertProfessionalInfo professionalInfo = buildExpertProfessionalInfo(expertUserInfo, dictInfoMap
, tagInfoMap, fileInfoMap, expertAvoidCompanyList);
// 推荐信息
ExpertRecommendInfo recommendInfo = new ExpertRecommendInfo();
recommendInfo.setRecommendedWay(dictFieldInfoMap.get(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey()));
recommendInfo.setRecommendationProofFile(getFileBasicInfoList(fileBasicInfoMap, expertUserInfo.getRecommendationProofFileIdList()));
recommendInfo.setRecommendedWay(dictInfoMap.get(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey()));
recommendInfo.setRecommendationProofFile(getFileBasicInfoList(fileInfoMap, expertUserInfo.getRecommendationProofFileIdList()));
// 其他信息
ExpertOtherInfo otherInfo = new ExpertOtherInfo();
otherInfo.setOther(tagFieldInfoMap.get(ExpertTagEnum.OTHER.getKey()));
otherInfo.setOther(tagInfoMap.get(ExpertTagEnum.OTHER.getKey()));
otherInfo.setRemark(expertUserInfo.getRemark());

// 专家申请履职意向展示列表
@@ -121,8 +120,8 @@ public class ExpertUserInfoAssembler {
}).collect(Collectors.groupingBy(TagFieldInfo::getTagFieldName));
}

public Map<String, List<DictionaryFieldInfo>> buildDictionaryFieldInfoMap(List<ExpertDictionaryDTO> expertDictionaryList) {
return expertDictionaryList.stream().map(r -> {
public Map<String, List<DictionaryFieldInfo>> buildDictInfoMap(List<ExpertDictionaryDTO> expertDictList) {
return expertDictList.stream().map(r -> {
DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo();
dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField());
dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode());
@@ -134,61 +133,63 @@ public class ExpertUserInfoAssembler {
}).collect(Collectors.groupingBy(DictionaryFieldInfo::getDictionaryFieldName));
}

public static ExpertProfessionalInfo buildExpertProfessionalInfo(ExpertUserFullInfoDTO expertUserInfoDTO
, Map<String, List<DictionaryFieldInfo>> dictionaryFieldInfoMap, Map<String, List<TagFieldInfo>> tagFieldInfoMap
, Map<Long, FileBasicInfo> fileBasicInfoMap, List<ExpertAvoidCompanyDTO> expertAvoidCompanyList) {
public static ExpertProfessionalInfo buildExpertProfessionalInfo(ExpertUserFullInfoDTO expertUserInfoDTO,
Map<String, List<DictionaryFieldInfo>> dictInfoMap,
Map<String, List<TagFieldInfo>> tagFieldInfoMap,
Map<Long, FileBasicInfo> fileInfoMap,
List<ExpertAvoidCompanyDTO> expertAvoidCompanyList) {
ExpertProfessionalInfo professionalInfo = new ExpertProfessionalInfo();
professionalInfo.setTechnicalTitles(expertUserInfoDTO.getTechnicalTitles());
professionalInfo.setTitleLevel(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()));
professionalInfo.setTitleCertificateFile(getFileBasicInfoList(fileBasicInfoMap, expertUserInfoDTO.getTitleCertificateFileIdList()));
professionalInfo.setTitleLevel(dictInfoMap.get(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()));
professionalInfo.setTitleCertificateFile(getFileBasicInfoList(fileInfoMap, expertUserInfoDTO.getTitleCertificateFileIdList()));
professionalInfo.setGoodAt(tagFieldInfoMap.get(ExpertTagEnum.GOOD_AT.getKey()));
professionalInfo.setTechnicalExpertise(tagFieldInfoMap.get(ExpertTagEnum.TECHNICAL_EXPERTISE.getKey()));
professionalInfo.setAwards(expertUserInfoDTO.getAwards());
professionalInfo.setIndustrySector(tagFieldInfoMap.get(ExpertTagEnum.INDUSTRY_SECTOR.getKey()));
professionalInfo.setRecognitionReward(expertUserInfoDTO.getRecognitionReward());
professionalInfo.setAvoidCompanyList(expertAvoidCompanyList.stream().map(r -> {
ExpertAvoidCompanyInfo expertAvoidCompanyInfo = new ExpertAvoidCompanyInfo();
expertAvoidCompanyInfo.setCompanyName(r.getCompanyName());
expertAvoidCompanyInfo.setCompanyUniqCode(r.getCompanyUniqCode());
return expertAvoidCompanyInfo;
ExpertAvoidCompanyInfo avoidCompanyInfo = new ExpertAvoidCompanyInfo();
avoidCompanyInfo.setCompanyName(r.getCompanyName());
avoidCompanyInfo.setCompanyUniqCode(r.getCompanyUniqCode());
return avoidCompanyInfo;
}).collect(Collectors.toList()));
return professionalInfo;
}

public static ExpertJobInfo buildExpertJobInfo(ExpertUserFullInfoDTO expertUserInfoDTO
, Map<String, List<DictionaryFieldInfo>> dictionaryFieldInfoMap) {
public static ExpertJobInfo buildExpertJobInfo(ExpertUserFullInfoDTO expertUserInfoDTO,
Map<String, List<DictionaryFieldInfo>> dictInfoMap) {
ExpertJobInfo jobInfo = new ExpertJobInfo();
jobInfo.setJobStatus(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.JOB_STATUS.getKey()));
jobInfo.setJobStatus(dictInfoMap.get(DictExpertInfoTypeEnum.JOB_STATUS.getKey()));
jobInfo.setRetiredAt(expertUserInfoDTO.getRetiredAt());
jobInfo.setCompany(expertUserInfoDTO.getCompany());
jobInfo.setCompanyUniqCode(expertUserInfoDTO.getCompanyUniqCode());
jobInfo.setLegalEntityCode(expertUserInfoDTO.getLegalEntityCode());
jobInfo.setAdministrativeDuties(expertUserInfoDTO.getAdministrativeDuties());
jobInfo.setStartWorkAt(expertUserInfoDTO.getStartWorkAt());
jobInfo.setAdministrativeRank(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.ADMINISTRATIVE_RANK.getKey()));
jobInfo.setCompanyAttribute(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey()));
jobInfo.setAdministrativeRank(dictInfoMap.get(DictExpertInfoTypeEnum.ADMINISTRATIVE_RANK.getKey()));
jobInfo.setCompanyAttribute(dictInfoMap.get(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey()));
jobInfo.setAddress(expertUserInfoDTO.getAddress());
jobInfo.setExperience(expertUserInfoDTO.getExperience());
return jobInfo;
}

public static ExpertEduInfo buildExpertEduInfo(ExpertUserFullInfoDTO expertUserInfoDTO
, Map<String, List<DictionaryFieldInfo>> dictionaryFieldInfoMap, Map<Long, FileBasicInfo> fileBasicInfoMap) {
public static ExpertEduInfo buildExpertEduInfo(ExpertUserFullInfoDTO expertFullInfo,
Map<String, List<DictionaryFieldInfo>> dictInfoMap,
Map<Long, FileBasicInfo> fileInfoMap) {
// 学历信息
ExpertEduInfo eduInfo = new ExpertEduInfo();
eduInfo.setSchool(expertUserInfoDTO.getSchool());
eduInfo.setGraduatedAt(expertUserInfoDTO.getGraduatedAt());
eduInfo.setAcademicTitle(expertUserInfoDTO.getAcademicTitle());
eduInfo.setEdu(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.EDU.getKey()));
eduInfo.setGraduationCertificateFile(getFileBasicInfoList(fileBasicInfoMap
, expertUserInfoDTO.getGraduationCertificateFileIdList()));
eduInfo.setDegree(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.DEGREE.getKey()));
eduInfo.setDegreeCertificateFile(getFileBasicInfoList(fileBasicInfoMap, expertUserInfoDTO.getDegreeCertificateFileIdList()));
eduInfo.setSchool(expertFullInfo.getSchool());
eduInfo.setGraduatedAt(expertFullInfo.getGraduatedAt());
eduInfo.setAcademicTitle(expertFullInfo.getAcademicTitle());
eduInfo.setEdu(dictInfoMap.get(DictExpertInfoTypeEnum.EDU.getKey()));
eduInfo.setGraduationCertificateFile(getFileBasicInfoList(fileInfoMap, expertFullInfo.getGraduationCertificateFileIdList()));
eduInfo.setDegree(dictInfoMap.get(DictExpertInfoTypeEnum.DEGREE.getKey()));
eduInfo.setDegreeCertificateFile(getFileBasicInfoList(fileInfoMap, expertFullInfo.getDegreeCertificateFileIdList()));
return eduInfo;
}

public static List<FileBasicInfo> getFileBasicInfoList(Map<Long, FileBasicInfo> fileBasicInfoMap, List<Long> fileIdList) {
if (CollectionUtils.isEmpty(fileIdList)) {
private static List<FileBasicInfo> getFileBasicInfoList(Map<Long, FileBasicInfo> fileBasicInfoMap, List<Long> fileIdList) {
if (CollUtil.isEmpty(fileIdList)) {
return new ArrayList<>();
}
List<FileBasicInfo> fileBasicInfoList = new ArrayList<>();
@@ -249,33 +250,33 @@ public class ExpertUserInfoAssembler {
return basicInfo;
}

public static ExpertFullInfoAllDTO buildExpertFullInfoAllDTO(ExpertUserFullInfo expertUserFullInfo
, List<ExpertTag> expertTagList
, List<ExpertDictionary> expertDictionaryList
, List<ExpertIntentionWorkRegion> expertIntentionWorkRegionList
, List<ExpertMetaApply> expertMetaApplyList
, List<ExpertAvoidCompany> expertAvoidCompanyList) {
ExpertUserFullInfoDTO expertUserFullInfoDTO = buildExpertUserFullInfoDTO(expertUserFullInfo);
List<ExpertDictionaryDTO> expertDictionaryDTOList = buildExpertDictionaryDTOList(expertDictionaryList);
List<ExpertTagDTO> expertTagDTOList = buildExpertTagDTOList(expertTagList);
List<ExpertRegionDTO> expertIntentionWorkRegionInfo = buildExpertIntentionWorkRegionInfo(expertIntentionWorkRegionList);
public static ExpertFullInfoAllDTO buildExpertFullInfoAllDTO(ExpertUserFullInfo expertUserFullInfo,
List<ExpertTag> expertTagList,
List<ExpertDictionary> expertDictionaryList,
List<ExpertIntentionWorkRegion> intentionWorkRegionList,
List<ExpertMetaApply> expertMetaApplyList,
List<ExpertAvoidCompany> expertAvoidCompanyList) {
ExpertUserFullInfoDTO expertFullInfoDto = buildExpertUserFullInfoDTO(expertUserFullInfo);
List<ExpertDictionaryDTO> expertDicts = buildExpertDictionaryDTOList(expertDictionaryList);
List<ExpertTagDTO> expertTags = buildExpertTagDTOList(expertTagList);
List<ExpertRegionDTO> intentionWorkRegions = buildExpertIntentionWorkRegionInfo(intentionWorkRegionList);

// 专家申请履职意向展示列表
List<ExpertRegionDTO> expertApplyIntentionWorkRegionInfo = buildExpertApplyIntentionWorkRegionInfo(expertIntentionWorkRegionList, expertMetaApplyList);
List<ExpertRegionDTO> applyIntentionWorkRegions = buildExpertApplyIntentionWorkRegionInfo(intentionWorkRegionList, expertMetaApplyList);
List<ExpertAvoidCompanyDTO> expertAvoidCompanyDTOList = buildExpertAvoidCompanyDTOList(expertAvoidCompanyList);
ExpertFullInfoAllDTO expertFullInfoAllDTO = new ExpertFullInfoAllDTO();
expertFullInfoAllDTO.setUserId(expertUserFullInfo.getUserId());
expertFullInfoAllDTO.setExpertUserInfoDTO(expertUserFullInfoDTO);
expertFullInfoAllDTO.setExpertDictionaryList(expertDictionaryDTOList);
expertFullInfoAllDTO.setExpertTagList(expertTagDTOList);
expertFullInfoAllDTO.setExpertIntentionWorkRegionInfo(expertIntentionWorkRegionInfo);
expertFullInfoAllDTO.setExpertApplyIntentionWorkRegionInfo(expertApplyIntentionWorkRegionInfo);
expertFullInfoAllDTO.setExpertAvoidCompanyList(expertAvoidCompanyDTOList);
return expertFullInfoAllDTO;
ExpertFullInfoAllDTO expertFullInfoAll = new ExpertFullInfoAllDTO();
expertFullInfoAll.setUserId(expertUserFullInfo.getUserId());
expertFullInfoAll.setExpertUserInfoDTO(expertFullInfoDto);
expertFullInfoAll.setExpertDictionaryList(expertDicts);
expertFullInfoAll.setExpertTagList(expertTags);
expertFullInfoAll.setExpertIntentionWorkRegionInfo(intentionWorkRegions);
expertFullInfoAll.setExpertApplyIntentionWorkRegionInfo(applyIntentionWorkRegions);
expertFullInfoAll.setExpertAvoidCompanyList(expertAvoidCompanyDTOList);
return expertFullInfoAll;
}

private static List<ExpertRegionDTO> buildExpertApplyIntentionWorkRegionInfo(List<ExpertIntentionWorkRegion> expertIntentionWorkRegionList
, List<ExpertMetaApply> expertMetaApplyList) {
private static List<ExpertRegionDTO> buildExpertApplyIntentionWorkRegionInfo(List<ExpertIntentionWorkRegion> expertIntentionWorkRegionList,
List<ExpertMetaApply> expertMetaApplyList) {
Set<RegionDtoMapKey> set = new HashSet<>();
for (ExpertIntentionWorkRegion expertIntentionWorkRegion : expertIntentionWorkRegionList) {
RegionDtoMapKey regionDtoMapKey = new RegionDtoMapKey();
@@ -453,7 +454,6 @@ public class ExpertUserInfoAssembler {

expertAdminExpertManageListDTO.setCreateTime(expertUserFullInfo.getCreateOn());
return expertAdminExpertManageListDTO;

}




+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java Прегледај датотеку

@@ -53,7 +53,7 @@ public class ExpertInfoSensitiveFieldModifyCheckHelper {
ExpertUserFullInfoDTO expertUserInfoDTO = expertUserFullInfoAll.getExpertUserInfoDTO();
// 字典字典段map
Map<String, List<DictionaryFieldInfo>> dictionaryFieldInfoMap =
expertUserInfoAssembler.buildDictionaryFieldInfoMap(expertUserFullInfoAll.getExpertDictionaryList());
expertUserInfoAssembler.buildDictInfoMap(expertUserFullInfoAll.getExpertDictionaryList());
// 专家文件资料map
Map<Long, FileBasicInfo> fileBasicInfoMap = ExpertUserInfoAssembler.buildFileBasicInfoMap(attachFiles);
// 专家标签字段map


Loading…
Откажи
Сачувај