1.获得UUID
import java.util.UUID;
UUID uid=UUID.randomUUID();//获得uuid
String uuidPreplan=uid.toString();//变成String
2.获得当前时间
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
//获得当前时间,
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//转化为数据库存储的Timestamp格式
Timestamp t=Timestamp.valueOf(sdf.format(System.currentTimeMillis()));
System.out.println("转化为Timestamp:"+t);
//转化为String格式
Date d=new Date();
String time=sdf.format(d);
System.out.println("转化为String:"+time);