24 lines
498 B
Plaintext
24 lines
498 B
Plaintext
|
|
package com.sercurityControl.proteam.util;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @author cw chen
|
|||
|
|
* @description TODO
|
|||
|
|
* @date 2023-03-31 14:47
|
|||
|
|
*/
|
|||
|
|
public class IDUtils {
|
|||
|
|
private static byte[] lock = new byte[0];
|
|||
|
|
|
|||
|
|
// 位数,默认是8位
|
|||
|
|
private final static long w = 100000000;
|
|||
|
|
|
|||
|
|
public static String createID() {
|
|||
|
|
long r = 0;
|
|||
|
|
synchronized (lock) {
|
|||
|
|
r = (long) ((Math.random() + 1) * w);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return System.currentTimeMillis() + String.valueOf(r).substring(1);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|