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
7bc0cadf
Commit
7bc0cadf
authored
Jan 13, 2025
by
Smile
Committed by
wux
Jan 13, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
会员积分规则匹配,当有两个不相冲突的积分规则,只匹配一个问题修改
parent
141ac79e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
64 deletions
+80
-64
CustomerContactsServiceImpl.java
...service/customerContacts/CustomerContactsServiceImpl.java
+12
-1
OrderVStrategy.java
.../module/member/mq/consumer/score/core/OrderVStrategy.java
+68
-63
No files found.
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/service/customerContacts/CustomerContactsServiceImpl.java
View file @
7bc0cadf
...
...
@@ -16,6 +16,8 @@ import cn.iocoder.yudao.module.customer.vo.customer.customerContacts.CustomerCon
import
cn.iocoder.yudao.module.customer.vo.customer.customerContacts.CustomerContactsPageReqVO
;
import
cn.iocoder.yudao.module.customer.vo.customer.customerContacts.CustomerContactsUpdateReqVO
;
import
cn.iocoder.yudao.module.ecw.service.paramValid.ParamValidatorService
;
import
cn.iocoder.yudao.module.member.api.user.MemberUserApi
;
import
cn.iocoder.yudao.module.member.api.user.dto.UserRespDTO
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -44,6 +46,8 @@ public class CustomerContactsServiceImpl extends AbstractService<CustomerContact
private
CustomerContactsMapper
customerContactsMapper
;
@Resource
private
ParamValidatorService
paramValidatorService
;
@Resource
private
MemberUserApi
memberUserApi
;
@Override
public
Long
createCustomerContacts
(
CustomerContactsCreateReqVO
createReqVO
)
{
...
...
@@ -124,7 +128,14 @@ public class CustomerContactsServiceImpl extends AbstractService<CustomerContact
@Override
public
List
<
CustomerContactsDO
>
getCustomerContactsListByCustomerId
(
Long
customerId
)
{
return
customerContactsMapper
.
selectList
(
new
LambdaQueryWrapperX
<
CustomerContactsDO
>().
eqIfPresent
(
CustomerContactsDO:
:
getCustomerId
,
customerId
));
List
<
CustomerContactsDO
>
customerContactsDOS
=
customerContactsMapper
.
selectList
(
new
LambdaQueryWrapperX
<
CustomerContactsDO
>().
eqIfPresent
(
CustomerContactsDO:
:
getCustomerId
,
customerId
));
customerContactsDOS
.
forEach
(
customerContactsDO
->
{
if
(
customerContactsDO
.
getUserid
()!=
null
)
{
UserRespDTO
user
=
memberUserApi
.
getUser
(
customerContactsDO
.
getUserid
());
customerContactsDO
.
setUsername
(
user
.
getNickname
());
}
});
return
customerContactsDOS
;
}
@Override
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/OrderVStrategy.java
View file @
7bc0cadf
...
...
@@ -35,6 +35,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
static
cn
.
iocoder
.
yudao
.
module
.
member
.
enums
.
TransportTypeEnum
.
SPECIAL_LINE_AIR_FREIGHT
;
...
...
@@ -97,13 +98,15 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
consigneeId
=
order
.
getOrderConsigneeDO
().
getCustomerId
();
}
// 获取订单规则
ScoreRuleDO
scoreRuleDO
=
this
.
getMatchRule
(
order
,
consigneeId
);
if
(
Objects
.
isNull
(
scoreRuleDO
))
{
List
<
ScoreRuleDO
>
scoreRuleDOList
=
this
.
getMatchRule
(
order
,
consigneeId
);
if
(
Objects
.
isNull
(
scoreRuleDO
List
))
{
log
.
info
(
"Order in shipping listener: No score rule match,orderID:{}"
,
orderId
);
orderOperateLogDTO
.
setBody
(
JSONObject
.
toJSONString
(
logBody
.
append
(
"无匹配积分规则;"
)));
orderApi
.
createOrderOperateLog
(
orderOperateLogDTO
);
return
;
}
for
(
int
i
=
0
;
i
<
scoreRuleDOList
.
size
();
i
++)
{
ScoreRuleDO
scoreRuleDO
=
scoreRuleDOList
.
get
(
i
);
orderOperateLogDTO
.
setCreator
(
scoreRuleDO
.
getCode
());
ScoreRuleOrderVExtraVO
extraInfo
=
JSONUtil
.
toBean
(
scoreRuleDO
.
getExtra
(),
ScoreRuleOrderVExtraVO
.
class
);
String
lockKey1
;
...
...
@@ -164,6 +167,8 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
}
finally
{
multiLock
.
unlock
();
}
}
orderOperateLogDTO
.
setBody
(
JSONObject
.
toJSONString
(
logBody
.
append
(
"获取积分成功"
)));
orderApi
.
createOrderOperateLog
(
orderOperateLogDTO
);
}
...
...
@@ -213,7 +218,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
boolean
hasConsignor
=
ArrayUtil
.
contains
(
customerSideArray
,
String
.
valueOf
(
CustomerSideEnum
.
CONSIGNOR
.
getValue
()));
// 发货人和收货人都要判断给分
boolean
isBackendOrder
=
userId
<=
0
;
logNote
.
append
(
"此订单为"
).
append
(
isBackendOrder
?
"后台"
:
"客户端"
).
append
(
"下单;"
);
logNote
.
append
(
"
匹配规则"
+
scoreRuleDO
.
getCode
()+
"
此订单为"
).
append
(
isBackendOrder
?
"后台"
:
"客户端"
).
append
(
"下单;"
);
// 如果是后台下单,重新获取发货人用户ID
if
(
isBackendOrder
)
{
CustomerContactsDO
contactsDO
=
getCustomerMemberId
(
consignorId
);
...
...
@@ -224,7 +229,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
if
(!
hasConsignor
&&
customerSideArray
.
length
!=
0
){
logNote
.
append
(
"发货人绑定会员:"
).
append
(
contactsDO
.
getUsername
()).
append
(
",会员ID:"
).
append
(
userId
).
append
(
";"
);
userId
=
0L
;
logNote
.
append
(
"积分规则客户方不包含发货人"
);
logNote
.
append
(
"积分规则客户方不包含发货人
"
);
}
if
(
hasConsignor
||
customerSideArray
.
length
==
0
){
userId
=
contactsDO
.
getUserid
();
...
...
@@ -269,7 +274,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
log
.
info
(
"Order in shipping listener: The consignee has reached the maximum score, userId:{}, scoreRuleId:{}"
,
consigneeMemberId
,
scoreRuleDO
.
getId
());
}
else
{
if
(!
hasConsignee
&&
customerSideArray
.
length
!=
0
){
logNote
.
append
(
"积分规则客户方不包含收货人"
);
logNote
.
append
(
"积分规则客户方不包含收货人
"
);
}
if
(
hasConsignee
||
customerSideArray
.
length
==
0
){
users
.
add
(
consigneeMemberId
);
...
...
@@ -303,7 +308,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
* @param consigneeId
* @return
*/
private
ScoreRuleDO
getMatchRule
(
OrderRespDTO
order
,
long
consigneeId
)
{
private
List
<
ScoreRuleDO
>
getMatchRule
(
OrderRespDTO
order
,
long
consigneeId
)
{
List
<
ScoreRuleDO
>
scoreRuleDOs
=
scoreRuleService
.
getEnableOrderVRule
();
if
(
CollectionUtil
.
isEmpty
(
scoreRuleDOs
))
{
return
null
;
...
...
@@ -341,7 +346,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
}
}
return
true
;
}).
findFirst
().
orElse
(
null
);
}).
collect
(
Collectors
.
toList
()
);
}
/**
...
...
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