Blame view

src/main/java/com/rnt/utils/SequenceUtil.java 568 Bytes
e80df919   atao   init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  package com.rnt.utils;
  
  import com.jfinal.kit.PropKit;
  
  public class SequenceUtil {
  	
  	   
      /**
       * 
       * @param prx 订单类型
       */
      public static String getNextOrderId(String orderType) {
      	  PropKit.use("a_little_config.txt");
      	  SnowflakeIdWorker idWorker = new SnowflakeIdWorker(Long.parseLong(PropKit.get("workerId")),Long.parseLong(PropKit.get("datacenterId")));
      	  long id = idWorker.nextId();
      	  if(orderType != null && orderType !=""){
      		  return orderType+id;
      	  }else{
      		  return id+"";  
      	  }
      	 
      }
  }