热门游戏 过滤下架的游戏
This commit is contained in:
parent
3a08c5d612
commit
fb54999074
@ -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.game.GameRankingRecord;
|
||||||
import com.red.circle.other.domain.gateway.game.GameRankingGateway;
|
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.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 com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
@ -32,6 +35,7 @@ public class GameRankingQryExe {
|
|||||||
private final GameRankingGateway gameRankingGateway;
|
private final GameRankingGateway gameRankingGateway;
|
||||||
private final GameRankingConvertor gameRankingConvertor;
|
private final GameRankingConvertor gameRankingConvertor;
|
||||||
private final RedisService redisService;
|
private final RedisService redisService;
|
||||||
|
private final GameListConfigService gameListConfigService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存过期时间:30秒
|
* 缓存过期时间:30秒
|
||||||
@ -63,8 +67,17 @@ public class GameRankingQryExe {
|
|||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.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 排序
|
// latest 排前,非 latest 保持原 totalPrizeAmount 排序
|
||||||
List<GameRankingCO> sorted = coList.stream()
|
List<GameRankingCO> sorted = coList.stream()
|
||||||
|
.filter(co -> showcaseGameIds.contains(co.getGameId()))
|
||||||
.sorted((a, b) -> {
|
.sorted((a, b) -> {
|
||||||
boolean aLatest = a.isLatest();
|
boolean aLatest = a.isLatest();
|
||||||
boolean bLatest = b.isLatest();
|
boolean bLatest = b.isLatest();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user