Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
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
youjj
cloud-platform
Commits
23823d6b
Commit
23823d6b
authored
Nov 06, 2020
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
8d731f98
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
OrderUtil.java
...va/com/github/wxiaoqi/security/common/util/OrderUtil.java
+8
-7
No files found.
ace-common/src/main/java/com/github/wxiaoqi/security/common/util/OrderUtil.java
View file @
23823d6b
...
...
@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Random
;
import
java.util.concurrent.atomic.AtomicInteger
;
public
class
OrderUtil
{
...
...
@@ -14,7 +15,7 @@ public class OrderUtil {
public
static
final
String
COMPANY_MID
=
"05"
;
static
Date
today
=
new
Date
();
static
int
orderIndex
=
0
;
static
AtomicInteger
orderIndex
=
new
AtomicInteger
(
0
)
;
@SuppressWarnings
(
"deprecation"
)
private
static
String
getIndex
(
String
midFix
)
{
...
...
@@ -25,19 +26,19 @@ public class OrderUtil {
SimpleDateFormat
outFormat
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
String
currTime
=
outFormat
.
format
(
n
);
if
(
orderIndex
>
0
)
{
if
(
orderIndex
.
intValue
()
>
0
)
{
if
(
n
.
getYear
()
==
today
.
getYear
()
&&
n
.
getMonth
()
==
today
.
getMonth
()
&&
n
.
getDay
()
==
today
.
getDay
())
{
orderIndex
+=
1
;
orderIndex
.
getAndIncrement
()
;
}
else
{
today
=
n
;
orderIndex
=
1
;
orderIndex
=
new
AtomicInteger
(
1
)
;
}
}
else
{
today
=
n
;
orderIndex
=
1
;
orderIndex
=
new
AtomicInteger
(
1
)
;
}
if
(
orderIndex
>
9999
)
{
orderIndex
=
1
;
if
(
orderIndex
.
intValue
()
>
9999
)
{
orderIndex
=
new
AtomicInteger
(
1
)
;
}
String
indexString
=
String
.
format
(
"%s%s%04d"
,
currTime
,
midFix
,
orderIndex
);
return
indexString
;
...
...
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