|
|
@ -10,6 +10,7 @@ import com.bx.imclient.IMClient; |
|
|
import com.bx.imcommon.enums.IMTerminalType; |
|
|
import com.bx.imcommon.enums.IMTerminalType; |
|
|
import com.bx.imcommon.model.IMPrivateMessage; |
|
|
import com.bx.imcommon.model.IMPrivateMessage; |
|
|
import com.bx.imcommon.model.IMUserInfo; |
|
|
import com.bx.imcommon.model.IMUserInfo; |
|
|
|
|
|
import com.bx.implatform.annotation.RedisLock; |
|
|
import com.bx.implatform.contant.RedisKey; |
|
|
import com.bx.implatform.contant.RedisKey; |
|
|
import com.bx.implatform.dto.FriendDndDTO; |
|
|
import com.bx.implatform.dto.FriendDndDTO; |
|
|
import com.bx.implatform.entity.Friend; |
|
|
import com.bx.implatform.entity.Friend; |
|
|
@ -75,10 +76,10 @@ public class FriendServiceImpl extends ServiceImpl<FriendMapper, Friend> impleme |
|
|
return friends.stream().map(this::conver).collect(Collectors.toList()); |
|
|
return friends.stream().map(this::conver).collect(Collectors.toList()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RedisLock(prefixKey = RedisKey.IM_LOCK_FRIEND_ADD, key = "#userId+':'+#friendId") |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Override |
|
|
@Override |
|
|
public void addFriend(Long friendId) { |
|
|
public void addFriend(Long userId, Long friendId) { |
|
|
long userId = SessionContext.getSession().getUserId(); |
|
|
|
|
|
if (friendId.equals(userId)) { |
|
|
if (friendId.equals(userId)) { |
|
|
throw new GlobalException("不允许添加自己为好友"); |
|
|
throw new GlobalException("不允许添加自己为好友"); |
|
|
} |
|
|
} |
|
|
|