Browse Source

专家审核通过的时候保存角色

master
WendyYang 1 year ago
parent
commit
10e86e7e55
5 changed files with 59 additions and 24 deletions
  1. +13
    -12
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java
  2. +8
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java
  3. +25
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java
  4. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleService.java
  5. +10
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IUserRoleService.java

+ 13
- 12
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java View File

@@ -26,6 +26,7 @@ import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO;
import com.ningdatech.pmapi.expert.model.dto.ExpertTagDTO;
import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery;
import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest;
import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest.StorageApplyResultExtraInfo;
import com.ningdatech.pmapi.expert.model.vo.ExpertApplyMetaVO;
import com.ningdatech.pmapi.expert.model.vo.MetaApplyResultVo;
import com.ningdatech.pmapi.expert.service.ExpertAdminManageService;
@@ -527,16 +528,17 @@ public class ExpertMetaApplyManage {
return expertMetaApplyListQuery;
}

private ExpertStorageDealCmd buildExpertStorageDealCmd(
MetaApplyResultRequest applyResultRequest, Long expertUserId, ExpertMetaApply expertMetaApply) {
MetaApplyResultRequest.StorageApplyResultExtraInfo extraInfo = applyResultRequest.getStorageApplyResultExtraInfo();
private ExpertStorageDealCmd buildExpertStorageDealCmd(MetaApplyResultRequest applyResultRequest,
Long expertUserId,
ExpertMetaApply expertMetaApply) {
StorageApplyResultExtraInfo extraInfo = applyResultRequest.getStorageApplyResultExtraInfo();
ExpertStorageDealCmd expertStorageDealCmd = new ExpertStorageDealCmd();
Boolean applyResult = applyResultRequest.getApplyResult();
expertStorageDealCmd.setApplyResult(applyResult);

if (Objects.nonNull(extraInfo)) {
List<DictionaryFieldInfo> expertType = extraInfo.getExpertType();
if (CollectionUtils.isNotEmpty(expertType)) {
if (CollUtil.isNotEmpty(expertType)) {
expertStorageDealCmd.setExpertType(extraInfo.getExpertType().stream().map(r -> {
ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO();
expertDictionaryDTO.setExpertInfoField(r.getDictionaryFieldName());
@@ -545,7 +547,7 @@ public class ExpertMetaApplyManage {
}).collect(Collectors.toList()));
}
List<TagFieldInfo> other = extraInfo.getOther();
if (CollectionUtils.isNotEmpty(other)) {
if (CollUtil.isNotEmpty(other)) {
expertStorageDealCmd.setOther(extraInfo.getOther().stream().map(r -> {
ExpertTagDTO expertTagDTO = new ExpertTagDTO();
expertTagDTO.setExpertInfoField(r.getTagFieldName());
@@ -562,8 +564,8 @@ public class ExpertMetaApplyManage {
}


private ExpertInfoModifyApplyDealCmd buildExpertInfoModifyApplyDealCmd(MetaApplyResultRequest applyResultRequest
, Long userId, Long applyId) {
private ExpertInfoModifyApplyDealCmd buildExpertInfoModifyApplyDealCmd(MetaApplyResultRequest applyResultRequest,
Long userId, Long applyId) {
ExpertInfoModifyApplyDealCmd expertInfoModifyApplyDealCmd = new ExpertInfoModifyApplyDealCmd();
Boolean applyResult = applyResultRequest.getApplyResult();
expertInfoModifyApplyDealCmd.setApplyResult(applyResult);
@@ -572,8 +574,8 @@ public class ExpertMetaApplyManage {
return expertInfoModifyApplyDealCmd;
}

private ExpertIntentionApplyDealCmd buildExpertIntentionApplyDealCmd(MetaApplyResultRequest applyResultRequest
, ExpertMetaApply expertMetaApply) {
private ExpertIntentionApplyDealCmd buildExpertIntentionApplyDealCmd(MetaApplyResultRequest applyResultRequest,
ExpertMetaApply expertMetaApply) {
Boolean applyResult = applyResultRequest.getApplyResult();
String applyType = expertMetaApply.getApplyType();
ExpertApplyTypeEnum applyTypeEnum = ExpertApplyTypeEnum.of(applyType);
@@ -590,12 +592,11 @@ public class ExpertMetaApplyManage {
/**
* 专家管理员 新增专家使用使用
*
* @param expertUserId
* @param expertUserId \
*/
@Transactional(rollbackFor = Exception.class)
public void autoPassExpertApply(Long expertUserId) {
List<ExpertMetaApply> expertIntentionJoinApplyList = iMetaApplyService.list(Wrappers
.lambdaQuery(ExpertMetaApply.class)
List<ExpertMetaApply> expertIntentionJoinApplyList = iMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class)
.eq(ExpertMetaApply::getUserId, expertUserId)
.in(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), ExpertApplyTypeEnum.EXPERT_STORAGE.getKey())
.eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()));


+ 8
- 4
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java View File

@@ -27,19 +27,23 @@ public interface ExpertInfoService {
/**
* 专家信息修改审核结果处理
*
* @param expertInfoModifyApplyDealCmd
* @param expertInfoModifyApplyDealCmd \
*/
void expertInfoModifyDeal(ExpertInfoModifyApplyDealCmd expertInfoModifyApplyDealCmd);

/**
* 根据user_id 获取用户全量信息
*
* @param userId
* @return
* @param userId \
* @return \
*/
ExpertFullInfoAllDTO getExpertUserFullInfoAll(Long userId);


/**
* 专家入库审核处理
*
* @param cmd \
**/
void expertStorageDeal(ExpertStorageDealCmd cmd);




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

@@ -29,6 +29,12 @@ 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.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.sys.model.entity.UserRole;
import com.ningdatech.pmapi.sys.service.IRoleService;
import com.ningdatech.pmapi.sys.service.IUserRoleService;
import com.ningdatech.pmapi.sys.service.impl.UserRoleServiceImpl;
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.ningdatech.yxt.utils.JSONUtils;
import lombok.RequiredArgsConstructor;
@@ -56,6 +62,8 @@ public class ExpertInfoServiceImpl implements ExpertInfoService {
private final IExpertAvoidCompanyService iExpertAvoidCompanyService;
private final IExpertIntentionWorkRegionService iExpertIntentionWorkRegionService;
private final IExpertMetaApplyService iExpertMetaApplyService;
private final IRoleService roleService;
private final IUserRoleService userRoleService;
private final IExpertSensitiveInfoModifyDetailRecordService iExpertSensitiveInfoModifyDetailRecordService;


@@ -369,16 +377,14 @@ public class ExpertInfoServiceImpl implements ExpertInfoService {
/**
* 专家入库审核
*
* @param cmd
* @param cmd \
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void expertStorageDeal(ExpertStorageDealCmd cmd) {
boolean applyResult = cmd.getApplyResult();
Long expertUserId = cmd.getExpertUserId();
ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(expertUserId);

if (applyResult) {
if (cmd.getApplyResult()) {
// 修改专家状态为可用
expertUserFullInfo.setExpertAccountStatus(ExpertAccountStatusEnum.AVAILABLE.getKey());
expertUserFullInfo.setRemark(cmd.getRemark());
@@ -390,10 +396,21 @@ public class ExpertInfoServiceImpl implements ExpertInfoService {
iExpertTagService.saveBatch(saveExpertTagList);
// 保存所有专家字典字段
List<ExpertDictionaryDTO> expertType = cmd.getExpertType();
if (CollectionUtils.isNotEmpty(expertType)) {
expertType = expertType.stream().peek(r -> r.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey())).collect(Collectors.toList());
List<ExpertDictionary> saveExpertDictionaryList = buildSaveExpertDictionaryList(expertUserId, expertType);
iExpertDictionaryService.saveBatch(saveExpertDictionaryList);
if (CollUtil.isNotEmpty(expertType)) {
expertType.forEach(r -> r.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey()));
List<ExpertDictionary> saveExpertDictList = buildSaveExpertDictionaryList(expertUserId, expertType);
iExpertDictionaryService.saveBatch(saveExpertDictList);
}
// 补充专家 专家角色
Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getCode, RoleEnum.EXPERT));
if (Objects.nonNull(role)) {
UserRole one = userRoleService.getOne(expertUserId, role.getId());
if (Objects.isNull(one)) {
UserRole saveUserRole = new UserRole();
saveUserRole.setUserId(expertUserId);
saveUserRole.setRoleId(role.getId());
userRoleService.save(saveUserRole);
}
}
} else {
expertUserFullInfo.setUserInfoStep(ExpertUserInfoStepEnum.INFORMATION_TO_BE_SUBMITTED.getKey());


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleService.java View File

@@ -75,4 +75,7 @@ public interface IRoleService extends IService<Role> {
* @return boolean
*/
Boolean check(String name, Long id);



}

+ 10
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IUserRoleService.java View File

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

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.sys.model.entity.UserRole;

import java.util.List;
@@ -32,5 +35,12 @@ public interface IUserRoleService extends IService<UserRole> {
**/
List<Long> listUserIdByRoleId(Long roleId);

default UserRole getOne(Long userId, Long roleId) {
LambdaQueryWrapper<UserRole> eq = Wrappers.lambdaQuery(UserRole.class)
.eq(UserRole::getUserId, userId)
.eq(UserRole::getRoleId, roleId)
.last(BizConst.LIMIT_1);
return getOne(eq);
}

}

Loading…
Cancel
Save