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
65bf4671
Commit
65bf4671
authored
Aug 08, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
错误码配置
parent
7f8837a4
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
92 additions
and
68 deletions
+92
-68
ErrorCodeConstants.java
...iocoder/yudao/module/member/enums/ErrorCodeConstants.java
+15
-4
ScoreRuleServiceImpl.java
...module/member/service/scoreRule/ScoreRuleServiceImpl.java
+31
-38
ScoreRuleBaseVO.java
...der/yudao/module/member/vo/scoreRule/ScoreRuleBaseVO.java
+3
-0
RedeemRewardApi.java
...coder/yudao/module/reward/api/reward/RedeemRewardApi.java
+1
-1
RedeemRewardApiImpl.java
...r/yudao/module/reward/api/reward/RedeemRewardApiImpl.java
+10
-17
RedeemRewardController.java
...eward/controller/admin/redeem/RedeemRewardController.java
+1
-1
AppRedeemRewardController.java
...ward/controller/app/redeem/AppRedeemRewardController.java
+1
-1
messages_en.properties
yudao-server/src/main/resources/i18n/messages_en.properties
+15
-3
messages_zh.properties
yudao-server/src/main/resources/i18n/messages_zh.properties
+15
-3
No files found.
yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java
View file @
65bf4671
...
...
@@ -55,8 +55,19 @@ public interface ErrorCodeConstants {
ErrorCode
SCORE_RULE_NOT_EXISTS
=
new
ErrorCode
(
1004008010
,
"score.rule.not.exists"
);
ErrorCode
SCORE_RULE_DELETE_ERROR
=
new
ErrorCode
(
1004008011
,
"score.rule.delete.error"
);
ErrorCode
SCORE_RULE_UPDATE_ERROR
=
new
ErrorCode
(
1004008012
,
"score.rule.update.error"
);
ErrorCode
SCORE_RULE_FIELD_ERROR
=
new
ErrorCode
(
1004008013
,
"score.rule.field.error"
);
ErrorCode
USER_ADDRESS_NOT_EXISTS
=
new
ErrorCode
(
1004008014
,
"user.address.not.exists"
);
ErrorCode
USER_ADDRESS_FIELD_ERROR
=
new
ErrorCode
(
1004008015
,
"user.address.field.error"
);
ErrorCode
SCORE_RULE_STATUS_ERROR
=
new
ErrorCode
(
1004008014
,
"score.rule.status.error"
);
ErrorCode
SCORE_RULE_STATUS_NOT_ENABLE
=
new
ErrorCode
(
1004008015
,
"score.rule.status.not.enable"
);
ErrorCode
SCORE_RULE_UNIQUE_CHECK_ERROR
=
new
ErrorCode
(
1004008016
,
"score.rule.unique.check.error"
);
ErrorCode
SCORE_RULE_TRANSPORT_TYPE_ERROR
=
new
ErrorCode
(
1004008017
,
"score.rule.transport.type.error"
);
ErrorCode
SCORE_RULE_TIME_ERROR
=
new
ErrorCode
(
1004008018
,
"score.rule.time.error"
);
ErrorCode
SCORE_RULE_PERIOD_ERROR
=
new
ErrorCode
(
1004008019
,
"score.rule.period.error"
);
ErrorCode
ORDERV_SCORE_RULE_ERROR
=
new
ErrorCode
(
1004008020
,
"orderv.score.rule.error"
);
ErrorCode
SCORE_RULE_SHARE_STATUS_ERROR
=
new
ErrorCode
(
1004008021
,
"score.rule.share.status.error"
);
ErrorCode
SCORE_RULE_EXTRA_ERROR
=
new
ErrorCode
(
1004008022
,
"score.rule.extra.error"
);
ErrorCode
SCORE_RULE_RECEIVE_ADDRESS_ERROR
=
new
ErrorCode
(
1004008023
,
"score.rule.receive.address.error"
);
ErrorCode
SCORE_RULE_ORDERENTRY_ERROR
=
new
ErrorCode
(
1004008024
,
"score.rule.orderentry.error"
);
ErrorCode
SCORE_RULE_FIRST_ORDER_ERROR
=
new
ErrorCode
(
1004008025
,
"score.rule.first.order.error"
);
ErrorCode
USER_ADDRESS_NOT_EXISTS
=
new
ErrorCode
(
1004008026
,
"user.address.not.exists"
);
ErrorCode
USER_ADDRESS_FIELD_ERROR
=
new
ErrorCode
(
1004008027
,
"user.address.field.error"
);
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/scoreRule/ScoreRuleServiceImpl.java
View file @
65bf4671
This diff is collapsed.
Click to expand it.
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/vo/scoreRule/ScoreRuleBaseVO.java
View file @
65bf4671
...
...
@@ -46,9 +46,11 @@ public class ScoreRuleBaseVO {
private
String
coverImageEn
;
@ApiModelProperty
(
value
=
"单次获取积分数(订单V值不传)"
,
required
=
true
)
@Min
(
value
=
0
,
message
=
"单次获取积分数不能小于0"
)
private
Integer
getScoreOnce
=
0
;
@ApiModelProperty
(
value
=
"累积最高积分(注册不传)"
,
required
=
true
)
@Min
(
value
=
0
,
message
=
"累积最高积分不能小于0"
)
private
Integer
maxScoreTotal
=
0
;
@ApiModelProperty
(
value
=
"活动开始时间"
,
required
=
true
)
...
...
@@ -63,6 +65,7 @@ public class ScoreRuleBaseVO {
@ApiModelProperty
(
value
=
"积分有效期(天)"
,
required
=
true
)
@NotNull
(
message
=
"积分有效期不能为空"
)
@Min
(
value
=
0
,
message
=
"积分有效期不能小于0天"
)
private
Integer
scorePeriod
;
@ApiModelProperty
(
value
=
"排序值"
,
required
=
true
)
...
...
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/api/reward/RedeemRewardApi.java
View file @
65bf4671
...
...
@@ -11,7 +11,7 @@ import java.util.List;
*/
public
interface
RedeemRewardApi
{
RedeemRewardRespDTO
redeemReward
(
RedeemRewardReqVO
redeemRewardReqVO
);
Boolean
redeemReward
(
RedeemRewardReqVO
redeemRewardReqVO
);
List
<
RedeemRewardRespDTO
>
redeemRewards
(
List
<
RedeemRewardReqVO
>
redeemRewardReqVOList
);
RedeemDetailForUserDTO
getRedeemDetailForUser
(
Long
redeemId
);
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/api/reward/RedeemRewardApiImpl.java
View file @
65bf4671
...
...
@@ -18,6 +18,7 @@ import cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO;
import
cn.iocoder.yudao.module.reward.dal.mysql.redeem.RewardRedeemMapper
;
import
cn.iocoder.yudao.module.reward.dal.mysql.reward.RewardMapper
;
import
cn.iocoder.yudao.module.reward.enums.RewardRedeemStatusEnum
;
import
cn.iocoder.yudao.module.reward.enums.RewardStatusEnum
;
import
cn.iocoder.yudao.module.system.api.sms.SmsCodeApi
;
import
cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeSendReqDTO
;
import
cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO
;
...
...
@@ -65,7 +66,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
RedeemRewardRespDTO
redeemReward
(
RedeemRewardReqVO
redeemRewardReqVO
)
{
public
Boolean
redeemReward
(
RedeemRewardReqVO
redeemRewardReqVO
)
{
if
(
redeemRewardReqVO
.
getEntrance
()
!=
PlatformTypeEnum
.
BACKEND
.
getValue
()
&&
redeemRewardReqVO
instanceof
AppRedeemRewardReqVO
){
AppRedeemRewardReqVO
appRedeemRewardReqVO
=
(
AppRedeemRewardReqVO
)
redeemRewardReqVO
;
SmsCodeUseReqDTO
smsCodeUseReqDTO
=
new
SmsCodeUseReqDTO
();
...
...
@@ -82,28 +83,28 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
// 查询礼品
RewardDO
rewardDO
=
rewardMapper
.
selectById
(
redeemRewardReqVO
.
getRewardId
());
if
(
rewardDO
==
null
)
{
return
getRedeemResp
(
false
,
"礼品不存在"
,
"reward do not exist!"
);
throw
exception
(
REWARD_NOT_EXISTS
);
}
// 礼品未开启
if
(
rewardDO
.
getStatus
()
!=
1
)
{
return
getRedeemResp
(
false
,
"礼品未开启"
,
"reward do not enable!"
);
throw
exception
(
REWARD_NOT_ENABLE
);
}
// 礼品数量不够
if
(
rewardDO
.
getQuantityRemain
()
<
redeemRewardReqVO
.
getRewardCount
())
{
return
getRedeemResp
(
false
,
"礼品数量不够"
,
"reward do not enough!"
);
throw
exception
(
REWARD_COUNT_NOT_ENOUGH
);
}
// 兑换方式不匹配
String
pickMethod
=
rewardDO
.
getPickMethod
();
String
[]
split
=
pickMethod
.
split
(
","
);
if
(!
Arrays
.
asList
(
split
).
contains
(
String
.
valueOf
(
redeemRewardReqVO
.
getRedeemType
())))
{
return
getRedeemResp
(
false
,
"兑换方式不支持"
,
"redeem type do not support!"
);
throw
exception
(
REWARD_PICK_METHOD_NOT_ALLOW
);
}
verifyMemberUser
(
redeemRewardReqVO
,
rewardDO
);
String
lockKey
=
"reward:redeem:lock:"
+
redeemRewardReqVO
.
getRewardId
();
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
if
(!
lock
.
tryLock
(
2
,
10
,
TimeUnit
.
SECONDS
))
{
return
getRedeemResp
(
false
,
"系统繁忙,请稍后再试"
,
"The service is busy, please try again later"
);
throw
exception
(
GET_LOCK_FAILED
);
}
// 添加兑换记录
Long
redeemId
=
addRedeemRecord
(
redeemRewardReqVO
,
rewardDO
);
...
...
@@ -112,19 +113,11 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
// 更新礼品
redeemReward
(
rewardDO
,
redeemRewardReqVO
.
getRewardCount
());
}
catch
(
InterruptedException
e
)
{
return
getRedeemResp
(
false
,
"系统繁忙,请稍后再试"
,
"The service is busy, please try again later"
);
throw
exception
(
GET_LOCK_FAILED
);
}
finally
{
lock
.
unlock
();
}
return
getRedeemResp
(
true
,
"兑换成功!"
,
"redeem success!"
);
}
private
RedeemRewardRespDTO
getRedeemResp
(
Boolean
exchangeResult
,
String
msgZh
,
String
msgEn
)
{
RedeemRewardRespDTO
redeemRewardRespDTO
=
new
RedeemRewardRespDTO
();
redeemRewardRespDTO
.
setExchangeResult
(
false
);
redeemRewardRespDTO
.
setMsgZh
(
msgZh
);
redeemRewardRespDTO
.
setMsgEn
(
msgEn
);
return
redeemRewardRespDTO
;
return
true
;
}
private
void
redeemReward
(
RewardDO
reward
,
Integer
rewardCount
)
{
...
...
@@ -171,7 +164,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
// 查询礼品
RewardDO
rewardDO
=
rewardMapper
.
selectById
(
rewardId
);
// 礼品未开启
if
(
rewardDO
.
getStatus
()
!=
1
)
{
if
(
rewardDO
.
getStatus
()
!=
RewardStatusEnum
.
ENABLED
.
getValue
()
)
{
throw
exception
(
REWARD_NOT_ENABLE
);
}
int
totalCount
=
0
;
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/controller/admin/redeem/RedeemRewardController.java
View file @
65bf4671
...
...
@@ -125,7 +125,7 @@ public class RedeemRewardController {
@PostMapping
(
"/single"
)
@ApiOperation
(
"兑换礼品"
)
@PreAuthorize
(
"@ss.hasPermission('ecw:giftManagement:exchange')"
)
public
CommonResult
<
RedeemRewardRespDTO
>
redeemReward
(
@Valid
@RequestBody
RedeemRewardReqVO
redeemRewardReqVO
)
{
public
CommonResult
<
Boolean
>
redeemReward
(
@Valid
@RequestBody
RedeemRewardReqVO
redeemRewardReqVO
)
{
return
success
(
redeemRewardApi
.
redeemReward
(
redeemRewardReqVO
));
}
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/controller/app/redeem/AppRedeemRewardController.java
View file @
65bf4671
...
...
@@ -58,7 +58,7 @@ public class AppRedeemRewardController {
@ApiOperation
(
"兑换礼品"
)
@Idempotent
(
timeout
=
5
)
//@PreAuthenticated
public
CommonResult
<
RedeemRewardRespDTO
>
redeemReward
(
@Valid
@RequestBody
AppRedeemRewardReqVO
redeemRewardReqVO
)
{
public
CommonResult
<
Boolean
>
redeemReward
(
@Valid
@RequestBody
AppRedeemRewardReqVO
redeemRewardReqVO
)
{
return
success
(
redeemRewardApi
.
redeemReward
(
redeemRewardReqVO
));
}
@PostMapping
(
"/send-sms-code"
)
...
...
yudao-server/src/main/resources/i18n/messages_en.properties
View file @
65bf4671
...
...
@@ -1036,9 +1036,21 @@ level.bound.range.conflict = score range exist conflict
score.operate.idempotent.error
=
idempotent key conflict
score.rule.not.exists
=
score rule not exists
score.rule.field.error
=
score rule field error:{}
score.rule.update.error
=
score rule update error:{}
score.rule.delete.error
=
score rule delete error:{}
score.rule.field.error
=
score rule field error
score.rule.update.error
=
only disabled rule can update
score.rule.delete.error
=
only disabled rule can delete
score.rule.status.error
=
score rule status error
score.rule.status.not.enable
=
score rule status not enable
score.rule.unique.check.error
=
score rule unique check error
score.rule.transport.type.error
=
transport type error
score.rule.time.error
=
score rule time error
score.rule.period.error
=
score rule period error
orderv.score.rule.error
=
order v score rule error
score.rule.share.status.error
=
score rule share status error
score.rule.extra.error
=
score rule extra error
score.rule.receive.address.error
=
score rule receive address error
score.rule.orderentry.error
=
order entry must not null
score.rule.first.order.error
=
firstOrder must 0 or 1
user.address.not.exists
=
user address not exists
user.address.field.error
=
user address field error:{}
\ No newline at end of file
yudao-server/src/main/resources/i18n/messages_zh.properties
View file @
65bf4671
...
...
@@ -1040,9 +1040,21 @@ level.bound.range.conflict = \u79EF\u5206\u8303\u56F4\u5B58\u5728\u51B2\u7A81
score.operate.idempotent.error
=
\u
5E42
\u
7B49key
\u
51B2
\u
7A81
score.rule.not.exists
=
\u
79EF
\u5206\u
89C4
\u5219\u
4E0D
\u
5B58
\u5728
score.rule.field.error
=
\u
79EF
\u5206\u
89C4
\u5219\u
5B57
\u
6BB5
\u9519\u
8BEF
\u
FF1A{}
score.rule.update.error
=
\u
79EF
\u5206\u
89C4
\u5219\u
66F4
\u
65B0
\u5931\u
8D25
\u
FF1A{}
score.rule.delete.error
=
\u
79EF
\u5206\u
89C4
\u5219\u5220\u9664\u5931\u
8D25
\u
FF1A{}
score.rule.field.error
=
\u
79EF
\u5206\u
89C4
\u5219\u
5B57
\u
6BB5
\u9519\u
8BEF
score.rule.update.error
=
\u
53EA
\u6709\u
672A
\u
542F
\u7528\u
89C4
\u5219\u
53EF
\u
4EE5
\u
66F4
\u
65B0
score.rule.delete.error
=
\u
53EA
\u6709\u
672A
\u
542F
\u7528\u
53EF
\u
4EE5
\u5220\u9664
score.rule.status.error
=
\u
79EF
\u5206\u
89C4
\u5219\u
72B6
\u6001\u9519\u
8BEF
score.rule.status.not.enable
=
\u
79EF
\u5206\u
89C4
\u5219\u
672A
\u
542F
\u7528
score.rule.unique.check.error
=
\u
79EF
\u5206\u
89C4
\u5219\u
552F
\u
4E00
\u6027\u
68C0
\u
67E5
\u5931\u
8D25
score.rule.transport.type.error
=
\u
8FD0
\u
8F93
\u
7C7B
\u
578B
\u9519\u
8BEF
score.rule.time.error
=
\u
6D3B
\u
52A8
\u
65F6
\u
95F4
\u
4E0D
\u5408\u
6CD5
score.rule.period.error
=
\u
8FC7
\u
671F
\u
65F6
\u
95F4
\u9519\u
8BEF
orderv.score.rule.error
=
\u
8BA2
\u5355
V
\u
503C
\u
79EF
\u5206\u
89C4
\u5219\u9519\u
8BEF
score.rule.share.status.error
=
\u5206\u
4EAB
\u
72B6
\u6001\u9519\u
8BEF
score.rule.extra.error
=
\u
79EF
\u5206\u
89C4
\u5219\u
989D
\u5916\u
5B57
\u
6BB5
\u9519\u
8BEF
score.rule.receive.address.error
=
\u
8BA2
\u5355
V
\u
503C
\u
89C4
\u5219\u
63D0
\u
8D27
\u
70B9
\u5217\u8868\u9519\u
8BEF
score.rule.orderentry.error
=
\u
8BA2
\u5355\u5165\u
53E3
\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
score.rule.first.order.error
=
\u
662F
\u5426\u9996\u5355\u
5FC5
\u
987B
\u
4E3A
\u
662F
\u
FF080
\u
FF09
\u6216\u5426\u
FF081
\u
FF09
user.address.not.exists
=
\u7528\u6237\u5730\u5740\u
4E0D
\u
5B58
\u5728
user.address.field.error
=
\u7528\u6237\u5730\u5740\u
5B57
\u
6BB5
\u9519\u
8BEF
\u
FF1A{}
\ No newline at end of file
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