diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java index d4975d0..3bdc985 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java @@ -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 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 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 expertIntentionJoinApplyList = iMetaApplyService.list(Wrappers - .lambdaQuery(ExpertMetaApply.class) + List 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())); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java index 02b34b5..4908125 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java @@ -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); 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 b3e1b80..412e5e4 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 @@ -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 expertType = cmd.getExpertType(); - if (CollectionUtils.isNotEmpty(expertType)) { - expertType = expertType.stream().peek(r -> r.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey())).collect(Collectors.toList()); - List saveExpertDictionaryList = buildSaveExpertDictionaryList(expertUserId, expertType); - iExpertDictionaryService.saveBatch(saveExpertDictionaryList); + if (CollUtil.isNotEmpty(expertType)) { + expertType.forEach(r -> r.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey())); + List 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()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleService.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleService.java index 42be6de..c7bf23e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRoleService.java @@ -75,4 +75,7 @@ public interface IRoleService extends IService { * @return boolean */ Boolean check(String name, Long id); + + + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IUserRoleService.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IUserRoleService.java index a5f9a3d..09e308c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IUserRoleService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IUserRoleService.java @@ -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 { **/ List listUserIdByRoleId(Long roleId); + default UserRole getOne(Long userId, Long roleId) { + LambdaQueryWrapper eq = Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getUserId, userId) + .eq(UserRole::getRoleId, roleId) + .last(BizConst.LIMIT_1); + return getOne(eq); + } }