Преглед изворни кода

fix : SDK后台CP表和game表字段优化修改

bilingfeng пре 1 година
родитељ
комит
288fed3df6
12 измењених фајлова са 130 додато и 548 уклоњено
  1. 17 0
      game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/pojo/enums/GameCategoryEnum.java
  2. 2 60
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/controller/GameController.java
  3. 0 6
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/CpAddUpdateParam.java
  4. 36 6
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameAddParam.java
  5. 2 26
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameListVO.java
  6. 6 56
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IGameService.java
  7. 0 8
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IGameTagService.java
  8. 0 2
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GamePictureServiceImpl.java
  9. 53 272
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameServiceImpl.java
  10. 0 8
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameTagServiceImpl.java
  11. 0 6
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/Cp.java
  12. 14 98
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/Game.java

+ 17 - 0
game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/pojo/enums/GameCategoryEnum.java

@@ -3,6 +3,8 @@ package com.zanxiang.game.module.base.pojo.enums;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
 
+import java.util.Objects;
+
 /**
  * @author : lingfeng
  * @time : 2022-07-13
@@ -46,4 +48,19 @@ public enum GameCategoryEnum {
      * 描述
      */
     private String name;
+
+    /**
+     * 被分类名字
+     *
+     * @param category 类别
+     * @return {@link String}
+     */
+    public static String getNameByCategory(Long category) {
+        for (GameCategoryEnum gameCategoryEnum : GameCategoryEnum.values()) {
+            if (Objects.equals(gameCategoryEnum.getCategory(), category)) {
+                return gameCategoryEnum.getName();
+            }
+        }
+        return null;
+    }
 }

+ 2 - 60
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/controller/GameController.java

@@ -2,11 +2,9 @@ package com.zanxiang.game.module.manage.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.zanxiang.erp.security.annotation.PreAuthorize;
-import com.zanxiang.game.module.manage.pojo.params.*;
-import com.zanxiang.game.module.manage.pojo.vo.GameDockVO;
-import com.zanxiang.game.module.manage.pojo.vo.GameInfoVO;
+import com.zanxiang.game.module.manage.pojo.params.GameAddParam;
+import com.zanxiang.game.module.manage.pojo.params.GameListParam;
 import com.zanxiang.game.module.manage.pojo.vo.GameListVO;
-import com.zanxiang.game.module.manage.pojo.vo.GameRelationVO;
 import com.zanxiang.game.module.manage.service.IGameService;
 import com.zanxiang.module.util.pojo.ResultVO;
 import io.swagger.annotations.Api;
@@ -40,62 +38,6 @@ public class GameController {
         return ResultVO.ok(gameService.gameAddOrUpdate(param));
     }
 
-    @ApiOperation(value = "游戏基本信息查询")
-    @GetMapping(value = "/detail/info")
-    @PreAuthorize(permissionKey = "sdk:game:detailInfo")
-    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameInfoVO.class)})
-    public ResultVO<GameInfoVO> getGameInfo(@RequestParam Long id) {
-        return ResultVO.ok(gameService.getGameInfo(id));
-    }
-
-    @ApiOperation(value = "游戏基本信息更新")
-    @PostMapping(value = "/detail/update")
-    @PreAuthorize(permissionKey = "sdk:game:detailUpdate")
-    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
-    public ResultVO<Boolean> gameUpdate(@Validated @RequestBody GameUpdateParam param) {
-        return ResultVO.ok(gameService.updateGameInfo(param));
-    }
-
-    @ApiOperation(value = "游戏对接参数获取展示")
-    @GetMapping(value = "/dock/info")
-    @PreAuthorize(permissionKey = "sdk:game:dockInfo")
-    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameDockVO.class)})
-    public ResultVO<GameDockVO> getGameDock(@RequestParam Long id) {
-        return ResultVO.ok(gameService.getGameDock(id));
-    }
-
-    @ApiOperation(value = "游戏对接参数更新更新")
-    @PostMapping(value = "/dock/update")
-    @PreAuthorize(permissionKey = "sdk:game:dockUpdate")
-    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
-    public ResultVO<Boolean> gameDockUpdate(@Validated @RequestBody GameDockParam param) {
-        return ResultVO.ok(gameService.gameDockUpdate(param));
-    }
-
-    @ApiOperation(value = "获取游戏关联信息")
-    @GetMapping(value = "/relation/info")
-    @PreAuthorize(permissionKey = "sdk:game:relationInfo")
-    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameRelationVO.class)})
-    public ResultVO<GameRelationVO> getGameRelation(@RequestParam Long id) {
-        return ResultVO.ok(gameService.getGameRelation(id));
-    }
-
-    @ApiOperation(value = "关联游戏更新")
-    @PostMapping(value = "/relation/update")
-    @PreAuthorize(permissionKey = "sdk:game:relationUpdate")
-    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
-    public ResultVO<Boolean> relationGameUpdate(@Validated @RequestBody RelationGameUpdateParam param) {
-        return ResultVO.ok(gameService.relationGameUpdate(param));
-    }
-
-    @ApiOperation(value = "导量游戏更新")
-    @PostMapping(value = "/guide/update")
-    @PreAuthorize(permissionKey = "sdk:game:guideUpdate")
-    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameListVO.class)})
-    public ResultVO<Boolean> guideGameUpdateUpdate(@Validated @RequestBody GuideGameUpdateParam param) {
-        return ResultVO.ok(gameService.guideGameUpdateUpdate(param));
-    }
-
     @ApiOperation(value = "游戏列表查询")
     @PostMapping(value = "/list")
     @PreAuthorize(permissionKey = "sdk:game:list")

