Administrator
2024-07-24 f844554d994465a14e93b0334c2677a37876d7eb
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个ID
@@ -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) + "毫秒");
//