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
99e50784
Commit
99e50784
authored
Aug 12, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
礼品创建修改
parent
bde97df0
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
29 deletions
+66
-29
ErrorCodeConstants.java
...iocoder/yudao/module/reward/enums/ErrorCodeConstants.java
+1
-0
RewardController.java
...dule/reward/controller/admin/reward/RewardController.java
+1
-1
RewardService.java
...der/yudao/module/reward/service/reward/RewardService.java
+1
-1
RewardServiceImpl.java
...yudao/module/reward/service/reward/RewardServiceImpl.java
+42
-20
RewardCreateReqVO.java
...oder/yudao/module/reward/vo/reward/RewardCreateReqVO.java
+19
-7
messages_en.properties
yudao-server/src/main/resources/i18n/messages_en.properties
+1
-0
messages_zh.properties
yudao-server/src/main/resources/i18n/messages_zh.properties
+1
-0
No files found.
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/enums/ErrorCodeConstants.java
View file @
99e50784
...
@@ -28,5 +28,6 @@ public interface ErrorCodeConstants {
...
@@ -28,5 +28,6 @@ public interface ErrorCodeConstants {
ErrorCode
REWARD_REDEEM_VERIFY_BACK_STATUS
=
new
ErrorCode
(
1001011022
,
"reward.redeem.verify.back.status"
);
ErrorCode
REWARD_REDEEM_VERIFY_BACK_STATUS
=
new
ErrorCode
(
1001011022
,
"reward.redeem.verify.back.status"
);
ErrorCode
REDEEM_IMPORT_MAX_COUNT
=
new
ErrorCode
(
1001011023
,
"redeem.import.max.count"
);
ErrorCode
REDEEM_IMPORT_MAX_COUNT
=
new
ErrorCode
(
1001011023
,
"redeem.import.max.count"
);
ErrorCode
REDEEM_CANCEL_STATUS_ERROR
=
new
ErrorCode
(
1001011024
,
"redeem.cancel.status.error"
);
ErrorCode
REDEEM_CANCEL_STATUS_ERROR
=
new
ErrorCode
(
1001011024
,
"redeem.cancel.status.error"
);
ErrorCode
REWARD_NODE_AND_POINTS_LIST_ERROR
=
new
ErrorCode
(
1001011025
,
"reward.node.and.points.list.error"
);
}
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/controller/admin/reward/RewardController.java
View file @
99e50784
...
@@ -41,7 +41,7 @@ public class RewardController {
...
@@ -41,7 +41,7 @@ public class RewardController {
@ApiOperation
(
"创建礼品"
)
@ApiOperation
(
"创建礼品"
)
@Idempotent
(
timeout
=
3
)
@Idempotent
(
timeout
=
3
)
@PreAuthorize
(
"@ss.hasPermission('ecw:giftManagement:add')"
)
@PreAuthorize
(
"@ss.hasPermission('ecw:giftManagement:add')"
)
public
CommonResult
<
L
ong
>
create
(
@Valid
@RequestBody
RewardCreateReqVO
createReqVO
)
{
public
CommonResult
<
L
ist
<
Long
>
>
create
(
@Valid
@RequestBody
RewardCreateReqVO
createReqVO
)
{
return
success
(
rewardService
.
create
(
createReqVO
));
return
success
(
rewardService
.
create
(
createReqVO
));
}
}
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/service/reward/RewardService.java
View file @
99e50784
...
@@ -24,7 +24,7 @@ public interface RewardService extends IService<RewardDO> {
...
@@ -24,7 +24,7 @@ public interface RewardService extends IService<RewardDO> {
* @param createReqVO 创建信息
* @param createReqVO 创建信息
* @return 编号
* @return 编号
*/
*/
L
ong
create
(
@Valid
RewardCreateReqVO
createReqVO
);
L
ist
<
Long
>
create
(
@Valid
RewardCreateReqVO
createReqVO
);
/**
/**
* 更新礼品
* 更新礼品
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/service/reward/RewardServiceImpl.java
View file @
99e50784
...
@@ -24,10 +24,7 @@ import org.springframework.validation.annotation.Validated;
...
@@ -24,10 +24,7 @@ import org.springframework.validation.annotation.Validated;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.time.Instant
;
import
java.time.Instant
;
import
java.util.Collection
;
import
java.util.*
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
...
@@ -50,7 +47,34 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
...
@@ -50,7 +47,34 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
private
MemberUserApi
memberUserApi
;
private
MemberUserApi
memberUserApi
;
@Override
@Override
public
Long
create
(
RewardCreateReqVO
createReqVO
)
{
public
List
<
Long
>
create
(
RewardCreateReqVO
createReqVO
)
{
verifyCreateVO
(
createReqVO
);
// 插入
RewardDO
rewardDO
=
RewardConvert
.
INSTANCE
.
convert
(
createReqVO
);
// 剩余数量若没传给默认值0
if
(
rewardDO
.
getQuantityRemain
()
==
null
)
{
rewardDO
.
setQuantityRemain
(
0
);
}
ArrayList
<
Long
>
ids
=
new
ArrayList
<>();
for
(
RewardCreateReqVO
.
NodeAndPoints
nodeId
:
createReqVO
.
getNodeIds
())
{
rewardDO
.
setNodeId
(
nodeId
.
getNodeId
());
rewardDO
.
setPointsRequire
(
nodeId
.
getPoints
());
rewardDO
.
setCode
(
generateRewardCode
());
//如果插入失败,重新生成code再次插入
try
{
rewardMapper
.
insert
(
rewardDO
);
}
catch
(
Exception
e
)
{
rewardDO
.
setCode
(
generateRewardCode
());
rewardMapper
.
insert
(
rewardDO
);
}
ids
.
add
(
rewardDO
.
getId
());
rewardDO
.
setId
(
null
);
}
// 返回
return
ids
;
}
private
void
verifyCreateVO
(
RewardCreateReqVO
createReqVO
)
{
//活动开始时间不能比活动结束时间晚,活动结束时间不能比当前时间早
//活动开始时间不能比活动结束时间晚,活动结束时间不能比当前时间早
if
(
ObjectUtils
.
allNotNull
(
createReqVO
.
getStartTime
(),
createReqVO
.
getEndTime
()))
{
if
(
ObjectUtils
.
allNotNull
(
createReqVO
.
getStartTime
(),
createReqVO
.
getEndTime
()))
{
if
(
createReqVO
.
getStartTime
().
after
((
createReqVO
.
getEndTime
()))
||
createReqVO
.
getEndTime
().
before
(
Date
.
from
(
Instant
.
now
())))
{
if
(
createReqVO
.
getStartTime
().
after
((
createReqVO
.
getEndTime
()))
||
createReqVO
.
getEndTime
().
before
(
Date
.
from
(
Instant
.
now
())))
{
...
@@ -64,22 +88,20 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
...
@@ -64,22 +88,20 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
if
(
createReqVO
.
getStatus
()
!=
RewardStatusEnum
.
ENABLED
.
getValue
()
&&
createReqVO
.
getStatus
()
!=
RewardStatusEnum
.
DISABLED
.
getValue
())
{
if
(
createReqVO
.
getStatus
()
!=
RewardStatusEnum
.
ENABLED
.
getValue
()
&&
createReqVO
.
getStatus
()
!=
RewardStatusEnum
.
DISABLED
.
getValue
())
{
throw
exception
(
REWARD_STATUS_NOT_ALLOW_CREATE
);
throw
exception
(
REWARD_STATUS_NOT_ALLOW_CREATE
);
}
}
// 插入
// 校验节点和所需积分
RewardDO
rewardDO
=
RewardConvert
.
INSTANCE
.
convert
(
createReqVO
);
List
<
RewardCreateReqVO
.
NodeAndPoints
>
nodeIds
=
createReqVO
.
getNodeIds
();
rewardDO
.
setCode
(
generateRewardCode
());
if
(
CollectionUtil
.
isEmpty
(
nodeIds
))
{
// 剩余数量若没传给默认值0
throw
exception
(
REWARD_NODE_AND_POINTS_LIST_ERROR
);
if
(
rewardDO
.
getQuantityRemain
()
==
null
)
{
}
else
{
rewardDO
.
setQuantityRemain
(
0
);
for
(
RewardCreateReqVO
.
NodeAndPoints
nodeId
:
nodeIds
)
{
if
(
nodeId
.
getPoints
()
==
null
||
nodeId
.
getNodeId
()
==
null
)
{
throw
exception
(
REWARD_NODE_AND_POINTS_LIST_ERROR
);
}
if
(
nodeId
.
getPoints
()
<=
0
||
nodeId
.
getNodeId
()
<=
0
)
{
throw
exception
(
REWARD_NODE_AND_POINTS_LIST_ERROR
);
}
}
}
//如果插入失败,重新生成code再次插入
try
{
rewardMapper
.
insert
(
rewardDO
);
}
catch
(
Exception
e
)
{
rewardDO
.
setCode
(
generateRewardCode
());
rewardMapper
.
insert
(
rewardDO
);
}
}
// 返回
return
rewardDO
.
getId
();
}
}
@Override
@Override
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardCreateReqVO.java
View file @
99e50784
...
@@ -40,14 +40,18 @@ public class RewardCreateReqVO {
...
@@ -40,14 +40,18 @@ public class RewardCreateReqVO {
@ApiModelProperty
(
value
=
"法文礼品图片"
)
@ApiModelProperty
(
value
=
"法文礼品图片"
)
private
String
imgFr
;
private
String
imgFr
;
@ApiModelProperty
(
value
=
"兑换所需积分"
,
required
=
true
)
//
@ApiModelProperty(value = "兑换所需积分", required = true)
@NotNull
(
message
=
"兑换所需积分不能为空"
)
//
@NotNull(message = "兑换所需积分不能为空")
@Min
(
value
=
0
)
//
@Min(value = 0)
private
Integer
pointsRequire
;
//
private Integer pointsRequire;
@ApiModelProperty
(
value
=
"兑换网点"
,
required
=
true
)
//@ApiModelProperty(value = "兑换网点", required = true)
@NotNull
(
message
=
"兑换网点不能为空"
)
//@NotNull(message = "兑换网点不能为空")
private
Integer
nodeId
;
//private Integer nodeId;
@ApiModelProperty
(
value
=
"兑换网点和积分列表"
,
required
=
true
)
@NotNull
(
message
=
"兑换网点列表不能为空"
)
private
List
<
NodeAndPoints
>
nodeIds
;
@ApiModelProperty
(
value
=
"剩余数量"
,
required
=
true
)
@ApiModelProperty
(
value
=
"剩余数量"
,
required
=
true
)
@NotNull
(
message
=
"剩余数量不能为空"
)
@NotNull
(
message
=
"剩余数量不能为空"
)
...
@@ -86,4 +90,12 @@ public class RewardCreateReqVO {
...
@@ -86,4 +90,12 @@ public class RewardCreateReqVO {
@ApiModelProperty
(
value
=
"礼品状态(1已启用,2未启用,3已关闭,4已过期)"
,
required
=
true
)
@ApiModelProperty
(
value
=
"礼品状态(1已启用,2未启用,3已关闭,4已过期)"
,
required
=
true
)
@NotNull
(
message
=
"礼品状态不能为空"
)
@NotNull
(
message
=
"礼品状态不能为空"
)
private
Integer
status
;
private
Integer
status
;
@Data
public
static
class
NodeAndPoints
{
@ApiModelProperty
(
value
=
"兑换网点"
)
private
Integer
nodeId
;
@ApiModelProperty
(
value
=
"兑换网点对应积分"
)
private
Integer
points
;
}
}
}
yudao-server/src/main/resources/i18n/messages_en.properties
View file @
99e50784
...
@@ -1024,6 +1024,7 @@ reward.score.not.enough = user score not enough:{}
...
@@ -1024,6 +1024,7 @@ reward.score.not.enough = user score not enough:{}
reward.count.not.enough
=
reward count not enough
reward.count.not.enough
=
reward count not enough
reward.redeem.count.not.allow
=
bulk redemption is limited to a maximum of 10 pieces at a time
reward.redeem.count.not.allow
=
bulk redemption is limited to a maximum of 10 pieces at a time
reward.redeem.allow.count.error
=
the number of redemptions allowed by the individual has been exceeded:{}
reward.redeem.allow.count.error
=
the number of redemptions allowed by the individual has been exceeded:{}
reward.node.and.points.list.error
=
reward node and points create error
redeem.import.max.count
=
allow maximum number of imports is {}
redeem.import.max.count
=
allow maximum number of imports is {}
dict.unknown.error
=
Not in dict {0}: {1}
dict.unknown.error
=
Not in dict {0}: {1}
...
...
yudao-server/src/main/resources/i18n/messages_zh.properties
View file @
99e50784
...
@@ -1022,6 +1022,7 @@ reward.score.not.enough = \u79EF\u5206\u4E0D\u8DB3\uFF1A{}
...
@@ -1022,6 +1022,7 @@ reward.score.not.enough = \u79EF\u5206\u4E0D\u8DB3\uFF1A{}
reward.count.not.enough
=
\u
793C
\u
54C1
\u6570\u
91CF
\u
4E0D
\u
8DB3
reward.count.not.enough
=
\u
793C
\u
54C1
\u6570\u
91CF
\u
4E0D
\u
8DB3
reward.redeem.count.not.allow
=
\u6279\u
91CF
\u5151\u6362\u
6BCF
\u
6B21
\u6700\u
591A
\u5341\u6761
reward.redeem.count.not.allow
=
\u6279\u
91CF
\u5151\u6362\u
6BCF
\u
6B21
\u6700\u
591A
\u5341\u6761
reward.redeem.allow.count.error
=
\u
5DF2
\u
8D85
\u
51FA
\u
4E2A
\u
4EBA
\u5141\u
8BB8
\u5151\u6362\u
6B21
\u6570\u
FF1A{}
reward.redeem.allow.count.error
=
\u
5DF2
\u
8D85
\u
51FA
\u
4E2A
\u
4EBA
\u5141\u
8BB8
\u5151\u6362\u
6B21
\u6570\u
FF1A{}
reward.node.and.points.list.error
=
\u
521B
\u
5EFA
\u
793C
\u
54C1
\u
7F51
\u
70B9
\u6216\u6240\u9700\u
79EF
\u5206\u9519\u
8BEF
get.lock.failed
=
\u
670D
\u
52A1
\u
7E41
\u
5FD9
\u
FF0C
\u
8BF7
\u
7A0D
\u
540E
\u
91CD
\u
8BD5
get.lock.failed
=
\u
670D
\u
52A1
\u
7E41
\u
5FD9
\u
FF0C
\u
8BF7
\u
7A0D
\u
540E
\u
91CD
\u
8BD5
reward.redeem.not.exist
=
\u
793C
\u
54C1
\u5151\u6362\u
8BB0
\u
5F55
\u
4E0D
\u
5B58
\u5728
reward.redeem.not.exist
=
\u
793C
\u
54C1
\u5151\u6362\u
8BB0
\u
5F55
\u
4E0D
\u
5B58
\u5728
...
...
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