分开绑定支付宝接口和实名认证接口
This commit is contained in:
@@ -100,6 +100,100 @@ public class AppController {
|
|||||||
return userService.updatePhone(phone, msg, userId);
|
return userService.updatePhone(phone, msg, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Login
|
||||||
|
@RequestMapping(value = "/bindAlipay", method = RequestMethod.POST)
|
||||||
|
@ApiOperation("绑定支付宝")
|
||||||
|
@ResponseBody
|
||||||
|
@Debounce(interval = 3000, value = "#userId")
|
||||||
|
public Result bindAlipay(@RequestAttribute("userId") Long userId,
|
||||||
|
@RequestParam String zhiFuBao,
|
||||||
|
@RequestParam String certName
|
||||||
|
) {
|
||||||
|
if (StrUtil.isAllBlank(zhiFuBao, certName)) {
|
||||||
|
return Result.error("支付宝账号或姓名不能为空");
|
||||||
|
}
|
||||||
|
UserEntity userEntity = userService.getById(userId);
|
||||||
|
if (zhiFuBao.equals(userEntity.getZhiFuBao()) && certName.equals(userEntity.getZhiFuBaoName())) {
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
int count = userService.count(new QueryWrapper<UserEntity>()
|
||||||
|
.ne("user_id", userId)
|
||||||
|
.eq("zhi_fu_bao_name", certName)
|
||||||
|
.eq("zhi_fu_bao", zhiFuBao));
|
||||||
|
if (count > 0) {
|
||||||
|
return Result.error("支付宝信息修改失败: 此支付宝账号已被绑定");
|
||||||
|
}
|
||||||
|
UserInfo userInfo = userInfoService.getByUserId(userId);
|
||||||
|
if (userInfo != null) {
|
||||||
|
if (StrUtil.isNotBlank(userInfo.getCertName()) && !certName.equals(userInfo.getCertName())) {
|
||||||
|
return Result.error("支付宝信息修改失败: 姓名与实名认证信息不相符");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!DataLimitUtil.isAccessAllowed(zhiFuBao + certName, Integer.parseInt(commonRepository.findOne(924).getValue()), "month")) {
|
||||||
|
return Result.error("支付宝信息修改失败: 相同支付宝账号每月可绑定次数已用完");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ApiAccessLimitUtil.isAccessAllowed(userId.toString(), "updateZFB", Integer.parseInt(commonRepository.findOne(925).getValue()), "month")) {
|
||||||
|
return Result.error("支付宝信息修改失败: 每月可修改次数已用完,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
userEntity.setZhiFuBao(zhiFuBao);
|
||||||
|
userEntity.setZhiFuBaoName(certName);
|
||||||
|
userService.update(userEntity, new LambdaQueryWrapper<UserEntity>().eq(UserEntity::getUserId, userId));
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Login
|
||||||
|
@RequestMapping(value = "/realNameAuth", method = RequestMethod.POST)
|
||||||
|
@ApiOperation("实名认证")
|
||||||
|
@ResponseBody
|
||||||
|
@Debounce(interval = 3000, value = "#userId")
|
||||||
|
public Result bindAlipay(@RequestAttribute("userId") Long userId,
|
||||||
|
@RequestParam String certName,
|
||||||
|
@RequestParam String certNum,
|
||||||
|
@RequestParam String accountNo,
|
||||||
|
@RequestParam String mobile
|
||||||
|
) {
|
||||||
|
if (StrUtil.isAllBlank(certName, certNum, accountNo, mobile)) {
|
||||||
|
return Result.error("真实姓名、身份证号码、银行卡号、银行预留手机号缺一不可");
|
||||||
|
}
|
||||||
|
int count = userInfoService.count(new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getUserId, userId).eq(UserInfo::getCertName, certName).eq(UserInfo::getCertNo, certNum).isNotNull(UserInfo::getAccountNo).isNotNull(UserInfo::getMobile));
|
||||||
|
if (count > 0) {
|
||||||
|
return Result.error("已完成实名认证,无需重复操作");
|
||||||
|
}
|
||||||
|
count = userInfoService.count(new LambdaQueryWrapper<UserInfo>().ne(UserInfo::getUserId, userId).eq(UserInfo::getCertName, certName).eq(UserInfo::getCertNo, certNum).isNotNull(UserInfo::getAccountNo).isNotNull(UserInfo::getMobile));
|
||||||
|
if (count > 0) {
|
||||||
|
return Result.error("实名认证失败: 此身份证信息已被其他账号绑定");
|
||||||
|
}
|
||||||
|
if (!ApiAccessLimitUtil.getCertAuthIsAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 5)) {
|
||||||
|
return Result.error("实名修改失败: 每月可修改次数已用完,请联系管理员");
|
||||||
|
}
|
||||||
|
String respJson = aliService.auth(certName, certNum, accountNo, mobile);
|
||||||
|
UserInfo userInfo = userInfoService.getByUserId(userId);
|
||||||
|
userInfo.setCertName(certName);
|
||||||
|
userInfo.setCertNo(certNum);
|
||||||
|
userInfo.setAccountNo(accountNo);
|
||||||
|
userInfo.setMobile(mobile);
|
||||||
|
userInfo.setRespJson(respJson);
|
||||||
|
userInfo.setUpdateTime(DateUtil.date());
|
||||||
|
boolean update = userInfoService.update(userInfo, new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getUserId, userId).eq(UserInfo::getId, userInfo.getId()));
|
||||||
|
if (!update) {
|
||||||
|
return Result.error("实名修改失败: 请稍后重试");
|
||||||
|
}
|
||||||
|
// 校验实名信息是否在黑名单里面
|
||||||
|
count = tbUserBlacklistMapper.selectCount(new LambdaQueryWrapper<TbUserBlacklist>().eq(TbUserBlacklist::getIdCardNo, certNum));
|
||||||
|
if (count > 0) {
|
||||||
|
UserEntity userEntity = userService.getById(userId);
|
||||||
|
userEntity.setStatus(0);
|
||||||
|
userService.update(userEntity, new LambdaQueryWrapper<UserEntity>().eq(UserEntity::getUserId, userId));
|
||||||
|
log.warn("异常行为用户:实名信息异常: {}", userId);
|
||||||
|
return Result.error("异常行为: 您的实名信息存在异常行为");
|
||||||
|
}
|
||||||
|
ApiAccessLimitUtil.setCertAuthIsAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 1, "month");
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Login
|
@Login
|
||||||
@RequestMapping(value = "/updateUser", method = RequestMethod.POST)
|
@RequestMapping(value = "/updateUser", method = RequestMethod.POST)
|
||||||
@ApiOperation("用户修改个人信息")
|
@ApiOperation("用户修改个人信息")
|
||||||
|
|||||||
Reference in New Issue
Block a user