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
f9d6bf8f
Commit
f9d6bf8f
authored
Aug 06, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
积分基本信息,积分日志
parent
416de628
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
331 additions
and
6 deletions
+331
-6
ScoreSourceTypeEnum.java
...ocoder/yudao/module/member/enums/ScoreSourceTypeEnum.java
+4
-0
pom.xml
yudao-module-member/yudao-module-member-impl/pom.xml
+5
-0
AppMemberUserScoreController.java
...ontroller/app/userScore/AppMemberUserScoreController.java
+53
-0
AppMemberUserIdQueryVO.java
...r/controller/app/userScore/vo/AppMemberUserIdQueryVO.java
+18
-0
AppMemberUserScoreInfoRespVO.java
...roller/app/userScore/vo/AppMemberUserScoreInfoRespVO.java
+26
-0
AppMemberUserScoreLogRespVO.java
...troller/app/userScore/vo/AppMemberUserScoreLogRespVO.java
+44
-0
MemberUserScoreService.java
...o/module/member/service/score/MemberUserScoreService.java
+9
-0
MemberUserScoreServiceImpl.java
...dule/member/service/score/MemberUserScoreServiceImpl.java
+26
-0
MemberUserScoreLogService.java
...le/member/service/scoreLog/MemberUserScoreLogService.java
+6
-0
MemberUserScoreLogServiceImpl.java
...ember/service/scoreLog/MemberUserScoreLogServiceImpl.java
+106
-5
ScoreDelayReqVO.java
...der/yudao/module/member/vo/scoreRule/ScoreDelayReqVO.java
+1
-1
RedeemRewardApi.java
...coder/yudao/module/reward/api/reward/RedeemRewardApi.java
+2
-0
RedeemDetailForUserDTO.java
.../module/reward/api/reward/dto/RedeemDetailForUserDTO.java
+16
-0
RedeemRewardApiImpl.java
...r/yudao/module/reward/api/reward/RedeemRewardApiImpl.java
+15
-0
No files found.
yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ScoreSourceTypeEnum.java
View file @
f9d6bf8f
...
...
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.member.enums;
import
com.google.common.collect.Sets
;
import
java.util.Set
;
import
java.util.stream.Stream
;
public
enum
ScoreSourceTypeEnum
{
MANUAL_OPERATE
(
1
,
"人工操作"
,
null
,
null
),
...
...
@@ -53,4 +54,7 @@ public enum ScoreSourceTypeEnum {
public
static
Set
<
ScoreSourceTypeEnum
>
getInvalidScoreStatusSourceType
()
{
return
Sets
.
newHashSet
(
MANUAL_OPERATE
,
SYSTEM_EXPIRED
);
}
public
static
ScoreSourceTypeEnum
parseByValue
(
int
value
)
{
return
Stream
.
of
(
values
()).
filter
(
e
->
e
.
getValue
()
==
value
).
findAny
().
orElse
(
null
);
}
}
yudao-module-member/yudao-module-member-impl/pom.xml
View file @
f9d6bf8f
...
...
@@ -59,5 +59,10 @@
<artifactId>
yudao-module-customer-core
</artifactId>
<version>
${revision}
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-reward-api
</artifactId>
<version>
${revision}
</version>
</dependency>
</dependencies>
</project>
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/userScore/AppMemberUserScoreController.java
0 → 100644
View file @
f9d6bf8f
package
cn
.
iocoder
.
yudao
.
module
.
member
.
controller
.
app
.
userScore
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated
;
import
cn.iocoder.yudao.module.member.api.score.MemberUserScoreApiImpl
;
import
cn.iocoder.yudao.module.member.controller.app.userScore.vo.AppMemberUserIdQueryVO
;
import
cn.iocoder.yudao.module.member.controller.app.userScore.vo.AppMemberUserScoreInfoRespVO
;
import
cn.iocoder.yudao.module.member.controller.app.userScore.vo.AppMemberUserScoreLogRespVO
;
import
cn.iocoder.yudao.module.member.service.score.MemberUserScoreService
;
import
cn.iocoder.yudao.module.member.service.scoreLog.MemberUserScoreLogService
;
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.annotation.Resource
;
import
javax.validation.Valid
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
@Validated
@RestController
@Api
(
tags
=
"用户 APP - 会员积分"
)
@RequestMapping
(
"/member/user-score"
)
public
class
AppMemberUserScoreController
{
@Resource
private
MemberUserScoreService
userScoreService
;
@Resource
private
MemberUserScoreApiImpl
scoreApi
;
@Resource
private
MemberUserScoreLogService
memberUserScoreLogService
;
@PostMapping
(
"/info"
)
@ApiOperation
(
"获得会员积分基本信息"
)
//@PreAuthenticated
public
CommonResult
<
AppMemberUserScoreInfoRespVO
>
getUserScoreInfo
(
@Valid
@RequestBody
AppMemberUserIdQueryVO
idQuery
)
{
AppMemberUserScoreInfoRespVO
scoreInfo
=
userScoreService
.
getUserScoreInfo
(
idQuery
);
return
success
(
scoreInfo
);
}
@PostMapping
(
"/log"
)
@ApiOperation
(
"获取会员积分日志列表"
)
//@PreAuthenticated
public
CommonResult
<
List
<
AppMemberUserScoreLogRespVO
>>
getUserScoreLogList
(
@Valid
@RequestBody
AppMemberUserIdQueryVO
query
)
{
return
success
(
memberUserScoreLogService
.
getUserScoreLogList
(
query
));
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/userScore/vo/AppMemberUserIdQueryVO.java
0 → 100644
View file @
f9d6bf8f
package
cn
.
iocoder
.
yudao
.
module
.
member
.
controller
.
app
.
userScore
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
/**
* @author zhaobiyan
*/
@Data
@ApiModel
(
"用户 APP - 会员积分 id查询 VO"
)
public
class
AppMemberUserIdQueryVO
{
@ApiModelProperty
(
value
=
"会员id"
)
@NotNull
private
Long
id
;
}
\ No newline at end of file
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/userScore/vo/AppMemberUserScoreInfoRespVO.java
0 → 100644
View file @
f9d6bf8f
package
cn
.
iocoder
.
yudao
.
module
.
member
.
controller
.
app
.
userScore
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@ApiModel
(
"用户 APP - 会员积分基本信息返回 VO"
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
AppMemberUserScoreInfoRespVO
{
@ApiModelProperty
(
value
=
"会员id"
)
private
Long
id
;
@ApiModelProperty
(
value
=
"当前积分"
)
private
Integer
holdScore
;
@ApiModelProperty
(
value
=
"已兑换积分"
)
private
Integer
usedScore
;
@ApiModelProperty
(
value
=
"历史总积分"
)
private
Integer
totalScore
;
@ApiModelProperty
(
value
=
"会员等级名称"
)
private
String
levelName
;
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/userScore/vo/AppMemberUserScoreLogRespVO.java
0 → 100644
View file @
f9d6bf8f
package
cn
.
iocoder
.
yudao
.
module
.
member
.
controller
.
app
.
userScore
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
@Data
@ApiModel
(
"用户 APP - 会员积分日志返回 VO"
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
AppMemberUserScoreLogRespVO
{
@ApiModelProperty
(
value
=
"积分数量"
)
private
Integer
scoreCount
;
@ApiModelProperty
(
value
=
"操作类型"
)
private
String
operateType
;
@ApiModelProperty
(
value
=
"积分来源"
)
private
String
sourceTypeZh
;
@ApiModelProperty
(
value
=
"积分来源"
)
private
String
sourceTypeEn
;
@ApiModelProperty
(
value
=
"积分规则id"
)
private
Long
ruleId
;
@ApiModelProperty
(
value
=
"积分规则名称中文"
)
private
String
ruleNameZh
;
@ApiModelProperty
(
value
=
"积分规则名称英文"
)
private
String
ruleNameEn
;
@ApiModelProperty
(
value
=
"日志时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
Date
createTime
;
@ApiModelProperty
(
value
=
"描述信息中文"
)
private
String
descZh
=
""
;
@ApiModelProperty
(
value
=
"描述信息英文"
)
private
String
descEn
=
""
;
@ApiModelProperty
(
value
=
"礼品兑换数量"
)
private
Integer
rewardCount
;
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/score/MemberUserScoreService.java
View file @
f9d6bf8f
...
...
@@ -4,6 +4,8 @@ import java.util.*;
import
cn.iocoder.yudao.framework.mybatis.core.service.IService
;
import
cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreUpdateReqDTO
;
import
cn.iocoder.yudao.module.member.controller.app.userScore.vo.AppMemberUserIdQueryVO
;
import
cn.iocoder.yudao.module.member.controller.app.userScore.vo.AppMemberUserScoreInfoRespVO
;
import
cn.iocoder.yudao.module.member.vo.memberUserScore.*
;
import
cn.iocoder.yudao.module.member.dal.dataobject.score.MemberUserScoreDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
...
...
@@ -50,4 +52,11 @@ public interface MemberUserScoreService extends IService<MemberUserScoreDO> {
List
<
MemberUserScoreDO
>
getUserScoreList
(
MemberUserScoreQueryVO
query
);
void
updateUserScore
(
MemberUserScoreUpdateReqDTO
query
);
/**
* 获取会员积分及会员等级信息
* @param id
* @return
*/
AppMemberUserScoreInfoRespVO
getUserScoreInfo
(
AppMemberUserIdQueryVO
id
);
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/score/MemberUserScoreServiceImpl.java
View file @
f9d6bf8f
...
...
@@ -3,12 +3,16 @@ package cn.iocoder.yudao.module.member.service.score;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.mybatis.core.service.AbstractService
;
import
cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreUpdateReqDTO
;
import
cn.iocoder.yudao.module.member.controller.app.userScore.vo.AppMemberUserIdQueryVO
;
import
cn.iocoder.yudao.module.member.controller.app.userScore.vo.AppMemberUserScoreInfoRespVO
;
import
cn.iocoder.yudao.module.member.dal.dataobject.score.MemberUserScoreDO
;
import
cn.iocoder.yudao.module.member.dal.mysql.memberUserScore.MemberUserScoreMapper
;
import
cn.iocoder.yudao.module.member.enums.ScoreOperateTypeEnum
;
import
cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum
;
import
cn.iocoder.yudao.module.member.service.level.MemberUserLevelConfigService
;
import
cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreBackVO
;
import
cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreQueryVO
;
import
cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigBaseRespVO
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -34,6 +38,8 @@ public class MemberUserScoreServiceImpl extends AbstractService<MemberUserScoreM
@Resource
private
MemberUserScoreMapper
userScoreMapper
;
@Resource
private
MemberUserLevelConfigService
memberUserLevelConfigService
;
@Override
public
void
deleteUserScore
(
Long
id
)
{
...
...
@@ -103,6 +109,26 @@ public class MemberUserScoreServiceImpl extends AbstractService<MemberUserScoreM
}
}
@Override
public
AppMemberUserScoreInfoRespVO
getUserScoreInfo
(
AppMemberUserIdQueryVO
id
)
{
MemberUserScoreDO
userScoreDO
=
userScoreMapper
.
getByMemberId
(
id
.
getId
());
if
(
userScoreDO
==
null
)
{
throw
exception
(
MEMBER_ID_IS_NULL
);
}
Integer
userScoreTotal
=
userScoreDO
.
getHoldScore
()
+
userScoreDO
.
getUsedScore
()
+
userScoreDO
.
getExpiredScore
();
AppMemberUserScoreInfoRespVO
infoRespVO
=
AppMemberUserScoreInfoRespVO
.
builder
()
.
holdScore
(
userScoreDO
.
getHoldScore
())
.
id
(
userScoreDO
.
getId
())
.
totalScore
(
userScoreTotal
)
.
usedScore
(
userScoreDO
.
getUsedScore
())
.
build
();
MemberUserLevelConfigBaseRespVO
level
=
memberUserLevelConfigService
.
getLevelByCount
(
userScoreTotal
);
if
(
level
!=
null
)
{
infoRespVO
.
setLevelName
(
level
.
getName
());
}
return
infoRespVO
;
}
private
MemberUserScoreDO
initMemberUserScore
(
Long
memberId
)
{
MemberUserScoreDO
memberUserScoreDO
=
new
MemberUserScoreDO
();
memberUserScoreDO
.
setMemberId
(
memberId
);
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/scoreLog/MemberUserScoreLogService.java
View file @
f9d6bf8f
...
...
@@ -2,11 +2,15 @@ package cn.iocoder.yudao.module.member.service.scoreLog;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.mybatis.core.service.IService
;
import
cn.iocoder.yudao.module.member.controller.app.userScore.vo.AppMemberUserIdQueryVO
;
import
cn.iocoder.yudao.module.member.controller.app.userScore.vo.AppMemberUserScoreLogRespVO
;
import
cn.iocoder.yudao.module.member.dal.dataobject.scoreLog.MemberUserScoreLogDO
;
import
cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogBackVO
;
import
cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogCreateReq
;
import
cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQueryVO
;
import
java.util.List
;
/**
* 会员积分日志 Service 接口
*
...
...
@@ -19,4 +23,6 @@ public interface MemberUserScoreLogService extends IService<MemberUserScoreLogDO
Long
createScoreLog
(
MemberUserScoreLogCreateReq
createReq
);
MemberUserScoreLogDO
getByUniqueId
(
String
uniqueId
);
List
<
AppMemberUserScoreLogRespVO
>
getUserScoreLogList
(
AppMemberUserIdQueryVO
query
);
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/scoreLog/MemberUserScoreLogServiceImpl.java
View file @
f9d6bf8f
...
...
@@ -3,12 +3,22 @@ package cn.iocoder.yudao.module.member.service.scoreLog;
import
cn.hutool.core.lang.generator.SnowflakeGenerator
;
import
cn.hutool.json.JSONUtil
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.util.json.JsonUtils
;
import
cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils
;
import
cn.iocoder.yudao.framework.mybatis.core.service.AbstractService
;
import
cn.iocoder.yudao.module.member.controller.app.userScore.vo.AppMemberUserIdQueryVO
;
import
cn.iocoder.yudao.module.member.controller.app.userScore.vo.AppMemberUserScoreLogRespVO
;
import
cn.iocoder.yudao.module.member.dal.dataobject.scoreLog.MemberUserScoreLogDO
;
import
cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreLog.MemberUserScoreLogMapper
;
import
cn.iocoder.yudao.module.member.enums.ScoreOperateTypeEnum
;
import
cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum
;
import
cn.iocoder.yudao.module.member.service.scoreRule.ScoreRuleService
;
import
cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogBackVO
;
import
cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogCreateReq
;
import
cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQueryVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.ScoreRuleBackDetailVO
;
import
cn.iocoder.yudao.module.reward.api.reward.RedeemRewardApi
;
import
cn.iocoder.yudao.module.reward.api.reward.dto.RedeemDetailForUserDTO
;
import
cn.iocoder.yudao.module.system.service.dict.DictTypeService
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
...
...
@@ -16,7 +26,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.validation.annotation.Validated
;
import
javax.annotation.Resource
;
import
java.util.
List
;
import
java.util.
*
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
module
.
member
.
enums
.
ErrorCodeConstants
.
MEMBER_ID_IS_NULL
;
...
...
@@ -32,12 +42,12 @@ public class MemberUserScoreLogServiceImpl extends AbstractService<MemberUserSco
@Resource
private
MemberUserScoreLogMapper
userScoreLogMapper
;
@Resource
private
DictTypeService
dictTypeService
;
@Resource
private
SnowflakeGenerator
snowflakeGenerator
;
@Resource
private
ScoreRuleService
scoreRuleService
;
@Resource
RedeemRewardApi
redeemRewardApi
;
@Override
...
...
@@ -75,4 +85,95 @@ public class MemberUserScoreLogServiceImpl extends AbstractService<MemberUserSco
wrapper
.
eq
(
MemberUserScoreLogDO:
:
getUniqueId
,
uniqueId
);
return
this
.
selectOne
(
wrapper
);
}
@Override
public
List
<
AppMemberUserScoreLogRespVO
>
getUserScoreLogList
(
AppMemberUserIdQueryVO
query
)
{
List
<
MemberUserScoreLogDO
>
userScoreLogDOS
=
userScoreLogMapper
.
selectList
(
"member_id"
,
query
.
getId
());
if
(
userScoreLogDOS
==
null
||
userScoreLogDOS
.
isEmpty
())
{
return
Collections
.
EMPTY_LIST
;
}
ArrayList
<
AppMemberUserScoreLogRespVO
>
appMemberUserScoreLogRespVOS
=
new
ArrayList
<>();
for
(
MemberUserScoreLogDO
userScoreLogDO
:
userScoreLogDOS
)
{
setScoreRuleLogDetail
(
userScoreLogDO
,
appMemberUserScoreLogRespVOS
);
}
return
appMemberUserScoreLogRespVOS
;
}
private
void
setScoreRuleLogDetail
(
MemberUserScoreLogDO
userScoreLogDO
,
ArrayList
<
AppMemberUserScoreLogRespVO
>
appMemberUserScoreLogRespVOS
)
{
AppMemberUserScoreLogRespVO
appMemberUserScoreLogRespVO
=
new
AppMemberUserScoreLogRespVO
();
appMemberUserScoreLogRespVO
.
setScoreCount
(
userScoreLogDO
.
getScoreCount
());
appMemberUserScoreLogRespVO
.
setOperateType
(
userScoreLogDO
.
getOperateType
()
==
1
?
"+"
:
"-"
);
appMemberUserScoreLogRespVO
.
setCreateTime
(
userScoreLogDO
.
getCreateTime
());
// 增加积分日志
if
(
Objects
.
equals
(
userScoreLogDO
.
getOperateType
(),
ScoreOperateTypeEnum
.
ADD
.
getValue
()))
{
switch
(
userScoreLogDO
.
getSourceType
())
{
// 人工操作
case
1
:
appMemberUserScoreLogRespVO
.
setSourceTypeZh
(
DictFrameworkUtils
.
getDictDataFromCache
(
"member_score_source"
,
"1"
).
getLabel
());
appMemberUserScoreLogRespVO
.
setSourceTypeEn
(
DictFrameworkUtils
.
getDictDataFromCache
(
"member_score_source"
,
"1"
).
getLabelEn
());
appMemberUserScoreLogRespVO
.
setDescZh
(
"人工积分"
);
appMemberUserScoreLogRespVO
.
setDescEn
(
"Manually add points"
);
break
;
// 撤销兑换
case
4
:
appMemberUserScoreLogRespVO
.
setSourceTypeZh
(
DictFrameworkUtils
.
getDictDataFromCache
(
"member_score_source"
,
"4"
).
getLabel
());
appMemberUserScoreLogRespVO
.
setSourceTypeEn
(
DictFrameworkUtils
.
getDictDataFromCache
(
"member_score_source"
,
"4"
).
getLabelEn
());
// TODO:补充描述
appMemberUserScoreLogRespVO
.
setDescZh
(
DictFrameworkUtils
.
getDictDataFromCache
(
"member_score_source"
,
"4"
).
getLabel
());
appMemberUserScoreLogRespVO
.
setDescEn
(
DictFrameworkUtils
.
getDictDataFromCache
(
"member_score_source"
,
"4"
).
getLabelEn
());
break
;
// 活动积分
case
5
:
case
6
:
case
7
:
case
8
:
ScoreSourceTypeEnum
scoreSourceTypeEnum
=
ScoreSourceTypeEnum
.
parseByValue
(
userScoreLogDO
.
getSourceType
());
appMemberUserScoreLogRespVO
.
setSourceTypeZh
(
DictFrameworkUtils
.
getDictDataFromCache
(
"member_score_source"
,
String
.
valueOf
(
scoreSourceTypeEnum
.
getValue
())).
getLabel
());
appMemberUserScoreLogRespVO
.
setSourceTypeEn
(
DictFrameworkUtils
.
getDictDataFromCache
(
"member_score_source"
,
String
.
valueOf
(
scoreSourceTypeEnum
.
getValue
())).
getLabelEn
());
ScoreRuleBackDetailVO
scoreRule
=
scoreRuleService
.
getScoreRule
(
userScoreLogDO
.
getRuleId
());
if
(
scoreRule
!=
null
)
{
appMemberUserScoreLogRespVO
.
setRuleId
(
userScoreLogDO
.
getRuleId
());
appMemberUserScoreLogRespVO
.
setRuleNameEn
(
scoreRule
.
getTitleEn
());
appMemberUserScoreLogRespVO
.
setRuleNameZh
(
scoreRule
.
getTitleZh
());
appMemberUserScoreLogRespVO
.
setDescEn
(
scoreRule
.
getDescEn
());
appMemberUserScoreLogRespVO
.
setDescZh
(
scoreRule
.
getDescZh
());
}
break
;
}
}
else
{
// 减少积分日志
switch
(
userScoreLogDO
.
getSourceType
())
{
// 人工操作
case
1
:
appMemberUserScoreLogRespVO
.
setSourceTypeZh
(
DictFrameworkUtils
.
getDictDataFromCache
(
"member_score_source"
,
"1"
).
getLabel
());
appMemberUserScoreLogRespVO
.
setSourceTypeEn
(
DictFrameworkUtils
.
getDictDataFromCache
(
"member_score_source"
,
"1"
).
getLabelEn
());
appMemberUserScoreLogRespVO
.
setDescZh
(
"人工积分"
);
appMemberUserScoreLogRespVO
.
setDescEn
(
"Manually reduce points"
);
break
;
// 兑换
case
2
:
appMemberUserScoreLogRespVO
.
setSourceTypeZh
(
DictFrameworkUtils
.
getDictDataFromCache
(
"member_score_source"
,
"2"
).
getLabel
());
appMemberUserScoreLogRespVO
.
setSourceTypeEn
(
DictFrameworkUtils
.
getDictDataFromCache
(
"member_score_source"
,
"2"
).
getLabelEn
());
// 查询兑换记录
Map
<
String
,
Long
>
extParam
=
JsonUtils
.
parseObject
(
userScoreLogDO
.
getExtParam
(),
HashMap
.
class
);
Long
redeemId
=
extParam
.
get
(
"redeemId"
);
if
(
redeemId
!=
null
)
{
RedeemDetailForUserDTO
redeemDetailForUser
=
redeemRewardApi
.
getRedeemDetailForUser
(
redeemId
);
if
(
redeemDetailForUser
!=
null
)
{
appMemberUserScoreLogRespVO
.
setRewardCount
(
redeemDetailForUser
.
getRewardCount
());
appMemberUserScoreLogRespVO
.
setDescZh
(
redeemDetailForUser
.
getRewardNameZh
());
appMemberUserScoreLogRespVO
.
setDescEn
(
redeemDetailForUser
.
getRewardNameEn
());
}
}
break
;
// 系统过期
case
3
:
appMemberUserScoreLogRespVO
.
setSourceTypeZh
(
DictFrameworkUtils
.
getDictDataFromCache
(
"member_score_source"
,
"3"
).
getLabel
());
appMemberUserScoreLogRespVO
.
setSourceTypeEn
(
DictFrameworkUtils
.
getDictDataFromCache
(
"member_score_source"
,
"3"
).
getLabelEn
());
appMemberUserScoreLogRespVO
.
setDescZh
(
"系统过期"
);
appMemberUserScoreLogRespVO
.
setDescEn
(
"System expiration"
);
}
}
appMemberUserScoreLogRespVOS
.
add
(
appMemberUserScoreLogRespVO
);
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/vo/scoreRule/ScoreDelayReqVO.java
View file @
f9d6bf8f
...
...
@@ -11,7 +11,7 @@ import java.util.Date;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
@Data
@ApiModel
(
"管理后台 - 积分规则延期 Re
sponse
VO"
)
@ApiModel
(
"管理后台 - 积分规则延期 Re
quest
VO"
)
public
class
ScoreDelayReqVO
{
@ApiModelProperty
(
value
=
"主键"
,
required
=
true
)
@NotNull
(
message
=
"主键不能为空"
)
...
...
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/api/reward/RedeemRewardApi.java
View file @
f9d6bf8f
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
api
.
reward
;
import
cn.iocoder.yudao.module.reward.api.reward.dto.RedeemDetailForUserDTO
;
import
cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardReqVO
;
import
cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardRespDTO
;
...
...
@@ -13,4 +14,5 @@ public interface RedeemRewardApi {
RedeemRewardRespDTO
redeemReward
(
RedeemRewardReqVO
redeemRewardReqVO
);
List
<
RedeemRewardRespDTO
>
redeemRewards
(
List
<
RedeemRewardReqVO
>
redeemRewardReqVOList
);
RedeemDetailForUserDTO
getRedeemDetailForUser
(
Long
redeemId
);
}
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/api/reward/dto/RedeemDetailForUserDTO.java
0 → 100644
View file @
f9d6bf8f
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
api
.
reward
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"用户 APP - 礼品兑换记录 DTO"
)
public
class
RedeemDetailForUserDTO
{
@ApiModelProperty
(
value
=
"礼品名称中文"
)
private
String
rewardNameZh
;
@ApiModelProperty
(
value
=
"礼品名称英文"
)
private
String
rewardNameEn
;
@ApiModelProperty
(
value
=
"兑换数量"
)
private
Integer
rewardCount
;
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/api/reward/RedeemRewardApiImpl.java
View file @
f9d6bf8f
...
...
@@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import
cn.iocoder.yudao.module.member.api.user.dto.UserRespDTO
;
import
cn.iocoder.yudao.module.member.enums.PlatformTypeEnum
;
import
cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum
;
import
cn.iocoder.yudao.module.reward.api.reward.dto.RedeemDetailForUserDTO
;
import
cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardReqVO
;
import
cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardRespDTO
;
import
cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO
;
...
...
@@ -188,6 +189,20 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
return
null
;
}
@Override
public
RedeemDetailForUserDTO
getRedeemDetailForUser
(
Long
redeemId
)
{
RewardRedeemDO
rewardRedeemDO
=
rewardRedeemMapper
.
selectById
(
redeemId
);
if
(
rewardRedeemDO
!=
null
)
{
RedeemDetailForUserDTO
redeemDetailForUserDTO
=
new
RedeemDetailForUserDTO
();
redeemDetailForUserDTO
.
setRewardCount
(
rewardRedeemDO
.
getRewardCount
());
RewardDO
rewardDO
=
rewardMapper
.
selectById
(
rewardRedeemDO
.
getRewardId
());
redeemDetailForUserDTO
.
setRewardNameEn
(
rewardDO
.
getTitleEn
());
redeemDetailForUserDTO
.
setRewardNameZh
(
rewardDO
.
getTitleZh
());
return
redeemDetailForUserDTO
;
}
return
null
;
}
private
void
verifyMemberUser
(
RedeemRewardReqVO
redeemRewardReqVO
,
RewardDO
rewardDO
)
{
// 查询会员积分
UserRespDTO
memberUser
=
memberUserApi
.
getUser
(
redeemRewardReqVO
.
getMemberId
());
...
...
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