Sfoglia il codice sorgente

fix : 用户列表昵称改成角色名称

bilingfeng 1 anno fa
parent
commit
74e59f85e7

+ 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, 依赖修改1> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 <dubbo升级3.0, 用户列表昵称改成角色名称> ( ´・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 6 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameUserListVO.java

@@ -170,4 +170,10 @@ public class GameUserListVO {
     @ApiModelProperty(notes = "最近充值时间")
     private LocalDateTime lastRechargeTime;
 
+    /**
+     * 最新游戏角色名称
+     */
+    @ApiModelProperty(notes = "最新游戏角色名称")
+    private String lastGameRoleName;
+
 }

+ 6 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/UserListVO.java

@@ -182,4 +182,10 @@ public class UserListVO {
     @ApiModelProperty(notes = "玩家状态, -1 为冻结状态, 1 为试玩状态 2为正常状态")
     private Integer status;
 
+    /**
+     * 最新游戏角色名称
+     */
+    @ApiModelProperty(notes = "最新游戏角色名称")
+    private String lastGameRoleName;
+
 }

+ 11 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/UserWechatVO.java

@@ -0,0 +1,11 @@
+package com.zanxiang.game.module.manage.pojo.vo;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-07-26
+ * @description : 用户微信信息
+ */
+public class UserWechatVO {
+
+
+}

+ 10 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IGameUserRoleService.java

@@ -5,6 +5,7 @@ import com.zanxiang.game.module.manage.pojo.dto.GameUserRoleDTO;
 import com.zanxiang.game.module.manage.pojo.params.GameUserRoleListParam;
 import com.zanxiang.game.module.manage.pojo.vo.GameUserRoleListVO;
 import com.zanxiang.game.module.manage.pojo.vo.GameUserRoleVO;
+import com.zanxiang.game.module.mybatis.entity.GameUserRole;
 
 import java.util.List;
 
@@ -15,6 +16,15 @@ import java.util.List;
  */
 public interface IGameUserRoleService {
 
+    /**
+     * 获取用户最近的游戏角色
+     *
+     * @param userId 用户id
+     * @param gameId 游戏id
+     * @return {@link GameUserRole}
+     */
+    GameUserRole getLastGameUserRoleName(Long userId, Long gameId);
+
     /**
      * 根据角色id查询
      *

+ 9 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameUserRoleServiceImpl.java

@@ -53,6 +53,15 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
     @Autowired
     private IAgentService agentService;
 
+    @Override
+    public GameUserRole getLastGameUserRoleName(Long userId, Long gameId) {
+        return super.getOne(new LambdaQueryWrapper<GameUserRole>()
+                .eq(GameUserRole::getUserId, userId)
+                .eq(GameUserRole::getGameId, gameId)
+                .orderByDesc(GameUserRole::getUpdateTime)
+                .last("limit 1"));
+    }
+
     @Override
     public GameUserRoleDTO getByRoleId(String roleId) {
         GameUserRole gameUserRole = super.getOne(new LambdaQueryWrapper<GameUserRole>().eq(GameUserRole::getRoleId, roleId));

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

@@ -16,6 +16,7 @@ import com.zanxiang.game.module.manage.pojo.vo.GameUserVO;
 import com.zanxiang.game.module.manage.service.*;
 import com.zanxiang.game.module.mybatis.entity.Agent;
 import com.zanxiang.game.module.mybatis.entity.GameUser;
+import com.zanxiang.game.module.mybatis.entity.GameUserRole;
 import com.zanxiang.game.module.mybatis.mapper.GameUserMapper;
 import com.zanxiang.module.util.bean.BeanUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -53,6 +54,9 @@ public class GameUserServiceImpl extends ServiceImpl<GameUserMapper, GameUser> i
     @Autowired
     private IAgentService agentService;
 
+    @Autowired
+    private IGameUserRoleService gameUserRoleService;
+
     @Override
     public IPage<GameUserListVO> gameUserList(GameUserListParam param) {
         //游戏条件处理
@@ -131,6 +135,10 @@ public class GameUserServiceImpl extends ServiceImpl<GameUserMapper, GameUser> i
             gameUserListVO.setCpName(cpMap.get(gameDTO.getCpId()) == null ? null : cpMap.get(gameDTO.getCpId()).getCpName());
             gameUserListVO.setGameCategoryName(GameCategoryEnum.getNameByCategory(gameDTO.getCategory()));
         }
+        //最近角色
+        GameUserRole gameUserRole = gameUserRoleService.getLastGameUserRoleName(gameUser.getUserId(), gameUser.getGameId());
+        gameUserListVO.setLastGameRoleName(gameUserRole == null ? null : gameUserRole.getRoleName());
+        //返回
         return gameUserListVO;
     }
 

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

@@ -19,6 +19,7 @@ import com.zanxiang.game.module.manage.pojo.vo.UserListVO;
 import com.zanxiang.game.module.manage.pojo.vo.UserVO;
 import com.zanxiang.game.module.manage.service.*;
 import com.zanxiang.game.module.mybatis.entity.Agent;
+import com.zanxiang.game.module.mybatis.entity.GameUserRole;
 import com.zanxiang.game.module.mybatis.entity.User;
 import com.zanxiang.game.module.mybatis.mapper.UserMapper;
 import com.zanxiang.module.util.bean.BeanUtil;
@@ -61,6 +62,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     @Autowired
     private IAgentService agentService;
 
+    @Autowired
+    private IGameUserRoleService gameUserRoleService;
+
     @Override
     public IPage<UserListVO> list(UserListParam param) {
         //游戏条件处理
@@ -131,6 +135,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             userListVO.setCpId(gameDTO.getCpId());
             userListVO.setCpName(cpMap.get(gameDTO.getCpId()) == null ? null : cpMap.get(gameDTO.getCpId()).getCpName());
         }
+        //最近角色
+        GameUserRole gameUserRole = gameUserRoleService.getLastGameUserRoleName(user.getId(), user.getGameId());
+        userListVO.setLastGameRoleName(gameUserRole == null ? null : gameUserRole.getRoleName());
+        //返回
         return userListVO;
     }