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
e05f532f
Commit
e05f532f
authored
Oct 28, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix(member): 推荐规则触发更新分享记录
parent
6f7e9cb1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
RecommendStrategy.java
...dule/member/mq/consumer/score/core/RecommendStrategy.java
+22
-0
No files found.
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/RecommendStrategy.java
View file @
e05f532f
...
@@ -2,18 +2,22 @@ package cn.iocoder.yudao.module.member.mq.consumer.score.core;
...
@@ -2,18 +2,22 @@ package cn.iocoder.yudao.module.member.mq.consumer.score.core;
import
cn.iocoder.yudao.module.member.api.score.MemberUserScoreApi
;
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.api.score.dto.MemberUserScoreOperateReqDTO
;
import
cn.iocoder.yudao.module.member.dal.dataobject.ScoreRuleShareRecord.ScoreRuleShareRecordDO
;
import
cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO
;
import
cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO
;
import
cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO
;
import
cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum
;
import
cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum
;
import
cn.iocoder.yudao.module.member.mq.message.ScoreMessage
;
import
cn.iocoder.yudao.module.member.mq.message.ScoreMessage
;
import
cn.iocoder.yudao.module.member.service.ScoreRuleShareRecord.ScoreRuleShareRecordService
;
import
cn.iocoder.yudao.module.member.service.scoreLog.MemberUserScoreLogService
;
import
cn.iocoder.yudao.module.member.service.scoreLog.MemberUserScoreLogService
;
import
cn.iocoder.yudao.module.member.service.scoreRule.ScoreRuleService
;
import
cn.iocoder.yudao.module.member.service.scoreRule.ScoreRuleService
;
import
cn.iocoder.yudao.module.member.service.user.MemberUserService
;
import
cn.iocoder.yudao.module.member.service.user.MemberUserService
;
import
cn.iocoder.yudao.module.member.util.ScoreRuleGenCodeUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
/**
/**
...
@@ -24,6 +28,10 @@ import java.util.HashMap;
...
@@ -24,6 +28,10 @@ import java.util.HashMap;
public
class
RecommendStrategy
extends
AbstractScoreRuleStrategy
{
public
class
RecommendStrategy
extends
AbstractScoreRuleStrategy
{
@Resource
@Resource
private
MemberUserService
memberUserService
;
private
MemberUserService
memberUserService
;
@Resource
private
ScoreRuleShareRecordService
scoreRuleShareRecordService
;
@Resource
private
ScoreRuleGenCodeUtils
scoreRuleGenCodeUtils
;
public
RecommendStrategy
(
ScoreRuleService
scoreRuleService
,
MemberUserScoreLogService
memberUserScoreLogService
,
MemberUserService
memberUserService
,
MemberUserScoreApi
memberUserScoreApi
)
{
public
RecommendStrategy
(
ScoreRuleService
scoreRuleService
,
MemberUserScoreLogService
memberUserScoreLogService
,
MemberUserService
memberUserService
,
MemberUserScoreApi
memberUserScoreApi
)
{
super
(
scoreRuleService
,
memberUserScoreLogService
,
memberUserService
,
memberUserScoreApi
);
super
(
scoreRuleService
,
memberUserScoreLogService
,
memberUserService
,
memberUserScoreApi
);
...
@@ -39,6 +47,7 @@ public class RecommendStrategy extends AbstractScoreRuleStrategy {
...
@@ -39,6 +47,7 @@ public class RecommendStrategy extends AbstractScoreRuleStrategy {
return
;
return
;
}
}
Long
userId
=
memberUserDO
.
getId
();
Long
userId
=
memberUserDO
.
getId
();
// 获取推荐规则
ScoreRuleDO
scoreRuleDO
=
scoreRuleService
.
getEnableScoreRuleByType
(
ScoreRuleTypeEnum
.
RECOMMEND
);
ScoreRuleDO
scoreRuleDO
=
scoreRuleService
.
getEnableScoreRuleByType
(
ScoreRuleTypeEnum
.
RECOMMEND
);
if
(
scoreRuleDO
==
null
)
{
if
(
scoreRuleDO
==
null
)
{
log
.
info
(
"Recommend rule is not exist,userID:{}"
,
userId
);
log
.
info
(
"Recommend rule is not exist,userID:{}"
,
userId
);
...
@@ -50,6 +59,19 @@ public class RecommendStrategy extends AbstractScoreRuleStrategy {
...
@@ -50,6 +59,19 @@ public class RecommendStrategy extends AbstractScoreRuleStrategy {
log
.
info
(
"Recommend listener: The user has reached the maximum score,userId:{},scoreRuleId:{}"
,
userId
,
scoreRuleDO
.
getId
());
log
.
info
(
"Recommend listener: The user has reached the maximum score,userId:{},scoreRuleId:{}"
,
userId
,
scoreRuleDO
.
getId
());
return
;
return
;
}
}
// 根据分享人和规则id获取分享记录
ScoreRuleShareRecordDO
scoreRuleShareRecordDO
=
scoreRuleShareRecordService
.
selectOne
(
"member_id"
,
userId
,
"rule_id"
,
scoreRuleDO
.
getId
());
if
(
scoreRuleShareRecordDO
==
null
)
{
// 没有分享记录说明是手动输入推荐码,创建分享记录
scoreRuleShareRecordDO
=
new
ScoreRuleShareRecordDO
();
scoreRuleShareRecordDO
.
setMemberId
(
userId
);
scoreRuleShareRecordDO
.
setRuleId
(
scoreRuleDO
.
getId
());
scoreRuleShareRecordDO
.
setCode
(
scoreRuleGenCodeUtils
.
generateShareRecordCode
());
scoreRuleShareRecordDO
.
setTotalScore
(
0
);
}
scoreRuleShareRecordDO
.
setLastTriggerTime
(
new
Date
());
scoreRuleShareRecordDO
.
setTotalScore
(
scoreRuleShareRecordDO
.
getTotalScore
()
+
scoreRuleDO
.
getGetScoreOnce
());
scoreRuleShareRecordService
.
saveOrUpdate
(
scoreRuleShareRecordDO
);
try
{
try
{
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"userId"
,
userId
);
map
.
put
(
"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