码迷,mamicode.com
首页 > 其他好文 > 详细

根据时间生成分配批次号

时间:2018-05-04 17:12:08      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:生成   mss   时间   sim   format   mat   部分   led   第二部分   

 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     }

 

根据时间生成分配批次号

标签:生成   mss   时间   sim   format   mat   部分   led   第二部分   

原文地址:https://www.cnblogs.com/liyue-sqsf/p/8990759.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!