@@ -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<T> implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
private int currentPageNumber; | |||||
private Long itemsTotal; | |||||
private List<T> items; | |||||
} |
@@ -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<DictionaryFieldInfo> toDictionaryFieldInfoList(List<ExpertDictionary> 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()); | |||||
} | |||||
} |
@@ -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<ExpertAdminExpertManageListVO> toExpertAdminExpertManageListVOList( | |||||
List<ExpertAdminExpertManageListDTO> 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<DictionaryFieldInfo> expertType = r.getExpertType(); | |||||
if (CollectionUtils.isNotEmpty(expertType)) { | |||||
expertType = assembleDictionaryName(expertType); | |||||
expertAdminExpertManageListVO.setExpertType(expertType); | |||||
} | |||||
List<DictionaryFieldInfo> companyAttribute = r.getCompanyAttribute(); | |||||
if (CollectionUtils.isNotEmpty(companyAttribute)) { | |||||
companyAttribute = assembleDictionaryName(companyAttribute); | |||||
expertAdminExpertManageListVO.setCompanyAttribute(companyAttribute); | |||||
} | |||||
List<DictionaryFieldInfo> titleLevel = r.getTitleLevel(); | |||||
if (CollectionUtils.isNotEmpty(titleLevel)) { | |||||
titleLevel = assembleDictionaryName(titleLevel); | |||||
expertAdminExpertManageListVO.setTitleLevel(titleLevel); | |||||
} | |||||
List<TagFieldInfo> expertSource = r.getExpertSource(); | |||||
if (CollectionUtils.isNotEmpty(expertSource)) { | |||||
expertSource = assembleTagName(expertSource); | |||||
expertAdminExpertManageListVO.setExpertSource(expertSource); | |||||
} | |||||
return expertAdminExpertManageListVO; | |||||
}).collect(Collectors.toList()); | |||||
} | |||||
public List<DictionaryFieldInfo> assembleDictionaryName(List<DictionaryFieldInfo> 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<TagFieldInfo> assembleTagName(List<TagFieldInfo> collect) { | |||||
return collect.stream().peek(r -> { | |||||
TagDTO tagDTO = tagCache.getByTagCode(r.getTagCode()); | |||||
if (Objects.nonNull(tagDTO)) { | |||||
r.setTagName(tagDTO.getTagName()); | |||||
} | |||||
}).collect(Collectors.toList()); | |||||
} | |||||
} |
@@ -404,56 +404,56 @@ public class ExpertUserInfoAssembler { | |||||
return expertUserFullInfoDTO; | return expertUserFullInfoDTO; | ||||
} | } | ||||
// public static ExpertAdminExpertManageListDTO buildExpertAdminExpertManageListDTO(ExpertUserFullInfo expertUserFullInfo | |||||
// , Map<Long, List<ExpertDictionary>> expertDictionaryMap, Map<Long, List<ExpertTag>> 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<ExpertDictionary> userExpertDictionaryList = Objects.isNull(expertDictionaryMap.get(userId)) ? new ArrayList<>() : expertDictionaryMap.get(userId); | |||||
// Map<String, List<ExpertDictionary>> 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<ExpertTag> expertTagList = Objects.isNull(expertTagMap.get(userId)) ? new ArrayList<>() : expertTagMap.get(userId); | |||||
// Map<String, List<ExpertTag>> 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<Long, List<ExpertDictionary>> expertDictionaryMap, Map<Long, List<ExpertTag>> 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<ExpertDictionary> userExpertDictionaryList = Objects.isNull(expertDictionaryMap.get(userId)) ? new ArrayList<>() : expertDictionaryMap.get(userId); | |||||
Map<String, List<ExpertDictionary>> 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<ExpertTag> expertTagList = Objects.isNull(expertTagMap.get(userId)) ? new ArrayList<>() : expertTagMap.get(userId); | |||||
Map<String, List<ExpertTag>> 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; | |||||
} | |||||
} | } |
@@ -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<TagFieldInfo> toTagFieldInfoList(List<ExpertTag> 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()); | |||||
} | |||||
} |
@@ -7,6 +7,8 @@ import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; | import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; | ||||
import com.ningdatech.pmapi.common.helper.RegionLimitHelper; | 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.assembler.ExpertInfoCmdAssembler; | ||||
import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; | import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; | ||||
import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum; | 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.bo.ExpertInfoSensitiveFieldCheckBO; | ||||
import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd; | import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd; | ||||
import com.ningdatech.pmapi.expert.model.cmd.ExpertInfoModifyCmd; | 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.ExpertDictionaryQuery; | ||||
import com.ningdatech.pmapi.expert.model.query.ExpertTagQuery; | import com.ningdatech.pmapi.expert.model.query.ExpertTagQuery; | ||||
import com.ningdatech.pmapi.expert.model.req.AdminExpertBasicInfoModifyRequest; | import com.ningdatech.pmapi.expert.model.req.AdminExpertBasicInfoModifyRequest; | ||||
import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest; | import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest; | ||||
import com.ningdatech.pmapi.expert.model.vo.ExpertAdminExpertManageListVO; | import com.ningdatech.pmapi.expert.model.vo.ExpertAdminExpertManageListVO; | ||||
import com.ningdatech.pmapi.expert.model.vo.ExpertBasicInfoModifyResultVO; | 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.ExpertInfoService; | ||||
import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService; | import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService; | ||||
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; | import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; | ||||
@@ -54,6 +58,8 @@ public class ExpertAdminManage { | |||||
private final ExpertInfoSensitiveFieldModifyCheckHelper expertInfoSensitiveFieldModifyCheckHelper; | private final ExpertInfoSensitiveFieldModifyCheckHelper expertInfoSensitiveFieldModifyCheckHelper; | ||||
private final ExpertInfoService expertInfoService; | private final ExpertInfoService expertInfoService; | ||||
private final ExpertMetaApplyManage expertMetaApplyManage; | private final ExpertMetaApplyManage expertMetaApplyManage; | ||||
private final ExpertAdminManageService expertAdminManageService; | |||||
private final ExpertAdminExpertManageAssembler expertAdminExpertManageAssembler; | |||||
/** | /** | ||||
* 专家管理员使用 专家库列表查询 | * 专家管理员使用 专家库列表查询 | ||||
@@ -64,14 +70,13 @@ public class ExpertAdminManage { | |||||
public PageVo<ExpertAdminExpertManageListVO> getExpertLibraryList(ExpertAdminExpertManageQuery query) { | public PageVo<ExpertAdminExpertManageListVO> getExpertLibraryList(ExpertAdminExpertManageQuery query) { | ||||
Long userId = LoginUserUtil.getUserId(); | Long userId = LoginUserUtil.getUserId(); | ||||
ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd = buildExpertAdminExpertManageQueryCmd(query, userId); | ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd = buildExpertAdminExpertManageQueryCmd(query, userId); | ||||
// CommonPage<ExpertAdminExpertManageListDTO> pageResult = | |||||
// expertAdminManageService.getExpertLibraryList(expertAdminExpertManageQueryCmd); | |||||
// | |||||
// PageVo<ExpertAdminExpertManageListVO> pageVo = new PageVo<>(); | |||||
// pageVo.setTotal(pageResult.getItemsTotal()); | |||||
// pageVo.setRecords(expertAdminExpertManageAssembler.toExpertAdminExpertManageListVOList(pageResult.getItems())); | |||||
// return pageVo; | |||||
return null; | |||||
CommonPage<ExpertAdminExpertManageListDTO> pageResult = | |||||
expertAdminManageService.getExpertLibraryList(expertAdminExpertManageQueryCmd); | |||||
PageVo<ExpertAdminExpertManageListVO> pageVo = new PageVo<>(); | |||||
pageVo.setTotal(pageResult.getItemsTotal()); | |||||
pageVo.setRecords(expertAdminExpertManageAssembler.toExpertAdminExpertManageListVOList(pageResult.getItems())); | |||||
return pageVo; | |||||
} | } | ||||
@@ -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<Long> listExpertUserId(@Param("query") ListExpertQuery query); | |||||
} |
@@ -0,0 +1,117 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.ningdatech.pmapi.expert.mapper.ExpertAdminManageMapper"> | |||||
<sql id="Expert_Full_Info_Region"> | |||||
SELECT user_id FROM nd_expert_user_full_info | |||||
<where> | |||||
<if test="query.expertName != null and query.expertName !='' "> | |||||
AND expert_name LIKE CONCAT('%',#{query.expertName, jdbcType=BIGINT},'%') | |||||
</if> | |||||
<if test="query.company != null and query.company !='' "> | |||||
AND company LIKE CONCAT('%',#{query.company, jdbcType=BIGINT},'%') | |||||
</if> | |||||
<if test="query.expertAccountStatusList != null and query.expertAccountStatusList.size >0 "> | |||||
AND expert_account_status IN | |||||
<foreach collection="query.expertAccountStatusList" item="expertAccountStatus" index="index" open="(" | |||||
close=")" | |||||
separator=","> | |||||
#{expertAccountStatus} | |||||
</foreach> | |||||
</if> | |||||
<if test="query.regionCode != null and query.regionCode != '' and query.regionLevel != null and query.regionLevel != '' "> | |||||
AND region_code = #{query.regionCode} AND region_level = #{query.regionLevel} | |||||
</if> | |||||
<if test="query.isDingUser != null and query.isDingUser == true "> | |||||
AND is_ding_user = 'Y' | |||||
</if> | |||||
<if test="query.isDingUser != null and query.isDingUser == false "> | |||||
AND is_ding_user = 'N' | |||||
</if> | |||||
<if test="query.regionContainsList != null and query.regionContainsList.size >0 "> | |||||
AND ( | |||||
<foreach collection="query.regionContainsList" item="regionContains" index="index" separator="OR"> | |||||
(<![CDATA[ region_level>= #{regionContains.parentRegionTreeLevel} AND region_code IN ]]> | |||||
<foreach collection="regionContains.containsRegionCodeList" item="containsRegionCode" index="index" | |||||
open="(" | |||||
close=")" | |||||
separator=",">#{containsRegionCode} | |||||
</foreach> | |||||
) | |||||
</foreach> | |||||
) | |||||
</if> | |||||
</where> | |||||
-- ORDER BY create_on DESC | |||||
</sql> | |||||
<sql id="Expert_Tag_Relation"> | |||||
SELECT | |||||
user_id | |||||
FROM | |||||
( | |||||
SELECT DISTINCT | |||||
et.user_id, | |||||
et.expert_info_field | |||||
FROM | |||||
expert_tag et | |||||
WHERE | |||||
<foreach collection="query.expertTagQueryList" item="expertTagQuery" index="index" separator="OR"> | |||||
(et.expert_info_field = #{expertTagQuery.expertInfoField} | |||||
AND et.tag_code IN | |||||
<foreach collection="expertTagQuery.tagCodeList" item="tagCode" index="index" open="(" close=")" | |||||
separator=","> | |||||
#{tagCode} | |||||
</foreach>) | |||||
</foreach> | |||||
) temp | |||||
GROUP BY | |||||
user_id | |||||
HAVING | |||||
count( user_id )= ${query.expertTagQueryList.size()} | |||||
</sql> | |||||
<sql id="Expert_Dictionary_Relation"> | |||||
SELECT | |||||
user_id | |||||
FROM | |||||
( | |||||
SELECT DISTINCT | |||||
ed.user_id, | |||||
ed.expert_info_field | |||||
FROM | |||||
expert_dictionary ed | |||||
WHERE | |||||
<foreach collection="query.expertDictionaryQueryList" item="expertDictionaryQuery" index="index" separator="OR"> | |||||
(ed.expert_info_field = #{expertDictionaryQuery.expertInfoField} | |||||
AND ed.dictionary_code IN | |||||
<foreach collection="expertDictionaryQuery.dictionaryCodeList" item="dictionaryCode" index="index" open="(" | |||||
close=")" | |||||
separator=","> | |||||
#{dictionaryCode} | |||||
</foreach>) | |||||
</foreach> | |||||
) temp | |||||
GROUP BY | |||||
user_id | |||||
HAVING | |||||
count( user_id )= ${query.expertDictionaryQueryList.size()} | |||||
</sql> | |||||
<select id="listExpertUserId" resultType="java.lang.Long" | |||||
parameterType="com.ningdatech.pmapi.expert.model.query.ListExpertQuery"> | |||||
<include refid="Expert_Full_Info_Region"/> | |||||
<if test="query.expertTagQueryList != null and query.expertTagQueryList.size >0 "> | |||||
INTERSECT | |||||
<include refid="Expert_Tag_Relation"/> | |||||
</if> | |||||
<if test="query.expertDictionaryQueryList != null and query.expertDictionaryQueryList.size >0 "> | |||||
INTERSECT | |||||
<include refid="Expert_Dictionary_Relation"/> | |||||
</if> | |||||
</select> | |||||
</mapper> |
@@ -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<DictionaryFieldInfo> companyAttribute; | |||||
/** | |||||
* 专家联系方式 | |||||
*/ | |||||
private String phoneNo; | |||||
/** | |||||
* 性别 | |||||
*/ | |||||
private String gender; | |||||
/** | |||||
* 出生日期 | |||||
*/ | |||||
private LocalDateTime birth; | |||||
/** | |||||
* 籍贯 | |||||
*/ | |||||
private String hometown; | |||||
/** | |||||
* 民族 | |||||
*/ | |||||
private String nationality; | |||||
/** | |||||
* 政治面貌(字典code) | |||||
*/ | |||||
private List<DictionaryFieldInfo> political; | |||||
/** | |||||
* 身份证号码 | |||||
*/ | |||||
private String idCard; | |||||
/** | |||||
* 专家层级 | |||||
*/ | |||||
private ExpertRegionInfo expertRegionInfo; | |||||
/** | |||||
* 银行卡号 | |||||
*/ | |||||
private String bankNo; | |||||
/** | |||||
* 开户银行 | |||||
*/ | |||||
private String bank; | |||||
/** | |||||
* 学历(字典code) | |||||
*/ | |||||
private List<DictionaryFieldInfo> edu; | |||||
/** | |||||
* 学位(字典code) | |||||
*/ | |||||
private List<DictionaryFieldInfo> degree; | |||||
/** | |||||
* 职称级别 | |||||
*/ | |||||
private List<DictionaryFieldInfo> titleLevel; | |||||
/** | |||||
* 推荐方式 | |||||
*/ | |||||
private List<DictionaryFieldInfo> recommendedWay; | |||||
/** | |||||
* 单位法人编号 | |||||
*/ | |||||
private String legalEntityCode; | |||||
/** | |||||
* 专家类型(内外围) | |||||
*/ | |||||
private List<DictionaryFieldInfo> expertType; | |||||
/** | |||||
* 是否浙政钉用户 | |||||
*/ | |||||
private Boolean isDingUser; | |||||
/** | |||||
* 账号状态 | |||||
*/ | |||||
private String expertAccountStatus; | |||||
/** | |||||
* 专家来源 | |||||
*/ | |||||
private List<TagFieldInfo> expertSource; | |||||
} |
@@ -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<ExpertAdminExpertManageListDTO> getExpertLibraryList(ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd); | |||||
} |
@@ -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<ExpertAdminExpertManageListDTO> getExpertLibraryList(ExpertAdminExpertManageQueryCmd req) { | |||||
ListExpertQuery listExpertQuery = buildListExpertQuery(req); | |||||
List<Long> userIdList = expertAdminManageMapper.listExpertUserId(listExpertQuery); | |||||
List<ExpertUserFullInfo> evidenceHasBeenSubmittedExpertInfoList = iExpertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) | |||||
.eq(ExpertUserFullInfo::getUserInfoStep, ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey())); | |||||
List<Long> evidenceHasBeenSubmittedExpertUserIdList = evidenceHasBeenSubmittedExpertInfoList | |||||
.stream().map(ExpertUserFullInfo::getUserId) | |||||
.distinct().collect(Collectors.toList()); | |||||
Iterator<Long> iterator = userIdList.iterator(); | |||||
while (iterator.hasNext()) { | |||||
if (!evidenceHasBeenSubmittedExpertUserIdList.contains(iterator.next())) { | |||||
userIdList.remove(iterator.next()); | |||||
} | |||||
} | |||||
CommonPage<ExpertAdminExpertManageListDTO> commonPage = new CommonPage<>(); | |||||
commonPage.setCurrentPageNumber(req.getPageNumber()); | |||||
commonPage.setItemsTotal((long) userIdList.size()); | |||||
List<ExpertAdminExpertManageListDTO> recordList = new ArrayList<>(); | |||||
if (userIdList.size() != 0) { | |||||
List<Long> currPageUserIdList = CollUtil.page(req.getPageNumber() - 1, req.getPageSize(), userIdList); | |||||
List<ExpertUserFullInfo> expertUserList = iExpertUserFullInfoService.listByUserIds(currPageUserIdList); | |||||
// 获取专家字典数据 | |||||
LambdaQueryWrapper<ExpertDictionary> in = Wrappers.lambdaQuery(ExpertDictionary.class) | |||||
.in(ExpertDictionary::getUserId, userIdList); | |||||
List<ExpertDictionary> expertDictionaryList = iExpertDictionaryService.list(in); | |||||
Map<Long, List<ExpertDictionary>> expertDictMap = CollUtils.group(expertDictionaryList, ExpertDictionary::getUserId); | |||||
// 获取专家标签数据 | |||||
LambdaQueryWrapper<ExpertTag> tagIn = Wrappers.lambdaQuery(ExpertTag.class) | |||||
.in(ExpertTag::getUserId, userIdList); | |||||
List<ExpertTag> expertTagList = iExpertTagService.list(tagIn); | |||||
Map<Long, List<ExpertTag>> 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; | |||||
} | |||||
} |