|
@@ -374,6 +374,15 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
*/
|
|
|
@Override
|
|
|
public IPage<GameListVO> gameList(GameListParam param) {
|
|
|
+ //cp列表
|
|
|
+ Map<Long, String> cpMap = cpService.choiceList().stream()
|
|
|
+ .collect(Collectors.toMap(CpChoiceVO::getId, CpChoiceVO::getCpName));
|
|
|
+ //游戏分类列表
|
|
|
+ Map<Long, String> gameCategoryMap = gameCategoryService.choiceList().stream()
|
|
|
+ .collect(Collectors.toMap(GameCategoryParentVO::getId, GameCategoryParentVO::getName));
|
|
|
+ //查询游戏
|
|
|
+ Map<Long, String> gameMap = this.choiceList().stream()
|
|
|
+ .collect(Collectors.toMap(GameChoiceVO::getId, GameChoiceVO::getName));
|
|
|
//执行查询
|
|
|
return page(param.toPage(), new QueryWrapper<Game>().lambda()
|
|
|
.eq(param.getCpId() != null, Game::getCpId, param.getCpId())
|
|
@@ -389,7 +398,7 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
"FIND_IN_SET({0}, classifyParent)", String.valueOf(param.getGameClassifyId()))
|
|
|
.eq(param.getStatus() != null, Game::getStatus, param.getStatus())
|
|
|
.orderByDesc(Game::getCreateTime)
|
|
|
- ).convert(this::toVo);
|
|
|
+ ).convert(game -> this.toVo(game, cpMap, gameCategoryMap, gameMap));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -398,18 +407,44 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
* @param game : 游戏信息
|
|
|
* @return : 返回展示对象
|
|
|
*/
|
|
|
- private GameListVO toVo(Game game) {
|
|
|
+ private GameListVO toVo(Game game, Map<Long, String> cpMap, Map<Long, String> gameCategoryMap, Map<Long, String> gameMap) {
|
|
|
GameListVO gameListVO = BeanUtils.copy(game, GameListVO.class);
|
|
|
if (gameListVO == null) {
|
|
|
return null;
|
|
|
}
|
|
|
- //游戏是主游戏
|
|
|
+ //cp设置
|
|
|
+ if (gameListVO.getCpId() != null) {
|
|
|
+ gameListVO.setCpName(cpMap.get(gameListVO.getCpId()));
|
|
|
+ }
|
|
|
+ //游戏类型
|
|
|
+ if (gameListVO.getCategory() != null) {
|
|
|
+ gameListVO.setCategoryName(gameCategoryMap.get(gameListVO.getCategory()));
|
|
|
+ }
|
|
|
+ //游戏分类
|
|
|
+ if (gameListVO.getClassify() != null) {
|
|
|
+ String[] classifyIds = gameListVO.getClassify().split(",");
|
|
|
+ List<String> classifyNameList = new ArrayList<>();
|
|
|
+ for (String classifyId : classifyIds) {
|
|
|
+ classifyNameList.add(gameCategoryMap.get(Long.valueOf(classifyId)));
|
|
|
+ }
|
|
|
+ gameListVO.setClassifyNameList(classifyNameList);
|
|
|
+ }
|
|
|
+ //主游戏设置
|
|
|
if (Objects.equals(game.getParentId(), 0L)) {
|
|
|
gameListVO.setIsParentGame(Boolean.TRUE);
|
|
|
gameListVO.setParentId(game.getId());
|
|
|
gameListVO.setParentName(game.getName());
|
|
|
} else {
|
|
|
-
|
|
|
+ gameListVO.setIsParentGame(Boolean.FALSE);
|
|
|
+ gameListVO.setParentName(gameMap.get(gameListVO.getParentId()));
|
|
|
+ }
|
|
|
+ //h5游戏
|
|
|
+ if (gameListVO.getH5GameId() != null) {
|
|
|
+ gameListVO.setH5GameName(gameMap.get(gameListVO.getH5GameId()));
|
|
|
+ }
|
|
|
+ //关联游戏
|
|
|
+ if (gameListVO.getGuideGameId() != null) {
|
|
|
+ gameListVO.setGuideGameName(gameMap.get(gameListVO.getGuideGameId()));
|
|
|
}
|
|
|
//查询支付方式列表
|
|
|
List<GamePayWayVO> gamePayWayVOList = gamePayWayService.getByGameId(game.getId());
|