分账失败不回滚主订单了
This commit is contained in:
parent
af4d4321fe
commit
7528ee8d28
|
|
@ -0,0 +1,9 @@
|
|||
package com.ghy.common.adapay.model;
|
||||
|
||||
public interface AdpCode {
|
||||
|
||||
/**
|
||||
* 当前确认金额 > 支付金额 - 已支付确认金额 - 已支付撤销金额
|
||||
*/
|
||||
String CONFIRM_AMT_OVER_LIMIT = "confirm_amt_over_limit";
|
||||
}
|
||||
|
|
@ -542,7 +542,7 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
|||
// 待提现金额里加入子财务单金额
|
||||
dtx = dtx.add(fdPayMoney);
|
||||
|
||||
// 修改平台抽成子财务单金额
|
||||
// 修改平台抽成子财务单金额 减去手续费
|
||||
fdUpdate.setPayMoney(fdUpdate.getPayMoney().subtract(fee));
|
||||
financialDetailService.updateFinancialDetail(fdUpdate);
|
||||
}
|
||||
|
|
@ -553,10 +553,11 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
|||
logger.info("子订单[code={}]开始自动提现", odCode);
|
||||
if (BigDecimal.ZERO.compareTo(dtx) > -1) {
|
||||
logger.info("子订单[code={}] 待提现金额={} 无需提现", odCode, dtx);
|
||||
} else {
|
||||
// 待提现金额
|
||||
String cashAmt = AdapayUtils.bigDecimalToString(dtx);
|
||||
executor.execute(() -> drawCash(orderDetailId, financialDetail.getDeptId(), memberId, cashAmt));
|
||||
}
|
||||
// 待提现金额
|
||||
String cashAmt = AdapayUtils.bigDecimalToString(dtx);
|
||||
executor.execute(() -> drawCash(orderDetailId, financialDetail.getDeptId(), memberId, cashAmt));
|
||||
// --------------------- 自动提现流程 end ---------------------
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ghy.order.service.impl;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ghy.common.adapay.model.AdapayStatusEnum;
|
||||
import com.ghy.common.adapay.model.AdpCode;
|
||||
import com.ghy.common.adapay.model.DivMember;
|
||||
import com.ghy.common.adapay.model.PaymentDTO;
|
||||
import com.ghy.common.constant.UserConstants;
|
||||
|
|
@ -249,8 +250,18 @@ public class OrderMasterServiceImpl implements OrderMasterService {
|
|||
|
||||
boolean status = AdapayStatusEnum.pending.code.equals(response.getString("status")) ||
|
||||
AdapayStatusEnum.succeeded.code.equals(response.getString("status"));
|
||||
// 如果确认支付失败 这里抛出异常
|
||||
Assert.isTrue(status, response.getString("error_msg"));
|
||||
|
||||
if (!status) {
|
||||
// 如果确认支付失败
|
||||
if (AdpCode.CONFIRM_AMT_OVER_LIMIT.equals(response.getString("code"))) {
|
||||
// 如果是金额超限的话 可能已经分过帐了 就不回滚了
|
||||
logger.error("主订单[{}]分账失败: {}", orderMaster.getId(), response.toJSONString());
|
||||
return;
|
||||
} else {
|
||||
logger.error("主订单[{}]分账失败: {}", orderMaster.getId(), response.toJSONString());
|
||||
throw new BaseAdaPayException(response.getString("code"), response.getString("message"));
|
||||
}
|
||||
}
|
||||
|
||||
// 走到这里确认支付和分账都成功了 异步进入自动提现流程
|
||||
logger.info("订单[code={}]开始自动提现", orderMaster.getCode());
|
||||
|
|
|
|||
Loading…
Reference in New Issue