From bb935c7a17bf3c5254a525d6f34baee819f9d53d Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 4 Apr 2023 16:19:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=93=E5=AE=B6=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E7=BC=96=E7=A0=81=E6=9C=AA=E4=BF=9D=E5=AD=98bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constant/ExpertUserInfoSensitiveFieldEnum.java | 3 +- .../ExpertInfoSensitiveFieldModifyCheckHelper.java | 3 ++ .../pmapi/expert/model/SensitiveModifySegment.java | 3 +- .../expert/service/impl/ExpertInfoServiceImpl.java | 45 +++++++++++++--------- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoSensitiveFieldEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoSensitiveFieldEnum.java index 962cade..588b311 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoSensitiveFieldEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoSensitiveFieldEnum.java @@ -29,6 +29,7 @@ public enum ExpertUserInfoSensitiveFieldEnum { expert_intention_work_region("expert_intention_work_region", "履职意向", ExpertRegionInfo.class, UnitType.list), // 工作单位(单位code和单位法人编号是关联的) company("company", "工作单位", String.class, UnitType.single), + company_uniq_code("company_uniq_code", "工作单位编码", String.class, UnitType.single), legal_entity_code("legal_entity_code", "单位法人编号", String.class, UnitType.single), // 行政职级 administrative_rank("administrative_rank", "行政职级", DictionaryFieldInfo.class, UnitType.list), @@ -45,7 +46,7 @@ public enum ExpertUserInfoSensitiveFieldEnum { private final String key; private final String value; - private final Class aClass; + private final Class aClass; private final UnitType type; public static List getSensitiveDictionaryList() { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java index 68ddd4a..48f6466 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java @@ -80,6 +80,9 @@ public class ExpertInfoSensitiveFieldModifyCheckHelper { .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.company , originalJobInfo.getCompany(), applyJobInfo.getCompany())); sensitiveModifySegmentList + .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.company_uniq_code + , originalJobInfo.getCompanyUniqCode(), applyJobInfo.getCompanyUniqCode())); + sensitiveModifySegmentList .add(new SensitiveModifySegment(ExpertUserInfoSensitiveFieldEnum.legal_entity_code , originalJobInfo.getLegalEntityCode(), applyJobInfo.getLegalEntityCode())); sensitiveModifySegmentList diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/SensitiveModifySegment.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/SensitiveModifySegment.java index bfe93d0..69d05da 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/SensitiveModifySegment.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/SensitiveModifySegment.java @@ -13,6 +13,7 @@ import lombok.Data; import org.apache.commons.collections4.CollectionUtils; import java.util.List; +import java.util.Objects; /** * @author liuxinxin @@ -68,7 +69,7 @@ public class SensitiveModifySegment { case expert_intention_work_region: return RegionUtils.isValueEquals((List) this.original, (List) this.apply); default: - return this.original.equals(this.apply); + return Objects.equals(this.original, this.apply); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java index e880fde..a45bc0a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java @@ -160,6 +160,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { } expertUserFullInfo.setRetiredAt(expertUserInfoDTO.getRetiredAt()); expertUserFullInfo.setCompany(expertUserInfoDTO.getCompany()); + expertUserFullInfo.setCompanyUniqCode(expertUserInfoDTO.getCompanyUniqCode()); expertUserFullInfo.setLegalEntityCode(expertUserInfoDTO.getLegalEntityCode()); expertUserFullInfo.setAdministrativeDuties(expertUserInfoDTO.getAdministrativeDuties()); expertUserFullInfo.setStartWorkAt(expertUserInfoDTO.getStartWorkAt()); @@ -450,11 +451,11 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { .in(ExpertAvoidCompany::getUserId, userIds)); Map> avoidInfoMap = CollUtils.group(expertAvoidCompanyList, ExpertAvoidCompany::getUserId); return expertUserFullInfos.stream().map(w -> ExpertUserInfoAssembler.buildExpertFullInfoAllDTO(w, - expertTagListMap.getOrDefault(w.getUserId(), Collections.emptyList()), - expertDictMap.getOrDefault(w.getUserId(), Collections.emptyList()), - intentionRegionMap.getOrDefault(w.getUserId(), Collections.emptyList()), - metaApplyMap.getOrDefault(w.getUserId(), Collections.emptyList()), - avoidInfoMap.getOrDefault(w.getUserId(), Collections.emptyList()))) + expertTagListMap.getOrDefault(w.getUserId(), Collections.emptyList()), + expertDictMap.getOrDefault(w.getUserId(), Collections.emptyList()), + intentionRegionMap.getOrDefault(w.getUserId(), Collections.emptyList()), + metaApplyMap.getOrDefault(w.getUserId(), Collections.emptyList()), + avoidInfoMap.getOrDefault(w.getUserId(), Collections.emptyList()))) .collect(Collectors.toList()); } @@ -474,7 +475,8 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { saveExpertUserFullInfo.setId(originalExpertUserFullInfo.getId()); // 删除所有专家字典字段(需审核敏感字段不删除) LambdaQueryWrapper expertDictionaryRemove = Wrappers.lambdaQuery(ExpertDictionary.class) - .eq(ExpertDictionary::getUserId, userId).notIn(ExpertDictionary::getExpertInfoField, ExpertUserInfoSensitiveFieldEnum.getSensitiveDictionaryList()); + .eq(ExpertDictionary::getUserId, userId) + .notIn(ExpertDictionary::getExpertInfoField, ExpertUserInfoSensitiveFieldEnum.getSensitiveDictionaryList()); iExpertDictionaryService.remove(expertDictionaryRemove); @@ -487,7 +489,8 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { List saveExpertTagList = buildSaveExpertTagList(userId, expertTagList); saveExpertTagList = saveExpertTagList.stream() - .filter(r -> ExpertTagEnum.EXPERT_SOURCE.getKey().equals(r.getExpertInfoField())).collect(Collectors.toList()); + .filter(r -> ExpertTagEnum.EXPERT_SOURCE.getKey().equals(r.getExpertInfoField())) + .collect(Collectors.toList()); if (CollUtil.isNotEmpty(saveExpertTagList)) { iExpertTagService.saveBatch(saveExpertTagList); } @@ -502,13 +505,15 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { saveExpertUserFullInfo.setRegionLevel(null); saveExpertUserFullInfo.setRegionCode(null); saveExpertUserFullInfo.setCompany(null); + saveExpertUserFullInfo.setCompanyUniqCode(null); saveExpertUserFullInfo.setLegalEntityCode(null); iExpertUserFullInfoService.saveOrUpdate(saveExpertUserFullInfo); // 保存所有专家字典字段 List saveExpertDictionaryList = buildSaveExpertDictionaryList(userId, expertDictionaryList); saveExpertDictionaryList = saveExpertDictionaryList - .stream().filter(r -> !ExpertUserInfoSensitiveFieldEnum.getSensitiveDictionaryList().contains(r.getExpertInfoField())).collect(Collectors.toList()); + .stream().filter(r -> !ExpertUserInfoSensitiveFieldEnum.getSensitiveDictionaryList().contains(r.getExpertInfoField())) + .collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(saveExpertDictionaryList)) { iExpertDictionaryService.saveBatch(saveExpertDictionaryList); } @@ -694,6 +699,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.phone_no, collectMap); assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.email, collectMap); assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.company, collectMap); + assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.company_uniq_code, collectMap); assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.legal_entity_code, collectMap); iExpertUserFullInfoService.saveOrUpdate(originalExpertUserFullInfo); @@ -756,27 +762,30 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { /** * 信息修改审核通过后 装配更新用户信息敏感字段 * - * @param originalExpertUserFullInfo - * @param expertUserFullInfoStrEnum - * @param collectMap + * @param originalInfo / + * @param fieldEnum / + * @param collectMap / */ - private void assemblerExpertUserFullInfoSensitiveFieldSaveRecord(ExpertUserFullInfo originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum expertUserFullInfoStrEnum + private void assemblerExpertUserFullInfoSensitiveFieldSaveRecord(ExpertUserFullInfo originalInfo, ExpertUserInfoSensitiveFieldEnum fieldEnum , Map collectMap) { - SensitiveModifySegment segment = collectMap.get(expertUserFullInfoStrEnum); + SensitiveModifySegment segment = collectMap.get(fieldEnum); if (Objects.nonNull(segment)) { String segmentApplyValue = (String) segment.getApply(); - switch (expertUserFullInfoStrEnum) { + switch (fieldEnum) { case phone_no: - originalExpertUserFullInfo.setPhoneNo(segmentApplyValue); + originalInfo.setPhoneNo(segmentApplyValue); break; case email: - originalExpertUserFullInfo.setEmail(segmentApplyValue); + originalInfo.setEmail(segmentApplyValue); break; case company: - originalExpertUserFullInfo.setCompany(segmentApplyValue); + originalInfo.setCompany(segmentApplyValue); + break; + case company_uniq_code: + originalInfo.setCompanyUniqCode(segmentApplyValue); break; case legal_entity_code: - originalExpertUserFullInfo.setLegalEntityCode(segmentApplyValue); + originalInfo.setLegalEntityCode(segmentApplyValue); break; default: break;