package com.heyu.api.gateway.util;

import lombok.extern.slf4j.Slf4j;

import java.text.SimpleDateFormat;


/**
 * 订单号生成工具
 * 枚举相关信息，查看 https://www.showdoc.cc/web/#/page/495445295769339
 */
@Slf4j
public class OrderUtils {

    public static String getUserPoolOrder() {
        SimpleDateFormat dateformat = new SimpleDateFormat("SSSyyyyMMddHHmmss");
        StringBuffer sb = new StringBuffer();
        return sb.
               append((int) (Math.random() * 1000)).append(dateformat.format(System.currentTimeMillis())).toString();
    }




    public static String getOrderNo(String pre) {
        SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        StringBuffer sb = new StringBuffer(pre);
        return sb.
                append((int) (Math.random() * 1000)).append(dateformat.format(System.currentTimeMillis())).toString();
    }



}
