From 7aab004601e77890b158f19d1735594a8326feaa Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 24 四月 2025 17:11:17 +0800
Subject: [PATCH] 数据库事务注解位置调整

---
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IDLongGenerator.java |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 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..3ab0397 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
@@ -22,6 +22,7 @@
 	//姝D鐢熸垚鍣ㄥ湪鍚勪釜瀛愮郴缁熶腑闅惧厤涓哄悓涓�绫绘暟鎹敓鎴愮浉鍚岀殑ID锛岄�犳垚鏁版嵁搴撴彃鍏ュ洜涓婚敭鐩稿悓鑰屾姤閿�,
 	//鎵�浠ヨ璁℃鍚庣紑锛屾瘡涓瓙绯荤粺鍚庣紑涓嶅悓
 	private static int suffix = 0 ;
+	private static final int noSuffix = 0 ;
 
 	static {
 		last = current() ;
@@ -56,7 +57,7 @@
      * @return ID
      */
     public static Long generateTodayStartId(){
-    	return (currentTodayStart() * chengShu) * 100 + suffix;
+    	return (currentTodayStart() * chengShu) * 100 + noSuffix;
     }
     
     /**
@@ -64,7 +65,7 @@
      * @return ID
      */
     public static Long generateTodayEndId(){
-    	return (currentTodayEnd() * chengShu) * 100 + suffix;
+    	return (currentTodayEnd() * chengShu) * 100 + noSuffix;
     }
     
     
@@ -73,7 +74,7 @@
      * @return ID
      */
     public static Long generateBeforeXDayStartId(int xday){
-    	return (beforeXDayStart(xday) * chengShu) * 100 + suffix;
+    	return (beforeXDayStart(xday) * chengShu) * 100 + noSuffix;
     }
     
     /**
@@ -81,7 +82,7 @@
      * @return ID
      */
     public static Long generateBeforeXDayEndId(int xday){
-    	return (beforeXDayEnd(xday) * chengShu) * 100 + suffix;
+    	return (beforeXDayEnd(xday) * chengShu) * 100 + noSuffix;
     }
   
     
@@ -114,17 +115,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 +239,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