提现全面使用银行卡
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);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class CashOutTask{
|
||||
public class CashOutTask {
|
||||
|
||||
@Resource
|
||||
private CashOutDao cashOutDao;
|
||||
@@ -42,26 +42,26 @@ public class CashOutTask{
|
||||
cashOut.setOrderNumber(outOrderNo);
|
||||
|
||||
boolean isUser = cashOut.getUserType() != 2;
|
||||
BaseResp baseResp = wuyouPay.extractOrder(outOrderNo, cashOut.getUserId(), isUser, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
BaseResp baseResp = wuyouPay.extractOrder(outOrderNo, cashOut.getUserId(), isUser, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName(), cashOut.getBankName());
|
||||
if (baseResp.getStatus() != null && baseResp.getStatus().equals(2)) {
|
||||
cashOut.setState(1);
|
||||
} else {
|
||||
cashOut.setState(2);
|
||||
cashOut.setRefund(StringUtils.isNotBlank(baseResp.getMsg()) ? baseResp.getMsg() : baseResp.getErrorMsg());
|
||||
if (cashOut.getRefund().contains("收款人账户号出款属性不匹配") || cashOut.getRefund().contains("已驳回")) {
|
||||
cashOut.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||
cashOut.setRefund("提现失败,请检查收款账号与收款人姓名后重试。");
|
||||
} else {
|
||||
cashOut.setRefund(baseResp.getErrorMsg());
|
||||
}
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||
cashOut.getUserId(), null, null, "提现失败", 4, 1, 1,
|
||||
new BigDecimal(cashOut.getMoney()), "提现失败存入余额" + cashOut.getMoney() + "元", 1,cashOut.getId());
|
||||
new BigDecimal(cashOut.getMoney()), "提现失败存入余额" + cashOut.getMoney() + "元", 1, cashOut.getId());
|
||||
|
||||
//存入余额 钱
|
||||
userMoneyService.updateAmount(1, cashOut.getUserId(), Double.parseDouble(cashOut.getMoney()));
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
cashOut.setState(3);
|
||||
}
|
||||
cashOutDao.updateById(cashOut);
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
||||
import com.sqx.modules.app.service.UserMoneyService;
|
||||
import com.sqx.modules.banner.entity.Activity;
|
||||
import com.sqx.modules.pay.dao.CashOutDao;
|
||||
import com.sqx.modules.pay.entity.CashOut;
|
||||
import com.sqx.modules.pay.entity.WithdrawTypeEnum;
|
||||
@@ -15,17 +14,15 @@ import com.sqx.modules.utils.AliPayOrderUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class CashOutTask2{
|
||||
public class CashOutTask2 {
|
||||
|
||||
@Resource
|
||||
private CashOutDao cashOutDao;
|
||||
@@ -54,20 +51,20 @@ public class CashOutTask2{
|
||||
String outOrderNo = AliPayOrderUtil.createOrderId();
|
||||
cashOut.setOrderNumber(outOrderNo);
|
||||
boolean isUser = cashOut.getUserType() != 2;
|
||||
BaseResp baseResp = wuyouPay.extractOrder(outOrderNo, cashOut.getUserId(), isUser, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
BaseResp baseResp = wuyouPay.extractOrder(outOrderNo, cashOut.getUserId(), isUser, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName(), cashOut.getBankName());
|
||||
if (baseResp.getStatus() != null && baseResp.getStatus().equals(2)) {
|
||||
cashOut.setState(1);
|
||||
} else {
|
||||
cashOut.setState(2);
|
||||
cashOut.setRefund(StringUtils.isNotBlank(baseResp.getMsg()) ? baseResp.getMsg() : baseResp.getErrorMsg());
|
||||
if (cashOut.getRefund().contains("收款人账户号出款属性不匹配") || cashOut.getRefund().contains("已驳回")) {
|
||||
cashOut.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||
cashOut.setRefund("提现失败,请检查收款账号与收款人姓名后重试。");
|
||||
} else {
|
||||
cashOut.setRefund(baseResp.getErrorMsg());
|
||||
}
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||
cashOut.getUserId(), null, null, "提现失败", 4, 1, 1,
|
||||
new BigDecimal(cashOut.getMoney()), "提现失败存入余额" + cashOut.getMoney() + "元", 1,cashOut.getId());
|
||||
new BigDecimal(cashOut.getMoney()), "提现失败存入余额" + cashOut.getMoney() + "元", 1, cashOut.getId());
|
||||
|
||||
//存入余额 钱
|
||||
userMoneyService.updateAmount(1, cashOut.getUserId(), Double.parseDouble(cashOut.getMoney()));
|
||||
|
||||
@@ -290,7 +290,7 @@ public class CashController {
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/alipay/{cashId}", method = RequestMethod.POST)
|
||||
//@RequestMapping(value = "/alipay/{cashId}", method = RequestMethod.POST)
|
||||
@ApiOperation("管理平台确认提现")
|
||||
@ResponseBody
|
||||
@Debounce(interval = 3000, value = "#cashId")
|
||||
|
||||
@@ -73,6 +73,11 @@ public class CashOut implements Serializable {
|
||||
*/
|
||||
private String zhifubaoName;
|
||||
|
||||
/**
|
||||
* 银行名称
|
||||
*/
|
||||
private String bankName;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
@@ -145,4 +150,8 @@ public class CashOut implements Serializable {
|
||||
private Long verifyCount;
|
||||
|
||||
private Integer withdrawType;
|
||||
|
||||
public void setZhifubao(String zhifubao) {
|
||||
this.zhifubao = zhifubao;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@@ -184,8 +186,9 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
titles.add("编号");
|
||||
titles.add("用户类型");
|
||||
titles.add("用户名称");
|
||||
titles.add("支付宝账号");
|
||||
titles.add("支付宝名称");
|
||||
titles.add("收款账号");
|
||||
titles.add("真实姓名");
|
||||
titles.add("开户银行");
|
||||
titles.add("提现金币");
|
||||
titles.add("状态");
|
||||
titles.add("拒绝原因");
|
||||
@@ -206,6 +209,7 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
}
|
||||
row.add(cashOut.getZhifubao());
|
||||
row.add(cashOut.getZhifubaoName());
|
||||
row.add(StrUtil.nullToDefault(cashOut.getBankName(), ""));
|
||||
row.add(cashOut.getMoney());
|
||||
|
||||
if (cashOut.getState() == -1) {
|
||||
@@ -391,6 +395,18 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
// UserMoney userMoney=userMoneyService.selectUserMoneyByUserId(userId);
|
||||
InviteMoney inviteMoney = inviteMoneyService.selectInviteMoneyByUserId(userId);
|
||||
UserEntity userEntity = userService.selectUserById(userId);
|
||||
UserInfo userInfo = userInfoService.getByUserId(userId);
|
||||
if (userInfo == null) {
|
||||
return Result.success("未完成实名认证,请先完成实名认证再进行提现操作!");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(userInfo.getCertName())
|
||||
&& StrUtil.isNotEmpty(userInfo.getCertNo())
|
||||
&& StrUtil.isNotEmpty(userInfo.getAccountNo())
|
||||
&& StrUtil.isNotEmpty(userInfo.getMobile())
|
||||
) {
|
||||
} else {
|
||||
return Result.success("未完成实名认证,请先完成实名认证再进行提现操作!");
|
||||
}
|
||||
// 提现判断金币是否足够 金币=提现金币+手续费
|
||||
Double moneySum = AmountCalUtils.add(new BigDecimal(money), new BigDecimal(mul)).doubleValue();
|
||||
// 用户金币足够
|
||||
@@ -412,8 +428,8 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
CashOut cashOut = new CashOut();
|
||||
cashOut.setState(0);
|
||||
cashOut.setZhifubao(userEntity.getZhiFuBao());
|
||||
cashOut.setZhifubaoName(userEntity.getZhiFuBaoName());
|
||||
cashOut.setZhifubao(userInfo.getAccountNo());
|
||||
cashOut.setZhifubaoName(userInfo.getCertName());
|
||||
cashOut.setMoney(money.toString());
|
||||
cashOut.setCreateAt(sdf.format(new Date()));
|
||||
cashOut.setUserId(userEntity.getUserId());
|
||||
@@ -502,6 +518,7 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
|
||||
String alipayAccount;
|
||||
String alipayName;
|
||||
String bankName;
|
||||
Set<String> withdrawCheckNameSet = new HashSet<>();
|
||||
if (isSys) {
|
||||
SysUserEntity sysUserEntity = sysUserService.getById(userId);
|
||||
@@ -514,15 +531,13 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
}
|
||||
alipayAccount = sysUserEntity.getZhiFuBao();
|
||||
alipayName = sysUserEntity.getZhiFuBaoName();
|
||||
bankName = null;
|
||||
withdrawCheckNameSet.add(alipayName);
|
||||
} else {
|
||||
UserEntity userInfo = userService.queryByUserId(userId);
|
||||
if (userInfo.getStatus().equals(0)) {
|
||||
return Result.error(9999, "账号不存在!");
|
||||
}
|
||||
if (StringUtils.isBlank(userInfo.getZhiFuBao()) || StringUtils.isBlank(userInfo.getZhiFuBaoName())) {
|
||||
return Result.error(9999, "请先绑定支付宝账号!");
|
||||
}
|
||||
|
||||
UserInfo userDetailInfo = userInfoService.getOne(new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getUserId, userId));
|
||||
if (userDetailInfo == null || StrUtil.isBlank(userDetailInfo.getCertName())) {
|
||||
@@ -531,15 +546,18 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
if (StrUtil.isEmpty(userDetailInfo.getAccountNo()) || StrUtil.isEmpty(userDetailInfo.getMobile())) {
|
||||
return Result.error(9991, "需重新完成实名认证后才可提现!");
|
||||
}
|
||||
|
||||
if (!userInfo.getZhiFuBaoName().equals(userDetailInfo.getCertName())) {
|
||||
return Result.error(500, "支付宝和实名姓名不符无法提现!");
|
||||
if (StrUtil.isEmpty(userDetailInfo.getBankName()) && StrUtil.isNotEmpty(userDetailInfo.getRespJson())) {
|
||||
userDetailInfo.setBankName(getBankName(userDetailInfo.getRespJson()));
|
||||
userInfoService.updateById(userDetailInfo);
|
||||
}
|
||||
alipayAccount = userInfo.getZhiFuBao();
|
||||
alipayName = userInfo.getZhiFuBaoName();
|
||||
String certName = userDetailInfo.getCertName();
|
||||
if (StrUtil.isEmpty(userDetailInfo.getBankName())) {
|
||||
userInfoService.removeById(userDetailInfo.getId());
|
||||
return Result.error(9991, "需重新完成实名认证后才可提现!");
|
||||
}
|
||||
alipayAccount = userDetailInfo.getAccountNo();
|
||||
alipayName = userDetailInfo.getCertName();
|
||||
bankName = userDetailInfo.getBankName();
|
||||
withdrawCheckNameSet.add(alipayName);
|
||||
withdrawCheckNameSet.add(certName);
|
||||
}
|
||||
|
||||
// 最低提现金额
|
||||
@@ -560,7 +578,7 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
|
||||
cashOut.setZhifubao(alipayAccount);
|
||||
cashOut.setZhifubaoName(alipayName);
|
||||
|
||||
cashOut.setBankName(bankName);
|
||||
cashOut.setState(0);
|
||||
cashOut.setRate(0.00);
|
||||
cashOut.setCreateAt(DateUtil.now());
|
||||
@@ -588,7 +606,7 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
}
|
||||
if (wuyouPay.checkCanCash(userId, WithdrawTypeEnum.MANUAL, new BigDecimal(money.toString()))) {
|
||||
cashOut.setStatus(4);
|
||||
BaseResp baseResp = wuyouPay.extractOrder(outOrderNo, cashOut.getUserId(), false, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
BaseResp baseResp = wuyouPay.extractOrder(outOrderNo, cashOut.getUserId(), false, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName(), cashOut.getBankName());
|
||||
if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))) {
|
||||
sysUserMoneyDetails.setContent("成功提现:" + money);
|
||||
cashOut.setState(1);
|
||||
@@ -632,7 +650,7 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
} else {
|
||||
if (wuyouPay.checkCanCash(userId, WithdrawTypeEnum.MANUAL, new BigDecimal(money.toString()))) {
|
||||
cashOut.setStatus(4);
|
||||
BaseResp baseResp = wuyouPay.extractOrder(outOrderNo, cashOut.getUserId(), true, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
BaseResp baseResp = wuyouPay.extractOrder(outOrderNo, cashOut.getUserId(), true, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName(), cashOut.getBankName());
|
||||
if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))) {
|
||||
userMoneyDetails.setContent("成功提现:" + money);
|
||||
cashOut.setState(1);
|
||||
@@ -654,6 +672,20 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
return Result.success("提现成功,将在三个工作日内到账,请耐心等待!");
|
||||
}
|
||||
|
||||
private String getBankName(String respJson) {
|
||||
JSONObject ret = JSONUtil.parseObj(respJson);
|
||||
JSONObject result = ret.getJSONObject("result");
|
||||
Integer errorCode = ret.getInt("error_code");
|
||||
String respCode = result.getStr("respCode");
|
||||
if (errorCode == 0 && "0".equals(respCode)) {
|
||||
boolean isExist = result.containsKey("bancardInfor");
|
||||
if (isExist) {
|
||||
return result.getJSONObject("bancardInfor").getStr("bankName");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils auditPage(Map<String, Object> params) {
|
||||
PageHelper.startPage(ParamPageUtils.getPageNum(params), ParamPageUtils.getPageSize(params));
|
||||
@@ -672,6 +704,9 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
if (StrUtil.isNotBlank(cashOut.getZhifubao())) {
|
||||
queryWrapper.like(CashOut::getZhifubao, cashOut.getZhifubao());
|
||||
}
|
||||
if (StrUtil.isNotBlank(cashOut.getBankName())) {
|
||||
queryWrapper.like(CashOut::getBankName, cashOut.getBankName());
|
||||
}
|
||||
if (cashOut.getUserType() != null) {
|
||||
queryWrapper.eq(CashOut::getUserType, cashOut.getUserType());
|
||||
}
|
||||
@@ -747,6 +782,7 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
if (userEntity == null) {
|
||||
throw new SqxException("提现用户信息不存在!");
|
||||
}
|
||||
|
||||
} else {
|
||||
SysUserEntity sysUserEntity = sysUserService.getById(entity.getUserId());
|
||||
if (sysUserEntity == null) {
|
||||
@@ -758,6 +794,11 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
backCashAmount(entity);
|
||||
return;
|
||||
}
|
||||
boolean isHistoryData = false;
|
||||
// 历史数据使用原有的提现方式,新数据再进行银行卡提现
|
||||
if (isAgree == 1 && isUser && StrUtil.isBlank(cashOut.getBankName())) {
|
||||
isHistoryData = true;
|
||||
}
|
||||
entity.setState(4);
|
||||
baseMapper.update(entity, new LambdaQueryWrapper<CashOut>().eq(CashOut::getUserId, entity.getUserId()).eq(CashOut::getId, entity.getId()));
|
||||
if (StrUtil.isBlank(entity.getOrderNumber())) {
|
||||
@@ -765,20 +806,20 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
entity.setOrderNumber(outOrderNo);
|
||||
}
|
||||
// 执行提现操作
|
||||
BaseResp baseResp = wuyouPay.extractOrderForAudit(entity.getOrderNumber(), entity.getUserId(), isUser, entity.getMoney(), entity.getZhifubao(), entity.getZhifubaoName());
|
||||
BaseResp baseResp = wuyouPay.extractOrderForAudit(isHistoryData, entity.getOrderNumber(), entity.getUserId(), isUser, entity.getMoney(), entity.getZhifubao(), entity.getZhifubaoName(), entity.getBankName());
|
||||
if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))) {
|
||||
entity.setState(1);
|
||||
} else if (StringUtils.isNotBlank(baseResp.getErrorMsg())) {
|
||||
entity.setState(2);
|
||||
if (baseResp.getErrorMsg().contains("收款人账户号出款属性不匹配")) {
|
||||
entity.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||
entity.setRefund("提现失败,请检查收款账号与收款人姓名后重试。");
|
||||
} else {
|
||||
entity.setRefund(baseResp.getErrorMsg());
|
||||
}
|
||||
backCashAmount(entity);
|
||||
} else if (StringUtils.isNotBlank(baseResp.getMsg())) {
|
||||
entity.setState(2);
|
||||
entity.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||
entity.setRefund("提现失败,请检查收款账号与收款人姓名后重试。");
|
||||
backCashAmount(entity);
|
||||
}
|
||||
updateByUserId(entity);
|
||||
|
||||
@@ -165,14 +165,19 @@ public class WuyouPay {
|
||||
* @param account 支付宝账号
|
||||
* @param userName 支付宝名称
|
||||
*/
|
||||
public BaseResp extractOrderForAudit(String outOrderNo, Long userId, boolean isUser, String amount, String account, String userName) {
|
||||
public BaseResp extractOrderForAudit(boolean isHistoryData, String outOrderNo, Long userId, boolean isUser, String amount, String account,
|
||||
String userName, String bankName) {
|
||||
Map<String, Object> params = getBaseParams();
|
||||
|
||||
params.put("out_trade_no", String.format("%s-%s:%s", outOrderNo, userId, isUser ? "us" : "dl"));
|
||||
params.put("total", amount);
|
||||
params.put("bank_card", account);
|
||||
params.put("bank_account_name", userName);
|
||||
params.put("bank_name", "1");
|
||||
if (isHistoryData) {
|
||||
params.put("bank_name", "1");
|
||||
} else {
|
||||
params.put("bank_name", isUser ? bankName : "1");
|
||||
}
|
||||
params.put("bank_branch", "1");
|
||||
params.put("province", "1");
|
||||
params.put("city", "1");
|
||||
@@ -182,7 +187,7 @@ public class WuyouPay {
|
||||
params.put("sign", sign);
|
||||
|
||||
params.put("business_type", 0);
|
||||
params.put("business_attr", "alipay");
|
||||
params.put("business_attr", isUser ? "unionpay" : "alipay");
|
||||
|
||||
String body = request(Constants.EXTRACT_URL, params, "");
|
||||
return JSONObject.parseObject(body, BaseResp.class);
|
||||
@@ -200,7 +205,7 @@ public class WuyouPay {
|
||||
return JSONObject.parseObject(body, BaseResp.class);
|
||||
}
|
||||
|
||||
public BaseResp queryExtractOrder(String outOrderNo,String amount) {
|
||||
public BaseResp queryExtractOrder(String outOrderNo, String amount) {
|
||||
Map<String, Object> params = getBaseParams();
|
||||
params.put("out_trade_no", String.format("%s", outOrderNo));
|
||||
params.put("total", amount);
|
||||
@@ -238,7 +243,7 @@ public class WuyouPay {
|
||||
|
||||
Map<String, Object> params = pay.getBaseParams();
|
||||
|
||||
params.put("out_trade_no", String.format("%s-%s:%s", "1111122223333", "26924", "us"));
|
||||
params.put("out_trade_no", String.format("%s-%s:%s", "1111122223333", "26924", "us"));
|
||||
params.put("total", "0.1");
|
||||
params.put("bank_card", "6214831259609102");
|
||||
params.put("bank_account_name", "巩奕杰");
|
||||
|
||||
@@ -28,7 +28,7 @@ spring:
|
||||
redis:
|
||||
open: true # 是否开启redis缓存 true开启 false关闭
|
||||
database: 0
|
||||
host: localhost
|
||||
host: 47.122.26.160
|
||||
port: 6379
|
||||
password: 111111 # 密码(默认为空)
|
||||
timeout: 6000ms # 连接超时时长(毫秒)
|
||||
|
||||
Reference in New Issue
Block a user