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
b32084eb
Commit
b32084eb
authored
Aug 05, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
积分规则触发逻辑
parent
d7e8488e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
134 additions
and
74 deletions
+134
-74
TransportTypeEnum.java
.../iocoder/yudao/module/member/enums/TransportTypeEnum.java
+5
-0
RedisKeyConstant.java
...coder/yudao/module/member/dal/redis/RedisKeyConstant.java
+8
-0
ScoreRuleRedisDao.java
.../module/member/dal/redis/scoreRule/ScoreRuleRedisDao.java
+78
-0
AbstractScoreRuleStrategy.java
...ber/mq/consumer/score/core/AbstractScoreRuleStrategy.java
+34
-43
OderVStrategy.java
...o/module/member/mq/consumer/score/core/OderVStrategy.java
+1
-8
RecommendStrategy.java
...dule/member/mq/consumer/score/core/RecommendStrategy.java
+1
-11
RegisterStrategy.java
...odule/member/mq/consumer/score/core/RegisterStrategy.java
+1
-11
ScoreRuleStrategy.java
...dule/member/mq/consumer/score/core/ScoreRuleStrategy.java
+0
-1
ScoreRuleServiceImpl.java
...module/member/service/scoreRule/ScoreRuleServiceImpl.java
+6
-0
No files found.
yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/TransportTypeEnum.java
View file @
b32084eb
package
cn
.
iocoder
.
yudao
.
module
.
member
.
enums
;
import
java.util.stream.Stream
;
public
enum
TransportTypeEnum
{
OCEAN_LCL
(
1
,
"海运拼柜"
),
SPECIAL_LINE_AIR_FREIGHT
(
3
,
"专线空运"
);
...
...
@@ -20,4 +22,7 @@ public enum TransportTypeEnum {
public
String
getName
()
{
return
name
;
}
public
static
TransportTypeEnum
parseByValue
(
int
value
)
{
return
Stream
.
of
(
values
()).
filter
(
e
->
e
.
getValue
()
==
value
).
findAny
().
orElse
(
null
);
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/dal/redis/
package-info
.java
→
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/dal/redis/
RedisKeyConstant
.java
View file @
b32084eb
package
cn
.
iocoder
.
yudao
.
module
.
member
.
dal
.
redis
;
/**
*
占位,后续有类后,可以删除,避免 package 无法提交到 Git 上
*
Redis Key 枚举类
*/
package
cn
.
iocoder
.
yudao
.
module
.
member
.
dal
.
redis
;
public
interface
RedisKeyConstant
{
String
MEMBER_USER_SCORE_RULE
=
"member:user:score:rule:"
;
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/dal/redis/scoreRule/ScoreRuleRedisDao.java
0 → 100644
View file @
b32084eb
package
cn
.
iocoder
.
yudao
.
module
.
member
.
dal
.
redis
.
scoreRule
;
import
cn.iocoder.yudao.framework.common.util.json.JsonUtils
;
import
cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO
;
import
cn.iocoder.yudao.module.member.dal.redis.RedisKeyConstant
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
cn.iocoder.yudao.module.member.enums.TransportTypeEnum
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleOrderVExtraVO
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Repository
;
import
javax.annotation.Resource
;
/**
* 会员积分规则 Redis DAO
*/
@Repository
public
class
ScoreRuleRedisDao
{
@Resource
private
StringRedisTemplate
stringRedisTemplate
;
public
ScoreRuleDO
getEnableScoreRule
(
ScoreRuleTypeEnum
type
,
TransportTypeEnum
transportType
)
{
// 如果transportType不为空则是订单V值类型
if
(
transportType
==
null
)
{
String
redisKey
=
formatKey
(
type
.
getValue
(),
null
);
String
scoreRuleJson
=
stringRedisTemplate
.
opsForValue
().
get
(
redisKey
);
if
(
scoreRuleJson
==
null
)
{
return
null
;
}
return
JsonUtils
.
parseObject
(
scoreRuleJson
,
ScoreRuleDO
.
class
);
}
else
{
String
redisKey
=
formatKey
(
type
.
getValue
(),
transportType
.
getValue
());
String
scoreRuleJson
=
stringRedisTemplate
.
opsForValue
().
get
(
redisKey
);
if
(
scoreRuleJson
==
null
)
{
return
null
;
}
return
JsonUtils
.
parseObject
(
scoreRuleJson
,
ScoreRuleDO
.
class
);
}
}
public
ScoreRuleDO
getEnableScoreRule
(
ScoreRuleTypeEnum
type
)
{
return
getEnableScoreRule
(
type
,
null
);
}
public
void
setEnableScoreRule
(
ScoreRuleDO
scoreRuleDO
)
{
// 多余字段置空
scoreRuleDO
.
setCreator
(
null
);
scoreRuleDO
.
setUpdater
(
null
);
scoreRuleDO
.
setUpdateTime
(
null
);
scoreRuleDO
.
setCreateTime
(
null
);
scoreRuleDO
.
setDeleted
(
null
);
scoreRuleDO
.
setCoverImageEn
(
null
);
scoreRuleDO
.
setCoverImageZh
(
null
);
scoreRuleDO
.
setDescEn
(
null
);
scoreRuleDO
.
setDescZh
(
null
);
if
(
scoreRuleDO
.
getType
()
==
ScoreRuleTypeEnum
.
ORDER_V
.
getValue
())
{
ScoreRuleOrderVExtraVO
scoreRuleOrderVExtraVO
=
JsonUtils
.
parseObject
(
scoreRuleDO
.
getExtra
(),
ScoreRuleOrderVExtraVO
.
class
);
stringRedisTemplate
.
opsForValue
().
set
(
formatKey
(
scoreRuleDO
.
getType
(),
scoreRuleOrderVExtraVO
.
getTransportType
()),
JsonUtils
.
toJsonString
(
scoreRuleDO
));
}
stringRedisTemplate
.
opsForValue
().
set
(
formatKey
(
scoreRuleDO
.
getType
(),
null
),
JsonUtils
.
toJsonString
(
scoreRuleDO
));
}
public
void
deleteEnableScoreRule
(
Integer
type
)
{
if
(
ScoreRuleTypeEnum
.
ORDER_V
.
getValue
()
==
type
)
{
stringRedisTemplate
.
delete
(
formatKey
(
type
,
1
));
stringRedisTemplate
.
delete
(
formatKey
(
type
,
3
));
}
String
redisKey
=
formatKey
(
type
,
null
);
stringRedisTemplate
.
delete
(
redisKey
);
}
private
static
String
formatKey
(
Integer
type
,
Integer
transportType
)
{
if
(
transportType
==
null
)
{
return
RedisKeyConstant
.
MEMBER_USER_SCORE_RULE
+
type
;
}
return
RedisKeyConstant
.
MEMBER_USER_SCORE_RULE
+
type
+
":"
+
transportType
;
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/AbstractScoreRuleStrategy.java
View file @
b32084eb
...
...
@@ -2,23 +2,20 @@ package cn.iocoder.yudao.module.member.mq.consumer.score.core;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery
;
import
cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO
;
import
cn.iocoder.yudao.module.member.dal.redis.scoreRule.ScoreRuleRedisDao
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleStatusEnum
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
cn.iocoder.yudao.module.member.enums.TransportTypeEnum
;
import
cn.iocoder.yudao.module.member.service.scoreRule.ScoreRuleService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.annotation.Resource
;
import
java.util.Date
;
/**
* 半成品
* @author zhangfeng
*/
public
abstract
class
AbstractScoreRuleStrategy
implements
ScoreRuleStrategy
{
private
static
ScoreRuleDO
orderVShipScoreRule
=
null
;
private
static
ScoreRuleDO
orderVFlyScoreRule
=
null
;
private
static
ScoreRuleDO
registerScoreRule
=
null
;
private
static
ScoreRuleDO
recommendScoreRule
=
null
;
protected
ScoreRuleService
scoreRuleService
;
...
...
@@ -27,63 +24,57 @@ public abstract class AbstractScoreRuleStrategy implements ScoreRuleStrategy {
this
.
scoreRuleService
=
scoreRuleService
;
}
@Resource
ScoreRuleRedisDao
scoreRuleRedisDao
;
public
ScoreRuleDO
getEnableScoreRuleByType
(
ScoreRuleTypeEnum
scoreRuleType
)
{
ScoreRuleDO
scoreRuleDO
=
scoreRuleService
.
selectOne
(
new
LambdaQuery
<
ScoreRuleDO
>()
.
eq
(
ScoreRuleDO:
:
getType
,
scoreRuleType
.
getValue
())
.
eq
(
ScoreRuleDO:
:
getStatus
,
ScoreRuleStatusEnum
.
ENABLED
.
getValue
()));
if
(
scoreRuleDO
!=
null
)
{
ScoreRuleDO
enableScoreRule
;
enableScoreRule
=
scoreRuleRedisDao
.
getEnableScoreRule
(
scoreRuleType
);
if
(
enableScoreRule
==
null
)
{
enableScoreRule
=
scoreRuleService
.
selectOne
(
new
LambdaQuery
<
ScoreRuleDO
>()
.
eq
(
ScoreRuleDO:
:
getType
,
scoreRuleType
.
getValue
())
.
eq
(
ScoreRuleDO:
:
getStatus
,
ScoreRuleStatusEnum
.
ENABLED
.
getValue
()));
if
(
enableScoreRule
==
null
)
{
return
null
;
}
// 校验一下活动开始结束时间
if
(!
scoreRuleDO
.
getEndTime
().
after
(
new
Date
())
||
!
scoreRuleDO
.
getStartTime
().
before
(
new
Date
()))
{
if
(!
enableScoreRule
.
getEndTime
().
after
(
new
Date
())
||
!
enableScoreRule
.
getStartTime
().
before
(
new
Date
()))
{
return
null
;
}
scoreRuleRedisDao
.
setEnableScoreRule
(
enableScoreRule
);
}
else
{
if
(!
enableScoreRule
.
getEndTime
().
after
(
new
Date
())
||
!
enableScoreRule
.
getStartTime
().
before
(
new
Date
()))
{
return
null
;
}
else
{
recommendScoreRule
=
scoreRuleDO
;
return
recommendScoreRule
;
}
}
return
null
;
return
enableScoreRule
;
}
public
ScoreRuleDO
getEnableScoreRuleByType
(
ScoreRuleTypeEnum
scoreRuleType
,
TransportTypeEnum
transportType
)
{
ScoreRuleDO
scoreRuleDO
=
null
;
ScoreRuleDO
enableScoreRule
;
switch
(
scoreRuleType
)
{
case
ORDER_V:
scoreRuleDO
=
scoreRuleService
.
getEnabledOrderVScoreRuleByTransportType
(
transportType
.
getValue
());
if
(
scoreRuleDO
!=
null
)
{
if
(!
scoreRuleDO
.
getEndTime
().
after
(
new
Date
())
||
!
scoreRuleDO
.
getStartTime
().
before
(
new
Date
()))
{
enableScoreRule
=
scoreRuleRedisDao
.
getEnableScoreRule
(
scoreRuleType
,
transportType
);
if
(
enableScoreRule
==
null
)
{
enableScoreRule
=
scoreRuleService
.
getEnabledOrderVScoreRuleByTransportType
(
transportType
.
getValue
());
if
(
enableScoreRule
==
null
)
{
return
null
;
}
if
(
transportType
==
TransportTypeEnum
.
OCEAN_LCL
)
{
orderVShipScoreRule
=
scoreRuleDO
;
return
orderVShipScoreRule
;
if
(!
enableScoreRule
.
getEndTime
().
after
(
new
Date
())
||
!
enableScoreRule
.
getStartTime
().
before
(
new
Date
()))
{
return
null
;
}
if
(
transportType
==
TransportTypeEnum
.
SPECIAL_LINE_AIR_FREIGHT
)
{
orderVFlyScoreRule
=
scoreRuleDO
;
return
orderVFlyScoreRule
;
scoreRuleRedisDao
.
setEnableScoreRule
(
enableScoreRule
);
}
else
{
if
(!
enableScoreRule
.
getEndTime
().
after
(
new
Date
())
||
!
enableScoreRule
.
getStartTime
().
before
(
new
Date
()))
{
return
null
;
}
}
break
;
return
enableScoreRule
;
case
RECOMMEND:
case
REGISTER:
return
getEnableScoreRuleByType
(
scoreRuleType
);
}
return
null
;
}
@Override
public
void
refreshScoreRule
(
ScoreRuleTypeEnum
scoreRuleType
)
{
switch
(
scoreRuleType
)
{
case
ORDER_V:
orderVShipScoreRule
=
null
;
orderVFlyScoreRule
=
null
;
break
;
case
RECOMMEND:
recommendScoreRule
=
null
;
break
;
case
REGISTER:
registerScoreRule
=
null
;
break
;
}
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/OderVStrategy.java
View file @
b32084eb
...
...
@@ -27,7 +27,6 @@ import org.springframework.stereotype.Service;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Objects
;
...
...
@@ -72,16 +71,11 @@ public class OderVStrategy extends AbstractScoreRuleStrategy {
}
// 判断海运空运
Integer
transportId
=
order
.
getTransportId
();
ScoreRuleDO
scoreRuleDO
=
scoreRuleService
.
getEnabledOrderVScoreRuleByTransportType
(
transportId
);
ScoreRuleDO
scoreRuleDO
=
getEnableScoreRuleByType
(
ScoreRuleTypeEnum
.
ORDER_V
,
TransportTypeEnum
.
parseByValue
(
transportId
)
);
if
(
Objects
.
isNull
(
scoreRuleDO
))
{
log
.
info
(
"Order in shipping listener: No score rule match,orderID:{}"
,
orderId
);
return
;
}
// 是否过期,或者活动还没开始
if
(!
scoreRuleDO
.
getEndTime
().
after
(
new
Date
())
||
!
scoreRuleDO
.
getStartTime
().
before
(
new
Date
()))
{
log
.
info
(
"Order in shipping listener: The score rule has expired,scoreRuleID:{}"
,
scoreRuleDO
.
getId
());
return
;
}
// 目的地信息
OrderObjectiveApiDO
orderObjectiveDO
=
order
.
getOrderObjectiveDO
();
ScoreRuleOrderVExtraVO
extraInfo
=
JSONUtil
.
toBean
(
scoreRuleDO
.
getExtra
(),
ScoreRuleOrderVExtraVO
.
class
);
...
...
@@ -177,7 +171,6 @@ public class OderVStrategy extends AbstractScoreRuleStrategy {
try
{
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"orderId"
,
orderId
);
// TODO:增加订单号和唯一键
memberUserScoreApi
.
operateScore
(
MemberUserScoreOperateReqDTO
.
builder
()
.
memberId
(
userId
)
.
scoreCount
(
scoreCount
)
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/RecommendStrategy.java
View file @
b32084eb
package
cn
.
iocoder
.
yudao
.
module
.
member
.
mq
.
consumer
.
score
.
core
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery
;
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
;
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.enums.ScoreRuleStatusEnum
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum
;
import
cn.iocoder.yudao.module.member.mq.message.ScoreMessage
;
...
...
@@ -19,7 +17,6 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -44,18 +41,11 @@ public class RecommendStrategy extends AbstractScoreRuleStrategy {
public
void
addScore
(
ScoreMessage
message
)
{
Long
userId
=
message
.
getUserId
();
log
.
info
(
"Received Recommend message,userID:{}"
,
userId
);
ScoreRuleDO
scoreRuleDO
=
scoreRuleService
.
selectOne
(
new
LambdaQuery
<
ScoreRuleDO
>()
.
eq
(
ScoreRuleDO:
:
getType
,
ScoreRuleTypeEnum
.
RECOMMEND
.
getValue
())
.
eq
(
ScoreRuleDO:
:
getStatus
,
ScoreRuleStatusEnum
.
ENABLED
.
getValue
()));
ScoreRuleDO
scoreRuleDO
=
getEnableScoreRuleByType
(
ScoreRuleTypeEnum
.
RECOMMEND
);
if
(
scoreRuleDO
==
null
)
{
log
.
info
(
"Recommend rule is not exist,userID:{}"
,
userId
);
return
;
}
// 是否过期,或者活动还没开始
if
(!
scoreRuleDO
.
getEndTime
().
after
(
new
Date
())
||
!
scoreRuleDO
.
getStartTime
().
before
(
new
Date
()))
{
log
.
info
(
"Recommend listener: The score rule has expired,scoreRuleID:{}"
,
scoreRuleDO
.
getId
());
return
;
}
MemberUserDO
memberUserDO
=
memberUserService
.
getUser
(
userId
);
if
(
memberUserDO
==
null
)
{
log
.
info
(
"Recommend listener: The user does not exist,userID:{}"
,
userId
);
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/RegisterStrategy.java
View file @
b32084eb
package
cn
.
iocoder
.
yudao
.
module
.
member
.
mq
.
consumer
.
score
.
core
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery
;
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.scoreRule.ScoreRuleDO
;
import
cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleStatusEnum
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum
;
import
cn.iocoder.yudao.module.member.mq.message.ScoreMessage
;
...
...
@@ -15,7 +13,6 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.HashMap
;
/**
...
...
@@ -37,18 +34,11 @@ public class RegisterStrategy extends AbstractScoreRuleStrategy {
public
void
addScore
(
ScoreMessage
message
)
{
Long
userId
=
message
.
getUserId
();
log
.
info
(
"Received register message,userID:{}"
,
userId
);
ScoreRuleDO
scoreRuleDO
=
scoreRuleService
.
selectOne
(
new
LambdaQuery
<
ScoreRuleDO
>()
.
eq
(
ScoreRuleDO:
:
getType
,
ScoreRuleTypeEnum
.
REGISTER
.
getValue
())
.
eq
(
ScoreRuleDO:
:
getStatus
,
ScoreRuleStatusEnum
.
ENABLED
.
getValue
()));
ScoreRuleDO
scoreRuleDO
=
getEnableScoreRuleByType
(
ScoreRuleTypeEnum
.
REGISTER
);
if
(
scoreRuleDO
==
null
)
{
log
.
info
(
"Register rule is not exist,userID:{}"
,
userId
);
return
;
}
// 是否过期,或者活动还没开始
if
(!
scoreRuleDO
.
getEndTime
().
after
(
new
Date
())
||
!
scoreRuleDO
.
getStartTime
().
before
(
new
Date
()))
{
log
.
info
(
"Register listener: The score rule has expired,scoreRuleID:{}"
,
scoreRuleDO
.
getId
());
return
;
}
MemberUserDO
memberUserDO
=
memberUserService
.
getUser
(
userId
);
if
(
memberUserDO
==
null
)
{
log
.
info
(
"Register listener: The user does not exist,userID:{}"
,
userId
);
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/ScoreRuleStrategy.java
View file @
b32084eb
...
...
@@ -8,5 +8,4 @@ import cn.iocoder.yudao.module.member.mq.message.ScoreMessage;
public
interface
ScoreRuleStrategy
{
void
addScore
(
ScoreMessage
message
);
ScoreRuleTypeEnum
getStrategyScoreRuleType
();
void
refreshScoreRule
(
ScoreRuleTypeEnum
scoreRuleType
);
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/scoreRule/ScoreRuleServiceImpl.java
View file @
b32084eb
...
...
@@ -12,6 +12,7 @@ import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import
cn.iocoder.yudao.module.member.convert.scoreRule.ScoreRuleConvert
;
import
cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO
;
import
cn.iocoder.yudao.module.member.dal.mysql.scoreRule.ScoreRuleMapper
;
import
cn.iocoder.yudao.module.member.dal.redis.scoreRule.ScoreRuleRedisDao
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleStatusEnum
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
cn.iocoder.yudao.module.member.enums.TransportTypeEnum
;
...
...
@@ -41,6 +42,8 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
@Resource
private
ScoreRuleMapper
scoreRuleMapper
;
@Resource
private
ScoreRuleRedisDao
scoreRuleRedisDao
;
@Override
public
Long
createScoreRule
(
ScoreRuleCreateReqVO
createReqVO
)
{
...
...
@@ -52,6 +55,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
Integer
scoreRuleType
=
scoreRule
.
getType
();
verifyAndSetExtraDO
(
createReqVO
,
scoreRuleType
,
scoreRule
);
scoreRuleMapper
.
insert
(
scoreRule
);
scoreRuleRedisDao
.
deleteEnableScoreRule
(
scoreRule
.
getType
());
// 返回
return
scoreRule
.
getId
();
}
...
...
@@ -117,6 +121,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
verifyAndSetExtraDO
(
updateReqVO
,
updateReqVO
.
getType
(),
scoreRule
);
// 更新
scoreRuleMapper
.
updateById
(
scoreRule
);
scoreRuleRedisDao
.
deleteEnableScoreRule
(
scoreRule
.
getType
());
}
/**
...
...
@@ -289,6 +294,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
throw
exception
(
SCORE_RULE_UPDATE_ERROR
);
}
scoreRuleMapper
.
updateById
(
upScoreRuleDO
);
scoreRuleRedisDao
.
deleteEnableScoreRule
(
scoreRuleDO
.
getType
());
}
@Override
...
...
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