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
1958735a
Commit
1958735a
authored
Jul 26, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature-reward:兑换方式修改
parent
ab8f42f6
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
69 additions
and
16 deletions
+69
-16
RewardPickMethedEnum.java
...coder/yudao/module/reward/enums/RewardPickMethedEnum.java
+24
-0
RewardController.java
...dule/reward/controller/admin/reward/RewardController.java
+14
-3
RewardDO.java
...r/yudao/module/reward/dal/dataobject/reward/RewardDO.java
+3
-1
RewardServiceImpl.java
...yudao/module/reward/service/reward/RewardServiceImpl.java
+9
-6
RewardBackVO.java
...n/iocoder/yudao/module/reward/vo/reward/RewardBackVO.java
+7
-1
RewardBaseVO.java
...n/iocoder/yudao/module/reward/vo/reward/RewardBaseVO.java
+6
-1
RewardCreateReqVO.java
...oder/yudao/module/reward/vo/reward/RewardCreateReqVO.java
+3
-2
RewardQueryVO.java
.../iocoder/yudao/module/reward/vo/reward/RewardQueryVO.java
+1
-1
RewardUpdateReqVO.java
...oder/yudao/module/reward/vo/reward/RewardUpdateReqVO.java
+2
-1
No files found.
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/enums/RewardPickMethedEnum.java
0 → 100644
View file @
1958735a
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
enums
;
public
enum
RewardPickMethedEnum
{
PICKUP
(
1
,
"上门领取"
),
SEND_HOME_FREE
(
2
,
"包邮到家"
),
SEND_HOME_PAY
(
3
,
"邮寄到付"
)
;
private
final
int
value
;
private
final
String
name
;
RewardPickMethedEnum
(
int
value
,
String
name
)
{
this
.
value
=
value
;
this
.
name
=
name
;
}
public
int
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/controller/admin/reward/RewardController.java
View file @
1958735a
...
...
@@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.reward.convert.reward.RewardConvert;
import
cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO
;
import
cn.iocoder.yudao.module.reward.service.reward.RewardService
;
import
cn.iocoder.yudao.module.reward.vo.reward.*
;
import
com.alibaba.fastjson.JSON
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -65,7 +66,9 @@ public class RewardController {
//@PreAuthorize("@ss.hasPermission('reward::query')")
public
CommonResult
<
RewardBackVO
>
get
(
@RequestParam
(
"id"
)
Long
id
)
{
RewardDO
rewardDO
=
rewardService
.
get
(
id
);
return
success
(
RewardConvert
.
INSTANCE
.
convert
(
rewardDO
));
RewardBackVO
rewardBackVO
=
RewardConvert
.
INSTANCE
.
convert
(
rewardDO
);
addPickMethodList
(
rewardBackVO
);
return
success
(
rewardBackVO
);
}
@GetMapping
(
"/list"
)
...
...
@@ -74,7 +77,9 @@ public class RewardController {
//@PreAuthorize("@ss.hasPermission('reward::query')")
public
CommonResult
<
List
<
RewardBackVO
>>
getList
(
@RequestParam
(
"ids"
)
Collection
<
Long
>
ids
)
{
List
<
RewardDO
>
list
=
rewardService
.
getList
(
ids
);
return
success
(
RewardConvert
.
INSTANCE
.
convertList
(
list
));
List
<
RewardBackVO
>
rewardBackVOS
=
RewardConvert
.
INSTANCE
.
convertList
(
list
);
rewardBackVOS
.
forEach
(
this
::
addPickMethodList
);
return
success
(
rewardBackVOS
);
}
@PostMapping
(
"/page"
)
...
...
@@ -82,7 +87,9 @@ public class RewardController {
//@PreAuthorize("@ss.hasPermission('reward::query')")
public
CommonResult
<
PageResult
<
RewardBackVO
>>
getPage
(
@Valid
@RequestBody
RewardQueryVO
query
,
PageVO
page
)
{
PageResult
<
RewardDO
>
pageResult
=
rewardService
.
getPage
(
query
,
page
);
return
success
(
RewardConvert
.
INSTANCE
.
convertPage
(
pageResult
));
PageResult
<
RewardBackVO
>
rewardBackVOPageResult
=
RewardConvert
.
INSTANCE
.
convertPage
(
pageResult
);
rewardBackVOPageResult
.
getList
().
forEach
(
this
::
addPickMethodList
);
return
success
(
rewardBackVOPageResult
);
}
@PostMapping
(
"/status"
)
...
...
@@ -117,4 +124,8 @@ public class RewardController {
List
<
RewardBackVO
>
datas
=
RewardConvert
.
INSTANCE
.
convertList
(
list
);
ExcelUtils
.
write
(
response
,
"礼品.xls"
,
"数据"
,
RewardBackVO
.
class
,
datas
);
}
private
void
addPickMethodList
(
RewardBackVO
rewardBackVO
)
{
rewardBackVO
.
setPickMethodList
(
JSON
.
parseArray
(
rewardBackVO
.
getPickMethod
()));
}
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/dal/dataobject/reward/RewardDO.java
View file @
1958735a
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
dal
.
dataobject
.
reward
;
import
cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.*
;
import
java.util.Date
;
import
java.util.List
;
/**
* 礼品 DO
...
...
@@ -82,7 +84,7 @@ public class RewardDO extends BaseDO {
* 领取方式(1上门领取,2包邮到家,3邮寄到付)
* TODO :改为枚举
*/
private
Integer
pickMethod
;
private
String
pickMethod
;
/**
* 允许兑换次数
*/
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/service/reward/RewardServiceImpl.java
View file @
1958735a
...
...
@@ -8,6 +8,8 @@ import cn.iocoder.yudao.module.reward.convert.reward.RewardConvert;
import
cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO
;
import
cn.iocoder.yudao.module.reward.dal.mysql.reward.RewardMapper
;
import
cn.iocoder.yudao.module.reward.vo.reward.*
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.RandomStringUtils
;
import
org.springframework.stereotype.Service
;
...
...
@@ -15,6 +17,7 @@ import org.springframework.validation.annotation.Validated;
import
javax.annotation.Resource
;
import
java.time.Instant
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -50,9 +53,9 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
throw
exception
(
REWARD_STATUS_NOT_ALLOW_CREATE
);
}
//领取方式只能是1,2,3
if
(
createReqVO
.
getPickMethod
()
!=
1
&&
createReqVO
.
getPickMethod
()
!=
2
&&
createReqVO
.
getPickMethod
()
!=
3
)
{
throw
exception
(
REWARD_PICK_METHOD_NOT_ALLOW_CREATE
);
}
//
if (createReqVO.getPickMethod() != 1 && createReqVO.getPickMethod() != 2 && createReqVO.getPickMethod() != 3) {
//
throw exception(REWARD_PICK_METHOD_NOT_ALLOW_CREATE);
//
}
// 插入
RewardDO
rewardDO
=
RewardConvert
.
INSTANCE
.
convert
(
createReqVO
);
rewardDO
.
setCode
(
generateRewardCode
());
...
...
@@ -91,9 +94,9 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
throw
exception
(
REWARD_START_OR_END_TIME_NOT_ALLOW_CREATE
);
}
//领取方式只能是1,2,3
if
(
updateReqVO
.
getPickMethod
()
!=
1
&&
updateReqVO
.
getPickMethod
()
!=
2
&&
updateReqVO
.
getPickMethod
()
!=
3
)
{
throw
exception
(
REWARD_PICK_METHOD_NOT_ALLOW_CREATE
);
}
//
if (updateReqVO.getPickMethod() != 1 && updateReqVO.getPickMethod() != 2 && updateReqVO.getPickMethod() != 3) {
//
throw exception(REWARD_PICK_METHOD_NOT_ALLOW_CREATE);
//
}
updateObj
=
RewardConvert
.
INSTANCE
.
convert
(
updateReqVO
);
}
else
if
(
rewardDO
.
getStatus
()
==
1
)
{
//已启用可编辑剩余数量和备注
updateObj
.
setQuantityRemain
(
updateReqVO
.
getQuantityRemain
());
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardBackVO.java
View file @
1958735a
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
vo
.
reward
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.fastjson.JSONArray
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
...
...
@@ -78,7 +80,11 @@ public class RewardBackVO {
@ExcelProperty
(
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
)
@ApiModelProperty
(
value
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
,
required
=
true
)
private
Integer
pickMethod
;
private
String
pickMethod
;
@ExcelProperty
(
"领取方式(JSON数组)"
)
@ApiModelProperty
(
value
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
)
private
JSONArray
pickMethodList
;
@ExcelProperty
(
"允许兑换次数"
)
@ApiModelProperty
(
value
=
"允许兑换次数"
,
required
=
true
)
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardBaseVO.java
View file @
1958735a
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
vo
.
reward
;
import
com.alibaba.fastjson.JSONArray
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
...
...
@@ -57,7 +59,10 @@ public class RewardBaseVO {
private
Date
endTime
;
@ApiModelProperty
(
value
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
)
private
Integer
pickMethod
;
private
String
pickMethod
;
@ApiModelProperty
(
value
=
"领取方式(JSON数组)"
)
private
JSONArray
pickMethodList
;
@ApiModelProperty
(
value
=
"允许兑换次数"
)
private
Integer
allowCount
;
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardCreateReqVO.java
View file @
1958735a
...
...
@@ -10,6 +10,7 @@ import javax.validation.constraints.Min;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
java.util.Date
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
...
...
@@ -61,9 +62,9 @@ public class RewardCreateReqVO {
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
Date
endTime
;
@ApiModelProperty
(
value
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
,
required
=
true
)
@ApiModelProperty
(
value
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)
可以多选
"
,
required
=
true
)
@NotNull
(
message
=
"领取方式不能为空"
)
private
Integer
pickMethod
;
private
String
pickMethod
;
@ApiModelProperty
(
value
=
"允许兑换次数"
,
required
=
true
)
@NotNull
(
message
=
"允许兑换次数不能为空"
)
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardQueryVO.java
View file @
1958735a
...
...
@@ -35,7 +35,7 @@ public class RewardQueryVO {
private
Integer
quantityRemainSymbol
;
@ApiModelProperty
(
value
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
)
private
Integer
pickMethod
;
private
String
pickMethod
;
@ApiModelProperty
(
value
=
"礼品状态(1已启用,2未启用,3已关闭,4已过期)"
)
private
Integer
status
;
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardUpdateReqVO.java
View file @
1958735a
...
...
@@ -10,6 +10,7 @@ import javax.validation.constraints.Min;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
java.util.Date
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
...
...
@@ -64,7 +65,7 @@ public class RewardUpdateReqVO {
private
Date
endTime
;
@ApiModelProperty
(
value
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
)
private
Integer
pickMethod
;
private
String
pickMethod
;
@ApiModelProperty
(
value
=
"允许兑换次数"
)
@Min
(
value
=
0
)
...
...
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