| | |
| | | } |
| | | } |
| | | |
| | | 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); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 如果用户是库区用户,判断是否数据公司级别 |
| | | * |
| | | * @param userDeptId 当前用户部门ID |
| | | * @return 如果部门ID大于长度7说明是库区,否则就是公司级别 |
| | | */ |
| | | public static boolean isDepotUser(String userDeptId) { |
| | | if(StringUtils.isBlank(userDeptId)) return false; |
| | | return userDeptId.length() > 7; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | for (int i = 0; i < 10; i++){ |
| | | String id = generateId(); |
| | | System.out.println(id); |
| | | } |
| | | } |
| | | } |