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
77525aef
Commit
77525aef
authored
Aug 19, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
礼品领取方式校验
parent
26afa7ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
+23
-7
RewardServiceImpl.java
...yudao/module/reward/service/reward/RewardServiceImpl.java
+22
-6
RewardUpdateReqVO.java
...oder/yudao/module/reward/vo/reward/RewardUpdateReqVO.java
+1
-1
No files found.
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/service/reward/RewardServiceImpl.java
View file @
77525aef
...
...
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.reward.service.reward;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO
;
import
cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery
;
import
cn.iocoder.yudao.framework.mybatis.core.service.AbstractService
;
...
...
@@ -16,6 +17,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.dal.mysql.reward.RewardMapper
;
import
cn.iocoder.yudao.module.reward.enums.QuantitativeRelationSymbolEnum
;
import
cn.iocoder.yudao.module.reward.enums.RewardPickMethedEnum
;
import
cn.iocoder.yudao.module.reward.enums.RewardStatusEnum
;
import
cn.iocoder.yudao.module.reward.vo.reward.*
;
import
org.apache.commons.lang3.ObjectUtils
;
...
...
@@ -78,7 +80,12 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
}
private
void
verifyCreateVO
(
RewardCreateReqVO
createReqVO
)
{
//活动开始时间不能比活动结束时间晚,活动结束时间不能比当前时间早
// 校验领取方式
List
<
String
>
pickMethodList
=
Arrays
.
asList
(
createReqVO
.
getPickMethod
().
split
(
","
));
if
(!
pickMethodList
.
contains
(
String
.
valueOf
(
RewardPickMethedEnum
.
SELF_PICKUP
.
getValue
()))
&&
!
pickMethodList
.
contains
(
String
.
valueOf
(
RewardPickMethedEnum
.
SEND_HOME_FREE
.
getValue
()))
&&
!
pickMethodList
.
contains
(
String
.
valueOf
(
RewardPickMethedEnum
.
SEND_HOME_PAY
.
getValue
())))
{
throw
exception
(
REWARD_PICK_METHOD_NOT_ALLOW
);
}
// 活动开始时间不能比活动结束时间晚,活动结束时间不能比当前时间早
if
(
ObjectUtils
.
allNotNull
(
createReqVO
.
getStartTime
(),
createReqVO
.
getEndTime
()))
{
if
(
createReqVO
.
getStartTime
().
after
((
createReqVO
.
getEndTime
()))
||
createReqVO
.
getEndTime
().
before
(
Date
.
from
(
Instant
.
now
())))
{
throw
exception
(
REWARD_START_OR_END_TIME_NOT_ALLOW
);
...
...
@@ -117,6 +124,11 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
RewardDO
updateObj
=
new
RewardDO
();
//未启用可编辑所有内容
if
(
rewardDO
.
getStatus
()
==
RewardStatusEnum
.
DISABLED
.
getValue
())
{
// 校验领取方式
List
<
String
>
pickMethodList
=
Arrays
.
asList
(
updateReqVO
.
getPickMethod
().
split
(
","
));
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getPickMethod
())
&&
!
pickMethodList
.
contains
(
String
.
valueOf
(
RewardPickMethedEnum
.
SELF_PICKUP
.
getValue
()))
&&
!
pickMethodList
.
contains
(
String
.
valueOf
(
RewardPickMethedEnum
.
SEND_HOME_FREE
.
getValue
()))
&&
!
pickMethodList
.
contains
(
String
.
valueOf
(
RewardPickMethedEnum
.
SEND_HOME_PAY
.
getValue
())))
{
throw
exception
(
REWARD_PICK_METHOD_NOT_ALLOW
);
}
if
(
ObjectUtils
.
allNotNull
(
updateReqVO
.
getStartTime
(),
updateReqVO
.
getEndTime
()))
{
if
(
updateReqVO
.
getStartTime
().
after
((
updateReqVO
.
getEndTime
()))
||
updateReqVO
.
getEndTime
().
before
(
Date
.
from
(
Instant
.
now
())))
{
throw
exception
(
REWARD_START_OR_END_TIME_NOT_ALLOW
);
...
...
@@ -125,11 +137,11 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
}
else
{
throw
exception
(
REWARD_START_OR_END_TIME_NOT_ALLOW
);
}
List
<
Reward
Cre
ateReqVO
.
NodeAndPoints
>
nodeIds
=
updateReqVO
.
getNodeIds
();
List
<
Reward
Upd
ateReqVO
.
NodeAndPoints
>
nodeIds
=
updateReqVO
.
getNodeIds
();
if
(
CollectionUtil
.
isEmpty
(
nodeIds
))
{
throw
exception
(
REWARD_NODE_AND_POINTS_LIST_ERROR
);
}
Reward
Cre
ateReqVO
.
NodeAndPoints
nodeAndPoints
=
nodeIds
.
get
(
0
);
Reward
Upd
ateReqVO
.
NodeAndPoints
nodeAndPoints
=
nodeIds
.
get
(
0
);
updateObj
=
RewardConvert
.
INSTANCE
.
convert
(
updateReqVO
);
updateObj
.
setPointsRequire
(
nodeAndPoints
.
getPoints
());
updateObj
.
setNodeId
(
nodeAndPoints
.
getNodeId
());
...
...
@@ -360,11 +372,15 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
}
private
void
setPickMethod
(
AppRewardBackVO
appRewardBackVO
)
{
for
(
String
pickMethod
:
appRewardBackVO
.
getPickMethod
().
split
(
","
))
{
String
[]
splitPickMethod
=
appRewardBackVO
.
getPickMethod
().
split
(
","
);
for
(
String
pickMethod
:
splitPickMethod
)
{
AppRewardBackVO
.
PickMethod
pickMethodDict
=
new
AppRewardBackVO
.
PickMethod
();
pickMethodDict
.
setValue
(
pickMethod
);
pickMethodDict
.
setLabelZh
(
DictFrameworkUtils
.
getDictDataFromCache
(
"way_of_receiving"
,
pickMethod
).
getLabel
());
pickMethodDict
.
setLabelEn
(
DictFrameworkUtils
.
getDictDataFromCache
(
"way_of_receiving"
,
pickMethod
).
getLabelEn
());
DictDataRespDTO
wayOfReceiving
=
DictFrameworkUtils
.
getDictDataFromCache
(
"way_of_receiving"
,
pickMethod
);
if
(
wayOfReceiving
!=
null
)
{
pickMethodDict
.
setLabelZh
(
wayOfReceiving
.
getLabel
());
pickMethodDict
.
setLabelEn
(
wayOfReceiving
.
getLabelEn
());
}
appRewardBackVO
.
getPickMethodList
().
add
(
pickMethodDict
);
}
}
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardUpdateReqVO.java
View file @
77525aef
...
...
@@ -52,7 +52,7 @@ public class RewardUpdateReqVO {
@ApiModelProperty
(
value
=
"兑换网点和积分列表"
,
required
=
true
)
@NotNull
(
message
=
"兑换网点列表不能为空"
)
private
List
<
Reward
Cre
ateReqVO
.
NodeAndPoints
>
nodeIds
;
private
List
<
Reward
Upd
ateReqVO
.
NodeAndPoints
>
nodeIds
;
@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