+ 0 - 6
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/CpAddUpdateParam.java

@@ -59,10 +59,4 @@ public class CpAddUpdateParam {
      */
     @ApiModelProperty(notes = "备注")
     private String remark;
-
-    /**
-     * 渠道
-     */
-    @ApiModelProperty(notes = "渠道, 暂时没有用到, 不传值")
-    private Long channel;
 }

+ 36 - 6
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameAddParam.java

@@ -70,15 +70,45 @@ public class GameAddParam {
     private Long parentGameId;
 
     /**
-     * CP回调地址
+     * 关联H5游戏id
      */
-    @ApiModelProperty(notes = "CP回调地址")
-    private String cpPaybackUrl;
+    @ApiModelProperty(notes = "关联H5游戏id(选填)")
+    private Long h5GameId;
 
     /**
-     * 游戏地址
+     * 导量游戏id
      */
-    @ApiModelProperty(notes = "游戏地址")
-    private String gameUrl;
+    @ApiModelProperty(notes = "导量游戏id(选填)")
+    private Long guideGameId;
+
+    /**
+     * 小游戏/公众号应用id
+     */
+    @ApiModelProperty(notes = "小游戏/公众号应用id (微信小游戏和H5游戏必填, APP游戏不填)")
+    private String appId;
+
+    /**
+     * 小游戏/公众号应用原始id
+     */
+    @ApiModelProperty(notes = "小游戏/公众号应用原始id (微信小游戏和H5游戏必填, APP游戏不填)")
+    private String ghId;
+
+    /**
+     * 小游戏/公众号应用名称
+     */
+    @ApiModelProperty(notes = "小游戏/公众号应用名称 (微信小游戏和H5游戏必填, APP游戏不填)")
+    private String appName;
+
+    /**
+     * 小游戏/公众号应用密钥
+     */
+    @ApiModelProperty(notes = "小游戏/公众号应用密钥 (微信小游戏和H5游戏必填, APP游戏不填)")
+    private String appSecret;
+
+    /**
+     * 游戏描述
+     */
+    @ApiModelProperty(notes = "游戏描述(选填)")
+    private String description;
 
 }

+ 2 - 26
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameListVO.java

