|
@@ -10,6 +10,7 @@ import com.zanxiang.common.exception.BaseException;
|
|
import com.zanxiang.common.utils.bean.BeanUtils;
|
|
import com.zanxiang.common.utils.bean.BeanUtils;
|
|
import com.zanxiang.mybatis.entity.GameExt;
|
|
import com.zanxiang.mybatis.entity.GameExt;
|
|
import com.zanxiang.mybatis.entity.User;
|
|
import com.zanxiang.mybatis.entity.User;
|
|
|
|
+import com.zanxiang.mybatis.entity.UserCard;
|
|
import com.zanxiang.mybatis.mapper.UserMapper;
|
|
import com.zanxiang.mybatis.mapper.UserMapper;
|
|
import com.zanxiang.sdk.domain.dto.UserDTO;
|
|
import com.zanxiang.sdk.domain.dto.UserDTO;
|
|
import com.zanxiang.sdk.domain.params.BindPhoneParam;
|
|
import com.zanxiang.sdk.domain.params.BindPhoneParam;
|
|
@@ -20,6 +21,7 @@ import com.zanxiang.sdk.domain.vo.CustomerVO;
|
|
import com.zanxiang.sdk.domain.vo.UserVO;
|
|
import com.zanxiang.sdk.domain.vo.UserVO;
|
|
import com.zanxiang.sdk.service.GameExtService;
|
|
import com.zanxiang.sdk.service.GameExtService;
|
|
import com.zanxiang.sdk.service.SmsService;
|
|
import com.zanxiang.sdk.service.SmsService;
|
|
|
|
+import com.zanxiang.sdk.service.UserCardService;
|
|
import com.zanxiang.sdk.service.UserService;
|
|
import com.zanxiang.sdk.service.UserService;
|
|
import com.zanxiang.sdk.util.RegisterUtil;
|
|
import com.zanxiang.sdk.util.RegisterUtil;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -46,6 +48,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
@Autowired
|
|
@Autowired
|
|
private SmsService smsService;
|
|
private SmsService smsService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private UserCardService userCardService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 忘记密码找回
|
|
* 忘记密码找回
|
|
*
|
|
*
|
|
@@ -110,9 +115,16 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
String newPassword = param.getNewPassword();
|
|
String newPassword = param.getNewPassword();
|
|
//查询用户信息
|
|
//查询用户信息
|
|
User user = super.getById(userData.getUserId());
|
|
User user = super.getById(userData.getUserId());
|
|
- //旧密码校验
|
|
|
|
- if (Strings.isBlank(user.getPassword()) || !Objects.equals(RegisterUtil.cmfPassword(oldPassword), user.getPassword())) {
|
|
|
|
- return new ResultVO<>(HttpStatusEnum.OLD_PASSWORD_ERROR);
|
|
|
|
|
|
+ //旧密存在
|
|
|
|
+ if (Strings.isNotBlank(user.getPassword())) {
|
|
|
|
+ //旧密码不可为空
|
|
|
|
+ if (Strings.isBlank(oldPassword)) {
|
|
|
|
+ return new ResultVO<>(HttpStatusEnum.OLD_PASSWORD_EMPTY);
|
|
|
|
+ }
|
|
|
|
+ //旧密码错误
|
|
|
|
+ if (!Objects.equals(RegisterUtil.cmfPassword(oldPassword), user.getPassword())) {
|
|
|
|
+ return new ResultVO<>(HttpStatusEnum.OLD_PASSWORD_ERROR);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//新密码校验
|
|
//新密码校验
|
|
HttpStatusEnum checkPasswordEnum = RegisterUtil.checkPassword(newPassword);
|
|
HttpStatusEnum checkPasswordEnum = RegisterUtil.checkPassword(newPassword);
|
|
@@ -147,7 +159,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
throw new BaseException("参数错误, 用户信息不存在");
|
|
throw new BaseException("参数错误, 用户信息不存在");
|
|
}
|
|
}
|
|
//判断手机号是否已经绑定
|
|
//判断手机号是否已经绑定
|
|
- if (Objects.equals(user.getMobile(), mobile)) {
|
|
|
|
|
|
+ if (Strings.isNotBlank(user.getMobile()) || Objects.equals(user.getMobile(), mobile)) {
|
|
return new ResultVO<>(HttpStatusEnum.PHONE_IS_BIND);
|
|
return new ResultVO<>(HttpStatusEnum.PHONE_IS_BIND);
|
|
}
|
|
}
|
|
//校验手机号是否已经绑定了其他账号
|
|
//校验手机号是否已经绑定了其他账号
|
|
@@ -182,12 +194,32 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
Long userId = userData.getUserId();
|
|
Long userId = userData.getUserId();
|
|
//查询用户信息
|
|
//查询用户信息
|
|
User user = this.getById(userId);
|
|
User user = this.getById(userId);
|
|
|
|
+ String mobile = user.getMobile();
|
|
|
|
+ //手机号
|
|
|
|
+ String phoneNum = null;
|
|
|
|
+ if (Strings.isNotBlank(mobile)) {
|
|
|
|
+ phoneNum = mobile.substring(0, 3) + "****" + mobile.substring(mobile.length() - 4);
|
|
|
|
+ }
|
|
|
|
+ //真实姓名
|
|
|
|
+ String cardName = null;
|
|
|
|
+ //身份证信息
|
|
|
|
+ String cardId = null;
|
|
|
|
+ //查询用户实名信息
|
|
|
|
+ UserCard userCard = userCardService.getOne(new LambdaQueryWrapper<UserCard>().eq(UserCard::getUserId, userId));
|
|
|
|
+ if (userCard != null && Strings.isNotBlank(userCard.getCardId()) && Strings.isNotBlank(userCard.getCardName())) {
|
|
|
|
+ cardName = "**" + userCard.getCardName().substring(userCard.getCardName().length() - 1);
|
|
|
|
+ cardId = userCard.getCardId().substring(0, 6) + "********" + userCard.getCardId().substring(userCard.getCardId().length() - 4);
|
|
|
|
+ }
|
|
//构造用户登录信息
|
|
//构造用户登录信息
|
|
return UserVO.builder()
|
|
return UserVO.builder()
|
|
.userId(user.getId())
|
|
.userId(user.getId())
|
|
.userName(user.getUsername())
|
|
.userName(user.getUsername())
|
|
.authentication(user.getAuthentication())
|
|
.authentication(user.getAuthentication())
|
|
- .bindPhone(Strings.isBlank(user.getMobile()) ? 0 : 1)
|
|
|
|
|
|
+ .bindPhone(Strings.isBlank(phoneNum) ? 0 : 1)
|
|
|
|
+ .hasOldPassword(Strings.isNotBlank(user.getPassword()))
|
|
|
|
+ .phoneNum(phoneNum)
|
|
|
|
+ .cardName(cardName)
|
|
|
|
+ .cardId(cardId)
|
|
.build();
|
|
.build();
|
|
}
|
|
}
|
|
|
|
|