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 new file mode 100644 index 0000000..2d71b44 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java @@ -0,0 +1,476 @@ +package com.ningdatech.pmapi.expert.assembler; + +//import com.ningdatech.emapi.common.enumeration.BoolDisplayEnum; +//import com.ningdatech.emapi.common.helper.RegionCache; +//import com.ningdatech.emapi.common.utils.JSONObject; +//import com.ningdatech.emapi.expert.constants.DictExpertInfoTypeEnum; +//import com.ningdatech.emapi.expert.constants.ExpertApplyTypeEnum; +//import com.ningdatech.emapi.expert.constants.ExpertTagEnum; +//import com.ningdatech.emapi.expert.entity.*; +//import com.ningdatech.emapi.expert.entity.domain.*; +//import com.ningdatech.emapi.expert.entity.dto.*; +//import com.ningdatech.emapi.expert.entity.vo.ExpertFullInfoVO; +//import com.ningdatech.emapi.sys.file.entity.FileBasicInfo; +//import com.ningdatech.emapi.sys.file.entity.vo.result.AttachFileVo; +//import com.ningdatech.emapi.sys.meta.entity.RegionDtoMapKey; +//import com.ningdatech.emapi.sys.meta.entity.dto.DictionaryDTO; +//import com.ningdatech.emapi.sys.meta.entity.dto.TagDTO; +//import com.ningdatech.emapi.sys.meta.helper.DictionaryCache; +//import com.ningdatech.emapi.sys.meta.helper.TagCache; + +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; +import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; +import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; +import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; +import com.ningdatech.pmapi.expert.model.*; +import com.ningdatech.pmapi.expert.model.dto.*; +import com.ningdatech.pmapi.expert.model.vo.ExpertFullInfoVO; +import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; +import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; +import com.ningdatech.pmapi.meta.helper.DictionaryCache; +import com.ningdatech.pmapi.meta.helper.TagCache; +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.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; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/27 上午10:46 + */ +@Component +@RequiredArgsConstructor +public class ExpertUserInfoAssembler { + + private final TagCache tagCache; + private final DictionaryCache dictionaryCache; +// private final RegionCache regionCache; + + public ExpertFullInfoVO buildExpertFullInfoVO(List attachFiles + , ExpertFullInfoAllDTO expertUserFullInfoAll) { + ExpertUserFullInfoDTO expertUserInfoDTO = expertUserFullInfoAll.getExpertUserInfoDTO(); + // 字典字典段map + Map> dictionaryFieldInfoMap = + buildDictionaryFieldInfoMap(expertUserFullInfoAll.getExpertDictionaryList()); + // 专家文件资料map + Map fileBasicInfoMap = buildFileBasicInfoMap(attachFiles); + // 专家标签字段map + Map> tagFieldInfoMap = buildTagFieldInfoMap(expertUserFullInfoAll.getExpertTagList()); + // 专家履职意向地 + List expertIntentionWorkRegionInfo = + expertUserFullInfoAll.getExpertIntentionWorkRegionInfo(); + // 专家回避单位列表 + List expertAvoidCompanyList = expertUserFullInfoAll.getExpertAvoidCompanyList(); + // 基本信息 + ExpertBasicInfo basicInfo = buildExpertBasicInfo(expertUserInfoDTO, dictionaryFieldInfoMap, tagFieldInfoMap, expertIntentionWorkRegionInfo, fileBasicInfoMap); + // 学历信息 + ExpertEduInfo eduInfo = buildExpertEduInfo(expertUserInfoDTO, dictionaryFieldInfoMap, fileBasicInfoMap); + // 职业信息 + ExpertJobInfo jobInfo = buildExpertJobInfo(expertUserInfoDTO, dictionaryFieldInfoMap); + // 专业信息 + ExpertProfessionalInfo professionalInfo = + buildExpertProfessionalInfo(expertUserInfoDTO, dictionaryFieldInfoMap, tagFieldInfoMap + , fileBasicInfoMap, expertAvoidCompanyList); + // 推荐信息 + ExpertRecommendInfo recommendInfo = new ExpertRecommendInfo(); + recommendInfo.setRecommendedWay(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey())); + recommendInfo.setRecommendationProofFile( + getFileBasicInfoList(fileBasicInfoMap, expertUserInfoDTO.getRecommendationProofFileIdList())); + // 其他信息 + ExpertOtherInfo otherInfo = new ExpertOtherInfo(); + otherInfo.setOther(tagFieldInfoMap.get(ExpertTagEnum.OTHER.getKey())); + otherInfo.setRemark(expertUserInfoDTO.getRemark()); + + // 专家申请履职意向展示列表 + List expertApplyIntentionWorkRegions = expertUserFullInfoAll.getExpertApplyIntentionWorkRegionInfo().stream().map(r -> { + ExpertRegionInfo expertApplyIntentionWorkRegion = new ExpertRegionInfo(); + expertApplyIntentionWorkRegion.setRegionLevel(r.getRegionLevel()); + expertApplyIntentionWorkRegion.setRegionCode(r.getRegionCode()); +// expertApplyIntentionWorkRegion.setRegionName(regionCache.getUnionPathStr(r.getRegionCode(), r.getRegionLevel())); + return expertApplyIntentionWorkRegion; + }).collect(Collectors.toList()); + + + ExpertFullInfoVO expertFullInfoVO = new ExpertFullInfoVO(); + expertFullInfoVO.setUserId(expertUserInfoDTO.getUserId()); + expertFullInfoVO.setBasicInfo(basicInfo); + expertFullInfoVO.setEduInfo(eduInfo); + expertFullInfoVO.setJobInfo(jobInfo); + expertFullInfoVO.setProfessionalInfo(professionalInfo); + expertFullInfoVO.setRecommendInfo(recommendInfo); + expertFullInfoVO.setExpertOtherInfo(otherInfo); + expertFullInfoVO.setExpertApplyIntentionWorkRegions(expertApplyIntentionWorkRegions); + + return expertFullInfoVO; + } + + public static Map buildFileBasicInfoMap(List attachFiles) { + return attachFiles.stream().map(r -> { + FileBasicInfo fileBasicInfo = new FileBasicInfo(); + fileBasicInfo.setFileId(r.getFileId()); + fileBasicInfo.setFileName(r.getOriginalFileName()); + return fileBasicInfo; + }).collect(Collectors.toMap(FileBasicInfo::getFileId, Function.identity())); + } + + public Map> buildTagFieldInfoMap(List expertTagList) { + return expertTagList.stream().map(r -> { + TagFieldInfo tagFieldInfo = new TagFieldInfo(); + tagFieldInfo.setTagCode(r.getTagCode()); + tagFieldInfo.setTagFieldName(r.getExpertInfoField()); + TagDTO tagDTO = tagCache.getByTagCode(r.getTagCode()); + if (Objects.nonNull(tagDTO)) { + tagFieldInfo.setTagName(tagDTO.getTagName()); + } + return tagFieldInfo; + }).collect(Collectors.groupingBy(TagFieldInfo::getTagFieldName)); + } + + public Map> buildDictionaryFieldInfoMap(List expertDictionaryList) { + return expertDictionaryList.stream().map(r -> { + DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo(); + dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField()); + dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode()); + DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); + if (Objects.nonNull(dictionaryDTO)) { + dictionaryFieldInfo.setDictionaryName(dictionaryDTO.getName()); + } + return dictionaryFieldInfo; + }).collect(Collectors.groupingBy(DictionaryFieldInfo::getDictionaryFieldName)); + } + + public static ExpertProfessionalInfo buildExpertProfessionalInfo(ExpertUserFullInfoDTO expertUserInfoDTO + , Map> dictionaryFieldInfoMap, Map> tagFieldInfoMap + , Map fileBasicInfoMap, List expertAvoidCompanyList) { + ExpertProfessionalInfo professionalInfo = new ExpertProfessionalInfo(); + professionalInfo.setTechnicalTitles(expertUserInfoDTO.getTechnicalTitles()); + professionalInfo.setTitleLevel(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey())); + professionalInfo.setTitleCertificateFile(getFileBasicInfoList(fileBasicInfoMap, 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; + }).collect(Collectors.toList())); + return professionalInfo; + } + + public static ExpertJobInfo buildExpertJobInfo(ExpertUserFullInfoDTO expertUserInfoDTO + , Map> dictionaryFieldInfoMap) { + ExpertJobInfo jobInfo = new ExpertJobInfo(); + jobInfo.setJobStatus(dictionaryFieldInfoMap.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.setAddress(expertUserInfoDTO.getAddress()); + jobInfo.setExperience(expertUserInfoDTO.getExperience()); + return jobInfo; + } + + public static ExpertEduInfo buildExpertEduInfo(ExpertUserFullInfoDTO expertUserInfoDTO + , Map> dictionaryFieldInfoMap, Map fileBasicInfoMap) { + // 学历信息 + 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())); + return eduInfo; + } + + public static List getFileBasicInfoList(Map fileBasicInfoMap, List fileIdList) { + if (CollectionUtils.isEmpty(fileIdList)) { + return new ArrayList<>(); + } + List fileBasicInfoList = new ArrayList<>(); + for (Long fileId : fileIdList) { + FileBasicInfo fileBasicInfo = fileBasicInfoMap.get(fileId); + if (Objects.nonNull(fileBasicInfo)) { + fileBasicInfoList.add(fileBasicInfo); + } + } + return fileBasicInfoList; + } + + public static FileBasicInfo getFileBasicInfo(Map fileBasicInfoMap, Long fileId) { + if (Objects.isNull(fileId)) { + return null; + } + FileBasicInfo fileBasicInfo = fileBasicInfoMap.get(fileId); + return fileBasicInfo; + } + + public ExpertBasicInfo buildExpertBasicInfo(ExpertUserFullInfoDTO expertUserInfoDTO + , Map> dictionaryFieldInfoMap + , Map> tagFieldInfoMap + , List expertIntentionWorkRegionInfo + , Map fileBasicInfoMap) { + //专家层级 + ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); + expertRegionInfo.setRegionLevel(expertUserInfoDTO.getRegionLevel()); + expertRegionInfo.setRegionCode(expertUserInfoDTO.getRegionCode()); + + // 基本信息 + ExpertBasicInfo basicInfo = new ExpertBasicInfo(); + basicInfo.setIsDingUser(expertUserInfoDTO.getIsDingUser()); + basicInfo.setPhoneNo(expertUserInfoDTO.getPhoneNo()); + basicInfo.setName(expertUserInfoDTO.getName()); + basicInfo.setAvatarFile(getFileBasicInfo(fileBasicInfoMap, expertUserInfoDTO.getAvatarFileId())); + basicInfo.setGender(expertUserInfoDTO.getGender()); + basicInfo.setPolitical(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.POLITICAL.getKey())); + basicInfo.setIdCard(expertUserInfoDTO.getIdCard()); + basicInfo.setOfficePhone(expertUserInfoDTO.getPhoneNo()); + basicInfo.setBirth(expertUserInfoDTO.getBirth()); + basicInfo.setBank(expertUserInfoDTO.getBank()); + basicInfo.setBankNo(expertUserInfoDTO.getBankNo()); + basicInfo.setEmail(expertUserInfoDTO.getEmail()); + basicInfo.setHometown(expertUserInfoDTO.getHometown()); + basicInfo.setNationality(expertUserInfoDTO.getNationality()); + basicInfo.setExpertSource(tagFieldInfoMap.get(ExpertTagEnum.EXPERT_SOURCE.getKey())); + if (Objects.nonNull(expertRegionInfo)) { +// expertRegionInfo.setRegionName(regionCache.getUnionPathStr(expertRegionInfo.getRegionCode(), expertRegionInfo.getRegionLevel())); + basicInfo.setExpertRegionInfo(expertRegionInfo); + } + + basicInfo.setExpertIntentionWorkRegions(expertIntentionWorkRegionInfo.stream().map(r -> { + ExpertRegionInfo expertIntentionWorkRegion = new ExpertRegionInfo(); + expertIntentionWorkRegion.setRegionCode(r.getRegionCode()); + expertIntentionWorkRegion.setRegionLevel(r.getRegionLevel()); +// expertIntentionWorkRegion.setRegionName(regionCache.getUnionPathStr(r.getRegionCode(), r.getRegionLevel())); + return expertIntentionWorkRegion; + }).collect(Collectors.toList())); + basicInfo.setExpertType(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey())); + return basicInfo; + } + + public static ExpertFullInfoAllDTO buildExpertFullInfoAllDTO(ExpertUserFullInfo expertUserFullInfo + , List expertTagList + , List expertDictionaryList + , List expertIntentionWorkRegionList +// , List expertMetaApplyList + , List expertAvoidCompanyList) { + ExpertUserFullInfoDTO expertUserFullInfoDTO = buildExpertUserFullInfoDTO(expertUserFullInfo); + List expertDictionaryDTOList = buildExpertDictionaryDTOList(expertDictionaryList); + List expertTagDTOList = buildExpertTagDTOList(expertTagList); + List expertIntentionWorkRegionInfo = buildExpertIntentionWorkRegionInfo(expertIntentionWorkRegionList); + + // 专家申请履职意向展示列表 +// List expertApplyIntentionWorkRegionInfo = buildExpertApplyIntentionWorkRegionInfo(expertIntentionWorkRegionList, expertMetaApplyList); + List 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; + } +// +// private static List buildExpertApplyIntentionWorkRegionInfo(List expertIntentionWorkRegionList +// , List expertMetaApplyList) { +// HashSet set = new HashSet(); +// for (ExpertIntentionWorkRegion expertIntentionWorkRegion : expertIntentionWorkRegionList) { +// RegionDtoMapKey regionDtoMapKey = new RegionDtoMapKey(); +// regionDtoMapKey.setRegionCode(expertIntentionWorkRegion.getRegionCode()); +// regionDtoMapKey.setRegionLevel(expertIntentionWorkRegion.getRegionLevel()); +// set.add(regionDtoMapKey); +// } +// +// for (ExpertMetaApply expertMetaApply : expertMetaApplyList) { +// String applyType = expertMetaApply.getApplyType(); +// RegionDtoMapKey regionDtoMapKey = new RegionDtoMapKey(); +// regionDtoMapKey.setRegionCode(expertMetaApply.getRegionCode()); +// regionDtoMapKey.setRegionLevel(expertMetaApply.getRegionLevel()); +// ExpertApplyTypeEnum typeEnum = ExpertApplyTypeEnum.of(applyType); +// switch (typeEnum) { +// case EXPERT_INTENTION_LEAVE: { +// set.remove(regionDtoMapKey); +// } +// break; +// case EXPERT_INTENTION_JOIN: { +// set.add(regionDtoMapKey); +// } +// break; +// default: +// break; +// } +// } +// return set.stream().map(r -> { +// ExpertRegionDTO expertRegionDTO = new ExpertRegionDTO(); +// expertRegionDTO.setRegionCode(r.getRegionCode()); +// expertRegionDTO.setRegionLevel(r.getRegionLevel()); +// return expertRegionDTO; +// }).collect(Collectors.toList()); +// } + + private static List buildExpertAvoidCompanyDTOList(List expertAvoidCompanyList) { + return expertAvoidCompanyList.stream().map(r -> { + ExpertAvoidCompanyDTO expertAvoidCompanyDTO = new ExpertAvoidCompanyDTO(); + expertAvoidCompanyDTO.setCompanyUniqCode(r.getCompanyUniqCode()); + expertAvoidCompanyDTO.setCompanyName(r.getCompanyName()); + return expertAvoidCompanyDTO; + }).collect(Collectors.toList()); + } + + private static List buildExpertIntentionWorkRegionInfo(List expertIntentionWorkRegionList) { + return expertIntentionWorkRegionList.stream().map(r -> { + ExpertRegionDTO expertRegionDTO = new ExpertRegionDTO(); + expertRegionDTO.setRegionLevel(r.getRegionLevel()); + expertRegionDTO.setRegionCode(r.getRegionCode()); + return expertRegionDTO; + }).collect(Collectors.toList()); + } + + private static List buildExpertTagDTOList(List expertTagList) { + return expertTagList.stream().map(r -> { + ExpertTagDTO expertTagDTO = new ExpertTagDTO(); + expertTagDTO.setExpertInfoField(r.getExpertInfoField()); + expertTagDTO.setTagCode(r.getTagCode()); + return expertTagDTO; + }).collect(Collectors.toList()); + } + + private static List buildExpertDictionaryDTOList(List expertDictionaryList) { + return expertDictionaryList.stream().map(r -> { + ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); + expertDictionaryDTO.setExpertInfoField(r.getExpertInfoField()); + expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); + return expertDictionaryDTO; + }).collect(Collectors.toList()); + } + + public static ExpertUserFullInfoDTO buildExpertUserFullInfoDTO(ExpertUserFullInfo expertUserFullInfo) { + ExpertUserFullInfoDTO expertUserFullInfoDTO = new ExpertUserFullInfoDTO(); + expertUserFullInfoDTO.setIsDingUser(BoolDisplayEnum.judgeBoolean(expertUserFullInfo.getIsDingUser())); + expertUserFullInfoDTO.setPhoneNo(expertUserFullInfo.getPhoneNo()); + expertUserFullInfoDTO.setGender(expertUserFullInfo.getGender()); + expertUserFullInfoDTO.setName(expertUserFullInfo.getExpertName()); + expertUserFullInfoDTO.setAvatarFileId(expertUserFullInfo.getAvatarFileId()); + expertUserFullInfoDTO.setIdCard(expertUserFullInfo.getIdCard()); + expertUserFullInfoDTO.setOfficePhone(expertUserFullInfo.getOfficePhone()); + expertUserFullInfoDTO.setBirth(expertUserFullInfo.getBirth()); + expertUserFullInfoDTO.setBankNo(expertUserFullInfo.getBankNo()); + expertUserFullInfoDTO.setBank(expertUserFullInfo.getBank()); + expertUserFullInfoDTO.setEmail(expertUserFullInfo.getEmail()); + expertUserFullInfoDTO.setHometown(expertUserFullInfo.getHometown()); + expertUserFullInfoDTO.setNationality(expertUserFullInfo.getNationality()); + + expertUserFullInfoDTO.setSchool(expertUserFullInfo.getSchool()); + expertUserFullInfoDTO.setGraduatedAt(expertUserFullInfo.getGraduatedAt()); + expertUserFullInfoDTO.setAcademicTitle(expertUserFullInfo.getAcademicTitle()); + if (StringUtils.isNotBlank(expertUserFullInfo.getGraduationCertificateFileIdList())) { + expertUserFullInfoDTO.setGraduationCertificateFileIdList(JSONObject.parseArray(expertUserFullInfo.getGraduationCertificateFileIdList(), Long.class)); + } + if (StringUtils.isNotBlank(expertUserFullInfo.getDegreeCertificateFileIdList())) { + expertUserFullInfoDTO.setDegreeCertificateFileIdList(JSONObject.parseArray(expertUserFullInfo.getDegreeCertificateFileIdList(), Long.class)); + } + expertUserFullInfoDTO.setRetiredAt(expertUserFullInfo.getRetiredAt()); + expertUserFullInfoDTO.setCompany(expertUserFullInfo.getCompany()); +// expertUserFullInfoDTO.setCompanyUniqCode(expertUserFullInfo.getCompanyUniqCode()); + expertUserFullInfoDTO.setLegalEntityCode(expertUserFullInfo.getLegalEntityCode()); + expertUserFullInfoDTO.setAdministrativeDuties(expertUserFullInfo.getAdministrativeDuties()); + expertUserFullInfoDTO.setStartWorkAt(expertUserFullInfo.getStartWorkAt()); + expertUserFullInfoDTO.setAddress(expertUserFullInfo.getAddress()); + expertUserFullInfoDTO.setExperience(expertUserFullInfo.getExperience()); + + expertUserFullInfoDTO.setTechnicalTitles(expertUserFullInfo.getTechnicalTitles()); + if (StringUtils.isNotBlank(expertUserFullInfo.getTitleCertificateFileIdList())) { + expertUserFullInfoDTO.setTitleCertificateFileIdList(JSONObject.parseArray(expertUserFullInfo.getTitleCertificateFileIdList(), Long.class)); + } + expertUserFullInfoDTO.setAwards(expertUserFullInfo.getAwards()); + expertUserFullInfoDTO.setRecognitionReward(expertUserFullInfo.getRecognitionReward()); + + expertUserFullInfoDTO.setRegionCode(expertUserFullInfo.getRegionCode()); + expertUserFullInfoDTO.setRegionLevel(expertUserFullInfo.getRegionLevel()); + + if (StringUtils.isNotBlank(expertUserFullInfo.getRecommendationProofFileIdList())) { + expertUserFullInfoDTO.setRecommendationProofFileIdList(JSONObject.parseArray(expertUserFullInfo.getRecommendationProofFileIdList(), Long.class)); + } + expertUserFullInfoDTO.setRemark(expertUserFullInfo.getRemark()); + + 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; +// +// } + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertAvoidCompanyController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertAvoidCompanyController.java deleted file mode 100644 index a5c4ef5..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertAvoidCompanyController.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi.expert.controller; - - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-02-23 - */ -@Controller -@RequestMapping("/pmapi.expert/expert-avoid-company") -public class ExpertAvoidCompanyController { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java index 5f9b29f..df457d6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java @@ -2,14 +2,13 @@ package com.ningdatech.pmapi.expert.controller; import com.ningdatech.pmapi.expert.manage.ExpertManage; +import com.ningdatech.pmapi.expert.model.req.ExpertRecommendProofSubmitRequest; import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest; +import com.ningdatech.pmapi.expert.model.vo.ExpertFullInfoVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.validation.Valid; @@ -36,5 +35,17 @@ public class ExpertController { expertManage.expertBasicInfoSubmit(request); } + @PostMapping("/recommend-proof-submit") + @ApiOperation("推荐证明提交接口(专家报名使用)") + public void expertRecommendProofSubmit(@Valid @RequestBody ExpertRecommendProofSubmitRequest request) { + expertManage.expertRecommendProofSubmit(request); + } + + @GetMapping("/detail") + @ApiOperation("专家获取专家详细信息") + public ExpertFullInfoVO getExpertFullInfoDetail() { + return expertManage.getExpertFullInfoDetail(null); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoCommonHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoCommonHelper.java new file mode 100644 index 0000000..fe63c30 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoCommonHelper.java @@ -0,0 +1,46 @@ +package com.ningdatech.pmapi.expert.helper; + +import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO; +import com.ningdatech.pmapi.expert.model.dto.ExpertUserFullInfoDTO; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/7/28 上午10:18 + */ +@Component +public class ExpertInfoCommonHelper { + + /** + * 获取专家的所有文件id + * 头像,学位证书,毕业证书,推荐证明材料,职称证明 + * + * @param expertUserFullInfoAll + * @return + */ + public List getExpertFileIdList(ExpertFullInfoAllDTO expertUserFullInfoAll) { + ExpertUserFullInfoDTO expertUserInfoDTO = expertUserFullInfoAll.getExpertUserInfoDTO(); + List fileIdList = new ArrayList<>(); + if (Objects.nonNull(expertUserInfoDTO.getAvatarFileId())) { + fileIdList.add(expertUserInfoDTO.getAvatarFileId()); + } + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getDegreeCertificateFileIdList())) { + fileIdList.addAll(expertUserInfoDTO.getDegreeCertificateFileIdList()); + } + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getGraduationCertificateFileIdList())) { + fileIdList.addAll(expertUserInfoDTO.getGraduationCertificateFileIdList()); + } + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getRecommendationProofFileIdList())) { + fileIdList.addAll(expertUserInfoDTO.getRecommendationProofFileIdList()); + } + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getTitleCertificateFileIdList())) { + fileIdList.addAll(expertUserInfoDTO.getTitleCertificateFileIdList()); + } + return fileIdList; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java index f9b55dd..3ca3ddd 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java @@ -1,25 +1,36 @@ package com.ningdatech.pmapi.expert.manage; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import com.ningdatech.file.service.FileService; import com.ningdatech.pmapi.expert.assembler.ExpertInfoCmdAssembler; +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.helper.ExpertInfoCommonHelper; import com.ningdatech.pmapi.expert.helper.ExpertManageHelper; -import com.ningdatech.pmapi.expert.model.ExpertBasicInfo; -import com.ningdatech.pmapi.expert.model.ExpertEduInfo; -import com.ningdatech.pmapi.expert.model.ExpertJobInfo; -import com.ningdatech.pmapi.expert.model.ExpertProfessionalInfo; +import com.ningdatech.pmapi.expert.model.*; import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; +import com.ningdatech.pmapi.expert.model.cmd.ExpertRecommendProofSaveCmd; +import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO; +import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO; +import com.ningdatech.pmapi.expert.model.req.ExpertRecommendProofSubmitRequest; import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest; +import com.ningdatech.pmapi.expert.model.vo.ExpertFullInfoVO; import com.ningdatech.pmapi.expert.service.ExpertInfoService; import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; +import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; import com.ningdatech.pmapi.user.util.LoginUserUtil; import lombok.RequiredArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Component; +import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** * @author liuxinxin @@ -31,10 +42,11 @@ import java.util.Objects; public class ExpertManage { private final ExpertManageHelper expertManageHelper; - private final IExpertUserFullInfoService iExpertUserFullInfoService; - private final ExpertInfoService expertInfoService; + private final ExpertInfoCommonHelper expertInfoCommonHelper; + private final FileService fileService; + private final ExpertUserInfoAssembler expertUserInfoAssembler; /** @@ -75,4 +87,51 @@ public class ExpertManage { } + public void expertRecommendProofSubmit(ExpertRecommendProofSubmitRequest request) { + // 用户id + Long expertUserId = LoginUserUtil.getUserId(); + ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(expertUserId); + // 判断专家状态,是否可以进行证明材料提交 + if (Objects.isNull(expertUserFullInfo) + || !ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus()) + || ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey().equals(expertUserFullInfo.getUserInfoStep())) { + throw new BizException("当前状态无法提交证明材料"); + } + // 根据用户id 获取用户信息,获取手机号校验 验证码是否正确 + String phoneNo = expertUserFullInfo.getPhoneNo(); + String verificationCode = request.getVerificationCode(); + + // 证明材料提交 + List recommendProofFile = request.getRecommendProofFile(); + List recommendedWayList = request.getRecommendedWay(); + ExpertRecommendProofSaveCmd expertRecommendProofSaveCmd = new ExpertRecommendProofSaveCmd(); + if (CollectionUtils.isNotEmpty(recommendProofFile)) { + expertRecommendProofSaveCmd.setRecommendationProofFileIdList(recommendProofFile.stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); + } + List recommendedWayDictionaryDTOList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(recommendedWayList)) { + recommendedWayDictionaryDTOList = recommendedWayList.stream().map(r -> { + ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); + expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); + expertDictionaryDTO.setExpertInfoField(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey()); + return expertDictionaryDTO; + }).collect(Collectors.toList()); + } + expertRecommendProofSaveCmd.setRecommendedWay(recommendedWayDictionaryDTOList); + expertRecommendProofSaveCmd.setUserId(expertUserId); + expertInfoService.expertRecommendProofSave(expertRecommendProofSaveCmd); + } + + public ExpertFullInfoVO getExpertFullInfoDetail(Long expertUserId) { + Long currentUserId = LoginUserUtil.getUserId(); + if (Objects.isNull(expertUserId)) { + expertUserId = currentUserId; + } + ExpertFullInfoAllDTO expertUserFullInfoAll = expertInfoService.getExpertUserFullInfoAll(expertUserId); + if (Objects.isNull(expertUserFullInfoAll)) { + return null; + } + List fileIdList = expertInfoCommonHelper.getExpertFileIdList(expertUserFullInfoAll); + List attachFiles = fileService.getByIds(fileIdList); + return expertUserInfoAssembler.buildExpertFullInfoVO(attachFiles, expertUserFullInfoAll); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/AdminModifyExpertInfoCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/AdminModifyExpertInfoCmd.java new file mode 100644 index 0000000..322291f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/AdminModifyExpertInfoCmd.java @@ -0,0 +1,37 @@ +//package com.ningdatech.pmapi.expert.model.cmd; +// +//import com.ningdatech.emapi.expert.entity.bo.ExpertInfoSensitiveFieldCheckBO; +//import com.ningdatech.emapi.expert.entity.dto.*; +//import lombok.Data; +// +//import java.util.List; +// +///** +// * @author liuxinxin +// * @date 2022/7/28 下午2:43 +// */ +//@Data +//public class AdminModifyExpertInfoCmd { +// +// private Long userId; +// +// private ExpertUserFullInfoDTO expertUserInfoDTO; +// +// private List expertDictionaryList; +// +// private List expertTagList; +// +// /** +// * 专家履职意向(区域编码) +// */ +// private List expertIntentionWorkRegionInfo; +// +// /** +// * 回避单位列表 +// */ +// private List expertAvoidCompanyList; +// +// private ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO; +// +// private ModifyApplyExtraInfoDTO modifyApplyExtraInfo; +//} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java new file mode 100644 index 0000000..c38d32c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java @@ -0,0 +1,61 @@ +//package com.ningdatech.pmapi.expert.model.cmd; +// +//import com.ningdatech.emapi.common.model.CommonPageReq; +//import com.ningdatech.emapi.expert.constants.ExpertAccountStatusEnum; +//import com.ningdatech.emapi.expert.entity.bo.RegionContainsBO; +//import com.ningdatech.emapi.expert.entity.query.ExpertDictionaryQuery; +//import com.ningdatech.emapi.expert.entity.query.ExpertTagQuery; +//import io.swagger.annotations.ApiModelProperty; +//import lombok.Data; +// +//import java.util.List; +// +///** +// * @author liuxinxin +// * @date 2022/8/4 上午11:11 +// */ +//@Data +//public class ExpertAdminExpertManageQueryCmd extends CommonPageReq { +// +// @ApiModelProperty("专家姓名(精准匹配)") +// private String expertName; +// +// @ApiModelProperty("工作单位(模糊匹配)") +// private String company; +// +// @ApiModelProperty("专家账号状态") +// private List expertAccountStatusList; +// +// /** +// * 区域编码 +// */ +// @ApiModelProperty("区域编码") +// private String regionCode; +// +// /** +// * 区域级别 +// */ +// @ApiModelProperty("区域级别") +// private Integer regionLevel; +// +// /** +// * 专家管理区域范围 +// */ +// List regionContainsList; +// +// /** +// * 专家字典信息 +// */ +// private List expertDictionaryQueryList; +// +// /** +// * 专家标签信息 +// */ +// private List expertTagQueryList; +// +// /** +// * 是否为钉用户 +// */ +// private Boolean isDingUser; +// +//} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertDeliveryDealCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertDeliveryDealCmd.java new file mode 100644 index 0000000..ece2d3c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertDeliveryDealCmd.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.expert.model.cmd; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/26 下午6:28 + * 专家出库审核处理cmd + */ +@Data +public class ExpertDeliveryDealCmd { + + private Long expertUserId; + + private Boolean applyResult; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyApplyDealCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyApplyDealCmd.java new file mode 100644 index 0000000..dc09f5a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyApplyDealCmd.java @@ -0,0 +1,18 @@ +package com.ningdatech.pmapi.expert.model.cmd; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/28 下午5:35 + */ +@Data +public class ExpertInfoModifyApplyDealCmd { + + private Long expertUserId; + + private Boolean applyResult; + + private Long applyId; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyCmd.java new file mode 100644 index 0000000..28a82cd --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyCmd.java @@ -0,0 +1,37 @@ +//package com.ningdatech.pmapi.expert.model.cmd; +// +//import com.ningdatech.emapi.expert.entity.bo.ExpertInfoSensitiveFieldCheckBO; +//import com.ningdatech.emapi.expert.entity.dto.*; +//import lombok.Data; +// +//import java.util.List; +// +///** +// * @author liuxinxin +// * @date 2022/7/28 下午2:43 +// */ +//@Data +//public class ExpertInfoModifyCmd { +// +// private Long userId; +// +// private ExpertUserFullInfoDTO expertUserInfoDTO; +// +// private List expertDictionaryList; +// +// private List expertTagList; +// +// /** +// * 专家履职意向(区域编码) +// */ +// private List expertIntentionWorkRegionInfo; +// +// /** +// * 回避单位列表 +// */ +// private List expertAvoidCompanyList; +// +// private ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO; +// +// private ModifyApplyExtraInfoDTO modifyApplyExtraInfo; +//} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertIntentionApplyDealCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertIntentionApplyDealCmd.java new file mode 100644 index 0000000..73aa7e6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertIntentionApplyDealCmd.java @@ -0,0 +1,22 @@ +//package com.ningdatech.pmapi.expert.model.cmd; +// +//import com.ningdatech.emapi.expert.constants.ExpertApplyTypeEnum; +//import lombok.Data; +// +///** +// * @author liuxinxin +// * @date 2022/7/27 上午9:06 +// */ +//@Data +//public class ExpertIntentionApplyDealCmd { +// +// private Long expertUserId; +// +// private Boolean applyResult; +// +// ExpertApplyTypeEnum applyTypeEnum; +// +// private String expertRegionCode; +// +// private Integer expertRegionLevel; +//} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertRecommendProofSaveCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertRecommendProofSaveCmd.java new file mode 100644 index 0000000..91b5b9f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertRecommendProofSaveCmd.java @@ -0,0 +1,22 @@ +package com.ningdatech.pmapi.expert.model.cmd; + +import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/25 下午4:59 + */ +@Data +public class ExpertRecommendProofSaveCmd { + + + private Long userId; + + private List recommendationProofFileIdList; + + private List recommendedWay; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertStorageDealCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertStorageDealCmd.java new file mode 100644 index 0000000..607fe5f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertStorageDealCmd.java @@ -0,0 +1,35 @@ +//package com.ningdatech.pmapi.expert.model.cmd; +// +//import com.ningdatech.emapi.expert.entity.dto.ExpertDictionaryDTO; +//import com.ningdatech.emapi.expert.entity.dto.ExpertTagDTO; +//import lombok.Data; +// +//import java.util.List; +// +///** +// * @author liuxinxin +// * @date 2022/7/26 下午5:40 +// */ +//@Data +//public class ExpertStorageDealCmd { +// +// private Long expertUserId; +// +// private Boolean applyResult; +// +// private String joinRegionCode; +// +// private Integer joinRegionLevel; +// +// /** +// * 专家类型(内外围) +// */ +// private List expertType; +// +// /** +// * 其他标签(标签code) +// */ +// private List other; +// +// private String remark; +//} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/SaveExpertAdminCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/SaveExpertAdminCmd.java new file mode 100644 index 0000000..1408d93 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/SaveExpertAdminCmd.java @@ -0,0 +1,60 @@ +//package com.ningdatech.pmapi.expert.model.cmd; +// +//import com.ningdatech.emapi.expert.entity.dto.ExpertAdminRegionDTO; +//import lombok.Data; +// +//import java.util.List; +// +///** +// * @author liuxinxin +// * @date 2022/8/1 上午10:54 +// */ +//@Data +//public class SaveExpertAdminCmd { +// +// /** +// * 用户id +// */ +// private Long userId; +// +// /** +// * 是否浙政钉用户Y/N +// */ +// private Boolean isDingUser; +// +// /** +// * 手机号 +// */ +// private String phoneNo; +// +// /** +// * 用户名称 +// */ +// private String name; +// +// /** +// * 工作单位 +// */ +// private String company; +// +// /** +// * 公司唯一标识 +// */ +// private String companyUniqCode; +// +// /** +// * 层级 +// */ +// private List regionInfoList; +// +// /** +// * 用户状态(启用/关闭) +// */ +// private Boolean isEnable; +// +// /** +// * 操作者id +// */ +// private Long operatorId; +// +//} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertFullInfoAllDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertFullInfoAllDTO.java new file mode 100644 index 0000000..c7a2d90 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertFullInfoAllDTO.java @@ -0,0 +1,39 @@ +package com.ningdatech.pmapi.expert.model.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/27 上午10:22 + * 专家全量信息表,包含履职意向,专家字典信息,专家标签信息,回避单位信息 + */ +@Data +public class ExpertFullInfoAllDTO { + + private Long userId; + + private ExpertUserFullInfoDTO expertUserInfoDTO; + + private List expertDictionaryList; + + private List expertTagList; + + /** + * 专家履职意向(区域编码) + */ + private List expertIntentionWorkRegionInfo; + + /** + * 专家申请履职意向展示列表 + */ + private List expertApplyIntentionWorkRegionInfo; + + /** + * 回避单位列表 + */ + private List expertAvoidCompanyList; + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertRecommendProofSubmitRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertRecommendProofSubmitRequest.java new file mode 100644 index 0000000..d828e3b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertRecommendProofSubmitRequest.java @@ -0,0 +1,31 @@ +package com.ningdatech.pmapi.expert.model.req; + +import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; +import com.ningdatech.pmapi.expert.model.FileBasicInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 下午5:49 + */ +@Data +@ApiModel("专家证明材料提交Request") +public class ExpertRecommendProofSubmitRequest { + + @NotEmpty + @ApiModelProperty("推荐方式") + private List recommendedWay; + + @ApiModelProperty("推荐证明材料") + private List recommendProofFile; + + @NotBlank + @ApiModelProperty("短信验证码") + private String verificationCode; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertFullInfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertFullInfoVO.java new file mode 100644 index 0000000..c3047bd --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertFullInfoVO.java @@ -0,0 +1,45 @@ +package com.ningdatech.pmapi.expert.model.vo; + +import com.ningdatech.pmapi.expert.model.*; +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/25 下午1:43 + */ +@Data +@ApiModel("专家全量信息") +public class ExpertFullInfoVO { + + @ApiModelProperty("专家用户id") + private Long userId; + + @ApiModelProperty("基本信息") + private ExpertBasicInfo basicInfo; + + @ApiModelProperty("学历信息") + private ExpertEduInfo eduInfo; + + @ApiModelProperty("职业信息") + private ExpertJobInfo jobInfo; + + @ApiModelProperty("专业信息") + private ExpertProfessionalInfo professionalInfo; + + @ApiModelProperty("推荐信息") + private ExpertRecommendInfo recommendInfo; + + @ApiModelProperty("其他信息") + private ExpertOtherInfo expertOtherInfo; + + @NotEmpty + @ApiModelProperty("专家申请履职意向展示列表") + private List expertApplyIntentionWorkRegions; + +} 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 fba707d..e418920 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 @@ -1,6 +1,8 @@ package com.ningdatech.pmapi.expert.service; import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; +import com.ningdatech.pmapi.expert.model.cmd.ExpertRecommendProofSaveCmd; +import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO; /** * @author liuxinxin @@ -11,4 +13,18 @@ public interface ExpertInfoService { void saveExpertInfo(ExpertFullInfoSaveCmd cmd); + /** + * 专家报名提交 推荐证明材料 + * + * @param expertRecommendProofSaveCmd + */ + void expertRecommendProofSave(ExpertRecommendProofSaveCmd expertRecommendProofSaveCmd); + + /** + * 根据user_id 获取用户全量信息 + * + * @param userId + * @return + */ + ExpertFullInfoAllDTO getExpertUserFullInfoAll(Long userId); } 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 8da61e5..a738451 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,14 +4,18 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; +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.ExpertAvoidCompany; +import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; +import com.ningdatech.pmapi.expert.model.cmd.ExpertRecommendProofSaveCmd; import com.ningdatech.pmapi.expert.model.dto.*; import com.ningdatech.pmapi.expert.service.ExpertInfoService; import com.ningdatech.pmapi.expert.service.IExpertAvoidCompanyService; +import com.ningdatech.pmapi.expert.service.IExpertIntentionWorkRegionService; import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; import com.ningdatech.pmapi.meta.model.entity.ExpertTag; @@ -44,6 +48,8 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { private final IExpertAvoidCompanyService iExpertAvoidCompanyService; + private final IExpertIntentionWorkRegionService iExpertIntentionWorkRegionService; + /** * 用户第一次申请修改,仅在专家用户状态为applying 状态时调用 @@ -216,4 +222,70 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { }).collect(Collectors.toList()); } + @Override + @Transactional(rollbackFor = Exception.class) + public void expertRecommendProofSave(ExpertRecommendProofSaveCmd cmd) { + // 保存专家证明材料 + Long userId = cmd.getUserId(); + ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); + expertUserFullInfo.setRecommendationProofFileIdList(JSONObject.toJSONString(cmd.getRecommendationProofFileIdList())); + expertUserFullInfo.setUpdateOn(LocalDateTime.now()); + expertUserFullInfo.setUserInfoStep(ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey()); + iExpertUserFullInfoService.saveOrUpdate(expertUserFullInfo); + + List recommendedWayList = cmd.getRecommendedWay(); + if (CollectionUtils.isNotEmpty(recommendedWayList)) { + List saveExpertDictionaryList = recommendedWayList.stream().map(r -> { + ExpertDictionary expertDictionary = new ExpertDictionary(); + expertDictionary.setUserId(userId); + expertDictionary.setExpertInfoField(r.getExpertInfoField()); + expertDictionary.setDictionaryCode(r.getDictionaryCode()); + expertDictionary.setUpdateOn(LocalDateTime.now()); + expertDictionary.setCreateOn(LocalDateTime.now()); + return expertDictionary; + }).collect(Collectors.toList()); + iExpertDictionaryService.saveBatch(saveExpertDictionaryList); + } + +// // 创建入库申请 +// ExpertMetaApply expertRegionApply = new ExpertMetaApply(); +// expertRegionApply.setApplyType(ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()); +// expertRegionApply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); +// expertRegionApply.setRegionCode(expertUserFullInfo.getRegionCode()); +// expertRegionApply.setRegionLevel(expertUserFullInfo.getRegionLevel()); +// expertRegionApply.setUserId(userId); +// expertRegionApply.setDisplayEnable(BoolDisplayEnum.Y.name()); +// iExpertMetaApplyService.save(expertRegionApply); + } + + @Override + public ExpertFullInfoAllDTO getExpertUserFullInfoAll(Long userId) { + ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); + if (Objects.isNull(expertUserFullInfo)) { + return null; + } + // 所有专家标签字段 + List expertTagList = iExpertTagService + .list(Wrappers.lambdaQuery(ExpertTag.class).eq(ExpertTag::getUserId, userId)); + // 所有专家字典字段 + List expertDictionaryList = iExpertDictionaryService + .list(Wrappers.lambdaQuery(ExpertDictionary.class).eq(ExpertDictionary::getUserId, userId)); + // 专家履职意向列表 + List expertIntentionWorkRegionList = iExpertIntentionWorkRegionService + .list(Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class).eq(ExpertIntentionWorkRegion::getUserId, userId)); +// // 专家履职意向申请列表 +// List expertMetaApplyList = iExpertMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class) +// .eq(ExpertMetaApply::getUserId, userId) +// .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) +// .in(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), ExpertApplyTypeEnum.EXPERT_INTENTION_LEAVE.getKey())); + // 所有专家回避单位 + List expertAvoidCompanyList = iExpertAvoidCompanyService + .list(Wrappers.lambdaQuery(ExpertAvoidCompany.class).eq(ExpertAvoidCompany::getUserId, userId)); + +// return ExpertUserInfoAssembler.buildExpertFullInfoAllDTO(expertUserFullInfo, expertTagList, expertDictionaryList +// , expertIntentionWorkRegionList, expertMetaApplyList, expertAvoidCompanyList); + return ExpertUserInfoAssembler.buildExpertFullInfoAllDTO(expertUserFullInfo, expertTagList, expertDictionaryList + , expertIntentionWorkRegionList, expertAvoidCompanyList); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java index b7cdf5b..54f3295 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java @@ -2,13 +2,10 @@ package com.ningdatech.pmapi.projectlib.controller; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; - -import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -import com.ningdatech.pmapi.todocenter.model.dto.req.ToBeProcessedExportReq; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index e82bac4..012a12c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -23,13 +23,15 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.todocenter.enumeration.IsAppendProjectEnum; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletResponse; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.Optional; /** *

