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
f2c13c11
Commit
f2c13c11
authored
Aug 09, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
积分规则触发
parent
b9d47982
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
25 deletions
+29
-25
OrderInShippingListener.java
...yudao/module/member/listener/OrderInShippingListener.java
+5
-5
AbstractScoreRuleStrategy.java
...ber/mq/consumer/score/core/AbstractScoreRuleStrategy.java
+4
-1
OrderVStrategy.java
.../module/member/mq/consumer/score/core/OrderVStrategy.java
+2
-4
RecommendStrategy.java
...dule/member/mq/consumer/score/core/RecommendStrategy.java
+9
-11
RegisterStrategy.java
...odule/member/mq/consumer/score/core/RegisterStrategy.java
+2
-4
MemberUserService.java
...r/yudao/module/member/service/user/MemberUserService.java
+2
-0
MemberUserServiceImpl.java
...dao/module/member/service/user/MemberUserServiceImpl.java
+5
-0
No files found.
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/listener/OrderInShippingListener.java
View file @
f2c13c11
...
...
@@ -26,9 +26,6 @@ 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
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
...
...
@@ -38,7 +35,10 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Objects
;
@Component
/**
* 弃用
*/
//@Component
@AllArgsConstructor
@Slf4j
public
class
OrderInShippingListener
{
...
...
@@ -53,7 +53,7 @@ public class OrderInShippingListener {
@Resource
private
CustomerContactsService
customerContactsService
;
@EventListener
(
OrderInShippingEvent
.
class
)
//
@EventListener(OrderInShippingEvent.class)
public
void
listen
(
OrderInShippingEvent
event
)
{
Long
orderId
=
event
.
getOrderId
();
String
orderNo
=
event
.
getOrderNo
();
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/AbstractScoreRuleStrategy.java
View file @
f2c13c11
package
cn
.
iocoder
.
yudao
.
module
.
member
.
mq
.
consumer
.
score
.
core
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.iocoder.yudao.module.member.api.score.MemberUserScoreApi
;
import
cn.iocoder.yudao.module.member.dal.dataobject.scoreLog.MemberUserScoreLogDO
;
import
cn.iocoder.yudao.module.member.service.scoreLog.MemberUserScoreLogService
;
import
cn.iocoder.yudao.module.member.service.scoreRule.ScoreRuleService
;
...
...
@@ -18,12 +19,14 @@ public abstract class AbstractScoreRuleStrategy implements ScoreRuleStrategy {
protected
ScoreRuleService
scoreRuleService
;
protected
MemberUserScoreLogService
memberUserScoreLogService
;
protected
MemberUserService
memberUserService
;
protected
MemberUserScoreApi
memberUserScoreApi
;
@Autowired
public
AbstractScoreRuleStrategy
(
ScoreRuleService
scoreRuleService
,
MemberUserScoreLogService
memberUserScoreLogService
,
MemberUserService
memberUserService
)
{
public
AbstractScoreRuleStrategy
(
ScoreRuleService
scoreRuleService
,
MemberUserScoreLogService
memberUserScoreLogService
,
MemberUserService
memberUserService
,
MemberUserScoreApi
memberUserScoreApi
)
{
this
.
scoreRuleService
=
scoreRuleService
;
this
.
memberUserScoreLogService
=
memberUserScoreLogService
;
this
.
memberUserService
=
memberUserService
;
this
.
memberUserScoreApi
=
memberUserScoreApi
;
}
/**
* 计算用户在某一活动获得积分总数
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/OrderVStrategy.java
View file @
f2c13c11
...
...
@@ -38,12 +38,10 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
@Resource
private
OrderApi
orderApi
;
@Resource
private
MemberUserScoreApi
memberUserScoreApi
;
@Resource
private
CustomerContactsService
customerContactsService
;
public
OrderVStrategy
(
ScoreRuleService
scoreRuleService
,
MemberUserScoreLogService
memberUserScoreLogService
,
MemberUserService
memberUserService
)
{
super
(
scoreRuleService
,
memberUserScoreLogService
,
memberUserService
);
public
OrderVStrategy
(
ScoreRuleService
scoreRuleService
,
MemberUserScoreLogService
memberUserScoreLogService
,
MemberUserService
memberUserService
,
MemberUserScoreApi
memberUserScoreApi
)
{
super
(
scoreRuleService
,
memberUserScoreLogService
,
memberUserService
,
memberUserScoreApi
);
}
@Override
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/RecommendStrategy.java
View file @
f2c13c11
...
...
@@ -23,30 +23,28 @@ import java.util.HashMap;
@Service
@Slf4j
public
class
RecommendStrategy
extends
AbstractScoreRuleStrategy
{
@Resource
private
MemberUserScoreApi
memberUserScoreApi
;
@Resource
private
MemberUserService
memberUserService
;
public
RecommendStrategy
(
ScoreRuleService
scoreRuleService
,
MemberUserScoreLogService
memberUserScoreLogService
,
MemberUserService
memberUserService
)
{
super
(
scoreRuleService
,
memberUserScoreLogService
,
memberUserService
);
public
RecommendStrategy
(
ScoreRuleService
scoreRuleService
,
MemberUserScoreLogService
memberUserScoreLogService
,
MemberUserService
memberUserService
,
MemberUserScoreApi
memberUserScoreApi
)
{
super
(
scoreRuleService
,
memberUserScoreLogService
,
memberUserService
,
memberUserScoreApi
);
}
@Override
public
void
addScore
(
ScoreMessage
message
)
{
log
.
info
(
"Received Recommend message,referralCode:{}"
,
message
.
getReferralCode
());
// 根据推荐码获取推荐用户id
Long
userId
=
ReferralCodeUtils
.
getUserId
(
message
.
getReferralCode
());
log
.
info
(
"Received Recommend message,userID:{}"
,
userId
);
MemberUserDO
memberUserDO
=
memberUserService
.
getUserByCode
(
message
.
getReferralCode
());
if
(
memberUserDO
==
null
)
{
log
.
info
(
"Recommend listener: can not find user by referralCode:{}"
,
message
.
getReferralCode
());
return
;
}
Long
userId
=
memberUserDO
.
getId
();
ScoreRuleDO
scoreRuleDO
=
scoreRuleService
.
getEnableScoreRuleByType
(
ScoreRuleTypeEnum
.
RECOMMEND
);
if
(
scoreRuleDO
==
null
)
{
log
.
info
(
"Recommend rule is not exist,userID:{}"
,
userId
);
return
;
}
MemberUserDO
memberUserDO
=
memberUserService
.
getUser
(
userId
);
if
(
memberUserDO
==
null
)
{
log
.
info
(
"Recommend listener: The recommend user does not exist,userID:{}"
,
userId
);
return
;
}
// 校验累计最高分
Integer
userScoreTotalCount
=
getUserScoreTotalCount
(
scoreRuleDO
.
getId
(),
userId
);
if
(
scoreRuleDO
.
getMaxScoreTotal
()
>
0
&&
userScoreTotalCount
>=
scoreRuleDO
.
getMaxScoreTotal
())
{
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/RegisterStrategy.java
View file @
f2c13c11
...
...
@@ -24,13 +24,11 @@ import java.util.HashMap;
@Service
@Slf4j
public
class
RegisterStrategy
extends
AbstractScoreRuleStrategy
{
@Resource
private
MemberUserScoreApi
memberUserScoreApi
;
@Resource
private
MemberUserService
memberUserService
;
public
RegisterStrategy
(
ScoreRuleService
scoreRuleService
,
MemberUserScoreLogService
memberUserScoreLogService
,
MemberUserService
memberUserService
)
{
super
(
scoreRuleService
,
memberUserScoreLogService
,
memberUserService
);
public
RegisterStrategy
(
ScoreRuleService
scoreRuleService
,
MemberUserScoreLogService
memberUserScoreLogService
,
MemberUserService
memberUserService
,
MemberUserScoreApi
memberUserScoreApi
)
{
super
(
scoreRuleService
,
memberUserScoreLogService
,
memberUserService
,
memberUserScoreApi
);
}
@Override
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java
View file @
f2c13c11
...
...
@@ -222,4 +222,6 @@ public interface MemberUserService {
List
<
MemberUserDO
>
getByCursor
(
Long
startUserId
,
long
limit
);
void
historyCodeFlush
();
MemberUserDO
getUserByCode
(
String
referralCode
);
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java
View file @
f2c13c11
...
...
@@ -578,6 +578,11 @@ public class MemberUserServiceImpl implements MemberUserService {
}
}
@Override
public
MemberUserDO
getUserByCode
(
String
referralCode
)
{
return
memberUserMapper
.
selectOne
(
"code"
,
referralCode
);
}
private
String
getNextMemberCode
()
{
String
key
=
"memberCode:max:number"
;
String
incrIfExistScript
=
"if redis.call(\"exists\", KEYS[1]) == 1 then\n"
+
...
...
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