|
|
@@ -1,6 +1,8 @@
|
|
|
package cn.reghao.tnb.user.app.rpc;
|
|
|
|
|
|
+import cn.reghao.tnb.auth.api.dto.AccountInfo;
|
|
|
import cn.reghao.tnb.auth.api.iface.AccountQuery;
|
|
|
+import cn.reghao.tnb.user.api.dto.ContactInfo;
|
|
|
import cn.reghao.tnb.user.api.dto.UserCard;
|
|
|
import cn.reghao.tnb.user.api.iface.UserService;
|
|
|
import cn.reghao.tnb.user.app.db.mapper.UserContactMapper;
|
|
|
@@ -86,4 +88,14 @@ public class UserServiceImpl implements UserService {
|
|
|
public boolean contactContain(long userId, long friendId) {
|
|
|
return userContactMapper.findByOwnerAndFriendId(userId, friendId) != null;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ContactInfo> getUserContacts(long userId) {
|
|
|
+ return userContactMapper.findByOwner(userId).stream()
|
|
|
+ .map(userContact -> {
|
|
|
+ long friendId = userContact.getFriendId();
|
|
|
+ AccountInfo accountInfo = accountQuery.getAccountInfo(friendId);
|
|
|
+ return new ContactInfo(accountInfo);
|
|
|
+ }).toList();
|
|
|
+ }
|
|
|
}
|