From b7c35c633b828ea6312b63b6e28102746a6a0d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E5=BA=86=E5=90=89?= <51312040@qq.com> Date: Mon, 18 Jan 2021 15:20:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9String=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E7=9A=84=E9=9B=AA=E8=8A=B1id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/ebtp/common/util/PropertyUtils.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/util/PropertyUtils.java b/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/util/PropertyUtils.java index 1c0768d..47f5a81 100644 --- a/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/util/PropertyUtils.java +++ b/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/util/PropertyUtils.java @@ -24,12 +24,21 @@ public class PropertyUtils { @Value("${mconfig.datacenter-id}") public static long DATACENTER_ID; + /** + * 生成雪花id, + * + * @return + */ + public static String getSnowflakeId() { + long l = IdUtil.getSnowflake(WORKER_ID, DATACENTER_ID).nextId(); + return String.valueOf(l); + } /** * 生成雪花id * * @return */ - public static Long getSnowflakeId() { + public static long getSnowflakeLongId() { return IdUtil.getSnowflake(WORKER_ID, DATACENTER_ID).nextId(); } }