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
0b755e3b
Commit
0b755e3b
authored
Oct 09, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix-488: 订单v值兼容无收货人订单
parent
8d08d0eb
Changes
1
Hide 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 @
0b755e3b
...
...
@@ -100,7 +100,14 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
}
else
{
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
lock2
=
redissonClient
.
getLock
(
lockKey2
);
RedissonMultiLock
multiLock
=
new
RedissonMultiLock
(
lock1
,
lock2
);
...
...
@@ -110,7 +117,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
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
))
{
log
.
info
(
"Order in shipping listener: consignor and consignee are not bound to the member, orderId:{}"
,
orderId
);
return
;
...
...
@@ -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
<>();
// 发货人和收货人都要判断给分
Long
userId
=
order
.
getUserId
();
Long
consigneeId
=
order
.
getOrderConsigneeDO
().
getCustomerId
();
Long
consigneeMemberId
;
boolean
isBackendOrder
=
userId
<=
0
;
// 校验订单入口
if
(!
isOrderEntryValid
(
extraInfo
.
getOrderEntry
(),
isBackendOrder
))
{
...
...
@@ -209,7 +208,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
}
// 如果是后台下单,重新获取发货人用户ID
if
(
isBackendOrder
)
{
userId
=
getCustomerMemberId
(
order
.
getOrderConsignorDO
().
getCustomerId
()
);
userId
=
getCustomerMemberId
(
consignorId
);
if
(
userId
==
null
)
{
userId
=
0L
;
}
...
...
@@ -224,7 +223,12 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
}
else
{
addValidUser
(
users
,
userId
);
}
consigneeMemberId
=
getCustomerMemberId
(
consigneeId
);
// 判断收货人
if
(
consigneeId
==
null
||
consigneeId
<=
0
)
{
return
users
;
}
Long
consigneeMemberId
=
getCustomerMemberId
(
consigneeId
);
if
(
consigneeMemberId
!=
null
&&
consigneeMemberId
>
0
)
{
if
(
consigneeMemberId
.
equals
(
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