@@ -56,7 +56,7 @@ public class GeneratorCodeKingbaseConfig { | |||||
} | } | ||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
generate("WendyYang", "projectlib", PATH_YYD, "nd_project_renewal_fund_declaration"); | |||||
generate("Liuxinxin", "expert", PATH_LXX, "expert_avoid_company"); | |||||
} | } | ||||
} | } |
@@ -0,0 +1,32 @@ | |||||
package com.ningdatech.pmapi.common.constant; | |||||
import lombok.AllArgsConstructor; | |||||
import lombok.Getter; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/26 上午9:21 | |||||
*/ | |||||
@AllArgsConstructor | |||||
@Getter | |||||
public enum BoolDisplayEnum { | |||||
/** | |||||
* true | |||||
*/ | |||||
Y, | |||||
/** | |||||
* false | |||||
*/ | |||||
N; | |||||
public static boolean judgeBoolean(String key) { | |||||
return Y.name().equals(key); | |||||
} | |||||
public static BoolDisplayEnum judgeBoolean(boolean key) { | |||||
return key ? Y : N; | |||||
} | |||||
} |
@@ -8,6 +8,7 @@ import org.springframework.util.NumberUtils; | |||||
import java.util.Arrays; | import java.util.Arrays; | ||||
import java.util.Collections; | import java.util.Collections; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.UUID; | |||||
import java.util.function.Consumer; | import java.util.function.Consumer; | ||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
@@ -63,4 +64,9 @@ public class BizUtils { | |||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
public static String uuid32() { | |||||
return UUID.randomUUID().toString().replace("-", ""); | |||||
} | |||||
} | } |
@@ -0,0 +1,226 @@ | |||||
package com.ningdatech.pmapi.expert.assembler; | |||||
import com.ningdatech.pmapi.expert.model.*; | |||||
import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; | |||||
import com.ningdatech.pmapi.expert.model.dto.*; | |||||
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; | |||||
import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; | |||||
import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; | |||||
import org.apache.commons.collections4.CollectionUtils; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 下午5:19 | |||||
*/ | |||||
public class ExpertInfoCmdAssembler { | |||||
public static ExpertFullInfoSaveCmd buildExpertFullInfoSaveCmd(Long userId | |||||
, ExpertBasicInfo expertBasicInfo, ExpertEduInfo expertEduInfo | |||||
, ExpertJobInfo expertJobInfo, ExpertProfessionalInfo expertProfessionalInfo) { | |||||
ExpertFullInfoSaveCmd expertFullInfoSaveCmd = new ExpertFullInfoSaveCmd(); | |||||
ExpertUserFullInfoDTO expertUserInfoDTO = buildExpertUserFullInfoDTO( | |||||
expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, null, null); | |||||
List<ExpertDictionaryDTO> expertDictionaryList = | |||||
buildExpertDictionaryList(expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, null); | |||||
List<ExpertTagDTO> expertTagList = buildExpertTagList(expertProfessionalInfo, expertBasicInfo, null); | |||||
// 专家履职意向(区域编码) | |||||
List<ExpertRegionDTO> expertIntentionWorkRegionInfo = buildExpertRegionList(expertBasicInfo); | |||||
List<ExpertAvoidCompanyDTO> expertAvoidCompanyList = buildExpertAvoidCompanyList(expertProfessionalInfo); | |||||
expertFullInfoSaveCmd.setUserId(userId); | |||||
expertFullInfoSaveCmd.setExpertUserInfoDTO(expertUserInfoDTO); | |||||
expertFullInfoSaveCmd.setExpertDictionaryList(expertDictionaryList); | |||||
expertFullInfoSaveCmd.setExpertTagList(expertTagList); | |||||
expertFullInfoSaveCmd.setExpertIntentionWorkRegionInfo(expertIntentionWorkRegionInfo); | |||||
expertFullInfoSaveCmd.setExpertAvoidCompanyList(expertAvoidCompanyList); | |||||
return expertFullInfoSaveCmd; | |||||
} | |||||
private static List<ExpertAvoidCompanyDTO> buildExpertAvoidCompanyList(ExpertProfessionalInfo professionalInfo) { | |||||
List<ExpertAvoidCompanyDTO> expertAvoidCompanyList = new ArrayList<>(); | |||||
List<ExpertAvoidCompanyInfo> avoidCompanyList = professionalInfo.getAvoidCompanyList(); | |||||
if (CollectionUtils.isNotEmpty(avoidCompanyList)) { | |||||
expertAvoidCompanyList = avoidCompanyList.stream().map(r -> { | |||||
ExpertAvoidCompanyDTO expertAvoidCompanyDTO = new ExpertAvoidCompanyDTO(); | |||||
expertAvoidCompanyDTO.setCompanyName(r.getCompanyName()); | |||||
expertAvoidCompanyDTO.setCompanyUniqCode(r.getCompanyUniqCode()); | |||||
return expertAvoidCompanyDTO; | |||||
}).collect(Collectors.toList()); | |||||
} | |||||
return expertAvoidCompanyList; | |||||
} | |||||
private static List<ExpertRegionDTO> buildExpertRegionList(ExpertBasicInfo basicInfo) { | |||||
List<ExpertRegionInfo> expertIntentionWorkRegions = basicInfo.getExpertIntentionWorkRegions(); | |||||
if (CollectionUtils.isEmpty(expertIntentionWorkRegions)) { | |||||
return new ArrayList<>(); | |||||
} | |||||
return expertIntentionWorkRegions.stream().map(r -> { | |||||
ExpertRegionDTO expertRegionDTO = new ExpertRegionDTO(); | |||||
expertRegionDTO.setRegionCode(r.getRegionCode()); | |||||
expertRegionDTO.setRegionLevel(r.getRegionLevel()); | |||||
return expertRegionDTO; | |||||
}).collect(Collectors.toList()); | |||||
} | |||||
private static List<ExpertTagDTO> buildExpertTagList(ExpertProfessionalInfo professionalInfo | |||||
, ExpertBasicInfo basicInfo, ExpertOtherInfo otherInfo) { | |||||
List<TagFieldInfo> goodAt = professionalInfo.getGoodAt(); | |||||
List<TagFieldInfo> technicalExpertise = professionalInfo.getTechnicalExpertise(); | |||||
List<TagFieldInfo> industrySector = professionalInfo.getIndustrySector(); | |||||
List<TagFieldInfo> expertSource = basicInfo.getExpertSource(); | |||||
List<TagFieldInfo> other = new ArrayList<>(); | |||||
if (Objects.nonNull(otherInfo)) { | |||||
other = otherInfo.getOther(); | |||||
} | |||||
List<TagFieldInfo> tagFieldInfoList = new ArrayList<>(); | |||||
assemblerTagExpertInfoFieldName(tagFieldInfoList, goodAt, ExpertTagEnum.GOOD_AT); | |||||
assemblerTagExpertInfoFieldName(tagFieldInfoList, technicalExpertise, ExpertTagEnum.TECHNICAL_EXPERTISE); | |||||
assemblerTagExpertInfoFieldName(tagFieldInfoList, industrySector, ExpertTagEnum.INDUSTRY_SECTOR); | |||||
assemblerTagExpertInfoFieldName(tagFieldInfoList, expertSource, ExpertTagEnum.EXPERT_SOURCE); | |||||
assemblerTagExpertInfoFieldName(tagFieldInfoList, other, ExpertTagEnum.OTHER); | |||||
return tagFieldInfoList.stream().map(r -> { | |||||
ExpertTagDTO expertTagDTO = new ExpertTagDTO(); | |||||
expertTagDTO.setTagCode(r.getTagCode()); | |||||
expertTagDTO.setExpertInfoField(r.getTagFieldName()); | |||||
return expertTagDTO; | |||||
}).collect(Collectors.toList()); | |||||
} | |||||
private static void assemblerTagExpertInfoFieldName(List<TagFieldInfo> allTagFieldInfoList | |||||
, List<TagFieldInfo> originalTagFieldInfoList, ExpertTagEnum tagExpertInfoFieldEnum) { | |||||
if (CollectionUtils.isNotEmpty(originalTagFieldInfoList)) { | |||||
originalTagFieldInfoList = originalTagFieldInfoList.stream().map(r -> { | |||||
r.setTagFieldName(tagExpertInfoFieldEnum.getKey()); | |||||
return r; | |||||
}).collect(Collectors.toList()); | |||||
allTagFieldInfoList.addAll(originalTagFieldInfoList); | |||||
} | |||||
} | |||||
private static List<ExpertDictionaryDTO> buildExpertDictionaryList(ExpertBasicInfo basicInfo, ExpertEduInfo eduInfo | |||||
, ExpertJobInfo jobInfo, ExpertProfessionalInfo professionalInfo, ExpertRecommendInfo recommendInfo) { | |||||
List<DictionaryFieldInfo> political = basicInfo.getPolitical(); | |||||
List<DictionaryFieldInfo> expertType = basicInfo.getExpertType(); | |||||
List<DictionaryFieldInfo> edu = eduInfo.getEdu(); | |||||
List<DictionaryFieldInfo> degree = eduInfo.getDegree(); | |||||
List<DictionaryFieldInfo> jobStatus = jobInfo.getJobStatus(); | |||||
List<DictionaryFieldInfo> companyAttribute = jobInfo.getCompanyAttribute(); | |||||
List<DictionaryFieldInfo> administrativeRank = jobInfo.getAdministrativeRank(); | |||||
List<DictionaryFieldInfo> titleLevel = professionalInfo.getTitleLevel(); | |||||
List<DictionaryFieldInfo> recommendedWay = new ArrayList<>(); | |||||
if (Objects.nonNull(recommendInfo)) { | |||||
recommendedWay = recommendInfo.getRecommendedWay(); | |||||
} | |||||
List<DictionaryFieldInfo> dictionaryFieldInfoList = new ArrayList<>(); | |||||
assemblerDictionaryFieldName(dictionaryFieldInfoList, political, DictExpertInfoTypeEnum.POLITICAL); | |||||
assemblerDictionaryFieldName(dictionaryFieldInfoList, expertType, DictExpertInfoTypeEnum.EXPERT_TYPE); | |||||
assemblerDictionaryFieldName(dictionaryFieldInfoList, edu, DictExpertInfoTypeEnum.EDU); | |||||
assemblerDictionaryFieldName(dictionaryFieldInfoList, degree, DictExpertInfoTypeEnum.DEGREE); | |||||
assemblerDictionaryFieldName(dictionaryFieldInfoList, jobStatus, DictExpertInfoTypeEnum.JOB_STATUS); | |||||
assemblerDictionaryFieldName(dictionaryFieldInfoList, companyAttribute, DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE); | |||||
assemblerDictionaryFieldName(dictionaryFieldInfoList, administrativeRank, DictExpertInfoTypeEnum.ADMINISTRATIVE_RANK); | |||||
assemblerDictionaryFieldName(dictionaryFieldInfoList, titleLevel, DictExpertInfoTypeEnum.TITLE_LEVEL); | |||||
assemblerDictionaryFieldName(dictionaryFieldInfoList, recommendedWay, DictExpertInfoTypeEnum.RECOMMENDED_WAY); | |||||
return dictionaryFieldInfoList.stream().map(r -> { | |||||
ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); | |||||
expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); | |||||
expertDictionaryDTO.setExpertInfoField(r.getDictionaryFieldName()); | |||||
return expertDictionaryDTO; | |||||
}).collect(Collectors.toList()); | |||||
} | |||||
private static void assemblerDictionaryFieldName( | |||||
List<DictionaryFieldInfo> allDictionaryFieldInfoList, List<DictionaryFieldInfo> originalDictionaryFieldInfoList | |||||
, DictExpertInfoTypeEnum dictExpertInfoTypeEnum) { | |||||
if (CollectionUtils.isNotEmpty(originalDictionaryFieldInfoList)) { | |||||
originalDictionaryFieldInfoList = originalDictionaryFieldInfoList.stream().map(r -> { | |||||
r.setDictionaryFieldName(dictExpertInfoTypeEnum.getKey()); | |||||
return r; | |||||
}).collect(Collectors.toList()); | |||||
allDictionaryFieldInfoList.addAll(originalDictionaryFieldInfoList); | |||||
} | |||||
} | |||||
private static ExpertUserFullInfoDTO buildExpertUserFullInfoDTO(ExpertBasicInfo basicInfo, ExpertEduInfo eduInfo | |||||
, ExpertJobInfo jobInfo, ExpertProfessionalInfo professionalInfo, ExpertRecommendInfo recommendInfo, ExpertOtherInfo otherInfo) { | |||||
ExpertUserFullInfoDTO expertUserFullInfoDTO = new ExpertUserFullInfoDTO(); | |||||
expertUserFullInfoDTO.setIsDingUser(basicInfo.getIsDingUser()); | |||||
expertUserFullInfoDTO.setPhoneNo(basicInfo.getPhoneNo()); | |||||
expertUserFullInfoDTO.setGender(basicInfo.getGender()); | |||||
expertUserFullInfoDTO.setName(basicInfo.getName()); | |||||
if (Objects.nonNull(basicInfo.getAvatarFile())) { | |||||
expertUserFullInfoDTO.setAvatarFileId(basicInfo.getAvatarFile().getFileId()); | |||||
} | |||||
expertUserFullInfoDTO.setIdCard(basicInfo.getIdCard()); | |||||
expertUserFullInfoDTO.setOfficePhone(basicInfo.getOfficePhone()); | |||||
expertUserFullInfoDTO.setBirth(basicInfo.getBirth()); | |||||
expertUserFullInfoDTO.setBankNo(basicInfo.getBankNo()); | |||||
expertUserFullInfoDTO.setBank(basicInfo.getBank()); | |||||
expertUserFullInfoDTO.setEmail(basicInfo.getEmail()); | |||||
expertUserFullInfoDTO.setHometown(basicInfo.getHometown()); | |||||
expertUserFullInfoDTO.setNationality(basicInfo.getNationality()); | |||||
if (Objects.nonNull(otherInfo)) { | |||||
expertUserFullInfoDTO.setRemark(otherInfo.getRemark()); | |||||
} | |||||
expertUserFullInfoDTO.setSchool(eduInfo.getSchool()); | |||||
expertUserFullInfoDTO.setGraduatedAt(eduInfo.getGraduatedAt()); | |||||
expertUserFullInfoDTO.setAcademicTitle(eduInfo.getAcademicTitle()); | |||||
if (CollectionUtils.isNotEmpty(eduInfo.getGraduationCertificateFile())) { | |||||
expertUserFullInfoDTO.setGraduationCertificateFileIdList(eduInfo.getGraduationCertificateFile().stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); | |||||
} | |||||
if (CollectionUtils.isNotEmpty(eduInfo.getDegreeCertificateFile())) { | |||||
expertUserFullInfoDTO.setDegreeCertificateFileIdList(eduInfo.getDegreeCertificateFile().stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); | |||||
} | |||||
expertUserFullInfoDTO.setRetiredAt(jobInfo.getRetiredAt()); | |||||
expertUserFullInfoDTO.setCompany(jobInfo.getCompany()); | |||||
expertUserFullInfoDTO.setLegalEntityCode(jobInfo.getLegalEntityCode()); | |||||
expertUserFullInfoDTO.setAdministrativeDuties(jobInfo.getAdministrativeDuties()); | |||||
expertUserFullInfoDTO.setStartWorkAt(jobInfo.getStartWorkAt()); | |||||
expertUserFullInfoDTO.setAddress(jobInfo.getAddress()); | |||||
expertUserFullInfoDTO.setExperience(jobInfo.getExperience()); | |||||
expertUserFullInfoDTO.setTechnicalTitles(professionalInfo.getTechnicalTitles()); | |||||
if (CollectionUtils.isNotEmpty(professionalInfo.getTitleCertificateFile())) { | |||||
expertUserFullInfoDTO.setTitleCertificateFileIdList(professionalInfo.getTitleCertificateFile().stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); | |||||
} | |||||
expertUserFullInfoDTO.setAwards(professionalInfo.getAwards()); | |||||
expertUserFullInfoDTO.setRecognitionReward(professionalInfo.getRecognitionReward()); | |||||
if (Objects.nonNull(basicInfo.getExpertRegionInfo())) { | |||||
expertUserFullInfoDTO.setRegionCode(basicInfo.getExpertRegionInfo().getRegionCode()); | |||||
expertUserFullInfoDTO.setRegionLevel(basicInfo.getExpertRegionInfo().getRegionLevel()); | |||||
} | |||||
// 推荐证明材料单独装配 | |||||
if (Objects.nonNull(recommendInfo)) { | |||||
List<FileBasicInfo> recommendationProofFile = recommendInfo.getRecommendationProofFile(); | |||||
if (CollectionUtils.isNotEmpty(recommendationProofFile)) { | |||||
expertUserFullInfoDTO | |||||
.setRecommendationProofFileIdList( | |||||
recommendationProofFile.stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); | |||||
} | |||||
} | |||||
return expertUserFullInfoDTO; | |||||
} | |||||
} |
@@ -0,0 +1,44 @@ | |||||
package com.ningdatech.pmapi.expert.constant; | |||||
import lombok.AllArgsConstructor; | |||||
import lombok.Getter; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 下午4:21 | |||||
*/ | |||||
@AllArgsConstructor | |||||
@Getter | |||||
public enum ExpertAccountStatusEnum { | |||||
/** | |||||
* 可用 | |||||
*/ | |||||
AVAILABLE("available"), | |||||
/** | |||||
* 冻结中 | |||||
*/ | |||||
FREEZE("freeze"), | |||||
/** | |||||
* 已出库 | |||||
*/ | |||||
DELIVERY("delivery"), | |||||
/** | |||||
* 申请中 | |||||
*/ | |||||
APPLYING("applying"); | |||||
private final String key; | |||||
public static ExpertAccountStatusEnum of(String key) { | |||||
for (ExpertAccountStatusEnum statusEnum : ExpertAccountStatusEnum.values()) { | |||||
if (statusEnum.key.equals(key)) { | |||||
return statusEnum; | |||||
} | |||||
} | |||||
throw new IllegalArgumentException(String.format("Illegal ExpertAccountStatusEnum = %s", key)); | |||||
} | |||||
} |
@@ -0,0 +1,31 @@ | |||||
package com.ningdatech.pmapi.expert.constant; | |||||
import lombok.AllArgsConstructor; | |||||
import lombok.Getter; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/26 上午9:26 | |||||
*/ | |||||
@AllArgsConstructor | |||||
@Getter | |||||
public enum ExpertUserInfoStepEnum { | |||||
/** | |||||
* 待提交信息 | |||||
*/ | |||||
INFORMATION_TO_BE_SUBMITTED("information_to_be_submitted"), | |||||
/** | |||||
* 已提交基本信息 | |||||
*/ | |||||
BASIC_INFORMATION_SUBMITTED("basic_information_submitted"), | |||||
/** | |||||
* 已提交证明材料 | |||||
*/ | |||||
EVIDENCE_HAS_BEEN_SUBMITTED("evidence_has_been_submitted"); | |||||
private final String key; | |||||
} |
@@ -0,0 +1,20 @@ | |||||
package com.ningdatech.pmapi.expert.controller; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.stereotype.Controller; | |||||
/** | |||||
* <p> | |||||
* 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-23 | |||||
*/ | |||||
@Controller | |||||
@RequestMapping("/pmapi.expert/expert-avoid-company") | |||||
public class ExpertAvoidCompanyController { | |||||
} |
@@ -0,0 +1,40 @@ | |||||
package com.ningdatech.pmapi.expert.controller; | |||||
import com.ningdatech.pmapi.expert.manage.ExpertManage; | |||||
import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest; | |||||
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 javax.validation.Valid; | |||||
/** | |||||
* <p> | |||||
* 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@RestController | |||||
@Api(tags = "专家管理相关接口") | |||||
@RequestMapping("/api/v1/expert") | |||||
@RequiredArgsConstructor | |||||
public class ExpertController { | |||||
private final ExpertManage expertManage; | |||||
@PostMapping("/basic-info-submit") | |||||
@ApiOperation("填写基本信息接口(专家报名使用))") | |||||
public void expertBasicInfoSubmit(@Valid @RequestBody ExpertUserBasicInfoSubmitRequest request) { | |||||
// ExpertUserInfoValidator.expertUserBasicInfoSubmitRequestValidate(request); | |||||
expertManage.expertBasicInfoSubmit(request); | |||||
} | |||||
} |
@@ -0,0 +1,20 @@ | |||||
package com.ningdatech.pmapi.expert.controller; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.stereotype.Controller; | |||||
/** | |||||
* <p> | |||||
* 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@Controller | |||||
@RequestMapping("/pmapi.expert/expert-intention-work-region") | |||||
public class ExpertIntentionWorkRegionController { | |||||
} |
@@ -0,0 +1,36 @@ | |||||
package com.ningdatech.pmapi.expert.entity; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import io.swagger.annotations.ApiModel; | |||||
import lombok.Data; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-23 | |||||
*/ | |||||
@TableName("expert_avoid_company") | |||||
@ApiModel(value = "ExpertAvoidCompany对象", description = "") | |||||
@Data | |||||
public class ExpertAvoidCompany implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
private Long id; | |||||
private LocalDateTime createOn; | |||||
private LocalDateTime updateOn; | |||||
private Long userId; | |||||
private String companyName; | |||||
private String companyUniqCode; | |||||
} |
@@ -0,0 +1,39 @@ | |||||
package com.ningdatech.pmapi.expert.entity; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import io.swagger.annotations.ApiModel; | |||||
import lombok.Data; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@TableName("expert_intention_work_region") | |||||
@Data | |||||
@ApiModel(value = "ExpertIntentionWorkRegion对象", description = "") | |||||
public class ExpertIntentionWorkRegion implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@TableId(type = IdType.AUTO) | |||||
private Long id; | |||||
private LocalDateTime createOn; | |||||
private LocalDateTime updateOn; | |||||
private Long userId; | |||||
private String regionCode; | |||||
private Integer regionLevel; | |||||
} |
@@ -0,0 +1,108 @@ | |||||
package com.ningdatech.pmapi.expert.entity; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import io.swagger.annotations.ApiModel; | |||||
import lombok.Data; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@TableName("nd_expert_user_full_info") | |||||
@Data | |||||
@ApiModel(value = "NdExpertUserFullInfo对象", description = "") | |||||
public class ExpertUserFullInfo implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@TableId(type = IdType.AUTO) | |||||
private Long id; | |||||
private LocalDateTime createOn; | |||||
private LocalDateTime updateOn; | |||||
private Long userId; | |||||
private String expertAccountStatus; | |||||
private String isDingUser; | |||||
private String userInfoStep; | |||||
private String phoneNo; | |||||
private String gender; | |||||
private String expertName; | |||||
private Long avatarFileId; | |||||
private String idCard; | |||||
private String officePhone; | |||||
private String bankNo; | |||||
private String bank; | |||||
private String email; | |||||
private String school; | |||||
private LocalDateTime graduatedAt; | |||||
private String academicTitle; | |||||
private String graduationCertificateFileIdList; | |||||
private String degreeCertificateFileIdList; | |||||
private LocalDateTime retiredAt; | |||||
private String company; | |||||
private String legalEntityCode; | |||||
private String administrativeDuties; | |||||
private LocalDateTime startWorkAt; | |||||
private String address; | |||||
private String experience; | |||||
private String technicalTitles; | |||||
private String titleCertificateFileIdList; | |||||
private String awards; | |||||
private String recognitionReward; | |||||
private String recommendationProofFileIdList; | |||||
private String regionCode; | |||||
private Integer regionLevel; | |||||
private String recommendedWay; | |||||
private String remark; | |||||
private String hometown; | |||||
private String nationality; | |||||
private LocalDateTime birth; | |||||
} |
@@ -0,0 +1,113 @@ | |||||
package com.ningdatech.pmapi.expert.helper; | |||||
import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.pmapi.expert.model.*; | |||||
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.sys.model.dto.RegionDTO; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Component; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2023/2/23 上午9:18 | |||||
*/ | |||||
@Component | |||||
public class ExpertManageHelper { | |||||
// @Autowired | |||||
// private RegionCache regionCache; | |||||
@Autowired | |||||
private TagCache tagCache; | |||||
@Autowired | |||||
private DictionaryCache dictionaryCache; | |||||
/** | |||||
* 校验区域code | |||||
* | |||||
* @param expertRegionInfo | |||||
*/ | |||||
public void expertRegionInfoCheck(ExpertRegionInfo expertRegionInfo) { | |||||
// // todo 必须为叶子节点编码 | |||||
// String regionCode = expertRegionInfo.getRegionCode(); | |||||
// Integer regionLevel = expertRegionInfo.getRegionLevel(); | |||||
// RegionDTO regionDTO = regionCache.getByCodeAndLevel(regionCode, regionLevel); | |||||
// if (Objects.isNull(regionDTO)) { | |||||
// throw new BadRequestException("illegal regionInfo"); | |||||
// } | |||||
} | |||||
/** | |||||
* 校验标签code是否合法 | |||||
* | |||||
* @param expertProfessionalInfo | |||||
* @param expertBasicInfo | |||||
*/ | |||||
public void tagFieldCheck(ExpertProfessionalInfo expertProfessionalInfo, ExpertBasicInfo expertBasicInfo) { | |||||
List<TagFieldInfo> goodAt = expertProfessionalInfo.getGoodAt(); | |||||
List<TagFieldInfo> technicalExpertise = expertProfessionalInfo.getTechnicalExpertise(); | |||||
List<TagFieldInfo> industrySector = expertProfessionalInfo.getIndustrySector(); | |||||
List<TagFieldInfo> expertSource = expertBasicInfo.getExpertSource(); | |||||
List<TagFieldInfo> tagFieldInfoList = new ArrayList<>(); | |||||
tagFieldInfoList.addAll(goodAt); | |||||
tagFieldInfoList.addAll(technicalExpertise); | |||||
tagFieldInfoList.addAll(industrySector); | |||||
tagFieldInfoList.addAll(expertSource); | |||||
for (TagFieldInfo tagFieldInfo : tagFieldInfoList) { | |||||
String tagCode = tagFieldInfo.getTagCode(); | |||||
TagDTO tagCodeDTO = tagCache.getByTagCode(tagCode); | |||||
if (Objects.isNull(tagCodeDTO)) { | |||||
throw new BizException("illegal tagCode: tagField=" + tagFieldInfo.getTagFieldName() + ",tagCode=" + tagCode); | |||||
} | |||||
} | |||||
} | |||||
/** | |||||
* 校验字典code是否合法 | |||||
* | |||||
* @param expertBasicInfo | |||||
* @param expertEduInfo | |||||
* @param expertJobInfo | |||||
*/ | |||||
public void dictionaryFieldCheck(ExpertBasicInfo expertBasicInfo, ExpertEduInfo expertEduInfo | |||||
, ExpertJobInfo expertJobInfo) { | |||||
List<DictionaryFieldInfo> political = expertBasicInfo.getPolitical(); | |||||
List<DictionaryFieldInfo> edu = expertEduInfo.getEdu(); | |||||
List<DictionaryFieldInfo> degree = expertEduInfo.getDegree(); | |||||
List<DictionaryFieldInfo> jobStatus = expertJobInfo.getJobStatus(); | |||||
List<DictionaryFieldInfo> companyAttribute = expertJobInfo.getCompanyAttribute(); | |||||
List<DictionaryFieldInfo> administrativeRank = expertJobInfo.getAdministrativeRank(); | |||||
List<DictionaryFieldInfo> dictionaryFieldInfoList = new ArrayList<>(); | |||||
dictionaryFieldInfoList.addAll(political); | |||||
dictionaryFieldInfoList.addAll(edu); | |||||
dictionaryFieldInfoList.addAll(degree); | |||||
dictionaryFieldInfoList.addAll(jobStatus); | |||||
dictionaryFieldInfoList.addAll(companyAttribute); | |||||
dictionaryFieldInfoList.addAll(administrativeRank); | |||||
for (DictionaryFieldInfo dictionaryFieldInfo : dictionaryFieldInfoList) { | |||||
String dictionaryFieldName = dictionaryFieldInfo.getDictionaryFieldName(); | |||||
String dictionaryCode = dictionaryFieldInfo.getDictionaryCode(); | |||||
DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(dictionaryCode); | |||||
if (Objects.isNull(dictionaryDTO)) { | |||||
throw new BizException("illegal dictionaryCode: dictionaryFieldName=" + dictionaryFieldName + ",dictionaryCode=" + dictionaryCode); | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,78 @@ | |||||
package com.ningdatech.pmapi.expert.manage; | |||||
import com.ningdatech.pmapi.expert.assembler.ExpertInfoCmdAssembler; | |||||
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.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.cmd.ExpertFullInfoSaveCmd; | |||||
import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest; | |||||
import com.ningdatech.pmapi.expert.service.ExpertInfoService; | |||||
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; | |||||
import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; | |||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||||
import lombok.RequiredArgsConstructor; | |||||
import org.springframework.stereotype.Component; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2023/2/23 上午8:55 | |||||
*/ | |||||
@Component | |||||
@RequiredArgsConstructor | |||||
public class ExpertManage { | |||||
private final ExpertManageHelper expertManageHelper; | |||||
private final IExpertUserFullInfoService iExpertUserFullInfoService; | |||||
private final ExpertInfoService expertInfoService; | |||||
/** | |||||
* 填写基本信息,只有专家自己可用 | |||||
* | |||||
* @param request | |||||
*/ | |||||
public void expertBasicInfoSubmit(ExpertUserBasicInfoSubmitRequest request) { | |||||
// 用户id | |||||
Long userId = LoginUserUtil.getUserId(); | |||||
ExpertBasicInfo basicInfo = request.getBasicInfo(); | |||||
// 校验区域编码合法性 校验履职意向编码合法性 | |||||
ExpertRegionInfo expertRegionInfo = basicInfo.getExpertRegionInfo(); | |||||
expertManageHelper.expertRegionInfoCheck(expertRegionInfo); | |||||
List<ExpertRegionInfo> expertIntentionWorkRegions = basicInfo.getExpertIntentionWorkRegions(); | |||||
for (ExpertRegionInfo expertIntentionWorkRegion : expertIntentionWorkRegions) { | |||||
expertManageHelper.expertRegionInfoCheck(expertIntentionWorkRegion); | |||||
} | |||||
ExpertEduInfo eduInfo = request.getEduInfo(); | |||||
ExpertJobInfo jobInfo = request.getJobInfo(); | |||||
ExpertProfessionalInfo professionalInfo = request.getProfessionalInfo(); | |||||
// 校验标签字段 | |||||
expertManageHelper.tagFieldCheck(professionalInfo, basicInfo); | |||||
// 校验字典字段 | |||||
expertManageHelper.dictionaryFieldCheck(basicInfo, eduInfo, jobInfo); | |||||
// 判断专家提交状态,判断是否可以进行此操作 | |||||
ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); | |||||
boolean submitBasicInfoStatusEnable = Objects.isNull(expertUserFullInfo) | |||||
|| (ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus()) | |||||
&& !ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey().equals(expertUserFullInfo.getUserInfoStep())); | |||||
if (submitBasicInfoStatusEnable) { | |||||
// 新建 保存 | |||||
ExpertFullInfoSaveCmd expertFullInfoSaveCmd = ExpertInfoCmdAssembler | |||||
.buildExpertFullInfoSaveCmd(userId, basicInfo, eduInfo, jobInfo, professionalInfo); | |||||
expertInfoService.saveExpertInfo(expertFullInfoSaveCmd); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.expert.mapper; | |||||
import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | |||||
* <p> | |||||
* Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-23 | |||||
*/ | |||||
public interface ExpertAvoidCompanyMapper extends BaseMapper<ExpertAvoidCompany> { | |||||
} |
@@ -0,0 +1,5 @@ | |||||
<?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.ExpertAvoidCompanyMapper"> | |||||
</mapper> |
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.expert.mapper; | |||||
import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | |||||
* <p> | |||||
* Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
public interface ExpertIntentionWorkRegionMapper extends BaseMapper<ExpertIntentionWorkRegion> { | |||||
} |
@@ -0,0 +1,5 @@ | |||||
<?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.ExpertIntentionWorkRegionMapper"> | |||||
</mapper> |
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.expert.mapper; | |||||
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | |||||
* <p> | |||||
* Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
public interface NdExpertUserFullInfoMapper extends BaseMapper<ExpertUserFullInfo> { | |||||
} |
@@ -0,0 +1,5 @@ | |||||
<?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.NdExpertUserFullInfoMapper"> | |||||
</mapper> |
@@ -0,0 +1,34 @@ | |||||
package com.ningdatech.pmapi.expert.model; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import javax.validation.constraints.NotBlank; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/25 下午2:03 | |||||
* 专家信息字典字段信息 | |||||
*/ | |||||
@Data | |||||
@ApiModel("字典字段信息") | |||||
public class DictionaryFieldInfo { | |||||
/** | |||||
* 字段名称 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty("字典字段名称") | |||||
private String dictionaryFieldName; | |||||
/** | |||||
* 字典code | |||||
*/ | |||||
@ApiModelProperty(value = "字典code") | |||||
private String dictionaryCode; | |||||
@ApiModelProperty(value = "字典code含义", required = false) | |||||
private String dictionaryName; | |||||
} |
@@ -0,0 +1,22 @@ | |||||
package com.ningdatech.pmapi.expert.model; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import javax.validation.constraints.NotBlank; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/25 下午2:16 | |||||
*/ | |||||
@Data | |||||
public class ExpertAvoidCompanyInfo { | |||||
@NotBlank | |||||
@ApiModelProperty("公司名称") | |||||
private String companyName; | |||||
@ApiModelProperty("公司唯一标识 即 调用获取组织架构的树状结构(单位筛选列表) 接口是对应公司的 organizationCode") | |||||
private String companyUniqCode; | |||||
} |
@@ -0,0 +1,147 @@ | |||||
package 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.Email; | |||||
import javax.validation.constraints.NotBlank; | |||||
import javax.validation.constraints.NotEmpty; | |||||
import javax.validation.constraints.NotNull; | |||||
import java.time.LocalDateTime; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/25 下午1:44 | |||||
* 专家信息中的基本信息一栏 | |||||
*/ | |||||
@Data | |||||
@ApiModel(value = "ExpertBasicInfo", description = "专家基本信息") | |||||
public class ExpertBasicInfo { | |||||
/** | |||||
* 是否浙政钉用户Y/N | |||||
*/ | |||||
@NotNull | |||||
@ApiModelProperty(value = "是否浙政钉用户Y/N") | |||||
private Boolean isDingUser; | |||||
/** | |||||
* 手机号 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty(value = "手机号") | |||||
private String phoneNo; | |||||
/** | |||||
* 专家姓名 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty(value = "专家姓名") | |||||
private String name; | |||||
/** | |||||
* 免冠照图片地址 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty(value = "免冠照图片文件") | |||||
private FileBasicInfo avatarFile; | |||||
/** | |||||
* 性别 0,1:女,男 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty(value = "性别 0,1:女,男") | |||||
private String gender; | |||||
/** | |||||
* 政治面貌(字典code) | |||||
*/ | |||||
@NotNull | |||||
@ApiModelProperty(value = "政治面貌(字典code)") | |||||
private List<DictionaryFieldInfo> political; | |||||
/** | |||||
* 身份证号码 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty(value = "身份证号码") | |||||
private String idCard; | |||||
/** | |||||
* 办公电话 | |||||
*/ | |||||
@ApiModelProperty(value = "办公电话") | |||||
private String officePhone; | |||||
/** | |||||
* 出生日期 | |||||
*/ | |||||
@NotNull | |||||
@ApiModelProperty(value = "出生日期") | |||||
private LocalDateTime birth; | |||||
/** | |||||
* 开户银行 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty(value = "开户银行") | |||||
private String bank; | |||||
/** | |||||
* 银行卡号 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty(value = "银行卡号") | |||||
private String bankNo; | |||||
/** | |||||
* 电子邮箱 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty(value = "电子邮箱") | |||||
private String email; | |||||
/** | |||||
* 专家来源(标签code) | |||||
*/ | |||||
@NotNull | |||||
@ApiModelProperty(value = "专家来源(标签code)") | |||||
private List<TagFieldInfo> expertSource; | |||||
/** | |||||
* 专家层级 | |||||
*/ | |||||
@NotNull | |||||
@ApiModelProperty(value = "专家层级") | |||||
private ExpertRegionInfo expertRegionInfo; | |||||
/** | |||||
* 履职意向 | |||||
*/ | |||||
@NotEmpty | |||||
@ApiModelProperty(value = "履职意向") | |||||
private List<ExpertRegionInfo> expertIntentionWorkRegions; | |||||
/** | |||||
* 专家类型(内外围) | |||||
*/ | |||||
@ApiModelProperty(value = "专家类型(内外围)") | |||||
private List<DictionaryFieldInfo> expertType; | |||||
/** | |||||
* 籍贯 | |||||
*/ | |||||
@ApiModelProperty(value = "籍贯") | |||||
private String hometown; | |||||
/** | |||||
* 民族 | |||||
*/ | |||||
@ApiModelProperty(value = "民族") | |||||
private String nationality; | |||||
} |
@@ -0,0 +1,66 @@ | |||||
package com.ningdatech.pmapi.expert.model; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import javax.validation.constraints.NotBlank; | |||||
import javax.validation.constraints.NotNull; | |||||
import java.time.LocalDateTime; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/25 下午1:50 | |||||
*/ | |||||
@Data | |||||
@ApiModel(value = "ExpertEduInfo", description = "学历信息") | |||||
public class ExpertEduInfo { | |||||
/** | |||||
* 毕业院校 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty("毕业院校") | |||||
private String school; | |||||
/** | |||||
* 毕业时间 | |||||
*/ | |||||
@NotNull | |||||
@ApiModelProperty("毕业时间") | |||||
private LocalDateTime graduatedAt; | |||||
/** | |||||
* 所学专业 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty("所学专业") | |||||
private String academicTitle; | |||||
/** | |||||
* 学历(字典code) | |||||
*/ | |||||
@NotNull | |||||
@ApiModelProperty("学历(字典code)") | |||||
private List<DictionaryFieldInfo> edu; | |||||
/** | |||||
* 毕业证附件信息 | |||||
*/ | |||||
@ApiModelProperty("毕业证附件信息") | |||||
private List<FileBasicInfo> graduationCertificateFile; | |||||
/** | |||||
* 学位(字典code) | |||||
*/ | |||||
@NotNull | |||||
@ApiModelProperty("学位(字典code)") | |||||
private List<DictionaryFieldInfo> degree; | |||||
/** | |||||
* 学位证附件信息 | |||||
*/ | |||||
@ApiModelProperty("学位证附件信息") | |||||
private List<FileBasicInfo> degreeCertificateFile; | |||||
} |
@@ -0,0 +1,91 @@ | |||||
package com.ningdatech.pmapi.expert.model; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import javax.validation.constraints.NotBlank; | |||||
import javax.validation.constraints.NotNull; | |||||
import java.time.LocalDateTime; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/25 下午1:58 | |||||
*/ | |||||
@Data | |||||
@ApiModel(value = "ExpertJobInfo", description = "职业信息") | |||||
public class ExpertJobInfo { | |||||
/** | |||||
* 在职状态(字典code) | |||||
*/ | |||||
@NotNull | |||||
@ApiModelProperty("在职状态(字典code)") | |||||
private List<DictionaryFieldInfo> jobStatus; | |||||
/** | |||||
* 退休时间 | |||||
*/ | |||||
@ApiModelProperty("退休时间") | |||||
private LocalDateTime retiredAt; | |||||
/** | |||||
* 工作单位 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty("工作单位,组织结构name") | |||||
private String company; | |||||
@ApiModelProperty("工作单位,前端使用标识") | |||||
private String companyUniqCode; | |||||
/** | |||||
* 单位法人编号 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty(" 单位法人编号") | |||||
private String legalEntityCode; | |||||
/** | |||||
* 行政职务 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty("行政职务") | |||||
private String administrativeDuties; | |||||
/** | |||||
* 开始工作时间 | |||||
*/ | |||||
@NotNull | |||||
@ApiModelProperty("开始工作时间") | |||||
private LocalDateTime startWorkAt; | |||||
/** | |||||
* 行政职级(字典code) | |||||
*/ | |||||
@NotNull | |||||
@ApiModelProperty("行政职级(字典code)") | |||||
private List<DictionaryFieldInfo> administrativeRank; | |||||
/** | |||||
* 单位类型(字典code) | |||||
*/ | |||||
@NotNull | |||||
@ApiModelProperty("单位类型(字典code)") | |||||
private List<DictionaryFieldInfo> companyAttribute; | |||||
/** | |||||
* 工作地址 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty("工作地址") | |||||
private String address; | |||||
/** | |||||
* 工作经历 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty("工作经历") | |||||
private String experience; | |||||
} |
@@ -0,0 +1,22 @@ | |||||
package com.ningdatech.pmapi.expert.model; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/8/19 下午6:43 | |||||
*/ | |||||
@Data | |||||
@ApiModel(description = "其他信息") | |||||
public class ExpertOtherInfo { | |||||
@ApiModelProperty(value = "其他标签(标签code)") | |||||
private List<TagFieldInfo> other; | |||||
@ApiModelProperty(value = "备注") | |||||
private String remark; | |||||
} |
@@ -0,0 +1,56 @@ | |||||
package com.ningdatech.pmapi.expert.model; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import javax.validation.constraints.NotBlank; | |||||
import javax.validation.constraints.NotNull; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/25 下午2:07 | |||||
*/ | |||||
@Data | |||||
@ApiModel(description = "专业信息") | |||||
public class ExpertProfessionalInfo { | |||||
@NotBlank | |||||
@ApiModelProperty(value = "技术职称") | |||||
private String technicalTitles; | |||||
@NotNull | |||||
@ApiModelProperty(value = "职称级别") | |||||
private List<DictionaryFieldInfo> titleLevel; | |||||
@ApiModelProperty(value = "职称证明") | |||||
private List<FileBasicInfo> titleCertificateFile; | |||||
@NotNull | |||||
@ApiModelProperty(value = "擅长方向(标签code)") | |||||
private List<TagFieldInfo> goodAt; | |||||
@NotNull | |||||
@ApiModelProperty(value = "技术专长(标签code)") | |||||
private List<TagFieldInfo> technicalExpertise; | |||||
@NotBlank | |||||
@ApiModelProperty(value = " 获奖情况") | |||||
private String awards; | |||||
@NotNull | |||||
@ApiModelProperty(value = "行业领域(标签code)") | |||||
private List<TagFieldInfo> industrySector; | |||||
@NotBlank | |||||
@ApiModelProperty(value = "表彰奖励") | |||||
private String recognitionReward; | |||||
@ApiModelProperty(value = "回避单位列表") | |||||
private List<ExpertAvoidCompanyInfo> avoidCompanyList; | |||||
@ApiModelProperty(value = "其他标签") | |||||
private List<TagFieldInfo> other; | |||||
} |
@@ -0,0 +1,25 @@ | |||||
package com.ningdatech.pmapi.expert.model; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/27 上午11:52 | |||||
*/ | |||||
@Data | |||||
@ApiModel(description = "推荐信息") | |||||
public class ExpertRecommendInfo { | |||||
/** | |||||
* 推荐方式 | |||||
*/ | |||||
@ApiModelProperty("推荐方式") | |||||
private List<DictionaryFieldInfo> recommendedWay; | |||||
@ApiModelProperty("推荐证明材料") | |||||
private List<FileBasicInfo> recommendationProofFile; | |||||
} |
@@ -0,0 +1,24 @@ | |||||
package com.ningdatech.pmapi.expert.model; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/25 下午1:55 | |||||
* 用于包装使用 | |||||
*/ | |||||
@Data | |||||
@ApiModel("文件信息基类") | |||||
public class FileBasicInfo { | |||||
@ApiModelProperty("文件id") | |||||
private Long fileId; | |||||
@ApiModelProperty("文件url") | |||||
private String url; | |||||
@ApiModelProperty("文件名") | |||||
private String fileName; | |||||
} |
@@ -0,0 +1,24 @@ | |||||
package com.ningdatech.pmapi.expert.model; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/25 下午2:12 | |||||
*/ | |||||
@Data | |||||
@ApiModel("标签信息") | |||||
public class TagFieldInfo { | |||||
@ApiModelProperty("标签字段名称") | |||||
private String tagFieldName; | |||||
@ApiModelProperty("标签字段code") | |||||
private String tagCode; | |||||
@ApiModelProperty(value = "标签code含义", required = false) | |||||
private String tagName; | |||||
} | |||||
@@ -0,0 +1,32 @@ | |||||
package com.ningdatech.pmapi.expert.model.cmd; | |||||
import com.ningdatech.pmapi.expert.model.dto.*; | |||||
import lombok.Data; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 下午4:41 | |||||
*/ | |||||
@Data | |||||
public class ExpertFullInfoSaveCmd { | |||||
private Long userId; | |||||
private ExpertUserFullInfoDTO expertUserInfoDTO; | |||||
private List<ExpertDictionaryDTO> expertDictionaryList; | |||||
private List<ExpertTagDTO> expertTagList; | |||||
/** | |||||
* 专家履职意向(区域编码) | |||||
*/ | |||||
private List<ExpertRegionDTO> expertIntentionWorkRegionInfo; | |||||
/** | |||||
* 回避单位列表 | |||||
*/ | |||||
private List<ExpertAvoidCompanyDTO> expertAvoidCompanyList; | |||||
} |
@@ -0,0 +1,20 @@ | |||||
package com.ningdatech.pmapi.expert.model.dto; | |||||
import lombok.Data; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/25 下午5:14 | |||||
*/ | |||||
@Data | |||||
public class ExpertAvoidCompanyDTO { | |||||
/** | |||||
* 公司名称 | |||||
*/ | |||||
private String companyName; | |||||
/** | |||||
* 公司唯一标识 | |||||
*/ | |||||
private String companyUniqCode; | |||||
} |
@@ -0,0 +1,30 @@ | |||||
package com.ningdatech.pmapi.expert.model.dto; | |||||
import lombok.Data; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 下午5:13 | |||||
*/ | |||||
@Data | |||||
public class ExpertDictionaryDTO { | |||||
/** | |||||
* 字典编码 | |||||
*/ | |||||
private String dictionaryCode; | |||||
/** | |||||
* 手机对应专家信息字段号 | |||||
* 政治面貌 political | |||||
* 专家来源 expert_source | |||||
* 学历 edu | |||||
* 学位 degree | |||||
* 在职状态 job_status | |||||
* 行政职级 administrative_rank | |||||
* 内外围(专家类型) expert_type | |||||
* 单位类型 company_attribute | |||||
* 职称级别 title_level | |||||
*/ | |||||
private String expertInfoField; | |||||
} |
@@ -0,0 +1,14 @@ | |||||
package com.ningdatech.pmapi.expert.model.dto; | |||||
import lombok.Data; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 下午5:10 | |||||
*/ | |||||
@Data | |||||
public class ExpertRegionDTO { | |||||
private String regionCode; | |||||
private Integer regionLevel; | |||||
} |
@@ -0,0 +1,21 @@ | |||||
package com.ningdatech.pmapi.expert.model.dto; | |||||
import lombok.Data; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 下午5:13 | |||||
*/ | |||||
@Data | |||||
public class ExpertTagDTO { | |||||
/** | |||||
* 标签code | |||||
*/ | |||||
private String tagCode; | |||||
/** | |||||
* 对应专家信息字段 | |||||
*/ | |||||
private String expertInfoField; | |||||
} |
@@ -0,0 +1,205 @@ | |||||
package com.ningdatech.pmapi.expert.model.dto; | |||||
import lombok.Data; | |||||
import java.time.LocalDateTime; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 下午4:43 | |||||
*/ | |||||
@Data | |||||
public class ExpertUserFullInfoDTO { | |||||
private Long id; | |||||
/** | |||||
* 用户id | |||||
*/ | |||||
private Long userId; | |||||
/** | |||||
* 专家账号状态 | |||||
*/ | |||||
private String expertAccountStatus; | |||||
/** | |||||
* 是否浙政钉用户Y/N | |||||
*/ | |||||
private Boolean isDingUser; | |||||
/** | |||||
* 专家信息提交步骤 | |||||
* 0,1,2 | |||||
* 0 :待提交信息 1: 已提交基本信息 2:已提交推荐证明 | |||||
*/ | |||||
private Integer userInfoStep; | |||||
/** | |||||
* 手机号 | |||||
*/ | |||||
private String phoneNo; | |||||
/** | |||||
* 性别 | |||||
* 0,1 女,男 | |||||
*/ | |||||
private String gender; | |||||
/** | |||||
* 姓名 | |||||
*/ | |||||
private String name; | |||||
/** | |||||
* 免冠照图片文件地址 | |||||
*/ | |||||
private Long avatarFileId; | |||||
/** | |||||
* 身份证号码 | |||||
*/ | |||||
private String idCard; | |||||
/** | |||||
* 办公电话 | |||||
*/ | |||||
private String officePhone; | |||||
/** | |||||
* 出生日期 | |||||
*/ | |||||
private LocalDateTime birth; | |||||
/** | |||||
* 银行卡号 | |||||
*/ | |||||
private String bankNo; | |||||
/** | |||||
* 开户银行 | |||||
*/ | |||||
private String bank; | |||||
/** | |||||
* 电子邮箱 | |||||
*/ | |||||
private String email; | |||||
/** | |||||
* 毕业院校 | |||||
*/ | |||||
private String school; | |||||
/** | |||||
* 毕业时间 | |||||
*/ | |||||
private LocalDateTime graduatedAt; | |||||
/** | |||||
* 所学专业 | |||||
*/ | |||||
private String academicTitle; | |||||
/** | |||||
* 毕业证 文件id | |||||
*/ | |||||
private List<Long> graduationCertificateFileIdList; | |||||
/** | |||||
* 学位证 文件id | |||||
*/ | |||||
private List<Long> degreeCertificateFileIdList; | |||||
/** | |||||
* 退休时间 | |||||
*/ | |||||
private LocalDateTime retiredAt; | |||||
/** | |||||
* 工作单位 | |||||
*/ | |||||
private String company; | |||||
/** | |||||
* 工作单位前端使用标识 | |||||
*/ | |||||
private String companyUniqCode; | |||||
/** | |||||
* 单位法人编号 | |||||
*/ | |||||
private String legalEntityCode; | |||||
/** | |||||
* 行政职务 | |||||
*/ | |||||
private String administrativeDuties; | |||||
/** | |||||
* 开始工作时间 | |||||
*/ | |||||
private LocalDateTime startWorkAt; | |||||
/** | |||||
* 工作地址 | |||||
*/ | |||||
private String address; | |||||
/** | |||||
* 工作经历 | |||||
*/ | |||||
private String experience; | |||||
/** | |||||
* 技术职称 | |||||
*/ | |||||
private String technicalTitles; | |||||
/** | |||||
* 职称证明 | |||||
* 文件id | |||||
*/ | |||||
private List<Long> titleCertificateFileIdList; | |||||
/** | |||||
* 获奖情况 | |||||
*/ | |||||
private String awards; | |||||
/** | |||||
* 表彰奖励 | |||||
*/ | |||||
private String recognitionReward; | |||||
/** | |||||
* 推荐证明材料文件id | |||||
*/ | |||||
private List<Long> recommendationProofFileIdList; | |||||
/** | |||||
* 专家层级(区域编码) | |||||
*/ | |||||
private String regionCode; | |||||
/** | |||||
* 区域级别 | |||||
*/ | |||||
private Integer regionLevel; | |||||
/** | |||||
* 专家管理员审核备注 | |||||
*/ | |||||
private String remark; | |||||
/** | |||||
* 籍贯 | |||||
*/ | |||||
private String hometown; | |||||
/** | |||||
* 民族 | |||||
*/ | |||||
private String nationality; | |||||
} |
@@ -0,0 +1,36 @@ | |||||
package com.ningdatech.pmapi.expert.model.req; | |||||
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 io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import javax.validation.constraints.NotNull; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/25 下午2:21 | |||||
*/ | |||||
@Data | |||||
@ApiModel(value = "ExpertUserBasicInfoSubmitRequest", description = "专家基本信息填写入参") | |||||
public class ExpertUserBasicInfoSubmitRequest { | |||||
@NotNull | |||||
@ApiModelProperty("基本信息") | |||||
private ExpertBasicInfo basicInfo; | |||||
@NotNull | |||||
@ApiModelProperty("学历信息") | |||||
private ExpertEduInfo eduInfo; | |||||
@NotNull | |||||
@ApiModelProperty("职业信息") | |||||
private ExpertJobInfo jobInfo; | |||||
@NotNull | |||||
@ApiModelProperty("专业信息") | |||||
private ExpertProfessionalInfo professionalInfo; | |||||
} |
@@ -0,0 +1,14 @@ | |||||
package com.ningdatech.pmapi.expert.service; | |||||
import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 下午4:39 | |||||
*/ | |||||
public interface ExpertInfoService { | |||||
void saveExpertInfo(ExpertFullInfoSaveCmd cmd); | |||||
} |
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.expert.service; | |||||
import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-23 | |||||
*/ | |||||
public interface IExpertAvoidCompanyService extends IService<ExpertAvoidCompany> { | |||||
} |
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.expert.service; | |||||
import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
public interface IExpertIntentionWorkRegionService extends IService<ExpertIntentionWorkRegion> { | |||||
} |
@@ -0,0 +1,24 @@ | |||||
package com.ningdatech.pmapi.expert.service; | |||||
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
public interface IExpertUserFullInfoService extends IService<ExpertUserFullInfo> { | |||||
/** | |||||
* 查询用户信息 | |||||
* | |||||
* @param userId 用户ID | |||||
* @return / | |||||
**/ | |||||
ExpertUserFullInfo getByUserId(Long userId); | |||||
} |
@@ -0,0 +1,20 @@ | |||||
package com.ningdatech.pmapi.expert.service.impl; | |||||
import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; | |||||
import com.ningdatech.pmapi.expert.mapper.ExpertAvoidCompanyMapper; | |||||
import com.ningdatech.pmapi.expert.service.IExpertAvoidCompanyService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-23 | |||||
*/ | |||||
@Service | |||||
public class ExpertAvoidCompanyServiceImpl extends ServiceImpl<ExpertAvoidCompanyMapper, ExpertAvoidCompany> implements IExpertAvoidCompanyService { | |||||
} |
@@ -0,0 +1,219 @@ | |||||
package com.ningdatech.pmapi.expert.service.impl; | |||||
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.constant.ExpertAccountStatusEnum; | |||||
import com.ningdatech.pmapi.expert.constant.ExpertUserInfoStepEnum; | |||||
import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; | |||||
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; | |||||
import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; | |||||
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.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.apache.commons.collections4.CollectionUtils; | |||||
import org.springframework.stereotype.Component; | |||||
import org.springframework.transaction.annotation.Transactional; | |||||
import java.time.LocalDateTime; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 下午4:39 | |||||
*/ | |||||
@Component | |||||
@RequiredArgsConstructor | |||||
public class ExpertInfoServiceImpl implements ExpertInfoService { | |||||
private final IExpertUserFullInfoService iExpertUserFullInfoService; | |||||
private final IExpertTagService iExpertTagService; | |||||
private final IExpertDictionaryService iExpertDictionaryService; | |||||
private final IExpertAvoidCompanyService iExpertAvoidCompanyService; | |||||
/** | |||||
* 用户第一次申请修改,仅在专家用户状态为applying 状态时调用 | |||||
* | |||||
* @param cmd | |||||
*/ | |||||
@Override | |||||
@Transactional(rollbackFor = Exception.class) | |||||
public void saveExpertInfo(ExpertFullInfoSaveCmd cmd) { | |||||
Long userId = cmd.getUserId(); | |||||
List<ExpertAvoidCompanyDTO> expertAvoidCompanyList = cmd.getExpertAvoidCompanyList(); | |||||
List<ExpertDictionaryDTO> expertDictionaryList = cmd.getExpertDictionaryList(); | |||||
List<ExpertRegionDTO> expertIntentionWorkRegionInfoList = cmd.getExpertIntentionWorkRegionInfo(); | |||||
List<ExpertTagDTO> expertTagList = cmd.getExpertTagList(); | |||||
ExpertUserFullInfoDTO expertUserInfoDTO = cmd.getExpertUserInfoDTO(); | |||||
ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); | |||||
ExpertUserFullInfo saveExpertUserFullInfo = buildSaveExpertUserFullInfo(expertUserInfoDTO); | |||||
if (Objects.nonNull(expertUserFullInfo)) { | |||||
// 专家信息审核通过之前,所有信息无需备份 | |||||
iExpertUserFullInfoService.removeById(expertUserFullInfo.getId()); | |||||
// 删除所有专家标签字段 | |||||
LambdaQueryWrapper<ExpertTag> expertTagRemove = Wrappers.lambdaQuery(ExpertTag.class) | |||||
.eq(ExpertTag::getUserId, userId); | |||||
iExpertTagService.remove(expertTagRemove); | |||||
// 删除所有专家字典字段 | |||||
LambdaQueryWrapper<ExpertDictionary> expertDictionaryRemove = Wrappers.lambdaQuery(ExpertDictionary.class) | |||||
.eq(ExpertDictionary::getUserId, userId); | |||||
iExpertDictionaryService.remove(expertDictionaryRemove); | |||||
// 删除所有专家履职意向申请 | |||||
// TODO 补充审核逻辑 | |||||
// LambdaQueryWrapper<ExpertMetaApply> expertMetaApplyRemove = Wrappers.lambdaQuery(ExpertMetaApply.class) | |||||
// .eq(ExpertMetaApply::getUserId, userId) | |||||
// .eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()) | |||||
// .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.N.name()); | |||||
// iExpertMetaApplyService.remove(expertMetaApplyRemove); | |||||
// 删除回避单位 | |||||
LambdaQueryWrapper<ExpertAvoidCompany> expertAvoidCompanyRemove = Wrappers.lambdaQuery(ExpertAvoidCompany.class) | |||||
.eq(ExpertAvoidCompany::getUserId, userId); | |||||
iExpertAvoidCompanyService.remove(expertAvoidCompanyRemove); | |||||
} | |||||
saveExpertUserFullInfo.setUserId(userId); | |||||
saveExpertUserFullInfo.setExpertAccountStatus(ExpertAccountStatusEnum.APPLYING.getKey()); | |||||
saveExpertUserFullInfo.setUserInfoStep(ExpertUserInfoStepEnum.BASIC_INFORMATION_SUBMITTED.getKey()); | |||||
saveExpertUserFullInfo.setUpdateOn(LocalDateTime.now()); | |||||
saveExpertUserFullInfo.setCreateOn(LocalDateTime.now()); | |||||
iExpertUserFullInfoService.save(saveExpertUserFullInfo); | |||||
// 保存所有专家标签字段 | |||||
List<ExpertTag> saveExpertTagList = buildSaveExpertTagList(userId, expertTagList); | |||||
if (CollectionUtils.isNotEmpty(saveExpertTagList)) { | |||||
iExpertTagService.saveBatch(saveExpertTagList); | |||||
} | |||||
// 保存所有专家字典字段 | |||||
List<ExpertDictionary> saveExpertDictionaryList = buildSaveExpertDictionaryList(userId, expertDictionaryList); | |||||
if (CollectionUtils.isNotEmpty(saveExpertDictionaryList)) { | |||||
iExpertDictionaryService.saveBatch(saveExpertDictionaryList); | |||||
} | |||||
// 保存所有专家履职意向申请 | |||||
// TODO 补充审核逻辑 | |||||
// List<ExpertMetaApply> saveExpertIntentionWorkRegionApplyList = buildSaveExpertIntentionWorkRegionApplyList(userId, expertIntentionWorkRegionInfoList); | |||||
// if (CollectionUtils.isNotEmpty(saveExpertDictionaryList)) { | |||||
// iExpertMetaApplyService.saveBatch(saveExpertIntentionWorkRegionApplyList); | |||||
// } | |||||
// 保存所有专家回避单位 | |||||
List<ExpertAvoidCompany> saveExpertAvoidCompanyList = buildSaveExpertAvoidCompanyList(userId, expertAvoidCompanyList); | |||||
if (CollectionUtils.isNotEmpty(saveExpertAvoidCompanyList)) { | |||||
iExpertAvoidCompanyService.saveBatch(saveExpertAvoidCompanyList); | |||||
} | |||||
} | |||||
private ExpertUserFullInfo buildSaveExpertUserFullInfo(ExpertUserFullInfoDTO expertUserInfoDTO) { | |||||
ExpertUserFullInfo expertUserFullInfo = new ExpertUserFullInfo(); | |||||
if (Objects.nonNull(expertUserInfoDTO.getIsDingUser())) { | |||||
expertUserFullInfo.setIsDingUser(expertUserInfoDTO.getIsDingUser() ? BoolDisplayEnum.Y.name() : BoolDisplayEnum.N.name()); | |||||
} | |||||
expertUserFullInfo.setPhoneNo(expertUserInfoDTO.getPhoneNo()); | |||||
expertUserFullInfo.setGender(expertUserInfoDTO.getGender()); | |||||
expertUserFullInfo.setExpertName(expertUserInfoDTO.getName()); | |||||
expertUserFullInfo.setAvatarFileId(expertUserInfoDTO.getAvatarFileId()); | |||||
expertUserFullInfo.setIdCard(expertUserInfoDTO.getIdCard()); | |||||
expertUserFullInfo.setOfficePhone(expertUserInfoDTO.getOfficePhone()); | |||||
expertUserFullInfo.setBirth(expertUserInfoDTO.getBirth()); | |||||
expertUserFullInfo.setBankNo(expertUserInfoDTO.getBankNo()); | |||||
expertUserFullInfo.setBank(expertUserInfoDTO.getBank()); | |||||
expertUserFullInfo.setEmail(expertUserInfoDTO.getEmail()); | |||||
expertUserFullInfo.setHometown(expertUserInfoDTO.getHometown()); | |||||
expertUserFullInfo.setNationality(expertUserInfoDTO.getNationality()); | |||||
expertUserFullInfo.setSchool(expertUserInfoDTO.getSchool()); | |||||
expertUserFullInfo.setGraduatedAt(expertUserInfoDTO.getGraduatedAt()); | |||||
expertUserFullInfo.setAcademicTitle(expertUserInfoDTO.getAcademicTitle()); | |||||
if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getGraduationCertificateFileIdList())) { | |||||
expertUserFullInfo.setGraduationCertificateFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getGraduationCertificateFileIdList())); | |||||
} | |||||
if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getDegreeCertificateFileIdList())) { | |||||
expertUserFullInfo.setDegreeCertificateFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getDegreeCertificateFileIdList())); | |||||
} | |||||
expertUserFullInfo.setRetiredAt(expertUserInfoDTO.getRetiredAt()); | |||||
expertUserFullInfo.setCompany(expertUserInfoDTO.getCompany()); | |||||
expertUserFullInfo.setLegalEntityCode(expertUserInfoDTO.getLegalEntityCode()); | |||||
expertUserFullInfo.setAdministrativeDuties(expertUserInfoDTO.getAdministrativeDuties()); | |||||
expertUserFullInfo.setStartWorkAt(expertUserInfoDTO.getStartWorkAt()); | |||||
expertUserFullInfo.setAddress(expertUserInfoDTO.getAddress()); | |||||
expertUserFullInfo.setExperience(expertUserInfoDTO.getExperience()); | |||||
expertUserFullInfo.setTechnicalTitles(expertUserInfoDTO.getTechnicalTitles()); | |||||
if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getTitleCertificateFileIdList())) { | |||||
expertUserFullInfo.setTitleCertificateFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getTitleCertificateFileIdList())); | |||||
} | |||||
expertUserFullInfo.setAwards(expertUserInfoDTO.getAwards()); | |||||
expertUserFullInfo.setRecognitionReward(expertUserInfoDTO.getRecognitionReward()); | |||||
expertUserFullInfo.setRegionCode(expertUserInfoDTO.getRegionCode()); | |||||
expertUserFullInfo.setRegionLevel(expertUserInfoDTO.getRegionLevel()); | |||||
if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getRecommendationProofFileIdList())) { | |||||
expertUserFullInfo.setRecommendationProofFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getRecommendationProofFileIdList())); | |||||
} | |||||
expertUserFullInfo.setRemark(expertUserInfoDTO.getRemark()); | |||||
return expertUserFullInfo; | |||||
} | |||||
private List<ExpertTag> buildSaveExpertTagList(Long userId, List<ExpertTagDTO> expertTagList) { | |||||
if (CollectionUtils.isEmpty(expertTagList)) { | |||||
return new ArrayList<>(); | |||||
} | |||||
return expertTagList.stream().map(r -> { | |||||
ExpertTag expertTag = new ExpertTag(); | |||||
expertTag.setExpertInfoField(r.getExpertInfoField()); | |||||
expertTag.setTagCode(r.getTagCode()); | |||||
expertTag.setCreateOn(LocalDateTime.now()); | |||||
expertTag.setUpdateOn(LocalDateTime.now()); | |||||
expertTag.setUserId(userId); | |||||
return expertTag; | |||||
}).collect(Collectors.toList()); | |||||
} | |||||
private List<ExpertDictionary> buildSaveExpertDictionaryList(Long userId, List<ExpertDictionaryDTO> expertDictionaryList) { | |||||
if (CollectionUtils.isEmpty(expertDictionaryList)) { | |||||
return new ArrayList<>(); | |||||
} | |||||
return expertDictionaryList.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()); | |||||
} | |||||
private List<ExpertAvoidCompany> buildSaveExpertAvoidCompanyList(Long userId, List<ExpertAvoidCompanyDTO> expertAvoidCompanyList) { | |||||
if (CollectionUtils.isEmpty(expertAvoidCompanyList)) { | |||||
return new ArrayList<>(); | |||||
} | |||||
return expertAvoidCompanyList.stream().map(r -> { | |||||
ExpertAvoidCompany expertAvoidCompany = new ExpertAvoidCompany(); | |||||
expertAvoidCompany.setCompanyName(r.getCompanyName()); | |||||
expertAvoidCompany.setUserId(userId); | |||||
expertAvoidCompany.setCompanyUniqCode(r.getCompanyUniqCode()); | |||||
expertAvoidCompany.setCreateOn(LocalDateTime.now()); | |||||
expertAvoidCompany.setUpdateOn(LocalDateTime.now()); | |||||
return expertAvoidCompany; | |||||
}).collect(Collectors.toList()); | |||||
} | |||||
} |
@@ -0,0 +1,20 @@ | |||||
package com.ningdatech.pmapi.expert.service.impl; | |||||
import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; | |||||
import com.ningdatech.pmapi.expert.mapper.ExpertIntentionWorkRegionMapper; | |||||
import com.ningdatech.pmapi.expert.service.IExpertIntentionWorkRegionService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@Service | |||||
public class ExpertIntentionWorkRegionServiceImpl extends ServiceImpl<ExpertIntentionWorkRegionMapper, ExpertIntentionWorkRegion> implements IExpertIntentionWorkRegionService { | |||||
} |
@@ -0,0 +1,31 @@ | |||||
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.pmapi.expert.entity.ExpertUserFullInfo; | |||||
import com.ningdatech.pmapi.expert.mapper.NdExpertUserFullInfoMapper; | |||||
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import org.springframework.stereotype.Service; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@Service | |||||
public class ExpertUserFullInfoServiceImpl extends ServiceImpl<NdExpertUserFullInfoMapper, ExpertUserFullInfo> implements IExpertUserFullInfoService { | |||||
@Override | |||||
public ExpertUserFullInfo getByUserId(Long userId) { | |||||
return getOne(Wrappers.<ExpertUserFullInfo>lambdaQuery().eq(ExpertUserFullInfo::getUserId, userId)); | |||||
} | |||||
} |
@@ -23,6 +23,7 @@ import javax.validation.Valid; | |||||
@Controller | @Controller | ||||
@RequestMapping("/api/v1/fiscal-code") | @RequestMapping("/api/v1/fiscal-code") | ||||
@RequiredArgsConstructor | @RequiredArgsConstructor | ||||
@ApiOperation("印章配置/财政编码配置") | |||||
public class CompanyFiscalCodeController { | public class CompanyFiscalCodeController { | ||||
private final CompanyFiscalCodeManage companyFiscalCodeManage; | private final CompanyFiscalCodeManage companyFiscalCodeManage; | ||||
@@ -0,0 +1,36 @@ | |||||
package com.ningdatech.pmapi.meta.assembler; | |||||
import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; | |||||
import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; | |||||
import com.ningdatech.pmapi.meta.model.vo.ResDictionaryVO; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 上午10:53 | |||||
*/ | |||||
public class MetaDictionaryAssembler { | |||||
public static DictionaryDTO toDictionaryDTO(MetaDictionary dictionaryManage) { | |||||
DictionaryDTO dictionaryDTO = new DictionaryDTO(); | |||||
dictionaryDTO.setDescribe(dictionaryManage.getDictionaryDescribe()); | |||||
dictionaryDTO.setDictionaryCode(dictionaryManage.getDictionaryCode()); | |||||
dictionaryDTO.setDictionaryType(dictionaryManage.getDictionaryType()); | |||||
dictionaryDTO.setName(dictionaryManage.getDictionaryName()); | |||||
dictionaryDTO.setReadonly(dictionaryManage.getReadonly()); | |||||
dictionaryDTO.setSortValue(dictionaryManage.getSortValue()); | |||||
return dictionaryDTO; | |||||
} | |||||
public static ResDictionaryVO toDictionaryVO(DictionaryDTO dictionaryDTO) { | |||||
ResDictionaryVO resDictionaryVO = new ResDictionaryVO(); | |||||
resDictionaryVO.setDescribe(dictionaryDTO.getDescribe()); | |||||
resDictionaryVO.setDictionaryCode(dictionaryDTO.getDictionaryCode()); | |||||
resDictionaryVO.setDictionaryType(dictionaryDTO.getDictionaryType()); | |||||
resDictionaryVO.setName(dictionaryDTO.getName()); | |||||
resDictionaryVO.setReadonly(dictionaryDTO.getReadonly()); | |||||
resDictionaryVO.setSortValue(dictionaryDTO.getSortValue()); | |||||
return resDictionaryVO; | |||||
} | |||||
} |
@@ -0,0 +1,62 @@ | |||||
package com.ningdatech.pmapi.meta.assembler; | |||||
import com.ningdatech.pmapi.meta.model.entity.MetaTag; | |||||
import com.ningdatech.pmapi.meta.model.dto.TagDTO; | |||||
import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; | |||||
import com.ningdatech.pmapi.meta.model.vo.ResTagTreeVO; | |||||
import org.apache.commons.collections4.CollectionUtils; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 上午9:57 | |||||
*/ | |||||
public class MetaTagAssembler { | |||||
public static TagDTO toTagDTO(MetaTag metaTagManage) { | |||||
TagDTO tagDTO = new TagDTO(); | |||||
tagDTO.setParentCode(metaTagManage.getParentCode()); | |||||
tagDTO.setTagCode(metaTagManage.getTagCode()); | |||||
tagDTO.setTagLevel(metaTagManage.getTagLevel()); | |||||
tagDTO.setTagName(metaTagManage.getTagName()); | |||||
return tagDTO; | |||||
} | |||||
public static List<TagTreeDTO> toTagTreeDTOList(List<TagDTO> tagDTOList) { | |||||
if (CollectionUtils.isEmpty(tagDTOList)) { | |||||
return new ArrayList<>(); | |||||
} | |||||
return tagDTOList.stream().map(MetaTagAssembler::toTagTreeDTO).collect(Collectors.toList()); | |||||
} | |||||
public static TagTreeDTO toTagTreeDTO(TagDTO tagDTO) { | |||||
TagTreeDTO tagTreeDTO = new TagTreeDTO(); | |||||
tagTreeDTO.setParentCode(tagDTO.getParentCode()); | |||||
tagTreeDTO.setTagCode(tagDTO.getTagCode()); | |||||
tagTreeDTO.setTagLevel(tagDTO.getTagLevel()); | |||||
tagTreeDTO.setTagName(tagDTO.getTagName()); | |||||
return tagTreeDTO; | |||||
} | |||||
public static List<ResTagTreeVO> toTagTreeVOList(List<TagTreeDTO> tagTreeDTOList) { | |||||
List<ResTagTreeVO> resTagTreeVOList = new ArrayList<>(); | |||||
for (TagTreeDTO tagTreeDTO : tagTreeDTOList) { | |||||
ResTagTreeVO resTagTreeVO = new ResTagTreeVO(); | |||||
resTagTreeVO.setTagLevel(tagTreeDTO.getTagLevel()); | |||||
resTagTreeVO.setTagName(tagTreeDTO.getTagName()); | |||||
resTagTreeVO.setParentCode(tagTreeDTO.getParentCode()); | |||||
resTagTreeVO.setTagCode(tagTreeDTO.getTagCode()); | |||||
resTagTreeVO.setUnionCode(tagTreeDTO.getTagName() + "##" + tagTreeDTO.getTagCode()); | |||||
if (CollectionUtils.isNotEmpty(tagTreeDTO.getChildren())) { | |||||
resTagTreeVO.setChildren(toTagTreeVOList(tagTreeDTO.getChildren())); | |||||
} | |||||
resTagTreeVOList.add(resTagTreeVO); | |||||
} | |||||
return resTagTreeVOList; | |||||
} | |||||
} |
@@ -0,0 +1,53 @@ | |||||
package com.ningdatech.pmapi.meta.constant; | |||||
import lombok.AllArgsConstructor; | |||||
import lombok.Getter; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/21 下午6:08 | |||||
*/ | |||||
@AllArgsConstructor | |||||
@Getter | |||||
public enum DictAllTypeEnum { | |||||
// 政治面貌 | |||||
POLITICAL("political"), | |||||
// 专家来源 | |||||
EXPERT_SOURCE("expert_source"), | |||||
// 学历 | |||||
EDU("edu"), | |||||
// 学位 | |||||
DEGREE("degree"), | |||||
// 在职状态 | |||||
JOB_STATUS("job_status"), | |||||
// 行政职级 | |||||
ADMINISTRATIVE_RANK("administrative_rank"), | |||||
// 内外围(专家类型) | |||||
EXPERT_TYPE("expert_type"), | |||||
// 单位类型 | |||||
COMPANY_ATTRIBUTE("company_attribute"), | |||||
// 职称级别 | |||||
TITLE_LEVEL("title_level"), | |||||
// 通知类型 | |||||
NOTICE_TYPE("notice_type"), | |||||
// 会议类型 | |||||
MEETING_TYPE("meeting_type"); | |||||
private final String key; | |||||
public static boolean contains(String key) { | |||||
if (StringUtils.isBlank(key)) { | |||||
return false; | |||||
} | |||||
for (DictAllTypeEnum typeEnum : DictAllTypeEnum.values()) { | |||||
if (typeEnum.key.equals(key)) { | |||||
return true; | |||||
} | |||||
} | |||||
return false; | |||||
} | |||||
} |
@@ -0,0 +1,70 @@ | |||||
package com.ningdatech.pmapi.meta.constant; | |||||
import lombok.AllArgsConstructor; | |||||
import lombok.Getter; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/21 下午6:08 | |||||
*/ | |||||
@AllArgsConstructor | |||||
@Getter | |||||
public enum DictExpertInfoTypeEnum { | |||||
// 政治面貌 | |||||
POLITICAL("political"), | |||||
// 学历 | |||||
EDU("edu"), | |||||
// 学位 | |||||
DEGREE("degree"), | |||||
// 在职状态 | |||||
JOB_STATUS("job_status"), | |||||
// 行政职级 | |||||
ADMINISTRATIVE_RANK("administrative_rank"), | |||||
// 内外围(专家类型) | |||||
EXPERT_TYPE("expert_type"), | |||||
// 单位类型 | |||||
COMPANY_ATTRIBUTE("company_attribute"), | |||||
// 职称级别 | |||||
TITLE_LEVEL("title_level"), | |||||
// 推荐方式 | |||||
RECOMMENDED_WAY("recommended_way"); | |||||
private final String key; | |||||
public static List<String> getAll() { | |||||
List<String> dictionaryList = new ArrayList<>(); | |||||
DictExpertInfoTypeEnum[] values = DictExpertInfoTypeEnum.values(); | |||||
for (DictExpertInfoTypeEnum typeEnum : values) { | |||||
dictionaryList.add(typeEnum.key); | |||||
} | |||||
return dictionaryList; | |||||
} | |||||
public static boolean contains(String key) { | |||||
if (StringUtils.isBlank(key)) { | |||||
return false; | |||||
} | |||||
for (DictExpertInfoTypeEnum typeEnum : DictExpertInfoTypeEnum.values()) { | |||||
if (typeEnum.key.equals(key)) { | |||||
return true; | |||||
} | |||||
} | |||||
return false; | |||||
} | |||||
public static DictExpertInfoTypeEnum of(String key) { | |||||
for (DictExpertInfoTypeEnum statusEnum : DictExpertInfoTypeEnum.values()) { | |||||
if (statusEnum.key.equals(key)) { | |||||
return statusEnum; | |||||
} | |||||
} | |||||
throw new IllegalArgumentException(String.format("Illegal DictionaryExpertInfoTypeEnum = %s", key)); | |||||
} | |||||
} |
@@ -0,0 +1,51 @@ | |||||
package com.ningdatech.pmapi.meta.constant; | |||||
import lombok.AllArgsConstructor; | |||||
import lombok.Getter; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 上午11:13 | |||||
*/ | |||||
@AllArgsConstructor | |||||
@Getter | |||||
public enum ExpertTagEnum { | |||||
// 专家来源 | |||||
EXPERT_SOURCE("expert_source"), | |||||
// 擅长方向 | |||||
GOOD_AT("good_at"), | |||||
// 技术专长 | |||||
TECHNICAL_EXPERTISE("technical_expertise"), | |||||
// 行业领域 | |||||
INDUSTRY_SECTOR("industry_sector"), | |||||
// 其他 | |||||
OTHER("other"); | |||||
private final String key; | |||||
public static List<String> getAll() { | |||||
List<String> tagList = new ArrayList<>(); | |||||
ExpertTagEnum[] values = ExpertTagEnum.values(); | |||||
for (ExpertTagEnum fieldEnum : values) { | |||||
tagList.add(fieldEnum.key); | |||||
} | |||||
return tagList; | |||||
} | |||||
public static boolean contains(String key) { | |||||
if (StringUtils.isBlank(key)) { | |||||
return false; | |||||
} | |||||
for (ExpertTagEnum fieldEnum : ExpertTagEnum.values()) { | |||||
if (fieldEnum.key.equals(key)) { | |||||
return true; | |||||
} | |||||
} | |||||
return false; | |||||
} | |||||
} |
@@ -0,0 +1,21 @@ | |||||
package com.ningdatech.pmapi.meta.constant; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/8/27 下午1:49 | |||||
*/ | |||||
public class TagConst { | |||||
private TagConst() { | |||||
} | |||||
/** | |||||
* 标签类型顶级时 parent_code 为 -1 | |||||
*/ | |||||
public static final String TAG_ROOT_PARENT_CODE = "-1"; | |||||
public static final Long TAG_ROOT_LEVEL = 1L; | |||||
public static final String TAG_CREATOR = "管理员"; | |||||
} |
@@ -0,0 +1,62 @@ | |||||
package com.ningdatech.pmapi.meta.controller; | |||||
import com.ningdatech.pmapi.meta.manage.MetaManage; | |||||
import com.ningdatech.pmapi.meta.model.po.ReqAddDictionaryPO; | |||||
import com.ningdatech.pmapi.meta.model.po.ReqDictionaryListPO; | |||||
import com.ningdatech.pmapi.meta.model.vo.ResDictionaryListVO; | |||||
import com.ningdatech.pmapi.meta.validate.DictionaryRequestValidator; | |||||
import io.swagger.annotations.Api; | |||||
import io.swagger.annotations.ApiOperation; | |||||
import lombok.RequiredArgsConstructor; | |||||
import org.springframework.validation.annotation.Validated; | |||||
import org.springframework.web.bind.annotation.*; | |||||
import javax.validation.Valid; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author liuxinxin | |||||
* @since 2022-07-21 | |||||
*/ | |||||
@RestController | |||||
@Validated | |||||
@RequiredArgsConstructor | |||||
@RequestMapping("/api/v1/meta/dictionary") | |||||
@Api(tags = "基础数据接口") | |||||
public class MetaDictionaryManageController { | |||||
// private final IMetaDictionaryManageService metaDictionaryManageService; | |||||
private final MetaManage metaManage; | |||||
@PostMapping("/list") | |||||
@ApiOperation("字典筛选数据返回") | |||||
public List<ResDictionaryListVO> expertDictList(@RequestBody ReqDictionaryListPO request) { | |||||
DictionaryRequestValidator.dictionaryRequestValidator(request); | |||||
return metaManage.getDictionaryList(request); | |||||
} | |||||
@PostMapping("/common/list") | |||||
@ApiOperation("通用字典筛选数据返回") | |||||
public List<ResDictionaryListVO> commonDictList(@RequestBody ReqDictionaryListPO request) { | |||||
DictionaryRequestValidator.dictionaryRequestValidator(request); | |||||
return metaManage.commonDictList(request); | |||||
} | |||||
@PostMapping("/add/dictionary") | |||||
@ApiOperation("添加字典值") | |||||
public void addDictionary(@Valid @RequestBody ReqAddDictionaryPO reqAddDictionaryPO) { | |||||
metaManage.addDictionary(reqAddDictionaryPO); | |||||
} | |||||
@PostMapping("/remove/dictionary/{dictionaryCode}") | |||||
@ApiOperation("删除字典值") | |||||
public void removeDictionary(@PathVariable String dictionaryCode) { | |||||
metaManage.removeDictionary(dictionaryCode); | |||||
} | |||||
} |
@@ -0,0 +1,79 @@ | |||||
package com.ningdatech.pmapi.meta.controller; | |||||
import com.ningdatech.pmapi.meta.manage.MetaManage; | |||||
import com.ningdatech.pmapi.meta.model.po.ReqAddTagTypePO; | |||||
import com.ningdatech.pmapi.meta.model.po.ReqTagListPO; | |||||
import com.ningdatech.pmapi.meta.model.po.ReqTagQueryPO; | |||||
import com.ningdatech.pmapi.meta.model.vo.ResTagListVO; | |||||
import com.ningdatech.pmapi.meta.model.vo.ResTagTreeVO; | |||||
import com.ningdatech.pmapi.meta.model.vo.ResTagTypeVO; | |||||
import com.ningdatech.pmapi.meta.validate.TagListRequestValidator; | |||||
import io.swagger.annotations.Api; | |||||
import io.swagger.annotations.ApiOperation; | |||||
import lombok.RequiredArgsConstructor; | |||||
import org.springframework.validation.annotation.Validated; | |||||
import org.springframework.web.bind.annotation.*; | |||||
import javax.servlet.http.HttpServletResponse; | |||||
import javax.validation.Valid; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author liuxinxin | |||||
* @since 2022-07-21 | |||||
*/ | |||||
@RestController | |||||
@Validated | |||||
@RequiredArgsConstructor | |||||
@RequestMapping("/api/v1/meta") | |||||
@Api(value = "MetaController", tags = "基础数据接口") | |||||
public class MetaTagManageController { | |||||
/** | |||||
* 专家标签的缓存时间设置为5分钟,单位秒 | |||||
*/ | |||||
private static final Long MAX_AGE = 5 * 60L; | |||||
/** | |||||
* max-age=86400 | |||||
*/ | |||||
private static final String MAX_AGE_STR = "max-age=" + MAX_AGE; | |||||
private final MetaManage metaManage; | |||||
@PostMapping("/tag") | |||||
@ApiOperation("获取专家标签的树状结构") | |||||
public List<ResTagTreeVO> getRegionTree(HttpServletResponse response, @RequestBody ReqTagListPO request) { | |||||
response.setHeader("Cache-Control", MAX_AGE_STR); | |||||
TagListRequestValidator.tagListRequestValidator(request); | |||||
return metaManage.getTagTree(request); | |||||
} | |||||
@PostMapping("/tag/query") | |||||
@ApiOperation("标签查询接口") | |||||
public List<ResTagListVO> tagQuery(@Valid @RequestBody ReqTagQueryPO reqTagQueryPO) { | |||||
return metaManage.tagQuery(reqTagQueryPO); | |||||
} | |||||
@PostMapping("/tag-tyoe/list") | |||||
@ApiOperation("获取标签分类列表") | |||||
public List<ResTagTypeVO> tagTypeList() { | |||||
return metaManage.tagTypeList(); | |||||
} | |||||
@PostMapping("/add/tag-type") | |||||
@ApiOperation("新增标签分类") | |||||
public void addTagType(@Valid @RequestBody ReqAddTagTypePO request) { | |||||
metaManage.addTagType(request); | |||||
} | |||||
@PostMapping("/remove/tag/{tagCode}") | |||||
@ApiOperation("删除标签") | |||||
public void removeTagName(@PathVariable String tagCode) { | |||||
metaManage.removeTagName(tagCode); | |||||
} | |||||
} |
@@ -0,0 +1,49 @@ | |||||
package com.ningdatech.pmapi.meta.helper; | |||||
import com.ningdatech.pmapi.meta.constant.DictAllTypeEnum; | |||||
import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/12/22 上午11:03 | |||||
*/ | |||||
public interface DictionaryCache { | |||||
/** | |||||
* 根据字典类型枚举 获取 字典列表 | |||||
* | |||||
* @param dictionaryType | |||||
* @return | |||||
*/ | |||||
List<DictionaryDTO> getDictionaryListByDictionaryType(DictAllTypeEnum dictionaryType); | |||||
/** | |||||
* 根据字典类型 获取 字典列表 | |||||
* | |||||
* @param dictionaryType | |||||
* @return | |||||
*/ | |||||
List<DictionaryDTO> getDictionaryListByDictionaryType(String dictionaryType); | |||||
/** | |||||
* 根据字典类型、字典编码 获取 字典实体 | |||||
* | |||||
* @param dictionaryType | |||||
* @param code | |||||
* @return | |||||
*/ | |||||
DictionaryDTO getDictionaryByDictionaryType(DictAllTypeEnum dictionaryType, String code); | |||||
/** | |||||
* 根据字典编码 获取 字典实体 | |||||
* | |||||
* @param dictionaryCode | |||||
* @return | |||||
*/ | |||||
DictionaryDTO getByCode(String dictionaryCode); | |||||
} |
@@ -0,0 +1,55 @@ | |||||
package com.ningdatech.pmapi.meta.helper; | |||||
import com.ningdatech.pmapi.meta.model.dto.TagDTO; | |||||
import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/12/22 上午11:56 | |||||
*/ | |||||
public interface TagCache { | |||||
/** | |||||
* @param level 最多几级标签 | |||||
* @param rootTagCode 根标签类型及对应的字段类型 | |||||
* @return | |||||
*/ | |||||
TagTreeDTO getTagTreeDTO(int level, String rootTagCode); | |||||
/** | |||||
* 根据标签编码获取 实体类 | |||||
* | |||||
* @param tagCode | |||||
* @return | |||||
*/ | |||||
TagDTO getByTagCode(String tagCode); | |||||
/** | |||||
* 导入原专家库数据使用 | |||||
* | |||||
* @return | |||||
*/ | |||||
Map<String, TagDTO> getNameTagDtoMap(); | |||||
/** | |||||
* 获取所有子节点包含当前节点 | |||||
* | |||||
* @param code 标签编码 | |||||
* @return | |||||
*/ | |||||
List<TagTreeDTO> listChildren(String code); | |||||
/** | |||||
* 获取所有子节点包含当前节点的编码 | |||||
* | |||||
* @param code 标签编码 | |||||
* @return | |||||
*/ | |||||
List<String> listChildrenCodes(String code); | |||||
} |
@@ -0,0 +1,54 @@ | |||||
package com.ningdatech.pmapi.meta.helper.basic; | |||||
import com.github.benmanes.caffeine.cache.Caffeine; | |||||
import com.github.benmanes.caffeine.cache.LoadingCache; | |||||
import com.ningdatech.pmapi.meta.service.IMetaDictionaryService; | |||||
import com.ningdatech.pmapi.meta.constant.DictAllTypeEnum; | |||||
import com.ningdatech.pmapi.meta.helper.DictionaryCache; | |||||
import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; | |||||
import org.springframework.beans.factory.InitializingBean; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.concurrent.ConcurrentHashMap; | |||||
import java.util.concurrent.TimeUnit; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/12/22 上午11:03 | |||||
*/ | |||||
public abstract class AbstractDictionaryCache implements InitializingBean, DictionaryCache { | |||||
@Autowired | |||||
private IMetaDictionaryService iMetaDictionaryService; | |||||
protected Map<String, DictionaryDTO> dictionaryMap; | |||||
protected LoadingCache<String, List<DictionaryDTO>> dictionaryCacheHelper; | |||||
@Override | |||||
public void afterPropertiesSet() { | |||||
dictionaryCacheHelper = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) | |||||
.refreshAfterWrite(5, TimeUnit.MINUTES).build(key -> { | |||||
List<DictionaryDTO> dictionaryDTOList = iMetaDictionaryService.queryAll(); | |||||
dictionaryMap = buildCateMap(dictionaryDTOList); | |||||
Map<String, List<DictionaryDTO>> dictionaryTypeListMap = dictionaryDTOList.stream().collect(Collectors.groupingBy(DictionaryDTO::getDictionaryType)); | |||||
return dictionaryTypeListMap.get(key); | |||||
}); | |||||
warmUp(); | |||||
} | |||||
private Map<String, DictionaryDTO> buildCateMap(List<DictionaryDTO> dictionaryDTOList) { | |||||
Map<String, DictionaryDTO> dictionaryDtoMap = new ConcurrentHashMap<>(128); | |||||
dictionaryDTOList.forEach(dictionaryDTO -> dictionaryDtoMap.put(dictionaryDTO.getDictionaryCode(), dictionaryDTO)); | |||||
return dictionaryDtoMap; | |||||
} | |||||
private void warmUp() { | |||||
for (DictAllTypeEnum typeEnum : DictAllTypeEnum.values()) { | |||||
dictionaryCacheHelper.get(typeEnum.getKey()); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,97 @@ | |||||
package com.ningdatech.pmapi.meta.helper.basic; | |||||
import cn.hutool.core.lang.Assert; | |||||
import com.github.benmanes.caffeine.cache.Caffeine; | |||||
import com.github.benmanes.caffeine.cache.LoadingCache; | |||||
import com.ningdatech.pmapi.meta.assembler.MetaTagAssembler; | |||||
import com.ningdatech.pmapi.meta.helper.TagCache; | |||||
import com.ningdatech.pmapi.meta.model.dto.TagDTO; | |||||
import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; | |||||
import com.ningdatech.pmapi.meta.service.IMetaTagService; | |||||
import org.apache.commons.collections4.CollectionUtils; | |||||
import org.springframework.beans.factory.InitializingBean; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import java.util.*; | |||||
import java.util.concurrent.ConcurrentHashMap; | |||||
import java.util.concurrent.TimeUnit; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/12/22 上午11:56 | |||||
*/ | |||||
public abstract class AbstractTagsCache implements InitializingBean, TagCache { | |||||
protected static final int MAX_LEVEL = 4; | |||||
@Autowired | |||||
private IMetaTagService iMetaTagService; | |||||
protected LoadingCache<String, List<TagTreeDTO>> tagsCache; | |||||
protected Map<String, TagDTO> tagDtoMap; | |||||
@Override | |||||
public void afterPropertiesSet() { | |||||
tagsCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) | |||||
.refreshAfterWrite(5, TimeUnit.MINUTES) | |||||
.build(key -> { | |||||
// 查询全部 | |||||
List<TagDTO> tagDTOList = iMetaTagService.queryAll(); | |||||
// TODO 临时关闭校验 | |||||
// Assert.isTrue(CollectionUtils.isNotEmpty(tagDTOList), "MetaTags queryAll is Empty"); | |||||
tagDtoMap = buildCateMap(tagDTOList); | |||||
List<TagDTO> tagInLevel = tagDTOList.stream().filter(tagDto -> { | |||||
// 只过滤出小于等于level的tag | |||||
if (Objects.isNull(tagDto.getTagLevel())) { | |||||
return false; | |||||
} | |||||
return Integer.parseInt(key) >= tagDto.getTagLevel(); | |||||
}).collect(Collectors.toList()); | |||||
List<TagTreeDTO> treeDtos = MetaTagAssembler.toTagTreeDTOList(tagInLevel); | |||||
return toTreeStructure(treeDtos); | |||||
}); | |||||
warmUp(); | |||||
} | |||||
private Map<String, TagDTO> buildCateMap(List<TagDTO> tagDTOList) { | |||||
Map<String, TagDTO> tagDtoMapTemp = new ConcurrentHashMap<>(1024); | |||||
tagDTOList.forEach(tagDTO -> tagDtoMapTemp.put(tagDTO.getTagCode(), tagDTO)); | |||||
return tagDtoMapTemp; | |||||
} | |||||
private List<TagTreeDTO> toTreeStructure(List<TagTreeDTO> rootList) { | |||||
List<TagTreeDTO> nodeList = new ArrayList<>(); | |||||
for (TagTreeDTO tagTreeDTO : rootList) { | |||||
if ("-1".equals(tagTreeDTO.getParentCode()) || Objects.isNull(tagTreeDTO.getParentCode())) { | |||||
nodeList.add(tagTreeDTO); | |||||
} | |||||
tagTreeDTO.setChildren(getChildren(tagTreeDTO.getTagCode(), rootList)); | |||||
} | |||||
return nodeList; | |||||
} | |||||
public void warmUp() { | |||||
for (int level = 1; level <= MAX_LEVEL; level++) { | |||||
tagsCache.get(level + ""); | |||||
} | |||||
} | |||||
protected List<TagTreeDTO> getChildren(String tagCode, List<TagTreeDTO> list) { | |||||
List<TagTreeDTO> childList = new ArrayList<>(); | |||||
for (TagTreeDTO tagTreeDTO : list) { | |||||
if (tagCode.equals(tagTreeDTO.getParentCode())) { | |||||
childList.add(tagTreeDTO); | |||||
} | |||||
} | |||||
for (TagTreeDTO tagTreeDTO : childList) { | |||||
tagTreeDTO.setChildren(getChildren(tagTreeDTO.getTagCode(), list)); | |||||
} | |||||
if (CollectionUtils.isEmpty(childList)) { | |||||
return Collections.emptyList(); | |||||
} | |||||
return childList; | |||||
} | |||||
} |
@@ -0,0 +1,40 @@ | |||||
package com.ningdatech.pmapi.meta.helper.impl; | |||||
import com.ningdatech.pmapi.meta.constant.DictAllTypeEnum; | |||||
import com.ningdatech.pmapi.meta.helper.basic.AbstractDictionaryCache; | |||||
import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; | |||||
import org.springframework.stereotype.Component; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 上午10:47 | |||||
*/ | |||||
@Component | |||||
public class DictionaryCacheImpl extends AbstractDictionaryCache { | |||||
@Override | |||||
public List<DictionaryDTO> getDictionaryListByDictionaryType(DictAllTypeEnum dictionaryType) { | |||||
return dictionaryCacheHelper.get(dictionaryType.getKey()); | |||||
} | |||||
@Override | |||||
public List<DictionaryDTO> getDictionaryListByDictionaryType(String dictionaryType) { | |||||
return dictionaryCacheHelper.get(dictionaryType); | |||||
} | |||||
@Override | |||||
public DictionaryDTO getDictionaryByDictionaryType(DictAllTypeEnum dictionaryType, String code) { | |||||
return Objects.requireNonNull(dictionaryCacheHelper.get(dictionaryType.getKey())) | |||||
.stream().filter(w -> w.getDictionaryCode().equals(code)) | |||||
.findFirst().orElse(null); | |||||
} | |||||
@Override | |||||
public DictionaryDTO getByCode(String dictionaryCode) { | |||||
return dictionaryMap.get(dictionaryCode); | |||||
} | |||||
} |
@@ -0,0 +1,105 @@ | |||||
package com.ningdatech.pmapi.meta.helper.impl; | |||||
import cn.hutool.core.bean.BeanUtil; | |||||
import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.basic.util.CollUtils; | |||||
import com.ningdatech.pmapi.meta.helper.basic.AbstractTagsCache; | |||||
import com.ningdatech.pmapi.meta.model.dto.TagDTO; | |||||
import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.stereotype.Component; | |||||
import java.util.ArrayList; | |||||
import java.util.HashMap; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 上午9:51 | |||||
* 标签树 | |||||
*/ | |||||
@Slf4j | |||||
@Component | |||||
public class TagsCacheImpl extends AbstractTagsCache { | |||||
@Override | |||||
public TagTreeDTO getTagTreeDTO(int level, String rootTagCode) { | |||||
List<TagTreeDTO> tagTreeDtos = tagsCache.get(level + ""); | |||||
for (TagTreeDTO tagTreeDTO : tagTreeDtos) { | |||||
if (tagTreeDTO.getTagCode().equals(rootTagCode)) { | |||||
return tagTreeDTO; | |||||
} | |||||
} | |||||
throw new BizException("rootTagCode not exist"); | |||||
} | |||||
@Override | |||||
public TagDTO getByTagCode(String tagCode) { | |||||
return tagDtoMap.get(tagCode); | |||||
} | |||||
/** | |||||
* 导入原专家库数据使用 | |||||
* | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public Map<String, TagDTO> getNameTagDtoMap() { | |||||
Map<String, TagDTO> nameTagDtoMap = new HashMap<>(1024); | |||||
for (String key : tagDtoMap.keySet()) { | |||||
nameTagDtoMap.put(tagDtoMap.get(key).getTagName(), tagDtoMap.get(key)); | |||||
} | |||||
return nameTagDtoMap; | |||||
} | |||||
/** | |||||
* 获取所有子节点包含当前节点 | |||||
* | |||||
* @param code 标签编码 | |||||
* @return java.util.List<com.ningdatech.emapi.meta.entity.dto.TagTreeDTO> | |||||
* @author WendyYang | |||||
**/ | |||||
@Override | |||||
public List<TagTreeDTO> listChildren(String code) { | |||||
List<TagTreeDTO> allTree = tagsCache.get(String.valueOf(MAX_LEVEL)); | |||||
assert allTree != null; | |||||
List<TagTreeDTO> children = getChildren(code, allTree); | |||||
TagDTO tagDTO = tagDtoMap.get(code); | |||||
TagTreeDTO rootNode = BeanUtil.copyProperties(tagDTO, TagTreeDTO.class); | |||||
rootNode.setChildren(children); | |||||
return treeToList(rootNode); | |||||
} | |||||
/** | |||||
* 获取所有子节点包含当前节点的编码 | |||||
* | |||||
* @param code 标签编码 | |||||
* @return java.util.List<com.ningdatech.emapi.meta.entity.dto.TagTreeDTO> | |||||
* @author WendyYang | |||||
**/ | |||||
@Override | |||||
public List<String> listChildrenCodes(String code) { | |||||
return CollUtils.fieldList(listChildren(code), TagTreeDTO::getTagCode); | |||||
} | |||||
/** | |||||
* tree -> list | |||||
* | |||||
* @param tagTreeDTO 树节点 | |||||
* @return java.util.List<com.ningdatech.emapi.meta.entity.dto.TagTreeDTO> | |||||
* @author WendyYang | |||||
**/ | |||||
private List<TagTreeDTO> treeToList(TagTreeDTO tagTreeDTO) { | |||||
List<TagTreeDTO> result = new ArrayList<>(); | |||||
result.add(tagTreeDTO); | |||||
if (tagTreeDTO.getChildren() != null && tagTreeDTO.getChildren().size() > 0) { | |||||
tagTreeDTO.getChildren().forEach(node -> { | |||||
result.addAll(treeToList(node)); | |||||
}); | |||||
} | |||||
return result; | |||||
} | |||||
} |
@@ -0,0 +1,283 @@ | |||||
package com.ningdatech.pmapi.meta.manage; | |||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.basic.util.CollUtils; | |||||
import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; | |||||
import com.ningdatech.pmapi.common.util.BizUtils; | |||||
import com.ningdatech.pmapi.meta.assembler.MetaDictionaryAssembler; | |||||
import com.ningdatech.pmapi.meta.assembler.MetaTagAssembler; | |||||
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; | |||||
import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; | |||||
import com.ningdatech.pmapi.meta.constant.TagConst; | |||||
import com.ningdatech.pmapi.meta.helper.DictionaryCache; | |||||
import com.ningdatech.pmapi.meta.helper.TagCache; | |||||
import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; | |||||
import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; | |||||
import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; | |||||
import com.ningdatech.pmapi.meta.model.entity.ExpertTag; | |||||
import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; | |||||
import com.ningdatech.pmapi.meta.model.entity.MetaTag; | |||||
import com.ningdatech.pmapi.meta.model.po.*; | |||||
import com.ningdatech.pmapi.meta.model.vo.*; | |||||
import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; | |||||
import com.ningdatech.pmapi.meta.service.IExpertTagService; | |||||
import com.ningdatech.pmapi.meta.service.IMetaDictionaryService; | |||||
import com.ningdatech.pmapi.meta.service.IMetaTagService; | |||||
import lombok.RequiredArgsConstructor; | |||||
import org.springframework.stereotype.Component; | |||||
import org.springframework.transaction.annotation.Transactional; | |||||
import java.time.LocalDateTime; | |||||
import java.util.*; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2023/2/22 下午2:34 | |||||
*/ | |||||
@Component | |||||
@RequiredArgsConstructor | |||||
public class MetaManage { | |||||
private final DictionaryCache dictionaryCache; | |||||
private final TagCache tagCache; | |||||
private final IMetaDictionaryService metaDictionaryManageService; | |||||
private final IExpertDictionaryService iExpertDictionaryService; | |||||
private final IMetaTagService iMetaTagManageService; | |||||
private final IExpertTagService iExpertTagService; | |||||
public List<ResDictionaryListVO> getDictionaryList(ReqDictionaryListPO request) { | |||||
List<String> dictionaryTypeList = request.getDictionaryTypeList(); | |||||
if (CollectionUtils.isEmpty(dictionaryTypeList)) { | |||||
dictionaryTypeList = DictExpertInfoTypeEnum.getAll(); | |||||
} | |||||
List<ResDictionaryListVO> resDictionaryListVos = new ArrayList<>(); | |||||
for (String dictionaryType : dictionaryTypeList) { | |||||
ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); | |||||
resDictionaryListVO.setDictionaryName(dictionaryType); | |||||
List<DictionaryDTO> dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); | |||||
List<ResDictionaryVO> resDictionaryVOList = dictionaryList.stream() | |||||
.map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); | |||||
resDictionaryListVO.setDictionaryList(resDictionaryVOList); | |||||
resDictionaryListVos.add(resDictionaryListVO); | |||||
} | |||||
return resDictionaryListVos; | |||||
} | |||||
public List<ResDictionaryListVO> commonDictList(ReqDictionaryListPO request) { | |||||
List<ResDictionaryListVO> result = new ArrayList<>(); | |||||
if (request.getAllDict()) { | |||||
Map<String, List<MetaDictionary>> groupByType = CollUtils.group(metaDictionaryManageService.list(), MetaDictionary::getDictionaryType); | |||||
groupByType.forEach((k, v) -> { | |||||
ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); | |||||
resDictionaryListVO.setDictionaryName(k); | |||||
List<ResDictionaryVO> resDictionaryVOList = v.stream() | |||||
.map(w -> { | |||||
ResDictionaryVO vo = new ResDictionaryVO(); | |||||
vo.setDescribe(w.getDictionaryDescribe()); | |||||
vo.setDictionaryCode(w.getDictionaryCode()); | |||||
vo.setDictionaryType(w.getDictionaryType()); | |||||
vo.setName(w.getDictionaryName()); | |||||
vo.setReadonly(w.getReadonly()); | |||||
vo.setSortValue(w.getSortValue()); | |||||
return vo; | |||||
}).collect(Collectors.toList()); | |||||
resDictionaryListVO.setDictionaryList(resDictionaryVOList); | |||||
result.add(resDictionaryListVO); | |||||
}); | |||||
} else { | |||||
List<String> dictionaryTypeList = request.getDictionaryTypeList(); | |||||
for (String dictionaryType : dictionaryTypeList) { | |||||
ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); | |||||
resDictionaryListVO.setDictionaryName(dictionaryType); | |||||
List<DictionaryDTO> dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); | |||||
List<ResDictionaryVO> resDictionaryVOList = dictionaryList.stream() | |||||
.map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); | |||||
resDictionaryListVO.setDictionaryList(resDictionaryVOList); | |||||
result.add(resDictionaryListVO); | |||||
} | |||||
} | |||||
return result; | |||||
} | |||||
public List<ResTagTreeVO> getTagTree(ReqTagListPO request) { | |||||
List<String> rootTagCodeList = request.getRootTagCodeList(); | |||||
if (CollectionUtils.isEmpty(rootTagCodeList)) { | |||||
rootTagCodeList = ExpertTagEnum.getAll(); | |||||
} | |||||
List<TagTreeDTO> tagTreeDTOList = new ArrayList<>(); | |||||
for (String rootTagCode : rootTagCodeList) { | |||||
TagTreeDTO tagTreeDTO = tagCache.getTagTreeDTO(4, rootTagCode); | |||||
if (Objects.nonNull(tagTreeDTO)) { | |||||
tagTreeDTOList.add(tagTreeDTO); | |||||
} | |||||
} | |||||
return MetaTagAssembler.toTagTreeVOList(tagTreeDTOList); | |||||
} | |||||
/** | |||||
* 专家管理员才能调用 | |||||
* | |||||
* @param reqAddDictionaryPO | |||||
*/ | |||||
@Transactional(rollbackFor = Exception.class) | |||||
public void addDictionary(ReqAddDictionaryPO reqAddDictionaryPO) { | |||||
String dictionaryType = reqAddDictionaryPO.getDictionaryType(); | |||||
boolean contains = DictExpertInfoTypeEnum.contains(dictionaryType); | |||||
if (!contains) { | |||||
throw BizException.wrap("无效的专家字典类型:%s", dictionaryType); | |||||
} | |||||
String name = reqAddDictionaryPO.getName(); | |||||
Integer sortValue = reqAddDictionaryPO.getSortValue(); | |||||
LambdaQueryWrapper<MetaDictionary> eq = Wrappers.lambdaQuery(MetaDictionary.class).eq(MetaDictionary::getDictionaryType, dictionaryType); | |||||
List<MetaDictionary> dictionaryManageList = metaDictionaryManageService.list(eq); | |||||
MetaDictionary saveRecord = new MetaDictionary(); | |||||
saveRecord.setCreateOn(LocalDateTime.now()); | |||||
saveRecord.setDictionaryName(name); | |||||
saveRecord.setUpdateOn(LocalDateTime.now()); | |||||
saveRecord.setDictionaryCode(BizUtils.uuid32()); | |||||
saveRecord.setDictionaryType(dictionaryType); | |||||
saveRecord.setReadonly(BoolDisplayEnum.N.name()); | |||||
saveRecord.setSortValue(sortValue); | |||||
List<MetaDictionary> saveRecordList = new ArrayList<>(); | |||||
saveRecordList.add(saveRecord); | |||||
for (MetaDictionary metaDictionary : dictionaryManageList) { | |||||
if (metaDictionary.getSortValue() >= sortValue) { | |||||
metaDictionary.setSortValue(metaDictionary.getSortValue() + 1); | |||||
} | |||||
saveRecordList.add(metaDictionary); | |||||
} | |||||
boolean remove = metaDictionaryManageService | |||||
.remove(Wrappers.lambdaQuery(MetaDictionary.class).eq(MetaDictionary::getDictionaryType, dictionaryType)); | |||||
if (remove) { | |||||
metaDictionaryManageService.saveBatch(saveRecordList); | |||||
} | |||||
} | |||||
public void removeDictionary(String dictionaryCode) { | |||||
LambdaUpdateWrapper<MetaDictionary> eq = Wrappers.lambdaUpdate(MetaDictionary.class) | |||||
.eq(MetaDictionary::getDictionaryCode, dictionaryCode); | |||||
MetaDictionary one = metaDictionaryManageService.getOne(eq); | |||||
if (Objects.isNull(one)) { | |||||
throw BizException.wrap("字典值不存在"); | |||||
} | |||||
if (BoolDisplayEnum.judgeBoolean(one.getReadonly())) { | |||||
throw BizException.wrap("内置字典值无法删除"); | |||||
} | |||||
List<ExpertDictionary> expertDictionaryList = iExpertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class).eq(ExpertDictionary::getDictionaryCode, dictionaryCode)); | |||||
if (CollUtil.isNotEmpty(expertDictionaryList)) { | |||||
throw BizException.wrap("该字典值已被使用无法删除"); | |||||
} | |||||
metaDictionaryManageService.removeById(one); | |||||
} | |||||
public void addTagType(ReqAddTagTypePO request) { | |||||
String tagName = request.getTagName(); | |||||
LambdaQueryWrapper<MetaTag> in = Wrappers.lambdaQuery(MetaTag.class) | |||||
.in(MetaTag::getTagName, tagName) | |||||
.in(MetaTag::getParentCode, TagConst.TAG_ROOT_PARENT_CODE); | |||||
List<MetaTag> list = iMetaTagManageService.list(in); | |||||
if (CollectionUtils.isNotEmpty(list)) { | |||||
throw BizException.wrap("该标签类型已存在"); | |||||
} | |||||
MetaTag saveRecord = new MetaTag(); | |||||
saveRecord.setCreateOn(LocalDateTime.now()); | |||||
saveRecord.setUpdateOn(LocalDateTime.now()); | |||||
saveRecord.setParentCode(TagConst.TAG_ROOT_PARENT_CODE); | |||||
saveRecord.setTagCode(BizUtils.uuid32()); | |||||
saveRecord.setTagName(tagName); | |||||
saveRecord.setTagLevel(TagConst.TAG_ROOT_LEVEL); | |||||
iMetaTagManageService.save(saveRecord); | |||||
} | |||||
public void removeTagName(String tagCode) { | |||||
LambdaQueryWrapper<ExpertTag> eq = Wrappers.lambdaQuery(ExpertTag.class) | |||||
.eq(ExpertTag::getTagCode, tagCode); | |||||
List<ExpertTag> expertTagList = iExpertTagService.list(eq); | |||||
if (CollectionUtils.isNotEmpty(expertTagList)) { | |||||
throw BizException.wrap("该标签正在使用无法删除"); | |||||
} | |||||
LambdaQueryWrapper<MetaTag> queryWrapper = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getParentCode, tagCode); | |||||
List<MetaTag> list = iMetaTagManageService.list(queryWrapper); | |||||
if (CollectionUtils.isNotEmpty(list)) { | |||||
throw BizException.wrap("该标签存在子标签无法删除"); | |||||
} | |||||
LambdaQueryWrapper<MetaTag> metaTagManageLambdaQueryWrapper = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getTagCode, tagCode); | |||||
MetaTag one = iMetaTagManageService.getOne(metaTagManageLambdaQueryWrapper); | |||||
if (Objects.nonNull(one)) { | |||||
iMetaTagManageService.removeById(one); | |||||
} | |||||
} | |||||
public List<ResTagTypeVO> tagTypeList() { | |||||
LambdaQueryWrapper<MetaTag> eq = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getParentCode, TagConst.TAG_ROOT_PARENT_CODE); | |||||
List<MetaTag> list = iMetaTagManageService.list(eq); | |||||
return list.stream().map(r -> { | |||||
ResTagTypeVO resTagTypeVO = new ResTagTypeVO(); | |||||
resTagTypeVO.setTagCode(r.getTagCode()); | |||||
resTagTypeVO.setTagLevel(r.getTagLevel()); | |||||
resTagTypeVO.setTagName(r.getTagName()); | |||||
resTagTypeVO.setTagName(r.getTagName()); | |||||
return resTagTypeVO; | |||||
}).collect(Collectors.toList()); | |||||
} | |||||
public List<ResTagListVO> tagQuery(ReqTagQueryPO reqTagQueryPO) { | |||||
String parentCode = reqTagQueryPO.getParentCode(); | |||||
if (StringUtils.isBlank(parentCode)) { | |||||
parentCode = TagConst.TAG_ROOT_PARENT_CODE; | |||||
} | |||||
LambdaQueryWrapper<MetaTag> eq = Wrappers.lambdaQuery(MetaTag.class) | |||||
.eq(MetaTag::getParentCode, parentCode); | |||||
List<MetaTag> list = iMetaTagManageService.list(eq); | |||||
List<String> tagCodeList = CollUtils.fieldList(list, MetaTag::getTagCode); | |||||
Map<String, List<MetaTag>> hasChildrenMap = new HashMap<>(16); | |||||
Map<String, List<ExpertTag>> useFrequencyMap = new HashMap<>(16); | |||||
if (CollectionUtils.isNotEmpty(tagCodeList)) { | |||||
List<MetaTag> childrenMetaTagList = iMetaTagManageService.list(Wrappers.lambdaQuery(MetaTag.class) | |||||
.in(MetaTag::getParentCode, tagCodeList)); | |||||
hasChildrenMap = CollUtils.group(childrenMetaTagList, MetaTag::getParentCode); | |||||
List<ExpertTag> expertTagList = iExpertTagService.list(Wrappers.lambdaQuery(ExpertTag.class) | |||||
.in(ExpertTag::getTagCode, tagCodeList)); | |||||
useFrequencyMap = CollUtils.group(expertTagList, ExpertTag::getTagCode); | |||||
} | |||||
Map<String, List<MetaTag>> finalHasChildrenMap = hasChildrenMap; | |||||
Map<String, List<ExpertTag>> finalUseFrequencyMap = useFrequencyMap; | |||||
return list.stream().map(r -> { | |||||
ResTagListVO resTagListVO = new ResTagListVO(); | |||||
resTagListVO.setCreateTime(r.getCreateOn()); | |||||
resTagListVO.setCreator(TagConst.TAG_CREATOR); | |||||
resTagListVO.setTagLevel(r.getTagLevel()); | |||||
resTagListVO.setTagCode(r.getTagCode()); | |||||
resTagListVO.setTagName(r.getTagName()); | |||||
List<MetaTag> metaTagManages = finalHasChildrenMap.get(r.getTagCode()); | |||||
if (CollUtil.isNotEmpty(metaTagManages)) { | |||||
resTagListVO.setIsLeaf(false); | |||||
resTagListVO.setHasChildren(true); | |||||
} else { | |||||
resTagListVO.setIsLeaf(true); | |||||
resTagListVO.setHasChildren(false); | |||||
} | |||||
long useFrequency = 0; | |||||
List<ExpertTag> expertTagList = finalUseFrequencyMap.get(r.getTagCode()); | |||||
if (CollUtil.isNotEmpty(expertTagList)) { | |||||
useFrequency = expertTagList.size(); | |||||
} | |||||
resTagListVO.setUseFrequency(useFrequency); | |||||
return resTagListVO; | |||||
}).collect(Collectors.toList()); | |||||
} | |||||
} |
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.meta.mapper; | |||||
import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | |||||
* <p> | |||||
* Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
public interface ExpertDictionaryMapper extends BaseMapper<ExpertDictionary> { | |||||
} |
@@ -0,0 +1,5 @@ | |||||
<?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.meta.mapper.ExpertDictionaryMapper"> | |||||
</mapper> |
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.meta.mapper; | |||||
import com.ningdatech.pmapi.meta.model.entity.ExpertTag; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | |||||
* <p> | |||||
* Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
public interface ExpertTagMapper extends BaseMapper<ExpertTag> { | |||||
} |
@@ -0,0 +1,5 @@ | |||||
<?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.meta.mapper.ExpertTagMapper"> | |||||
</mapper> |
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.meta.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; | |||||
/** | |||||
* <p> | |||||
* Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
public interface MetaDictionaryMapper extends BaseMapper<MetaDictionary> { | |||||
} |
@@ -0,0 +1,5 @@ | |||||
<?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.meta.mapper.MetaDictionaryMapper"> | |||||
</mapper> |
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.meta.mapper; | |||||
import com.ningdatech.pmapi.meta.model.entity.MetaTag; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | |||||
* <p> | |||||
* Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
public interface MetaTagMapper extends BaseMapper<MetaTag> { | |||||
} |
@@ -0,0 +1,5 @@ | |||||
<?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.meta.mapper.MetaTagMapper"> | |||||
</mapper> |
@@ -0,0 +1,36 @@ | |||||
package com.ningdatech.pmapi.meta.model; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import javax.validation.constraints.NotBlank; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/25 下午2:43 | |||||
*/ | |||||
@Data | |||||
@ApiModel("专家区域信息") | |||||
public class ExpertRegionInfo { | |||||
/** | |||||
* 区域编码 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty("区域编码") | |||||
private String regionCode; | |||||
/** | |||||
* 区域级别 | |||||
*/ | |||||
@NotBlank | |||||
@ApiModelProperty("区域级别") | |||||
private Integer regionLevel; | |||||
/** | |||||
* 区域名称 | |||||
*/ | |||||
@ApiModelProperty("区域名称") | |||||
private String regionName; | |||||
} |
@@ -0,0 +1,24 @@ | |||||
package com.ningdatech.pmapi.meta.model.bo; | |||||
import lombok.Data; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/26 下午4:48 | |||||
*/ | |||||
@Data | |||||
public class RegionContainsBO { | |||||
/** | |||||
* 最高级节点级别 | |||||
*/ | |||||
private Integer parentRegionTreeLevel; | |||||
/** | |||||
* 所有区域码列表 | |||||
*/ | |||||
private List<String> containsRegionCodeList; | |||||
} |
@@ -0,0 +1,40 @@ | |||||
package com.ningdatech.pmapi.meta.model.dto; | |||||
import lombok.Data; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 上午10:49 | |||||
*/ | |||||
@Data | |||||
public class DictionaryDTO { | |||||
private String dictionaryType; | |||||
/** | |||||
* 编码 随机数处理 | |||||
*/ | |||||
private String dictionaryCode; | |||||
/** | |||||
* 名称 | |||||
*/ | |||||
private String name; | |||||
/** | |||||
* 描述 | |||||
*/ | |||||
private String describe; | |||||
/** | |||||
* 排序 | |||||
*/ | |||||
private Integer sortValue; | |||||
/** | |||||
* 是否内置,内置不可删除 | |||||
*/ | |||||
private String readonly; | |||||
} | |||||
@@ -0,0 +1,37 @@ | |||||
package com.ningdatech.pmapi.meta.model.dto; | |||||
import lombok.Data; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 上午9:53 | |||||
*/ | |||||
@Data | |||||
public class TagDTO { | |||||
/** | |||||
* 标签 编码 | |||||
* 根标签 擅长方向 good_at | |||||
* 技术专长 technical_expertise | |||||
* 行业领域 industry_sector | |||||
* 其他 other | |||||
*/ | |||||
private String tagCode; | |||||
/** | |||||
* 标签名称 | |||||
*/ | |||||
private String tagName; | |||||
/** | |||||
* 标签级别 | |||||
*/ | |||||
private Long tagLevel; | |||||
/** | |||||
* 标签父级id | |||||
* 当parent_tag_code 为 -1 时为顶级标签 | |||||
*/ | |||||
private String parentCode; | |||||
} |
@@ -0,0 +1,42 @@ | |||||
package com.ningdatech.pmapi.meta.model.dto; | |||||
import lombok.Data; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 上午9:53 | |||||
*/ | |||||
@Data | |||||
public class TagTreeDTO { | |||||
/** | |||||
* 标签 编码 | |||||
* 根标签 擅长方向 good_at | |||||
* 技术专长 technical_expertise | |||||
* 行业领域 industry_sector | |||||
* 其他 other | |||||
*/ | |||||
private String tagCode; | |||||
/** | |||||
* 标签名称 | |||||
*/ | |||||
private String tagName; | |||||
/** | |||||
* 标签级别 | |||||
*/ | |||||
private Long tagLevel; | |||||
/** | |||||
* 标签父级id | |||||
* 当parent_tag_code 为 -1 时为顶级标签 | |||||
*/ | |||||
private String parentCode; | |||||
private List<TagTreeDTO> children; | |||||
} |
@@ -0,0 +1,38 @@ | |||||
package com.ningdatech.pmapi.meta.model.entity; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
import io.swagger.annotations.ApiModel; | |||||
import lombok.Data; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@Data | |||||
@TableName("expert_dictionary") | |||||
@ApiModel(value = "ExpertDictionary对象", description = "") | |||||
public class ExpertDictionary implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@TableId(type = IdType.AUTO) | |||||
private Long id; | |||||
private LocalDateTime createOn; | |||||
private LocalDateTime updateOn; | |||||
private String dictionaryCode; | |||||
private String expertInfoField; | |||||
private Long userId; | |||||
} |
@@ -0,0 +1,38 @@ | |||||
package com.ningdatech.pmapi.meta.model.entity; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
import io.swagger.annotations.ApiModel; | |||||
import lombok.Data; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@TableName("expert_tag") | |||||
@Data | |||||
@ApiModel(value = "ExpertTag对象", description = "") | |||||
public class ExpertTag implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@TableId(type = IdType.AUTO) | |||||
private Long id; | |||||
private LocalDateTime createOn; | |||||
private LocalDateTime updateOn; | |||||
private Long userId; | |||||
private String tagCode; | |||||
private String expertInfoField; | |||||
} |
@@ -0,0 +1,50 @@ | |||||
package com.ningdatech.pmapi.meta.model.entity; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import io.swagger.annotations.ApiModel; | |||||
import lombok.Data; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@Data | |||||
@TableName("meta_dictionary") | |||||
@ApiModel(value = "MetaDictionary对象", description = "") | |||||
public class MetaDictionary implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@TableId(type = IdType.AUTO) | |||||
private Long id; | |||||
private LocalDateTime createOn; | |||||
private LocalDateTime updateOn; | |||||
private String dictionaryType; | |||||
private String dictionaryCode; | |||||
private String dictionaryName; | |||||
private String dictionaryDescribe; | |||||
private Integer sortValue; | |||||
private Long createBy; | |||||
private String readonly; | |||||
private Long updateBy; | |||||
} |
@@ -0,0 +1,43 @@ | |||||
package com.ningdatech.pmapi.meta.model.entity; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
import io.swagger.annotations.ApiModel; | |||||
import lombok.Data; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@Data | |||||
@TableName("meta_tag") | |||||
@ApiModel(value = "MetaTag对象", description = "") | |||||
public class MetaTag implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@TableId(type = IdType.AUTO) | |||||
private Long id; | |||||
private LocalDateTime createOn; | |||||
private LocalDateTime updateOn; | |||||
private String tagName; | |||||
private Long tagLevel; | |||||
private String parentCode; | |||||
private String tagType; | |||||
private String tagCode; | |||||
} |
@@ -0,0 +1,37 @@ | |||||
package com.ningdatech.pmapi.meta.model.po; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import javax.validation.constraints.NotBlank; | |||||
import javax.validation.constraints.NotNull; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/8/25 上午11:10 | |||||
*/ | |||||
@Data | |||||
@ApiModel("新增字典值") | |||||
public class ReqAddDictionaryPO { | |||||
@ApiModelProperty(value = "字典类型") | |||||
@NotBlank | |||||
private String dictionaryType; | |||||
/** | |||||
* 名称 | |||||
*/ | |||||
@ApiModelProperty(value = "名称") | |||||
@NotBlank | |||||
private String name; | |||||
/** | |||||
* 排序 | |||||
*/ | |||||
@ApiModelProperty(value = "排序") | |||||
@NotNull | |||||
private Integer sortValue; | |||||
} |
@@ -0,0 +1,20 @@ | |||||
package com.ningdatech.pmapi.meta.model.po; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import javax.validation.constraints.NotBlank; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/8/27 上午10:17 | |||||
*/ | |||||
@ApiModel(description = "新增标签分类") | |||||
@Data | |||||
public class ReqAddTagTypePO { | |||||
@ApiModelProperty("标签分类名") | |||||
@NotBlank | |||||
private String tagName; | |||||
} |
@@ -0,0 +1,19 @@ | |||||
package com.ningdatech.pmapi.meta.model.po; | |||||
import lombok.Data; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/21 下午6:05 | |||||
*/ | |||||
@Data | |||||
public class ReqDictionaryListPO { | |||||
private List<String> dictionaryTypeList; | |||||
private Boolean allDict = false; | |||||
} |
@@ -0,0 +1,14 @@ | |||||
package com.ningdatech.pmapi.meta.model.po; | |||||
import lombok.Data; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 下午2:43 | |||||
*/ | |||||
@Data | |||||
public class ReqTagListPO { | |||||
private List<String> rootTagCodeList; | |||||
} |
@@ -0,0 +1,24 @@ | |||||
package com.ningdatech.pmapi.meta.model.po; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/8/27 下午2:30 | |||||
*/ | |||||
@Data | |||||
@ApiModel(description = "标签查询request") | |||||
public class ReqTagQueryPO { | |||||
// | |||||
// @ApiModelProperty("标签类型") | |||||
// private Long tagType; | |||||
// | |||||
// @ApiModelProperty("标签名") | |||||
// private String tagName; | |||||
@ApiModelProperty("父级标签编码") | |||||
private String parentCode; | |||||
} |
@@ -0,0 +1,25 @@ | |||||
package com.ningdatech.pmapi.meta.model.vo; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import lombok.ToString; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/21 下午6:13 | |||||
*/ | |||||
@Data | |||||
@ToString(callSuper = true) | |||||
@ApiModel(value = "DictionaryListVO", description = "字典列表结构VO") | |||||
public class ResDictionaryListVO { | |||||
@ApiModelProperty(value = "字典名称") | |||||
private String dictionaryName; | |||||
@ApiModelProperty(value = "字典选项名称") | |||||
private List<ResDictionaryVO> dictionaryList; | |||||
} |
@@ -0,0 +1,49 @@ | |||||
package com.ningdatech.pmapi.meta.model.vo; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 上午11:26 | |||||
*/ | |||||
@Data | |||||
@ApiModel(value = "DictionaryListVO", description = "字典结构VO") | |||||
public class ResDictionaryVO { | |||||
@ApiModelProperty(value = "字典类型") | |||||
private String dictionaryType; | |||||
/** | |||||
* 编码 随机数处理 | |||||
*/ | |||||
@ApiModelProperty(value = "编码") | |||||
private String dictionaryCode; | |||||
/** | |||||
* 名称 | |||||
*/ | |||||
@ApiModelProperty(value = "名称") | |||||
private String name; | |||||
/** | |||||
* 描述 | |||||
*/ | |||||
@ApiModelProperty(value = "描述") | |||||
private String describe; | |||||
/** | |||||
* 排序 | |||||
*/ | |||||
@ApiModelProperty(value = "排序") | |||||
private Integer sortValue; | |||||
/** | |||||
* 是否内置,内置不可删除 | |||||
*/ | |||||
@ApiModelProperty(value = "是否内置,内置不可删除") | |||||
private String readonly; | |||||
} |
@@ -0,0 +1,41 @@ | |||||
package com.ningdatech.pmapi.meta.model.vo; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/8/27 下午2:35 | |||||
*/ | |||||
@Data | |||||
@ApiModel(description = "标签列表展示") | |||||
public class ResTagListVO { | |||||
@ApiModelProperty(value = "标签 编码") | |||||
private String tagCode; | |||||
@ApiModelProperty(value = "标签名称") | |||||
private String tagName; | |||||
@ApiModelProperty(value = "标签级别") | |||||
private Long tagLevel; | |||||
@ApiModelProperty(value = "使用频次") | |||||
private Long useFrequency; | |||||
@ApiModelProperty(value = "创建时间") | |||||
private LocalDateTime createTime; | |||||
@ApiModelProperty(value = "创建人") | |||||
private String creator; | |||||
@ApiModelProperty(value = "是否为叶子节点") | |||||
private Boolean isLeaf; | |||||
@ApiModelProperty(value = "是否有子集") | |||||
private Boolean hasChildren; | |||||
} |
@@ -0,0 +1,58 @@ | |||||
package com.ningdatech.pmapi.meta.model.vo; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import lombok.ToString; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 下午2:27 | |||||
*/ | |||||
@Data | |||||
@ToString(callSuper = true) | |||||
@ApiModel(value = "TagTreeVO", description = "标签树状结构VO") | |||||
public class ResTagTreeVO { | |||||
/** | |||||
* 标签 编码 | |||||
* 根标签 擅长方向 good_at | |||||
* 技术专长 technical_expertise | |||||
* 行业领域 industry_sector | |||||
* 其他 other | |||||
*/ | |||||
@ApiModelProperty(value = " * 标签 编码\n" + | |||||
" * 根标签\u2028擅长方向 good_at\n" + | |||||
" * 技术专长 technical_expertise\n" + | |||||
" * 行业领域 industry_sector\n" + | |||||
" * 其他 other") | |||||
private String tagCode; | |||||
/** | |||||
* 标签名称 | |||||
*/ | |||||
@ApiModelProperty(value = "标签名称") | |||||
private String tagName; | |||||
/** | |||||
* 标签级别 | |||||
*/ | |||||
@ApiModelProperty(value = "标签级别") | |||||
private Long tagLevel; | |||||
/** | |||||
* 标签父级id | |||||
* 当parent_tag_code 为 -1 时为顶级标签 | |||||
*/ | |||||
@ApiModelProperty(value = " * 标签父级id\n" + | |||||
" * 当parent_tag_code 为 -1 时为顶级标签") | |||||
private String parentCode; | |||||
@ApiModelProperty(value = "子节点标签") | |||||
private List<ResTagTreeVO> children; | |||||
@ApiModelProperty(value = "联合唯一字段方便页面使用(tagName##tagCode)") | |||||
private String unionCode; | |||||
} |
@@ -0,0 +1,23 @@ | |||||
package com.ningdatech.pmapi.meta.model.vo; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/8/27 下午2:20 | |||||
*/ | |||||
@Data | |||||
@ApiModel(description = "标签类型VO") | |||||
public class ResTagTypeVO { | |||||
@ApiModelProperty(value = "标签编码") | |||||
private String tagCode; | |||||
@ApiModelProperty(value = "标签名称") | |||||
private String tagName; | |||||
@ApiModelProperty(value = "标签级别") | |||||
private Long tagLevel; | |||||
} |
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.meta.service; | |||||
import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
public interface IExpertDictionaryService extends IService<ExpertDictionary> { | |||||
} |
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.meta.service; | |||||
import com.ningdatech.pmapi.meta.model.entity.ExpertTag; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
public interface IExpertTagService extends IService<ExpertTag> { | |||||
} |
@@ -0,0 +1,22 @@ | |||||
package com.ningdatech.pmapi.meta.service; | |||||
import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
public interface IMetaDictionaryService extends IService<MetaDictionary> { | |||||
List<DictionaryDTO> queryAll(); | |||||
} |
@@ -0,0 +1,21 @@ | |||||
package com.ningdatech.pmapi.meta.service; | |||||
import com.ningdatech.pmapi.meta.model.entity.MetaTag; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
import com.ningdatech.pmapi.meta.model.dto.TagDTO; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
public interface IMetaTagService extends IService<MetaTag> { | |||||
List<TagDTO> queryAll(); | |||||
} |
@@ -0,0 +1,20 @@ | |||||
package com.ningdatech.pmapi.meta.service.impl; | |||||
import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; | |||||
import com.ningdatech.pmapi.meta.mapper.ExpertDictionaryMapper; | |||||
import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@Service | |||||
public class ExpertDictionaryServiceImpl extends ServiceImpl<ExpertDictionaryMapper, ExpertDictionary> implements IExpertDictionaryService { | |||||
} |
@@ -0,0 +1,20 @@ | |||||
package com.ningdatech.pmapi.meta.service.impl; | |||||
import com.ningdatech.pmapi.meta.model.entity.ExpertTag; | |||||
import com.ningdatech.pmapi.meta.mapper.ExpertTagMapper; | |||||
import com.ningdatech.pmapi.meta.service.IExpertTagService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@Service | |||||
public class ExpertTagServiceImpl extends ServiceImpl<ExpertTagMapper, ExpertTag> implements IExpertTagService { | |||||
} |
@@ -0,0 +1,32 @@ | |||||
package com.ningdatech.pmapi.meta.service.impl; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; | |||||
import com.ningdatech.pmapi.meta.mapper.MetaDictionaryMapper; | |||||
import com.ningdatech.pmapi.meta.service.IMetaDictionaryService; | |||||
import com.ningdatech.pmapi.meta.assembler.MetaDictionaryAssembler; | |||||
import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; | |||||
import org.springframework.stereotype.Service; | |||||
import java.util.List; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@Service | |||||
public class MetaDictionaryServiceImpl extends ServiceImpl<MetaDictionaryMapper, MetaDictionary> implements IMetaDictionaryService { | |||||
@Override | |||||
public List<DictionaryDTO> queryAll() { | |||||
List<MetaDictionary> dictionaryList = this.lambdaQuery().ne(MetaDictionary::getId, -1).list(); | |||||
List<DictionaryDTO> dictionaryDTOList = dictionaryList.stream().map(MetaDictionaryAssembler::toDictionaryDTO).collect(Collectors.toList()); | |||||
return dictionaryDTOList; | |||||
} | |||||
} |
@@ -0,0 +1,33 @@ | |||||
package com.ningdatech.pmapi.meta.service.impl; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import com.ningdatech.pmapi.meta.assembler.MetaTagAssembler; | |||||
import com.ningdatech.pmapi.meta.model.entity.MetaTag; | |||||
import com.ningdatech.pmapi.meta.mapper.MetaTagMapper; | |||||
import com.ningdatech.pmapi.meta.model.dto.TagDTO; | |||||
import com.ningdatech.pmapi.meta.service.IMetaTagService; | |||||
import org.springframework.stereotype.Service; | |||||
import java.util.List; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@Service | |||||
public class MetaTagServiceImpl extends ServiceImpl<MetaTagMapper, MetaTag> implements IMetaTagService { | |||||
@Override | |||||
public List<TagDTO> queryAll() { | |||||
List<MetaTag> allTags = this.lambdaQuery().ne(MetaTag::getId, -1).list(); | |||||
List<TagDTO> allTagDTOList = allTags.stream().map(MetaTagAssembler::toTagDTO).collect(Collectors.toList()); | |||||
return allTagDTOList; | |||||
} | |||||
} |
@@ -0,0 +1,27 @@ | |||||
package com.ningdatech.pmapi.meta.validate; | |||||
import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; | |||||
import com.ningdatech.pmapi.meta.model.po.ReqDictionaryListPO; | |||||
import org.apache.commons.collections4.CollectionUtils; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/21 下午6:15 | |||||
*/ | |||||
public class DictionaryRequestValidator { | |||||
public static void dictionaryRequestValidator(ReqDictionaryListPO reqDictionaryListPO) { | |||||
List<String> dictionaryTypeList = reqDictionaryListPO.getDictionaryTypeList(); | |||||
if (CollectionUtils.isNotEmpty(dictionaryTypeList)) { | |||||
for (String dictionaryType : dictionaryTypeList) { | |||||
if (!DictExpertInfoTypeEnum.contains(dictionaryType)) { | |||||
throw new BizException("Illegal dictionaryType: " + dictionaryType); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,31 @@ | |||||
package com.ningdatech.pmapi.meta.validate; | |||||
import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; | |||||
import com.ningdatech.pmapi.meta.model.po.ReqTagListPO; | |||||
import org.apache.commons.collections4.CollectionUtils; | |||||
import java.util.List; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/7/22 下午2:44 | |||||
*/ | |||||
public class TagListRequestValidator { | |||||
private TagListRequestValidator() { | |||||
} | |||||
public static void tagListRequestValidator(ReqTagListPO request) { | |||||
List<String> rootTagCodeList = request.getRootTagCodeList(); | |||||
if (CollectionUtils.isNotEmpty(rootTagCodeList)) { | |||||
for (String rootTagCode : rootTagCodeList) { | |||||
if (!ExpertTagEnum.contains(rootTagCode)) { | |||||
throw new BizException("Illegal rootTagCode:" + rootTagCode); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -61,8 +61,9 @@ public class NoticeController { | |||||
@GetMapping("/dashboard/list") | @GetMapping("/dashboard/list") | ||||
@ApiOperation("工作台公告列表") | @ApiOperation("工作台公告列表") | ||||
public PageVo<NoticeListItemVO> dashboardList(@RequestParam(required = false, defaultValue = "3") Integer limit) { | |||||
return noticeManage.dashboardList(limit); | |||||
public PageVo<NoticeListItemVO> dashboardList(@RequestParam(required = false, defaultValue = "3") Integer limit, | |||||
@RequestParam(required = false) Integer type) { | |||||
return noticeManage.dashboardList(limit, type); | |||||
} | } | ||||
@GetMapping("/manage/list") | @GetMapping("/manage/list") | ||||
@@ -5,12 +5,13 @@ import cn.hutool.core.lang.Assert; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.log.annotation.WebLog; | import com.ningdatech.log.annotation.WebLog; | ||||
import com.ningdatech.pmapi.common.util.BizUtils; | import com.ningdatech.pmapi.common.util.BizUtils; | ||||
import com.ningdatech.pmapi.sys.model.entity.Role; | |||||
import com.ningdatech.pmapi.sys.model.req.RolePageReq; | |||||
import com.ningdatech.pmapi.sys.manage.RoleManage; | |||||
import com.ningdatech.pmapi.sys.model.dto.MenuDataScopeDTO; | |||||
import com.ningdatech.pmapi.sys.model.dto.RoleSaveDTO; | import com.ningdatech.pmapi.sys.model.dto.RoleSaveDTO; | ||||
import com.ningdatech.pmapi.sys.model.dto.RoleUpdateDTO; | import com.ningdatech.pmapi.sys.model.dto.RoleUpdateDTO; | ||||
import com.ningdatech.pmapi.sys.model.entity.Role; | |||||
import com.ningdatech.pmapi.sys.model.req.RolePageReq; | |||||
import com.ningdatech.pmapi.sys.model.vo.RoleVO; | import com.ningdatech.pmapi.sys.model.vo.RoleVO; | ||||
import com.ningdatech.pmapi.sys.manage.RoleManage; | |||||
import com.ningdatech.pmapi.sys.service.IRoleService; | import com.ningdatech.pmapi.sys.service.IRoleService; | ||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | import com.ningdatech.pmapi.user.util.LoginUserUtil; | ||||
import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
@@ -62,6 +63,8 @@ public class RoleController { | |||||
Assert.notNull(role, "角色不存在"); | Assert.notNull(role, "角色不存在"); | ||||
RoleVO query = BeanUtil.toBean(role, RoleVO.class); | RoleVO query = BeanUtil.toBean(role, RoleVO.class); | ||||
query.setManageRoleIdList(BizUtils.splitToLong(role.getManageRoleIds())); | query.setManageRoleIdList(BizUtils.splitToLong(role.getManageRoleIds())); | ||||
List<MenuDataScopeDTO> menuDataScope = roleManage.getMenuDataScope(id); | |||||
query.setMenuDataScopeList(menuDataScope); | |||||
// 菜单 | // 菜单 | ||||
roleManage.buildMenu(query); | roleManage.buildMenu(query); | ||||
return query; | return query; | ||||