From e6e10141af7c033eeddb649c6d2d1ed93f55bf3f Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期一, 10 十月 2022 16:09:43 +0800
Subject: [PATCH] 案件商铺编码

---
 ycl-common/src/main/java/com/ycl/utils/common/RandomUtils.java |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/ycl-common/src/main/java/com/ycl/utils/common/RandomUtils.java b/ycl-common/src/main/java/com/ycl/utils/common/RandomUtils.java
index 22a574e..67b56a5 100644
--- a/ycl-common/src/main/java/com/ycl/utils/common/RandomUtils.java
+++ b/ycl-common/src/main/java/com/ycl/utils/common/RandomUtils.java
@@ -21,13 +21,15 @@
      */
     private static final String FORMT_STRING = "888888";
 
+    private static final String FORMT_STRING_0 = "000000";
+
     /**
      * 鑾峰彇鐢ㄦ埛鍚�
      *
      * @param userId
      * @return
      */
-    public static   String getUserId(long userId) {
+    public static String getUserId(long userId) {
         return NICK_NAME + formatSign(userId)
                 + generateRandomInt(SIGN_LENGTH);
 
@@ -38,6 +40,24 @@
      *
      * @return4
      */
+    public static String formatSign(Integer param, Integer lenght) {
+        String str = Long.toString(param);
+        int length = str.length() - lenght;
+        if (length == 0) {
+            return str;
+        } else if (length < 0) {
+            str = "0" + str;
+            return FORMT_STRING_0.substring(0, Math.abs(length) - 1) + str;
+        } else {
+            return str.substring(length);
+        }
+    }
+
+    /**
+     * 鏍煎紡鍖栨爣璁�
+     *
+     * @return4
+     */
     private static String formatSign(long param) {
         String str = Long.toString(param);
         int length = str.length() - SIGN_LENGTH;

--
Gitblit v1.8.0