From 452389a5f71702b812d9c5aa2c0ca83024ac7fc1 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 21 Dec 2023 16:32:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=84=E5=AE=A1=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E4=B8=8A=E4=BC=A0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hz/pm/api/common/util/ExpertRegisterUtil.java | 16 +-- .../dashboard/helper/DashboardChartAssembler.java | 2 +- .../dashboard/manage/DashboardExpertManage.java | 6 +- .../dashboard/manage/ExpertStatisticsManage.java | 6 +- .../ExpertAdminExpertManageAssembler.java | 14 +-- .../expert/assembler/ExpertInfoCmdAssembler.java | 22 ++--- .../expert/assembler/ExpertUserInfoAssembler.java | 40 ++++---- .../pm/api/expert/entity/ExpertUserFullInfo.java | 2 +- .../pm/api/expert/helper/ExpertManageHelper.java | 50 +++++----- .../hz/pm/api/expert/manage/ExpertAdminManage.java | 8 +- .../com/hz/pm/api/expert/manage/ExpertManage.java | 4 +- .../api/expert/manage/ExpertMetaApplyManage.java | 22 ++--- .../expert/service/impl/ExpertInfoServiceImpl.java | 4 +- .../hz/pm/api/meeting/entity/domain/Meeting.java | 9 +- .../meeting/entity/domain/MeetingInnerProject.java | 17 +++- .../meeting/entity/domain/MeetingOuterProject.java | 6 ++ .../pm/api/meeting/entity/dto/MeetingBasicDTO.java | 7 ++ .../entity/dto/MeetingReviewProjectDTO.java | 7 +- .../api/meeting/entity/dto/ReviewProjectDTO.java | 6 ++ .../meeting/entity/req/MeetingResultUploadReq.java | 4 + .../meeting/entity/vo/ExpertEvalListItemVO.java | 2 +- .../api/meeting/entity/vo/MeetingByManagerVO.java | 3 + .../meeting/entity/vo/MeetingDetailBasicVO.java | 3 + .../meeting/entity/vo/MeetingReviewProjectVO.java | 7 +- .../pm/api/meeting/helper/MeetingManageHelper.java | 11 ++- .../hz/pm/api/meeting/manage/DashboardManage.java | 2 +- .../hz/pm/api/meeting/manage/MeetingManage.java | 77 ++++++++------- .../service/IMeetingExpertJudgeService.java | 2 +- .../meta/assembler/MetaDictionaryAssembler.java | 8 +- .../hz/pm/api/meta/constant/DictAllTypeEnum.java | 53 ---------- .../api/meta/constant/DictExpertInfoTypeEnum.java | 92 ------------------ .../com/hz/pm/api/meta/constant/DictTypeEnum.java | 107 +++++++++++++++++++++ .../pm/api/meta/constant/ExpertDictTypeEnum.java | 101 +++++++++++++++++++ .../controller/MetaDictionaryManageController.java | 7 +- .../com/hz/pm/api/meta/helper/DictionaryCache.java | 35 ++++--- .../meta/helper/basic/AbstractDictionaryCache.java | 25 ++--- .../api/meta/helper/impl/DictionaryCacheImpl.java | 32 ++++-- .../java/com/hz/pm/api/meta/manage/MetaManage.java | 20 ++-- .../java/com/hz/pm/api/meta/model/dto/DictDTO.java | 40 ++++++++ .../hz/pm/api/meta/model/dto/DictionaryDTO.java | 40 -------- .../api/meta/service/IExpertDictionaryService.java | 4 +- .../api/meta/service/IMetaDictionaryService.java | 4 +- .../service/impl/ExpertDictionaryServiceImpl.java | 4 +- .../service/impl/MetaDictionaryServiceImpl.java | 6 +- .../pm/api/meta/validate/DictParamValidator.java | 4 +- 45 files changed, 532 insertions(+), 409 deletions(-) delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictAllTypeEnum.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictExpertInfoTypeEnum.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictTypeEnum.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/ExpertDictTypeEnum.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/DictDTO.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/DictionaryDTO.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegisterUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegisterUtil.java index 7295715..5d2fd2c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegisterUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegisterUtil.java @@ -10,12 +10,12 @@ import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.expert.controller.ExpertController; import com.hz.pm.api.expert.model.*; import com.hz.pm.api.expert.model.req.ExpertRegistrationRequest; -import com.hz.pm.api.meta.constant.DictAllTypeEnum; +import com.hz.pm.api.meta.constant.DictTypeEnum; import com.hz.pm.api.meta.constant.ExpertTagEnum; import com.hz.pm.api.meta.helper.DictionaryCache; import com.hz.pm.api.meta.helper.TagCache; import com.hz.pm.api.meta.model.ExpertRegionInfo; -import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.DictDTO; import com.hz.pm.api.meta.model.dto.TagDTO; import com.hz.pm.api.organization.model.entity.DingOrganization; import com.hz.pm.api.organization.service.IDingOrganizationService; @@ -62,7 +62,7 @@ public class ExpertRegisterUtil { // 政治面貌 basic.setPolitical(new ArrayList<>()); String political = MapUtil.getStr(w, "政治面貌"); - List politicalDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.POLITICAL.getKey()); + List politicalDicts = dictionaryCache.listDictByDictType(DictTypeEnum.POLITICAL.getKey()); if (!politicalDicts.isEmpty()) { politicalDicts.stream() .filter(dict -> dict.getName().equals(political)) @@ -82,7 +82,7 @@ public class ExpertRegisterUtil { eduInfo.setDegree(new ArrayList<>()); // 学历 String eduStr = MapUtil.getStr(w, "学历"); - List eduDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.EDU.getKey()); + List eduDicts = dictionaryCache.listDictByDictType(DictTypeEnum.EDU.getKey()); if (!eduDicts.isEmpty()) { eduDicts.stream() .filter(dict -> dict.getName().equals(eduStr)) @@ -96,7 +96,7 @@ public class ExpertRegisterUtil { } // 学位 String degreeStr = MapUtil.getStr(w, "学位"); - List degreeDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.DEGREE.getKey()); + List degreeDicts = dictionaryCache.listDictByDictType(DictTypeEnum.DEGREE.getKey()); if (!degreeDicts.isEmpty()) { degreeDicts.stream() .filter(dict -> dict.getName().equals(degreeStr)) @@ -139,7 +139,7 @@ public class ExpertRegisterUtil { jobInfo.setAdministrativeDuties(MapUtil.getStr(w, "行政职务")); jobInfo.setAdministrativeRank(new ArrayList<>()); String administrativeRankStr = MapUtil.getStr(w, "行政职级"); - List administrativeRankDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.ADMINISTRATIVE_RANK.getKey()); + List administrativeRankDicts = dictionaryCache.listDictByDictType(DictTypeEnum.ADMINISTRATIVE_RANK.getKey()); if (!administrativeRankDicts.isEmpty()) { administrativeRankDicts.stream() .filter(dict -> dict.getName().equals(administrativeRankStr)) @@ -153,7 +153,7 @@ public class ExpertRegisterUtil { } jobInfo.setCompanyAttribute(new ArrayList<>()); String companyTypeStr = MapUtil.getStr(w, "*单位类型"); - List companyTypeDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.COMPANY_ATTRIBUTE.getKey()); + List companyTypeDicts = dictionaryCache.listDictByDictType(DictTypeEnum.COMPANY_ATTRIBUTE.getKey()); if (!companyTypeDicts.isEmpty()) { companyTypeDicts.stream() .filter(dict -> dict.getName().equals(companyTypeStr)) @@ -240,7 +240,7 @@ public class ExpertRegisterUtil { } professionalInfo.setTitleLevel(new ArrayList<>()); String titleLevel = MapUtil.getStr(w, "*职称级别"); - List titleLevelDicts = dictionaryCache.getDictionaryListByDictionaryType(DictAllTypeEnum.TITLE_LEVEL.getKey()); + List titleLevelDicts = dictionaryCache.listDictByDictType(DictTypeEnum.TITLE_LEVEL.getKey()); if (!titleLevelDicts.isEmpty()) { titleLevelDicts.stream() .filter(dict -> dict.getName().equals(titleLevel)) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardChartAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardChartAssembler.java index 4b5ca6f..3194842 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardChartAssembler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardChartAssembler.java @@ -114,7 +114,7 @@ public class DashboardChartAssembler { for (String dictionaryCode : dictionaryCodeIdMap.keySet()) { AnalysisData analysisData = new AnalysisData(); - analysisData.setKey(dictionaryCache.getByCode(dictionaryCode).getName()); + analysisData.setKey(dictionaryCache.getByCode(dictionaryCode).get().getName()); analysisData.setValue(dictionaryCodeIdMap.get(dictionaryCode).size()); dataList.add(analysisData); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardExpertManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardExpertManage.java index be17e2d..d139e09 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardExpertManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardExpertManage.java @@ -19,7 +19,7 @@ import com.hz.pm.api.meeting.entity.domain.MeetingExpertJudge; import com.hz.pm.api.meeting.entity.enumeration.MeetingStatusEnum; import com.hz.pm.api.meeting.service.IMeetingExpertJudgeService; import com.hz.pm.api.meeting.service.IMeetingService; -import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.model.entity.ExpertDictionary; import com.hz.pm.api.meta.service.IExpertDictionaryService; import lombok.RequiredArgsConstructor; @@ -98,7 +98,7 @@ public class DashboardExpertManage { if (CollectionUtil.isNotEmpty(regionDegreeExpertIdList)) { // 区域学历分布 List degreeExpertDictionaryList = iExpertDictionaryService - .listByUserId(regionDegreeExpertIdList, DictExpertInfoTypeEnum.DEGREE); + .listByUserId(regionDegreeExpertIdList, ExpertDictTypeEnum.DEGREE); Map> degreeCodeMap = degreeExpertDictionaryList.stream() .map(ExpertDictionary::getDictionaryCode) .collect(Collectors.groupingBy(Function.identity())); @@ -108,7 +108,7 @@ public class DashboardExpertManage { // 区域职称级别分布 List titleLevelExpertDictionaryList = iExpertDictionaryService - .listByUserId(regionDegreeExpertIdList, DictExpertInfoTypeEnum.TITLE_LEVEL); + .listByUserId(regionDegreeExpertIdList, ExpertDictTypeEnum.TITLE_LEVEL); Map> titleLevelCodeMap = titleLevelExpertDictionaryList.stream() .collect(Collectors.groupingBy(ExpertDictionary::getDictionaryCode)); AnalysisChart regionExpertTitleLevelChartAnalysisChart = diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ExpertStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ExpertStatisticsManage.java index 830ee0b..859998c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ExpertStatisticsManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ExpertStatisticsManage.java @@ -14,7 +14,7 @@ import com.hz.pm.api.expert.entity.ExpertIntentionWorkRegion; import com.hz.pm.api.expert.entity.ExpertUserFullInfo; import com.hz.pm.api.expert.service.IExpertIntentionWorkRegionService; import com.hz.pm.api.expert.service.IExpertUserFullInfoService; -import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.DictDTO; import com.hz.pm.api.meta.model.dto.TagDTO; import com.hz.pm.api.meta.model.entity.ExpertDictionary; import com.hz.pm.api.meta.model.entity.ExpertTag; @@ -96,10 +96,10 @@ public class ExpertStatisticsManage { List tags = metaTagService.queryAll(); - List dictionaries = metaDictionaryService.queryAll(); + List dictionaries = metaDictionaryService.queryAll(); Set code = Sets.newHashSet(); Map dictionMap = dictionaries.stream().filter(d -> code.add(d.getDictionaryCode())) - .collect(Collectors.toMap(DictionaryDTO::getDictionaryCode, DictionaryDTO::getName)); + .collect(Collectors.toMap(DictDTO::getDictionaryCode, DictDTO::getName)); List expertDictionaries = expertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class) .eq(ExpertDictionary::getExpertInfoField, DashboardConstant.Expert.EXPERT_TYPE)); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java index 0974b83..872ea48 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java @@ -11,7 +11,7 @@ import com.hz.pm.api.expert.model.vo.ExpertLibraryListItemVO; import com.hz.pm.api.meta.helper.DictionaryCache; import com.hz.pm.api.meta.helper.impl.TagsCacheImpl; import com.hz.pm.api.meta.model.ExpertRegionInfo; -import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.DictDTO; import com.hz.pm.api.meta.model.dto.TagDTO; import com.hz.pm.api.sys.model.dto.RegionDTO; import lombok.RequiredArgsConstructor; @@ -19,9 +19,7 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; /** @@ -104,13 +102,11 @@ public class ExpertAdminExpertManageAssembler { public List assembleDictionaryName(List collect) { if (CollectionUtil.isEmpty(collect)){ - return new ArrayList<>(); + return Collections.emptyList(); } return collect.stream().peek(r -> { - DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); - if (Objects.nonNull(dictionaryDTO)) { - r.setDictionaryName(dictionaryDTO.getName()); - } + Optional dict = dictionaryCache.getByCode(r.getDictionaryCode()); + dict.ifPresent(dictDTO -> r.setDictionaryName(dictDTO.getName())); }).collect(Collectors.toList()); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertInfoCmdAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertInfoCmdAssembler.java index 769db09..6815d9d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertInfoCmdAssembler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertInfoCmdAssembler.java @@ -9,7 +9,7 @@ import com.hz.pm.api.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; import com.hz.pm.api.expert.model.cmd.ExpertFullInfoSaveCmd; import com.hz.pm.api.expert.model.cmd.ExpertInfoModifyCmd; import com.hz.pm.api.expert.model.dto.*; -import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.constant.ExpertTagEnum; import com.hz.pm.api.meta.model.ExpertRegionInfo; import org.apache.commons.collections4.CollectionUtils; @@ -133,15 +133,15 @@ public class ExpertInfoCmdAssembler { recommendedWay = recommendInfo.getRecommendedWay(); } List 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); + assemblerDictionaryFieldName(dictionaryFieldInfoList, political, ExpertDictTypeEnum.POLITICAL); + assemblerDictionaryFieldName(dictionaryFieldInfoList, expertType, ExpertDictTypeEnum.EXPERT_TYPE); + assemblerDictionaryFieldName(dictionaryFieldInfoList, edu, ExpertDictTypeEnum.EDU); + assemblerDictionaryFieldName(dictionaryFieldInfoList, degree, ExpertDictTypeEnum.DEGREE); + assemblerDictionaryFieldName(dictionaryFieldInfoList, jobStatus, ExpertDictTypeEnum.JOB_STATUS); + assemblerDictionaryFieldName(dictionaryFieldInfoList, companyAttribute, ExpertDictTypeEnum.COMPANY_ATTRIBUTE); + assemblerDictionaryFieldName(dictionaryFieldInfoList, administrativeRank, ExpertDictTypeEnum.ADMINISTRATIVE_RANK); + assemblerDictionaryFieldName(dictionaryFieldInfoList, titleLevel, ExpertDictTypeEnum.TITLE_LEVEL); + assemblerDictionaryFieldName(dictionaryFieldInfoList, recommendedWay, ExpertDictTypeEnum.RECOMMENDED_WAY); return dictionaryFieldInfoList.stream().map(r -> { ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); @@ -153,7 +153,7 @@ public class ExpertInfoCmdAssembler { private static void assemblerDictionaryFieldName( List allDictionaryFieldInfoList, List originalDictionaryFieldInfoList - , DictExpertInfoTypeEnum dictExpertInfoTypeEnum) { + , ExpertDictTypeEnum dictExpertInfoTypeEnum) { if (CollectionUtils.isNotEmpty(originalDictionaryFieldInfoList)) { originalDictionaryFieldInfoList = originalDictionaryFieldInfoList.stream().map(r -> { r.setDictionaryFieldName(dictExpertInfoTypeEnum.getKey()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertUserInfoAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertUserInfoAssembler.java index 5f2dde9..2b9a6f8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertUserInfoAssembler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertUserInfoAssembler.java @@ -15,12 +15,12 @@ import com.hz.pm.api.expert.model.*; import com.hz.pm.api.expert.model.dto.*; import com.hz.pm.api.expert.model.vo.ExpertFullInfoVO; import com.hz.pm.api.gov.model.vo.GovBusinessStripVO; -import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.constant.ExpertTagEnum; import com.hz.pm.api.meta.helper.DictionaryCache; import com.hz.pm.api.meta.helper.TagCache; import com.hz.pm.api.meta.model.ExpertRegionInfo; -import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.DictDTO; import com.hz.pm.api.meta.model.dto.TagDTO; import com.hz.pm.api.meta.model.entity.ExpertDictionary; import com.hz.pm.api.meta.model.entity.ExpertTag; @@ -67,7 +67,7 @@ public class ExpertUserInfoAssembler { ExpertProfessionalInfo profession = buildExpertProfessionalInfo(expertUserInfo, dictMap, tagMap, fileMap, avoidCompanies); // 推荐信息 ExpertRecommendInfo recommendInfo = new ExpertRecommendInfo(); - recommendInfo.setRecommendedWay(dictMap.get(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey())); + recommendInfo.setRecommendedWay(dictMap.get(ExpertDictTypeEnum.RECOMMENDED_WAY.getKey())); recommendInfo.setRecommendationProofFile(getFileBasicInfoList(fileMap, expertUserInfo.getRecommendationProofFileIdList())); // 其他信息 ExpertOtherInfo otherInfo = new ExpertOtherInfo(); @@ -125,10 +125,8 @@ public class ExpertUserInfoAssembler { DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo(); dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField()); dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode()); - DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); - if (Objects.nonNull(dictionaryDTO)) { - dictionaryFieldInfo.setDictionaryName(dictionaryDTO.getName()); - } + Optional dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); + dictionaryDTO.ifPresent(dictDTO -> dictionaryFieldInfo.setDictionaryName(dictDTO.getName())); return dictionaryFieldInfo; }).collect(Collectors.groupingBy(DictionaryFieldInfo::getDictionaryFieldName)); } @@ -140,7 +138,7 @@ public class ExpertUserInfoAssembler { List expertAvoidCompanyList) { ExpertProfessionalInfo professionalInfo = new ExpertProfessionalInfo(); professionalInfo.setTechnicalTitles(expertUserInfoDTO.getTechnicalTitles()); - professionalInfo.setTitleLevel(dictInfoMap.get(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey())); + professionalInfo.setTitleLevel(dictInfoMap.get(ExpertDictTypeEnum.TITLE_LEVEL.getKey())); professionalInfo.setTitleCertificateFile(getFileBasicInfoList(fileInfoMap, expertUserInfoDTO.getTitleCertificateFileIdList())); professionalInfo.setGoodAt(tagFieldInfoMap.get(ExpertTagEnum.GOOD_AT.getKey())); professionalInfo.setTechnicalExpertise(tagFieldInfoMap.get(ExpertTagEnum.TECHNICAL_EXPERTISE.getKey())); @@ -159,15 +157,15 @@ public class ExpertUserInfoAssembler { public static ExpertJobInfo buildExpertJobInfo(ExpertUserFullInfoDTO expertUserInfoDTO, Map> dictInfoMap) { ExpertJobInfo jobInfo = new ExpertJobInfo(); - jobInfo.setJobStatus(dictInfoMap.get(DictExpertInfoTypeEnum.JOB_STATUS.getKey())); + jobInfo.setJobStatus(dictInfoMap.get(ExpertDictTypeEnum.JOB_STATUS.getKey())); jobInfo.setRetiredAt(expertUserInfoDTO.getRetiredAt()); jobInfo.setCompany(expertUserInfoDTO.getCompany()); jobInfo.setCompanyUniqCode(expertUserInfoDTO.getCompanyUniqCode()); jobInfo.setLegalEntityCode(expertUserInfoDTO.getLegalEntityCode()); jobInfo.setAdministrativeDuties(expertUserInfoDTO.getAdministrativeDuties()); jobInfo.setStartWorkAt(expertUserInfoDTO.getStartWorkAt()); - jobInfo.setAdministrativeRank(dictInfoMap.get(DictExpertInfoTypeEnum.ADMINISTRATIVE_RANK.getKey())); - jobInfo.setCompanyAttribute(dictInfoMap.get(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey())); + jobInfo.setAdministrativeRank(dictInfoMap.get(ExpertDictTypeEnum.ADMINISTRATIVE_RANK.getKey())); + jobInfo.setCompanyAttribute(dictInfoMap.get(ExpertDictTypeEnum.COMPANY_ATTRIBUTE.getKey())); jobInfo.setAddress(expertUserInfoDTO.getAddress()); jobInfo.setExperience(expertUserInfoDTO.getExperience()); return jobInfo; @@ -181,9 +179,9 @@ public class ExpertUserInfoAssembler { eduInfo.setSchool(expertFullInfo.getSchool()); eduInfo.setGraduatedAt(expertFullInfo.getGraduatedAt()); eduInfo.setAcademicTitle(expertFullInfo.getAcademicTitle()); - eduInfo.setEdu(dictInfoMap.get(DictExpertInfoTypeEnum.EDU.getKey())); + eduInfo.setEdu(dictInfoMap.get(ExpertDictTypeEnum.EDU.getKey())); eduInfo.setGraduationCertificateFile(getFileBasicInfoList(fileInfoMap, expertFullInfo.getGraduationCertificateFileIdList())); - eduInfo.setDegree(dictInfoMap.get(DictExpertInfoTypeEnum.DEGREE.getKey())); + eduInfo.setDegree(dictInfoMap.get(ExpertDictTypeEnum.DEGREE.getKey())); eduInfo.setDegreeCertificateFile(getFileBasicInfoList(fileInfoMap, expertFullInfo.getDegreeCertificateFileIdList())); return eduInfo; } @@ -226,7 +224,7 @@ public class ExpertUserInfoAssembler { basicInfo.setName(expertUserInfoDTO.getName()); basicInfo.setAvatarFile(getFileBasicInfo(fileBasicInfoMap, expertUserInfoDTO.getAvatarFileId())); basicInfo.setGender(expertUserInfoDTO.getGender()); - basicInfo.setPolitical(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.POLITICAL.getKey())); + basicInfo.setPolitical(dictionaryFieldInfoMap.get(ExpertDictTypeEnum.POLITICAL.getKey())); basicInfo.setIdCard(expertUserInfoDTO.getIdCard()); basicInfo.setOfficePhone(expertUserInfoDTO.getPhoneNo()); basicInfo.setBirth(expertUserInfoDTO.getBirth()); @@ -246,7 +244,7 @@ public class ExpertUserInfoAssembler { expertIntentionWorkRegion.setRegionName(regionCacheHelper.getUnionPath(r.getRegionCode(), r.getRegionLevel())); return expertIntentionWorkRegion; }).collect(Collectors.toList())); - basicInfo.setExpertType(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey())); + basicInfo.setExpertType(dictionaryFieldInfoMap.get(ExpertDictTypeEnum.EXPERT_TYPE.getKey())); return basicInfo; } @@ -423,11 +421,11 @@ public class ExpertUserInfoAssembler { List userExpertDictList = expertDictMap.getOrDefault(userId, Collections.emptyList()); Map> fieldExpertDictMap = userExpertDictList.stream().collect(Collectors.groupingBy(ExpertDictionary::getExpertInfoField)); adminManageExpertListItem.setExpertType( - DictAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey()))); + DictAssembler.toDictFieldInfoList(fieldExpertDictMap.get(ExpertDictTypeEnum.EXPERT_TYPE.getKey()))); adminManageExpertListItem.setCompanyAttribute( - DictAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey()))); + DictAssembler.toDictFieldInfoList(fieldExpertDictMap.get(ExpertDictTypeEnum.COMPANY_ATTRIBUTE.getKey()))); adminManageExpertListItem.setTitleLevel( - DictAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()))); + DictAssembler.toDictFieldInfoList(fieldExpertDictMap.get(ExpertDictTypeEnum.TITLE_LEVEL.getKey()))); // 装配标签数据 List expertTagList = Objects.isNull(expertTagMap.get(userId)) ? new ArrayList<>() : expertTagMap.get(userId); Map> fieldExpertTagMap = expertTagList.stream().collect(Collectors.groupingBy(ExpertTag::getExpertInfoField)); @@ -446,13 +444,13 @@ public class ExpertUserInfoAssembler { adminManageExpertListItem.setHometown(expertUserFullInfo.getHometown()); adminManageExpertListItem.setNationality(expertUserFullInfo.getNationality()); adminManageExpertListItem.setPolitical( - DictAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.POLITICAL.getKey()))); + DictAssembler.toDictFieldInfoList(fieldExpertDictMap.get(ExpertDictTypeEnum.POLITICAL.getKey()))); adminManageExpertListItem.setIdCard(expertUserFullInfo.getIdCard()); adminManageExpertListItem.setBankNo(expertUserFullInfo.getBankNo()); adminManageExpertListItem.setEdu( - DictAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.EDU.getKey()))); + DictAssembler.toDictFieldInfoList(fieldExpertDictMap.get(ExpertDictTypeEnum.EDU.getKey()))); adminManageExpertListItem.setRecommendedWay( - DictAssembler.toDictFieldInfoList(fieldExpertDictMap.get(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey()))); + DictAssembler.toDictFieldInfoList(fieldExpertDictMap.get(ExpertDictTypeEnum.RECOMMENDED_WAY.getKey()))); adminManageExpertListItem.setCreateTime(expertUserFullInfo.getCreateOn()); return adminManageExpertListItem; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertUserFullInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertUserFullInfo.java index 9e6e674..b1ab27e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertUserFullInfo.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/entity/ExpertUserFullInfo.java @@ -19,7 +19,7 @@ import java.time.LocalDateTime; */ @Data @TableName("nd_expert_user_full_info") -@ApiModel(value = "NdExpertUserFullInfo对象", description = "") +@ApiModel(value = "NdExpertUserFullInfo对象") public class ExpertUserFullInfo implements Serializable { private static final long serialVersionUID = 1L; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertManageHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertManageHelper.java index 1da18f1..665f826 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertManageHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertManageHelper.java @@ -5,7 +5,7 @@ import com.hz.pm.api.expert.model.*; import com.hz.pm.api.meta.helper.DictionaryCache; import com.hz.pm.api.meta.helper.TagCache; import com.hz.pm.api.meta.model.ExpertRegionInfo; -import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.DictDTO; import com.hz.pm.api.meta.model.dto.TagDTO; import com.ningdatech.basic.exception.BizException; import lombok.RequiredArgsConstructor; @@ -14,6 +14,7 @@ import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.Optional; /** * @author liuxinxin @@ -76,33 +77,32 @@ public class ExpertManageHelper { /** * 校验字典code是否合法 * - * @param expertBasicInfo \ - * @param expertEduInfo \ - * @param expertJobInfo \ + * @param basicInfo \ + * @param eduInfo \ + * @param jobInfo \ */ - public void dictionaryFieldCheck(ExpertBasicInfo expertBasicInfo, ExpertEduInfo expertEduInfo - , ExpertJobInfo expertJobInfo) { - List political = expertBasicInfo.getPolitical(); - List edu = expertEduInfo.getEdu(); - List degree = expertEduInfo.getDegree(); - List jobStatus = expertJobInfo.getJobStatus(); - List companyAttribute = expertJobInfo.getCompanyAttribute(); - List administrativeRank = expertJobInfo.getAdministrativeRank(); + public void dictionaryFieldCheck(ExpertBasicInfo basicInfo, ExpertEduInfo eduInfo, ExpertJobInfo jobInfo) { + List political = basicInfo.getPolitical(); + List edu = eduInfo.getEdu(); + List degree = eduInfo.getDegree(); + List jobStatus = jobInfo.getJobStatus(); + List companyAttribute = jobInfo.getCompanyAttribute(); + List administrativeRank = jobInfo.getAdministrativeRank(); - List dictionaryFieldInfoList = new ArrayList<>(); - dictionaryFieldInfoList.addAll(political); - dictionaryFieldInfoList.addAll(edu); - dictionaryFieldInfoList.addAll(degree); - dictionaryFieldInfoList.addAll(jobStatus); - dictionaryFieldInfoList.addAll(companyAttribute); - dictionaryFieldInfoList.addAll(administrativeRank); + List dictFieldList = new ArrayList<>(); + dictFieldList.addAll(political); + dictFieldList.addAll(edu); + dictFieldList.addAll(degree); + dictFieldList.addAll(jobStatus); + dictFieldList.addAll(companyAttribute); + dictFieldList.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); + for (DictionaryFieldInfo dictField : dictFieldList) { + String dictCode = dictField.getDictionaryCode(); + Optional dict = dictionaryCache.getByCode(dictCode); + if (!dict.isPresent()) { + String dictFieldName = dictField.getDictionaryFieldName(); + throw BizException.wrap("字典数据无效:%s=%s", dictFieldName, dictCode); } } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertAdminManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertAdminManage.java index c06e78b..fc300db 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertAdminManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertAdminManage.java @@ -35,7 +35,7 @@ import com.hz.pm.api.expert.model.vo.ZzdInfoByMobileVO; import com.hz.pm.api.expert.service.ExpertAdminManageService; import com.hz.pm.api.expert.service.ExpertInfoService; import com.hz.pm.api.expert.service.IExpertMetaApplyService; -import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.constant.ExpertTagEnum; import com.hz.pm.api.meta.model.ExpertRegionInfo; import com.hz.pm.api.meta.model.bo.RegionContainsBO; @@ -105,19 +105,19 @@ public class ExpertAdminManage { List expertDictQueryList = new ArrayList<>(); if (StringUtils.isNotBlank(query.getTitleLevelDictionaryCode())) { ExpertDictionaryQuery expertDictQuery = new ExpertDictionaryQuery(); - expertDictQuery.setExpertInfoField(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()); + expertDictQuery.setExpertInfoField(ExpertDictTypeEnum.TITLE_LEVEL.getKey()); expertDictQuery.setDictionaryCodeList(CollectionUtil.toList(query.getTitleLevelDictionaryCode())); expertDictQueryList.add(expertDictQuery); } if (StringUtils.isNotBlank(query.getCompanyAttributeDictionaryCode())) { ExpertDictionaryQuery expertDictQuery = new ExpertDictionaryQuery(); - expertDictQuery.setExpertInfoField(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey()); + expertDictQuery.setExpertInfoField(ExpertDictTypeEnum.COMPANY_ATTRIBUTE.getKey()); expertDictQuery.setDictionaryCodeList(CollectionUtil.toList(query.getCompanyAttributeDictionaryCode())); expertDictQueryList.add(expertDictQuery); } if (StringUtils.isNotBlank(query.getExpertTypeDictionaryCode())) { ExpertDictionaryQuery expertDictQuery = new ExpertDictionaryQuery(); - expertDictQuery.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey()); + expertDictQuery.setExpertInfoField(ExpertDictTypeEnum.EXPERT_TYPE.getKey()); expertDictQuery.setDictionaryCodeList(CollectionUtil.toList(query.getExpertTypeDictionaryCode())); expertDictQueryList.add(expertDictQuery); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java index 3afaacf..907e860 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java @@ -33,7 +33,7 @@ import com.hz.pm.api.meeting.entity.enumeration.ExpertJudgeEnum.AttendStatus; import com.hz.pm.api.meeting.entity.enumeration.ExpertJudgeEnum.Performance; import com.hz.pm.api.meeting.service.IMeetingExpertJudgeService; import com.hz.pm.api.meeting.service.IMeetingExpertService; -import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.model.ExpertRegionInfo; import com.hz.pm.api.sms.constant.VerificationCodeType; import com.hz.pm.api.sms.helper.VerifyCodeCheckHelper; @@ -185,7 +185,7 @@ public class ExpertManage { recommendedWay.forEach(r -> { ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); - expertDictionaryDTO.setExpertInfoField(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey()); + expertDictionaryDTO.setExpertInfoField(ExpertDictTypeEnum.RECOMMENDED_WAY.getKey()); recommendedWayDictionaryDTOList.add(expertDictionaryDTO); }); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java index d7dc126..c6df747 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java @@ -30,12 +30,12 @@ import com.hz.pm.api.expert.service.ExpertAdminManageService; import com.hz.pm.api.expert.service.ExpertInfoService; import com.hz.pm.api.expert.service.IExpertMetaApplyService; import com.hz.pm.api.expert.service.IExpertUserFullInfoService; -import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.helper.DictionaryCache; import com.hz.pm.api.meta.helper.ExpertUserInfoHelper; import com.hz.pm.api.meta.model.ExpertRegionInfo; import com.hz.pm.api.meta.model.bo.RegionContainsBO; -import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.DictDTO; import com.hz.pm.api.meta.model.entity.ExpertDictionary; import com.hz.pm.api.meta.service.IExpertDictionaryService; import com.hz.pm.api.sys.model.dto.RegionDTO; @@ -113,10 +113,10 @@ public class ExpertMetaApplyManage { // 根据用户id 获取专家基本信息 List expertList = userFullInfoService.listByUserIds(expertIds); Map expertMap = CollUtils.listToMap(expertList, ExpertUserFullInfo::getUserId); - List titleLevelDictList = expertDictionaryService.listByUserId(expertIds, DictExpertInfoTypeEnum.TITLE_LEVEL); + List titleLevelDictList = expertDictionaryService.listByUserId(expertIds, ExpertDictTypeEnum.TITLE_LEVEL); Map> titleLevelDictMap = CollUtils.group(titleLevelDictList, ExpertDictionary::getUserId); - List expertTypeDictList = expertDictionaryService.listByUserId(expertIds, DictExpertInfoTypeEnum.EXPERT_TYPE); + List expertTypeDictList = expertDictionaryService.listByUserId(expertIds, ExpertDictTypeEnum.EXPERT_TYPE); Map> expertTypeDictMap = CollUtils.group(expertTypeDictList, ExpertDictionary::getUserId); result.setRecords(buildExpertApplyMetaVOList(records, expertMap, titleLevelDictMap, expertTypeDictMap)); }); @@ -359,7 +359,7 @@ public class ExpertMetaApplyManage { List expertDictionaryQueryList = new ArrayList<>(); if (StringUtils.isNotBlank(query.getTitleLevelDictionaryCode())) { ExpertDictionaryQuery expertDictionaryQuery = new ExpertDictionaryQuery(); - expertDictionaryQuery.setExpertInfoField(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()); + expertDictionaryQuery.setExpertInfoField(ExpertDictTypeEnum.TITLE_LEVEL.getKey()); expertDictionaryQuery.setDictionaryCodeList(CollectionUtil.toList(query.getTitleLevelDictionaryCode())); expertDictionaryQueryList.add(expertDictionaryQuery); } @@ -419,13 +419,11 @@ public class ExpertMetaApplyManage { List titleLevelDictionaryList = titleLevelDictMap.get(userId); if (CollectionUtils.isNotEmpty(titleLevelDictionaryList)) { expertApplyMetaVO.setTitleLevel(titleLevelDictionaryList.stream().map(r -> { - DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); + Optional dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo(); dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode()); dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField()); - if (Objects.nonNull(dictionaryDTO)) { - dictionaryFieldInfo.setDictionaryName(dictionaryDTO.getName()); - } + dictionaryDTO.ifPresent(dictDTO -> dictionaryFieldInfo.setDictionaryName(dictDTO.getName())); return dictionaryFieldInfo; }).collect(Collectors.toList())); } @@ -434,13 +432,11 @@ public class ExpertMetaApplyManage { List expertTypeDictionaryList = expertTypeDictMap.get(userId); if (CollectionUtils.isNotEmpty(titleLevelDictionaryList)) { expertApplyMetaVO.setExpertType(expertTypeDictionaryList.stream().map(r -> { - DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); + Optional dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo(); dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode()); dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField()); - if (Objects.nonNull(dictionaryDTO)) { - dictionaryFieldInfo.setDictionaryName(dictionaryDTO.getName()); - } + dictionaryDTO.ifPresent(dictDTO -> dictionaryFieldInfo.setDictionaryName(dictDTO.getName())); return dictionaryFieldInfo; }).collect(Collectors.toList())); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java index 0f92918..8e58635 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java @@ -25,7 +25,7 @@ import com.hz.pm.api.expert.model.dto.*; import com.hz.pm.api.expert.service.*; import com.hz.pm.api.expert.utils.SensitiveModifySegmentUtils; import com.hz.pm.api.meeting.helper.YxtCallOrSmsHelper; -import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.model.ExpertRegionInfo; import com.hz.pm.api.meta.model.entity.ExpertDictionary; import com.hz.pm.api.meta.model.entity.ExpertTag; @@ -415,7 +415,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { // 保存所有专家字典字段 List expertType = cmd.getExpertType(); if (CollUtil.isNotEmpty(expertType)) { - expertType.forEach(r -> r.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey())); + expertType.forEach(r -> r.setExpertInfoField(ExpertDictTypeEnum.EXPERT_TYPE.getKey())); List saveExpertDictList = buildSaveExpertDictionaryList(expertUserId, expertType); iExpertDictionaryService.saveBatch(saveExpertDictList); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/Meeting.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/Meeting.java index 339c4cc..055c1d7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/Meeting.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/Meeting.java @@ -71,6 +71,9 @@ public class Meeting implements Serializable { @ApiModelProperty("是否确认名单") private Boolean confirmedRoster; + @ApiModelProperty("短信通知签名") + private String smsNotifySign; + @ApiModelProperty("举办单位") private String holdOrg; @@ -92,12 +95,6 @@ public class Meeting implements Serializable { @ApiModelProperty("备注") private String remark; - @ApiModelProperty("会议结果说明") - private String resultDescription; - - @ApiModelProperty("会议结果附件") - private String resultAttachFiles; - @ApiModelProperty("创建人ID") @TableField(fill = FieldFill.INSERT) private Long createBy; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingInnerProject.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingInnerProject.java index 4b57021..afe2b3c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingInnerProject.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingInnerProject.java @@ -1,13 +1,12 @@ package com.hz.pm.api.meeting.entity.domain; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; +import java.time.LocalDateTime; /** *

@@ -37,4 +36,16 @@ public class MeetingInnerProject implements Serializable { @ApiModelProperty("项目编号") private String projectCode; + @ApiModelProperty("会议结果说明") + private String resultDescription; + + @ApiModelProperty("会议结果附件") + private String resultAttachFiles; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateOn; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingOuterProject.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingOuterProject.java index 81848b6..bedb882 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingOuterProject.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingOuterProject.java @@ -43,6 +43,12 @@ public class MeetingOuterProject implements Serializable { @ApiModelProperty("申报金额") private BigDecimal declareAmount; + @ApiModelProperty("会议结果说明") + private String resultDescription; + + @ApiModelProperty("会议结果附件") + private String resultAttachFiles; + @ApiModelProperty("会议ID") private Long meetingId; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingBasicDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingBasicDTO.java index 6b85412..0f27810 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingBasicDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingBasicDTO.java @@ -4,7 +4,9 @@ import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.hibernate.validator.constraints.Length; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.time.LocalDateTime; @@ -51,6 +53,11 @@ public class MeetingBasicDTO { @ApiModelProperty("评审地点") private String meetingAddress; + @NotBlank(message = "短信通知签名不能为空") + @Length(min = 1, max = 20, message = "短信通知签名无效") + @ApiModelProperty("短信通知签名") + private String smsNotifySign; + @NotEmpty(message = "联系人不能为空") @ApiModelProperty("联系人") private String connecter; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingReviewProjectDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingReviewProjectDTO.java index 9f40839..cf64e5f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingReviewProjectDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/MeetingReviewProjectDTO.java @@ -37,7 +37,10 @@ public class MeetingReviewProjectDTO { @ApiModelProperty("申报单位") private String buildOrg; - @ApiModelProperty("评审结果") - private String reviewResult; + @ApiModelProperty("会议结果说明") + private String resultDescription; + + @ApiModelProperty("会议结果附件") + private String resultAttachFiles; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ReviewProjectDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ReviewProjectDTO.java index 29d76f4..1b94096 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ReviewProjectDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ReviewProjectDTO.java @@ -68,4 +68,10 @@ public class ReviewProjectDTO { @ApiModelProperty("是否已评价:0 未自评、1 已自评、2 已终评") private Integer reviewed; + @ApiModelProperty("会议结果说明") + private String resultDescription; + + @ApiModelProperty("会议结果附件") + private String resultAttachFiles; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingResultUploadReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingResultUploadReq.java index cc0d197..c286596 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingResultUploadReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingResultUploadReq.java @@ -21,6 +21,10 @@ public class MeetingResultUploadReq { @NotNull(message = "会议ID不能为空") private Long meetingId; + @ApiModelProperty("项目关联会议ID") + @NotNull(message = "项目关联会议ID不能为空") + private Long meetingProjectId; + @ApiModelProperty("会议结果说明") @NotBlank(message = "会议结果说明不能为空") private String resultDescription; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertEvalListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertEvalListItemVO.java index 4af2ae0..1de962c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertEvalListItemVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/ExpertEvalListItemVO.java @@ -15,6 +15,6 @@ import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = true) public class ExpertEvalListItemVO extends ExpertBasicInfoVO{ - private Long evaluationId; + private Long expertJudgeId; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java index 06b25a4..3c5e2f4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java @@ -35,6 +35,9 @@ public class MeetingByManagerVO { @JSONField(format = "yyyy-MM-dd HH:mm") private LocalDateTime endTime; + @ApiModelProperty("评审地点") + private String meetingAddress; + @ApiModelProperty("会议状态") private Integer status; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingDetailBasicVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingDetailBasicVO.java index f084599..a244b7b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingDetailBasicVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingDetailBasicVO.java @@ -57,6 +57,9 @@ public class MeetingDetailBasicVO { @ApiModelProperty("会议耗时") private Integer meetingUsageTime; + @ApiModelProperty("短信通知单位签名") + private String smsNotifySign; + @ApiModelProperty("联系人") private String connecter; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingReviewProjectVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingReviewProjectVO.java index b374a0c..59b2ceb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingReviewProjectVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingReviewProjectVO.java @@ -46,8 +46,11 @@ public class MeetingReviewProjectVO { @ApiModelProperty("申报单位") private String buildOrg; - @ApiModelProperty("评审结果") - private String reviewResult; + @ApiModelProperty("会议结果说明") + private String resultDescription; + + @ApiModelProperty("会议结果附件") + private String resultAttachFiles; @ApiModelProperty("创建时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java index 62d4c03..7b07520 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java @@ -29,9 +29,9 @@ import com.hz.pm.api.meeting.entity.vo.MeetingByManagerVO; import com.hz.pm.api.meeting.service.IExpertInviteAvoidRuleService; import com.hz.pm.api.meeting.service.IExpertInviteRuleService; import com.hz.pm.api.meeting.service.IMeetingExpertService; -import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.helper.DictionaryCache; -import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.DictDTO; import com.hz.pm.api.sys.model.dto.RegionDTO; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.CollUtils; @@ -116,6 +116,7 @@ public class MeetingManageHelper { result.setCreateOn(meeting.getCreateOn()); result.setConnecter(meeting.getConnecter()); result.setContact(meeting.getContact()); + result.setMeetingAddress(meeting.getMeetingAddress()); return result; } @@ -166,11 +167,11 @@ public class MeetingManageHelper { basicInfoVo.setContact(userInfo.getPhoneNo()); basicInfoVo.setCompany(userInfo.getCompany()); Optional first = w.getExpertDictionaryList().stream() - .filter(dict -> dict.getExpertInfoField().equals(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey())) + .filter(dict -> dict.getExpertInfoField().equals(ExpertDictTypeEnum.TITLE_LEVEL.getKey())) .findFirst(); if (first.isPresent()) { - DictionaryDTO dictInfo = dictionaryCache.getByCode(first.get().getDictionaryCode()); - basicInfoVo.setJobLevel(dictInfo.getName()); + Optional dictInfo = dictionaryCache.getByCode(first.get().getDictionaryCode()); + dictInfo.ifPresent(d -> basicInfoVo.setJobLevel(d.getName())); } else { basicInfoVo.setJobLevel(""); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/DashboardManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/DashboardManage.java index f4d3dde..326cf49 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/DashboardManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/DashboardManage.java @@ -127,7 +127,7 @@ public class DashboardManage { item.setEndTime(w.getEndTime()); item.setStartTime(w.getStartTime()); item.setStatus(w.getStatus()); - item.setType(dictionaryCache.getByCode(w.getType()).getName()); + item.setType(dictionaryCache.getByCode(w.getType()).get().getName()); item.setMeetingName(w.getName()); return item; }).collect(Collectors.toList()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java index d9c7e2b..3a8978f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java @@ -47,7 +47,6 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.IdVo; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.basic.util.StrPool; import com.ningdatech.basic.util.ValidUtil; import com.ningdatech.cache.lock.DistributedLock; import lombok.RequiredArgsConstructor; @@ -104,10 +103,10 @@ public class MeetingManage { private static final String MEETING_CREATE_KEY = "MEETING_CREATE:"; - private String getDictName(String dictType) { - return Optional.ofNullable(dictionaryCache.getByCode(dictType)) - .flatMap(w -> Optional.of(w.getName())) - .orElse(StrPool.EMPTY); + private String getDictName(String dictCode) { + return dictionaryCache.getByCode(dictCode) + .flatMap(w -> Optional.ofNullable(w.getName())) + .orElse(StrUtil.EMPTY); } /** @@ -141,7 +140,7 @@ public class MeetingManage { meeting.setInviteType(inviteRule.getInviteType()); meetingService.save(meeting); if (meeting.getIsInnerProject() != null) { - if (meetingBasic.getIsInnerProject()) { + if (Boolean.TRUE.equals(meetingBasic.getIsInnerProject())) { List projects = meetingBasic.getInnerProjects().stream().map(w -> { MeetingInnerProject project = BeanUtil.copyProperties(w, MeetingInnerProject.class); project.setMeetingId(meeting.getId()); @@ -452,15 +451,13 @@ public class MeetingManage { .invitedStopped(meeting.getInviteStatus()) .attachFiles(meeting.getAttachFiles()) .description(meeting.getDescription()) - .resultDescription(meeting.getResultDescription()) - .resultAttachFiles(meeting.getResultAttachFiles()) .remark(meeting.getRemark()) .build(); if (meeting.getIsInnerProject() != null) { if (Boolean.TRUE.equals(meeting.getIsInnerProject())) { List innerProjects = meetingInnerProjectService.listByMeetingId(meetingId); - List projects = projectService.listByIds(CollUtils.fieldList(innerProjects, MeetingInnerProject::getProjectId)); - Map reviewMap = expertReviewService.listFinalReviewMap(meetingId); + Map innerProjectMap = CollUtils.listToMap(innerProjects, MeetingInnerProject::getProjectId); + List projects = projectService.listByIds(innerProjectMap.keySet()); List convert = CollUtils.convert(projects, w -> { MeetingReviewProjectDTO mrp = new MeetingReviewProjectDTO(); mrp.setProjectId(w.getId()); @@ -470,9 +467,10 @@ public class MeetingManage { mrp.setProjectYear(w.getProjectYear()); mrp.setDeclareAmount(w.getDeclareAmount()); mrp.setProjectCode(w.getProjectCode()); - ExpertReview review = reviewMap.get(w.getId()); - if (review != null) { - mrp.setReviewResult(ReviewResultEnum.getByCode(review.getReviewResult()).getValue()); + MeetingInnerProject innerProject = innerProjectMap.get(w.getId()); + if (innerProject != null) { + mrp.setResultAttachFiles(innerProject.getResultAttachFiles()); + mrp.setResultDescription(innerProject.getResultDescription()); } return mrp; }); @@ -591,7 +589,7 @@ public class MeetingManage { } if (randomRule.getExpertDicts() != null) { randomRule.getExpertDicts().forEach(w -> { - List dictNames = CollUtils.convert(w.getDictCodes(), dictCode -> dictionaryCache.getByCode(dictCode).getName()); + List dictNames = CollUtils.convert(w.getDictCodes(), this::getDictName); w.setDictCodes(dictNames); }); } @@ -900,18 +898,16 @@ public class MeetingManage { public List projectsByMeetingId(Long meetingId) { Meeting meeting = meetingService.getById(meetingId); - if (meeting.getIsInnerProject()) { + if (Boolean.TRUE.equals(meeting.getIsInnerProject())) { List projects = meetingInnerProjectService.listByMeetingId(meetingId); - List projectIdList = CollUtils.fieldList(projects, MeetingInnerProject::getProjectId); - List projectList = projectService.listByIds(projectIdList); - Map reviewMap = expertReviewService.listFinalReviewMap(meetingId); + Map projectMap = CollUtils.listToMap(projects, MeetingInnerProject::getProjectId); + List projectList = projectService.listByIds(projectMap.keySet()); return CollUtils.convert(projectList, w -> { MeetingReviewProjectVO vo = buildProjectList(w); - ExpertReview review = reviewMap.get(w.getId()); - if (review != null) { - vo.setReviewResult(ReviewResultEnum.getByCode(review.getReviewResult()).getValue()); - } else { - vo.setReviewResult("--"); + MeetingInnerProject innerProject = projectMap.get(w.getId()); + if (innerProject != null) { + vo.setResultAttachFiles(innerProject.getResultAttachFiles()); + vo.setResultDescription(innerProject.getResultDescription()); } return vo; }); @@ -949,7 +945,7 @@ public class MeetingManage { } public void uploadMeetingResult(MeetingResultUploadReq req) { - String key = "meeting_result_upload:" + req.getMeetingId(); + String key = "meeting_result_upload:" + req.getMeetingProjectId(); if (!distributedLock.lock(key, RETRY_TIMES)) { throw BizException.wrap("正在上传会议结果,请勿重复操作"); } @@ -962,13 +958,28 @@ public class MeetingManage { if (meeting.getEndTime().isAfter(now)) { throw BizException.wrap("会议未结束"); } - LambdaUpdateWrapper mUpdate = Wrappers.lambdaUpdate(Meeting.class) - .set(Meeting::getUpdateOn, now) - .set(Meeting::getResultDescription, req.getResultDescription()) - .set(Meeting::getResultAttachFiles, req.getResultAttachFiles()) - .set(Meeting::getUpdateBy, LoginUserUtil.getUserId()) - .eq(Meeting::getId, req.getMeetingId()); - meetingService.update(mUpdate); + if (meeting.getIsInnerProject() == null) { + throw BizException.wrap("此会议未关联项目"); + } + if (Boolean.TRUE.equals(meeting.getIsInnerProject())) { + LambdaUpdateWrapper mUpdate = Wrappers + .lambdaUpdate(MeetingInnerProject.class) + .set(MeetingInnerProject::getUpdateOn, now) + .set(MeetingInnerProject::getResultDescription, req.getResultDescription()) + .set(MeetingInnerProject::getResultAttachFiles, req.getResultAttachFiles()) + .set(MeetingInnerProject::getUpdateBy, LoginUserUtil.getUserId()) + .eq(MeetingInnerProject::getId, req.getMeetingProjectId()); + meetingInnerProjectService.update(mUpdate); + } else { + LambdaUpdateWrapper mUpdate = Wrappers + .lambdaUpdate(MeetingOuterProject.class) + .set(MeetingOuterProject::getUpdateOn, now) + .set(MeetingOuterProject::getResultDescription, req.getResultDescription()) + .set(MeetingOuterProject::getResultAttachFiles, req.getResultAttachFiles()) + .set(MeetingOuterProject::getUpdateBy, LoginUserUtil.getUserId()) + .eq(MeetingOuterProject::getId, req.getMeetingProjectId()); + meetingOuterProjectService.update(mUpdate); + } } finally { distributedLock.releaseLock(key); } @@ -979,14 +990,14 @@ public class MeetingManage { if (experts.isEmpty()) { return Collections.emptyList(); } - Map evaluationIdMap = meetingExpertJudgeService.getExpertJudgeIdMap(meetingId); + Map expertJudgeMap = meetingExpertJudgeService.getExpertJudgeIdMap(meetingId); List expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); Map expertMap = meetingManageHelper.getExpertBasicInfo(expertIds); return experts.stream().map(w -> { Long expertId = w.getExpertId(); ExpertEvalListItemVO item = new ExpertEvalListItemVO(); BeanUtil.copyProperties(expertMap.get(expertId), item); - item.setEvaluationId(evaluationIdMap.get(expertId)); + item.setExpertJudgeId(expertJudgeMap.get(expertId)); return item; }).collect(Collectors.toList()); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingExpertJudgeService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingExpertJudgeService.java index e2165fd..dd6e98f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingExpertJudgeService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/IMeetingExpertJudgeService.java @@ -36,7 +36,7 @@ public interface IMeetingExpertJudgeService extends IService LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpertJudge.class) .select(MeetingExpertJudge::getExpertId, MeetingExpertJudge::getId) .eq(MeetingExpertJudge::getMeetingId, meetingId); - return CollUtils.listToMap(list(query), MeetingExpertJudge::getExpertId, MeetingExpertJudge::getExpertId); + return CollUtils.listToMap(list(query), MeetingExpertJudge::getExpertId, MeetingExpertJudge::getId); } default List listByMeetingExpertIds(Collection meetingExpertIds) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaDictionaryAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaDictionaryAssembler.java index 6243da7..5fb9554 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaDictionaryAssembler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaDictionaryAssembler.java @@ -2,7 +2,7 @@ package com.hz.pm.api.meta.assembler; import com.hz.pm.api.meta.model.entity.MetaDictionary; -import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.DictDTO; import com.hz.pm.api.meta.model.vo.ResDictionaryVO; /** @@ -12,8 +12,8 @@ import com.hz.pm.api.meta.model.vo.ResDictionaryVO; public class MetaDictionaryAssembler { - public static DictionaryDTO toDictionaryDTO(MetaDictionary dictionaryManage) { - DictionaryDTO dictionaryDTO = new DictionaryDTO(); + public static DictDTO toDictionaryDTO(MetaDictionary dictionaryManage) { + DictDTO dictionaryDTO = new DictDTO(); dictionaryDTO.setDescribe(dictionaryManage.getDictionaryDescribe()); dictionaryDTO.setDictionaryCode(dictionaryManage.getDictionaryCode()); dictionaryDTO.setDictionaryType(dictionaryManage.getDictionaryType()); @@ -23,7 +23,7 @@ public class MetaDictionaryAssembler { return dictionaryDTO; } - public static ResDictionaryVO toDictionaryVO(DictionaryDTO dictionaryDTO) { + public static ResDictionaryVO toDictionaryVO(DictDTO dictionaryDTO) { ResDictionaryVO resDictionaryVO = new ResDictionaryVO(); resDictionaryVO.setDescribe(dictionaryDTO.getDescribe()); resDictionaryVO.setDictionaryCode(dictionaryDTO.getDictionaryCode()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictAllTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictAllTypeEnum.java deleted file mode 100644 index 441a1d2..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictAllTypeEnum.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.hz.pm.api.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; - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictExpertInfoTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictExpertInfoTypeEnum.java deleted file mode 100644 index 137b831..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictExpertInfoTypeEnum.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.hz.pm.api.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"), - /** - * 所属专家库 - */ - EXPERT_LIBRARY("expert_library"), - /** - * 单位类型 - */ - COMPANY_ATTRIBUTE("company_attribute"), - /** - * 职称级别 - */ - TITLE_LEVEL("title_level"), - /** - * 推荐方式 - */ - RECOMMENDED_WAY("recommended_way"); - - - private final String key; - - public static List getAll() { - List 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)); - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictTypeEnum.java new file mode 100644 index 0000000..5e8497b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/DictTypeEnum.java @@ -0,0 +1,107 @@ +package com.hz.pm.api.meta.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 所有的专家字典类型 + *

+ * + * @author WendyYang + * @since 13:50 2023/12/21 + */ +@Getter +@AllArgsConstructor +public enum DictTypeEnum { + + /** + * 政治面貌 + */ + POLITICAL("political"), + /** + * 专家来源 + */ + EXPERT_SOURCE("expert_source"), + /** + * 学历 + */ + EDU("edu"), + /** + * 学位 + */ + DEGREE("degree"), + /** + * 在职状态 + */ + JOB_STATUS("job_status"), + /** + * 行政职级 + */ + ADMINISTRATIVE_RANK("administrative_rank"), + /** + * 专家类型 + */ + EXPERT_TYPE("expert_type"), + /** + * 专家领域 + */ + EXPERT_AREA("expert_area"), + /** + * 专家专业特长 + */ + EXPERT_SPECIALTY("expert_specialty"), + /** + * 专家级别 + */ + EXPERT_LEVEL("expert_level"), + /** + * 所属专家库 + */ + EXPERT_LIBRARY("expert_library"), + /** + * 单位类型 + */ + COMPANY_ATTRIBUTE("company_attribute"), + /** + * 职称级别 + */ + TITLE_LEVEL("title_level"), + /** + * 通知类型 + */ + NOTICE_TYPE("notice_type"), + /** + * 会议类型 + */ + MEETING_TYPE("meeting_type"); + + private final String key; + + public static final List ALL; + + static { + List tmpKeys = Arrays.stream(values()) + .map(DictTypeEnum::getKey) + .collect(Collectors.toList()); + ALL = Collections.unmodifiableList(tmpKeys); + } + + public static boolean contains(String key) { + return ALL.contains(key); + } + + public static DictTypeEnum of(String key) { + return Arrays.stream(values()) + .filter(w -> w.getKey().equals(key)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("字典类型无效:" + key)); + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/ExpertDictTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/ExpertDictTypeEnum.java new file mode 100644 index 0000000..1c21088 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/constant/ExpertDictTypeEnum.java @@ -0,0 +1,101 @@ +package com.hz.pm.api.meta.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 专家字典信息枚举类 + *

+ * + * @author WendyYang + * @since 13:45 2023/12/21 + */ +@Getter +@AllArgsConstructor +public enum ExpertDictTypeEnum { + + /** + * 政治面貌 + */ + POLITICAL("political"), + /** + * 学历 + */ + EDU("edu"), + /** + * 学位 + */ + DEGREE("degree"), + /** + * 在职状态 + */ + JOB_STATUS("job_status"), + /** + * 行政职级 + */ + ADMINISTRATIVE_RANK("administrative_rank"), + /** + * 内外围(专家类型) + */ + EXPERT_TYPE("expert_type"), + /** + * 专家领域 + */ + EXPERT_AREA("expert_area"), + /** + * 专家级别 + */ + EXPERT_LEVEL("expert_level"), + /** + * 专家专业特长 + */ + EXPERT_SPECIALTY("expert_specialty"), + /** + * 所属专家库 + */ + EXPERT_LIBRARY("expert_library"), + /** + * 单位类型 + */ + COMPANY_ATTRIBUTE("company_attribute"), + /** + * 职称级别 + */ + TITLE_LEVEL("title_level"), + /** + * 推荐方式 + */ + RECOMMENDED_WAY("recommended_way"); + + + private final String key; + + //================================================================================================================== + + public static final List ALL; + + static { + List tmpKeys = Arrays.stream(values()) + .map(ExpertDictTypeEnum::getKey) + .collect(Collectors.toList()); + ALL = Collections.unmodifiableList(tmpKeys); + } + + public static boolean contains(String key) { + return ALL.contains(key); + } + + public static ExpertDictTypeEnum of(String key) { + return Arrays.stream(values()) + .filter(w -> w.getKey().equals(key)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("专家字典类型无效:" + key)); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/controller/MetaDictionaryManageController.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/controller/MetaDictionaryManageController.java index f223d46..4e3a846 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/controller/MetaDictionaryManageController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/controller/MetaDictionaryManageController.java @@ -1,12 +1,12 @@ package com.hz.pm.api.meta.controller; -import com.ningdatech.log.annotation.WebLog; import com.hz.pm.api.meta.manage.MetaManage; import com.hz.pm.api.meta.model.po.ReqAddDictionaryPO; import com.hz.pm.api.meta.model.po.ReqDictionaryListPO; import com.hz.pm.api.meta.model.vo.ResDictionaryListVO; import com.hz.pm.api.meta.validate.DictParamValidator; +import com.ningdatech.log.annotation.WebLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -31,7 +31,6 @@ import java.util.List; @Api(tags = "基础数据接口") public class MetaDictionaryManageController { - // private final IMetaDictionaryManageService metaDictionaryManageService; private final MetaManage metaManage; @PostMapping("/list") @@ -51,8 +50,8 @@ public class MetaDictionaryManageController { @PostMapping("/add/dictionary") @ApiOperation("添加字典值") @WebLog("添加字典值") - public void addDictionary(@Valid @RequestBody ReqAddDictionaryPO reqAddDictionaryPO) { - metaManage.addDictionary(reqAddDictionaryPO); + public void addDictionary(@Valid @RequestBody ReqAddDictionaryPO req) { + metaManage.addDictionary(req); } @PostMapping("/remove/dictionary/{dictionaryCode}") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/DictionaryCache.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/DictionaryCache.java index 127d473..0ae6557 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/DictionaryCache.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/DictionaryCache.java @@ -1,11 +1,11 @@ package com.hz.pm.api.meta.helper; - -import com.hz.pm.api.meta.constant.DictAllTypeEnum; -import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.constant.DictTypeEnum; +import com.hz.pm.api.meta.model.dto.DictDTO; import java.util.List; +import java.util.Optional; /** * @author liuxinxin @@ -17,33 +17,36 @@ public interface DictionaryCache { /** * 根据字典类型枚举 获取 字典列表 * - * @param dictionaryType - * @return + * @param dictionaryType \ + * @return \ */ - List getDictionaryListByDictionaryType(DictAllTypeEnum dictionaryType); + List listDictByDictType(DictTypeEnum dictionaryType); /** * 根据字典类型 获取 字典列表 * - * @param dictionaryType - * @return + * @param dictType \ + * @return \ */ - List getDictionaryListByDictionaryType(String dictionaryType); + List listDictByDictType(String dictType); /** * 根据字典类型、字典编码 获取 字典实体 * - * @param dictionaryType - * @param code - * @return + * @param dictionaryType \ + * @param code \ + * @return \ */ - DictionaryDTO getDictionaryByDictionaryType(DictAllTypeEnum dictionaryType, String code); + DictDTO getDictionaryByDictionaryType(DictTypeEnum dictionaryType, String code); /** * 根据字典编码 获取 字典实体 * - * @param dictionaryCode - * @return + * @param dictCode \ + * @return \ */ - DictionaryDTO getByCode(String dictionaryCode); + Optional getByCode(String dictCode); + + Optional getByDictTypeAndName(String dictType, String name); + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractDictionaryCache.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractDictionaryCache.java index a4376a0..26ff827 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractDictionaryCache.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractDictionaryCache.java @@ -2,9 +2,9 @@ package com.hz.pm.api.meta.helper.basic; import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.cache.LoadingCache; -import com.hz.pm.api.meta.constant.DictAllTypeEnum; +import com.hz.pm.api.meta.constant.DictTypeEnum; import com.hz.pm.api.meta.helper.DictionaryCache; -import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.DictDTO; import com.hz.pm.api.meta.service.IMetaDictionaryService; import com.ningdatech.basic.util.CollUtils; import lombok.RequiredArgsConstructor; @@ -24,30 +24,31 @@ public abstract class AbstractDictionaryCache implements InitializingBean, Dicti private final IMetaDictionaryService metaDictionaryService; - protected Map dictionaryMap = new ConcurrentHashMap<>(); - protected LoadingCache> dictionaryCacheHelper; + protected Map dictionaryMap = new ConcurrentHashMap<>(); + protected LoadingCache> dictCache; @Override public void afterPropertiesSet() { - dictionaryCacheHelper = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) - .refreshAfterWrite(30, TimeUnit.MINUTES).build(key -> { - List dicts = metaDictionaryService.queryAll(); + dictCache = Caffeine.newBuilder() + .refreshAfterWrite(30, TimeUnit.MINUTES) + .build(key -> { + List dicts = metaDictionaryService.queryAll(); dictionaryMap = buildCateMap(dicts); - Map> dictMapByType = CollUtils.group(dicts, DictionaryDTO::getDictionaryType); + Map> dictMapByType = CollUtils.group(dicts, DictDTO::getDictionaryType); return dictMapByType.get(key); }); warmUp(); } - private Map buildCateMap(List dictionaryDTOList) { - Map dictionaryDtoMap = new ConcurrentHashMap<>(128); + private Map buildCateMap(List dictionaryDTOList) { + Map 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()); + for (DictTypeEnum typeEnum : DictTypeEnum.values()) { + dictCache.get(typeEnum.getKey()); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/DictionaryCacheImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/DictionaryCacheImpl.java index 0885bd1..68f4311 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/DictionaryCacheImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/DictionaryCacheImpl.java @@ -1,13 +1,14 @@ package com.hz.pm.api.meta.helper.impl; -import com.hz.pm.api.meta.constant.DictAllTypeEnum; +import com.hz.pm.api.meta.constant.DictTypeEnum; import com.hz.pm.api.meta.helper.basic.AbstractDictionaryCache; -import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.DictDTO; import com.hz.pm.api.meta.service.IMetaDictionaryService; import org.springframework.stereotype.Component; import java.util.List; import java.util.Objects; +import java.util.Optional; /** * @author liuxinxin @@ -21,25 +22,36 @@ public class DictionaryCacheImpl extends AbstractDictionaryCache { } @Override - public List getDictionaryListByDictionaryType(DictAllTypeEnum dictionaryType) { - return dictionaryCacheHelper.get(dictionaryType.getKey()); + public List listDictByDictType(DictTypeEnum dictionaryType) { + return dictCache.get(dictionaryType.getKey()); } @Override - public List getDictionaryListByDictionaryType(String dictionaryType) { - return dictionaryCacheHelper.get(dictionaryType); + public List listDictByDictType(String dictType) { + return dictCache.get(dictType); } @Override - public DictionaryDTO getDictionaryByDictionaryType(DictAllTypeEnum dictionaryType, String code) { - return Objects.requireNonNull(dictionaryCacheHelper.get(dictionaryType.getKey())) + public DictDTO getDictionaryByDictionaryType(DictTypeEnum dictionaryType, String code) { + return Objects.requireNonNull(dictCache.get(dictionaryType.getKey())) .stream().filter(w -> w.getDictionaryCode().equals(code)) .findFirst().orElse(null); } @Override - public DictionaryDTO getByCode(String dictionaryCode) { - return dictionaryMap.get(dictionaryCode); + public Optional getByCode(String dictionaryCode) { + return Optional.ofNullable(dictionaryMap.get(dictionaryCode)); + } + + @Override + public Optional getByDictTypeAndName(String dictType, String name) { + List dicts = dictCache.get(dictType); + if (dicts == null || dicts.isEmpty()) { + return Optional.empty(); + } + return dicts.stream() + .filter(w -> w.getName().equalsIgnoreCase(name)) + .findFirst(); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java index b207a53..55dd286 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java @@ -6,18 +6,19 @@ 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.hz.pm.api.meta.constant.DictTypeEnum; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.CollUtils; import com.hz.pm.api.common.enumeration.BoolDisplayEnum; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.meta.assembler.MetaDictionaryAssembler; import com.hz.pm.api.meta.assembler.MetaTagAssembler; -import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.constant.ExpertTagEnum; import com.hz.pm.api.meta.constant.TagConst; import com.hz.pm.api.meta.helper.DictionaryCache; import com.hz.pm.api.meta.helper.TagCache; -import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.DictDTO; import com.hz.pm.api.meta.model.dto.TagTreeDTO; import com.hz.pm.api.meta.model.entity.ExpertDictionary; import com.hz.pm.api.meta.model.entity.ExpertTag; @@ -53,16 +54,15 @@ public class MetaManage { private final IExpertTagService iExpertTagService; public List getDictionaryList(ReqDictionaryListPO request) { - List dictionaryTypeList = request.getDictionaryTypeList(); - if (CollectionUtils.isEmpty(dictionaryTypeList)) { - dictionaryTypeList = DictExpertInfoTypeEnum.getAll(); - } - + List dictionaryTypeList = CollUtil.defaultIfEmpty(request.getDictionaryTypeList(), DictTypeEnum.ALL); List resDictionaryListVos = new ArrayList<>(); for (String dictionaryType : dictionaryTypeList) { ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); resDictionaryListVO.setDictionaryName(dictionaryType); - List dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); + List dictionaryList = dictionaryCache.listDictByDictType(dictionaryType); + if (dictionaryList == null) { + continue; + } List resDictionaryVOList = dictionaryList.stream() .map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); resDictionaryListVO.setDictionaryList(resDictionaryVOList); @@ -97,7 +97,7 @@ public class MetaManage { for (String dictionaryType : dictionaryTypeList) { ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); resDictionaryListVO.setDictionaryName(dictionaryType); - List dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); + List dictionaryList = dictionaryCache.listDictByDictType(dictionaryType); List resDictionaryVOList = dictionaryList.stream() .map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); resDictionaryListVO.setDictionaryList(resDictionaryVOList); @@ -131,7 +131,7 @@ public class MetaManage { @Transactional(rollbackFor = Exception.class) public void addDictionary(ReqAddDictionaryPO reqAddDictionaryPO) { String dictionaryType = reqAddDictionaryPO.getDictionaryType(); - boolean contains = DictExpertInfoTypeEnum.contains(dictionaryType); + boolean contains = ExpertDictTypeEnum.contains(dictionaryType); if (!contains) { throw BizException.wrap("无效的专家字典类型:%s", dictionaryType); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/DictDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/DictDTO.java new file mode 100644 index 0000000..b8dbb6b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/DictDTO.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.meta.model.dto; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/22 上午10:49 + */ +@Data +public class DictDTO { + + private String dictionaryType; + + /** + * 编码 随机数处理 + */ + private String dictionaryCode; + + /** + * 名称 + */ + private String name; + + /** + * 描述 + */ + private String describe; + + /** + * 排序 + */ + private Integer sortValue; + + /** + * 是否内置,内置不可删除 + */ + private String readonly; + +} + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/DictionaryDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/DictionaryDTO.java deleted file mode 100644 index 07252a8..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/model/dto/DictionaryDTO.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.hz.pm.api.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; - -} - diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IExpertDictionaryService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IExpertDictionaryService.java index 536da40..ca7f35d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IExpertDictionaryService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IExpertDictionaryService.java @@ -2,7 +2,7 @@ package com.hz.pm.api.meta.service; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.IService; -import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.model.entity.ExpertDictionary; import java.util.Collection; @@ -27,7 +27,7 @@ public interface IExpertDictionaryService extends IService { * @return / * @author WendyYang **/ - List listByUserId(Collection userIds, DictExpertInfoTypeEnum dictType); + List listByUserId(Collection userIds, ExpertDictTypeEnum dictType); default void removeByUserId(Long userId) { this.remove(Wrappers.lambdaQuery(ExpertDictionary.class).eq(ExpertDictionary::getUserId, userId)); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IMetaDictionaryService.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IMetaDictionaryService.java index d1556d7..46051a2 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IMetaDictionaryService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/IMetaDictionaryService.java @@ -2,7 +2,7 @@ package com.hz.pm.api.meta.service; import com.hz.pm.api.meta.model.entity.MetaDictionary; import com.baomidou.mybatisplus.extension.service.IService; -import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.DictDTO; import java.util.List; @@ -16,7 +16,7 @@ import java.util.List; */ public interface IMetaDictionaryService extends IService { - List queryAll(); + List queryAll(); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/ExpertDictionaryServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/ExpertDictionaryServiceImpl.java index 7f04708..05d8981 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/ExpertDictionaryServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/ExpertDictionaryServiceImpl.java @@ -3,7 +3,7 @@ package com.hz.pm.api.meta.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.mapper.ExpertDictionaryMapper; import com.hz.pm.api.meta.model.entity.ExpertDictionary; import com.hz.pm.api.meta.service.IExpertDictionaryService; @@ -24,7 +24,7 @@ import java.util.List; public class ExpertDictionaryServiceImpl extends ServiceImpl implements IExpertDictionaryService { @Override - public List listByUserId(Collection userIds, DictExpertInfoTypeEnum dictType) { + public List listByUserId(Collection userIds, ExpertDictTypeEnum dictType) { // 获取专家职称 LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertDictionary.class) .in(ExpertDictionary::getUserId, userIds) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java index b0ef27a..cb8103f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java @@ -5,7 +5,7 @@ import com.hz.pm.api.meta.model.entity.MetaDictionary; import com.hz.pm.api.meta.mapper.MetaDictionaryMapper; import com.hz.pm.api.meta.service.IMetaDictionaryService; import com.hz.pm.api.meta.assembler.MetaDictionaryAssembler; -import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.dto.DictDTO; import org.springframework.stereotype.Service; import java.util.List; @@ -23,9 +23,9 @@ import java.util.stream.Collectors; public class MetaDictionaryServiceImpl extends ServiceImpl implements IMetaDictionaryService { @Override - public List queryAll() { + public List queryAll() { List dictionaryList = this.lambdaQuery().ne(MetaDictionary::getId, -1).list(); - List dictionaryDTOList = dictionaryList.stream().map(MetaDictionaryAssembler::toDictionaryDTO).collect(Collectors.toList()); + List dictionaryDTOList = dictionaryList.stream().map(MetaDictionaryAssembler::toDictionaryDTO).collect(Collectors.toList()); return dictionaryDTOList; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/validate/DictParamValidator.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/validate/DictParamValidator.java index 5dcc2af..2c32a20 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/validate/DictParamValidator.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/validate/DictParamValidator.java @@ -1,7 +1,7 @@ package com.hz.pm.api.meta.validate; import com.ningdatech.basic.exception.BizException; -import com.hz.pm.api.meta.constant.DictExpertInfoTypeEnum; +import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.model.po.ReqDictionaryListPO; import org.apache.commons.collections4.CollectionUtils; @@ -20,7 +20,7 @@ public class DictParamValidator { List dictTypeList = req.getDictionaryTypeList(); if (CollectionUtils.isNotEmpty(dictTypeList)) { for (String dictType : dictTypeList) { - if (!DictExpertInfoTypeEnum.contains(dictType)) { + if (!ExpertDictTypeEnum.contains(dictType)) { throw new BizException("无效的字典信息: " + dictType); } }