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
ef6c09cc
Commit
ef6c09cc
authored
Aug 02, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单V值触发
parent
d6811845
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
7 deletions
+34
-7
pom.xml
yudao-module-member/yudao-module-member-impl/pom.xml
+5
-0
OrderInShippingListener.java
...yudao/module/member/listener/OrderInShippingListener.java
+29
-7
No files found.
yudao-module-member/yudao-module-member-impl/pom.xml
View file @
ef6c09cc
...
...
@@ -54,5 +54,10 @@
<artifactId>
yudao-module-order-api
</artifactId>
<version>
${revision}
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-customer-core
</artifactId>
<version>
${revision}
</version>
</dependency>
</dependencies>
</project>
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/listener/OrderInShippingListener.java
View file @
ef6c09cc
package
cn
.
iocoder
.
yudao
.
module
.
member
.
listener
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ArrayUtil
;
import
cn.hutool.json.JSONUtil
;
import
cn.iocoder.boot.module.order.api.OrderApi
;
...
...
@@ -8,6 +9,8 @@ import cn.iocoder.boot.module.order.api.dto.OrderObjectiveApiDO;
import
cn.iocoder.boot.module.order.api.dto.OrderRespDTO
;
import
cn.iocoder.boot.module.order.enums.OrderStatusApiEnum
;
import
cn.iocoder.yudao.framework.apollo.core.event.OrderInShippingEvent
;
import
cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO
;
import
cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContactsService
;
import
cn.iocoder.yudao.module.member.api.score.MemberUserScoreApi
;
import
cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreOperateReqDTO
;
import
cn.iocoder.yudao.module.member.dal.dataobject.scoreLog.MemberUserScoreLogDO
;
...
...
@@ -23,6 +26,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.stereotype.Component
;
...
...
@@ -46,6 +50,8 @@ public class OrderInShippingListener {
private
MemberUserScoreApi
memberUserScoreApi
;
@Resource
private
MemberUserScoreLogService
memberUserScoreLogService
;
@Resource
private
CustomerContactsService
customerContactsService
;
@EventListener
(
OrderInShippingEvent
.
class
)
public
void
listen
(
OrderInShippingEvent
event
)
{
...
...
@@ -107,6 +113,9 @@ public class OrderInShippingListener {
}
if
(
scoreCount
>
scoreRuleDO
.
getGetScoreOnce
())
{
scoreCount
=
scoreRuleDO
.
getGetScoreOnce
();
}
else
if
(
scoreCount
<=
0
)
{
log
.
info
(
"Order in shipping listener: The score count is less than or equal to 0,orderId:{}"
,
orderId
);
return
;
}
// 会员id
...
...
@@ -118,14 +127,27 @@ public class OrderInShippingListener {
return
;
}
String
[]
orderEntry
=
orderEntryString
.
split
(
","
);
// TODO:后台下单会员获取待确认
if
(
userId
<=
0
)
{
// 后台下单
if
(!
ArrayUtil
.
contains
(
orderEntry
,
String
.
valueOf
(
PlatformTypeEnum
.
BACKEND
.
getValue
())))
{
log
.
info
(
"Order in shipping listener: The order is placed by the background, userId:{}"
,
userId
);
return
;
}
//userId = order.getCustomerId();
// 查询客户绑定会员
List
<
CustomerContactsDO
>
customerContacts
=
customerContactsService
.
getCustomerContactsListByCustomerId
(
order
.
getCustomerId
());
if
(
CollectionUtil
.
isEmpty
(
customerContacts
))
{
log
.
info
(
"Order in shipping listener: The customer is not bound to the member, customerId:{}"
,
order
.
getCustomerId
());
return
;
}
for
(
CustomerContactsDO
customerContact
:
customerContacts
)
{
if
(
customerContact
.
getIsDefault
()
==
1
&&
customerContact
.
getUserid
()
!=
null
)
{
userId
=
customerContact
.
getUserid
();
}
}
if
(
userId
<=
0
)
{
log
.
info
(
"Order in shipping listener: The customer is not have default userId, customerId:{}"
,
order
.
getCustomerId
());
return
;
}
}
else
if
(!
ArrayUtil
.
contains
(
orderEntry
,
String
.
valueOf
(
PlatformTypeEnum
.
APP
.
getValue
()))
&&
!
ArrayUtil
.
contains
(
orderEntry
,
String
.
valueOf
(
PlatformTypeEnum
.
WEB
.
getValue
())))
{
log
.
info
(
"Order in shipping listener: The order is placed by the app or web, userId:{}"
,
userId
);
return
;
...
...
@@ -183,13 +205,13 @@ public class OrderInShippingListener {
private
Integer
computeScoreCount
(
BigDecimal
weightOrVolume
,
List
<
ScoreRuleOrderVExtraVO
.
OrderVRule
>
orderVRules
)
{
Integer
scoreCount
=
0
;
int
w
=
weightOrVolume
.
setScale
(
0
,
RoundingMode
.
HALF_UP
).
intValue
();
ScoreRuleOrderVExtraVO
.
OrderVRule
lastRule
=
orderVRules
.
get
(
orderVRules
.
size
()
-
1
);
if
(
w
>=
lastRule
.
getHigh
())
{
scoreCount
=
lastRule
.
getScore
();
}
for
(
int
i
=
orderVRules
.
size
()
-
1
;
i
>=
0
;
i
--)
{
ScoreRuleOrderVExtraVO
.
OrderVRule
orderVRule
=
orderVRules
.
get
(
i
);
if
(
w
>
orderVRule
.
getHigh
())
{
scoreCount
=
orderVRule
.
getScore
();
break
;
}
if
(
orderVRule
.
getLow
()
<=
w
&&
orderVRule
.
getHigh
()
>
w
)
{
if
(
orderVRule
.
getLow
()
<=
w
&&
orderVRule
.
getHigh
()
>=
w
)
{
scoreCount
=
orderVRule
.
getScore
();
break
;
}
...
...
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