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