|
@@ -8,7 +8,10 @@ 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.*;
|
|
|
+import com.zanxiang.manage.domain.dto.ChannelDTO;
|
|
|
+import com.zanxiang.manage.domain.dto.GameDTO;
|
|
|
+import com.zanxiang.manage.domain.dto.GameUserRoleDTO;
|
|
|
+import com.zanxiang.manage.domain.dto.UserDTO;
|
|
|
import com.zanxiang.manage.domain.params.GameUserRoleListParam;
|
|
|
import com.zanxiang.manage.domain.vo.GameCategoryVO;
|
|
|
import com.zanxiang.manage.domain.vo.GameUserRoleListVO;
|
|
@@ -38,9 +41,6 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private UserExtService userExtService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private GameService gameService;
|
|
|
|
|
@@ -53,6 +53,9 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
|
|
|
@Autowired
|
|
|
private ChannelService channelService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CpService cpService;
|
|
|
+
|
|
|
/**
|
|
|
* 根据角色id查询
|
|
|
*
|
|
@@ -113,29 +116,23 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
|
|
|
@Override
|
|
|
public IPage<GameUserRoleListVO> list(GameUserRoleListParam param) {
|
|
|
//玩家条件处理
|
|
|
- Map<Long, UserDTO> userMap = userService.userCondition(param.getUserId(), param.getChannelId(), param.getUserName(), param.getNickname());
|
|
|
+ Map<Long, UserDTO> userMap = userService.userCondition(param.getUserId(), param.getChannelId(), param.getUserName(), param.getNickname(), param.getRegIp());
|
|
|
//根据条件, 匹配不到玩家
|
|
|
if (userMap != null && userMap.isEmpty()) {
|
|
|
return new Page<>();
|
|
|
}
|
|
|
- //玩家注册ip条件处理
|
|
|
- Map<Long, UserExtDTO> userExtMap = userExtService.regIpCondition(param.getRegIp());
|
|
|
- //根据ip, 匹配不到玩家
|
|
|
- if (userExtMap != null && userExtMap.isEmpty()) {
|
|
|
- return new Page<>();
|
|
|
- }
|
|
|
- //玩家信息和拓展信息合并
|
|
|
- Set<Long> userIdSet = this.getUserId(userMap, userExtMap);
|
|
|
- //用户信息取交集不存在玩家信息
|
|
|
- if (userIdSet != null && userIdSet.isEmpty()) {
|
|
|
- return new Page<>();
|
|
|
- }
|
|
|
+ //相关用户id
|
|
|
+ Set<Long> userIdSet = userMap == null ? null : userMap.keySet();
|
|
|
//游戏条件处理
|
|
|
Map<Long, GameDTO> gameMap = gameService.gameCondition(param.getCpId(), param.getGameId(), param.getGameCategoryId());
|
|
|
//根据条件, 匹配不到游戏
|
|
|
if (gameMap != null && gameMap.isEmpty()) {
|
|
|
return new Page<>();
|
|
|
}
|
|
|
+ //注册渠道
|
|
|
+ Map<Long, String> channelMap = channelService.choiceMap();
|
|
|
+ Map<Long, String> cpMap = cpService.choiceMap();
|
|
|
+ Map<Long, String> categoryMap = gameCategoryService.choiceMap();
|
|
|
//执行查询
|
|
|
return page(param.toPage(), new QueryWrapper<GameUserRole>().lambda()
|
|
|
.in(CollectionUtils.isNotEmpty(userIdSet), GameUserRole::getUserId, userIdSet)
|
|
@@ -152,7 +149,7 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
|
|
|
.ge(param.getRechargeBeginDate() != null, GameUserRole::getLastRechargeTime, param.getRechargeBeginDate() == null ? null : LocalDateTime.of(param.getRechargeBeginDate(), LocalTime.MIN))
|
|
|
.le(param.getRechargeEndDate() != null, GameUserRole::getLastRechargeTime, param.getRechargeEndDate() == null ? null : LocalDateTime.of(param.getRechargeEndDate(), LocalTime.MAX))
|
|
|
.orderByDesc(GameUserRole::getCreateTime)
|
|
|
- ).convert(u -> this.toVo(u, userMap, userExtMap, gameMap));
|
|
|
+ ).convert(u -> this.toVo(u, userMap, gameMap, channelMap, cpMap, categoryMap));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -161,7 +158,8 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
|
|
|
* @param gameUserRole : 玩家角色信息
|
|
|
* @return : 玩家角色信息展示对象
|
|
|
*/
|
|
|
- private GameUserRoleListVO toVo(GameUserRole gameUserRole, Map<Long, UserDTO> userMap, Map<Long, UserExtDTO> userExtMap, Map<Long, GameDTO> gameMap) {
|
|
|
+ private GameUserRoleListVO toVo(GameUserRole gameUserRole, Map<Long, UserDTO> userMap, Map<Long, GameDTO> gameMap,
|
|
|
+ Map<Long, String> channelMap, Map<Long, String> cpMap, Map<Long, String> categoryMap) {
|
|
|
GameUserRoleListVO gameUserRoleListVO = BeanUtils.copy(gameUserRole, GameUserRoleListVO.class);
|
|
|
if (Objects.isNull(gameUserRoleListVO)) {
|
|
|
return null;
|
|
@@ -173,52 +171,22 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
|
|
|
if (userDTO != null) {
|
|
|
gameUserRoleListVO.setUsername(userDTO.getUsername());
|
|
|
gameUserRoleListVO.setNickname(userDTO.getNickname());
|
|
|
- gameUserRoleListVO.setChannelId(userDTO.getAgentId());
|
|
|
- }
|
|
|
- UserExtDTO userExtDTO = StringUtils.isEmpty(userExtMap) ? null : userExtMap.get(gameUserRoleListVO.getUserId());
|
|
|
- if (userExtDTO == null) {
|
|
|
- userExtDTO = userExtService.getById(gameUserRoleListVO.getUserId());
|
|
|
- }
|
|
|
- if (userExtDTO != null) {
|
|
|
- gameUserRoleListVO.setRegIp(userExtDTO.getRegIp());
|
|
|
- gameUserRoleListVO.setRegTime(userExtDTO.getCreateTime());
|
|
|
+ gameUserRoleListVO.setAgentId(userDTO.getAgentId());
|
|
|
+ gameUserRoleListVO.setChannel(channelMap.get(userDTO.getAgentId()));
|
|
|
+ gameUserRoleListVO.setRegIp(userDTO.getIp());
|
|
|
+ gameUserRoleListVO.setRegTime(userDTO.getCreateTime());
|
|
|
}
|
|
|
GameDTO gameDTO = StringUtils.isEmpty(gameMap) ? null : gameMap.get(gameUserRoleListVO.getGameId());
|
|
|
if (gameDTO == null) {
|
|
|
gameDTO = gameService.getById(gameUserRoleListVO.getGameId());
|
|
|
}
|
|
|
if (gameDTO != null) {
|
|
|
+ gameUserRoleListVO.setGameName(gameDTO.getName());
|
|
|
gameUserRoleListVO.setCpId(gameDTO.getCpId());
|
|
|
+ gameUserRoleListVO.setCpName(cpMap.get(gameDTO.getCpId()));
|
|
|
gameUserRoleListVO.setGameCategoryId(gameDTO.getCategory());
|
|
|
+ gameUserRoleListVO.setGameCategoryName(categoryMap.get(gameDTO.getCategory()));
|
|
|
}
|
|
|
return gameUserRoleListVO;
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取查询相关的玩家用户id
|
|
|
- *
|
|
|
- * @param userMap : 玩家信息
|
|
|
- * @param userExtMap : 玩家拓展信息
|
|
|
- * @return : 返回玩家id列表
|
|
|
- */
|
|
|
- private Set<Long> getUserId(Map<Long, UserDTO> userMap, Map<Long, UserExtDTO> userExtMap) {
|
|
|
- if (userMap == null && userExtMap == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- if (userMap == null) {
|
|
|
- return userExtMap.keySet();
|
|
|
- }
|
|
|
- if (userExtMap == null) {
|
|
|
- return userMap.keySet();
|
|
|
- }
|
|
|
- //两者都不为空, 取交集
|
|
|
- Set<Long> set = new HashSet<>();
|
|
|
- Set<Long> userExtMapKeySet = userExtMap.keySet();
|
|
|
- userMap.keySet().forEach(u -> {
|
|
|
- if (userExtMapKeySet.contains(u)) {
|
|
|
- set.add(u);
|
|
|
- }
|
|
|
- });
|
|
|
- return set;
|
|
|
- }
|
|
|
}
|