Browse Source

feat : 后台bug调试修改

bilingfeng 2 years ago
parent
commit
ad64fd6c16

+ 5 - 4
game-module/game-manage/src/main/java/com/zanxiang/manage/service/Impl/GameServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zanxiang.common.enums.GameCategoryEnum;
 import com.zanxiang.common.utils.bean.BeanUtils;
+import com.zanxiang.manage.domain.dto.GameCategoryDTO;
 import com.zanxiang.manage.domain.dto.GameDTO;
 import com.zanxiang.manage.domain.params.*;
 import com.zanxiang.manage.domain.vo.*;
@@ -378,7 +379,7 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
         Map<Long, String> cpMap = cpService.choiceList().stream()
                 .collect(Collectors.toMap(CpChoiceVO::getId, CpChoiceVO::getCpName));
         //游戏分类列表
-        Map<Long, String> gameCategoryMap = gameCategoryService.choiceMap();
+        Map<Long, GameCategoryDTO> gameCategoryMap = gameCategoryService.gameCategoryMap();
         //查询游戏
         Map<Long, String> gameMap = this.choiceList().stream()
                 .collect(Collectors.toMap(GameChoiceVO::getId, GameChoiceVO::getName));
@@ -406,7 +407,7 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
      * @param game : 游戏信息
      * @return : 返回展示对象
      */
-    private GameListVO toVo(Game game, Map<Long, String> cpMap, Map<Long, String> gameCategoryMap, Map<Long, String> gameMap) {
+    private GameListVO toVo(Game game, Map<Long, String> cpMap, Map<Long, GameCategoryDTO> gameCategoryMap, Map<Long, String> gameMap) {
         GameListVO gameListVO = BeanUtils.copy(game, GameListVO.class);
         if (gameListVO == null) {
             return null;
@@ -417,14 +418,14 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
         }
         //游戏类型
         if (gameListVO.getCategory() != null) {
-            gameListVO.setCategoryName(gameCategoryMap.get(gameListVO.getCategory()));
+            gameListVO.setCategoryName(gameCategoryMap.get(gameListVO.getCategory()) == null ? null : gameCategoryMap.get(gameListVO.getCategory()).getName());
         }
         //游戏分类
         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)));
+                classifyNameList.add(gameCategoryMap.get(Long.valueOf(classifyId)) == null ? null : gameCategoryMap.get(Long.valueOf(classifyId)).getName());
             }
             gameListVO.setClassifyNameList(classifyNameList);
         }