Authored by Lixiaodi

防止多次加帐

... ... @@ -273,6 +273,10 @@ public class PaymentServiceImpl implements IPaymentService {
// 更新订单状态[已支付]
int num = abstractOrderService.updateOrderStatusPaid(orderInfo);
if (num == 0) {
logger.warn("paySuccess finished. status has paid, orderCode is {}", orderCode);
return;
}
// 记录支付成功记录
OrdersPay ordersPay = new OrdersPay();
... ... @@ -313,10 +317,8 @@ public class PaymentServiceImpl implements IPaymentService {
addPayEnsureRecord(orderInfo.getUid(), orderInfo.getSkup(), orderCode, recordPayment,
ordersPay.getAmount());
} else if (codeMeta.getType() == OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType()) {
if (num > 0) { // 防止并发回调和 主动查询结果。做幂等
addPayEnsureRecord(orderInfo.getUid(), orderInfo.getSkup(), orderCode, recordPayment,
ordersPay.getAmount());
}
addPayEnsureRecord(orderInfo.getUid(), orderInfo.getSkup(), orderCode, recordPayment,
ordersPay.getAmount());
}
logger.info("paySuccess finished. orderCode is {}", orderCode);
abstractOrderService.processAfterPay(orderInfo);
... ...