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
8526f66c
Commit
8526f66c
authored
Jul 23, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature-reward:补充功能
parent
042ebb13
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
51 deletions
+45
-51
RewardMapper.java
...er/yudao/module/reward/dal/mysql/reward/RewardMapper.java
+0
-8
RewardServiceImpl.java
...yudao/module/reward/service/reward/RewardServiceImpl.java
+23
-6
RewardBaseVO.java
...n/iocoder/yudao/module/reward/vo/reward/RewardBaseVO.java
+7
-14
RewardQueryVO.java
.../iocoder/yudao/module/reward/vo/reward/RewardQueryVO.java
+5
-21
GenRewardCodeTest.java
...ao-module-reward-api/src/test/java/GenRewardCodeTest.java
+8
-0
RewardController.java
...dule/reward/controller/admin/reward/RewardController.java
+2
-2
No files found.
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/dal/mysql/reward/RewardMapper.java
View file @
8526f66c
...
...
@@ -26,12 +26,8 @@ public interface RewardMapper extends AbstractMapper<RewardDO> {
.
eqIfPresent
(
RewardDO:
:
getTitleFr
,
vo
.
getTitle
())
.
eqIfPresent
(
RewardDO:
:
getPointsRequire
,
vo
.
getPointsRequire
())
.
eqIfPresent
(
RewardDO:
:
getNodeId
,
vo
.
getNodeId
())
.
eqIfPresent
(
RewardDO:
:
getExchangeCount
,
vo
.
getExchangeCount
())
.
eqIfPresent
(
RewardDO:
:
getQuantityRemain
,
vo
.
getQuantityRemain
())
.
betweenIfPresent
(
RewardDO:
:
getStartTime
,
vo
.
getBeginStartTime
(),
vo
.
getEndStartTime
())
.
betweenIfPresent
(
RewardDO:
:
getEndTime
,
vo
.
getBeginEndTime
(),
vo
.
getEndEndTime
())
.
eqIfPresent
(
RewardDO:
:
getPickMethod
,
vo
.
getPickMethod
())
.
eqIfPresent
(
RewardDO:
:
getAllowCount
,
vo
.
getAllowCount
())
.
eqIfPresent
(
RewardDO:
:
getStatus
,
vo
.
getStatus
())
.
betweenIfPresent
(
RewardDO:
:
getCreateTime
,
vo
.
getBeginCreateTime
(),
vo
.
getEndCreateTime
())
.
orderByDesc
(
RewardDO:
:
getId
));
...
...
@@ -51,12 +47,8 @@ public interface RewardMapper extends AbstractMapper<RewardDO> {
.
eqIfPresent
(
RewardDO:
:
getTitleFr
,
vo
.
getTitle
())
.
eqIfPresent
(
RewardDO:
:
getPointsRequire
,
vo
.
getPointsRequire
())
.
eqIfPresent
(
RewardDO:
:
getNodeId
,
vo
.
getNodeId
())
.
eqIfPresent
(
RewardDO:
:
getExchangeCount
,
vo
.
getExchangeCount
())
.
eqIfPresent
(
RewardDO:
:
getQuantityRemain
,
vo
.
getQuantityRemain
())
.
betweenIfPresent
(
RewardDO:
:
getStartTime
,
vo
.
getBeginStartTime
(),
vo
.
getEndStartTime
())
.
betweenIfPresent
(
RewardDO:
:
getEndTime
,
vo
.
getBeginEndTime
(),
vo
.
getEndEndTime
())
.
eqIfPresent
(
RewardDO:
:
getPickMethod
,
vo
.
getPickMethod
())
.
eqIfPresent
(
RewardDO:
:
getAllowCount
,
vo
.
getAllowCount
())
.
eqIfPresent
(
RewardDO:
:
getStatus
,
vo
.
getStatus
())
.
betweenIfPresent
(
RewardDO:
:
getCreateTime
,
vo
.
getBeginCreateTime
(),
vo
.
getEndCreateTime
())
.
orderByDesc
(
RewardDO:
:
getId
));
...
...
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/service/reward/RewardServiceImpl.java
View file @
8526f66c
...
...
@@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.reward.service.reward;
import
java.util.*
;
import
javax.annotation.Resource
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
cn.iocoder.yudao.framework.mybatis.core.vo.PageVO
;
...
...
@@ -11,6 +13,7 @@ import cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.module.reward.convert.reward.RewardConvert
;
import
cn.iocoder.yudao.module.reward.dal.mysql.reward.RewardMapper
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
module
.
reward
.
enums
.
ErrorCodeConstants
.*;
import
static
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
IdWorker
.
getId
;
...
...
@@ -31,10 +34,10 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
public
Long
create
(
RewardCreateReqVO
createReqVO
)
{
// 插入
RewardDO
rewardDO
=
RewardConvert
.
INSTANCE
.
convert
(
createReqVO
);
rewardDO
.
setCode
(
"111"
);
int
id
=
rewardMapper
.
insert
(
rewardDO
);
rewardDO
.
setCode
(
generateRewardCode
()
);
rewardMapper
.
insert
(
rewardDO
);
// 返回
return
(
long
)
id
;
return
rewardDO
.
getId
()
;
}
@Override
...
...
@@ -72,7 +75,20 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
@Override
public
PageResult
<
RewardDO
>
getPage
(
RewardQueryVO
query
,
PageVO
page
)
{
return
rewardMapper
.
selectPage
(
page
,
query
);
PageResult
<
RewardDO
>
rewardDOPageResult
=
rewardMapper
.
selectPage
(
page
,
new
LambdaQuery
<
RewardDO
>()
.
eqIfPresent
(
RewardDO:
:
getCode
,
query
.
getCode
())
.
eqIfPresent
(
RewardDO:
:
getTitleZh
,
query
.
getTitle
())
.
eqIfPresent
(
RewardDO:
:
getTitleEn
,
query
.
getTitle
())
.
eqIfPresent
(
RewardDO:
:
getTitleFr
,
query
.
getTitle
())
.
eqIfPresent
(
RewardDO:
:
getPointsRequire
,
query
.
getPointsRequire
())
.
eqIfPresent
(
RewardDO:
:
getNodeId
,
query
.
getNodeId
())
.
eqIfPresent
(
RewardDO:
:
getQuantityRemain
,
query
.
getQuantityRemain
())
.
eqIfPresent
(
RewardDO:
:
getPickMethod
,
query
.
getPickMethod
())
.
eqIfPresent
(
RewardDO:
:
getStatus
,
query
.
getStatus
())
.
betweenIfPresent
(
RewardDO:
:
getCreateTime
,
query
.
getBeginCreateTime
(),
query
.
getEndCreateTime
())
.
orderByDesc
(
RewardDO:
:
getId
));
return
rewardDOPageResult
;
}
@Override
...
...
@@ -81,7 +97,8 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
}
//生成礼品ID
private
String
generateRewardCode
(){
return
String
.
valueOf
(
getId
());
private
String
generateRewardCode
()
{
String
uuid
=
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
);
return
uuid
.
substring
(
0
,
12
).
toUpperCase
();
}
}
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardBaseVO.java
View file @
8526f66c
...
...
@@ -15,8 +15,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Data
public
class
RewardBaseVO
{
@ApiModelProperty
(
value
=
"礼品ID"
,
required
=
true
)
@NotNull
(
message
=
"礼品ID不能为空"
)
@ApiModelProperty
(
value
=
"礼品ID"
)
private
String
code
;
@ApiModelProperty
(
value
=
"中文名称"
)
...
...
@@ -37,19 +36,16 @@ public class RewardBaseVO {
@ApiModelProperty
(
value
=
"法文礼品图片"
)
private
String
imgFr
;
@ApiModelProperty
(
value
=
"兑换所需积分"
,
required
=
true
)
@NotNull
(
message
=
"兑换所需积分不能为空"
)
@ApiModelProperty
(
value
=
"兑换所需积分"
)
private
Integer
pointsRequire
;
@ApiModelProperty
(
value
=
"兑换网点"
,
required
=
true
)
@NotNull
(
message
=
"兑换网点不能为空"
)
@ApiModelProperty
(
value
=
"兑换网点"
)
private
Integer
nodeId
;
@ApiModelProperty
(
value
=
"已兑换次数"
)
private
Integer
exchangeCount
;
@ApiModelProperty
(
value
=
"剩余数量"
,
required
=
true
)
@NotNull
(
message
=
"剩余数量不能为空"
)
@ApiModelProperty
(
value
=
"剩余数量"
)
private
Integer
quantityRemain
;
@ApiModelProperty
(
value
=
"活动开始时间"
)
...
...
@@ -60,12 +56,10 @@ public class RewardBaseVO {
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
Date
endTime
;
@ApiModelProperty
(
value
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
,
required
=
true
)
@NotNull
(
message
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)不能为空"
)
@ApiModelProperty
(
value
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
)
private
Integer
pickMethod
;
@ApiModelProperty
(
value
=
"允许兑换次数"
,
required
=
true
)
@NotNull
(
message
=
"允许兑换次数不能为空"
)
@ApiModelProperty
(
value
=
"允许兑换次数"
)
private
Integer
allowCount
;
@ApiModelProperty
(
value
=
"中文备注"
)
...
...
@@ -77,8 +71,7 @@ public class RewardBaseVO {
@ApiModelProperty
(
value
=
"法文备注"
)
private
String
remarkFr
;
@ApiModelProperty
(
value
=
"礼品状态(1已启用,2未启用,3已关闭,4已过期)"
,
required
=
true
)
@NotNull
(
message
=
"礼品状态(1已启用,2未启用,3已关闭,4已过期)不能为空"
)
@ApiModelProperty
(
value
=
"礼品状态(1已启用,2未启用,3已关闭,4已过期)"
)
private
Integer
status
;
}
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardQueryVO.java
View file @
8526f66c
...
...
@@ -21,37 +21,21 @@ public class RewardQueryVO {
@ApiModelProperty
(
value
=
"兑换所需积分"
)
private
Integer
pointsRequire
;
@ApiModelProperty
(
value
=
"兑换所需积分查询条件(1大于,2等于,3小于)"
)
private
Integer
pointsRequireSymbol
;
@ApiModelProperty
(
value
=
"兑换网点"
)
private
Integer
nodeId
;
@ApiModelProperty
(
value
=
"已兑换次数"
)
private
Integer
exchangeCount
;
@ApiModelProperty
(
value
=
"剩余数量"
)
private
Integer
quantityRemain
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"开始活动开始时间"
)
private
Date
beginStartTime
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"结束活动开始时间"
)
private
Date
endStartTime
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"开始活动结束时间"
)
private
Date
beginEndTime
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"结束活动结束时间"
)
private
Date
endEndTime
;
@ApiModelProperty
(
value
=
"剩余数量查询条件(1大于,2等于,3小于)"
)
private
Integer
quantityRemainSymbol
;
@ApiModelProperty
(
value
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
)
private
Integer
pickMethod
;
@ApiModelProperty
(
value
=
"允许兑换次数"
)
private
Integer
allowCount
;
@ApiModelProperty
(
value
=
"礼品状态(1已启用,2未启用,3已关闭,4已过期)"
)
private
Integer
status
;
...
...
yudao-module-reward/yudao-module-reward-api/src/test/java/GenRewardCodeTest.java
View file @
8526f66c
import
cn.hutool.core.lang.UUID
;
public
class
GenRewardCodeTest
{
public
static
void
main
(
String
[]
args
)
{
String
format
=
String
.
format
(
"%012d"
,
2
);
String
uuid
=
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
);
System
.
out
.
println
(
format
);
System
.
out
.
println
(
uuid
);
}
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/controller/admin/reward/RewardController.java
View file @
8526f66c
...
...
@@ -25,7 +25,7 @@ import cn.iocoder.yudao.module.reward.service.reward.RewardService;
@Validated
@RestController
@Api
(
tags
=
"管理后台 - 礼品"
)
@RequestMapping
(
"/reward/"
)
@RequestMapping
(
"/
ecw/
reward/"
)
public
class
RewardController
{
@Resource
...
...
@@ -56,7 +56,7 @@ public class RewardController {
}
@GetMapping
(
"/get"
)
@ApiOperation
(
"获得礼品"
)
@ApiOperation
(
"获得礼品
详情
"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"编号"
,
required
=
true
,
example
=
"1024"
,
dataTypeClass
=
Long
.
class
)
@PreAuthorize
(
"@ss.hasPermission('reward::query')"
)
public
CommonResult
<
RewardBackVO
>
get
(
@RequestParam
(
"id"
)
Long
id
)
{
...
...
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