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
a682a25a
Commit
a682a25a
authored
Aug 28, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
会员功能开关
parent
6789c9d9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
1 deletion
+68
-1
ScoreRuleController.java
...ember/controller/admin/scoreRule/ScoreRuleController.java
+13
-0
RedisKeyConstant.java
...coder/yudao/module/member/dal/redis/RedisKeyConstant.java
+1
-0
ScoreRuleRedisDao.java
.../module/member/dal/redis/scoreRule/ScoreRuleRedisDao.java
+17
-1
ScoreRuleService.java
...dao/module/member/service/scoreRule/ScoreRuleService.java
+13
-0
ScoreRuleServiceImpl.java
...module/member/service/scoreRule/ScoreRuleServiceImpl.java
+10
-0
SwitchReqVo.java
...iocoder/yudao/module/member/vo/scoreRule/SwitchReqVo.java
+14
-0
No files found.
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/admin/scoreRule/ScoreRuleController.java
View file @
a682a25a
...
...
@@ -145,4 +145,17 @@ public class ScoreRuleController {
List
<
ScoreRuleBackVO
>
datas
=
ScoreRuleConvert
.
INSTANCE
.
convertList
(
list
);
ExcelUtils
.
write
(
response
,
"积分规则.xls"
,
"数据"
,
ScoreRuleBackVO
.
class
,
datas
);
}
@PostMapping
(
"/switch/set"
)
@ApiOperation
(
"设置会员工能开关"
)
@PreAuthorize
(
"@ss.hasPermission('member:score-rule:update')"
)
public
CommonResult
<
Boolean
>
setScoreRuleSwitch
(
@RequestBody
SwitchReqVo
switchReqVo
)
{
return
success
(
scoreRuleService
.
setScoreRuleSwitch
(
switchReqVo
));
}
@GetMapping
(
"/switch/get"
)
@ApiOperation
(
"获取会员功能开关"
)
public
CommonResult
<
Boolean
>
getScoreRuleSwitch
()
{
return
success
(
scoreRuleService
.
getScoreRuleSwitch
());
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/dal/redis/RedisKeyConstant.java
View file @
a682a25a
...
...
@@ -5,4 +5,5 @@ package cn.iocoder.yudao.module.member.dal.redis;
*/
public
interface
RedisKeyConstant
{
String
MEMBER_USER_SCORE_RULE
=
"member:user:score:rule:"
;
String
MEMBER_USER_SCORE_RULE_SWITCH
=
"member:user:score:rule:switch"
;
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/dal/redis/scoreRule/ScoreRuleRedisDao.java
View file @
a682a25a
...
...
@@ -12,6 +12,8 @@ import org.springframework.stereotype.Repository;
import
javax.annotation.Resource
;
import
java.util.concurrent.TimeUnit
;
import
static
cn
.
iocoder
.
yudao
.
module
.
member
.
dal
.
redis
.
RedisKeyConstant
.
MEMBER_USER_SCORE_RULE_SWITCH
;
/**
* 会员积分规则 Redis DAO
*/
...
...
@@ -20,6 +22,20 @@ public class ScoreRuleRedisDao {
@Resource
private
StringRedisTemplate
stringRedisTemplate
;
public
Boolean
setScoreRuleSwitch
(
Boolean
switchStatus
)
{
stringRedisTemplate
.
opsForValue
().
set
(
MEMBER_USER_SCORE_RULE_SWITCH
,
switchStatus
.
toString
());
return
switchStatus
;
}
public
Boolean
getScoreRuleSwitch
()
{
String
string
=
stringRedisTemplate
.
opsForValue
().
get
(
MEMBER_USER_SCORE_RULE_SWITCH
);
if
(
string
==
null
)
{
stringRedisTemplate
.
opsForValue
().
set
(
MEMBER_USER_SCORE_RULE_SWITCH
,
"false"
);
return
false
;
}
return
Boolean
.
parseBoolean
(
string
);
}
public
ScoreRuleDO
getEnableScoreRule
(
ScoreRuleTypeEnum
type
,
TransportTypeEnum
transportType
)
{
// 如果transportType不为空则是订单V值类型
if
(
transportType
==
null
)
{
...
...
@@ -58,7 +74,7 @@ public class ScoreRuleRedisDao {
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
),
24L
,
TimeUnit
.
HOURS
);
stringRedisTemplate
.
opsForValue
().
set
(
formatKey
(
scoreRuleDO
.
getType
(),
null
),
JsonUtils
.
toJsonString
(
scoreRuleDO
),
24L
,
TimeUnit
.
HOURS
);
}
public
void
deleteEnableScoreRule
(
Integer
type
)
{
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/scoreRule/ScoreRuleService.java
View file @
a682a25a
...
...
@@ -138,4 +138,17 @@ public interface ScoreRuleService extends IService<ScoreRuleDO> {
* @return
*/
AppScoreRuleBackDetailVO
appGetScoreRule
(
Long
id
);
/**
* 获取会员功能开关状态
* @return
*/
Boolean
getScoreRuleSwitch
();
/**
* 设置会员功能开关
* @param switchReqVo
* @return
*/
Boolean
setScoreRuleSwitch
(
SwitchReqVo
switchReqVo
);
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/scoreRule/ScoreRuleServiceImpl.java
View file @
a682a25a
...
...
@@ -533,4 +533,14 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
appScoreRuleBackDetailVO
.
setTypeEn
(
DictFrameworkUtils
.
getDictDataFromCache
(
"score_rule_type"
,
type
).
getLabelEn
());
return
appScoreRuleBackDetailVO
;
}
@Override
public
Boolean
getScoreRuleSwitch
()
{
return
scoreRuleRedisDao
.
getScoreRuleSwitch
();
}
@Override
public
Boolean
setScoreRuleSwitch
(
SwitchReqVo
switchReqVo
)
{
return
scoreRuleRedisDao
.
setScoreRuleSwitch
(
switchReqVo
.
getSwitchState
());
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/vo/scoreRule/SwitchReqVo.java
0 → 100644
View file @
a682a25a
package
cn
.
iocoder
.
yudao
.
module
.
member
.
vo
.
scoreRule
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
@Data
@ApiModel
(
"管理后台 - 会员功能开关状态 VO"
)
public
class
SwitchReqVo
{
@ApiModelProperty
(
value
=
"开关状态"
,
required
=
true
)
private
Boolean
switchState
;
}
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