拉黑逻辑缓存处理
This commit is contained in:
parent
ff30192fe0
commit
4f56f8e8bf
@ -7,6 +7,7 @@ import com.red.circle.other.app.dto.cmd.user.user.UserShieldBlackUserCmd;
|
|||||||
import com.red.circle.other.domain.gateway.user.ability.UserRelationsCalculatorGateway;
|
import com.red.circle.other.domain.gateway.user.ability.UserRelationsCalculatorGateway;
|
||||||
import com.red.circle.other.domain.model.user.ability.UserRelationsCalculator;
|
import com.red.circle.other.domain.model.user.ability.UserRelationsCalculator;
|
||||||
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
|
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
|
||||||
|
import com.red.circle.other.infra.database.cache.service.user.UserRelationshipCacheService;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile;
|
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomUserBlacklist;
|
import com.red.circle.other.infra.database.mongo.entity.live.RoomUserBlacklist;
|
||||||
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
||||||
@ -44,6 +45,7 @@ public class UserShieldBlackAddCmdExe {
|
|||||||
private final CpRelationshipService cpRelationshipService;
|
private final CpRelationshipService cpRelationshipService;
|
||||||
private final UserSubscriptionService userSubscriptionService;
|
private final UserSubscriptionService userSubscriptionService;
|
||||||
private final UserRelationsCalculatorGateway userRelationsCalculatorGateway;
|
private final UserRelationsCalculatorGateway userRelationsCalculatorGateway;
|
||||||
|
private final UserRelationshipCacheService userRelationshipCacheService;
|
||||||
|
|
||||||
public void execute(UserShieldBlackUserCmd cmd) {
|
public void execute(UserShieldBlackUserCmd cmd) {
|
||||||
|
|
||||||
@ -94,21 +96,26 @@ public class UserShieldBlackAddCmdExe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void cancelSubAndRmFriend(Long reqUserId, Long shieldUserId) {
|
private void cancelSubAndRmFriend(Long reqUserId, Long shieldUserId) {
|
||||||
userSubscriptionService.remove(reqUserId, shieldUserId);
|
boolean removed = userSubscriptionService.remove(reqUserId, shieldUserId);
|
||||||
userRelationsCalculatorGateway.process(new UserRelationsCalculator()
|
if (removed) {
|
||||||
.setUserId(reqUserId)
|
userRelationsCalculatorGateway.process(new UserRelationsCalculator()
|
||||||
.setSubUserId(shieldUserId)
|
.setUserId(reqUserId)
|
||||||
.setIncr(Boolean.FALSE)
|
.setSubUserId(shieldUserId)
|
||||||
.setType(UserRelationsCalculator.CounterEnum.SUBSCRIPTION)
|
.setIncr(Boolean.FALSE)
|
||||||
);
|
.setType(UserRelationsCalculator.CounterEnum.SUBSCRIPTION)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
relationshipFriendService.removeFriend(reqUserId, shieldUserId);
|
boolean removedFriendId = relationshipFriendService.removeFriendId(reqUserId, shieldUserId);
|
||||||
userRelationsCalculatorGateway.process(new UserRelationsCalculator()
|
if (removedFriendId) {
|
||||||
.setUserId(reqUserId)
|
userRelationsCalculatorGateway.process(new UserRelationsCalculator()
|
||||||
.setSubUserId(shieldUserId)
|
.setUserId(reqUserId)
|
||||||
.setIncr(Boolean.FALSE)
|
.setSubUserId(shieldUserId)
|
||||||
.setType(UserRelationsCalculator.CounterEnum.FRIEND)
|
.setIncr(Boolean.FALSE)
|
||||||
);
|
.setType(UserRelationsCalculator.CounterEnum.FRIEND)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
userRelationshipCacheService.removeFriend(reqUserId, shieldUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,6 +50,11 @@ public interface RelationshipFriendService extends BaseService<RelationshipFrien
|
|||||||
*/
|
*/
|
||||||
Boolean checkFriend(Long userId, Long friendUserId);
|
Boolean checkFriend(Long userId, Long friendUserId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除单向好友
|
||||||
|
*/
|
||||||
|
boolean removeFriendId(Long userId, Long friendUserId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除好友.
|
* 移除好友.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -94,6 +94,16 @@ public class RelationshipFriendServiceImpl extends
|
|||||||
).map(relationshipFriend -> Objects.nonNull(relationshipFriend.getId())).orElse(Boolean.FALSE);
|
).map(relationshipFriend -> Objects.nonNull(relationshipFriend.getId())).orElse(Boolean.FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean removeFriendId(Long userId, Long friendUserId) {
|
||||||
|
return delete()
|
||||||
|
.eq(RelationshipFriend::getUserId, userId)
|
||||||
|
.eq(RelationshipFriend::getFriendUserId, friendUserId)
|
||||||
|
.last(PageConstant.LIMIT_ONE)
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeFriend(Long userId, Long friendUserId) {
|
public void removeFriend(Long userId, Long friendUserId) {
|
||||||
delete()
|
delete()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user