Kaynağa Gözat

fix : 有效创角

bilingfeng 1 yıl önce
ebeveyn
işleme
2269efc9d2

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/ManageApplication.java

@@ -21,7 +21,7 @@ public class ManageApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(ManageApplication.class, args);
-        System.out.println("赞象Manage服务启动成功 <dubbo升级3.0, 游戏提现记录> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 <dubbo升级3.0, 有效创角> ( ´・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 54 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/controller/GameUserConfigController.java

@@ -0,0 +1,54 @@
+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.GameUserConfigAddUpdateParam;
+import com.zanxiang.game.module.manage.pojo.params.GameUserConfigListParam;
+import com.zanxiang.game.module.manage.pojo.vo.GameUserConfigListVO;
+import com.zanxiang.game.module.manage.service.IGameUserConfigService;
+import com.zanxiang.module.util.pojo.ResultVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-09
+ * @description : 有效用户配置
+ */
+@Api(tags = {"有效创角配置接口"})
+@RestController
+@RequestMapping("/gameUser/config")
+public class GameUserConfigController {
+
+    @Autowired
+    private IGameUserConfigService gameUserConfigService;
+
+    @ApiOperation(value = "新增或修改有效创角配置")
+    @PostMapping(value = "/add/or/update")
+    @PreAuthorize(permissionKey = "manage:gameUserConfig:addOrUpdate")
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
+    public ResultVO<Boolean> addOrUpdate(@Validated @RequestBody GameUserConfigAddUpdateParam param) {
+        return ResultVO.ok(gameUserConfigService.addOrUpdate(param));
+    }
+
+    @ApiOperation(value = "有效创角配置列表查询")
+    @PostMapping(value = "/list")
+    @PreAuthorize(permissionKey = "manage:gameUserConfig:list")
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameUserConfigListVO.class)})
+    public ResultVO<IPage<GameUserConfigListVO>> listOfPage(@Validated @RequestBody GameUserConfigListParam param) {
+        return ResultVO.ok(gameUserConfigService.listOfPage(param));
+    }
+
+    @ApiOperation(value = "有效创角配置服删除")
+    @DeleteMapping(value = "/delete")
+    @PreAuthorize(permissionKey = "manage:gameUserConfig:delete")
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
+    public ResultVO<Boolean> deleteById(@RequestParam Long id) {
+        return ResultVO.ok(gameUserConfigService.deleteById(id));
+    }
+}

+ 35 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameUserConfigAddUpdateParam.java

@@ -0,0 +1,35 @@
+package com.zanxiang.game.module.manage.pojo.params;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-09
+ * @description : 有效用户配置
+ */
+@Data
+public class GameUserConfigAddUpdateParam {
+
+    /**
+     * 主键id
+     */
+    @ApiModelProperty(notes = "主键id, 传则是更新, 不传则是添加")
+    private Long id;
+
+    /**
+     * 游戏id
+     */
+    @NotNull(message = "游戏id不可为空, 必传")
+    @ApiModelProperty(notes = "游戏id")
+    private Long gameId;
+
+    /**
+     * 游戏角色等级
+     */
+    @NotNull(message = "游戏角色等级不可为空, 必传")
+    @ApiModelProperty(notes = "游戏角色等级")
+    private Long roleLevel;
+}

+ 21 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameUserConfigListParam.java

@@ -0,0 +1,21 @@
+package com.zanxiang.game.module.manage.pojo.params;
+
+import com.zanxiang.game.module.mybatis.entity.GameUserConfig;
+import com.zanxiang.module.web.pojo.BaseListDTO;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-09
+ * @description : 有效用户配置查询
+ */
+@Data
+public class GameUserConfigListParam extends BaseListDTO<GameUserConfig> {
+
+    /**
+     * 游戏id
+     */
+    @ApiModelProperty(notes = "游戏id")
+    private Long gameId;
+}

+ 51 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameUserConfigListVO.java

@@ -0,0 +1,51 @@
+package com.zanxiang.game.module.manage.pojo.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-09
+ * @description : 有效用户配置
+ */
+@Data
+public class GameUserConfigListVO {
+
+    /**
+     * 主键id
+     */
+    @ApiModelProperty(notes = "主键id")
+    private Long id;
+
+    /**
+     * 游戏id
+     */
+    @ApiModelProperty(notes = "游戏id")
+    private Long gameId;
+
+    /**
+     * 游戏名称
+     */
+    @ApiModelProperty(notes = "游戏名称")
+    private String gameName;
+
+    /**
+     * 游戏角色等级
+     */
+    @ApiModelProperty(notes = "游戏角色等级")
+    private Long roleLevel;
+
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(notes = "创建时间")
+    private LocalDateTime createTime;
+
+    /**
+     * 更新时间
+     */
+    @ApiModelProperty(notes = "更新时间")
+    private LocalDateTime updateTime;
+}

+ 40 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IGameUserConfigService.java

@@ -0,0 +1,40 @@
+package com.zanxiang.game.module.manage.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zanxiang.game.module.manage.pojo.params.GameUserConfigAddUpdateParam;
+import com.zanxiang.game.module.manage.pojo.params.GameUserConfigListParam;
+import com.zanxiang.game.module.manage.pojo.vo.GameUserConfigListVO;
+import com.zanxiang.game.module.mybatis.entity.GameUserConfig;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-09
+ * @description : 有效用户配置
+ */
+public interface IGameUserConfigService extends IService<GameUserConfig> {
+
+    /**
+     * 添加或更新
+     *
+     * @param param 参数
+     * @return boolean
+     */
+    boolean addOrUpdate(GameUserConfigAddUpdateParam param);
+
+    /**
+     * 列表页面
+     *
+     * @param param 参数
+     * @return {@link IPage}<{@link GameUserConfigListVO}>
+     */
+    IPage<GameUserConfigListVO> listOfPage(GameUserConfigListParam param);
+
+    /**
+     * 删除通过id
+     *
+     * @param id id
+     * @return boolean
+     */
+    boolean deleteById(Long id);
+}

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameRemitLogServiceImpl.java

