liujie
2026-09-11 4f6f15b818704079ff2e4e4719b798f48d68a335
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package com.tourguide.modules.order.payment;
 
import com.tourguide.modules.order.entity.TourOrder;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.UUID;
 
/** 当前未接入真实支付渠道,本地实现仅生成模拟退款流水号。 */
public class LocalPaymentRefundGateway implements PaymentRefundGateway {
    @Override
    public String refund(TourOrder order, BigDecimal amount) {
        if (order.getPaymentOrderNo() == null || !order.getPaymentOrderNo().startsWith("LOCAL")) {
            throw new IllegalStateException("真实支付退款渠道尚未接入");
        }
        String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
        return "LOCALRF" + time + UUID.randomUUID().toString().replace("-", "")
                .substring(0, 6).toUpperCase();
    }
}