package com.fzm.mall.server.front.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

public class UUIdUtil {
	
	public static String getUUID() {
		return UUID.randomUUID().toString().replaceAll("-", "");
	}
	
	/*public static void main(String[] args) {
		System.out.println(getUUID());
	}*/


     public static String getDate(String sformat) {
		       Date currentTime = new Date();
		        SimpleDateFormat formatter = new SimpleDateFormat(sformat);
		        String dateString = formatter.format(currentTime);
		      return dateString;
		   }

		     public static String getRandomNum(int num){
		         String numStr = "";
		        for(int i = 0; i < num; i++){
			             numStr += (int)(10*(Math.random()));
			         }
		         return numStr;
		    }

		     public static String getGeneratID(){
		         String sformat = "yyyyMMddhhmmssSSS";
		        int num = 15;
		        String idStr = getDate(sformat) + getRandomNum(num);
		         return idStr;
		     }

		     public static void main(String[] args) {
		         for(int i = 0; i < 1; i++){
			             System.out.println(getGeneratID());
			        }
		 }
}
