From 3c6b6fa1ae7a95ee8f1d67fdfedd45f7526e3fbb Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Tue, 9 Dec 2025 17:54:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=85=B3=E6=B3=A8=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=96=B0=E5=A2=9E=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dynamic/query/DynamicFollowQryExe.java | 2 +- .../material/query/RecommendUserQueryExe.java | 2 +- .../user/query/UserRelationFollowQryExe.java | 15 +++++++++++---- .../user/user/UserSubscriptionService.java | 2 +- .../user/impl/UserSubscriptionServiceImpl.java | 3 ++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicFollowQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicFollowQryExe.java index 48cfd41e..5ff60683 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicFollowQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicFollowQryExe.java @@ -62,7 +62,7 @@ public class DynamicFollowQryExe { // 获取关注人列表 List userSubscriptions = userSubscriptionService - .listByUserId(cmd.requiredReqUserId(), null); + .listByUserId(cmd.requiredReqUserId(), null, null); if (CollectionUtils.isEmpty(userSubscriptions)) { return Lists.newArrayList(); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/query/RecommendUserQueryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/query/RecommendUserQueryExe.java index c7c16ff6..2abec25a 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/query/RecommendUserQueryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/query/RecommendUserQueryExe.java @@ -73,7 +73,7 @@ public class RecommendUserQueryExe { // 用户关注列表 Set userSubscriptions = userSubscriptionService.listByUserId( - cmd.getReqUserId(),null).stream().map(UserSubscription::getSubscribeUserId) + cmd.getReqUserId(),null, null).stream().map(UserSubscription::getSubscribeUserId) .collect(Collectors.toSet()); userIds.addAll(userSubscriptions); // 用户好友列表 diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFollowQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFollowQryExe.java index 366fac3b..f076e6c1 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFollowQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFollowQryExe.java @@ -10,12 +10,12 @@ import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.infra.database.rds.entity.user.user.UserSubscription; import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService; -import java.util.List; -import java.util.Map; -import java.util.Set; + +import java.util.*; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; /** * 用户关系订阅列表 @@ -32,8 +32,15 @@ public class UserRelationFollowQryExe { private final UserSubscriptionService userSubscriptionService; public List execute(AppFlowCmd cmd) { + Long subscriptionUserId = null; + if (StringUtils.hasText(cmd.getAccount())) { + subscriptionUserId = Optional.ofNullable(userProfileGateway.getByAccount(cmd.getReqSysOrigin().getOrigin(), cmd.getAccount())) + .map(UserProfile::getId) + .orElse(-1L); + } + List userSubscriptions = userSubscriptionService - .listByUserId(cmd.requiredReqUserId(), cmd.getLastId()); + .listByUserId(cmd.requiredReqUserId(), cmd.getLastId(), subscriptionUserId); if (CollectionUtils.isEmpty(userSubscriptions)) { return Lists.newArrayList(); diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/user/UserSubscriptionService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/user/UserSubscriptionService.java index 69b0b365..47aea7e1 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/user/UserSubscriptionService.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/user/UserSubscriptionService.java @@ -51,7 +51,7 @@ public interface UserSubscriptionService extends BaseService { * @param lastId ignore * @return ignore */ - List listByUserId(Long userId, Long lastId); + List listByUserId(Long userId, Long lastId, Long subscriptionUserId ); /** * 获取订阅我的用于列表. diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/user/impl/UserSubscriptionServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/user/impl/UserSubscriptionServiceImpl.java index fee91e75..595ad95b 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/user/impl/UserSubscriptionServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/user/impl/UserSubscriptionServiceImpl.java @@ -61,9 +61,10 @@ public class UserSubscriptionServiceImpl extends } @Override - public List listByUserId(Long userId, Long lastId) { + public List listByUserId(Long userId, Long lastId, Long subscriptionUserId) { return query() .eq(UserSubscription::getUserId, userId) + .eq(Objects.nonNull(subscriptionUserId), UserSubscription::getSubscribeUserId, subscriptionUserId) .lt(Objects.nonNull(lastId), UserSubscription::getId, lastId) .orderByDesc(UserSubscription::getId) .last(PageConstant.DEFAULT_LIMIT)