public static String getOrderIdByUUId() { int first = new Random(10).nextInt(8) + 1; int hashCodeV = UUID.randomUUID().toString().hashCode(); if (hashCodeV < 0) {//有多是负数 hashCodeV = -hashCodeV; } // 0 表明前面补充0 // 4 表明长度为4 // d 表明参数为正数型 return first + String.format("%015d", hashCodeV); }