@@ -38,9 +38,9 @@ public class GameListVO {
     private String categoryName;
 
     /**
-     * CPID
+     * cp的主键id
      */
-    @ApiModelProperty(notes = "CPID")
+    @ApiModelProperty(notes = "cp的主键id")
     private Long cpId;
 
     /**
@@ -67,18 +67,6 @@ public class GameListVO {
     @ApiModelProperty(notes = "游戏分类名称列表")
     private List<String> tagNameList;
 
-    /**
-     * 游戏分类
-     */
-    @ApiModelProperty(notes = "游戏分类Id")
-    private String classify;
-
-    /**
-     * 游戏分类名称列表
-     */
-    @ApiModelProperty(notes = "游戏分类名称列表")
-    private List<String> classifyNameList;
-
     /**
      * 是否父游戏
      */
@@ -127,18 +115,6 @@ public class GameListVO {
     @ApiModelProperty(notes = "支付方式列表")
     private List<GamePayWayVO> gamePayWayList;
 
-    /**
-     * CP回调地址
-     */
-    @ApiModelProperty(notes = "CP回调地址")
-    private String cpPaybackUrl;
-
-    /**
-     * 游戏地址
-     */
-    @ApiModelProperty(notes = "游戏地址")
-    private String gameUrl;
-
     /**
      * 上线状态1 接入中, 2 可上线, 3 已下线
      */

+ 6 - 56
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IGameService.java

@@ -18,62 +18,6 @@ import java.util.Map;
  */
 public interface IGameService extends IService<Game> {
 
-    /**
-     * 获取游戏对接参数
-     *
-     * @param id : 游戏id
-     * @return {@link GameDockVO}
-     */
-    GameDockVO getGameDock(Long id);
-
-    /**
-     * 参数对接更新
-     *
-     * @param param : 对接参数
-     * @return {@link Boolean}
-     */
-    Boolean gameDockUpdate(GameDockParam param);
-
-    /**
-     * 获取游戏关联信息
-     *
-     * @param id : 游戏id
-     * @return {@link GameRelationVO}
-     */
-    GameRelationVO getGameRelation(Long id);
-
-    /**
-     * 导量游戏更新
-     *
-     * @param param : 关联游戏更新参数
-     * @return {@link Boolean}
-     */
-    Boolean guideGameUpdateUpdate(GuideGameUpdateParam param);
-
-    /**
-     * 关联游戏更新
-     *
-     * @param param : 关联游戏更新参数
-     * @return {@link Boolean}
-     */
-    Boolean relationGameUpdate(RelationGameUpdateParam param);
-
-    /**
-     * 获取游戏基本信息
-     *
-     * @param gameId : 游戏id
-     * @return {@link GameInfoVO}
-     */
-    GameInfoVO getGameInfo(Long gameId);
-
-    /**
-     * 游戏基本信息更新
-     *
-     * @param param : 游戏更新参数
-     * @return {@link Boolean}
-     */
-    Boolean updateGameInfo(GameUpdateParam param);
-
     /**
      * 游戏添加或更新
      *
@@ -97,6 +41,12 @@ public interface IGameService extends IService<Game> {
      */
     List<GameChoiceVO> choiceList();
 
+    /**
+     * 信息由ids
+     *
+     * @param gameIds 游戏id
+     * @return {@link List}<{@link GameInfoVO}>
+     */
     List<GameInfoVO> infoByIds(Collection<Long>  gameIds);
 
     /**

+ 0 - 8
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IGameTagService.java

@@ -19,14 +19,6 @@ import java.util.Map;
  */
 public interface IGameTagService extends IService<GameTag> {
 
-    /**
-     * 根据主键id查询分类以及子分类
-     *
-     * @param ids : 主键id列表
-     * @return {@link List}<{@link GameTagVO}>
-     */
-    List<GameTagVO> listByIds(List<Long> ids);
-
     /**
      * 游戏标签选择列表
      *

+ 0 - 2
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GamePictureServiceImpl.java

@@ -90,8 +90,6 @@ public class GamePictureServiceImpl extends ServiceImpl<GamePictureMapper, GameP
         //游戏信息更新
         if (param.getNeedAuth() != null || param.getDownloadCount() != null) {
             gameService.update(new LambdaUpdateWrapper<Game>()
-                    .set(Game::getNeedAuth, param.getNeedAuth())
-                    .set(Game::getDownloadCount, param.getDownloadCount())
                     .set(Game::getUpdateTime, LocalDateTime.now())
                     .eq(Game::getId, gameId));
         }

+ 53 - 272
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameServiceImpl.java

@@ -5,14 +5,21 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zanxiang.game.module.base.pojo.enums.GameCategoryEnum;
 import com.zanxiang.game.module.manage.enums.GameStatusEnum;
-import com.zanxiang.game.module.manage.pojo.dto.GameCategoryDTO;
 import com.zanxiang.game.module.manage.pojo.dto.GameDTO;
-import com.zanxiang.game.module.manage.pojo.dto.GameTagDTO;
-import com.zanxiang.game.module.manage.pojo.params.*;
-import com.zanxiang.game.module.manage.pojo.vo.*;
-import com.zanxiang.game.module.manage.service.*;
-import com.zanxiang.game.module.mybatis.entity.*;
+import com.zanxiang.game.module.manage.pojo.params.GameAddParam;
+import com.zanxiang.game.module.manage.pojo.params.GameListParam;
+import com.zanxiang.game.module.manage.pojo.vo.GameChoiceVO;
+import com.zanxiang.game.module.manage.pojo.vo.GameInfoVO;
+import com.zanxiang.game.module.manage.pojo.vo.GameListVO;
+import com.zanxiang.game.module.manage.service.ICpService;
+import com.zanxiang.game.module.manage.service.IGamePayWayService;
+import com.zanxiang.game.module.manage.service.IGameService;
+import com.zanxiang.game.module.manage.service.IGameTagService;
+import com.zanxiang.game.module.mybatis.entity.Cp;
+import com.zanxiang.game.module.mybatis.entity.Game;
+import com.zanxiang.game.module.mybatis.entity.GameTag;
 import com.zanxiang.game.module.mybatis.mapper.GameMapper;
 import com.zanxiang.module.util.bean.BeanUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -39,233 +46,12 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
     @Autowired
     private IGamePayWayService gamePayWayService;
 
-    @Autowired
-    private IGameCategoryService gameCategoryService;
-
     @Autowired
     private IGameTagService gameTagService;
 
     @Autowired
     private ICpService cpService;
 
-    @Autowired
-    private IGameAppletService gameAppletService;
-
-    @Override
-    public GameDockVO getGameDock(Long id) {
-        Game game = super.getById(id);
-        GameDockVO gameDockVO = BeanUtil.copy(game, GameDockVO.class);
-        if (gameDockVO == null) {
-            return null;
-        }
-        Cp cp = cpService.getById(gameDockVO.getCpId());
-        if (cp != null) {
-            gameDockVO.setCpName(cp.getCpName());
-        }
-        GameApplet gameApplet = gameAppletService.getOne(new LambdaQueryWrapper<GameApplet>().eq(GameApplet::getGameId, gameDockVO.getId()));
-        if (gameApplet != null) {
-            gameDockVO.setAppId(gameApplet.getAppId());
-            gameDockVO.setAppSecret(gameApplet.getAppSecret());
-        }
-        return gameDockVO;
-    }
-
-    @Override
-    public Boolean gameDockUpdate(GameDockParam param) {
-        if (Strings.isNotBlank(param.getAppKey())) {
-            super.update(new LambdaUpdateWrapper<Game>()
-                    .set(Game::getAppKey, param.getAppKey())
-                    .set(Game::getUpdateTime, LocalDateTime.now())
-                    .eq(Game::getId, param.getId()));
-        }
-        if (Strings.isBlank(param.getAppId()) && Strings.isBlank(param.getAppSecret())) {
-            return Boolean.TRUE;
-        }
-        GameApplet gameApplet = gameAppletService.getOne(new LambdaQueryWrapper<GameApplet>()
-                .eq(GameApplet::getGameId, param.getId()));
-        if (gameApplet == null) {
-            gameApplet = GameApplet.builder()
-                    .gameId(param.getId())
-                    .createTime(LocalDateTime.now())
-                    .build();
-        }
-        gameApplet.setUpdateTime(LocalDateTime.now());
-        if (Strings.isNotBlank(param.getAppId())) {
-            gameApplet.setAppId(param.getAppId());
-        }
-        if (Strings.isNotBlank(param.getAppSecret())) {
-            gameApplet.setAppSecret(param.getAppSecret());
-        }
-        return gameAppletService.saveOrUpdate(gameApplet);
-    }
-
-    @Override
-    public GameRelationVO getGameRelation(Long id) {
-        Game game = super.getById(id);
-        GameRelationVO gameRelationVO = BeanUtil.copy(game, GameRelationVO.class);
-        if (gameRelationVO == null) {
-            return null;
-        }
-        Map<Long, Game> gameMap = this.getGameRelationMap(Collections.singletonList(game));
-        //没有关联游戏
-        if (gameMap.isEmpty()) {
-            return gameRelationVO;
-        }
-        //设置关联游戏名字
-        if (Objects.equals(gameRelationVO.getParentId(), 0L)) {
-            gameRelationVO.setParentId(game.getId());
-            gameRelationVO.setParentName(game.getName());
-            gameRelationVO.setParentCategoryId(game.getCategory());
-        } else {
-            //非主游戏
-            if (gameRelationVO.getParentId() != null && gameMap.containsKey(gameRelationVO.getParentId())) {
-                gameRelationVO.setParentName(gameMap.get(gameRelationVO.getParentId()).getName());
-                gameRelationVO.setParentCategoryId(gameMap.get(gameRelationVO.getParentId()).getCategory());
-            }
-        }
-        if (gameRelationVO.getGuideGameId() != null && gameMap.containsKey(gameRelationVO.getGuideGameId())) {
-            gameRelationVO.setGuideGameName(gameMap.get(gameRelationVO.getGuideGameId()).getName());
-            gameRelationVO.setGuideCategoryId(gameMap.get(gameRelationVO.getGuideGameId()).getCategory());
-        }
-        if (gameRelationVO.getH5GameId() != null && gameMap.containsKey(gameRelationVO.getH5GameId())) {
-            gameRelationVO.setH5GameName(gameMap.get(gameRelationVO.getH5GameId()).getName());
-        }
-        //设置关联游戏应用类型名字
-        Set<Long> categoryIdSet = new HashSet<>();
-        if (gameRelationVO.getParentCategoryId() != null) {
-            categoryIdSet.add(gameRelationVO.getParentCategoryId());
-        }
-        if (gameRelationVO.getGuideCategoryId() != null) {
-            categoryIdSet.add(gameRelationVO.getGuideCategoryId());
-        }
-        Map<Long, GameCategory> categoryMap = gameCategoryService.listByIds(categoryIdSet).stream()
-                .collect(Collectors.toMap(GameCategory::getId, Function.identity()));
-        if (gameRelationVO.getParentCategoryId() != null && categoryMap.containsKey(gameRelationVO.getParentCategoryId())) {
-            gameRelationVO.setParentCategoryName(categoryMap.get(gameRelationVO.getParentCategoryId()).getName());
-        }
-        if (gameRelationVO.getGuideCategoryId() != null && categoryMap.containsKey(gameRelationVO.getGuideCategoryId())) {
-            gameRelationVO.setGuideCategoryName(categoryMap.get(gameRelationVO.getGuideCategoryId()).getName());
-        }
-        return gameRelationVO;
-    }
-
-    private Map<Long, Game> getGameRelationMap(List<Game> gameList) {
-        Set<Long> gameIdSet = new HashSet<>();
-        gameList.forEach(game -> {
-            if (game.getParentId() != null && !Objects.equals(game.getParentId(), 0L)) {
-                gameIdSet.add(game.getParentId());
-            }
-            if (game.getH5GameId() != null) {
-                gameIdSet.add(game.getH5GameId());
-            }
-            if (game.getGuideGameId() != null) {
-                gameIdSet.add(game.getGuideGameId());
-            }
-        });
-        if (gameIdSet.isEmpty()) {
-            return Collections.emptyMap();
-        }
-        return super.listByIds(gameIdSet).stream().collect(Collectors.toMap(Game::getId, Function.identity()));
-    }
-
-    @Override
-    public Boolean guideGameUpdateUpdate(GuideGameUpdateParam param) {
-        return super.update(new LambdaUpdateWrapper<Game>()
-                .set(param.getGuideGameId() != null, Game::getGuideGameId, param.getGuideGameId())
-                .set(Game::getUpdateTime, LocalDateTime.now())
-                .eq(Game::getId, param.getId()));
-    }
-
-    @Override
-    public Boolean relationGameUpdate(RelationGameUpdateParam param) {
-        if (param.getParentId() == null && param.getH5GameId() == null) {
-            return Boolean.FALSE;
-        }
-        return super.update(new LambdaUpdateWrapper<Game>()
-                .set(param.getParentId() != null, Game::getParentId, param.getParentId())
-                .set(param.getH5GameId() != null, Game::getH5GameId, param.getH5GameId())
-                .set(Game::getUpdateTime, LocalDateTime.now())
-                .eq(Game::getId, param.getId()));
-    }
-
-    @Override
-    public List<GameInfoVO> infoByIds(Collection<Long> gameIds) {
-        return listByIds(gameIds).stream().map(game -> BeanUtil.copy(game, GameInfoVO.class)).collect(Collectors.toList());
-    }
-
-    @Override
-    public GameInfoVO getGameInfo(Long gameId) {
-        Game game = super.getById(gameId);
-        GameInfoVO gameInfoVO = BeanUtil.copy(game, GameInfoVO.class);
-        if (gameInfoVO == null) {
-            return null;
-        }
-        if (gameInfoVO.getCpId() != null) {
-            Cp cp = cpService.getById(gameInfoVO.getCpId());
-            if (cp != null) {
-                gameInfoVO.setCpName(cp.getCpName());
-            }
-        }
-        if (Strings.isNotBlank(game.getTags())) {
-            String[] split = game.getTags().split(",");
-            List<Long> idList = Arrays.stream(split).map(Long::valueOf).collect(Collectors.toList());
-            List<GameTagChoiceVO> gameTagChoiceVOList = gameTagService.listByIds(idList).stream()
-                    .map(gameTagVO -> BeanUtil.copy(gameTagVO, GameTagChoiceVO.class))
-                    .collect(Collectors.toList());
-            gameInfoVO.setClassifyList(gameTagChoiceVOList);
-        }
-        if (game.getCategory() != null) {
-            GameCategoryDTO gameCategoryDTO = gameCategoryService.getById(game.getCategory());
-            gameInfoVO.setCategory(gameCategoryDTO);
-        }
-        //是否主游戏
-        gameInfoVO.setIsParentGame(Objects.equals(gameInfoVO.getParentId(), 0L));
-        //关联游戏查询
-        Map<Long, Game> gameMap = this.getGameRelationMap(Collections.singletonList(game));
-        //没有关联游戏
-        if (gameMap.isEmpty()) {
-            return gameInfoVO;
-        }
-        //设置关联游戏名字
-        if (gameInfoVO.getParentId() != null && !Objects.equals(gameInfoVO.getParentId(), 0L)) {
-            gameInfoVO.setParentName(gameMap.get(gameInfoVO.getParentId()).getName());
-        } else {
-            gameInfoVO.setParentId(game.getId());
-            gameInfoVO.setParentName(game.getName());
-        }
-        if (gameInfoVO.getH5GameId() != null) {
-            gameInfoVO.setH5GameName(gameMap.get(gameInfoVO.getH5GameId()).getName());
-        }
-        if (gameInfoVO.getGuideGameId() != null) {
-            gameInfoVO.setGuideGameName(gameMap.get(gameInfoVO.getGuideGameId()).getName());
-        }
-        return gameInfoVO;
-    }
-
-    @Override
-    public Boolean updateGameInfo(GameUpdateParam param) {
-        //游戏分类处理
-        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(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)
-                .set(!Objects.equals(param.getIsParentGame(), Boolean.TRUE) && param.getParentId() != null,
-                        Game::getParentId, param.getParentId())
-                .set(param.getH5GameId() != null, Game::getH5GameId, param.getH5GameId())
-                .set(param.getGuideGameId() != null, Game::getGuideGameId, param.getGuideGameId())
-                .set(Strings.isNotBlank(param.getPublicity()), Game::getPublicity, param.getPublicity())
-                .set(Strings.isNotBlank(param.getDescription()), Game::getDescription, param.getDescription())
-                .set(Strings.isNotBlank(param.getVersion()), Game::getVersion, param.getVersion())
-                .set(Strings.isNotBlank(param.getGameUrl()), Game::getGameUrl, param.getGameUrl())
-                .set(Strings.isNotBlank(param.getCpPaybackUrl()), Game::getCpPaybackUrl, param.getCpPaybackUrl())
-                .set(Game::getUpdateTime, LocalDateTime.now())
-                .eq(Game::getId, param.getId()));
-    }
-
     @Override
     public Boolean gameAddOrUpdate(GameAddParam param) {
         //游戏分类处理
@@ -277,12 +63,13 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
             game = Game.builder()
                     .cpId(param.getCpId())
                     .name(param.getName())
-                    .shareScale(param.getShareScale())
                     .category(param.getCategory())
                     .tags(gameTags)
-                    .cpPaybackUrl(param.getCpPaybackUrl())
-                    .gameUrl(param.getGameUrl())
                     .status(GameStatusEnum.UN_JOIN_UP.getStatus())
+                    .description(param.getDescription())
+                    .shareScale(param.getShareScale())
+                    .h5GameId(param.getH5GameId())
+                    .guideGameId(param.getGuideGameId())
                     .createTime(LocalDateTime.now())
                     .updateTime(LocalDateTime.now())
                     .build();
@@ -290,13 +77,13 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
             game = super.getById(id);
             game.setCpId(param.getCpId());
             game.setName(param.getName());
-            game.setShareScale(param.getShareScale());
             game.setTags(gameTags);
+            game.setShareScale(param.getShareScale());
+            game.setH5GameId(param.getH5GameId());
+            game.setGuideGameId(param.getGuideGameId());
+            game.setDescription(param.getDescription());
             game.setUpdateTime(LocalDateTime.now());
-            game.setCpPaybackUrl(param.getCpPaybackUrl());
-            game.setGameUrl(param.getGameUrl());
         }
-        //设置父游戏id
         if (!Objects.equals(param.getIsParentGame(), Boolean.TRUE) && param.getParentGameId() != null) {
             game.setParentId(param.getParentGameId());
         }
@@ -307,12 +94,12 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
         if (CollectionUtils.isEmpty(tagIdList)) {
             return null;
         }
-        List<GameTagVO> gameTagVOList = gameTagService.listByIds(tagIdList);
+        List<GameTag> gameTagList = 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());
+        gameTagList.forEach(gameTag -> {
+            tagIdSet.add(gameTag.getId());
+            if (Objects.equals(gameTag.getIsParent(), Boolean.TRUE) && gameTag.getParentId() != null) {
+                tagIdSet.add(gameTag.getParentId());
             }
         });
         if (tagIdSet.isEmpty()) {
@@ -323,16 +110,6 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
 
     @Override
     public IPage<GameListVO> gameList(GameListParam param) {
-        //cp列表
-        Map<Long, String> cpMap = cpService.choiceList().stream()
-                .collect(Collectors.toMap(CpChoiceVO::getId, CpChoiceVO::getCpName));
-        //游戏应用类型列表
-        Map<Long, GameCategoryDTO> gameCategoryMap = gameCategoryService.gameCategoryMap();
-        //游戏分类标签列表
-        Map<Long, GameTagDTO> gameTagMap = gameTagService.gameTagMap();
-        //查询游戏
-        Map<Long, String> gameMap = this.choiceList().stream()
-                .collect(Collectors.toMap(GameChoiceVO::getId, GameChoiceVO::getName));
         //分类标签
         List<Long> tagIds = new ArrayList<>();
         if (param.getGameClassifyId() != null) {
@@ -366,54 +143,53 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
                         }
                 )
                 .orderByDesc(Game::getCreateTime)
-        ).convert(game -> this.toVo(game, cpMap, gameCategoryMap, gameMap, gameTagMap));
+        ).convert(this::toVo);
     }
 
-    private GameListVO toVo(Game game, Map<Long, String> cpMap, Map<Long, GameCategoryDTO> gameCategoryMap,
-                            Map<Long, String> gameMap, Map<Long, GameTagDTO> gameTagMap) {
+    private GameListVO toVo(Game game) {
         GameListVO gameListVO = BeanUtil.copy(game, GameListVO.class);
         if (gameListVO == null) {
             return null;
         }
-        gameListVO.setClassify(game.getTags());
         //cp设置
         if (gameListVO.getCpId() != null) {
-            gameListVO.setCpName(cpMap.get(gameListVO.getCpId()));
+            Cp cp = cpService.getById(gameListVO.getCpId());
+            gameListVO.setCpName(cp == null ? null : cp.getCpName());
         }
         //游戏类型
         if (gameListVO.getCategory() != null) {
-            gameListVO.setCategoryName(gameCategoryMap.get(gameListVO.getCategory()) == null ? null : gameCategoryMap.get(gameListVO.getCategory()).getName());
+            gameListVO.setCategoryName(GameCategoryEnum.getNameByCategory(gameListVO.getCategory()));
         }
         //游戏分类
-        if (gameListVO.getClassify() != null) {
-            String[] classifyIds = gameListVO.getClassify().split(",");
-            List<String> tagNameList = new ArrayList<>();
-            for (String tagId : classifyIds) {
-                tagNameList.add(gameTagMap.get(Long.valueOf(tagId)) == null ? null : gameTagMap.get(Long.valueOf(tagId)).getName());
-            }
-            gameListVO.setClassifyNameList(tagNameList);
-            gameListVO.setTagNameList(tagNameList);
+        if (Strings.isNotBlank(gameListVO.getTags())) {
+            List<Long> tagIdList = Arrays.stream(gameListVO.getTags().split(","))
+                    .map(Long::parseLong).collect(Collectors.toList());
+            gameListVO.setTagNameList(gameTagService.listByIds(tagIdList).stream()
+                    .map(GameTag::getName).collect(Collectors.toList()));
         }
         //主游戏设置
-        if (Objects.equals(game.getParentId(), 0L)) {
-            gameListVO.setIsParentGame(Boolean.TRUE);
-            gameListVO.setParentId(game.getId());
-            gameListVO.setParentName(game.getName());
+        if (gameListVO.getParentId() != null) {
+            Game parentGame = super.getById(gameListVO.getParentId());
+            if (parentGame != null) {
+                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()));
+            Game h5Game = super.getById(gameListVO.getParentId());
+            gameListVO.setH5GameName(h5Game == null ? null : h5Game.getName());
         }
         //关联游戏
         if (gameListVO.getGuideGameId() != null) {
-            gameListVO.setGuideGameName(gameMap.get(gameListVO.getGuideGameId()));
+            Game guideGame = super.getById(gameListVO.getParentId());
+            gameListVO.setGuideGameName(guideGame == null ? null : guideGame.getName());
         }
         //查询支付方式列表
-        List<GamePayWayVO> gamePayWayVOList = gamePayWayService.getByGameId(game.getId());
-        gameListVO.setGamePayWayList(gamePayWayVOList);
+        gameListVO.setGamePayWayList(gamePayWayService.getByGameId(game.getId()));
         return gameListVO;
     }
 
@@ -496,4 +272,9 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
                 .eq(Game::getId, id));
     }
 
+    @Override
+    public List<GameInfoVO> infoByIds(Collection<Long> gameIds) {
+        return listByIds(gameIds).stream().map(game -> BeanUtil.copy(game, GameInfoVO.class)).collect(Collectors.toList());
+    }
+
 }

+ 0 - 8
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameTagServiceImpl.java

@@ -36,14 +36,6 @@ import java.util.stream.Collectors;
 @Service
 public class GameTagServiceImpl extends ServiceImpl<GameTagMapper, GameTag> implements IGameTagService {
 
-    @Override
-    public List<GameTagVO> listByIds(List<Long> ids) {
-        if (CollectionUtils.isEmpty(ids)) {
-            return Collections.emptyList();
-        }
-        return super.listByIds(ids).stream().map(gameTag -> BeanUtil.copy(gameTag, GameTagVO.class)).collect(Collectors.toList());
-    }
-
     @Override
     public List<GameTagChoiceVO> gameTagsChoiceList() {
         return super.list().stream().map(gameTag -> BeanUtil.copy(gameTag, GameTagChoiceVO.class)).collect(Collectors.toList());

+ 0 - 6
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/Cp.java

@@ -57,12 +57,6 @@ public class Cp {
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String remark;
 
-    /**
-     * 渠道
-     */
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
-    private Long channel;
-
     /**
      * 1 删除  0 正常
      */

+ 14 - 98
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/Game.java

@@ -1,9 +1,6 @@
 package com.zanxiang.game.module.mybatis.entity;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.*;
 import lombok.*;
 
 import java.time.LocalDateTime;
@@ -37,136 +34,55 @@ public class Game {
      */
     private String name;
 
-    /**
-     * appkey
-     */
-    private String appKey;
-
-    /**
-     * 游戏标签
-     */
-    private String tags;
-
     /**
      * 游戏类型
      */
     private Long category;
 
     /**
-     * 网页游戏图标,200*200
-     */
-    private String icon;
-
-    /**
-     * CP回调路径
-     */
-    private String cpPaybackUrl;
-
-    /**
-     * 从属游戏
-     */
-    private Long parentId;
-
-    /**
-     * 包名
+     * 游戏标签
      */
-    private String packageName;
+    private String tags;
 
     /**
      * 上线状态 1 : 未接入, 2 : 接入中, 3 : 上线, 4 : 下线
      */
     private Integer status;
 
-    /**
-     * 1在线游戏 2 单机
-     */
-    private Boolean isOnline;
-
-    /**
-     * 1 不是SDK游戏  2 是SDK游戏
-     */
-    private Boolean isSdk;
-
-    /**
-     * 游戏宣传语
-     */
-    private String publicity;
-
-    /**
-     * 语言
-     */
-    private String language;
-
     /**
      * 游戏描述
      */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String description;
 
     /**
-     * 游戏宣传图 JSON格式
-     */
-    private String image;
-
-    /**
-     * 苹果应用ID
-     */
-    private String appleId;
-
-    /**
-     * 是否需要实名认证,1:关闭实名认证,2:强制实名认证  3:开启实名认证
-     */
-    private Integer needAuth;
-
-    /**
-     * 扩展 JSON格式
-     */
-    private String extInfo;
-
-    /**
-     * 上线时间
-     */
-    private LocalDateTime onlineTime;
-
-    /**
-     * 1 删除  0 正常
-     */
-    @TableLogic
-    private Integer isDelete;
-
-    /**
-     * 删除时间
+     * 分成比例
      */
-    private LocalDateTime deleteTime;
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private Double shareScale;
 
     /**
-     * 分成比例
+     * 父游戏id
      */
-    private Double shareScale;
+    private Long parentId;
 
     /**
      * 关联H5游戏id
      */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private Long h5GameId;
 
     /**
      * 导量游戏id
      */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private Long guideGameId;
 
     /**
-     * 游戏地址
-     */
-    private String gameUrl;
-
-    /**
-     * 游戏版本
-     */
-    private String version;
-
-    /**
-     * 下载次数
+     * 1 删除  0 正常
      */
-    private Long downloadCount;
+    @TableLogic
+    private Integer isDelete;
 
     /**
      * 创建时间