| | |
| | | } |
| | | } |
| | | |
| | | if (null == prefix) return String.format("%s%04d", currentTimestamp, seq); |
| | | return prefix + "_" + String.format("%s%04d", currentTimestamp, seq); |
| | | if (null == prefix) return String.format("%s%02d", currentTimestamp, seq); |
| | | return prefix + "_" + String.format("%s%02d", currentTimestamp, seq); |
| | | } |
| | | |
| | | |
| | |
| | | public static String getTimeId(int start, int end) { |
| | | return DateFormatUtils.format(new Date(), "yyyyMMddHHmmss") + RandomUtils.nextInt(start, end); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | for (int i = 0; i < 10; i++){ |
| | | String id = generateId(); |
| | | System.out.println(id); |
| | | } |
| | | } |
| | | } |