diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFansQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFansQryExe.java index 5d827680..a1a22aff 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFansQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFansQryExe.java @@ -15,6 +15,7 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; /** @@ -32,8 +33,10 @@ public class UserRelationFansQryExe { private final UserSubscriptionService userSubscriptionService; public List execute(AppFlowCmd cmd) { + Long searchUserId = getSearchUserId(cmd); + List userFans = userSubscriptionService - .getBySubscriptionUserId(cmd.requiredReqUserId(), cmd.getLastId()); + .getBySubscriptionUserId(cmd.requiredReqUserId(),searchUserId, cmd.getLastId()); if (CollectionUtils.isEmpty(userFans)) { return Lists.newArrayList(); } @@ -53,6 +56,15 @@ public class UserRelationFansQryExe { .collect(Collectors.toList()); } + private Long getSearchUserId(AppFlowCmd cmd) { + if (StringUtils.isEmpty(cmd.getAccount())) { + return null; + } + + UserProfile profile = userProfileGateway.getByAccount(cmd.getReqSysOrigin().getOrigin(), cmd.getAccount()); + return profile != null ? profile.getId() : -1L; + } + private Set getUserIds(List userFans) { return userFans.stream() 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 47aea7e1..31299fad 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 @@ -60,7 +60,7 @@ public interface UserSubscriptionService extends BaseService { * @param lastId ignore * @return ignore */ - List getBySubscriptionUserId(Long userId, Long lastId); + List getBySubscriptionUserId(Long userId, Long searchUserId, Long lastId); /** * 检测用户是否订阅. 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 595ad95b..737983bb 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 @@ -72,9 +72,10 @@ public class UserSubscriptionServiceImpl extends } @Override - public List getBySubscriptionUserId(Long userId, Long lastId) { + public List getBySubscriptionUserId(Long userId, Long searchUserId, Long lastId) { return query() .eq(UserSubscription::getSubscribeUserId, userId) + .eq(Objects.nonNull(searchUserId), UserSubscription::getUserId, searchUserId) .lt(Objects.nonNull(lastId), UserSubscription::getId, lastId) .orderByDesc(UserSubscription::getId) .last(PageConstant.DEFAULT_LIMIT)