Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
16fc2d00
Commit
16fc2d00
authored
Jun 25, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
常规BUG的修改
parent
2a6fb6bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
StringHelper.java
...c/main/java/com/yanzuoguang/util/helper/StringHelper.java
+12
-2
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/StringHelper.java
View file @
16fc2d00
...
@@ -742,7 +742,7 @@ public class StringHelper {
...
@@ -742,7 +742,7 @@ public class StringHelper {
* @return
* @return
*/
*/
public
static
String
getNewID
()
{
public
static
String
getNewID
()
{
String
tag
=
String
.
format
(
"z%012d"
,
System
.
currentTimeMillis
()
/
1000
);
String
tag
=
getNewIdTag
(
System
.
currentTimeMillis
()
);
String
id
=
getUUID
();
String
id
=
getUUID
();
return
tag
+
id
.
substring
(
tag
.
length
());
return
tag
+
id
.
substring
(
tag
.
length
());
}
}
...
@@ -820,11 +820,21 @@ public class StringHelper {
...
@@ -820,11 +820,21 @@ public class StringHelper {
if
(
date
==
null
)
{
if
(
date
==
null
)
{
throw
new
CodeException
(
"生成时间搓 MD5 ID 时,时间不能为空"
);
throw
new
CodeException
(
"生成时间搓 MD5 ID 时,时间不能为空"
);
}
}
String
tag
=
String
.
format
(
"z%012d"
,
date
.
getTime
()
/
1000
);
String
tag
=
getNewIdTag
(
date
.
getTime
()
);
String
id
=
md51
(
getId
(
froms
));
String
id
=
md51
(
getId
(
froms
));
return
tag
+
id
.
substring
(
tag
.
length
());
return
tag
+
id
.
substring
(
tag
.
length
());
}
}
/**
* 获取新Id标价
*
* @param time
* @return
*/
private
static
String
getNewIdTag
(
long
time
)
{
return
String
.
format
(
"z%015d"
,
time
);
}
/**
/**
* 获取组合编号的MD5值
* 获取组合编号的MD5值
*
*
...
...
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