From d5e62ae5585f5d479921439e9f1af462a783f740 Mon Sep 17 00:00:00 2001
From: mg <maokecheng@163.com>
Date: 星期四, 13 十月 2022 18:04:08 +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