|
@@ -34,32 +34,26 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
-public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements GameService {
|
|
|
+public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IGameService {
|
|
|
|
|
|
@Autowired
|
|
|
- private GamePayWayService gamePayWayService;
|
|
|
+ private IGamePayWayService gamePayWayService;
|
|
|
|
|
|
@Autowired
|
|
|
- private GameStrategyService gameStrategyService;
|
|
|
+ private IGameStrategyService gameStrategyService;
|
|
|
|
|
|
@Autowired
|
|
|
- private GameCategoryService gameCategoryService;
|
|
|
+ private IGameCategoryService gameCategoryService;
|
|
|
|
|
|
@Autowired
|
|
|
- private GameTagService gameTagService;
|
|
|
+ private IGameTagService gameTagService;
|
|
|
|
|
|
@Autowired
|
|
|
- private CpService cpService;
|
|
|
+ private ICpService cpService;
|
|
|
|
|
|
@Autowired
|
|
|
- private GameAppletService gameAppletService;
|
|
|
+ private IGameAppletService gameAppletService;
|
|
|
|
|
|
- /**
|
|
|
- * 获取游戏对接参数
|
|
|
- *
|
|
|
- * @param id : 游戏id
|
|
|
- * @return : 信息展示
|
|
|
- */
|
|
|
@Override
|
|
|
public GameDockVO getGameDock(Long id) {
|
|
|
Game game = super.getById(id);
|
|
@@ -79,12 +73,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
return gameDockVO;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 参数对接更新
|
|
|
- *
|
|
|
- * @param param : 对接参数
|
|
|
- * @return : 返回更新结果
|
|
|
- */
|
|
|
@Override
|
|
|
public Boolean gameDockUpdate(GameDockParam param) {
|
|
|
if (Strings.isNotBlank(param.getAppKey())) {
|
|
@@ -114,12 +102,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
return gameAppletService.saveOrUpdate(gameApplet);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取游戏关联信息
|
|
|
- *
|
|
|
- * @param id : 游戏id
|
|
|
- * @return : 返回游戏关联信息
|
|
|
- */
|
|
|
@Override
|
|
|
public GameRelationVO getGameRelation(Long id) {
|
|
|
Game game = super.getById(id);
|
|
@@ -170,12 +152,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
return gameRelationVO;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取游戏的关联map
|
|
|
- *
|
|
|
- * @param gameList : 游戏列表
|
|
|
- * @return : 返回游戏列表
|
|
|
- */
|
|
|
private Map<Long, Game> getGameRelationMap(List<Game> gameList) {
|
|
|
Set<Long> gameIdSet = new HashSet<>();
|
|
|
gameList.forEach(game -> {
|
|
@@ -195,12 +171,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
return super.listByIds(gameIdSet).stream().collect(Collectors.toMap(Game::getId, Function.identity()));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 导量游戏更新
|
|
|
- *
|
|
|
- * @param param : 关联游戏更新参数
|
|
|
- * @return : 返回更新结果
|
|
|
- */
|
|
|
@Override
|
|
|
public Boolean guideGameUpdateUpdate(GuideGameUpdateParam param) {
|
|
|
return super.update(new LambdaUpdateWrapper<Game>()
|
|
@@ -209,12 +179,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
.eq(Game::getId, param.getId()));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 关联游戏更新
|
|
|
- *
|
|
|
- * @param param : 关联游戏更新参数
|
|
|
- * @return : 返回更新结果
|
|
|
- */
|
|
|
@Override
|
|
|
public Boolean relationGameUpdate(RelationGameUpdateParam param) {
|
|
|
if (param.getParentId() == null && param.getH5GameId() == null) {
|
|
@@ -227,12 +191,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
.eq(Game::getId, param.getId()));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取游戏基本信息
|
|
|
- *
|
|
|
- * @param gameId : 游戏id
|
|
|
- * @return : 返回游戏信息
|
|
|
- */
|
|
|
@Override
|
|
|
public GameInfoVO getGameInfo(Long gameId) {
|
|
|
Game game = super.getById(gameId);
|
|
@@ -280,12 +238,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
return gameInfoVO;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 游戏基本信息更新
|
|
|
- *
|
|
|
- * @param param : 游戏更新参数
|
|
|
- * @return : 返回更新结果
|
|
|
- */
|
|
|
@Override
|
|
|
public Boolean updateGameInfo(GameUpdateParam param) {
|
|
|
//游戏分类处理
|
|
@@ -310,12 +262,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
.eq(Game::getId, param.getId()));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 新增游戏
|
|
|
- *
|
|
|
- * @param param : 游戏新增参数
|
|
|
- * @return : 返回添加结果
|
|
|
- */
|
|
|
@Override
|
|
|
public Boolean gameAddOrUpdate(GameAddParam param) {
|
|
|
//游戏分类处理
|
|
@@ -353,12 +299,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
return super.saveOrUpdate(game);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 分类处理
|
|
|
- *
|
|
|
- * @param tagIdList : 选的游戏分类列表
|
|
|
- * @return : 返回分类信息
|
|
|
- */
|
|
|
private String getGameTags(List<Long> tagIdList) {
|
|
|
if (CollectionUtils.isEmpty(tagIdList)) {
|
|
|
return null;
|
|
@@ -377,12 +317,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
return StringUtils.join(tagIdSet, ",");
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 查询游戏列表
|
|
|
- *
|
|
|
- * @param param : 游戏列表查询参数
|
|
|
- * @return : 返回单页游戏游戏列表数据
|
|
|
- */
|
|
|
@Override
|
|
|
public IPage<GameListVO> gameList(GameListParam param) {
|
|
|
//cp列表
|
|
@@ -431,12 +365,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
).convert(game -> this.toVo(game, cpMap, gameCategoryMap, gameMap, gameTagMap));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 游戏对象信息转换
|
|
|
- *
|
|
|
- * @param game : 游戏信息
|
|
|
- * @return : 返回展示对象
|
|
|
- */
|
|
|
private GameListVO toVo(Game game, Map<Long, String> cpMap, Map<Long, GameCategoryDTO> gameCategoryMap,
|
|
|
Map<Long, String> gameMap, Map<Long, GameTagDTO> gameTagMap) {
|
|
|
GameListVO gameListVO = BeanUtils.copy(game, GameListVO.class);
|
|
@@ -488,23 +416,12 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
return gameListVO;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 游戏选择列表查询
|
|
|
- *
|
|
|
- * @return : 返回所有游戏信息
|
|
|
- */
|
|
|
@Override
|
|
|
public List<GameChoiceVO> choiceList() {
|
|
|
List<Game> gameList = super.list(new LambdaQueryWrapper<Game>().select(Game::getId, Game::getName, Game::getCategory));
|
|
|
return BeanUtils.copyList(gameList, GameChoiceVO.class);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 根据id查询游戏信息
|
|
|
- *
|
|
|
- * @param id : 游戏id
|
|
|
- * @return : 返回游戏信息
|
|
|
- */
|
|
|
@Override
|
|
|
public GameDTO getById(Long id) {
|
|
|
if (id == null) {
|
|
@@ -513,14 +430,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
return BeanUtils.copy(super.getById(id), GameDTO.class);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 游戏相关条件查询游戏信息
|
|
|
- *
|
|
|
- * @param cpId : cp唯一键
|
|
|
- * @param gameId : 游戏id
|
|
|
- * @param gameCategoryId : 分类id
|
|
|
- * @return : 返回游戏信息列表
|
|
|
- */
|
|
|
@Override
|
|
|
public Map<Long, GameDTO> gameCondition(Long cpId, Long gameId, Long gameCategoryId) {
|
|
|
//游戏条件判断
|
|
@@ -534,14 +443,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
return gameList.stream().collect(Collectors.toMap(GameDTO::getId, Function.identity()));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 游戏查询条件
|
|
|
- *
|
|
|
- * @param cpId : cp唯一键
|
|
|
- * @param gameId : 游戏id
|
|
|
- * @param gameCategoryId : 分类id
|
|
|
- * @return : 返回游戏信息列表, null 标识未匹配到游戏, 空表示没有条件
|
|
|
- */
|
|
|
private List<GameDTO> getGameList(Long cpId, Long gameId, Long gameCategoryId) {
|
|
|
if (cpId == null && gameId == null && gameCategoryId == null) {
|
|
|
return Collections.emptyList();
|
|
@@ -555,12 +456,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
return BeanUtils.copyList(gameList, GameDTO.class);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 游戏列表
|
|
|
- *
|
|
|
- * @param gameIds 游戏id列表
|
|
|
- * @return {@link Map}<{@link Long}, {@link GameDTO}>
|
|
|
- */
|
|
|
@Override
|
|
|
public Map<Long, GameDTO> gameMap(Collection<Long> gameIds) {
|
|
|
if (CollectionUtils.isEmpty(gameIds)) {
|
|
@@ -574,11 +469,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
return gameDTOList.stream().collect(Collectors.toMap(GameDTO::getId, Function.identity()));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 游戏列表
|
|
|
- *
|
|
|
- * @return {@link Map}<{@link Long}, {@link GameDTO}>
|
|
|
- */
|
|
|
@Override
|
|
|
public Map<Long, GameDTO> gameMap() {
|
|
|
List<Game> gameList = super.list();
|
|
@@ -589,24 +479,11 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
return gameDTOList.stream().collect(Collectors.toMap(GameDTO::getId, Function.identity()));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 根据主键id删除
|
|
|
- *
|
|
|
- * @param id : 主键id
|
|
|
- * @return : 返回删除结果
|
|
|
- */
|
|
|
@Override
|
|
|
public Boolean deleteById(Long id) {
|
|
|
return super.removeById(id);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 根据主键更新状态
|
|
|
- *
|
|
|
- * @param id : 主键id
|
|
|
- * @param status : 状态
|
|
|
- * @return : 返回更新结果
|
|
|
- */
|
|
|
@Override
|
|
|
public Boolean statusUpdate(Long id, Integer status) {
|
|
|
return super.update(new LambdaUpdateWrapper<Game>()
|