Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
40d50d15
Commit
40d50d15
authored
Nov 11, 2022
by
wanglong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复项目编号自增重复问题
parent
976fd7d0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
ProjectController.java
...mos/boot/module/ugp/biz/controller/ProjectController.java
+17
-4
No files found.
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/controller/ProjectController.java
View file @
40d50d15
...
@@ -31,6 +31,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
...
@@ -31,6 +31,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
...
@@ -92,18 +93,30 @@ public class ProjectController extends BaseController {
...
@@ -92,18 +93,30 @@ public class ProjectController extends BaseController {
projectInitiationService
.
start
(
project
);
projectInitiationService
.
start
(
project
);
return
ResponseHelper
.
buildResponse
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
}
// 静态变量存储最大值
private
static
final
AtomicInteger
atomicNum
=
new
AtomicInteger
();
private
static
final
Integer
INIT_CODE_NUM
=
0
;
public
String
getCode
(){
public
String
getCode
(){
String
date
=
new
SimpleDateFormat
(
"MMdd"
).
format
(
new
Date
());
String
date
=
new
SimpleDateFormat
(
"MMdd"
).
format
(
new
Date
());
String
code
=
"XM"
+
date
+
"-"
;
String
code
=
"XM"
+
date
+
"-"
;
int
c
=
1
;
String
format
=
""
;
LambdaQueryWrapper
<
Project
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
Project
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
orderByDesc
(
Project:
:
getCode
);
wrapper
.
orderByDesc
(
Project:
:
getCode
);
String
projectCode
=
projectServiceImpl
.
list
(
wrapper
).
iterator
().
next
().
getCode
();
String
projectCode
=
projectServiceImpl
.
list
(
wrapper
).
iterator
().
next
().
getCode
();
if
(!
ValidationUtil
.
isEmpty
(
projectCode
)){
if
(!
ValidationUtil
.
isEmpty
(
projectCode
)){
c
=
Integer
.
parseInt
(
projectCode
.
substring
(
projectCode
.
indexOf
(
"-"
)+
1
,
projectCode
.
length
()))+
1
;
String
proDate
=
projectCode
.
substring
(
projectCode
.
indexOf
(
"M"
)+
1
,
projectCode
.
length
()
-
5
);
if
(
proDate
.
equals
(
date
)){
String
substring
=
projectCode
.
substring
(
projectCode
.
length
()
-
4
);
atomicNum
.
set
(
Integer
.
parseInt
(
substring
));
}
else
{
atomicNum
.
set
(
INIT_CODE_NUM
);
}
format
=
String
.
format
(
"%04d"
,
atomicNum
.
incrementAndGet
());
}
}
return
code
+
c
;
return
code
+
format
;
}
}
public
Map
<
String
,
String
>
getInfo
(
String
regionName
,
String
regionCode
,
Long
sequenceNbr
){
public
Map
<
String
,
String
>
getInfo
(
String
regionName
,
String
regionCode
,
Long
sequenceNbr
){
...
...
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