|
|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
|
import com.ningdatech.basic.util.CollUtils; |
|
|
|
import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; |
|
|
|
import com.ningdatech.pmapi.common.model.ExpertRegionModifyDiffBO; |
|
|
@@ -13,14 +14,14 @@ import com.ningdatech.pmapi.common.util.GzipUtils; |
|
|
|
import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler; |
|
|
|
import com.ningdatech.pmapi.expert.constant.*; |
|
|
|
import com.ningdatech.pmapi.expert.entity.*; |
|
|
|
import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; |
|
|
|
import com.ningdatech.pmapi.expert.model.SensitiveModifySegment; |
|
|
|
import com.ningdatech.pmapi.expert.model.TagFieldInfo; |
|
|
|
import com.ningdatech.pmapi.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; |
|
|
|
import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; |
|
|
|
import com.ningdatech.pmapi.expert.model.cmd.ExpertInfoModifyCmd; |
|
|
|
import com.ningdatech.pmapi.expert.model.cmd.ExpertRecommendProofSaveCmd; |
|
|
|
import com.ningdatech.pmapi.expert.model.cmd.ExpertStorageDealCmd; |
|
|
|
import com.ningdatech.pmapi.expert.model.cmd.*; |
|
|
|
import com.ningdatech.pmapi.expert.model.dto.*; |
|
|
|
import com.ningdatech.pmapi.expert.service.*; |
|
|
|
import com.ningdatech.pmapi.expert.utils.SensitiveModifySegmentUtils; |
|
|
|
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; |
|
|
|
import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; |
|
|
|
import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; |
|
|
@@ -28,13 +29,16 @@ import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; |
|
|
|
import com.ningdatech.pmapi.meta.model.entity.ExpertTag; |
|
|
|
import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; |
|
|
|
import com.ningdatech.pmapi.meta.service.IExpertTagService; |
|
|
|
import com.ningdatech.yxt.utils.JSONUtils; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.*; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@@ -310,6 +314,49 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void expertIntentionApplyDeal(ExpertIntentionApplyDealCmd cmd) { |
|
|
|
Boolean applyResult = cmd.getApplyResult(); |
|
|
|
ExpertApplyTypeEnum applyTypeEnum = cmd.getApplyTypeEnum(); |
|
|
|
String expertRegionCode = cmd.getExpertRegionCode(); |
|
|
|
Integer expertRegionLevel = cmd.getExpertRegionLevel(); |
|
|
|
Long expertUserId = cmd.getExpertUserId(); |
|
|
|
|
|
|
|
if (applyResult) { |
|
|
|
switch (applyTypeEnum) { |
|
|
|
case EXPERT_INTENTION_JOIN: { |
|
|
|
// 新增履职意向地 |
|
|
|
LambdaQueryWrapper<ExpertIntentionWorkRegion> query = Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) |
|
|
|
.eq(ExpertIntentionWorkRegion::getUserId, expertUserId) |
|
|
|
.eq(ExpertIntentionWorkRegion::getRegionCode, expertRegionCode) |
|
|
|
.eq(ExpertIntentionWorkRegion::getRegionLevel, expertRegionLevel); |
|
|
|
ExpertIntentionWorkRegion one = iExpertIntentionWorkRegionService.getOne(query); |
|
|
|
if (Objects.isNull(one)) { |
|
|
|
ExpertIntentionWorkRegion expertIntentionWorkRegion = new ExpertIntentionWorkRegion(); |
|
|
|
expertIntentionWorkRegion.setCreateOn(LocalDateTime.now()); |
|
|
|
expertIntentionWorkRegion.setUpdateOn(LocalDateTime.now()); |
|
|
|
expertIntentionWorkRegion.setRegionCode(expertRegionCode); |
|
|
|
expertIntentionWorkRegion.setRegionLevel(expertRegionLevel); |
|
|
|
expertIntentionWorkRegion.setUserId(expertUserId); |
|
|
|
iExpertIntentionWorkRegionService.save(expertIntentionWorkRegion); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
case EXPERT_INTENTION_LEAVE: { |
|
|
|
// 删除履职意向地 |
|
|
|
LambdaUpdateWrapper<ExpertIntentionWorkRegion> expertIntentionWorkRegionQuery = Wrappers.lambdaUpdate(ExpertIntentionWorkRegion.class) |
|
|
|
.eq(ExpertIntentionWorkRegion::getUserId, expertUserId) |
|
|
|
.eq(ExpertIntentionWorkRegion::getRegionCode, expertRegionCode) |
|
|
|
.eq(ExpertIntentionWorkRegion::getRegionLevel, expertRegionLevel); |
|
|
|
iExpertIntentionWorkRegionService.remove(expertIntentionWorkRegionQuery); |
|
|
|
} |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw new BizException("illegal request"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 专家入库审核 |
|
|
|
* |
|
|
@@ -620,4 +667,158 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void expertInfoModifyDeal(ExpertInfoModifyApplyDealCmd expertInfoModifyApplyDealCmd) { |
|
|
|
Boolean applyResult = expertInfoModifyApplyDealCmd.getApplyResult(); |
|
|
|
Long expertUserId = expertInfoModifyApplyDealCmd.getExpertUserId(); |
|
|
|
Long applyId = expertInfoModifyApplyDealCmd.getApplyId(); |
|
|
|
if (applyResult) { |
|
|
|
ExpertUserFullInfo originalExpertUserFullInfo = iExpertUserFullInfoService.getByUserId(expertUserId); |
|
|
|
|
|
|
|
LambdaQueryWrapper<ExpertSensitiveInfoModifyDetailRecord> recordQuery = Wrappers.lambdaQuery(ExpertSensitiveInfoModifyDetailRecord.class) |
|
|
|
.eq(ExpertSensitiveInfoModifyDetailRecord::getUserId, expertUserId) |
|
|
|
.eq(ExpertSensitiveInfoModifyDetailRecord::getMetaApplyId, applyId); |
|
|
|
ExpertSensitiveInfoModifyDetailRecord record = iExpertSensitiveInfoModifyDetailRecordService.getOne(recordQuery); |
|
|
|
String modifyJson = record.getModifyJson(); |
|
|
|
if (StringUtils.isNotEmpty(modifyJson)) { |
|
|
|
modifyJson = GzipUtils.uncompress(modifyJson); |
|
|
|
} |
|
|
|
List<SensitiveModifySegment> sensitiveModifySegments = JSONUtils.parseArray(modifyJson, SensitiveModifySegment.class); |
|
|
|
Map<ExpertUserInfoSensitiveFieldEnum, SensitiveModifySegment> collectMap = sensitiveModifySegments |
|
|
|
.stream().collect(Collectors.toMap(SensitiveModifySegment::getFieldName, Function.identity())); |
|
|
|
|
|
|
|
// 更新专家基 expert_user_full_info 表中数据 |
|
|
|
assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.phone_no, collectMap); |
|
|
|
assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.email, collectMap); |
|
|
|
assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.company, collectMap); |
|
|
|
assemblerExpertUserFullInfoSensitiveFieldSaveRecord(originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum.legal_entity_code, collectMap); |
|
|
|
iExpertUserFullInfoService.saveOrUpdate(originalExpertUserFullInfo); |
|
|
|
|
|
|
|
// 更新专家字典字段 |
|
|
|
executeExpertUserFullInfoDictionaryInfoUpdate(expertUserId, collectMap |
|
|
|
, ExpertUserInfoSensitiveFieldEnum.administrative_rank |
|
|
|
, ExpertUserInfoSensitiveFieldEnum.title_level); |
|
|
|
|
|
|
|
// 更新专家标签字段列表 |
|
|
|
executeExpertUserFullInfoTagInfoUpdate(expertUserId, collectMap, ExpertUserInfoSensitiveFieldEnum.good_at |
|
|
|
, ExpertUserInfoSensitiveFieldEnum.technical_expertise |
|
|
|
, ExpertUserInfoSensitiveFieldEnum.industry_sector |
|
|
|
, ExpertUserInfoSensitiveFieldEnum.other); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void executeExpertUserFullInfoDictionaryInfoUpdate(Long expertUserId, Map<ExpertUserInfoSensitiveFieldEnum |
|
|
|
, SensitiveModifySegment> collectMap, ExpertUserInfoSensitiveFieldEnum... sensitiveFieldEnumArr) { |
|
|
|
for (ExpertUserInfoSensitiveFieldEnum sensitiveFieldEnum : sensitiveFieldEnumArr) { |
|
|
|
switch (sensitiveFieldEnum) { |
|
|
|
case administrative_rank: |
|
|
|
case title_level: { |
|
|
|
SensitiveModifySegment segment = collectMap.get(sensitiveFieldEnum); |
|
|
|
if (Objects.nonNull(segment)) { |
|
|
|
List<DictionaryFieldInfo> dictionaryFieldInfoList = SensitiveModifySegmentUtils.getDictionaryFieldInfoListApply(segment); |
|
|
|
updateExpertDictionaryList(expertUserId, dictionaryFieldInfoList, sensitiveFieldEnum.getKey()); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void executeExpertUserFullInfoTagInfoUpdate(Long expertUserId, Map<ExpertUserInfoSensitiveFieldEnum |
|
|
|
, SensitiveModifySegment> collectMap, ExpertUserInfoSensitiveFieldEnum... sensitiveFieldEnumArr) { |
|
|
|
for (ExpertUserInfoSensitiveFieldEnum sensitiveFieldEnum : sensitiveFieldEnumArr) { |
|
|
|
switch (sensitiveFieldEnum) { |
|
|
|
case good_at: |
|
|
|
case technical_expertise: |
|
|
|
case industry_sector: |
|
|
|
case other: { |
|
|
|
SensitiveModifySegment segment = collectMap.get(sensitiveFieldEnum); |
|
|
|
if (Objects.nonNull(segment)) { |
|
|
|
List<TagFieldInfo> tagFieldInfoList = SensitiveModifySegmentUtils.getTagFieldInfoListApply(segment); |
|
|
|
updateExpertTagList(expertUserId, tagFieldInfoList, sensitiveFieldEnum.getKey()); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 信息修改审核通过后 装配更新用户信息敏感字段 |
|
|
|
* |
|
|
|
* @param originalExpertUserFullInfo |
|
|
|
* @param expertUserFullInfoStrEnum |
|
|
|
* @param collectMap |
|
|
|
*/ |
|
|
|
private void assemblerExpertUserFullInfoSensitiveFieldSaveRecord(ExpertUserFullInfo originalExpertUserFullInfo, ExpertUserInfoSensitiveFieldEnum expertUserFullInfoStrEnum |
|
|
|
, Map<ExpertUserInfoSensitiveFieldEnum, SensitiveModifySegment> collectMap) { |
|
|
|
SensitiveModifySegment segment = collectMap.get(expertUserFullInfoStrEnum); |
|
|
|
if (Objects.nonNull(segment)) { |
|
|
|
String segmentApplyValue = (String) segment.getApply(); |
|
|
|
switch (expertUserFullInfoStrEnum) { |
|
|
|
case phone_no: |
|
|
|
originalExpertUserFullInfo.setPhoneNo(segmentApplyValue); |
|
|
|
break; |
|
|
|
case email: |
|
|
|
originalExpertUserFullInfo.setEmail(segmentApplyValue); |
|
|
|
break; |
|
|
|
case company: |
|
|
|
originalExpertUserFullInfo.setCompany(segmentApplyValue); |
|
|
|
break; |
|
|
|
case legal_entity_code: |
|
|
|
originalExpertUserFullInfo.setLegalEntityCode(segmentApplyValue); |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void updateExpertTagList(Long expertUserId, List<TagFieldInfo> tagFieldInfoList, String... tagExpertInfoTypeArr) { |
|
|
|
if (CollectionUtils.isNotEmpty(tagFieldInfoList)) { |
|
|
|
// 删除专家字典字段 |
|
|
|
LambdaQueryWrapper<ExpertTag> expertTagRemove = Wrappers.lambdaQuery(ExpertTag.class) |
|
|
|
.eq(ExpertTag::getUserId, expertUserId) |
|
|
|
.in(tagExpertInfoTypeArr.length > 0, ExpertTag::getExpertInfoField, tagExpertInfoTypeArr); |
|
|
|
iExpertTagService.remove(expertTagRemove); |
|
|
|
List<ExpertTag> expertDictionarySaveList = tagFieldInfoList.stream().map(r -> { |
|
|
|
ExpertTag expertTag = new ExpertTag(); |
|
|
|
expertTag.setUpdateOn(LocalDateTime.now()); |
|
|
|
expertTag.setUserId(expertUserId); |
|
|
|
expertTag.setExpertInfoField(r.getTagFieldName()); |
|
|
|
expertTag.setTagCode(r.getTagCode()); |
|
|
|
return expertTag; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
iExpertTagService.saveBatch(expertDictionarySaveList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void updateExpertDictionaryList(Long expertUserId, List<DictionaryFieldInfo> dictionaryFieldInfoList, String... dictionaryExpertInfoTypeArr) { |
|
|
|
if (CollectionUtils.isNotEmpty(dictionaryFieldInfoList)) { |
|
|
|
// 删除专家字典字段 |
|
|
|
LambdaQueryWrapper<ExpertDictionary> expertDictionaryRemove = Wrappers.lambdaQuery(ExpertDictionary.class) |
|
|
|
.eq(ExpertDictionary::getUserId, expertUserId) |
|
|
|
.in(dictionaryExpertInfoTypeArr.length > 0, ExpertDictionary::getExpertInfoField, dictionaryExpertInfoTypeArr); |
|
|
|
iExpertDictionaryService.remove(expertDictionaryRemove); |
|
|
|
List<ExpertDictionary> expertDictionarySaveList = dictionaryFieldInfoList.stream().map(r -> { |
|
|
|
ExpertDictionary expertDictionary = new ExpertDictionary(); |
|
|
|
expertDictionary.setUpdateOn(LocalDateTime.now()); |
|
|
|
expertDictionary.setCreateOn(LocalDateTime.now()); |
|
|
|
expertDictionary.setUserId(expertUserId); |
|
|
|
expertDictionary.setExpertInfoField(r.getDictionaryFieldName()); |
|
|
|
expertDictionary.setDictionaryCode(r.getDictionaryCode()); |
|
|
|
return expertDictionary; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
iExpertDictionaryService.saveBatch(expertDictionarySaveList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |