From 3a08c5d612b681b59a0a335e89553b24594177fd Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Fri, 29 May 2026 14:51:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E7=8E=A9=E8=AE=B0=E5=BD=95=20?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E4=B8=8B=E6=9E=B6=E7=9A=84=E6=B8=B8=E6=88=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../command/game/GamePlayHistoryQryExe.java | 23 +++++++++++++++++++ .../game/GamePlayHistoryRecordCmdExe.java | 1 + 2 files changed, 24 insertions(+) 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());