Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dcs-plan
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
INET-TWO
server
dcs-plan
Commits
a2fbc69b
Commit
a2fbc69b
authored
Sep 20, 2024
by
wei
🎱
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
供方名录编码规则
parent
0dc92b03
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
ProcessPlanEncode.java
...ava/com/yonde/dcs/plan/core/encode/ProcessPlanEncode.java
+51
-0
No files found.
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/encode/ProcessPlanEncode.java
0 → 100644
View file @
a2fbc69b
package
com
.
yonde
.
dcs
.
plan
.
core
.
encode
;
import
com.yonde.dcs.plan.common.vo.ExtSupplierManageVO
;
import
com.yonde.dcs.plan.core.service.ExtSupplierManageService
;
import
com.yonde.dex.initialization.encoder.CustomizeEncode
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.time.Year
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 工艺规程自定义编码规则
*/
@Slf4j
@Component
public
class
ProcessPlanEncode
implements
CustomizeEncode
<
ExtSupplierManageVO
>
{
@Autowired
ExtSupplierManageService
extSupplierManageService
;
@Override
public
synchronized
String
generateEncode
(
ExtSupplierManageVO
extSupplierManageVO
)
{
String
code
=
""
;
String
currentYear
=
Year
.
now
().
getValue
()
+
""
;
// 查询出最大编号+1
List
<
ExtSupplierManageVO
>
allList
=
extSupplierManageService
.
findAll
();
allList
=
allList
.
stream
().
sorted
(
Comparator
.
comparing
(
ExtSupplierManageVO:
:
getCreateTime
)
.
reversed
()).
collect
(
Collectors
.
toList
());
// 初始规则 G-1-2024
if
(
CollectionUtils
.
isEmpty
(
allList
))
{
code
=
"G-1-"
+
currentYear
;
}
else
{
String
number
=
allList
.
get
(
0
).
getNumber
();
String
[]
split
=
number
.
split
(
"-"
);
if
(
split
.
length
>
2
)
{
int
seq
=
Integer
.
parseInt
(
split
[
1
])
+
1
;
//每次加1
code
=
"G-"
+
seq
+
"-"
+
currentYear
;
}
}
log
.
info
(
"generateEncode.code={}"
,
code
);
return
code
;
}
}
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