根据时间生成分配批次号

 1     /**
 2      * 根据当前时间生成分配批次号
 3      * 
 4      * @return
 5      */
 6     private String createBatchNo() {
 7         // 批次号第一部分:时间
 8         DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
 9         String currentTimeStr = dateFormat.format(new Date());
10         
11         // 批次号第二部分:随机数
12         Random random = new Random();
13         Integer cusCode = random.nextInt(900000) + 100000;
14         String cusCodeStr = cusCode.toString();
15         
16         // 返回分配批次
17         return currentTimeStr + cusCodeStr;
18     }

猜你喜欢

转载自www.cnblogs.com/liyue-sqsf/p/8990759.html