@@ -52,7 +52,7 @@ public class GameRemitLogServiceImpl extends ServiceImpl<GameRemitLogMapper, Gam
     public IPage<GameRemitLogVO> listOfPage(GameRemitLogListParam param) {
         //渠道获取
         Tuple2<List<Long>, List<AgentDTO>> tuple2 = agentService.getUserAgent(null, null, null);
-        if (CollectionUtils.isNotEmpty(tuple2.getT1())) {
+        if (CollectionUtils.isEmpty(tuple2.getT1())) {
             return new Page<>();
         }
         //查询渠道的用户

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameServerServiceImpl.java

@@ -42,7 +42,7 @@ public class GameServerServiceImpl extends ServiceImpl<GameServerMapper, GameSer
 
     @Override
     public List<String> listServerId(Long gameId, String serverName) {
-        if (gameId == null && Strings.isBlank(serverName)) {
+        if (Strings.isBlank(serverName)) {
             return Collections.emptyList();
         }
         return super.list(new LambdaQueryWrapper<GameServer>()

+ 87 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameUserConfigServiceImpl.java

@@ -0,0 +1,87 @@
+package com.zanxiang.game.module.manage.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zanxiang.erp.security.util.SecurityUtil;
+import com.zanxiang.game.module.manage.pojo.dto.GameDTO;
+import com.zanxiang.game.module.manage.pojo.params.GameUserConfigAddUpdateParam;
+import com.zanxiang.game.module.manage.pojo.params.GameUserConfigListParam;
+import com.zanxiang.game.module.manage.pojo.vo.GameUserConfigListVO;
+import com.zanxiang.game.module.manage.service.IGameService;
+import com.zanxiang.game.module.manage.service.IGameUserConfigService;
+import com.zanxiang.game.module.mybatis.entity.GameUserConfig;
+import com.zanxiang.game.module.mybatis.mapper.GameUserConfigMapper;
+import com.zanxiang.module.util.bean.BeanUtil;
+import com.zanxiang.module.util.exception.BaseException;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.util.Objects;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-08-09
+ * @description : 有效用户配置
+ */
+@Slf4j
+@Service
+public class GameUserConfigServiceImpl extends ServiceImpl<GameUserConfigMapper, GameUserConfig> implements IGameUserConfigService {
+
+    @Autowired
+    private IGameService gameService;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean addOrUpdate(GameUserConfigAddUpdateParam param) {
+        //判断游戏配置不可重复
+        if (super.count(new LambdaQueryWrapper<GameUserConfig>()
+                .eq(GameUserConfig::getGameId, param.getGameId())
+                .ne(param.getId() != null, GameUserConfig::getId, param.getId())
+        ) > 0) {
+            throw new BaseException("该游戏已经存在配置, 禁止添加或者修改");
+        }
+        //添加或者更新
+        return super.saveOrUpdate(this.transform(param));
+    }
+
+    private GameUserConfig transform(GameUserConfigAddUpdateParam param) {
+        return GameUserConfig.builder()
+                .id(param.getId())
+                .gameId(param.getGameId())
+                .roleLevel(param.getRoleLevel())
+                .createBy(param.getId() == null ? SecurityUtil.getUserId() : null)
+                .createTime(param.getId() == null ? LocalDateTime.now() : null)
+                .updateBy(SecurityUtil.getUserId())
+                .updateTime(LocalDateTime.now())
+                .build();
+    }
+
+    @Override
+    public IPage<GameUserConfigListVO> listOfPage(GameUserConfigListParam param) {
+        return page(param.toPage(), new QueryWrapper<GameUserConfig>().lambda()
+                .eq(GameUserConfig::getGameId, param.getGameId())
+                .orderByDesc(GameUserConfig::getCreateTime)
+        ).convert(this::toVo);
+    }
+
+    private GameUserConfigListVO toVo(GameUserConfig gameUserConfig) {
+        if (Objects.isNull(gameUserConfig)) {
+            return null;
+        }
+        GameUserConfigListVO gameUserConfigListVO = BeanUtil.copy(gameUserConfig, GameUserConfigListVO.class);
+        GameDTO gameDTO = gameService.getById(gameUserConfigListVO.getGameId());
+        gameUserConfigListVO.setGameName(gameDTO == null ? null : gameDTO.getName());
+        return gameUserConfigListVO;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean deleteById(Long id) {
+        return super.removeById(id);
+    }
+}

+ 17 - 0
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameUserConfig.java

@@ -2,6 +2,7 @@ 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 lombok.*;
 
@@ -39,11 +40,27 @@ public class GameUserConfig implements Serializable {
      */
     private Long roleLevel;
 
+    /**
+     * 1 删除  0 正常
+     */
+    @TableLogic
+    private Integer isDelete;
+
     /**
      * 创建时间
      */
     private LocalDateTime createTime;
 
+    /**
+     * 创建者
+     */
+    private Long createBy;
+
+    /**
+     * 更新者
+     */
+    private Long updateBy;
+
     /**
      * 更新时间
      */