Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-api-boot-master
Commits
05e55582
Commit
05e55582
authored
Oct 09, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix-488: 订单v值兼容无收货人订单
parent
caf49b86
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
OrderVStrategy.java
.../module/member/mq/consumer/score/core/OrderVStrategy.java
+17
-13
No files found.
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/OrderVStrategy.java
View file @
05e55582
...
@@ -100,7 +100,14 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
...
@@ -100,7 +100,14 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
}
else
{
}
else
{
lockKey1
=
"score:rule:order:lock:"
+
order
.
getOrderConsignorDO
().
getCustomerId
();
lockKey1
=
"score:rule:order:lock:"
+
order
.
getOrderConsignorDO
().
getCustomerId
();
}
}
String
lockKey2
=
"score:rule:order:lock:"
+
order
.
getOrderConsigneeDO
().
getCustomerId
();
// 增加订单无收货人时校验
long
consigneeId
=
0
;
if
(
Objects
.
isNull
(
order
.
getOrderConsigneeDO
())
||
Objects
.
isNull
(
order
.
getOrderConsigneeDO
().
getCustomerId
()))
{
log
.
info
(
"Order in shipping listener: The order consignee is empty,orderID:{}"
,
orderId
);
}
else
{
consigneeId
=
order
.
getOrderConsigneeDO
().
getCustomerId
();
}
String
lockKey2
=
"score:rule:order:lock:"
+
consigneeId
;
RLock
lock1
=
redissonClient
.
getLock
(
lockKey1
);
RLock
lock1
=
redissonClient
.
getLock
(
lockKey1
);
RLock
lock2
=
redissonClient
.
getLock
(
lockKey2
);
RLock
lock2
=
redissonClient
.
getLock
(
lockKey2
);
RedissonMultiLock
multiLock
=
new
RedissonMultiLock
(
lock1
,
lock2
);
RedissonMultiLock
multiLock
=
new
RedissonMultiLock
(
lock1
,
lock2
);
...
@@ -110,7 +117,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
...
@@ -110,7 +117,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
log
.
error
(
"Order in shipping listener: get lock error, orderId:{}"
,
orderId
);
log
.
error
(
"Order in shipping listener: get lock error, orderId:{}"
,
orderId
);
}
}
// 获取需要添加积分的用户 发货人
// 获取需要添加积分的用户 发货人
List
<
Long
>
userIds
=
getAddScoreUser
(
order
,
extraInfo
,
scoreRuleDO
);
List
<
Long
>
userIds
=
getAddScoreUser
(
order
.
getUserId
(),
order
.
getOrderConsignorDO
().
getCustomerId
(),
consigneeId
,
extraInfo
,
scoreRuleDO
);
if
(
CollectionUtil
.
isEmpty
(
userIds
))
{
if
(
CollectionUtil
.
isEmpty
(
userIds
))
{
log
.
info
(
"Order in shipping listener: consignor and consignee are not bound to the member, orderId:{}"
,
orderId
);
log
.
info
(
"Order in shipping listener: consignor and consignee are not bound to the member, orderId:{}"
,
orderId
);
return
;
return
;
...
@@ -190,18 +197,10 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
...
@@ -190,18 +197,10 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
/**
/**
* 获取需要加分的用户
* 获取需要加分的用户
*
* @param order
* @param extraInfo
* @param scoreRuleDO
* @return
*/
*/
private
List
<
Long
>
getAddScoreUser
(
OrderRespDTO
order
,
ScoreRuleOrderVExtraVO
extraInfo
,
ScoreRuleDO
scoreRuleDO
)
{
private
List
<
Long
>
getAddScoreUser
(
Long
userId
,
Long
consignorId
,
Long
consigneeId
,
ScoreRuleOrderVExtraVO
extraInfo
,
ScoreRuleDO
scoreRuleDO
)
{
ArrayList
<
Long
>
users
=
new
ArrayList
<>();
ArrayList
<
Long
>
users
=
new
ArrayList
<>();
// 发货人和收货人都要判断给分
// 发货人和收货人都要判断给分
Long
userId
=
order
.
getUserId
();
Long
consigneeId
=
order
.
getOrderConsigneeDO
().
getCustomerId
();
Long
consigneeMemberId
;
boolean
isBackendOrder
=
userId
<=
0
;
boolean
isBackendOrder
=
userId
<=
0
;
// 校验订单入口
// 校验订单入口
if
(!
isOrderEntryValid
(
extraInfo
.
getOrderEntry
(),
isBackendOrder
))
{
if
(!
isOrderEntryValid
(
extraInfo
.
getOrderEntry
(),
isBackendOrder
))
{
...
@@ -209,7 +208,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
...
@@ -209,7 +208,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
}
}
// 如果是后台下单,重新获取发货人用户ID
// 如果是后台下单,重新获取发货人用户ID
if
(
isBackendOrder
)
{
if
(
isBackendOrder
)
{
userId
=
getCustomerMemberId
(
order
.
getOrderConsignorDO
().
getCustomerId
()
);
userId
=
getCustomerMemberId
(
consignorId
);
if
(
userId
==
null
)
{
if
(
userId
==
null
)
{
userId
=
0L
;
userId
=
0L
;
}
}
...
@@ -224,7 +223,12 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
...
@@ -224,7 +223,12 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
}
else
{
}
else
{
addValidUser
(
users
,
userId
);
addValidUser
(
users
,
userId
);
}
}
consigneeMemberId
=
getCustomerMemberId
(
consigneeId
);
// 判断收货人
if
(
consigneeId
==
null
||
consigneeId
<=
0
)
{
return
users
;
}
Long
consigneeMemberId
=
getCustomerMemberId
(
consigneeId
);
if
(
consigneeMemberId
!=
null
&&
consigneeMemberId
>
0
)
{
if
(
consigneeMemberId
!=
null
&&
consigneeMemberId
>
0
)
{
if
(
consigneeMemberId
.
equals
(
userId
))
{
if
(
consigneeMemberId
.
equals
(
userId
))
{
log
.
info
(
"Order in shipping listener: The consignee is the same as the sender, userId:{}"
,
userId
);
log
.
info
(
"Order in shipping listener: The consignee is the same as the sender, userId:{}"
,
userId
);
...
...
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