mirror of https://github.com/jeecgboot/jeecg-boot
邀请用户加入租户,支持通过用户账号
parent
420d6db3fb
commit
3d9f59c69b
|
@ -412,8 +412,11 @@ public class SysTenantController {
|
||||||
*/
|
*/
|
||||||
@PutMapping("/invitationUserJoin")
|
@PutMapping("/invitationUserJoin")
|
||||||
@RequiresPermissions("system:tenant:invitation:user")
|
@RequiresPermissions("system:tenant:invitation:user")
|
||||||
public Result<String> invitationUserJoin(@RequestParam("ids") String ids,@RequestParam("phone") String phone){
|
public Result<String> invitationUserJoin(@RequestParam("ids") String ids,@RequestParam(value = "phone", required = false) String phone, @RequestParam(value = "username", required = false) String username){
|
||||||
sysTenantService.invitationUserJoin(ids,phone);
|
if(oConvertUtils.isEmpty(phone) && oConvertUtils.isEmpty(username)){
|
||||||
|
return Result.error("手机号和用户账号不能同时为空!");
|
||||||
|
}
|
||||||
|
sysTenantService.invitationUserJoin(ids,phone,username);
|
||||||
return Result.ok("邀请用户成功");
|
return Result.ok("邀请用户成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,9 @@ public interface ISysTenantService extends IService<SysTenant> {
|
||||||
* 邀请用户加入租户,通过手机号
|
* 邀请用户加入租户,通过手机号
|
||||||
* @param ids
|
* @param ids
|
||||||
* @param phone
|
* @param phone
|
||||||
|
* @param username
|
||||||
*/
|
*/
|
||||||
void invitationUserJoin(String ids, String phone);
|
void invitationUserJoin(String ids, String phone,String username);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请离用户(租户)
|
* 请离用户(租户)
|
||||||
|
|
|
@ -104,15 +104,27 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(value={CacheConstant.SYS_USERS_CACHE}, allEntries=true)
|
@CacheEvict(value={CacheConstant.SYS_USERS_CACHE}, allEntries=true)
|
||||||
public void invitationUserJoin(String ids, String phone) {
|
public void invitationUserJoin(String ids, String phone,String username) {
|
||||||
String[] idArray = ids.split(SymbolConstant.COMMA);
|
String[] idArray = ids.split(SymbolConstant.COMMA);
|
||||||
|
String userId = null;
|
||||||
|
SysUser userByPhone = null;
|
||||||
//update-begin---author:wangshuai ---date:20230313 for:【QQYUN-4605】后台的邀请谁加入租户,没办法选不是租户下的用户,通过手机号邀请------------
|
//update-begin---author:wangshuai ---date:20230313 for:【QQYUN-4605】后台的邀请谁加入租户,没办法选不是租户下的用户,通过手机号邀请------------
|
||||||
SysUser userByPhone = userService.getUserByPhone(phone);
|
if(oConvertUtils.isNotEmpty(phone)){
|
||||||
|
userByPhone = userService.getUserByPhone(phone);
|
||||||
//说明用户不存在
|
//说明用户不存在
|
||||||
if(null == userByPhone){
|
if(null == userByPhone){
|
||||||
throw new JeecgBootException("当前用户不存在,请核对手机号");
|
throw new JeecgBootException("当前用户不存在,请核对手机号");
|
||||||
}
|
}
|
||||||
String userId = userByPhone.getId();
|
userId = userByPhone.getId();
|
||||||
|
}else{
|
||||||
|
userByPhone = userService.getUserByName(username);
|
||||||
|
//说明用户不存在
|
||||||
|
if(null == userByPhone){
|
||||||
|
throw new JeecgBootException("当前用户不存在,请核对手机号");
|
||||||
|
}
|
||||||
|
userId = userByPhone.getId();
|
||||||
|
}
|
||||||
|
|
||||||
//循环租户id
|
//循环租户id
|
||||||
for (String id:idArray) {
|
for (String id:idArray) {
|
||||||
//update-begin---author:wangshuai ---date:20221223 for:[QQYUN-3371]租户逻辑改造,改成关系表------------
|
//update-begin---author:wangshuai ---date:20221223 for:[QQYUN-3371]租户逻辑改造,改成关系表------------
|
||||||
|
|
Loading…
Reference in New Issue