From aa925d851857f50eff0556411366690d9a78a0e5 Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期一, 27 十一月 2023 17:30:26 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/PlayPai

---
 cloud-server-activity/src/main/java/com/dsh/activity/util/UUIDUtil.java |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/util/UUIDUtil.java b/cloud-server-activity/src/main/java/com/dsh/activity/util/UUIDUtil.java
index 7390847..f10bca6 100644
--- a/cloud-server-activity/src/main/java/com/dsh/activity/util/UUIDUtil.java
+++ b/cloud-server-activity/src/main/java/com/dsh/activity/util/UUIDUtil.java
@@ -1,7 +1,6 @@
 package com.dsh.activity.util;
 
 
-
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.UUID;
@@ -16,51 +15,54 @@
 
     /**
      * 定义生成原生的UUID随机码
+     *
      * @return
      */
-    public static String getNativeUUID(){
+    public static String getNativeUUID() {
         return UUID.randomUUID().toString();
     }
 
 
     /**
      * 生成32位随机码
+     *
      * @return
      */
-    public static String getRandomCode(){
+    public static String getRandomCode() {
         return UUIDUtil.getNativeUUID().replaceAll("-", "");
     }
 
 
     /**
      * 获取给定长度的随机码
+     *
      * @param num
      * @return
      * @throws Exception
      */
-    public static String getRandomCode(Integer num) throws Exception{
+    public static String getRandomCode(Integer num) throws Exception {
         String str = null;
-        if(0 < num){
-            if(num % 32 > 0){
+        if (0 < num) {
+            if (num % 32 > 0) {
                 Integer s = num / 32;
                 Integer l = num % 32;
                 StringBuffer sb = new StringBuffer();
-                for(int i = 0; i < s; i++){
+                for (int i = 0; i < s; i++) {
                     sb.append(UUIDUtil.getRandomCode());
                 }
                 sb.append(UUIDUtil.getRandomCode().substring(0, l));
                 str = sb.toString();
-            }else if(num % 32 == 0){
+            } else if (num % 32 == 0) {
                 Integer s = num / 32;
                 StringBuffer sb = new StringBuffer();
-                for(int i = 0; i < s; i++){
+                for (int i = 0; i < s; i++) {
                     sb.append(UUIDUtil.getRandomCode());
                 }
                 str = sb.toString();
-            }else{
+            } else {
                 str = UUIDUtil.getRandomCode().substring(0, num);
             }
-        }else{
+        } else {
             throw new Exception("参数只能大于0");
         }
         return str;
@@ -69,9 +71,10 @@
 
     /**
      * 获取根据当前时间的字符串数据
+     *
      * @return
      */
-    public synchronized static String getTimeStr(){
+    public synchronized static String getTimeStr() {
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmssS");
         return simpleDateFormat.format(new Date());
     }
@@ -85,17 +88,16 @@
      * @Return
      * @Exception
      */
-    public static String getNumberRandom(Integer num){
-        if(null == num){
+    public static String getNumberRandom(Integer num) {
+        if (null == num) {
             num = 32;
         }
         StringBuffer sb = new StringBuffer();
-        for(int i = 0; i < num; i++){
+        for (int i = 0; i < num; i++) {
             sb.append(Double.valueOf(Math.random() * 10).intValue());
         }
         return sb.toString();
     }
-
 
 
 }

--
Gitblit v1.7.1