用户提现支持支付宝
This commit is contained in:
@@ -540,7 +540,7 @@ public class CashController {
|
|||||||
redisUtils.set(lockKey, true, 30);
|
redisUtils.set(lockKey, true, 30);
|
||||||
Result ret = Result.error();
|
Result ret = Result.error();
|
||||||
try {
|
try {
|
||||||
ret = cashOutService.withdraw(userId, money, msg, true);
|
ret = cashOutService.withdraw(userId, money, msg, true, true);
|
||||||
int code = Convert.toInt(ret.get("code"),-1);
|
int code = Convert.toInt(ret.get("code"),-1);
|
||||||
if(code == 0){
|
if(code == 0){
|
||||||
redisUtils.set(intervalKey, true, 60 * 3);
|
redisUtils.set(intervalKey, true, 60 * 3);
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class AppCashController {
|
|||||||
@GetMapping(value = "/withdraw")
|
@GetMapping(value = "/withdraw")
|
||||||
@Debounce(interval = 3000, value = "#userId")
|
@Debounce(interval = 3000, value = "#userId")
|
||||||
@ApiOperation("发起提现 余额 金钱")
|
@ApiOperation("发起提现 余额 金钱")
|
||||||
public Result withdraw(@RequestAttribute("userId") Long userId, Double amount) {
|
public Result withdraw(@RequestAttribute("userId") Long userId, Double amount, Integer isAlipay) {
|
||||||
String intervalKey = StrUtil.format("user:withdraw:interval:limit:user:{}", userId);
|
String intervalKey = StrUtil.format("user:withdraw:interval:limit:user:{}", userId);
|
||||||
String lockKey = StrUtil.format("user:withdraw:interval:limit:user:lock:{}", userId);
|
String lockKey = StrUtil.format("user:withdraw:interval:limit:user:lock:{}", userId);
|
||||||
if (redisUtils.hasKey(lockKey)) {
|
if (redisUtils.hasKey(lockKey)) {
|
||||||
@@ -110,7 +110,10 @@ public class AppCashController {
|
|||||||
}
|
}
|
||||||
Result ret = Result.error();
|
Result ret = Result.error();
|
||||||
try {
|
try {
|
||||||
ret = cashOutService.withdraw(userId, amount, null, false);
|
if (isAlipay == null) {
|
||||||
|
isAlipay = 0;
|
||||||
|
}
|
||||||
|
ret = cashOutService.withdraw(userId, amount, null, false, isAlipay == 1);
|
||||||
int code = Convert.toInt(ret.get("code"), -1);
|
int code = Convert.toInt(ret.get("code"), -1);
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
redisService.removeCanCashFlag(userId);
|
redisService.removeCanCashFlag(userId);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public interface CashOutService {
|
|||||||
* @param money 提现金额
|
* @param money 提现金额
|
||||||
* @param isSys 是否是系统用户提现
|
* @param isSys 是否是系统用户提现
|
||||||
*/
|
*/
|
||||||
Result withdraw(Long userId, Double money, String msg, boolean isSys);
|
Result withdraw(Long userId, Double money, String msg, boolean isSys, boolean isAlipay);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提现审核分页查询
|
* 提现审核分页查询
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Result withdraw(Long userId, Double money, String msg, boolean isSys) {
|
public Result withdraw(Long userId, Double money, String msg, boolean isSys, boolean isAlipay) {
|
||||||
if (money == null || money <= 0.00) {
|
if (money == null || money <= 0.00) {
|
||||||
return Result.error("请不要输入小于0的数字,请输入正确的提现金额!");
|
return Result.error("请不要输入小于0的数字,请输入正确的提现金额!");
|
||||||
}
|
}
|
||||||
@@ -622,7 +622,7 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
|||||||
try {
|
try {
|
||||||
wuyouPay.checkCanCash(userId, WithdrawTypeEnum.MANUAL, new BigDecimal(money.toString()));
|
wuyouPay.checkCanCash(userId, WithdrawTypeEnum.MANUAL, new BigDecimal(money.toString()));
|
||||||
cashOut.setStatus(4);
|
cashOut.setStatus(4);
|
||||||
BaseResp baseResp = wuyouPay.extractOrder(outOrderNo, cashOut.getUserId(), false, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName(), cashOut.getBankName());
|
BaseResp baseResp = wuyouPay.extractOrder(isAlipay, outOrderNo, cashOut.getUserId(), false, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName(), cashOut.getBankName());
|
||||||
if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))) {
|
if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))) {
|
||||||
sysUserMoneyDetails.setContent("成功提现:" + money);
|
sysUserMoneyDetails.setContent("成功提现:" + money);
|
||||||
cashOut.setState(1);
|
cashOut.setState(1);
|
||||||
@@ -668,7 +668,7 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
|||||||
try {
|
try {
|
||||||
wuyouPay.checkCanCash(userId, WithdrawTypeEnum.MANUAL, new BigDecimal(money.toString()));
|
wuyouPay.checkCanCash(userId, WithdrawTypeEnum.MANUAL, new BigDecimal(money.toString()));
|
||||||
cashOut.setStatus(4);
|
cashOut.setStatus(4);
|
||||||
BaseResp baseResp = wuyouPay.extractOrder(outOrderNo, cashOut.getUserId(), true, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName(), cashOut.getBankName());
|
BaseResp baseResp = wuyouPay.extractOrder(isAlipay, outOrderNo, cashOut.getUserId(), true, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName(), cashOut.getBankName());
|
||||||
if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))) {
|
if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))) {
|
||||||
userMoneyDetails.setContent("成功提现:" + money);
|
userMoneyDetails.setContent("成功提现:" + money);
|
||||||
cashOut.setState(1);
|
cashOut.setState(1);
|
||||||
|
|||||||
@@ -167,9 +167,9 @@ public class WuyouPay {
|
|||||||
* @param userName 真实姓名 / 用户名
|
* @param userName 真实姓名 / 用户名
|
||||||
* @param bankName 开户行,支付宝提现可以不用传
|
* @param bankName 开户行,支付宝提现可以不用传
|
||||||
*/
|
*/
|
||||||
public BaseResp extractOrder(String outOrderNo, Long userId, boolean isUser, String amount, String account,
|
public BaseResp extractOrder(boolean isAlipay, String outOrderNo, Long userId, boolean isUser, String amount, String account,
|
||||||
String userName, String bankName) {
|
String userName, String bankName) {
|
||||||
return extractOrderExt(false, false, outOrderNo, userId, isUser, amount, account, userName, bankName);
|
return extractOrderExt(isAlipay, false, outOrderNo, userId, isUser, amount, account, userName, bankName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -179,7 +179,7 @@ public class WuyouPay {
|
|||||||
* @param userName 支付宝名称
|
* @param userName 支付宝名称
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @param isHistoryData cash_out是否历史提现数据
|
* @param isAlipay 是否是支付宝提现,true是
|
||||||
* @param ignoreConfig 是否忽略配置开关,true忽略
|
* @param ignoreConfig 是否忽略配置开关,true忽略
|
||||||
* @param outOrderNo 提现订单号
|
* @param outOrderNo 提现订单号
|
||||||
* @param userId
|
* @param userId
|
||||||
@@ -190,7 +190,7 @@ public class WuyouPay {
|
|||||||
* @param bankName 开户行,支付宝提现可以不用传
|
* @param bankName 开户行,支付宝提现可以不用传
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BaseResp extractOrderExt(boolean isHistoryData, boolean ignoreConfig, String outOrderNo, Long userId, boolean isUser, String amount, String account,
|
public BaseResp extractOrderExt(boolean isAlipay, boolean ignoreConfig, String outOrderNo, Long userId, boolean isUser, String amount, String account,
|
||||||
String userName, String bankName) {
|
String userName, String bankName) {
|
||||||
if (!ignoreConfig) {
|
if (!ignoreConfig) {
|
||||||
String payConfig = commonInfoService.findOne(927).getValue();
|
String payConfig = commonInfoService.findOne(927).getValue();
|
||||||
@@ -206,7 +206,7 @@ public class WuyouPay {
|
|||||||
params.put("total", amount);
|
params.put("total", amount);
|
||||||
params.put("bank_card", account);
|
params.put("bank_card", account);
|
||||||
params.put("bank_account_name", userName);
|
params.put("bank_account_name", userName);
|
||||||
if (isHistoryData) {
|
if (isAlipay) {
|
||||||
params.put("bank_name", "1");
|
params.put("bank_name", "1");
|
||||||
} else {
|
} else {
|
||||||
params.put("bank_name", isUser ? bankName : "1");
|
params.put("bank_name", isUser ? bankName : "1");
|
||||||
@@ -220,7 +220,7 @@ public class WuyouPay {
|
|||||||
params.put("sign", sign);
|
params.put("sign", sign);
|
||||||
|
|
||||||
params.put("business_type", 0);
|
params.put("business_type", 0);
|
||||||
if (isHistoryData) {
|
if (isAlipay) {
|
||||||
params.put("business_attr", "alipay");
|
params.put("business_attr", "alipay");
|
||||||
} else {
|
} else {
|
||||||
params.put("business_attr", isUser ? "unionpay" : "alipay");
|
params.put("business_attr", isUser ? "unionpay" : "alipay");
|
||||||
|
|||||||
Reference in New Issue
Block a user