|
@@ -1,5 +1,6 @@
|
|
|
package com.zanxiang.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.core.toolkit.CollectionUtils;
|
|
@@ -7,15 +8,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.zanxiang.common.utils.StringUtils;
|
|
|
import com.zanxiang.common.utils.bean.BeanUtils;
|
|
|
-import com.zanxiang.manage.domain.dto.GameDTO;
|
|
|
-import com.zanxiang.manage.domain.dto.UserDTO;
|
|
|
-import com.zanxiang.manage.domain.dto.UserExtDTO;
|
|
|
+import com.zanxiang.manage.domain.dto.*;
|
|
|
import com.zanxiang.manage.domain.params.GameUserRoleListParam;
|
|
|
+import com.zanxiang.manage.domain.vo.GameCategoryVO;
|
|
|
import com.zanxiang.manage.domain.vo.GameUserRoleListVO;
|
|
|
-import com.zanxiang.manage.service.GameService;
|
|
|
-import com.zanxiang.manage.service.GameUserRoleService;
|
|
|
-import com.zanxiang.manage.service.UserExtService;
|
|
|
-import com.zanxiang.manage.service.UserService;
|
|
|
+import com.zanxiang.manage.domain.vo.GameUserRoleVO;
|
|
|
+import com.zanxiang.manage.domain.vo.GameUserVO;
|
|
|
+import com.zanxiang.manage.service.*;
|
|
|
import com.zanxiang.mybatis.entity.GameUserRole;
|
|
|
import com.zanxiang.mybatis.mapper.GameUserRoleMapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -25,10 +24,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @author : lingfeng
|
|
@@ -48,6 +44,66 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
|
|
|
@Autowired
|
|
|
private GameService gameService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private GameUserService gameUserService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private GameCategoryService gameCategoryService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ChannelService channelService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据角色id查询
|
|
|
+ *
|
|
|
+ * @param roleId : 角色id
|
|
|
+ * @return : 玩家角色信息
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public GameUserRoleDTO getByRoleId(String roleId) {
|
|
|
+ GameUserRole gameUserRole = super.getOne(new LambdaQueryWrapper<GameUserRole>().eq(GameUserRole::getRoleId, roleId));
|
|
|
+ return BeanUtils.copy(gameUserRole, GameUserRoleDTO.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 单个用户的角色列表
|
|
|
+ *
|
|
|
+ * @param userId : 用户id
|
|
|
+ * @return : 返回用户角色信息列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<GameUserRoleVO> roleList(Long userId) {
|
|
|
+ List<GameUserRole> gameUserRoleList = super.list(new LambdaQueryWrapper<GameUserRole>().eq(GameUserRole::getUserId, userId));
|
|
|
+ if (CollectionUtils.isEmpty(gameUserRoleList)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+ List<GameUserRoleVO> list = new ArrayList<>();
|
|
|
+ gameUserRoleList.forEach(role -> {
|
|
|
+ GameUserRoleVO gameUserRoleVO = BeanUtils.copy(role, GameUserRoleVO.class);
|
|
|
+ if (gameUserRoleVO == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //设置游戏名称
|
|
|
+ GameDTO gameDTO = gameService.getById(role.getGameId());
|
|
|
+ if (gameDTO != null) {
|
|
|
+ gameUserRoleVO.setGameName(gameDTO.getName());
|
|
|
+ //设置游戏列表
|
|
|
+ GameCategoryVO gameCategoryVO = gameCategoryService.getById(gameDTO.getCategory());
|
|
|
+ if (gameCategoryVO != null) {
|
|
|
+ gameUserRoleVO.setGameCategoryName(gameCategoryVO.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //玩家游戏信息
|
|
|
+ GameUserVO gameUserVO = gameUserService.getById(role.getGameUserId());
|
|
|
+ if (gameUserVO != null) {
|
|
|
+ ChannelDTO channelDTO = channelService.getById(gameUserVO.getAgentId());
|
|
|
+ gameUserRoleVO.setChannelName(channelDTO.getChannelSign());
|
|
|
+ }
|
|
|
+ list.add(gameUserRoleVO);
|
|
|
+ });
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询玩家角色列表
|
|
|
*
|