package com.yami.shop.common.util;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.ThreadLocalRandom;

public final class RefundSnUtils {

    private static final DateTimeFormatter FMT = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");

    /**
     * 生成订单编号
     * 格式：D + yyyyMMddHHmmss + 4位随机数字
     */
    public static String generate() {
        String timestamp = LocalDateTime.now().format(FMT);
        int random4 = ThreadLocalRandom.current().nextInt(1000, 10000); // 1000~9999
        return "D" + timestamp + random4;
    }

}