SnowflakeIdWorker3rd逻辑还原

This commit is contained in:
gaoqr
2026-08-13 19:50:23 +08:00
parent 3ee87082f3
commit 42777bc7cd
11 changed files with 26 additions and 64 deletions
@@ -70,19 +70,6 @@ public class SnowflakeIdWorker3rd {
return Integer.parseInt(formatted_date);
}
/**
* 生成小板短编号。
*
* <p>编号以固定的 {@code 1} 开始,再拼接五位组织编号,避免其他系统截取前五位时出现前导零。</p>
*
* @param organId 组织编号
* @param id 小板序列号
* @return 小板短编号
*/
public static String generatePlateNo(Long organId, long id) {
return "1" + String.format("%05d", organId) + obtainingTime() + Long.toString(id).substring(2);
}
/**
* 获得下一个ID (该方法是线程安全)
*
@@ -1,17 +0,0 @@
package com.cf.imes.framework.id.core.util;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
class SnowflakeIdWorker3rdTest {
@Test
void generatePlateNoStartsWithOneAndKeepsFiveDigitOrganId() {
String plateNo = SnowflakeIdWorker3rd.generatePlateNo(7L, 123456L);
assertTrue(plateNo.startsWith("1"));
assertEquals("00007", plateNo.substring(1, 6));
}
}