转载的关于生成订单号的方法

public static String getOrderIdByUUId() {
        Date date=new Date();
        DateFormat format = new SimpleDateFormat("yyyyMMdd");
        String time = format.format(date);
        int hashCodeV = UUID.randomUUID().toString().hashCode();
        if (hashCodeV < 0) {//有可能是负数
            hashCodeV = -hashCodeV;
        }
        // 0 代表前面补充0
        // 11 代表长度为11
        // d 代表参数为正数型
        return time + String.format("%011d", hashCodeV);
    }
---------------------
作者:r萧枫
来源:CSDN
原文:https://blog.csdn.net/sinat_24527911/article/details/78590320
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自blog.csdn.net/weixin_42348845/article/details/85163769
今日推荐