Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
property-management
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
property-management
Commits
449a7759
Commit
449a7759
authored
Jan 25, 2021
by
zhangdaiscott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JeecgBoot 2.4.2 积木报表版本发布,基于SpringBoot的低代码平台
parent
33792096
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/rule/OrderNumberRule.java
+36
-0
No files found.
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/rule/OrderNumberRule.java
0 → 100644
View file @
449a7759
package
org
.
jeecg
.
modules
.
system
.
rule
;
import
com.alibaba.fastjson.JSONObject
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.math.RandomUtils
;
import
org.jeecg.common.handler.IFillRuleHandler
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
/**
* 填值规则Demo:生成订单号
* 【测试示例】
*/
public
class
OrderNumberRule
implements
IFillRuleHandler
{
@Override
public
Object
execute
(
JSONObject
params
,
JSONObject
formData
)
{
String
prefix
=
"CN"
;
//订单前缀默认为CN 如果规则参数不为空,则取自定义前缀
if
(
params
!=
null
)
{
Object
obj
=
params
.
get
(
"prefix"
);
if
(
obj
!=
null
)
prefix
=
obj
.
toString
();
}
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
int
random
=
RandomUtils
.
nextInt
(
90
)
+
10
;
String
value
=
prefix
+
format
.
format
(
new
Date
())
+
random
;
// 根据formData的值的不同,生成不同的订单号
String
name
=
formData
.
getString
(
"name"
);
if
(!
StringUtils
.
isEmpty
(
name
))
{
value
+=
name
;
}
return
value
;
}
}
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