package com.qiyuan.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class orderCode {

    //订单编号前缀
    public static final String PREFIX = "DD";
    //订单编号后缀(核心部分)
    private static long code;
    
    // 生成订单编号
    public static synchronized String getOrderCode() {
        code++;
        String str = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
        long m = Long.parseLong((str)) * 10000;
        m += code;
        return PREFIX + m;
    }
    
    public static void main(String[] args) {
        System.out.println(orderCode.getOrderCode());
    }

}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2022-01-17
相关资源
相似解决方案