Browse Source

专家报名用户角色自动补充专家信息

master
niohe·erbao 1 year ago
parent
commit
95c286c7ea
1 changed files with 20 additions and 0 deletions
  1. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java

+ 20
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java View File

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




Loading…
Cancel
Save