Sfoglia il codice sorgente

专家审核信息修改改正

master
niohe·erbao 1 anno fa
parent
commit
451bde9700
5 ha cambiato i file con 321 aggiunte e 37 eliminazioni
  1. +30
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java
  2. +22
    -22
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertIntentionApplyDealCmd.java
  3. +11
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java
  4. +205
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java
  5. +53
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/utils/SensitiveModifySegmentUtils.java

+ 30
- 7
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java Vedi File

@@ -22,9 +22,7 @@ import com.ningdatech.pmapi.expert.entity.ExpertMetaApply;
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo;
import com.ningdatech.pmapi.expert.model.TagFieldInfo;
import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd;
import com.ningdatech.pmapi.expert.model.cmd.ExpertStorageDealCmd;
import com.ningdatech.pmapi.expert.model.cmd.MetaApplyListQuery;
import com.ningdatech.pmapi.expert.model.cmd.*;
import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO;
import com.ningdatech.pmapi.expert.model.dto.ExpertTagDTO;
import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery;
@@ -170,14 +168,14 @@ public class ExpertMetaApplyManage {
break;
// 专家信息审核
case EXPERT_INFO_MODIFY:
// ExpertInfoModifyApplyDealCmd applyDealCmd = buildExpertInfoModifyApplyDealCmd(req, expertMetaApply.getUserId(), applyId);
// expertInfoService.expertInfoModifyDeal(applyDealCmd);
ExpertInfoModifyApplyDealCmd applyDealCmd = buildExpertInfoModifyApplyDealCmd(req, expertMetaApply.getUserId(), applyId);
expertInfoService.expertInfoModifyDeal(applyDealCmd);
break;
// 专家履职意向加入/离开
case EXPERT_INTENTION_JOIN:
case EXPERT_INTENTION_LEAVE:
// ExpertIntentionApplyDealCmd expertIntentionApplyDealCmd = buildExpertIntentionApplyDealCmd(req, expertMetaApply);
// expertInfoService.expertIntentionApplyDeal(expertIntentionApplyDealCmd);
ExpertIntentionApplyDealCmd expertIntentionApplyDealCmd = buildExpertIntentionApplyDealCmd(req, expertMetaApply);
expertInfoService.expertIntentionApplyDeal(expertIntentionApplyDealCmd);
break;
default:
break;
@@ -535,4 +533,29 @@ public class ExpertMetaApplyManage {
return expertStorageDealCmd;
}


private ExpertInfoModifyApplyDealCmd buildExpertInfoModifyApplyDealCmd(MetaApplyResultRequest applyResultRequest
, Long userId, Long applyId) {
ExpertInfoModifyApplyDealCmd expertInfoModifyApplyDealCmd = new ExpertInfoModifyApplyDealCmd();
Boolean applyResult = applyResultRequest.getApplyResult();
expertInfoModifyApplyDealCmd.setApplyResult(applyResult);
expertInfoModifyApplyDealCmd.setExpertUserId(userId);
expertInfoModifyApplyDealCmd.setApplyId(applyId);
return expertInfoModifyApplyDealCmd;
}

private ExpertIntentionApplyDealCmd buildExpertIntentionApplyDealCmd(MetaApplyResultRequest applyResultRequest
, ExpertMetaApply expertMetaApply) {
Boolean applyResult = applyResultRequest.getApplyResult();
String applyType = expertMetaApply.getApplyType();
ExpertApplyTypeEnum applyTypeEnum = ExpertApplyTypeEnum.of(applyType);

ExpertIntentionApplyDealCmd expertIntentionApplyDealCmd = new ExpertIntentionApplyDealCmd();
expertIntentionApplyDealCmd.setApplyResult(applyResult);
expertIntentionApplyDealCmd.setApplyTypeEnum(applyTypeEnum);
expertIntentionApplyDealCmd.setExpertUserId(expertMetaApply.getUserId());
expertIntentionApplyDealCmd.setExpertRegionCode(expertMetaApply.getRegionCode());
expertIntentionApplyDealCmd.setExpertRegionLevel(expertMetaApply.getRegionLevel());
return expertIntentionApplyDealCmd;
}
}

+ 22
- 22
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertIntentionApplyDealCmd.java Vedi File

@@ -1,22 +1,22 @@
//package com.ningdatech.pmapi.expert.model.cmd;
//
//import com.ningdatech.emapi.expert.constants.ExpertApplyTypeEnum;
//import lombok.Data;
//
///**
// * @author liuxinxin
// * @date 2022/7/27 上午9:06
// */
//@Data
//public class ExpertIntentionApplyDealCmd {
//
// private Long expertUserId;
//
// private Boolean applyResult;
//
// ExpertApplyTypeEnum applyTypeEnum;
//
// private String expertRegionCode;
//
// private Integer expertRegionLevel;
//}
package com.ningdatech.pmapi.expert.model.cmd;
import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum;
import lombok.Data;
/**
* @author liuxinxin
* @date 2022/7/27 上午9:06
*/
@Data
public class ExpertIntentionApplyDealCmd {
private Long expertUserId;
private Boolean applyResult;
ExpertApplyTypeEnum applyTypeEnum;
private String expertRegionCode;
private Integer expertRegionLevel;
}

+ 11
- 4
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java Vedi File

@@ -1,9 +1,6 @@
package com.ningdatech.pmapi.expert.service;

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.ExpertFullInfoAllDTO;

import java.util.List;
@@ -24,6 +21,16 @@ public interface ExpertInfoService {
*/
void expertRecommendProofSave(ExpertRecommendProofSaveCmd expertRecommendProofSaveCmd);

void expertIntentionApplyDeal(ExpertIntentionApplyDealCmd expertIntentionApplyDealCmd);


/**
* 专家信息修改审核结果处理
*
* @param expertInfoModifyApplyDealCmd
*/
void expertInfoModifyDeal(ExpertInfoModifyApplyDealCmd expertInfoModifyApplyDealCmd);

/**
* 根据user_id 获取用户全量信息
*


+ 205
- 4
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java Vedi File

@@ -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);
}
}


}

+ 53
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/utils/SensitiveModifySegmentUtils.java Vedi File

@@ -0,0 +1,53 @@
package com.ningdatech.pmapi.expert.utils;


import com.ningdatech.basic.exception.BizException;
import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo;
import com.ningdatech.pmapi.expert.model.SensitiveModifySegment;
import com.ningdatech.pmapi.expert.model.TagFieldInfo;
import com.ningdatech.yxt.utils.JSONUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
* @author liuxinxin
* @date 2022/8/24 下午3:36
*/

public class SensitiveModifySegmentUtils {

private SensitiveModifySegmentUtils() {
}

public static List<TagFieldInfo> getTagFieldInfoListApply(SensitiveModifySegment segment) {
switch (segment.getFieldName()) {
case good_at:
case technical_expertise:
case industry_sector:
case other:
if (Objects.nonNull(segment.getApply())) {
return JSONUtils.parseArray(segment.getApply().toString(), TagFieldInfo.class);
}
return new ArrayList<>();
default:
throw new BizException("非法格式");
}

}

public static List<DictionaryFieldInfo> getDictionaryFieldInfoListApply(SensitiveModifySegment segment) {
switch (segment.getFieldName()) {
case administrative_rank:
case title_level: {
if (Objects.nonNull(segment.getApply())) {
return JSONUtils.parseArray(segment.getApply().toString(), DictionaryFieldInfo.class);
}
return new ArrayList<>();
}
default:
throw new BizException("非法格式");
}
}
}

Loading…
Annulla
Salva