Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
isoft_psa
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
王飞
isoft_psa
Commits
721e7ac8
Commit
721e7ac8
authored
Mar 25, 2025
by
wangjiancheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:项目管理修改
parent
441b812c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
ProjectNumberGenerator.java
...n/java/com/ruoyi/common/utils/ProjectNumberGenerator.java
+3
-3
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/utils/ProjectNumberGenerator.java
View file @
721e7ac8
...
@@ -8,7 +8,7 @@ import java.util.concurrent.atomic.AtomicInteger;
...
@@ -8,7 +8,7 @@ import java.util.concurrent.atomic.AtomicInteger;
public
class
ProjectNumberGenerator
{
public
class
ProjectNumberGenerator
{
// 存储当天每种类型的项目计数器
// 存储当天每种类型的项目计数器
private
static
final
ConcurrentHashMap
<
String
,
AtomicInteger
>
projectCounter
=
new
ConcurrentHashMap
<>();
private
static
final
ConcurrentHashMap
<
String
,
AtomicInteger
>
PROJECT_COUNTER
=
new
ConcurrentHashMap
<>();
/**
/**
* 生成项目编号
* 生成项目编号
...
@@ -22,9 +22,9 @@ public class ProjectNumberGenerator {
...
@@ -22,9 +22,9 @@ public class ProjectNumberGenerator {
// 用于区分不同类型的项目
// 用于区分不同类型的项目
String
key
=
currentDate
+
type
;
String
key
=
currentDate
+
type
;
// 如果该类型今天没有生成过编号,则初始化计数器为 1
// 如果该类型今天没有生成过编号,则初始化计数器为 1
projectCounter
.
computeIfAbsent
(
key
,
k
->
new
AtomicInteger
(
1
));
PROJECT_COUNTER
.
computeIfAbsent
(
key
,
k
->
new
AtomicInteger
(
1
));
// 获取当前计数器值并递增
// 获取当前计数器值并递增
int
count
=
projectCounter
.
get
(
key
).
getAndIncrement
();
int
count
=
PROJECT_COUNTER
.
get
(
key
).
getAndIncrement
();
// 格式化序号为三位数
// 格式化序号为三位数
String
formattedCount
=
String
.
format
(
"%03d"
,
count
);
String
formattedCount
=
String
.
format
(
"%03d"
,
count
);
return
currentDate
+
type
+
formattedCount
;
return
currentDate
+
type
+
formattedCount
;
...
...
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