@@ -80,7 +82,6 @@ public class ProjectLibManage { } /** - * * @param projectId 项目详情 * @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO * @author ZPF @@ -89,7 +90,7 @@ public class ProjectLibManage { public ProjectDetailVO getProjectDetail(Long projectId) { // 查询项目申报信息 Project projectInfo = projectService.getById(projectId); - if(Objects.isNull(projectInfo)){ + if (Objects.isNull(projectInfo)) { return null; } ProjectDetailVO vo = new ProjectDetailVO(); @@ -101,28 +102,28 @@ public class ProjectLibManage { Optional.ofNullable(applications).ifPresent(apps -> vo.setProjectApplications(CollUtils.convert(apps, ProjectHelper::convertVO) - )); + )); //查询年度投资金额 要是已验收的项目 - if(ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())){ + if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) { List annualAmounts = Lists.newArrayList(); annualAmounts.add(AnnualAmountVO.builder() - .projectId(projectInfo.getId()) - .projectYear(projectInfo.getProjectYear()) - .annualAmount(projectInfo.getAnnualPlanAmount()) - .build()); + .projectId(projectInfo.getId()) + .projectYear(projectInfo.getProjectYear()) + .annualAmount(projectInfo.getAnnualPlanAmount()) + .build()); List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> - declarations.forEach(declaration -> { - annualAmounts.add(AnnualAmountVO.builder() - .projectId(projectInfo.getId()) - .projectYear(declaration.getProjectYear()) - .annualAmount(declaration.getAnnualPaymentAmount()) - .build()); - }) - ); + declarations.forEach(declaration -> { + annualAmounts.add(AnnualAmountVO.builder() + .projectId(projectInfo.getId()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .build()); + }) + ); vo.setAnnualAccumulateAmountList(annualAmounts); } return vo; @@ -134,7 +135,6 @@ public class ProjectLibManage { } public void exportList(ProjectListReq param, HttpServletResponse response) { - param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); LambdaQueryWrapper query = ProjectHelper.projectQuery(param);