热门游戏 过滤下架的游戏

This commit is contained in:
tianfeng 2026-05-29 14:54:53 +08:00
parent 3a08c5d612
commit fb54999074

View File

@ -11,11 +11,14 @@ import com.red.circle.other.domain.game.GameRankingPeriodType;
import com.red.circle.other.domain.game.GameRankingRecord;
import com.red.circle.other.domain.gateway.game.GameRankingGateway;
import com.red.circle.other.infra.database.cache.key.GameRankingKeys;
import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig;
import com.red.circle.other.infra.database.rds.service.sys.GameListConfigService;
import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@ -32,6 +35,7 @@ public class GameRankingQryExe {
private final GameRankingGateway gameRankingGateway;
private final GameRankingConvertor gameRankingConvertor;
private final RedisService redisService;
private final GameListConfigService gameListConfigService;
/**
* 缓存过期时间30秒
@ -63,8 +67,17 @@ public class GameRankingQryExe {
})
.collect(Collectors.toList());
Set<String> showcaseGameIds = gameListConfigService.query()
.in(GameListConfig::getGameId, coList.stream().map(GameRankingCO::getGameId).collect(Collectors.toSet()))
.eq(GameListConfig::getShowcase, Boolean.TRUE)
.list()
.stream()
.map(GameListConfig::getGameId)
.collect(Collectors.toSet());
// latest 排前 latest 保持原 totalPrizeAmount 排序
List<GameRankingCO> sorted = coList.stream()
.filter(co -> showcaseGameIds.contains(co.getGameId()))
.sorted((a, b) -> {
boolean aLatest = a.isLatest();
boolean bLatest = b.isLatest();