|
@@ -1,12 +1,15 @@
|
|
|
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.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.zanxiang.common.exception.BaseException;
|
|
|
import com.zanxiang.common.utils.MD5Util;
|
|
|
+import com.zanxiang.common.utils.StringUtils;
|
|
|
import com.zanxiang.common.utils.bean.BeanUtils;
|
|
|
import com.zanxiang.manage.domain.dto.ChannelDTO;
|
|
|
import com.zanxiang.manage.domain.dto.GameDTO;
|
|
@@ -28,9 +31,11 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.LocalTime;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -63,7 +68,83 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
*/
|
|
|
@Override
|
|
|
public IPage<UserListVO> list(UserListParam param) {
|
|
|
- return null;
|
|
|
+ //游戏条件处理
|
|
|
+ Map<Long, GameDTO> gameMap = gameService.gameCondition(param.getCpId(), param.getGameId(), param.getGameCategoryId());
|
|
|
+ //根据条件, 匹配不到游戏
|
|
|
+ if (gameMap != null && gameMap.isEmpty()) {
|
|
|
+ return new Page<>();
|
|
|
+ }
|
|
|
+ //玩家拓展信息条件
|
|
|
+ Map<Long, UserExtDTO> userExtMap = userExtService.getUserExtList(param.getRealName(), param.getRegIp(), param.getIsAuth());
|
|
|
+ if (userExtMap != null && userExtMap.isEmpty()) {
|
|
|
+ return new Page<>();
|
|
|
+ }
|
|
|
+ //判断指定的玩家id是否在用户列表中
|
|
|
+ if (param.getUserId() != null && userExtMap != null && !userExtMap.keySet().contains(param.getUserId())) {
|
|
|
+ return new Page<>();
|
|
|
+ }
|
|
|
+ //执行查询
|
|
|
+ return page(param.toPage(), new QueryWrapper<User>().lambda()
|
|
|
+ .eq(param.getUserId() != null, User::getId, param.getUserId())
|
|
|
+ .like(Strings.isNotBlank(param.getUserName()), User::getUsername, param.getUserName())
|
|
|
+ .like(Strings.isNotBlank(param.getNickname()), User::getNickname, param.getNickname())
|
|
|
+ .eq(Strings.isNotBlank(param.getMobile()), User::getMobile, param.getMobile())
|
|
|
+ .in(userExtMap != null, User::getId, userExtMap != null ? userExtMap.keySet() : null)
|
|
|
+ .isNotNull(Objects.equals(param.getIsBindMobile(), Boolean.TRUE), User::getMobile)
|
|
|
+ .isNull(Objects.equals(param.getIsBindMobile(), Boolean.FALSE), User::getMobile)
|
|
|
+ .in(gameMap != null, User::getGameId, gameMap != null ? gameMap.keySet() : null)
|
|
|
+ .ge(param.getBeginDate() != null, User::getCreateTime, param.getBeginDate() == null ? null : LocalDateTime.of(param.getBeginDate(), LocalTime.MIN))
|
|
|
+ .le(param.getEndDate() != null, User::getCreateTime, param.getEndDate() == null ? null : LocalDateTime.of(param.getEndDate(), LocalTime.MAX))
|
|
|
+ .ge(param.getRechargeBeginDate() != null, User::getLastRechargeTime, param.getRechargeBeginDate() == null ? null : LocalDateTime.of(param.getRechargeBeginDate(), LocalTime.MIN))
|
|
|
+ .le(param.getRechargeEndDate() != null, User::getLastRechargeTime, param.getRechargeEndDate() == null ? null : LocalDateTime.of(param.getRechargeEndDate(), LocalTime.MAX))
|
|
|
+ .gt(Objects.equals(param.getIsRecharge(), Boolean.TRUE), User::getRechargeCount, 0)
|
|
|
+ .eq(Objects.equals(param.getIsRecharge(), Boolean.FALSE), User::getRechargeCount, 0)
|
|
|
+ .eq(param.getVipLevel() != null && param.getVipLevel() <= 10, User::getVipMax, param.getVipLevel())
|
|
|
+ .gt(param.getVipLevel() != null && param.getVipLevel() > 10, User::getVipMax, param.getVipLevel())
|
|
|
+ .eq(param.getStatus() != null, User::getStatus, param.getStatus())
|
|
|
+ .eq(param.getChannelId() != null, User::getAgentId, param.getChannelId())
|
|
|
+ // todo : 归因推广账号
|
|
|
+ // todo : 归因投放人员
|
|
|
+ .eq(param.getCustomerId() != null, User::getCustomerId, param.getCustomerId())
|
|
|
+ // todo : 归因广告
|
|
|
+ .eq(param.getIsGs() != null, User::getIsGs, param.getIsGs())
|
|
|
+ // todo : 是否切量
|
|
|
+ .orderByDesc(User::getCreateTime)
|
|
|
+ ).convert(u -> this.toVo(u, userExtMap, gameMap));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 游戏玩家信息转换对象
|
|
|
+ *
|
|
|
+ * @param user : 用户信息
|
|
|
+ * @param userExtMap : 用户拓展信息
|
|
|
+ * @param gameMap : 游戏列表
|
|
|
+ * @return : 返回用户信息
|
|
|
+ */
|
|
|
+ private UserListVO toVo(User user, Map<Long, UserExtDTO> userExtMap, Map<Long, GameDTO> gameMap) {
|
|
|
+ UserListVO userListVO = BeanUtils.copy(user, UserListVO.class);
|
|
|
+ if (Objects.isNull(userListVO)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ UserExtDTO userExtDTO = StringUtils.isEmpty(userExtMap) ? null : userExtMap.get(userListVO.getId());
|
|
|
+ if (userExtDTO == null) {
|
|
|
+ userExtDTO = userExtService.getById(userListVO.getId());
|
|
|
+ }
|
|
|
+ if (userExtDTO != null) {
|
|
|
+ userListVO.setRealName(userExtDTO.getRealName());
|
|
|
+ userListVO.setRegIp(userExtDTO.getRegIp());
|
|
|
+ userListVO.setIdCard(userExtDTO.getIdCard());
|
|
|
+ }
|
|
|
+ GameDTO gameDTO = StringUtils.isEmpty(gameMap) ? null : gameMap.get(userListVO.getGameId());
|
|
|
+ if (gameDTO == null) {
|
|
|
+ gameDTO = gameService.getById(userListVO.getGameId());
|
|
|
+ }
|
|
|
+ if (gameDTO != null) {
|
|
|
+ userListVO.setGameCategoryId(gameDTO.getCategory());
|
|
|
+ userListVO.setCpId(gameDTO.getCpId());
|
|
|
+ }
|
|
|
+ userListVO.setChannelId(user.getAgentId());
|
|
|
+ return userListVO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -84,13 +165,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
.set(Strings.isNotBlank(param.getPassword()), User::getPassword, this.cmfPassword(param.getPassword()))
|
|
|
.set(Strings.isNotBlank(param.getMobile()) || Strings.isNotBlank(param.getAliPay())
|
|
|
|| Strings.isNotBlank(param.getPassword()), User::getUpdateTime, LocalDateTime.now()));
|
|
|
- //用户拓展信息更新
|
|
|
- userExtService.update(new LambdaUpdateWrapper<UserExt>()
|
|
|
- .eq(UserExt::getUserId, param.getUserId())
|
|
|
- .set(Strings.isNotBlank(param.getRealName()), UserExt::getRealName, param.getRealName())
|
|
|
- .set(Strings.isNotBlank(param.getIdCard()), UserExt::getIdCard, param.getIdCard())
|
|
|
- .set(Strings.isNotBlank(param.getRealName()) || Strings.isNotBlank(param.getIdCard()), UserExt::getUpdateTime, LocalDateTime.now())
|
|
|
- );
|
|
|
+// //用户拓展信息更新
|
|
|
+// userExtService.update(new LambdaUpdateWrapper<UserExt>()
|
|
|
+// .eq(UserExt::getUserId, param.getUserId())
|
|
|
+// .set(Strings.isNotBlank(param.getRealName()), UserExt::getRealName, param.getRealName())
|
|
|
+// .set(Strings.isNotBlank(param.getIdCard()), UserExt::getIdCard, param.getIdCard())
|
|
|
+// .set(Strings.isNotBlank(param.getRealName()) || Strings.isNotBlank(param.getIdCard()), UserExt::getUpdateTime, LocalDateTime.now())
|
|
|
+// );
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
|