|
|
@ -82,10 +82,10 @@ public class UserInfoService {
|
|
|
|
private final UserPointLogDao userPointLogDao;
|
|
|
|
private final UserPointLogDao userPointLogDao;
|
|
|
|
|
|
|
|
|
|
|
|
public UserInfoService(UserInfoDao userInfoDao, IdWorker idWorker, RedisTemplate redisTemplate,
|
|
|
|
public UserInfoService(UserInfoDao userInfoDao, IdWorker idWorker, RedisTemplate redisTemplate,
|
|
|
|
RabbitTemplate rabbitTemplate, BCryptPasswordEncoder encoder, HttpServletRequest request,
|
|
|
|
RabbitTemplate rabbitTemplate, BCryptPasswordEncoder encoder, HttpServletRequest request,
|
|
|
|
JwtUtil jwtUtil, UserRealNameDao userRealNameDao, UserBankDao userBankDao,
|
|
|
|
JwtUtil jwtUtil, UserRealNameDao userRealNameDao, UserBankDao userBankDao,
|
|
|
|
WithdrawDao withdrawDao, UserPointLogService userPointLogService,
|
|
|
|
WithdrawDao withdrawDao, UserPointLogService userPointLogService,
|
|
|
|
UserPointLogDao userPointLogDao) {
|
|
|
|
UserPointLogDao userPointLogDao) {
|
|
|
|
this.userInfoDao = userInfoDao;
|
|
|
|
this.userInfoDao = userInfoDao;
|
|
|
|
this.idWorker = idWorker;
|
|
|
|
this.idWorker = idWorker;
|
|
|
|
this.redisTemplate = redisTemplate;
|
|
|
|
this.redisTemplate = redisTemplate;
|
|
|
@ -233,8 +233,8 @@ public class UserInfoService {
|
|
|
|
* 注册判断是否有邀请码
|
|
|
|
* 注册判断是否有邀请码
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param loginUserInfo 登录用户
|
|
|
|
* @param loginUserInfo 登录用户
|
|
|
|
* @param loginReq 邀请码
|
|
|
|
* @param loginReq 邀请码
|
|
|
|
* @return token
|
|
|
|
* @return token
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public String loginOrRegisterWithInvite(UserInfo loginUserInfo, LoginReq loginReq) {
|
|
|
|
public String loginOrRegisterWithInvite(UserInfo loginUserInfo, LoginReq loginReq) {
|
|
|
|
UserInfo userInfo = userInfoDao.findByMobile(loginUserInfo.getMobile());
|
|
|
|
UserInfo userInfo = userInfoDao.findByMobile(loginUserInfo.getMobile());
|
|
|
@ -269,7 +269,7 @@ public class UserInfoService {
|
|
|
|
userInfoDao.save(userInfo);
|
|
|
|
userInfoDao.save(userInfo);
|
|
|
|
String token = Constants.TOKEN_PREFIX
|
|
|
|
String token = Constants.TOKEN_PREFIX
|
|
|
|
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
|
|
|
|
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
|
|
|
|
if(isNewUser) {
|
|
|
|
if (isNewUser) {
|
|
|
|
// 只有新用户会获得积分
|
|
|
|
// 只有新用户会获得积分
|
|
|
|
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token);
|
|
|
|
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -279,7 +279,7 @@ public class UserInfoService {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 绑定邀请人
|
|
|
|
* 绑定邀请人
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param userInfo 用户
|
|
|
|
* @param userInfo 用户
|
|
|
|
* @param invitationCode 邀请码
|
|
|
|
* @param invitationCode 邀请码
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@ -343,7 +343,7 @@ public class UserInfoService {
|
|
|
|
String token = Constants.TOKEN_PREFIX
|
|
|
|
String token = Constants.TOKEN_PREFIX
|
|
|
|
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
|
|
|
|
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
|
|
|
|
|
|
|
|
|
|
|
|
if(isNewUser) {
|
|
|
|
if (isNewUser) {
|
|
|
|
// 只有新用户会获得积分
|
|
|
|
// 只有新用户会获得积分
|
|
|
|
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token);
|
|
|
|
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -383,7 +383,7 @@ public class UserInfoService {
|
|
|
|
userInfoDao.save(userInfo);
|
|
|
|
userInfoDao.save(userInfo);
|
|
|
|
String token = Constants.TOKEN_PREFIX
|
|
|
|
String token = Constants.TOKEN_PREFIX
|
|
|
|
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
|
|
|
|
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
|
|
|
|
if(isNewUser) {
|
|
|
|
if (isNewUser) {
|
|
|
|
// 只有新用户会获得积分
|
|
|
|
// 只有新用户会获得积分
|
|
|
|
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token);
|
|
|
|
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -469,7 +469,7 @@ public class UserInfoService {
|
|
|
|
userInfoDao.save(userInfo);
|
|
|
|
userInfoDao.save(userInfo);
|
|
|
|
String token = Constants.TOKEN_PREFIX
|
|
|
|
String token = Constants.TOKEN_PREFIX
|
|
|
|
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
|
|
|
|
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
|
|
|
|
if(isNewUser) {
|
|
|
|
if (isNewUser) {
|
|
|
|
// 只有新用户会获得积分
|
|
|
|
// 只有新用户会获得积分
|
|
|
|
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token);
|
|
|
|
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -804,9 +804,9 @@ public class UserInfoService {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 分页查询用户的提现记录
|
|
|
|
* 分页查询用户的提现记录
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param token 登录token
|
|
|
|
* @param token 登录token
|
|
|
|
* @param page 页码
|
|
|
|
* @param page 页码
|
|
|
|
* @param size 每页数量
|
|
|
|
* @param size 每页数量
|
|
|
|
* @return 列表
|
|
|
|
* @return 列表
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public PageResult<Withdraw> withdrawPageResult(String token, Integer page, Integer size) {
|
|
|
|
public PageResult<Withdraw> withdrawPageResult(String token, Integer page, Integer size) {
|
|
|
@ -820,7 +820,7 @@ public class UserInfoService {
|
|
|
|
long totalElements = withdrawPage.getTotalElements();
|
|
|
|
long totalElements = withdrawPage.getTotalElements();
|
|
|
|
List<Withdraw> content = withdrawPage.getContent();
|
|
|
|
List<Withdraw> content = withdrawPage.getContent();
|
|
|
|
for (Withdraw withdraw : content) {
|
|
|
|
for (Withdraw withdraw : content) {
|
|
|
|
if(withdraw.getState() != null) {
|
|
|
|
if (withdraw.getState() != null) {
|
|
|
|
withdraw.setStateStr(Objects.requireNonNull(WithdrawStateEnum.getByCode(withdraw.getState())).getDesc());
|
|
|
|
withdraw.setStateStr(Objects.requireNonNull(WithdrawStateEnum.getByCode(withdraw.getState())).getDesc());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -843,21 +843,21 @@ public class UserInfoService {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 确定身份以及判断是否二维码过期等
|
|
|
|
* 确定身份以及判断是否二维码过期等
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param userId 用户id
|
|
|
|
* @param userId 用户id
|
|
|
|
* @param token 二维码uuid
|
|
|
|
* @param token 二维码uuid
|
|
|
|
* @param type 类型,1-扫码 2-确认
|
|
|
|
* @param type 类型,1-扫码 2-确认
|
|
|
|
* @return token
|
|
|
|
* @return token
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void scan(String userId, String token, Integer type) throws Exception {
|
|
|
|
public void scan(String userId, String token, Integer type) throws Exception {
|
|
|
|
Object o = redisTemplate.opsForValue().get(token);
|
|
|
|
Object o = redisTemplate.opsForValue().get(token);
|
|
|
|
if (o == null) {
|
|
|
|
if (o == null) {
|
|
|
|
throw new BizException("二维码失效!");
|
|
|
|
throw new BizException("二维码失效!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!String.valueOf(o).equals("0") && !String.valueOf(o).equals("1")) {
|
|
|
|
if (!String.valueOf(o).equals("0") && !String.valueOf(o).equals("1")) {
|
|
|
|
throw new BizException("登录认证已完成");
|
|
|
|
throw new BizException("登录认证已完成");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(type == 1) {
|
|
|
|
if (type == 1) {
|
|
|
|
// 扫码
|
|
|
|
// 扫码
|
|
|
|
redisTemplate.opsForValue().set(token, 1, 60, TimeUnit.SECONDS);
|
|
|
|
redisTemplate.opsForValue().set(token, 1, 60, TimeUnit.SECONDS);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -884,7 +884,7 @@ public class UserInfoService {
|
|
|
|
public String createInvitationCode(String token) {
|
|
|
|
public String createInvitationCode(String token) {
|
|
|
|
UserLoginDto user = jwtUtil.getUserLoginDto(token);
|
|
|
|
UserLoginDto user = jwtUtil.getUserLoginDto(token);
|
|
|
|
UserInfo byId = userInfoDao.getById(user.getUserId());
|
|
|
|
UserInfo byId = userInfoDao.getById(user.getUserId());
|
|
|
|
if(StringUtils.isNotBlank(byId.getInvitationCode())) {
|
|
|
|
if (StringUtils.isNotBlank(byId.getInvitationCode())) {
|
|
|
|
return byId.getInvitationCode();
|
|
|
|
return byId.getInvitationCode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -907,4 +907,14 @@ public class UserInfoService {
|
|
|
|
public List<UserInfo> getExpireVipList() {
|
|
|
|
public List<UserInfo> getExpireVipList() {
|
|
|
|
return userInfoDao.getExpireVipList();
|
|
|
|
return userInfoDao.getExpireVipList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 根据邀请码查询用户信息
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param invitationCode 邀请码
|
|
|
|
|
|
|
|
* @return 用户信息
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public UserInfo getUserInfoByInvitationCode(String invitationCode) {
|
|
|
|
|
|
|
|
return userInfoDao.findByInvitationCode(invitationCode);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|