Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐少华
midjourney-proxy
Commits
45e185d9
Commit
45e185d9
authored
Jun 24, 2019
by
songxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
错题本二期相关代码
parent
0a9981a5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
27 deletions
+48
-27
MQTopicProducer.java
...java/com/pcloud/common/core/constant/MQTopicProducer.java
+4
-0
UUIDUitl.java
...ommon/src/main/java/com/pcloud/common/utils/UUIDUitl.java
+44
-27
No files found.
pcloud-common-core/src/main/java/com/pcloud/common/core/constant/MQTopicProducer.java
View file @
45e185d9
...
...
@@ -344,4 +344,8 @@ public class MQTopicProducer {
* 微信群用户绑定TOPIC
*/
public
static
final
String
WXGROUP_USER_BIND
=
"topic.wXGroupUserBind"
;
/**
* 商品创建
*/
public
static
final
String
PRODUCT_CREATE
=
"topic.productCreate"
;
}
pcloud-common/src/main/java/com/pcloud/common/utils/UUIDUitl.java
View file @
45e185d9
...
...
@@ -6,10 +6,10 @@ import java.util.UUID;
/**
* @描述:生成随机数
* @作者:DiSeng.H
* @创建时间:2016年3月10日,下午1:17:02
* @版本:1.0
* @创建时间:2016年3月10日,下午1:17:02 @版本:1.0
*/
public
class
UUIDUitl
{
public
static
final
String
allCharStr
=
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+"
;
public
static
final
String
allChar
=
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
;
public
static
final
String
letterChar
=
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
;
...
...
@@ -18,13 +18,39 @@ public class UUIDUitl {
/**
* 生成的token
*/
public
static
final
String
someCharStr
=
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@$%^&*()_+"
;
public
static
final
String
someCharStr
=
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@$%^&*()_+"
;
public
static
String
[]
chars
=
new
String
[]{
"a"
,
"b"
,
"c"
,
"d"
,
"e"
,
"f"
,
"g"
,
"h"
,
"i"
,
"j"
,
"k"
,
"l"
,
"m"
,
"n"
,
"o"
,
"p"
,
"q"
,
"r"
,
"s"
,
"t"
,
"u"
,
"v"
,
"w"
,
"x"
,
"y"
,
"z"
,
"0"
,
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"I"
,
"J"
,
"K"
,
"L"
,
"M"
,
"N"
,
"O"
,
"P"
,
"Q"
,
"R"
,
"S"
,
"T"
,
"U"
,
"V"
,
"W"
,
"X"
,
"Y"
,
"Z"
};
/**
* 生成8位不重复的随机码
*
* @return
*/
public
static
String
generateShort
()
{
StringBuffer
shortBuffer
=
new
StringBuffer
();
String
uuid
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
for
(
int
i
=
0
;
i
<
8
;
i
++)
{
String
str
=
uuid
.
substring
(
i
*
4
,
i
*
4
+
4
);
int
x
=
Integer
.
parseInt
(
str
,
16
);
shortBuffer
.
append
(
chars
[
x
%
0x3E
]);
}
return
shortBuffer
.
toString
();
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
generateShort
());
}
/**
* 返回一个定长的随机字符串(只包含大小写字母、数字)
*
* @param length
* 随机字符串长度
* @param length 随机字符串长度
* @return 随机字符串
*/
public
static
String
generateInteger
(
int
length
)
{
...
...
@@ -39,8 +65,7 @@ public class UUIDUitl {
/**
* 返回一个定长的随机字符串(只包含大小写字母、数字)
*
* @param length
* 随机字符串长度
* @param length 随机字符串长度
* @return 随机字符串
*/
public
static
String
generateString
(
int
length
)
{
...
...
@@ -55,8 +80,7 @@ public class UUIDUitl {
/**
* 返回一个定长的随机字符串(只包含大小写字母、数字)
*
* @param length
* 随机字符串长度
* @param length 随机字符串长度
* @return 随机字符串
*/
public
static
String
generateAllString
(
int
length
)
{
...
...
@@ -67,11 +91,11 @@ public class UUIDUitl {
}
return
sb
.
toString
();
}
/**
* 返回一个定长的随机字符串(只包含大小写字母、数字),不包含#
*
* @param length
* 随机字符串长度
* @param length 随机字符串长度
* @return 随机字符串
*/
public
static
String
generateSomeString
(
int
length
)
{
...
...
@@ -82,11 +106,11 @@ public class UUIDUitl {
}
return
sb
.
toString
();
}
/**
* 返回一个定长的随机纯字母字符串(只包含大小写字母)
*
* @param length
* 随机字符串长度
* @param length 随机字符串长度
* @return 随机字符串
*/
public
static
String
generateMixString
(
int
length
)
{
...
...
@@ -101,8 +125,7 @@ public class UUIDUitl {
/**
* 返回一个定长的随机纯大写字母字符串(只包含大小写字母)
*
* @param length
* 随机字符串长度
* @param length 随机字符串长度
* @return 随机字符串
*/
public
static
String
generateLowerString
(
int
length
)
{
...
...
@@ -112,8 +135,7 @@ public class UUIDUitl {
/**
* 返回一个定长的随机纯小写字母字符串(只包含大小写字母)
*
* @param length
* 随机字符串长度
* @param length 随机字符串长度
* @return 随机字符串
*/
public
static
String
generateUpperString
(
int
length
)
{
...
...
@@ -123,8 +145,7 @@ public class UUIDUitl {
/**
* 生成一个定长的纯0字符串
*
* @param length
* 字符串长度
* @param length 字符串长度
* @return 纯0字符串
*/
public
static
String
generateZeroString
(
int
length
)
{
...
...
@@ -138,10 +159,8 @@ public class UUIDUitl {
/**
* 根据数字生成一个定长的字符串,长度不够前面补0
*
* @param num
* 数字
* @param fixdlenth
* 字符串长度
* @param num 数字
* @param fixdlenth 字符串长度
* @return 定长的字符串
*/
public
static
String
toFixdLengthString
(
long
num
,
int
fixdlenth
)
{
...
...
@@ -159,10 +178,8 @@ public class UUIDUitl {
/**
* 根据数字生成一个定长的字符串,长度不够前面补0
*
* @param num
* 数字
* @param fixdlenth
* 字符串长度
* @param num 数字
* @param fixdlenth 字符串长度
* @return 定长的字符串
*/
public
static
String
toFixdLengthString
(
int
num
,
int
fixdlenth
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment