提现全面使用银行卡
This commit is contained in:
@@ -4,7 +4,6 @@ package com.sqx.modules.app.controller.app;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.IdcardUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -17,6 +16,7 @@ import com.sqx.common.utils.DesensitizedUtil;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.app.annotation.LoginUser;
|
||||
import com.sqx.modules.app.dto.AuthRespDTO;
|
||||
import com.sqx.modules.app.entity.TbUserBlacklist;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.entity.UserInfo;
|
||||
@@ -157,144 +157,56 @@ public class AppController {
|
||||
@RequestParam String accountNo,
|
||||
@RequestParam String mobile
|
||||
) {
|
||||
return Result.error("系统优化中,请稍后再试");
|
||||
// if (StrUtil.isAllBlank(certName, certNum, accountNo, mobile)) {
|
||||
// return Result.error("真实姓名、身份证号码、银行卡号、银行预留手机号缺一不可");
|
||||
// }
|
||||
// if(certNum.contains("*") || accountNo.contains("*") || mobile.contains("*")){
|
||||
// return Result.success();
|
||||
// }
|
||||
// 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("实名修改失败: 请稍后重试");
|
||||
// }
|
||||
// ApiAccessLimitUtil.setCertAuthIsAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 1, "month");
|
||||
// // 校验实名信息是否在黑名单里面
|
||||
// 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("异常行为: 您的实名信息存在异常行为");
|
||||
// }
|
||||
// return Result.success();
|
||||
}
|
||||
|
||||
|
||||
//@Login
|
||||
//@RequestMapping(value = "/updateUser", method = RequestMethod.POST)
|
||||
@ApiOperation("用户修改个人信息")
|
||||
@ResponseBody
|
||||
@Debounce(interval = 3000, value = "#userId")
|
||||
public Result updateUserImageUrl(@RequestAttribute("userId") Long userId,
|
||||
@RequestParam(required = false) String zhiFuBao,
|
||||
@RequestParam String certName,
|
||||
@RequestParam(required = false) String certNum,
|
||||
@RequestParam(required = false) String accountNo,
|
||||
@RequestParam(required = false) String mobile
|
||||
) {
|
||||
if (StrUtil.isAllBlank(zhiFuBao, certNum)) {
|
||||
return Result.error("支付宝账号或实名身份证号码必须传递一个");
|
||||
if (StrUtil.isAllBlank(certName, certNum, accountNo, mobile)) {
|
||||
return Result.error("真实姓名、身份证号码、银行卡号、银行预留手机号缺一不可");
|
||||
}
|
||||
|
||||
UserInfo userInfo = userInfoService.getByUserId(userId);
|
||||
UserEntity userEntity = userService.getById(userId);
|
||||
|
||||
if (StrUtil.isNotBlank(zhiFuBao) && (!zhiFuBao.equals(userEntity.getZhiFuBao())) || !certName.equals(userEntity.getZhiFuBaoName())) {
|
||||
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("支付宝信息修改失败: 此支付宝账号已被绑定");
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(certNum)) {
|
||||
if(certNum.contains("*") || accountNo.contains("*") || mobile.contains("*")){
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
if (!certNum.equals(userInfo.getCertNo())
|
||||
|| !certName.equals(userInfo.getCertName())
|
||||
|| !accountNo.equals(userInfo.getAccountNo())
|
||||
|| !mobile.equals(userInfo.getMobile())
|
||||
) {
|
||||
if (StrUtil.isNotBlank(userEntity.getZhiFuBaoName()) && !certName.equals(userEntity.getZhiFuBaoName())) {
|
||||
return Result.error("实名修改失败: 姓名与绑定支付宝信息不相符");
|
||||
}
|
||||
if (!IdcardUtil.isValidCard(certNum)) {
|
||||
return Result.error("实名修改失败: 身份证号码有误");
|
||||
}
|
||||
|
||||
Integer idCount = userInfoService.countCertCount(certName, certNum);
|
||||
if (idCount >= 1) {
|
||||
return Result.error("实名修改失败: 此身份证信息已绑定过");
|
||||
}
|
||||
|
||||
try {
|
||||
// 校验实名信息是否在黑名单里面
|
||||
Integer count = tbUserBlacklistMapper.selectCount(new LambdaQueryWrapper<TbUserBlacklist>().eq(TbUserBlacklist::getRealName, certName)
|
||||
.eq(TbUserBlacklist::getIdCardNo, certNum));
|
||||
if (count > 0) {
|
||||
userEntity.setStatus(0);
|
||||
userService.update(userEntity, new LambdaQueryWrapper<UserEntity>().eq(UserEntity::getUserId, userId));
|
||||
log.warn("异常行为用户:实名信息异常: {}", userId);
|
||||
return Result.error("异常行为: 您的实名信息存在异常行为");
|
||||
}
|
||||
|
||||
String respJson = aliService.auth(certName, certNum, accountNo, mobile);
|
||||
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("实名修改失败: 请稍后重试");
|
||||
}
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error("实名修改失败: 身份证信息不匹配");
|
||||
}
|
||||
int count = userInfoService.count(Wrappers.<UserInfo>lambdaQuery()
|
||||
.eq(UserInfo::getUserId, userId).eq(UserInfo::getCertName, certName)
|
||||
.eq(UserInfo::getCertNo, certNum)
|
||||
.isNotNull(UserInfo::getAccountNo)
|
||||
.isNotNull(UserInfo::getMobile)
|
||||
.isNotNull(UserInfo::getBankName)
|
||||
);
|
||||
if (count > 0) {
|
||||
return Result.error("已完成实名认证,无需重复操作");
|
||||
}
|
||||
count = userInfoService.count(Wrappers.<UserInfo>lambdaQuery()
|
||||
.ne(UserInfo::getUserId, userId)
|
||||
.eq(UserInfo::getCertName, certName)
|
||||
.eq(UserInfo::getCertNo, certNum)
|
||||
);
|
||||
if (count > 0) {
|
||||
return Result.error("实名认证失败: 此身份证信息已被其他账号绑定");
|
||||
}
|
||||
if (!ApiAccessLimitUtil.getCertAuthIsAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 5)) {
|
||||
return Result.error("实名修改失败: 每月可修改次数已用完,请联系管理员");
|
||||
}
|
||||
AuthRespDTO resp = aliService.auth(certName, certNum, accountNo, mobile);
|
||||
UserInfo userInfo = userInfoService.getByUserId(userId);
|
||||
userInfo.setCertName(certName);
|
||||
userInfo.setCertNo(certNum);
|
||||
userInfo.setAccountNo(accountNo);
|
||||
userInfo.setMobile(mobile);
|
||||
userInfo.setBankName(resp.getBankName());
|
||||
userInfo.setRespJson(resp.getRespJson());
|
||||
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("实名修改失败: 请稍后重试");
|
||||
}
|
||||
ApiAccessLimitUtil.setCertAuthIsAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 1, "month");
|
||||
// 校验实名信息是否在黑名单里面
|
||||
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("异常行为: 您的实名信息存在异常行为");
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,7 @@ package com.sqx.modules.app.controller.app;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.sqx.common.annotation.Debounce;
|
||||
import com.sqx.common.utils.ApiAccessLimitUtil;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.app.dao.AuthCertNoDTO;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.service.IAppleService;
|
||||
import com.sqx.modules.app.service.UserService;
|
||||
@@ -22,7 +19,6 @@ import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import weixin.popular.api.SnsAPI;
|
||||
import weixin.popular.bean.sns.SnsToken;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.sqx.modules.app.dao;
|
||||
package com.sqx.modules.app.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.sqx.modules.app.dao;
|
||||
package com.sqx.modules.app.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
13
src/main/java/com/sqx/modules/app/dto/AuthRespDTO.java
Normal file
13
src/main/java/com/sqx/modules/app/dto/AuthRespDTO.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.sqx.modules.app.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-09 10:37
|
||||
*/
|
||||
@Data
|
||||
public class AuthRespDTO {
|
||||
private String respJson;
|
||||
private String bankName;
|
||||
}
|
||||
@@ -49,6 +49,11 @@ public class UserInfo implements Serializable {
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 银行预留手机号
|
||||
*/
|
||||
private String bankName;
|
||||
|
||||
/**
|
||||
* 四要素接口响应报文
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.sqx.modules.app.service;
|
||||
|
||||
|
||||
import com.sqx.modules.app.dto.AuthRespDTO;
|
||||
|
||||
public interface AliService {
|
||||
void authCertNo(String name, String idCard);
|
||||
|
||||
String auth(String name, String idCard, String accountNo, String bankPreMobile);
|
||||
AuthRespDTO auth(String name, String idCard, String accountNo, String bankPreMobile);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.dao.AuthCertNoDTO;
|
||||
import com.sqx.modules.app.dao.AuthDTO;
|
||||
import com.sqx.modules.app.dto.AuthCertNoDTO;
|
||||
import com.sqx.modules.app.dto.AuthDTO;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.aliyun.dytnsapi20200217.models.CertNoTwoElementVerificationRequest;
|
||||
import com.aliyun.dytnsapi20200217.models.CertNoTwoElementVerificationResponse;
|
||||
import com.aliyun.teautil.models.RuntimeOptions;
|
||||
import com.sqx.common.exception.SqxException;
|
||||
import com.sqx.modules.app.dto.AuthRespDTO;
|
||||
import com.sqx.modules.app.service.AliService;
|
||||
import com.sqx.modules.common.entity.CommonInfo;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
@@ -87,7 +88,7 @@ public class AliServiceImpl implements AliService {
|
||||
* @param bankPreMobile
|
||||
*/
|
||||
@Override
|
||||
public String auth(String name, String idCard, String accountNo, String bankPreMobile) {
|
||||
public AuthRespDTO auth(String name, String idCard, String accountNo, String bankPreMobile) {
|
||||
log.info("阿里云四要素认证请求参数: {} {} {} {}", name, idCard, accountNo, bankPreMobile);
|
||||
if (StrUtil.isBlank(name)) {
|
||||
throw new SqxException("持卡人姓名不能为空");
|
||||
@@ -132,9 +133,17 @@ public class AliServiceImpl implements AliService {
|
||||
Integer errorCode = ret.getInt("error_code");
|
||||
String respCode = result.getStr("respCode");
|
||||
if (errorCode == 0 && "0".equals(respCode)) {
|
||||
}else{
|
||||
} else {
|
||||
throw new SqxException(result.getStr("respMsg"));
|
||||
}
|
||||
return respBody;
|
||||
String bankName = null;
|
||||
boolean isExist = result.containsKey("bancardInfor");
|
||||
if (isExist) {
|
||||
bankName = result.getJSONObject("bancardInfor").getStr("bankName");
|
||||
}
|
||||
AuthRespDTO dto = new AuthRespDTO();
|
||||
dto.setBankName(bankName);
|
||||
dto.setRespJson(respBody);
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package com.sqx.modules.app.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.IdcardUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -41,7 +39,12 @@ import com.sqx.common.exception.SqxException;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.dao.*;
|
||||
import com.sqx.modules.app.dao.MsgDao;
|
||||
import com.sqx.modules.app.dao.UserDao;
|
||||
import com.sqx.modules.app.dao.UserVipDao;
|
||||
import com.sqx.modules.app.dto.AuthCertNoDTO;
|
||||
import com.sqx.modules.app.dto.AuthDTO;
|
||||
import com.sqx.modules.app.dto.AuthRespDTO;
|
||||
import com.sqx.modules.app.entity.*;
|
||||
import com.sqx.modules.app.mapper.TbUserBlacklistMapper;
|
||||
import com.sqx.modules.app.service.*;
|
||||
@@ -1689,13 +1692,14 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
throw new SqxException("此实名信息已存在");
|
||||
}
|
||||
|
||||
String respJson = aliService.auth(authDTO.getName(), authDTO.getIdNum(), authDTO.getAccountNo(), authDTO.getMobile());
|
||||
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.setRespJson(respJson);
|
||||
userInfo.setBankName(resp.getBankName());
|
||||
userInfo.setRespJson(resp.getRespJson());
|
||||
userInfo.setUpdateTime(DateUtil.date());
|
||||
return userInfoService.updateById(userInfo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user