|
@@ -246,8 +246,8 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
gameInfoVO.setCpName(cp.getCpName());
|
|
|
}
|
|
|
}
|
|
|
- if (Strings.isNotBlank(game.getClassify())) {
|
|
|
- String[] split = game.getClassify().split(",");
|
|
|
+ if (Strings.isNotBlank(game.getTags())) {
|
|
|
+ String[] split = game.getTags().split(",");
|
|
|
List<Long> idList = Arrays.stream(split).map(Long::valueOf).collect(Collectors.toList());
|
|
|
List<GameTagVO> gameTagVOList = gameTagService.listByIds(idList);
|
|
|
gameInfoVO.setClassifyList(BeanUtils.copyList(gameTagVOList, GameTagChoiceVO.class));
|
|
@@ -289,13 +289,11 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
@Override
|
|
|
public Boolean updateGameInfo(GameUpdateParam param) {
|
|
|
//游戏分类处理
|
|
|
- List<Long> classifyList = param.getClassifyList();
|
|
|
- Map<String, String> map = this.getClassifyMap(classifyList);
|
|
|
+ String gameTags = this.getGameTags(param.getClassifyList());
|
|
|
return super.update(new LambdaUpdateWrapper<Game>()
|
|
|
.set(Strings.isNotBlank(param.getName()), Game::getName, param.getName())
|
|
|
.set(param.getCpId() != null, Game::getCpId, param.getCpId())
|
|
|
- .set(Strings.isNotBlank(map.get("classify")), Game::getClassify, map.get("classify"))
|
|
|
- .set(Strings.isNotBlank(map.get("classifyParent")), Game::getClassifyParent, map.get("classifyParent"))
|
|
|
+ .set(Strings.isNotBlank(gameTags), Game::getTags, gameTags)
|
|
|
.set(param.getCategory() != null, Game::getCategory, param.getCategory())
|
|
|
.set(param.getShareScale() != null, Game::getShareScale, param.getShareScale())
|
|
|
.set(Objects.equals(param.getIsParentGame(), Boolean.TRUE), Game::getParentId, 0L)
|
|
@@ -321,8 +319,7 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
@Override
|
|
|
public Boolean gameAddOrUpdate(GameAddParam param) {
|
|
|
//游戏分类处理
|
|
|
- List<Long> classifyList = param.getClassifyList();
|
|
|
- Map<String, String> map = this.getClassifyMap(classifyList);
|
|
|
+ String gameTags = this.getGameTags(param.getClassifyList());
|
|
|
//主键id
|
|
|
Long id = param.getId();
|
|
|
Game game;
|
|
@@ -332,8 +329,7 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
.name(param.getName())
|
|
|
.shareScale(param.getShareScale())
|
|
|
.category(param.getCategory())
|
|
|
- .classify(map.get("classify"))
|
|
|
- .classifyParent(map.get("classifyParent"))
|
|
|
+ .tags(gameTags)
|
|
|
.cpPaybackUrl(param.getCpPaybackUrl())
|
|
|
.gameUrl(param.getGameUrl())
|
|
|
.status(GameStatusEnum.UN_JOIN_UP.getStatus())
|
|
@@ -345,8 +341,7 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
game.setCpId(param.getCpId());
|
|
|
game.setName(param.getName());
|
|
|
game.setShareScale(param.getShareScale());
|
|
|
- game.setClassify(map.get("classify"));
|
|
|
- game.setClassifyParent(map.get("classifyParent"));
|
|
|
+ game.setTags(gameTags);
|
|
|
game.setUpdateTime(LocalDateTime.now());
|
|
|
game.setCpPaybackUrl(param.getCpPaybackUrl());
|
|
|
game.setGameUrl(param.getGameUrl());
|
|
@@ -361,30 +356,25 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
/**
|
|
|
* 分类处理
|
|
|
*
|
|
|
- * @param classifyList : 选的游戏分类列表
|
|
|
+ * @param tagIdList : 选的游戏分类列表
|
|
|
* @return : 返回分类信息
|
|
|
*/
|
|
|
- private Map<String, String> getClassifyMap(List<Long> classifyList) {
|
|
|
- if (CollectionUtils.isEmpty(classifyList)) {
|
|
|
- return Collections.emptyMap();
|
|
|
+ private String getGameTags(List<Long> tagIdList) {
|
|
|
+ if (CollectionUtils.isEmpty(tagIdList)) {
|
|
|
+ return null;
|
|
|
}
|
|
|
- List<GameTagVO> gameCategoryVOList = gameTagService.listByIds(classifyList);
|
|
|
- Set<Long> classifySet = new HashSet<>();
|
|
|
- Set<Long> classifyParentSet = new HashSet<>();
|
|
|
- gameCategoryVOList.forEach(vo -> {
|
|
|
- classifySet.add(vo.getId());
|
|
|
- if (Objects.equals(vo.getParentId(), 0L)) {
|
|
|
- classifyParentSet.add(vo.getId());
|
|
|
+ List<GameTagVO> gameTagVOList = gameTagService.listByIds(tagIdList);
|
|
|
+ Set<Long> tagIdSet = new HashSet<>();
|
|
|
+ gameTagVOList.forEach(tag -> {
|
|
|
+ tagIdSet.add(tag.getId());
|
|
|
+ if (Objects.equals(tag.getIsParent(), Boolean.TRUE) && tag.getParentId() != null) {
|
|
|
+ tagIdSet.add(tag.getParentId());
|
|
|
}
|
|
|
});
|
|
|
- Map<String, String> map = new HashMap<>(2);
|
|
|
- if (!classifySet.isEmpty()) {
|
|
|
- map.put("classify", StringUtils.join(classifySet, ","));
|
|
|
- }
|
|
|
- if (!classifyParentSet.isEmpty()) {
|
|
|
- map.put("classifyParent", StringUtils.join(classifySet, ","));
|
|
|
+ if (tagIdSet.isEmpty()) {
|
|
|
+ return null;
|
|
|
}
|
|
|
- return map;
|
|
|
+ return StringUtils.join(tagIdSet, ",");
|
|
|
}
|
|
|
|
|
|
/**
|