Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
Tankaikai 2025-01-10 16:41:39 +08:00
commit d0a5e26834
6 changed files with 16 additions and 78 deletions

View File

@ -183,7 +183,7 @@ public class AppController {
return Result.error("实名修改失败: 每月可修改次数已用完,请联系管理员");
}
AuthRespDTO resp = aliService.auth(certName, certNum, accountNo, mobile);
UserInfo userInfo = userInfoService.getByUserId(userId);
UserInfo userInfo = userInfoService.getByUserIdOrSave(userId);
userInfo.setCertName(certName);
userInfo.setCertNo(certNum);
userInfo.setAccountNo(accountNo);

View File

@ -11,6 +11,7 @@ import java.util.List;
* @createDate 2025-01-02 14:15:08
*/
public interface UserInfoService extends IService<UserInfo> {
UserInfo getByUserIdOrSave(long userId);
UserInfo getByUserId(long userId);

View File

@ -228,17 +228,6 @@ public interface UserService extends IService<UserEntity> {
void firstBindAwardsMoney(UserEntity entity);
/**
* 二要素身份证认证
*/
Object authCertNo(long userId, AuthCertNoDTO authCertNoDTO);
/**
* 四要素身份证认证
*/
Object auth(long userId, AuthDTO authDTO);
/**
* 封禁拉黑用户
* 用户行为

View File

@ -22,7 +22,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
implements UserInfoService {
@Override
public UserInfo getByUserId(long userId) {
public UserInfo getByUserIdOrSave(long userId) {
UserInfo userInfo = getOne(new LambdaQueryWrapper<UserInfo>()
.eq(UserInfo::getUserId, userId));
if (userInfo == null) {
@ -33,6 +33,17 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
return userInfo;
}
@Override
public UserInfo getByUserId(long userId) {
UserInfo userInfo = getOne(new LambdaQueryWrapper<UserInfo>()
.eq(UserInfo::getUserId, userId));
if (userInfo == null) {
userInfo = new UserInfo();
userInfo.setUserId(userId);
}
return userInfo;
}
@Override
public boolean isAuth(long userId) {
UserInfo userInfo = getOne(new LambdaQueryWrapper<UserInfo>()

View File

@ -1657,71 +1657,6 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
}
@Override
public Object authCertNo(long userId, AuthCertNoDTO authCertNoDTO) {
authCertNoDTO.setName(StrUtil.trim(authCertNoDTO.getName()));
authCertNoDTO.setIdNum(StrUtil.trim(authCertNoDTO.getIdNum()));
if (!IdcardUtil.isValidCard(authCertNoDTO.getIdNum())) {
throw new SqxException("身份证号码有误");
}
UserEntity userEntity = baseMapper.selectById(userId);
if (userEntity == null) {
throw new SqxException("用户信息不存在");
}
UserInfo userInfo = userInfoService.getByUserId(userId);
if (userInfo.getCertName() != null) {
throw new SqxException("此账号已认证");
}
Integer count = userInfoService.countCertCount(authCertNoDTO.getName(), authCertNoDTO.getIdNum());
if (count > 1) {
throw new SqxException("此实名信息已存在");
}
aliService.authCertNo(authCertNoDTO.getName(), authCertNoDTO.getIdNum());
userInfo.setCertName(authCertNoDTO.getName());
userInfo.setCertNo(authCertNoDTO.getIdNum());
userInfo.setUpdateTime(DateUtil.date());
return userInfoService.updateById(userInfo);
}
@Override
public Object auth(long userId, AuthDTO authDTO) {
authDTO.setName(StrUtil.trim(authDTO.getName()));
authDTO.setIdNum(StrUtil.trim(authDTO.getIdNum()));
authDTO.setAccountNo(StrUtil.trim(authDTO.getAccountNo()));
authDTO.setMobile(StrUtil.trim(authDTO.getMobile()));
UserEntity userEntity = baseMapper.selectById(userId);
if (userEntity == null) {
throw new SqxException("用户信息不存在");
}
UserInfo userInfo = userInfoService.getByUserId(userId);
if (StrUtil.isNotEmpty(userInfo.getCertName()) && StrUtil.isNotEmpty(userInfo.getAccountNo()) && StrUtil.isNotEmpty(userInfo.getMobile())) {
throw new SqxException("此账号已认证");
}
Integer count = userInfoService.countCertCount(authDTO.getName(), authDTO.getIdNum(), authDTO.getAccountNo(), authDTO.getMobile());
if (count > 1) {
throw new SqxException("此实名信息已存在");
}
AuthRespDTO resp = aliService.auth(authDTO.getName(), authDTO.getIdNum(), authDTO.getAccountNo(), authDTO.getMobile());
userInfo.setCertName(authDTO.getName());
userInfo.setCertNo(authDTO.getIdNum());
userInfo.setAccountNo(authDTO.getAccountNo());
userInfo.setMobile(authDTO.getMobile());
userInfo.setBankName(resp.getBankName());
userInfo.setRespJson(resp.getRespJson());
userInfo.setUpdateTime(DateUtil.date());
return userInfoService.updateById(userInfo);
}
@Override
public void addBlackUser(Long userId,String behavior) {
log.info("异常用户id, 异常操作: {},{}", userId,behavior);

View File

@ -261,6 +261,8 @@ public class TempOrdersTask {
.eq(InviteAchievement::getState, 1).select(InviteAchievement::getTargetUserId)).stream().map(InviteAchievement::getTargetUserId).collect(Collectors.toSet());
int count = 0;
if (!byUserIdList.isEmpty()) {
List<UserInfo> list = userInfoService.list(new LambdaQueryWrapper<UserInfo>().in(UserInfo::getUserId, byUserIdList).isNotNull(UserInfo::getAccountNo).select(UserInfo::getCertNo));
System.out.println(list.stream().map(UserInfo::getCertNo).collect(Collectors.toSet()));
count = userInfoService.list(new LambdaQueryWrapper<UserInfo>().in(UserInfo::getUserId, byUserIdList).isNotNull(UserInfo::getAccountNo).select(UserInfo::getCertNo))
.stream().map(UserInfo::getCertNo).collect(Collectors.toSet()).size();
}else {