From c1c140874bd375e36f4efa0b45e819e7cd22aaa6 Mon Sep 17 00:00:00 2001 From: liyj <1003249715@qq.com> Date: Wed, 28 Aug 2024 16:40:05 +0800 Subject: [PATCH] 1、主键生成策略优化 --- dyh-service/dyh-utils/src/main/java/cn/huge/module/mediate/utils/CaseIdUtils.java | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dyh-service/dyh-utils/src/main/java/cn/huge/module/common/utils/CaseIdUtils.java b/dyh-service/dyh-utils/src/main/java/cn/huge/module/mediate/utils/CaseIdUtils.java similarity index 87% rename from dyh-service/dyh-utils/src/main/java/cn/huge/module/common/utils/CaseIdUtils.java rename to dyh-service/dyh-utils/src/main/java/cn/huge/module/mediate/utils/CaseIdUtils.java index e8df121..8fa2ab7 100644 --- a/dyh-service/dyh-utils/src/main/java/cn/huge/module/common/utils/CaseIdUtils.java +++ b/dyh-service/dyh-utils/src/main/java/cn/huge/module/mediate/utils/CaseIdUtils.java @@ -1,4 +1,4 @@ -package cn.huge.module.common.utils; +package cn.huge.module.mediate.utils; import org.apache.commons.lang3.StringUtils; @@ -21,17 +21,17 @@ /** * 时间Id统计常量 */ - private static int COUNT_NUM = 1000; + private static int COUNT_NUM = 10000; /** * 时间Id统计常量,常量前缀 */ - private static int SIGN_COUNT_NUM = 1000; + private static int SIGN_COUNT_NUM = 10000; /** * 时间Id统计常量,常量后缀 */ - private static int COUNT_NUM_SIGN = 1000; + private static int COUNT_NUM_SIGN = 10000; /** * 获取时间Id,后四位常量 @@ -39,8 +39,8 @@ */ public synchronized static String getNewTimeId(){ String timeId = getNowTime() + (COUNT_NUM++); - if(COUNT_NUM > 9999){ - COUNT_NUM = 1000; + if(COUNT_NUM > 99999){ + COUNT_NUM = 10000; } timeId=timeId.substring(2, timeId.length()); return timeId; @@ -53,8 +53,8 @@ */ public synchronized static String getSignNewTimeId(String sign){ String timeId = getNowTime() + sign + (SIGN_COUNT_NUM++); - if(SIGN_COUNT_NUM > 9999){ - SIGN_COUNT_NUM = 1000; + if(SIGN_COUNT_NUM > 99999){ + SIGN_COUNT_NUM = 10000; } timeId=timeId.substring(2, timeId.length()); return timeId; @@ -67,8 +67,8 @@ */ public synchronized static String getNewTimeIdSign(String sign){ String timeId = getNowTime() + (COUNT_NUM_SIGN++) + sign; - if(COUNT_NUM_SIGN > 9999){ - COUNT_NUM_SIGN = 1000; + if(COUNT_NUM_SIGN > 99999){ + COUNT_NUM_SIGN = 10000; } timeId=timeId.substring(2, timeId.length()); return timeId; -- Gitblit v1.8.0