/** * 获取流水号(22位) * @return */ public static StringBuilder getRandomReqNo() { StringBuilder messageid = new StringBuilder(); messageid.append("GD00"); SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMdd"); String date=sdf.format(new Date()); //拼接时间 messageid.append(date); int length=10; String base = "0123456789"; Random random = new Random(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; i++) { int number = random.nextInt(base.length()); sb.append(base.charAt(number)); } //拼接流水号 messageid.append(sb); return messageid; }
12-10
02-14
202
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)