粉丝列表新增account查询逻辑

This commit is contained in:
tianfeng 2026-03-12 16:50:51 +08:00
parent e0d114cabf
commit 9f6e55d871
3 changed files with 16 additions and 3 deletions

View File

@ -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<UserSupportRelationCO> execute(AppFlowCmd cmd) {
Long searchUserId = getSearchUserId(cmd);
List<UserSubscription> 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<Long> getUserIds(List<UserSubscription> userFans) {
return userFans.stream()

View File

@ -60,7 +60,7 @@ public interface UserSubscriptionService extends BaseService<UserSubscription> {
* @param lastId ignore
* @return ignore
*/
List<UserSubscription> getBySubscriptionUserId(Long userId, Long lastId);
List<UserSubscription> getBySubscriptionUserId(Long userId, Long searchUserId, Long lastId);
/**
* 检测用户是否订阅.

View File

@ -72,9 +72,10 @@ public class UserSubscriptionServiceImpl extends
}
@Override
public List<UserSubscription> getBySubscriptionUserId(Long userId, Long lastId) {
public List<UserSubscription> 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)