From 95c286c7eac09aa7628fef3e5e42a78df3d7f840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Tue, 4 Apr 2023 16:49:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=93=E5=AE=B6=E6=8A=A5=E5=90=8D=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=A7=92=E8=89=B2=E8=87=AA=E5=8A=A8=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E4=B8=93=E5=AE=B6=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/expert/manage/ExpertManage.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java index 71dc2e7..ca4795d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.expert.manage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.exception.BizException; import com.ningdatech.file.entity.vo.result.AttachFileVo; import com.ningdatech.file.service.FileService; @@ -23,8 +24,13 @@ import com.ningdatech.pmapi.expert.service.ExpertInfoService; import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +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.user.constant.UserAvailableEnum; import com.ningdatech.pmapi.user.entity.UserInfo; +import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; import com.ningdatech.pmapi.user.service.IUserInfoService; import com.ningdatech.pmapi.user.util.LoginUserUtil; import lombok.RequiredArgsConstructor; @@ -55,6 +61,8 @@ public class ExpertManage { private final ExpertUserInfoAssembler expertUserInfoAssembler; private final IUserInfoService iUserInfoService; private final ExpertMetaApplyManage expertMetaApplyManage; + private final IUserRoleService iUserRoleService; + private final IRoleService iRoleService; /** @@ -108,6 +116,18 @@ public class ExpertManage { applyResult.setAuditOpinion("同意"); applyResult.setApplyResult(true); expertMetaApplyManage.metaApplyResult(applyResult); + + // 增加用户专家角色 + Role expertRole = iRoleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getCode, RoleEnum.EXPERT.name())); + UserRole expertUserRole = iUserRoleService.getOne(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getRoleId, expertRole.getId())); + if (Objects.isNull(expertUserRole)) { + expertUserRole = new UserRole(); + expertUserRole.setUserId(userId); + expertUserRole.setRoleId(expertRole.getId()); + expertUserRole.setCreateBy(-1L); + expertUserRole.setCreateOn(LocalDateTime.now()); + iUserRoleService.save(expertUserRole); + } }