|
|
|
@ -53,14 +53,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us |
|
|
|
private final IMClient imClient; |
|
|
|
private final SensitiveFilterUtil sensitiveFilterUtil; |
|
|
|
private final PrivateMessageService privateMessageService; |
|
|
|
@Autowired |
|
|
|
private UserLabelService userLabelService; |
|
|
|
@Autowired |
|
|
|
private UserGroupService UserGroupService; |
|
|
|
private final UserGroupService userGroupService; // 注入 UserGroupService
|
|
|
|
// @Autowired
|
|
|
|
// private UserLabelService UserLabelService;
|
|
|
|
private final UserLabelService UserLabelService; // 注入 UserGroupService
|
|
|
|
|
|
|
|
private final UserGroupService userGroupService; |
|
|
|
|
|
|
|
private final UserLabelService userLabelService; |
|
|
|
|
|
|
|
private final ImAgentService imAgentService; |
|
|
|
|
|
|
|
// @Override
|
|
|
|
// public LoginVO login(LoginDTO dto) {
|
|
|
|
@ -98,7 +96,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us |
|
|
|
@Override |
|
|
|
public LoginVO login(LoginDTO dto) { |
|
|
|
log.info("【测试】前端传的uniqueToken:{}", dto.getUniqueToken()); |
|
|
|
// 生成游客唯一标识UUID
|
|
|
|
|
|
|
|
String uniqueToken = dto.getUniqueToken(); |
|
|
|
// 检查uniqueToken是否为空或已过期
|
|
|
|
if(ObjectUtil.isEmpty(uniqueToken) || imAgentService.isPackageExpire(uniqueToken)){ |
|
|
|
throw new GlobalException("标识异常"); |
|
|
|
} |
|
|
|
|
|
|
|
// 生成游客唯一标识UUID,用于标识唯一游客
|
|
|
|
String guestUuid = UUID.randomUUID().toString(); |
|
|
|
|
|
|
|
// 生成游客用户名,例如 guest_随机6位数字
|
|
|
|
@ -190,6 +195,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us |
|
|
|
if (!passwordEncoder.matches(dto.getPassword(), user.getPassword())) { |
|
|
|
throw new GlobalException(ResultCode.PASSWOR_ERROR); |
|
|
|
} |
|
|
|
|
|
|
|
//未设置套餐或套餐过期
|
|
|
|
if(imAgentService.isPackageExpire(user.getUniqueToken())) { |
|
|
|
throw new GlobalException("套餐已过期"); |
|
|
|
} |
|
|
|
|
|
|
|
// 生成token
|
|
|
|
UserSession session = BeanUtils.copyProperties(user, UserSession.class); |
|
|
|
session.setUserId(user.getId()); |
|
|
|
@ -334,7 +345,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.hasText(user.getGroupIds())) { |
|
|
|
List<String> groupNames = UserGroupService.getGroupNamesByIds(user.getGroupIds()); |
|
|
|
List<String> groupNames = userGroupService.getGroupNamesByIds(user.getGroupIds()); |
|
|
|
vo.setGroupNames(groupNames); |
|
|
|
} |
|
|
|
|
|
|
|
@ -384,7 +395,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us |
|
|
|
// 获取用户的分组信息并转换为VO
|
|
|
|
String token = user.getUniqueToken(); |
|
|
|
if (StringUtils.hasText(token)) { |
|
|
|
List<UserLabel> label = UserLabelService.getLabelList(token); |
|
|
|
List<UserLabel> label = userLabelService.getLabelList(token); |
|
|
|
|
|
|
|
// 转换为UserGroupVO
|
|
|
|
List<UserLabelVO> labelVOList = label.stream() |
|
|
|
|