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
ca7db54a
Commit
ca7db54a
authored
Aug 01, 2024
by
zhaobiyan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
会员等级相关接口
parent
9fd2406f
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
282 additions
and
4 deletions
+282
-4
ErrorCodeConstants.java
...iocoder/yudao/module/member/enums/ErrorCodeConstants.java
+2
-0
MemberUserLevelConfigController.java
...ntroller/admin/level/MemberUserLevelConfigController.java
+59
-0
MemberUserScoreController.java
...controller/admin/userScore/MemberUserScoreController.java
+1
-1
MemberUserScoreLogController.java
...ller/admin/userScoreLog/MemberUserScoreLogController.java
+1
-1
MemberUserLevelConfigService.java
...le/member/service/level/MemberUserLevelConfigService.java
+26
-0
MemberUserLevelConfigServiceImpl.java
...ember/service/level/MemberUserLevelConfigServiceImpl.java
+101
-0
MemberUserLevelBaseRespVO.java
...module/member/vo/userLevel/MemberUserLevelBaseRespVO.java
+32
-0
MemberUserLevelReqVO.java
...udao/module/member/vo/userLevel/MemberUserLevelReqVO.java
+16
-0
MemberUserLevelUpdateVO.java
...o/module/member/vo/userLevel/MemberUserLevelUpdateVO.java
+38
-0
messages_en.properties
yudao-server/src/main/resources/i18n/messages_en.properties
+3
-1
messages_zh.properties
yudao-server/src/main/resources/i18n/messages_zh.properties
+3
-1
No files found.
yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java
View file @
ca7db54a
...
...
@@ -46,4 +46,6 @@ public interface ErrorCodeConstants {
ErrorCode
MEMBER_SCORE_NOT_ENOUGH
=
new
ErrorCode
(
1004008003
,
"member.score.not.enough"
);
ErrorCode
REVERSE_SOURCE_NO_RELEATION_ID
=
new
ErrorCode
(
1004008004
,
"reverse.source.no.releation.id"
);
ErrorCode
LEVEL_BOUND_RANGE_ERROR
=
new
ErrorCode
(
1004008005
,
"level.bound.range.error"
);
ErrorCode
LEVEL_BOUND_RANGE_CONFLICT
=
new
ErrorCode
(
1004008006
,
"level.bound.range.conflict"
);
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/admin/level/MemberUserLevelConfigController.java
0 → 100644
View file @
ca7db54a
package
cn
.
iocoder
.
yudao
.
module
.
member
.
controller
.
admin
.
level
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.module.member.service.level.MemberUserLevelConfigService
;
import
cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelBaseRespVO
;
import
cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelReqVO
;
import
cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelUpdateVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
@Validated
@RestController
@Api
(
tags
=
"管理后台 - 会员等级配置"
)
@RequestMapping
(
"/member/user-level"
)
public
class
MemberUserLevelConfigController
{
private
final
MemberUserLevelConfigService
userLevelConfigService
;
public
MemberUserLevelConfigController
(
MemberUserLevelConfigService
userLevelConfigService
)
{
this
.
userLevelConfigService
=
userLevelConfigService
;
}
@PostMapping
(
"/page"
)
@ApiOperation
(
"列表"
)
public
CommonResult
<
PageResult
<
MemberUserLevelBaseRespVO
>>
getLevelPage
(
@Valid
@RequestBody
MemberUserLevelReqVO
query
)
{
return
success
(
userLevelConfigService
.
getLevelPage
(
query
));
}
@PostMapping
(
"/delete"
)
@ApiOperation
(
"删除"
)
public
CommonResult
<
Boolean
>
delete
(
@Valid
@RequestBody
List
<
Long
>
ids
)
{
return
success
(
userLevelConfigService
.
delete
(
ids
));
}
@PostMapping
(
"/add"
)
@ApiOperation
(
"新增"
)
public
CommonResult
<
Boolean
>
add
(
@Valid
@RequestBody
MemberUserLevelUpdateVO
query
)
{
return
success
(
userLevelConfigService
.
add
(
query
));
}
@PostMapping
(
"/update"
)
@ApiOperation
(
"编辑"
)
public
CommonResult
<
Boolean
>
update
(
@Valid
@RequestBody
MemberUserLevelUpdateVO
query
)
{
return
success
(
userLevelConfigService
.
updateLevel
(
query
));
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/admin/
memberU
serScore/MemberUserScoreController.java
→
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/admin/
u
serScore/MemberUserScoreController.java
View file @
ca7db54a
package
cn
.
iocoder
.
yudao
.
module
.
member
.
controller
.
admin
.
memberU
serScore
;
package
cn
.
iocoder
.
yudao
.
module
.
member
.
controller
.
admin
.
u
serScore
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/admin/
memberU
serScoreLog/MemberUserScoreLogController.java
→
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/admin/
u
serScoreLog/MemberUserScoreLogController.java
View file @
ca7db54a
package
cn
.
iocoder
.
yudao
.
module
.
member
.
controller
.
admin
.
memberU
serScoreLog
;
package
cn
.
iocoder
.
yudao
.
module
.
member
.
controller
.
admin
.
u
serScoreLog
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/level/MemberUserLevelConfigService.java
0 → 100644
View file @
ca7db54a
package
cn
.
iocoder
.
yudao
.
module
.
member
.
service
.
level
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.mybatis.core.service.IService
;
import
cn.iocoder.yudao.module.member.dal.dataobject.level.MemberUserLevelConfigDO
;
import
cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelBaseRespVO
;
import
cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelReqVO
;
import
cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelUpdateVO
;
import
java.util.List
;
/**
* 会员等级 Service 接口
*
* @author 系统管理员
*/
public
interface
MemberUserLevelConfigService
extends
IService
<
MemberUserLevelConfigDO
>
{
PageResult
<
MemberUserLevelBaseRespVO
>
getLevelPage
(
MemberUserLevelReqVO
query
);
Boolean
delete
(
List
<
Long
>
ids
);
Boolean
add
(
MemberUserLevelUpdateVO
query
);
Boolean
updateLevel
(
MemberUserLevelUpdateVO
query
);
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/level/MemberUserLevelConfigServiceImpl.java
0 → 100644
View file @
ca7db54a
package
cn
.
iocoder
.
yudao
.
module
.
member
.
service
.
level
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.mybatis.core.service.AbstractService
;
import
cn.iocoder.yudao.module.member.dal.dataobject.level.MemberUserLevelConfigDO
;
import
cn.iocoder.yudao.module.member.dal.mysql.memberUserLevel.MemberUserLevelConfigMapper
;
import
cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreBackVO
;
import
cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelBaseRespVO
;
import
cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelReqVO
;
import
cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelUpdateVO
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
module
.
infra
.
enums
.
ErrorCodeConstants
.
GET_LOCK_FAILED
;
import
static
cn
.
iocoder
.
yudao
.
module
.
member
.
enums
.
ErrorCodeConstants
.
LEVEL_BOUND_RANGE_CONFLICT
;
import
static
cn
.
iocoder
.
yudao
.
module
.
member
.
enums
.
ErrorCodeConstants
.
LEVEL_BOUND_RANGE_ERROR
;
/**
* 会员积分 Service 实现类
*
* @author 系统管理员
*/
@Service
@Validated
@Lazy
public
class
MemberUserLevelConfigServiceImpl
extends
AbstractService
<
MemberUserLevelConfigMapper
,
MemberUserLevelConfigDO
>
implements
MemberUserLevelConfigService
{
private
final
MemberUserLevelConfigMapper
memberUserLevelConfigMapper
;
public
MemberUserLevelConfigServiceImpl
(
MemberUserLevelConfigMapper
memberUserLevelConfigMapper
)
{
this
.
memberUserLevelConfigMapper
=
memberUserLevelConfigMapper
;
}
@Override
public
PageResult
<
MemberUserLevelBaseRespVO
>
getLevelPage
(
MemberUserLevelReqVO
query
)
{
int
start
=
(
query
.
getPageNo
()
-
1
)
*
query
.
getPageSize
();
int
size
=
query
.
getPageSize
();
LambdaQueryWrapper
<
MemberUserLevelConfigDO
>
wrapper
=
Wrappers
.
lambdaQuery
();
wrapper
.
eq
(
MemberUserLevelConfigDO:
:
getDeleted
,
0
);
wrapper
.
last
(
String
.
format
(
"limit %s, %s"
,
start
,
size
));
List
<
MemberUserLevelConfigDO
>
list
=
this
.
list
(
wrapper
);
List
<
MemberUserLevelBaseRespVO
>
result
=
list
.
stream
().
map
(
i
->
BeanUtil
.
copyProperties
(
i
,
MemberUserLevelBaseRespVO
.
class
)).
collect
(
Collectors
.
toList
());
Long
total
=
memberUserLevelConfigMapper
.
selectCount
();
return
new
PageResult
<>(
result
,
total
,
query
.
getPageSize
(),
query
.
getPageNo
(),
(
total
+
query
.
getPageSize
()
-
1
)
/
query
.
getPageSize
());
}
@Override
public
Boolean
delete
(
List
<
Long
>
ids
)
{
if
(
CollectionUtils
.
isEmpty
(
ids
))
{
return
true
;
}
LambdaUpdateWrapper
<
MemberUserLevelConfigDO
>
wrapper
=
Wrappers
.
lambdaUpdate
();
wrapper
.
in
(
MemberUserLevelConfigDO:
:
getId
,
ids
);
wrapper
.
set
(
MemberUserLevelConfigDO:
:
getDeleted
,
1
);
return
this
.
update
(
wrapper
);
}
@Override
public
Boolean
add
(
MemberUserLevelUpdateVO
query
)
{
validate
(
query
);
MemberUserLevelConfigDO
memberUserLevelConfigDO
=
BeanUtil
.
copyProperties
(
query
,
MemberUserLevelConfigDO
.
class
);
return
this
.
saveOrUpdate
(
memberUserLevelConfigDO
);
}
private
void
validate
(
MemberUserLevelUpdateVO
query
)
{
if
(
query
.
getLowerCount
()
>
query
.
getUpperCount
())
{
throw
exception
(
LEVEL_BOUND_RANGE_ERROR
);
}
LambdaQueryWrapper
<
MemberUserLevelConfigDO
>
wrapper
=
Wrappers
.
lambdaQuery
();
wrapper
.
eq
(
MemberUserLevelConfigDO:
:
getDeleted
,
0
);
if
(
query
.
getId
()
!=
null
)
{
wrapper
.
ne
(
MemberUserLevelConfigDO:
:
getId
,
query
.
getId
());
}
List
<
MemberUserLevelConfigDO
>
list
=
this
.
list
(
wrapper
);
for
(
MemberUserLevelConfigDO
memberUserLevelConfigDO
:
list
)
{
if
(
query
.
getLowerCount
()
>=
memberUserLevelConfigDO
.
getLowerCount
()
&&
query
.
getLowerCount
()
<=
memberUserLevelConfigDO
.
getUpperCount
())
{
throw
exception
(
LEVEL_BOUND_RANGE_CONFLICT
);
}
if
(
query
.
getUpperCount
()
>=
memberUserLevelConfigDO
.
getLowerCount
()
&&
query
.
getUpperCount
()
<=
memberUserLevelConfigDO
.
getUpperCount
())
{
throw
exception
(
LEVEL_BOUND_RANGE_CONFLICT
);
}
}
}
@Override
public
Boolean
updateLevel
(
MemberUserLevelUpdateVO
query
)
{
validate
(
query
);
MemberUserLevelConfigDO
memberUserLevelConfigDO
=
BeanUtil
.
copyProperties
(
query
,
MemberUserLevelConfigDO
.
class
);
return
this
.
saveOrUpdate
(
memberUserLevelConfigDO
);
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/vo/userLevel/MemberUserLevelBaseRespVO.java
0 → 100644
View file @
ca7db54a
package
cn
.
iocoder
.
yudao
.
module
.
member
.
vo
.
userLevel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"管理后台 - 会员等级查询返回 VO"
)
public
class
MemberUserLevelBaseRespVO
{
@ApiModelProperty
(
value
=
"id"
)
private
Long
id
;
/**
* 名称
*/
@ApiModelProperty
(
value
=
"等级名称"
)
private
String
name
;
/**
* 积分范围 下界
*/
@ApiModelProperty
(
value
=
"积分范围 下界"
)
private
Integer
lowerCount
;
/**
* 积分范围 上界
*/
@ApiModelProperty
(
value
=
"积分范围 上界"
)
private
Integer
upperCount
;
/**
* 图标
*/
@ApiModelProperty
(
value
=
"图标"
)
private
String
icon
;
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/vo/userLevel/MemberUserLevelReqVO.java
0 → 100644
View file @
ca7db54a
package
cn
.
iocoder
.
yudao
.
module
.
member
.
vo
.
userLevel
;
import
cn.iocoder.yudao.framework.common.pojo.PageParam
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author zhaobiyan
*/
@Data
@ApiModel
(
"管理后台 - 会员等级配置查询 VO"
)
public
class
MemberUserLevelReqVO
extends
PageParam
{
@ApiModelProperty
(
value
=
"id"
)
private
Long
id
;
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/vo/userLevel/MemberUserLevelUpdateVO.java
0 → 100644
View file @
ca7db54a
package
cn
.
iocoder
.
yudao
.
module
.
member
.
vo
.
userLevel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
@Data
@ApiModel
(
"管理后台 - 会员等级编辑 VO"
)
public
class
MemberUserLevelUpdateVO
{
@ApiModelProperty
(
value
=
"id"
)
private
Long
id
;
/**
* 名称
*/
@ApiModelProperty
(
value
=
"等级名称"
)
@NotNull
(
message
=
"name is null"
)
private
String
name
;
/**
* 积分范围 下界
*/
@ApiModelProperty
(
value
=
"积分范围 下界"
)
@NotNull
(
message
=
"lowerCount is null"
)
private
Integer
lowerCount
;
/**
* 积分范围 上界
*/
@ApiModelProperty
(
value
=
"积分范围 上界"
)
@NotNull
(
message
=
"upperCount is null"
)
private
Integer
upperCount
;
/**
* 图标
*/
@ApiModelProperty
(
value
=
"图标"
)
@NotNull
(
message
=
"icon is null"
)
private
String
icon
;
}
yudao-server/src/main/resources/i18n/messages_en.properties
View file @
ca7db54a
...
...
@@ -1021,4 +1021,6 @@ dict.unknown.error = Not in dict {0}: {1}
express.not.exist
=
express not exist
currency.not.exist
=
currency not exist
date.format.error
=
date format error, for example : 2024-01-01 12:11:11
redeem.cancel.status.error
=
record status must be redeeming
\ No newline at end of file
redeem.cancel.status.error
=
record status must be redeeming
level.bound.range.error
=
upper count must greater than lower count
level.bound.range.conflict
=
score range exist conflict
\ No newline at end of file
yudao-server/src/main/resources/i18n/messages_zh.properties
View file @
ca7db54a
...
...
@@ -1025,4 +1025,6 @@ dict.unknown.error = \u4E0D\u5728{0}\u5B57\u5178\u4E2D: {1}
express.not.exist
=
\u
5FEB
\u9012\u
516C
\u
53F8
\u
4E0D
\u
5B58
\u5728
currency.not.exist
=
\u
5E01
\u
79CD
\u
4E0D
\u
5B58
\u5728
date.format.error
=
\u
65E5
\u
671F
\u
683C
\u
5F0F
\u
4E0D
\u
6B63
\u
786E,
\u
6B63
\u
786E
\u
683C
\u
5F0F
\u
53C2
\u8003
: 2024-01-01 12:11:11
redeem.cancel.status.error
=
\u5151\u6362\u
4E2D
\u
72B6
\u6001\u7684\u
8BB0
\u
5F55
\u
624D
\u
80FD
\u
64A4
\u9500
\ No newline at end of file
redeem.cancel.status.error
=
\u5151\u6362\u
4E2D
\u
72B6
\u6001\u7684\u
8BB0
\u
5F55
\u
624D
\u
80FD
\u
64A4
\u9500
level.bound.range.error
=
\u
4E0A
\u
754C
\u6570\u
503C
\u
5FC5
\u
987B
\u5927\u
4E8E
\u
4E0B
\u
754C
\u6570\u
503C
level.bound.range.conflict
=
\u
79EF
\u5206\u8303\u
56F4
\u
5B58
\u5728\u
51B2
\u
7A81
\ No newline at end of file
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