diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/game/GamePlayHistoryQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/game/GamePlayHistoryQryExe.java index f6893cc1..e0d38a73 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/game/GamePlayHistoryQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/game/GamePlayHistoryQryExe.java @@ -3,8 +3,13 @@ package com.red.circle.other.app.command.game; import com.red.circle.other.app.dto.clientobject.game.GamePlayHistoryCO; import com.red.circle.other.infra.database.mongo.entity.game.UserGamePlayHistory; import com.red.circle.other.infra.database.mongo.service.game.UserGamePlayHistoryService; +import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig; +import com.red.circle.other.infra.database.rds.service.sys.GameListConfigService; import java.util.List; +import java.util.Map; import java.util.Objects; +import java.util.Set; +import java.util.function.Function; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -21,13 +26,31 @@ public class GamePlayHistoryQryExe { private static final int RECENT_LIMIT = 10; private final UserGamePlayHistoryService userGamePlayHistoryService; + private final GameListConfigService gameListConfigService; public List execute(String sysOrigin, Long userId, String scene) { List historyList = userGamePlayHistoryService.listRecent(sysOrigin, userId, scene, RECENT_LIMIT); + if (historyList.isEmpty()) { + return List.of(); + } + + Set configIds = historyList.stream() + .map(UserGamePlayHistory::getGameListConfigId) + .collect(Collectors.toSet()); + Map configMap = gameListConfigService.query() + .in(GameListConfig::getId, configIds) + .list() + .stream() + .collect(Collectors.toMap(GameListConfig::getId, Function.identity())); + return historyList.stream() .filter(h -> Objects.nonNull(h.getGameInfo())) + .filter(h -> { + GameListConfig config = configMap.get(h.getGameListConfigId()); + return config != null && Boolean.TRUE.equals(config.getShowcase()); + }) .map(this::toCO) .collect(Collectors.toList()); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/game/GamePlayHistoryRecordCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/game/GamePlayHistoryRecordCmdExe.java index 18233141..14d9b1f3 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/game/GamePlayHistoryRecordCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/game/GamePlayHistoryRecordCmdExe.java @@ -28,6 +28,7 @@ public class GamePlayHistoryRecordCmdExe { public void execute(GamePlayHistoryRecordCmd cmd) { GameListConfig config = gameListConfigService.getById(cmd.getGameListConfigId()); ResponseAssert.notNull(GameErrorCode.GAME_NOT_EXIST, config); + ResponseAssert.isTrue(GameErrorCode.GAME_NOT_EXIST, Boolean.TRUE.equals(config.getShowcase())); GameInfo gameInfo = new GameInfo(); gameInfo.setId(config.getId());