feat: 兼容提现失败场景,对失败消息持久化
This commit is contained in:
parent
dcf48db2ac
commit
74941f7243
@ -88,3 +88,4 @@ ALTER TABLE li_foot_print ADD `store_id` varchar(255) DEFAULT NULL COMMENT '店
|
|||||||
*/
|
*/
|
||||||
ALTER TABLE li_member_withdraw_apply ADD `real_name` varchar(255) DEFAULT NULL;
|
ALTER TABLE li_member_withdraw_apply ADD `real_name` varchar(255) DEFAULT NULL;
|
||||||
ALTER TABLE li_member_withdraw_apply ADD `connect_number` varchar(255) DEFAULT NULL;
|
ALTER TABLE li_member_withdraw_apply ADD `connect_number` varchar(255) DEFAULT NULL;
|
||||||
|
ALTER TABLE li_member_withdraw_apply ADD `error_message` text DEFAULT NULL;
|
||||||
|
@ -31,15 +31,19 @@ public class MemberWalletExecute implements MemberWithdrawalEvent {
|
|||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
//提现成功扣减冻结金额
|
//提现成功扣减冻结金额
|
||||||
memberWalletService.reduceFrozen(
|
memberWalletService.reduceFrozen(
|
||||||
new MemberWalletUpdateDTO(memberWithdrawalMessage.getPrice(), memberWithdrawalMessage.getMemberId(), "提现成功,余额提现", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name()));
|
new MemberWalletUpdateDTO(memberWithdrawalMessage.getPrice(), memberWithdrawalMessage.getMemberId(), "提现成功,余额提现",
|
||||||
|
DepositServiceTypeEnum.WALLET_WITHDRAWAL.name()));
|
||||||
break;
|
break;
|
||||||
case ERROR:
|
case ERROR:
|
||||||
//需要从冻结金额扣减到余额
|
//需要从冻结金额扣减到余额
|
||||||
memberWalletService.increaseWithdrawal(new MemberWalletUpdateDTO(memberWithdrawalMessage.getPrice(), memberWithdrawalMessage.getMemberId(), "提现失败,提现金额解冻到余额", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name()));
|
memberWalletService.increaseWithdrawal(new MemberWalletUpdateDTO(memberWithdrawalMessage.getPrice(),
|
||||||
|
memberWithdrawalMessage.getMemberId(), "第三方提现失败,提现金额解冻到余额", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name()));
|
||||||
break;
|
break;
|
||||||
case FAIL_AUDITING:
|
case FAIL_AUDITING:
|
||||||
//需要从冻结金额扣减到余额
|
//需要从冻结金额扣减到余额
|
||||||
memberWalletService.increaseWithdrawal(new MemberWalletUpdateDTO(memberWithdrawalMessage.getPrice(), memberWithdrawalMessage.getMemberId(), "审核拒绝,提现金额解冻到余额", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name()));
|
memberWalletService.increaseWithdrawal(new MemberWalletUpdateDTO(memberWithdrawalMessage.getPrice(),
|
||||||
|
memberWithdrawalMessage.getMemberId(), "审核拒绝,提现金额解冻到余额", DepositServiceTypeEnum.WALLET_WITHDRAWAL.name()));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import cn.lili.modules.system.entity.dto.payment.dto.PaymentSupportItem;
|
|||||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||||
import cn.lili.modules.system.service.SettingService;
|
import cn.lili.modules.system.service.SettingService;
|
||||||
import cn.lili.modules.wallet.entity.dos.MemberWithdrawApply;
|
import cn.lili.modules.wallet.entity.dos.MemberWithdrawApply;
|
||||||
|
import cn.lili.modules.wallet.entity.dto.TransferResultDTO;
|
||||||
import cn.lili.modules.wallet.service.MemberWalletService;
|
import cn.lili.modules.wallet.service.MemberWalletService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -149,7 +150,7 @@ public class CashierSupport {
|
|||||||
* @param paymentMethodEnum 支付渠道
|
* @param paymentMethodEnum 支付渠道
|
||||||
* @param memberWithdrawApply 用户提现申请
|
* @param memberWithdrawApply 用户提现申请
|
||||||
*/
|
*/
|
||||||
public boolean transfer(PaymentMethodEnum paymentMethodEnum, MemberWithdrawApply memberWithdrawApply) {
|
public TransferResultDTO transfer(PaymentMethodEnum paymentMethodEnum, MemberWithdrawApply memberWithdrawApply) {
|
||||||
Payment payment = (Payment) SpringContextUtil.getBean(paymentMethodEnum.getPlugin());
|
Payment payment = (Payment) SpringContextUtil.getBean(paymentMethodEnum.getPlugin());
|
||||||
return payment.transfer(memberWithdrawApply);
|
return payment.transfer(memberWithdrawApply);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import cn.lili.modules.payment.entity.RefundLog;
|
|||||||
import cn.lili.modules.payment.entity.enums.PaymentMethodEnum;
|
import cn.lili.modules.payment.entity.enums.PaymentMethodEnum;
|
||||||
import cn.lili.modules.payment.kit.dto.PayParam;
|
import cn.lili.modules.payment.kit.dto.PayParam;
|
||||||
import cn.lili.modules.wallet.entity.dos.MemberWithdrawApply;
|
import cn.lili.modules.wallet.entity.dos.MemberWithdrawApply;
|
||||||
|
import cn.lili.modules.wallet.entity.dto.TransferResultDTO;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -114,7 +115,7 @@ public interface Payment {
|
|||||||
/**
|
/**
|
||||||
* 提现
|
* 提现
|
||||||
*/
|
*/
|
||||||
default boolean transfer(MemberWithdrawApply memberWithdrawApply) {
|
default TransferResultDTO transfer(MemberWithdrawApply memberWithdrawApply) {
|
||||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ import cn.lili.modules.system.entity.dto.payment.AlipayPaymentSetting;
|
|||||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||||
import cn.lili.modules.system.service.SettingService;
|
import cn.lili.modules.system.service.SettingService;
|
||||||
import cn.lili.modules.wallet.entity.dos.MemberWithdrawApply;
|
import cn.lili.modules.wallet.entity.dos.MemberWithdrawApply;
|
||||||
|
import cn.lili.modules.wallet.entity.dto.TransferResultDTO;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alipay.api.AlipayApiException;
|
import com.alipay.api.AlipayApiException;
|
||||||
import com.alipay.api.domain.*;
|
import com.alipay.api.domain.*;
|
||||||
@ -170,7 +171,8 @@ public class AliPayPlugin implements Payment {
|
|||||||
payModel.setTimeoutExpress("3m");
|
payModel.setTimeoutExpress("3m");
|
||||||
payModel.setOutTradeNo(outTradeNo);
|
payModel.setOutTradeNo(outTradeNo);
|
||||||
log.info("支付宝扫码:{}", payModel);
|
log.info("支付宝扫码:{}", payModel);
|
||||||
String resultStr = AliPayRequest.tradePrecreatePayToResponse(payModel, notifyUrl(apiProperties.getBuyer(), PaymentMethodEnum.ALIPAY)).getBody();
|
String resultStr =
|
||||||
|
AliPayRequest.tradePrecreatePayToResponse(payModel, notifyUrl(apiProperties.getBuyer(), PaymentMethodEnum.ALIPAY)).getBody();
|
||||||
|
|
||||||
log.info("支付宝扫码交互返回:{}", resultStr);
|
log.info("支付宝扫码交互返回:{}", resultStr);
|
||||||
JSONObject jsonObject = JSONObject.parseObject(resultStr);
|
JSONObject jsonObject = JSONObject.parseObject(resultStr);
|
||||||
@ -202,7 +204,8 @@ public class AliPayPlugin implements Payment {
|
|||||||
refundLog.setIsRefund(true);
|
refundLog.setIsRefund(true);
|
||||||
refundLog.setReceivableNo(refundLog.getOutOrderNo());
|
refundLog.setReceivableNo(refundLog.getOutOrderNo());
|
||||||
} else {
|
} else {
|
||||||
refundLog.setErrorMessage(String.format("错误码:%s,错误原因:%s", alipayTradeRefundResponse.getSubCode(), alipayTradeRefundResponse.getSubMsg()));
|
refundLog.setErrorMessage(String.format("错误码:%s,错误原因:%s", alipayTradeRefundResponse.getSubCode(),
|
||||||
|
alipayTradeRefundResponse.getSubMsg()));
|
||||||
}
|
}
|
||||||
refundLogService.save(refundLog);
|
refundLogService.save(refundLog);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -237,7 +240,7 @@ public class AliPayPlugin implements Payment {
|
|||||||
* @param memberWithdrawApply 会员提现申请
|
* @param memberWithdrawApply 会员提现申请
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean transfer(MemberWithdrawApply memberWithdrawApply) {
|
public TransferResultDTO transfer(MemberWithdrawApply memberWithdrawApply) {
|
||||||
AlipayFundTransUniTransferModel model = new AlipayFundTransUniTransferModel();
|
AlipayFundTransUniTransferModel model = new AlipayFundTransUniTransferModel();
|
||||||
model.setOutBizNo(SnowFlake.createStr("T"));
|
model.setOutBizNo(SnowFlake.createStr("T"));
|
||||||
model.setRemark("用户提现");
|
model.setRemark("用户提现");
|
||||||
@ -257,15 +260,15 @@ public class AliPayPlugin implements Payment {
|
|||||||
AlipayFundTransUniTransferResponse alipayFundTransUniTransferResponse = AliPayApi.uniTransferToResponse(model, null);
|
AlipayFundTransUniTransferResponse alipayFundTransUniTransferResponse = AliPayApi.uniTransferToResponse(model, null);
|
||||||
log.error("支付宝退款,参数:{},支付宝响应:{}", JSONUtil.toJsonStr(model), JSONUtil.toJsonStr(alipayFundTransUniTransferResponse));
|
log.error("支付宝退款,参数:{},支付宝响应:{}", JSONUtil.toJsonStr(model), JSONUtil.toJsonStr(alipayFundTransUniTransferResponse));
|
||||||
if (alipayFundTransUniTransferResponse.isSuccess()) {
|
if (alipayFundTransUniTransferResponse.isSuccess()) {
|
||||||
return true;
|
return TransferResultDTO.builder().result(true).build();
|
||||||
} else {
|
} else {
|
||||||
log.error(alipayFundTransUniTransferResponse.getSubMsg());
|
log.error(alipayFundTransUniTransferResponse.getSubMsg());
|
||||||
|
return TransferResultDTO.builder().result(false).response(alipayFundTransUniTransferResponse.getSubMsg()).build();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("用户提现异常:", e);
|
log.error("用户提现异常:", e);
|
||||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
return TransferResultDTO.builder().result(false).response(e.getMessage()).build();
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +17,6 @@ import cn.lili.common.utils.SnowFlake;
|
|||||||
import cn.lili.common.utils.StringUtils;
|
import cn.lili.common.utils.StringUtils;
|
||||||
import cn.lili.common.vo.ResultMessage;
|
import cn.lili.common.vo.ResultMessage;
|
||||||
import cn.lili.modules.connect.entity.Connect;
|
import cn.lili.modules.connect.entity.Connect;
|
||||||
import cn.lili.modules.connect.entity.enums.ConnectEnum;
|
|
||||||
import cn.lili.modules.connect.entity.enums.SourceEnum;
|
import cn.lili.modules.connect.entity.enums.SourceEnum;
|
||||||
import cn.lili.modules.connect.service.ConnectService;
|
import cn.lili.modules.connect.service.ConnectService;
|
||||||
import cn.lili.modules.member.entity.dto.ConnectQueryDTO;
|
import cn.lili.modules.member.entity.dto.ConnectQueryDTO;
|
||||||
@ -47,10 +46,10 @@ import cn.lili.modules.system.entity.dto.payment.WechatPaymentSetting;
|
|||||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||||
import cn.lili.modules.system.service.SettingService;
|
import cn.lili.modules.system.service.SettingService;
|
||||||
import cn.lili.modules.wallet.entity.dos.MemberWithdrawApply;
|
import cn.lili.modules.wallet.entity.dos.MemberWithdrawApply;
|
||||||
|
import cn.lili.modules.wallet.entity.dto.TransferResultDTO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.ss.formula.atp.Switch;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -481,13 +480,15 @@ public class WechatPlugin implements Payment {
|
|||||||
* @param memberWithdrawApply 会员提现申请
|
* @param memberWithdrawApply 会员提现申请
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean transfer(MemberWithdrawApply memberWithdrawApply) {
|
public TransferResultDTO transfer(MemberWithdrawApply memberWithdrawApply) {
|
||||||
try {
|
try {
|
||||||
//获取提现设置
|
//获取提现设置
|
||||||
WithdrawalSetting withdrawalSetting = new Gson().fromJson(settingService.get(SettingEnum.WITHDRAWAL_SETTING.name()).getSettingValue(), WithdrawalSetting.class);
|
WithdrawalSetting withdrawalSetting = new Gson().fromJson(settingService.get(SettingEnum.WITHDRAWAL_SETTING.name()).getSettingValue(),
|
||||||
|
WithdrawalSetting.class);
|
||||||
|
|
||||||
//获取用户OPENID
|
//获取用户OPENID
|
||||||
WechatConnectSetting wechatConnectSetting = new Gson().fromJson(settingService.get(SettingEnum.WECHAT_CONNECT.name()).getSettingValue(), WechatConnectSetting.class);
|
WechatConnectSetting wechatConnectSetting = new Gson().fromJson(settingService.get(SettingEnum.WECHAT_CONNECT.name()).getSettingValue()
|
||||||
|
, WechatConnectSetting.class);
|
||||||
String source = "";
|
String source = "";
|
||||||
for (WechatConnectSettingItem wechatConnectSettingItem : wechatConnectSetting.getWechatConnectSettingItems()) {
|
for (WechatConnectSettingItem wechatConnectSettingItem : wechatConnectSetting.getWechatConnectSettingItems()) {
|
||||||
if (wechatConnectSettingItem.getAppId().equals(withdrawalSetting.getWechatAppId())) {
|
if (wechatConnectSettingItem.getAppId().equals(withdrawalSetting.getWechatAppId())) {
|
||||||
@ -548,12 +549,13 @@ public class WechatPlugin implements Payment {
|
|||||||
log.info("微信提现响应 {}", response);
|
log.info("微信提现响应 {}", response);
|
||||||
String body = response.getBody();
|
String body = response.getBody();
|
||||||
JSONObject jsonObject = JSONUtil.parseObj(body);
|
JSONObject jsonObject = JSONUtil.parseObj(body);
|
||||||
return jsonObject.getStr("batch_id") != null ? true : false;
|
|
||||||
|
return TransferResultDTO.builder().result(jsonObject.getStr("batch_id") != null).response(body).build();
|
||||||
//根据自身业务进行接下来的任务处理
|
//根据自身业务进行接下来的任务处理
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
return TransferResultDTO.builder().result(false).response(e.getMessage()).build();
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,7 +672,8 @@ public class WechatPlugin implements Payment {
|
|||||||
String transactionId = jsonObject.getStr("transaction_id");
|
String transactionId = jsonObject.getStr("transaction_id");
|
||||||
String refundId = jsonObject.getStr("refund_id");
|
String refundId = jsonObject.getStr("refund_id");
|
||||||
|
|
||||||
RefundLog refundLog = refundLogService.getOne(new LambdaQueryWrapper<RefundLog>().eq(RefundLog::getPaymentReceivableNo, transactionId));
|
RefundLog refundLog = refundLogService.getOne(new LambdaQueryWrapper<RefundLog>().eq(RefundLog::getPaymentReceivableNo,
|
||||||
|
transactionId));
|
||||||
if (refundLog != null) {
|
if (refundLog != null) {
|
||||||
refundLog.setIsRefund(true);
|
refundLog.setIsRefund(true);
|
||||||
refundLog.setReceivableNo(refundId);
|
refundLog.setReceivableNo(refundId);
|
||||||
@ -683,7 +686,8 @@ public class WechatPlugin implements Payment {
|
|||||||
String transactionId = jsonObject.getStr("transaction_id");
|
String transactionId = jsonObject.getStr("transaction_id");
|
||||||
String refundId = jsonObject.getStr("refund_id");
|
String refundId = jsonObject.getStr("refund_id");
|
||||||
|
|
||||||
RefundLog refundLog = refundLogService.getOne(new LambdaQueryWrapper<RefundLog>().eq(RefundLog::getPaymentReceivableNo, transactionId));
|
RefundLog refundLog = refundLogService.getOne(new LambdaQueryWrapper<RefundLog>().eq(RefundLog::getPaymentReceivableNo,
|
||||||
|
transactionId));
|
||||||
if (refundLog != null) {
|
if (refundLog != null) {
|
||||||
refundLog.setReceivableNo(refundId);
|
refundLog.setReceivableNo(refundId);
|
||||||
refundLog.setErrorMessage(ciphertext.getStr("summary"));
|
refundLog.setErrorMessage(ciphertext.getStr("summary"));
|
||||||
|
@ -67,4 +67,10 @@ public class MemberWithdrawApply extends BaseEntity {
|
|||||||
@ApiModelProperty(value = "第三方平台账号")
|
@ApiModelProperty(value = "第三方平台账号")
|
||||||
private String connectNumber;
|
private String connectNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付宝登录账号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "第三方错误消息")
|
||||||
|
private String errorMessage;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package cn.lili.modules.wallet.entity.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转账结果
|
||||||
|
*
|
||||||
|
* @author liushuai(liushuai711 @ gmail.com)
|
||||||
|
* @version v4.0
|
||||||
|
* @Description:
|
||||||
|
* @since 2023/5/6 16:10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class TransferResultDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "错误信息")
|
||||||
|
private String response;
|
||||||
|
@ApiModelProperty(value = "是否成功")
|
||||||
|
private Boolean result;
|
||||||
|
|
||||||
|
}
|
@ -6,7 +6,6 @@ import cn.lili.modules.wallet.entity.dos.MemberWallet;
|
|||||||
import cn.lili.modules.wallet.entity.dto.MemberWalletUpdateDTO;
|
import cn.lili.modules.wallet.entity.dto.MemberWalletUpdateDTO;
|
||||||
import cn.lili.modules.wallet.entity.vo.MemberWalletVO;
|
import cn.lili.modules.wallet.entity.vo.MemberWalletVO;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员预存款业务层
|
* 会员预存款业务层
|
||||||
@ -102,8 +101,7 @@ public interface MemberWalletService extends IService<MemberWallet> {
|
|||||||
* 提现公共方法
|
* 提现公共方法
|
||||||
*
|
*
|
||||||
* @param withdrawApplyId 会员零钱提现Id
|
* @param withdrawApplyId 会员零钱提现Id
|
||||||
* @return 操作状态
|
|
||||||
*/
|
*/
|
||||||
Boolean withdrawal(String withdrawApplyId);
|
void withdrawal(String withdrawApplyId);
|
||||||
|
|
||||||
}
|
}
|
@ -22,6 +22,7 @@ import cn.lili.modules.wallet.entity.dos.MemberWithdrawApply;
|
|||||||
import cn.lili.modules.wallet.entity.dos.WalletLog;
|
import cn.lili.modules.wallet.entity.dos.WalletLog;
|
||||||
import cn.lili.modules.wallet.entity.dto.MemberWalletUpdateDTO;
|
import cn.lili.modules.wallet.entity.dto.MemberWalletUpdateDTO;
|
||||||
import cn.lili.modules.wallet.entity.dto.MemberWithdrawalMessage;
|
import cn.lili.modules.wallet.entity.dto.MemberWithdrawalMessage;
|
||||||
|
import cn.lili.modules.wallet.entity.dto.TransferResultDTO;
|
||||||
import cn.lili.modules.wallet.entity.enums.DepositServiceTypeEnum;
|
import cn.lili.modules.wallet.entity.enums.DepositServiceTypeEnum;
|
||||||
import cn.lili.modules.wallet.entity.enums.WithdrawStatusEnum;
|
import cn.lili.modules.wallet.entity.enums.WithdrawStatusEnum;
|
||||||
import cn.lili.modules.wallet.entity.vo.MemberWalletVO;
|
import cn.lili.modules.wallet.entity.vo.MemberWalletVO;
|
||||||
@ -312,7 +313,7 @@ public class MemberWalletServiceImpl extends ServiceImpl<MemberWalletMapper, Mem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean withdrawal(String withdrawApplyId) {
|
public void withdrawal(String withdrawApplyId) {
|
||||||
MemberWithdrawApply memberWithdrawApply = memberWithdrawApplyService.getById(withdrawApplyId);
|
MemberWithdrawApply memberWithdrawApply = memberWithdrawApplyService.getById(withdrawApplyId);
|
||||||
memberWithdrawApply.setInspectTime(new Date());
|
memberWithdrawApply.setInspectTime(new Date());
|
||||||
//获取提现设置
|
//获取提现设置
|
||||||
@ -320,20 +321,18 @@ public class MemberWalletServiceImpl extends ServiceImpl<MemberWalletMapper, Mem
|
|||||||
WithdrawalSetting withdrawalSetting = new Gson().fromJson(setting.getSettingValue(), WithdrawalSetting.class);
|
WithdrawalSetting withdrawalSetting = new Gson().fromJson(setting.getSettingValue(), WithdrawalSetting.class);
|
||||||
|
|
||||||
//调用提现方法
|
//调用提现方法
|
||||||
boolean result = true;
|
TransferResultDTO transferResultDTO = "WECHAT".equals(withdrawalSetting.getType()) ?
|
||||||
if ("WECHAT".equals(withdrawalSetting.getType())) {
|
cashierSupport.transfer(PaymentMethodEnum.WECHAT, memberWithdrawApply) : cashierSupport.transfer(PaymentMethodEnum.ALIPAY,
|
||||||
result = cashierSupport.transfer(PaymentMethodEnum.WECHAT, memberWithdrawApply);
|
memberWithdrawApply);
|
||||||
} else if ("ALI".equals(withdrawalSetting.getType())) {
|
|
||||||
result = cashierSupport.transfer(PaymentMethodEnum.ALIPAY, memberWithdrawApply);
|
|
||||||
}
|
|
||||||
|
|
||||||
//成功则扣减冻结金额
|
//成功则扣减冻结金额
|
||||||
//失败则恢复冻结金额
|
//失败则恢复冻结金额
|
||||||
|
|
||||||
if (result) {
|
if (transferResultDTO.getResult()) {
|
||||||
memberWithdrawApply.setApplyStatus(WithdrawStatusEnum.SUCCESS.name());
|
memberWithdrawApply.setApplyStatus(WithdrawStatusEnum.SUCCESS.name());
|
||||||
} else {
|
} else {
|
||||||
memberWithdrawApply.setApplyStatus(WithdrawStatusEnum.ERROR.name());
|
memberWithdrawApply.setApplyStatus(WithdrawStatusEnum.ERROR.name());
|
||||||
|
memberWithdrawApply.setErrorMessage(transferResultDTO.getResponse());
|
||||||
}
|
}
|
||||||
//修改提现申请
|
//修改提现申请
|
||||||
this.memberWithdrawApplyService.updateById(memberWithdrawApply);
|
this.memberWithdrawApplyService.updateById(memberWithdrawApply);
|
||||||
@ -348,7 +347,6 @@ public class MemberWalletServiceImpl extends ServiceImpl<MemberWalletMapper, Mem
|
|||||||
|
|
||||||
String destination = rocketmqCustomProperties.getMemberTopic() + ":" + MemberTagsEnum.MEMBER_WITHDRAWAL.name();
|
String destination = rocketmqCustomProperties.getMemberTopic() + ":" + MemberTagsEnum.MEMBER_WITHDRAWAL.name();
|
||||||
rocketMQTemplate.asyncSend(destination, memberWithdrawalMessage, RocketmqSendCallbackBuilder.commonCallback());
|
rocketMQTemplate.asyncSend(destination, memberWithdrawalMessage, RocketmqSendCallbackBuilder.commonCallback());
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user