|
|
@@ -624,7 +624,6 @@ public class PaymentServiceImpl implements PaymentService {
|
|
|
BigDecimal existingRefund = order.getRefundAmount() != null ? order.getRefundAmount() : BigDecimal.ZERO;
|
|
|
BigDecimal cumulativeAmount = existingRefund.add(amount);
|
|
|
|
|
|
- order.setRefundStatus(RefundStatus.REFUNDED.getCode());
|
|
|
order.setRefundAmount(cumulativeAmount);
|
|
|
order.setRefundTime(LocalDateTime.now());
|
|
|
order.setRefundReason(reason);
|
|
|
@@ -632,10 +631,12 @@ public class PaymentServiceImpl implements PaymentService {
|
|
|
// 仅当累计退款 >= 实付金额时,才标记为全额退款
|
|
|
BigDecimal paidAmount = order.getPaidAmount() != null ? order.getPaidAmount() : order.getTotalAmount();
|
|
|
if (cumulativeAmount.compareTo(paidAmount) >= 0) {
|
|
|
+ order.setRefundStatus(RefundStatus.REFUNDED.getCode());
|
|
|
order.setPayStatus(OrderConstants.PAY_STATUS_REFUND);
|
|
|
log.info("订单全额退款完成 - orderId={}, cumulativeAmount={}, paidAmount={}",
|
|
|
order.getId(), cumulativeAmount, paidAmount);
|
|
|
} else {
|
|
|
+ // 部分退款:不设 REFUNDED 状态,保留退款入口
|
|
|
order.setPayStatus(OrderConstants.PAY_STATUS_PARTIAL_REFUND);
|
|
|
log.info("订单部分退款 - orderId={}, cumulativeAmount={}, paidAmount={}",
|
|
|
order.getId(), cumulativeAmount, paidAmount);
|