mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2026-04-24 11:28:39 +08:00
update 优化 SysLoginService#socialRegister 判断是否已经绑定用户 ;
add 新增 RemoteSocialServiceImpl#updateByBo 更新社会化关系 ;
This commit is contained in:
@@ -31,6 +31,7 @@ import org.dromara.system.api.RemoteTenantService;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.bo.RemoteSocialBo;
|
||||
import org.dromara.system.api.domain.bo.RemoteUserBo;
|
||||
import org.dromara.system.api.domain.vo.RemoteSocialVo;
|
||||
import org.dromara.system.api.domain.vo.RemoteTenantVo;
|
||||
import org.dromara.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -66,14 +67,25 @@ public class SysLoginService {
|
||||
* @param authUserData 授权响应实体
|
||||
*/
|
||||
public void socialRegister(AuthUser authUserData) {
|
||||
String authId = authUserData.getSource() + authUserData.getUuid();
|
||||
// 第三方用户信息
|
||||
RemoteSocialBo bo = BeanUtil.toBean(authUserData, RemoteSocialBo.class);
|
||||
BeanUtil.copyProperties(authUserData.getToken(), bo);
|
||||
bo.setUserId(LoginHelper.getUserId());
|
||||
bo.setAuthId(authUserData.getSource() + authUserData.getUuid());
|
||||
bo.setAuthId(authId);
|
||||
bo.setOpenId(authUserData.getUuid());
|
||||
bo.setUserName(authUserData.getUsername());
|
||||
bo.setNickName(authUserData.getNickname());
|
||||
remoteSocialService.insertByBo(bo);
|
||||
// 查询是否已经绑定用户
|
||||
RemoteSocialVo vo = remoteSocialService.selectByAuthId(authId);
|
||||
if (ObjectUtil.isEmpty(vo)) {
|
||||
// 没有绑定用户, 新增用户信息
|
||||
remoteSocialService.insertByBo(bo);
|
||||
} else {
|
||||
// 更新用户信息
|
||||
bo.setId(vo.getId());
|
||||
remoteSocialService.updateByBo(bo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user