mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-08-15 02:27:34 +08:00
统一保险订单资金口径:payAmount=充电金额,明细=完整实付(充电+保险)
规则:order_basic_info.pay_amount 只记充电金额(不含保险);order_pay_record 汇总为用户完整实付(充电+保险);凭证校验以 payAmount+保险==明细 为准。 - 在线支付(OrderService.adapayCallback):payAmount 存 amount-保险(充电金额), 回退f11b781c2的"完整金额"写入;下发桩额度直接用 payAmount,避免结算多退保险。 - 余额支付(Not/DelayMerchantProgramLogic.balancePayOrderV2):与在线一致,从钱包 扣 充电+保险,order_pay_record 记完整实付,payAmount 仍只记充电金额;余额不足 (<充电+保险)直接拒绝。会员交易流水记完整实付。 - 凭证校验(OrderBasicInfoServiceImpl.inspectOrderPayment):余额/非余额支路统一 改为容错对比 payAmount==明细 或 payAmount+保险==明细;补偿回写只写充电金额, 修复余额支路仍按 payAmount==明细 会误判新余额保险单的问题。 - 新增 docs/sql/fix_online_insurance_pay_amount_20260725.sql:矫正f11b781c2期间 在线保险单被写成完整金额的 payAmount(dry-run/备份/回滚齐全)。 - 新增单测:calculateBalanceRefund 6 例 + inspectOrderPayment 5 例(计算层,不连库)。
This commit is contained in:
@@ -1302,12 +1302,17 @@ public class OrderService {
|
||||
// 支付订单成功
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
BigDecimal insuranceAmount = orderBasicInfo.getInsuranceAmount();
|
||||
log.info("adapayCallback-订单:{}, 网关支付金额(amount):{}, 订单保险金额(insuranceAmount):{}, payRecord将记录:{}",
|
||||
orderCode, amount, insuranceAmount, amount);
|
||||
// 主表 payAmount 只存充电金额(不含保险):充电金额 = 网关实付(amount) - 保险金额;
|
||||
// order_pay_record 仍记录完整实付(amount),故校验时 明细 == payAmount + 保险。
|
||||
BigDecimal chargeAmount = amount;
|
||||
if (insuranceAmount != null && insuranceAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
chargeAmount = amount.subtract(insuranceAmount).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
log.info("adapayCallback-订单:{}, 网关支付金额(amount):{}, 订单保险金额(insuranceAmount):{}, 充电金额(payAmount将记录):{}, order_pay_record记录:{}",
|
||||
orderCode, amount, insuranceAmount, chargeAmount, amount);
|
||||
PayOrderSuccessCallbackDTO callbackDTO = PayOrderSuccessCallbackDTO.builder()
|
||||
.orderCode(orderCode)
|
||||
.payAmount(amount) // 完整支付金额(含保险),与 order_pay_record 汇总一致
|
||||
.insuranceAmount(insuranceAmount) // 保险金额,回调中用于计算下发桩的充电金额
|
||||
.payAmount(chargeAmount) // 充电金额(不含保险)
|
||||
.payMode(payModel)
|
||||
.acquirer(AcquirerEnum.ADAPAY.getValue())
|
||||
.build();
|
||||
|
||||
Reference in New Issue
Block a user