Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
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
order-group-application
order-group
Commits
075dd586
Commit
075dd586
authored
Jun 03, 2021
by
hanghang.wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整取餐码起始规则
parent
cd2f20c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
order-application-service/src/main/java/cn/freemud/manager/OrderTackCodeManager.java
+9
-8
No files found.
order-application-service/src/main/java/cn/freemud/manager/OrderTackCodeManager.java
View file @
075dd586
...
...
@@ -73,13 +73,13 @@ public class OrderTackCodeManager {
}
else
if
(
StringUtils
.
isNotEmpty
(
rule
)
&&
rule
.
equals
(
OrderTackCodeRuleEnum
.
THE_CUSTOM
.
getCode
()+
""
))
{
//规则自定义
Map
<
Object
,
Object
>
tackCodeSettingMap
=
redisTemplate
.
opsForHash
().
entries
(
randomKey
);
log
.
info
(
"tackCode rule3 : "
+
assortmentTackCodeRule
);
//
log.info("tackCode rule3 : " + assortmentTackCodeRule );
if
(
tackCodeSettingMap
.
isEmpty
())
{
if
(
Objects
.
isNull
(
assortmentTackCodeRule
))
{
log
.
info
(
"tackCode rule4 : "
+
assortmentTackCodeRule
);
//
log.info("tackCode rule4 : " + assortmentTackCodeRule );
assortmentTackCodeRule
=
assortmentTackCodeRuleManager
.
queryTackCodeRule
(
partnerId
);
}
log
.
info
(
"tackCode rule5 : "
+
assortmentTackCodeRule
);
//
log.info("tackCode rule5 : " + assortmentTackCodeRule );
initTackCodeSettingHash
(
assortmentTackCodeRule
,
randomKey
,
tackCodeSettingMap
);
}
//判断订单类型
...
...
@@ -87,12 +87,13 @@ public class OrderTackCodeManager {
OrderType
orderTypeEnum
=
OrderType
.
getByCode
(
orderType
);
if
(!
Objects
.
isNull
(
orderTypeEnum
)){
String
tackDesc
=
orderTypeEnum
.
getTackDesc
();
head
=
(
String
)
tackCodeSettingMap
.
get
(
tackDesc
+
"Head"
);
head
=
tackCodeSettingMap
.
get
(
tackDesc
+
"Head"
).
toString
(
);
Integer
length
=
(
Integer
)
tackCodeSettingMap
.
get
(
tackDesc
+
"Length"
);
code
=
redisTemplate
.
opsForHash
().
increment
(
key
,
tackDesc
+
"Code"
,
1
).
toString
();
if
(
code
.
length
()
>
length
)
{
//处理并发情况下,同时含有超过上限的数字。在第一次已经变更为1之后,再次塞1进缓存导致取餐吗重复
if
(
redisTemplate
.
opsForHash
().
get
(
key
,
tackDesc
+
"Code"
).
toString
().
length
()
<
length
){
code
=
tackCodeSettingMap
.
get
(
tackDesc
+
"Code"
).
toString
();
String
incrementCode
=
redisTemplate
.
opsForHash
().
increment
(
key
,
tackDesc
+
"Code"
,
1
).
toString
();
if
(
incrementCode
.
length
()
>
length
)
{
//处理并发情况下,同时含有超过上限的数字。在第一次已经变更为1之后,再次塞1进缓存导致取餐吗重复。暂时无效,后续调整
if
(
incrementCode
.
length
()
<
length
){
code
=
redisTemplate
.
opsForHash
().
increment
(
key
,
tackDesc
+
"Code"
,
1
).
toString
();
}
else
{
code
=
"1"
;
...
...
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