|
@@ -1,90 +0,0 @@
|
|
|
-package com.zanxiang.manage.service.Impl;
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.zanxiang.common.utils.bean.BeanUtils;
|
|
|
-import com.zanxiang.manage.domain.dto.UserExtDTO;
|
|
|
-import com.zanxiang.manage.service.UserExtService;
|
|
|
-import com.zanxiang.mybatis.entity.UserExt;
|
|
|
-import com.zanxiang.mybatis.mapper.UserExtMapper;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.logging.log4j.util.Strings;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.function.Function;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-/**
|
|
|
- * @author : lingfeng
|
|
|
- * @time : 2022-06-29
|
|
|
- * @description : 玩家拓展信息
|
|
|
- */
|
|
|
-@Slf4j
|
|
|
-@Service
|
|
|
-public class UserExtServiceImpl extends ServiceImpl<UserExtMapper, UserExt> implements UserExtService {
|
|
|
-
|
|
|
- /**
|
|
|
- * 多条件查询用户拓展信息
|
|
|
- *
|
|
|
- * @param realName : 真实姓名
|
|
|
- * @param regIp : 注册ip
|
|
|
- * @param isAuth : 是否实名
|
|
|
- * @return : 返回用户拓展信息列表
|
|
|
- */
|
|
|
- @Override
|
|
|
- public Map<Long, UserExtDTO> getUserExtList(String realName, String regIp, Boolean isAuth) {
|
|
|
- if (Strings.isBlank(realName) && Strings.isBlank(regIp) && isAuth == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- List<UserExt> userExtList = super.list(new LambdaQueryWrapper<UserExt>()
|
|
|
- .eq(Strings.isNotBlank(realName), UserExt::getRealName, realName)
|
|
|
- .eq(Strings.isNotBlank(regIp), UserExt::getRegIp, regIp)
|
|
|
- .eq(isAuth != null, UserExt::getIsAuth, isAuth)
|
|
|
- .select(UserExt::getUserId, UserExt::getRealName, UserExt::getRegIp, UserExt::getIsAuth, UserExt::getIdCard));
|
|
|
- if (CollectionUtils.isEmpty(userExtList)) {
|
|
|
- return Collections.emptyMap();
|
|
|
- }
|
|
|
- return BeanUtils.copyList(userExtList, UserExtDTO.class).stream()
|
|
|
- .collect(Collectors.toMap(UserExtDTO::getUserId, Function.identity()));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 注册ip相关条件查询用户拓展信息
|
|
|
- *
|
|
|
- * @param regIp : 参数
|
|
|
- * @return : 玩家信息
|
|
|
- */
|
|
|
- @Override
|
|
|
- public Map<Long, UserExtDTO> regIpCondition(String regIp) {
|
|
|
- if (Strings.isBlank(regIp)) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- //玩家注册ip条件处理
|
|
|
- List<UserExt> userExtList = super.list(new LambdaQueryWrapper<UserExt>()
|
|
|
- .eq(UserExt::getRegIp, regIp)
|
|
|
- .select(UserExt::getUserId, UserExt::getRegIp));
|
|
|
- if (CollectionUtils.isEmpty(userExtList)) {
|
|
|
- return Collections.emptyMap();
|
|
|
- }
|
|
|
- return BeanUtils.copyList(userExtList, UserExtDTO.class).stream()
|
|
|
- .collect(Collectors.toMap(UserExtDTO::getUserId, Function.identity()));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据玩家id查询
|
|
|
- *
|
|
|
- * @param userId : 玩家id
|
|
|
- * @return : 返回玩家信息
|
|
|
- */
|
|
|
- @Override
|
|
|
- public UserExtDTO getById(Long userId) {
|
|
|
- if (userId == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- return BeanUtils.copy(super.getById(userId), UserExtDTO.class);
|
|
|
- }
|
|
|
-}
|