v2.9.0 & PasswordPolicyValidator
This commit is contained in:
@@ -110,6 +110,17 @@ public class SnowFlakeId {
|
||||
| machineId << MACHINE_LEFT //机器标识部分
|
||||
| sequence; //序列号部分
|
||||
}
|
||||
|
||||
|
||||
public long currId() {
|
||||
long currStmp = lastStmp;
|
||||
|
||||
return (currStmp - START_STMP) << TIMESTMP_LEFT //时间戳部分
|
||||
| datacenterId << DATACENTER_LEFT //数据中心部分
|
||||
| machineId << MACHINE_LEFT //机器标识部分
|
||||
| sequence; //序列号部分
|
||||
}
|
||||
|
||||
|
||||
private long getNextMill() {
|
||||
long mill = getNewstmp();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
package org.maxkey.util;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SonwFlakeIdTest {
|
||||
@@ -24,9 +25,12 @@ public class SonwFlakeIdTest {
|
||||
|
||||
@Test
|
||||
public void UidGenerator() {
|
||||
SnowFlakeId snowFlake = new SnowFlakeId(2, 3);
|
||||
DateTime d= new DateTime("2020-01-01T01:01:01");
|
||||
System.out.println("time "+d.getMillis());
|
||||
SnowFlakeId snowFlake = new SnowFlakeId(1, 1,8,d.getMillis());
|
||||
long seq = snowFlake.nextId();
|
||||
|
||||
System.out.println(seq);
|
||||
System.out.println(snowFlake.parse(seq));
|
||||
System.out.println(snowFlake.parse(seq).getDateTime());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user