多因素UUID
This commit is contained in:
@ -25,6 +25,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@ -56,8 +57,7 @@ public class BizShortMessageServiceImpl extends BaseServiceImpl<BizShortMessageM
|
||||
@Override
|
||||
public Boolean authCodeSend(String mobile) {
|
||||
String id = PropertyUtils.getSnowflakeId();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
String bizSn = "ebtp"+id+"ebtp"+ LocalDate.now().format(formatter);
|
||||
String bizSn = getUUID(15);
|
||||
String s=appCode;
|
||||
BizShortMessage shortMessage = new BizShortMessage();
|
||||
shortMessage.setId(id)
|
||||
@ -133,8 +133,35 @@ public class BizShortMessageServiceImpl extends BaseServiceImpl<BizShortMessageM
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
// if (message!=null){
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
*32位默认长度的uuid
|
||||
* (获取32位uuid)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getUUID()
|
||||
{
|
||||
return UUID.randomUUID().toString().replace("-", "");
|
||||
}
|
||||
|
||||
public static String getUUID(int len)
|
||||
{
|
||||
if(0 >= len)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String uuid = getUUID();
|
||||
System.out.println(uuid);
|
||||
StringBuffer str = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
str.append(uuid.charAt(i));
|
||||
}
|
||||
|
||||
return str.toString();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user