| | |
| | | return buildUserInfo(user); |
| | | } |
| | | |
| | | /** |
| | | * 用户信息 |
| | | * |
| | | * @param tenantId |
| | | * @param account |
| | | * @param password |
| | | * @param type 登录类型 2:pc 3:app |
| | | * @return |
| | | */ |
| | | @Override |
| | | public UserInfo userInfo(String tenantId, String account, String password, Integer type) { |
| | | User user = baseMapper.getUser(tenantId, account, password); |
| | | return buildUserInfo(user, type); |
| | | } |
| | | |
| | | /** |
| | | * 用户信息 |
| | | * |
| | | * @param tenantId |
| | | * @param account |
| | | * @param password |
| | | * @param userEnum |
| | | * @return |
| | | */ |
| | | @Override |
| | | public UserInfo userInfo(String tenantId, String account, String password, UserEnum userEnum) { |
| | | User user = baseMapper.getUser(tenantId, account, password); |
| | |
| | | return userInfo; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param user |
| | | * @param type 登录类型 2:pc 3:app |
| | | * @return |
| | | */ |
| | | private UserInfo buildUserInfo(User user, Integer type) { |
| | | if (ObjectUtil.isEmpty(user)) { |
| | | return null; |
| | | } |
| | | UserInfo userInfo = new UserInfo(); |
| | | userInfo.setUser(user); |
| | | if (Func.isNotEmpty(user)) { |
| | | // 判断登录类型设置对应的角色id |
| | | user.setRoleId(Strings.join(roleService.getRoleIdStrByRoleIdAndType(user.getRoleId(),type), ',')); |
| | | // 设置角色别名 |
| | | List<String> roleAlias = roleService.getRoleAliases(user.getRoleId()); |
| | | userInfo.setRoles(roleAlias); |
| | | } |
| | | // 根据每个用户平台,建立对应的detail表,通过查询将结果集写入到detail字段 |
| | | Kv detail = Kv.create().set("type", null); |
| | | UserOther userOther = new UserOther(); |
| | | UserOther query = userOther.selectOne(Wrappers.<UserOther>lambdaQuery().eq(UserOther::getUserId, user.getId())); |
| | | if (ObjectUtil.isNotEmpty(query)) { |
| | | detail.set("ext", query.getUserExt()); |
| | | } |
| | | userInfo.setDetail(detail); |
| | | return userInfo; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public UserInfo userInfo(UserOauth userOauth) { |