From 8910275656c9bf398832dc14957a03684a593e96 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期五, 30 八月 2024 15:16:58 +0800
Subject: [PATCH] 2024-08-30 朱宝民 修改配置文件bug
---
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IDLongGenerator.java | 27 +++++++++++++++------------
1 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IDLongGenerator.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IDLongGenerator.java
index 9f6e86f..3b8a133 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IDLongGenerator.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IDLongGenerator.java
@@ -11,7 +11,7 @@
private static final Object synObj = new Object() ;
- private static final int yearLenght = 4 ;//4锛氬勾搴﹀彇鍥涗綅锛� 3锛氬勾搴﹀彇涓変綅锛� 2锛氬勾搴﹀彇涓や綅锛� 1锛氬勾搴﹀彇涓�浣嶏紝 0锛氬勾搴﹀彇0浣�
+ private static final int yearLength = 4 ;//4锛氬勾搴﹀彇鍥涗綅锛� 3锛氬勾搴﹀彇涓変綅锛� 2锛氬勾搴﹀彇涓や綅锛� 1锛氬勾搴﹀彇涓�浣嶏紝 0锛氬勾搴﹀彇0浣�
private static int add = 0 ;
private static final int chengShu = 1000 ;//1000锛氫笁浣嶈嚜澧為噺锛屽嵆涓�绉掗挓鍙骇鐢�10000涓狪D
@@ -114,17 +114,17 @@
//涓婃鐢熸垚ID 涓庢湰娆$敓鎴怚D 涓嶅湪鍚屼竴绉掑唴
last = now ;
add = 0 ;
- id = last * chengShu + add ++;
+ id = last * chengShu + add++;
}else{
//涓婃鐢熸垚ID 涓庢湰娆$敓鎴怚D 鍦ㄥ悓涓�绉掑唴
if(add >= maxAdd){
//闄勫姞閲忓凡缁忕敤灏�
waitNextSecond(last) ;//绛夊埌涓嬩竴绉�
- id = last * chengShu + add ++ ;//杩斿洖涓婁竴绉掔敓鎴愮殑ID
+ id = last * chengShu + add++ ;//杩斿洖涓婁竴绉掔敓鎴愮殑ID
add = 0 ;//闄勫姞閲忓綊闆讹紝涓轰笅涓�绉掑噯澶�
}else{
//闄勫姞閲忔湭鐢ㄥ敖
- id = last * chengShu + add ++ ;
+ id = last * chengShu + add++ ;
}
}
return (id * 100) + suffix ;
@@ -238,28 +238,31 @@
* @return 澶勭悊鍚庣殑骞村害
*/
private static int dealYear(int year){
- if(yearLenght == 0){
+ if(yearLength == 0){
return 0 ;
- }else if(yearLenght == 1){
+ }else if(yearLength == 1){
return year % 10 ;
- }else if(yearLenght == 2){
+ }else if(yearLength == 2){
return year % 100 ;
- }else if(yearLenght == 3){
+ }else if(yearLength == 3){
return year % 1000 ;
- }else if(yearLenght == 4){
+ }else if(yearLength == 4){
return year ;
}else{
return year ;
}
}
-//
+
// public static void main(String[] args){
+// Calendar cal = Calendar.getInstance();
+// System.out.println(cal.get(Calendar.MONTH) + 1) ;
+//
// IDLongGenerator o = new IDLongGenerator() ;
-// int total = 800 ;
-// long start = System.currentTimeMillis() ;
+// int total = 1 ;
// for(int i = 0 ; i < total ; i++){
// System.out.println(o.generate()) ;
// }
+// long start = System.currentTimeMillis() ;
// long end = System.currentTimeMillis() ;
// System.out.println("浜х敓" + total + "ID鐢ㄦ椂" + (end - start) + "姣");
//
--
Gitblit v1.8.0