Browse Source

修复专家单位编码未保存bug

tags/24080901
WendyYang 1 year ago
parent
commit
bb935c7a17
4 changed files with 34 additions and 20 deletions
  1. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoSensitiveFieldEnum.java
  2. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java
  3. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/SensitiveModifySegment.java
  4. +27
    -18
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java

+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoSensitiveFieldEnum.java View File

@@ -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<String> getSensitiveDictionaryList() {


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java View File

@@ -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


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/SensitiveModifySegment.java View File

@@ -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<ExpertRegionInfo>) this.original, (List<ExpertRegionInfo>) this.apply);
default:
return this.original.equals(this.apply);
return Objects.equals(this.original, this.apply);
}
}



+ 27
- 18
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java View File

@@ -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<Long, List<ExpertAvoidCompany>> 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<ExpertDictionary> 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<ExpertTag> 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<ExpertDictionary> 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<ExpertUserInfoSensitiveFieldEnum, SensitiveModifySegment> 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;


Loading…
Cancel
Save