@@ -20,7 +20,7 @@ package com.ningdatech.pmapi.expert.assembler; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.ningdatech.file.entity.vo.result.AttachFileVo; | |||
import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; | |||
import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; | |||
import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum; | |||
import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; | |||
import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; | |||
@@ -0,0 +1,39 @@ | |||
package com.ningdatech.pmapi.expert.assembler; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |||
import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; | |||
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; | |||
import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; | |||
import java.util.List; | |||
/** | |||
* @author liuxinxin | |||
* @date 2022/8/10 下午5:36 | |||
*/ | |||
public class RegionWrapperAssembler { | |||
public static void expertUserFullInfoRegionContainsWrapperAssembler(LambdaQueryWrapper<ExpertUserFullInfo> wrapperQuery, List<RegionContainsBO> containsRegionList) { | |||
for (RegionContainsBO regionContainsBO : containsRegionList) { | |||
List<String> containsRegionCodeList = regionContainsBO.getContainsRegionCodeList(); | |||
Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel(); | |||
if (CollectionUtils.isNotEmpty(containsRegionCodeList)) { | |||
wrapperQuery.and(wrapper -> wrapper.in(ExpertUserFullInfo::getRegionCode, containsRegionCodeList) | |||
.ge(ExpertUserFullInfo::getRegionLevel, parentRegionTreeLevel)); | |||
} | |||
} | |||
} | |||
public static void expertMetaApplyRegionContainsWrapperAssembler(LambdaQueryWrapper<ExpertMetaApply> wrapperQuery, List<RegionContainsBO> containsRegionList) { | |||
for (RegionContainsBO regionContainsBO : containsRegionList) { | |||
List<String> containsRegionCodeList = regionContainsBO.getContainsRegionCodeList(); | |||
Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel(); | |||
if (CollectionUtils.isNotEmpty(containsRegionCodeList)) { | |||
wrapperQuery.and(wrapper -> wrapper.in(ExpertMetaApply::getRegionCode, containsRegionCodeList) | |||
.ge(ExpertMetaApply::getRegionLevel, parentRegionTreeLevel)); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.ningdatech.pmapi.expert.constant; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Getter; | |||
import org.apache.commons.lang3.StringUtils; | |||
/** | |||
* @author liuxinxin | |||
* @date 2022/8/4 上午11:14 | |||
*/ | |||
@AllArgsConstructor | |||
@Getter | |||
public enum QueryExpertAccountStatusEnum { | |||
/** | |||
* 冻结中 | |||
*/ | |||
FREEZING("freezing"), | |||
/** | |||
* 正常 | |||
*/ | |||
NORMAL("normal"); | |||
private final String key; | |||
public static boolean contains(String key) { | |||
if (StringUtils.isBlank(key)) { | |||
return false; | |||
} | |||
for (QueryExpertAccountStatusEnum statusEnum : QueryExpertAccountStatusEnum.values()) { | |||
if (statusEnum.key.equals(key)) { | |||
return true; | |||
} | |||
} | |||
return false; | |||
} | |||
public static QueryExpertAccountStatusEnum of(String key) { | |||
for (QueryExpertAccountStatusEnum statusEnum : QueryExpertAccountStatusEnum.values()) { | |||
if (statusEnum.key.equals(key)) { | |||
return statusEnum; | |||
} | |||
} | |||
throw new IllegalArgumentException(String.format("Illegal QueryExpertAccountStatusEnum = %s", key)); | |||
} | |||
} |
@@ -1,9 +1,13 @@ | |||
package com.ningdatech.pmapi.expert.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.pmapi.expert.manage.ExpertAdminManage; | |||
import com.ningdatech.pmapi.expert.manage.ExpertManage; | |||
import com.ningdatech.pmapi.expert.model.ExpertAdminExpertManageQuery; | |||
import com.ningdatech.pmapi.expert.model.req.ExpertRecommendProofSubmitRequest; | |||
import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest; | |||
import com.ningdatech.pmapi.expert.model.vo.ExpertAdminExpertManageListVO; | |||
import com.ningdatech.pmapi.expert.model.vo.ExpertFullInfoVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
@@ -27,6 +31,7 @@ import javax.validation.Valid; | |||
public class ExpertController { | |||
private final ExpertManage expertManage; | |||
private final ExpertAdminManage expertAdminManage; | |||
@PostMapping("/basic-info-submit") | |||
@ApiOperation("填写基本信息接口(专家报名使用))") | |||
@@ -47,5 +52,11 @@ public class ExpertController { | |||
return expertManage.getExpertFullInfoDetail(null); | |||
} | |||
@PostMapping("/expert-library/list") | |||
@ApiOperation("专家库列表查询接口") | |||
public PageVo<ExpertAdminExpertManageListVO> getExpertLibraryList( | |||
@RequestBody @Valid ExpertAdminExpertManageQuery expertAdminExpertManageQuery) { | |||
return expertAdminManage.getExpertLibraryList(expertAdminExpertManageQuery); | |||
} | |||
} |
@@ -0,0 +1,142 @@ | |||
package com.ningdatech.pmapi.expert.manage; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.pmapi.common.helper.RegionLimitHelper; | |||
import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; | |||
import com.ningdatech.pmapi.expert.constant.QueryExpertAccountStatusEnum; | |||
import com.ningdatech.pmapi.expert.helper.PermissionCheckHelper; | |||
import com.ningdatech.pmapi.expert.model.ExpertAdminExpertManageQuery; | |||
import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd; | |||
import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery; | |||
import com.ningdatech.pmapi.expert.model.query.ExpertTagQuery; | |||
import com.ningdatech.pmapi.expert.model.vo.ExpertAdminExpertManageListVO; | |||
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; | |||
import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; | |||
import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import lombok.RequiredArgsConstructor; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.stereotype.Component; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Objects; | |||
/** | |||
* @author liuxinxin | |||
* @date 2023/3/1 下午2:12 | |||
*/ | |||
@Component | |||
@RequiredArgsConstructor | |||
public class ExpertAdminManage { | |||
private final PermissionCheckHelper permissionCheckHelper; | |||
private final RegionLimitHelper regionLimitHelper; | |||
/** | |||
* 专家管理员使用 专家库列表查询 | |||
* | |||
* @param query | |||
* @return | |||
*/ | |||
public PageVo<ExpertAdminExpertManageListVO> getExpertLibraryList(ExpertAdminExpertManageQuery query) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
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; | |||
} | |||
private ExpertAdminExpertManageQueryCmd buildExpertAdminExpertManageQueryCmd(ExpertAdminExpertManageQuery query, Long userId) { | |||
ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd = new ExpertAdminExpertManageQueryCmd(); | |||
expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); | |||
expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); | |||
if (StringUtils.isNotBlank(query.getExpertName())) { | |||
expertAdminExpertManageQueryCmd.setExpertName(query.getExpertName()); | |||
} | |||
if (StringUtils.isNotBlank(query.getCompany())) { | |||
expertAdminExpertManageQueryCmd.setCompany(query.getCompany()); | |||
} | |||
List<ExpertDictionaryQuery> expertDictionaryQueryList = new ArrayList<>(); | |||
if (StringUtils.isNotBlank(query.getTitleLevelDictionaryCode())) { | |||
ExpertDictionaryQuery expertDictionaryQuery = new ExpertDictionaryQuery(); | |||
expertDictionaryQuery.setExpertInfoField(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()); | |||
expertDictionaryQuery.setDictionaryCodeList(CollectionUtil.toList(query.getTitleLevelDictionaryCode())); | |||
expertDictionaryQueryList.add(expertDictionaryQuery); | |||
} | |||
if (StringUtils.isNotBlank(query.getCompanyAttributeDictionaryCode())) { | |||
ExpertDictionaryQuery expertDictionaryQuery = new ExpertDictionaryQuery(); | |||
expertDictionaryQuery.setExpertInfoField(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey()); | |||
expertDictionaryQuery.setDictionaryCodeList(CollectionUtil.toList(query.getCompanyAttributeDictionaryCode())); | |||
expertDictionaryQueryList.add(expertDictionaryQuery); | |||
} | |||
if (StringUtils.isNotBlank(query.getExpertTypeDictionaryCode())) { | |||
ExpertDictionaryQuery expertDictionaryQuery = new ExpertDictionaryQuery(); | |||
expertDictionaryQuery.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey()); | |||
expertDictionaryQuery.setDictionaryCodeList(CollectionUtil.toList(query.getExpertTypeDictionaryCode())); | |||
expertDictionaryQueryList.add(expertDictionaryQuery); | |||
} | |||
List<ExpertTagQuery> expertTagQueryList = new ArrayList<>(); | |||
if (StringUtils.isNotBlank(query.getExpertSourceTagCode())) { | |||
ExpertTagQuery expertTagQuery = new ExpertTagQuery(); | |||
expertTagQuery.setExpertInfoField(ExpertTagEnum.EXPERT_SOURCE.getKey()); | |||
expertTagQuery.setTagCodeList(CollectionUtil.toList(query.getExpertSourceTagCode())); | |||
expertTagQueryList.add(expertTagQuery); | |||
} | |||
if (StringUtils.isNotBlank(query.getGoodAtTagCode())) { | |||
ExpertTagQuery expertTagQuery = new ExpertTagQuery(); | |||
expertTagQuery.setExpertInfoField(ExpertTagEnum.GOOD_AT.getKey()); | |||
expertTagQuery.setTagCodeList(CollectionUtil.toList(query.getGoodAtTagCode())); | |||
expertTagQueryList.add(expertTagQuery); | |||
} | |||
if (StringUtils.isNotBlank(query.getExpertAccountStatus())) { | |||
QueryExpertAccountStatusEnum queryExpertAccountStatusEnum = QueryExpertAccountStatusEnum.of(query.getExpertAccountStatus()); | |||
switch (queryExpertAccountStatusEnum) { | |||
case NORMAL: | |||
expertAdminExpertManageQueryCmd | |||
.setExpertAccountStatusList(CollectionUtil.toList(ExpertAccountStatusEnum.AVAILABLE)); | |||
break; | |||
case FREEZING: | |||
expertAdminExpertManageQueryCmd | |||
.setExpertAccountStatusList(CollectionUtil.toList(ExpertAccountStatusEnum.FREEZE)); | |||
break; | |||
default: | |||
break; | |||
} | |||
} else { | |||
expertAdminExpertManageQueryCmd | |||
.setExpertAccountStatusList(CollectionUtil.toList(ExpertAccountStatusEnum.AVAILABLE, ExpertAccountStatusEnum.FREEZE)); | |||
} | |||
List<RegionContainsBO> expertAdminContainsRegionList = new ArrayList<>(); | |||
// 如果为超级管理员,可以查看所有的专家,包括没有层级的专家 | |||
if (!permissionCheckHelper.isSuperAdmin()) { | |||
expertAdminContainsRegionList = regionLimitHelper.getExpertAdminContainsRegion(userId); | |||
} | |||
List<RegionContainsBO> containsRegion = new ArrayList<>(); | |||
if (Objects.nonNull(query.getExpertRegionInfo())) { | |||
RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegionInfo().getRegionLevel() | |||
, query.getExpertRegionInfo().getRegionCode()); | |||
containsRegion = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); | |||
} else { | |||
containsRegion = expertAdminContainsRegionList; | |||
} | |||
expertAdminExpertManageQueryCmd.setExpertDictionaryQueryList(expertDictionaryQueryList); | |||
expertAdminExpertManageQueryCmd.setExpertTagQueryList(expertTagQueryList); | |||
expertAdminExpertManageQueryCmd.setIsDingUser(query.getIsDingUser()); | |||
expertAdminExpertManageQueryCmd.setRegionContainsList(containsRegion); | |||
expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); | |||
expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); | |||
return expertAdminExpertManageQueryCmd; | |||
} | |||
} |
@@ -9,9 +9,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; | |||
import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; | |||
import com.ningdatech.pmapi.common.helper.RegionLimitHelper; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.common.util.BizUtils; | |||
import com.ningdatech.pmapi.expert.assembler.RegionWrapperAssembler; | |||
import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum; | |||
import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum; | |||
import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeQueryEnum; | |||
@@ -71,13 +73,13 @@ public class ExpertMetaApplyManage { | |||
private final UserInfoHelper userInfoHelper; | |||
private final RegionLimitHelper regionLimitHelper; | |||
public PageVo<ExpertApplyMetaVO> metaApplyListQuery(MetaApplyListQuery req) { | |||
Long expertAdminUserId = LoginUserUtil.getUserId(); | |||
// 查找符合专家条件的用户id | |||
// TODO | |||
// List<RegionContainsBO> viewRegions = regionLimitHelper.getExpertAdminContainsRegion(expertAdminUserId); | |||
List<RegionContainsBO> viewRegions = new ArrayList<>(); | |||
List<RegionContainsBO> viewRegions = regionLimitHelper.getExpertAdminContainsRegion(expertAdminUserId); | |||
ExpertAdminExpertManageQueryCmd queryCmd = buildExpertAdminExpertManageQueryCmd(req, viewRegions); | |||
// TODO | |||
// List<Long> filterExpertUserIdList = expertAdminManageService.filterExpertUserIdList(queryCmd); | |||
@@ -89,7 +91,7 @@ public class ExpertMetaApplyManage { | |||
LambdaQueryWrapper<ExpertMetaApply> expertMetaApplyListQuery = | |||
buildMetaApplyListQueryWrapper(req, filterExpertUserIdList, viewRegions); | |||
// RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions); | |||
RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions); | |||
Page<ExpertMetaApply> pageResult = iMetaApplyService.page(req.page(), expertMetaApplyListQuery); | |||
PageVo<ExpertApplyMetaVO> result = new PageVo<>(); | |||
result.setTotal(pageResult.getTotal()); | |||
@@ -380,17 +382,17 @@ public class ExpertMetaApplyManage { | |||
expertDictionaryQueryList.add(expertDictionaryQuery); | |||
} | |||
// List<RegionContainsBO> containsRegion; | |||
// if (Objects.nonNull(query.getExpertRegion())) { | |||
// RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegion().getRegionLevel() | |||
// , query.getExpertRegion().getRegionCode()); | |||
// containsRegion = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); | |||
// } else { | |||
// containsRegion = expertAdminContainsRegionList; | |||
// } | |||
List<RegionContainsBO> containsRegion; | |||
if (Objects.nonNull(query.getExpertRegion())) { | |||
RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegion().getRegionLevel() | |||
, query.getExpertRegion().getRegionCode()); | |||
containsRegion = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); | |||
} else { | |||
containsRegion = expertAdminContainsRegionList; | |||
} | |||
expertAdminExpertManageQueryCmd.setExpertDictionaryQueryList(expertDictionaryQueryList); | |||
// expertAdminExpertManageQueryCmd.setRegionContainsList(containsRegion); | |||
expertAdminExpertManageQueryCmd.setRegionContainsList(containsRegion); | |||
expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); | |||
expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); | |||
return expertAdminExpertManageQueryCmd; | |||
@@ -484,7 +486,7 @@ public class ExpertMetaApplyManage { | |||
.ne(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.REVOKED.getKey()) | |||
.orderByDesc(ExpertMetaApply::getCreateOn); | |||
// RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions); | |||
RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions); | |||
return expertMetaApplyListQuery; | |||
} | |||
@@ -0,0 +1,48 @@ | |||
package com.ningdatech.pmapi.expert.model; | |||
import com.ningdatech.basic.model.PagePo; | |||
import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
/** | |||
* @author liuxinxin | |||
* @date 2022/8/4 上午10:18 | |||
*/ | |||
@Data | |||
@ApiModel("专家库筛选接口") | |||
public class ExpertAdminExpertManageQuery extends PagePo { | |||
@ApiModelProperty("专家姓名(精准匹配)") | |||
private String expertName; | |||
@ApiModelProperty("工作单位(模糊匹配)") | |||
private String company; | |||
@ApiModelProperty("职称级别字典编码") | |||
private String titleLevelDictionaryCode; | |||
@ApiModelProperty("单位属性字典编码") | |||
private String companyAttributeDictionaryCode; | |||
@ApiModelProperty(value = "专家账号状态", allowableValues = "冻结:freezing,正常:normal") | |||
private String expertAccountStatus; | |||
@ApiModelProperty("区域信息") | |||
private ExpertRegionInfo expertRegionInfo; | |||
@ApiModelProperty(value = "是否浙政钉用户") | |||
private Boolean isDingUser; | |||
@ApiModelProperty("内外围字典编码") | |||
private String expertTypeDictionaryCode; | |||
@ApiModelProperty("专家来源标签编码") | |||
private String expertSourceTagCode; | |||
@ApiModelProperty("擅长方向标签编码") | |||
private String goodAtTagCode; | |||
} |
@@ -1,5 +1,6 @@ | |||
package com.ningdatech.pmapi.expert.model.cmd; | |||
import com.ningdatech.pmapi.common.model.CommonPageReq; | |||
import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; | |||
import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery; | |||
@@ -0,0 +1,56 @@ | |||
package com.ningdatech.pmapi.expert.model.vo; | |||
import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; | |||
import com.ningdatech.pmapi.expert.model.TagFieldInfo; | |||
import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* @author liuxinxin | |||
* @date 2022/8/4 上午11:04 | |||
*/ | |||
@Data | |||
@ApiModel("专家库列表查询返回model") | |||
public class ExpertAdminExpertManageListVO { | |||
@ApiModelProperty(value = "用户id") | |||
private Long userId; | |||
@ApiModelProperty(value = "专家姓名") | |||
private String expertName; | |||
@ApiModelProperty(value = "职称级别") | |||
private List<DictionaryFieldInfo> titleLevel; | |||
@ApiModelProperty("工作单位") | |||
private String company; | |||
@ApiModelProperty(" 单位法人编号") | |||
private String legalEntityCode; | |||
@ApiModelProperty("单位类型(字典code)") | |||
private List<DictionaryFieldInfo> companyAttribute; | |||
@ApiModelProperty(value = "手机号") | |||
private String phoneNo; | |||
@ApiModelProperty(value = "专家类型(内外围)") | |||
private List<DictionaryFieldInfo> expertType; | |||
@ApiModelProperty(value = "专家层级") | |||
private ExpertRegionInfo expertRegionInfo; | |||
@ApiModelProperty(value = "是否浙政钉用户") | |||
private Boolean isDingUser; | |||
@ApiModelProperty(value = "专家账号状态", allowableValues = "冻结:freezing,正常:normal") | |||
private String expertAccountStatus; | |||
@ApiModelProperty(value = "专家来源") | |||
private List<TagFieldInfo> expertSource; | |||
} |