粉丝列表新增account查询逻辑
This commit is contained in:
parent
e0d114cabf
commit
9f6e55d871
@ -15,6 +15,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,8 +33,10 @@ public class UserRelationFansQryExe {
|
|||||||
private final UserSubscriptionService userSubscriptionService;
|
private final UserSubscriptionService userSubscriptionService;
|
||||||
|
|
||||||
public List<UserSupportRelationCO> execute(AppFlowCmd cmd) {
|
public List<UserSupportRelationCO> execute(AppFlowCmd cmd) {
|
||||||
|
Long searchUserId = getSearchUserId(cmd);
|
||||||
|
|
||||||
List<UserSubscription> userFans = userSubscriptionService
|
List<UserSubscription> userFans = userSubscriptionService
|
||||||
.getBySubscriptionUserId(cmd.requiredReqUserId(), cmd.getLastId());
|
.getBySubscriptionUserId(cmd.requiredReqUserId(),searchUserId, cmd.getLastId());
|
||||||
if (CollectionUtils.isEmpty(userFans)) {
|
if (CollectionUtils.isEmpty(userFans)) {
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
@ -53,6 +56,15 @@ public class UserRelationFansQryExe {
|
|||||||
.collect(Collectors.toList());
|
.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) {
|
private Set<Long> getUserIds(List<UserSubscription> userFans) {
|
||||||
return userFans.stream()
|
return userFans.stream()
|
||||||
|
|||||||
@ -60,7 +60,7 @@ public interface UserSubscriptionService extends BaseService<UserSubscription> {
|
|||||||
* @param lastId ignore
|
* @param lastId ignore
|
||||||
* @return ignore
|
* @return ignore
|
||||||
*/
|
*/
|
||||||
List<UserSubscription> getBySubscriptionUserId(Long userId, Long lastId);
|
List<UserSubscription> getBySubscriptionUserId(Long userId, Long searchUserId, Long lastId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测用户是否订阅.
|
* 检测用户是否订阅.
|
||||||
|
|||||||
@ -72,9 +72,10 @@ public class UserSubscriptionServiceImpl extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UserSubscription> getBySubscriptionUserId(Long userId, Long lastId) {
|
public List<UserSubscription> getBySubscriptionUserId(Long userId, Long searchUserId, Long lastId) {
|
||||||
return query()
|
return query()
|
||||||
.eq(UserSubscription::getSubscribeUserId, userId)
|
.eq(UserSubscription::getSubscribeUserId, userId)
|
||||||
|
.eq(Objects.nonNull(searchUserId), UserSubscription::getUserId, searchUserId)
|
||||||
.lt(Objects.nonNull(lastId), UserSubscription::getId, lastId)
|
.lt(Objects.nonNull(lastId), UserSubscription::getId, lastId)
|
||||||
.orderByDesc(UserSubscription::getId)
|
.orderByDesc(UserSubscription::getId)
|
||||||
.last(PageConstant.DEFAULT_LIMIT)
|
.last(PageConstant.DEFAULT_LIMIT)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user