BUGFIX:aida;
This commit is contained in:
@@ -178,14 +178,17 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
public List<Long> getLikedPortfolios(Long userId) {
|
||||
// 获取所有包含PORTFOLIO_LIKE_KEY的键
|
||||
Set<String> likedPortfolios = redisTemplate.keys(PORTFOLIO_LIKE_KEY + "*");
|
||||
|
||||
// 如果没有喜欢的,返回空列表
|
||||
if (likedPortfolios == null || likedPortfolios.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 过滤出包含指定用户ID的键,并提取投资组合ID
|
||||
return likedPortfolios.stream()
|
||||
.filter(key -> redisTemplate.opsForSet().isMember(key, userId.toString()))
|
||||
.filter(key -> redisTemplate.opsForSet().isMember(key, String.valueOf(userId)))
|
||||
.map(key -> Long.valueOf(key.replace(PORTFOLIO_LIKE_KEY, "")))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
qw.lambda().eq(Portfolio::getAccountId, userHolder.getId());
|
||||
}
|
||||
if (query.getGetLikePortfolio() == 1) {
|
||||
List<Long> likedPortfolioIdList = redisUtil.getLikedPortfolios(userHolder.getId());
|
||||
List<Long> likedPortfolioIdList = redisUtil.getLikedPortfolios(88L);
|
||||
if (!CollectionUtils.isEmpty(likedPortfolioIdList)) {
|
||||
qw.lambda().in(Portfolio::getId, likedPortfolioIdList);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user