mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-22 18:36:52 +08:00
adding wx-pay and alipay logic and order and good logic code
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package net.lab1024.smartadmin.util;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.FieldPosition;
|
||||
import java.text.Format;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
|
||||
public class GenerateSequenceUtil {
|
||||
|
||||
/** .log */
|
||||
|
||||
/** The FieldPosition. */
|
||||
private static final FieldPosition HELPER_POSITION = new FieldPosition(0);
|
||||
|
||||
/** This Format for format the data to special format. */
|
||||
private final static Format dateFormat = new SimpleDateFormat("MMddHHmmssS");
|
||||
|
||||
/** This Format for format the number to special format. */
|
||||
private final static NumberFormat numberFormat = new DecimalFormat("0000");
|
||||
|
||||
/** This int is the sequence number ,the default value is 0. */
|
||||
private static int seq = 0;
|
||||
|
||||
private static final int MAX = 9999;
|
||||
|
||||
/**
|
||||
* ʱ<><CAB1><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* @return String
|
||||
*/
|
||||
public static synchronized String generateSequenceNo() {
|
||||
|
||||
Calendar rightNow = Calendar.getInstance();
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
dateFormat.format(rightNow.getTime(), sb, HELPER_POSITION);
|
||||
|
||||
numberFormat.format(seq, sb, HELPER_POSITION);
|
||||
|
||||
if (seq == MAX) {
|
||||
seq = 0;
|
||||
} else {
|
||||
seq++;
|
||||
}
|
||||
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user