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
e8cd74aa
Commit
e8cd74aa
authored
Aug 07, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'refs/heads/feature_member_score' into dev
parents
3481b43f
62f23b58
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
101 additions
and
60 deletions
+101
-60
ErrorCodeConstants.java
...iocoder/yudao/module/member/enums/ErrorCodeConstants.java
+3
-3
UserAddressServiceImpl.java
...module/member/service/address/UserAddressServiceImpl.java
+2
-2
ScoreRuleServiceImpl.java
...module/member/service/scoreRule/ScoreRuleServiceImpl.java
+42
-33
ErrorCodeConstants.java
...iocoder/yudao/module/reward/enums/ErrorCodeConstants.java
+10
-12
RedeemRewardApiImpl.java
...r/yudao/module/reward/api/reward/RedeemRewardApiImpl.java
+4
-4
RewardServiceImpl.java
...yudao/module/reward/service/reward/RewardServiceImpl.java
+4
-4
messages_en.properties
yudao-server/src/main/resources/i18n/messages_en.properties
+18
-1
messages_zh.properties
yudao-server/src/main/resources/i18n/messages_zh.properties
+18
-1
No files found.
yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java
View file @
e8cd74aa
...
@@ -53,10 +53,10 @@ public interface ErrorCodeConstants {
...
@@ -53,10 +53,10 @@ public interface ErrorCodeConstants {
ErrorCode
SCORE_OPERATE_IDEMPOTENT_ERROR
=
new
ErrorCode
(
1004008009
,
"score.operate.idempotent.error"
);
ErrorCode
SCORE_OPERATE_IDEMPOTENT_ERROR
=
new
ErrorCode
(
1004008009
,
"score.operate.idempotent.error"
);
ErrorCode
SCORE_RULE_NOT_EXISTS
=
new
ErrorCode
(
1004008010
,
"score.rule.not.exists"
);
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_DELETE_ERROR
=
new
ErrorCode
(
1004008011
,
"score.rule.delete.error
:{}
"
);
ErrorCode
SCORE_RULE_UPDATE_ERROR
=
new
ErrorCode
(
1004008012
,
"score.rule.update.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
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_NOT_EXISTS
=
new
ErrorCode
(
1004008014
,
"user.address.not.exists"
);
ErrorCode
USER_ADDRESS_FIELD_ERROR
=
new
ErrorCode
(
1004008015
,
"user.address.field.error"
);
ErrorCode
USER_ADDRESS_FIELD_ERROR
=
new
ErrorCode
(
1004008015
,
"user.address.field.error
:{}
"
);
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/address/UserAddressServiceImpl.java
View file @
e8cd74aa
...
@@ -64,11 +64,11 @@ public class UserAddressServiceImpl extends AbstractService<UserAddressMapper, U
...
@@ -64,11 +64,11 @@ public class UserAddressServiceImpl extends AbstractService<UserAddressMapper, U
// throw exception(USER_NOT_EXISTS);
// throw exception(USER_NOT_EXISTS);
//}
//}
if
(
StringUtils
.
isAnyBlank
(
reqVO
.
getAddress
(),
reqVO
.
getAreaCode
(),
reqVO
.
getName
(),
reqVO
.
getPhone
()))
{
if
(
StringUtils
.
isAnyBlank
(
reqVO
.
getAddress
(),
reqVO
.
getAreaCode
(),
reqVO
.
getName
(),
reqVO
.
getPhone
()))
{
throw
exception
(
USER_ADDRESS_FIELD_ERROR
);
throw
exception
(
USER_ADDRESS_FIELD_ERROR
,
"Address,AreaCode,Name,Phone must not null"
);
}
}
// 校验手机号格式
// 校验手机号格式
if
(!
reqVO
.
getPhone
().
matches
(
"^1[3-9]\\d{9}$"
))
{
if
(!
reqVO
.
getPhone
().
matches
(
"^1[3-9]\\d{9}$"
))
{
throw
exception
(
USER_ADDRESS_FIELD_ERROR
);
throw
exception
(
USER_ADDRESS_FIELD_ERROR
,
"phone number error"
);
}
}
}
}
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/scoreRule/ScoreRuleServiceImpl.java
View file @
e8cd74aa
...
@@ -21,6 +21,7 @@ import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleOrderVExtraVO;
...
@@ -21,6 +21,7 @@ import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleOrderVExtraVO;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleRegisterExtraVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleRegisterExtraVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO
;
import
cn.iocoder.yudao.module.system.api.user.AdminUserApi
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.NotNull
;
...
@@ -50,12 +51,14 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -50,12 +51,14 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
private
ScoreRuleRedisDao
scoreRuleRedisDao
;
private
ScoreRuleRedisDao
scoreRuleRedisDao
;
@Resource
@Resource
private
WarehouseService
warehouseService
;
private
WarehouseService
warehouseService
;
@Resource
private
AdminUserApi
adminUserApi
;
@Override
@Override
public
Long
createScoreRule
(
ScoreRuleCreateReqVO
createReqVO
)
{
public
Long
createScoreRule
(
ScoreRuleCreateReqVO
createReqVO
)
{
ScoreRuleDO
scoreRule
=
ScoreRuleConvert
.
INSTANCE
.
convert
(
createReqVO
);
ScoreRuleDO
scoreRule
=
ScoreRuleConvert
.
INSTANCE
.
convert
(
createReqVO
);
if
(
scoreRule
.
getStatus
()
!=
ScoreRuleStatusEnum
.
DISABLED
.
getValue
()
&&
scoreRule
.
getStatus
()
!=
ScoreRuleStatusEnum
.
ENABLED
.
getValue
())
{
if
(
scoreRule
.
getStatus
()
!=
ScoreRuleStatusEnum
.
DISABLED
.
getValue
()
&&
scoreRule
.
getStatus
()
!=
ScoreRuleStatusEnum
.
ENABLED
.
getValue
())
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"
状态只能是启用或未启用
"
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"
status must be 1 or 2
"
);
}
}
verifyCommon
(
createReqVO
);
verifyCommon
(
createReqVO
);
Integer
scoreRuleType
=
scoreRule
.
getType
();
Integer
scoreRuleType
=
scoreRule
.
getType
();
...
@@ -69,16 +72,16 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -69,16 +72,16 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
private
void
verifyCommon
(
ScoreRuleBaseVO
scoreRuleIn
)
{
private
void
verifyCommon
(
ScoreRuleBaseVO
scoreRuleIn
)
{
//校验公共入参
//校验公共入参
if
(
scoreRuleIn
.
getType
()
!=
ScoreRuleTypeEnum
.
ORDER_V
.
getValue
()
&&
scoreRuleIn
.
getGetScoreOnce
()
<=
0
)
{
if
(
scoreRuleIn
.
getType
()
!=
ScoreRuleTypeEnum
.
ORDER_V
.
getValue
()
&&
scoreRuleIn
.
getGetScoreOnce
()
<=
0
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"getScoreOnce must > 0"
);
}
}
if
(
scoreRuleIn
.
getType
()
!=
ScoreRuleTypeEnum
.
RECOMMEND
.
getValue
()
&&
scoreRuleIn
.
getMaxScoreTotal
()
<=
0
)
{
if
(
scoreRuleIn
.
getType
()
!=
ScoreRuleTypeEnum
.
RECOMMEND
.
getValue
()
&&
scoreRuleIn
.
getMaxScoreTotal
()
<=
0
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"maxScoreTotal must > 0"
);
}
}
if
(
scoreRuleIn
.
getStartTime
().
after
((
scoreRuleIn
.
getEndTime
()))
||
scoreRuleIn
.
getEndTime
().
before
(
Date
.
from
(
Instant
.
now
())))
{
if
(
scoreRuleIn
.
getStartTime
().
after
((
scoreRuleIn
.
getEndTime
()))
||
scoreRuleIn
.
getEndTime
().
before
(
Date
.
from
(
Instant
.
now
())))
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"startTime must before endTime and endTime must after now"
);
}
}
if
(
scoreRuleIn
.
getScorePeriod
()
<=
0
)
{
if
(
scoreRuleIn
.
getScorePeriod
()
<=
0
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"scorePeriod must > 0"
);
}
}
//如果是启用,校验同一个规则下,有效期内有没有重复的规则设置,分享不校验。海运空运分开算
//如果是启用,校验同一个规则下,有效期内有没有重复的规则设置,分享不校验。海运空运分开算
if
(
scoreRuleIn
.
getStatus
()
==
ScoreRuleStatusEnum
.
ENABLED
.
getValue
()
&&
scoreRuleIn
.
getType
()
!=
ScoreRuleTypeEnum
.
SHARE
.
getValue
())
{
if
(
scoreRuleIn
.
getStatus
()
==
ScoreRuleStatusEnum
.
ENABLED
.
getValue
()
&&
scoreRuleIn
.
getType
()
!=
ScoreRuleTypeEnum
.
SHARE
.
getValue
())
{
...
@@ -88,25 +91,25 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -88,25 +91,25 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
if
(
scoreRuleIn
.
getType
()
==
ScoreRuleTypeEnum
.
ORDER_V
.
getValue
())
{
if
(
scoreRuleIn
.
getType
()
==
ScoreRuleTypeEnum
.
ORDER_V
.
getValue
())
{
ScoreRuleOrderVExtraVO
extraOrderV
=
scoreRuleIn
.
getExtraOrderV
();
ScoreRuleOrderVExtraVO
extraOrderV
=
scoreRuleIn
.
getExtraOrderV
();
if
(
extraOrderV
==
null
)
{
if
(
extraOrderV
==
null
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"extraOrderV must not null"
);
}
}
Integer
transportType
=
extraOrderV
.
getTransportType
();
Integer
transportType
=
extraOrderV
.
getTransportType
();
if
(
transportType
!=
TransportTypeEnum
.
OCEAN_LCL
.
getValue
()
&&
transportType
!=
TransportTypeEnum
.
SPECIAL_LINE_AIR_FREIGHT
.
getValue
())
{
if
(
transportType
!=
TransportTypeEnum
.
OCEAN_LCL
.
getValue
()
&&
transportType
!=
TransportTypeEnum
.
SPECIAL_LINE_AIR_FREIGHT
.
getValue
())
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"transportType must 1 or 3"
);
}
}
List
<
ScoreRuleDO
>
scoreRuleDOS
=
scoreRuleMapper
.
selectList
(
scoreRuleDOLambdaQuery
);
List
<
ScoreRuleDO
>
scoreRuleDOS
=
scoreRuleMapper
.
selectList
(
scoreRuleDOLambdaQuery
);
if
(
scoreRuleDOS
!=
null
&&
!
scoreRuleDOS
.
isEmpty
())
{
if
(
scoreRuleDOS
!=
null
&&
!
scoreRuleDOS
.
isEmpty
())
{
for
(
ScoreRuleDO
scoreRuleDO
:
scoreRuleDOS
)
{
for
(
ScoreRuleDO
scoreRuleDO
:
scoreRuleDOS
)
{
ScoreRuleOrderVExtraVO
bean
=
JSONUtil
.
toBean
(
scoreRuleDO
.
getExtra
(),
ScoreRuleOrderVExtraVO
.
class
);
ScoreRuleOrderVExtraVO
bean
=
JSONUtil
.
toBean
(
scoreRuleDO
.
getExtra
(),
ScoreRuleOrderVExtraVO
.
class
);
if
(
Objects
.
equals
(
bean
.
getTransportType
(),
transportType
))
{
if
(
Objects
.
equals
(
bean
.
getTransportType
(),
transportType
))
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"such rule is already enabled"
);
}
}
}
}
}
}
}
else
{
}
else
{
Long
count
=
scoreRuleMapper
.
selectCount
(
scoreRuleDOLambdaQuery
);
Long
count
=
scoreRuleMapper
.
selectCount
(
scoreRuleDOLambdaQuery
);
if
(
count
>
0
)
{
if
(
count
>
0
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"such rule is already enabled"
);
}
}
}
}
}
}
...
@@ -120,7 +123,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -120,7 +123,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
throw
exception
(
SCORE_RULE_NOT_EXISTS
);
throw
exception
(
SCORE_RULE_NOT_EXISTS
);
}
}
if
(
scoreRuleDO
.
getStatus
()
!=
ScoreRuleStatusEnum
.
DISABLED
.
getValue
())
{
if
(
scoreRuleDO
.
getStatus
()
!=
ScoreRuleStatusEnum
.
DISABLED
.
getValue
())
{
throw
exception
(
SCORE_RULE_UPDATE_ERROR
);
throw
exception
(
SCORE_RULE_UPDATE_ERROR
,
"only disabled rule can update"
);
}
}
ScoreRuleDO
scoreRule
=
ScoreRuleConvert
.
INSTANCE
.
convert
(
updateReqVO
);
ScoreRuleDO
scoreRule
=
ScoreRuleConvert
.
INSTANCE
.
convert
(
updateReqVO
);
verifyCommon
(
updateReqVO
);
verifyCommon
(
updateReqVO
);
...
@@ -141,18 +144,18 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -141,18 +144,18 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
if
(
scoreRuleType
==
ScoreRuleTypeEnum
.
ORDER_V
.
getValue
())
{
if
(
scoreRuleType
==
ScoreRuleTypeEnum
.
ORDER_V
.
getValue
())
{
ScoreRuleOrderVExtraVO
extraOrderV
=
reqVO
.
getExtraOrderV
();
ScoreRuleOrderVExtraVO
extraOrderV
=
reqVO
.
getExtraOrderV
();
if
(
extraOrderV
==
null
)
{
if
(
extraOrderV
==
null
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"extraOrderV must not null"
);
}
}
if
(
extraOrderV
.
getFirstOrder
()
!=
YesOrNoTypeEnum
.
YES
.
ordinal
()
&&
extraOrderV
.
getFirstOrder
()
!=
YesOrNoTypeEnum
.
NO
.
ordinal
())
{
if
(
extraOrderV
.
getFirstOrder
()
!=
YesOrNoTypeEnum
.
YES
.
ordinal
()
&&
extraOrderV
.
getFirstOrder
()
!=
YesOrNoTypeEnum
.
NO
.
ordinal
())
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"firstOrder must 0 or 1"
);
}
}
if
(
extraOrderV
.
getTransportType
()
!=
TransportTypeEnum
.
OCEAN_LCL
.
getValue
()
&&
extraOrderV
.
getTransportType
()
!=
TransportTypeEnum
.
SPECIAL_LINE_AIR_FREIGHT
.
getValue
())
{
if
(
extraOrderV
.
getTransportType
()
!=
TransportTypeEnum
.
OCEAN_LCL
.
getValue
()
&&
extraOrderV
.
getTransportType
()
!=
TransportTypeEnum
.
SPECIAL_LINE_AIR_FREIGHT
.
getValue
())
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"transportType must 1 or 3"
);
}
}
// 国家,城市,仓库id从receiveAddrList中获取
// 国家,城市,仓库id从receiveAddrList中获取
List
<
List
<
Long
>>
receiveAddrList
=
extraOrderV
.
getReceiveAddrList
();
List
<
List
<
Long
>>
receiveAddrList
=
extraOrderV
.
getReceiveAddrList
();
if
(
receiveAddrList
==
null
||
extraOrderV
.
getReceiveAddrList
().
isEmpty
())
{
if
(
receiveAddrList
==
null
||
extraOrderV
.
getReceiveAddrList
().
isEmpty
())
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"receiveAddrList must not null"
);
}
}
StringBuilder
targetCountry
=
new
StringBuilder
();
StringBuilder
targetCountry
=
new
StringBuilder
();
StringBuilder
targetCity
=
new
StringBuilder
();
StringBuilder
targetCity
=
new
StringBuilder
();
...
@@ -163,7 +166,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -163,7 +166,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
targetCity
.
append
(
integers
.
get
(
1
)).
append
(
","
);
targetCity
.
append
(
integers
.
get
(
1
)).
append
(
","
);
receiveAddr
.
append
(
integers
.
get
(
2
)).
append
(
","
);
receiveAddr
.
append
(
integers
.
get
(
2
)).
append
(
","
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"receiveAddrList format error"
);
}
}
}
}
extraOrderV
.
setTargetCountry
(
targetCountry
.
toString
());
extraOrderV
.
setTargetCountry
(
targetCountry
.
toString
());
...
@@ -171,55 +174,55 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -171,55 +174,55 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
extraOrderV
.
setReceiveAddr
(
receiveAddr
.
toString
());
extraOrderV
.
setReceiveAddr
(
receiveAddr
.
toString
());
extraOrderV
.
setReceiveAddrList
(
null
);
extraOrderV
.
setReceiveAddrList
(
null
);
if
(
StringUtils
.
isBlank
(
extraOrderV
.
getOrderEntry
()))
{
if
(
StringUtils
.
isBlank
(
extraOrderV
.
getOrderEntry
()))
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"orderEntry must not null"
);
}
}
verifyOrderVRule
(
extraOrderV
.
getOrderVRule
());
verifyOrderVRule
(
extraOrderV
.
getOrderVRule
());
scoreRule
.
setExtra
(
JSONUtil
.
toJsonStr
(
extraOrderV
));
scoreRule
.
setExtra
(
JSONUtil
.
toJsonStr
(
extraOrderV
));
}
else
if
(
scoreRuleType
==
ScoreRuleTypeEnum
.
REGISTER
.
getValue
())
{
}
else
if
(
scoreRuleType
==
ScoreRuleTypeEnum
.
REGISTER
.
getValue
())
{
if
(
reqVO
.
getExtraRegister
()
==
null
)
{
if
(
reqVO
.
getExtraRegister
()
==
null
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"extraRegister must not null"
);
}
}
if
(
StringUtils
.
isBlank
(
reqVO
.
getExtraRegister
().
getRegisterPlatform
()))
{
if
(
StringUtils
.
isBlank
(
reqVO
.
getExtraRegister
().
getRegisterPlatform
()))
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"registerPlatform must not null"
);
}
}
scoreRule
.
setExtra
(
JSONUtil
.
toJsonStr
(
reqVO
.
getExtraRegister
()));
scoreRule
.
setExtra
(
JSONUtil
.
toJsonStr
(
reqVO
.
getExtraRegister
()));
}
else
if
(
scoreRuleType
==
ScoreRuleTypeEnum
.
RECOMMEND
.
getValue
())
{
}
else
if
(
scoreRuleType
==
ScoreRuleTypeEnum
.
RECOMMEND
.
getValue
())
{
ScoreRulerRecommendExtraVO
extraRecommend
=
reqVO
.
getExtraRecommend
();
ScoreRulerRecommendExtraVO
extraRecommend
=
reqVO
.
getExtraRecommend
();
if
(
extraRecommend
==
null
)
{
if
(
extraRecommend
==
null
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"extraRecommend must not null"
);
}
}
if
(
extraRecommend
.
getShareStatus
()
!=
YesOrNoTypeEnum
.
YES
.
ordinal
()
&&
extraRecommend
.
getShareStatus
()
!=
YesOrNoTypeEnum
.
NO
.
ordinal
())
{
if
(
extraRecommend
.
getShareStatus
()
!=
YesOrNoTypeEnum
.
YES
.
ordinal
()
&&
extraRecommend
.
getShareStatus
()
!=
YesOrNoTypeEnum
.
NO
.
ordinal
())
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"shareStatus must 0 or 1"
);
}
}
if
(
StringUtils
.
isAnyBlank
(
extraRecommend
.
getShareContentEn
(),
extraRecommend
.
getShareContentZh
()))
{
if
(
StringUtils
.
isAnyBlank
(
extraRecommend
.
getShareContentEn
(),
extraRecommend
.
getShareContentZh
()))
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"shareContentEn and shareContentZh must not null"
);
}
}
scoreRule
.
setExtra
(
JSONUtil
.
toJsonStr
(
extraRecommend
));
scoreRule
.
setExtra
(
JSONUtil
.
toJsonStr
(
extraRecommend
));
}
else
if
(
scoreRuleType
==
ScoreRuleTypeEnum
.
SHARE
.
getValue
())
{
}
else
if
(
scoreRuleType
==
ScoreRuleTypeEnum
.
SHARE
.
getValue
())
{
ScoreRuleShareExtraVO
extraShare
=
reqVO
.
getExtraShare
();
ScoreRuleShareExtraVO
extraShare
=
reqVO
.
getExtraShare
();
if
(
extraShare
==
null
)
{
if
(
extraShare
==
null
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"extraShare must not null"
);
}
}
if
(
StringUtils
.
isAnyBlank
(
extraShare
.
getActivityDescZh
(),
extraShare
.
getActivityDescEn
(),
extraShare
.
getActivityUrl
()))
{
if
(
StringUtils
.
isAnyBlank
(
extraShare
.
getActivityDescZh
(),
extraShare
.
getActivityDescEn
(),
extraShare
.
getActivityUrl
()))
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"activityDescZh,activityDescEn,activityUrl must not null"
);
}
}
if
(
extraShare
.
getShareStatus
()
!=
YesOrNoTypeEnum
.
YES
.
ordinal
()
&&
extraShare
.
getShareStatus
()
!=
YesOrNoTypeEnum
.
NO
.
ordinal
())
{
if
(
extraShare
.
getShareStatus
()
!=
YesOrNoTypeEnum
.
YES
.
ordinal
()
&&
extraShare
.
getShareStatus
()
!=
YesOrNoTypeEnum
.
NO
.
ordinal
())
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"shareStatus must 0 or 1"
);
}
}
scoreRule
.
setExtra
(
JSONUtil
.
toJsonStr
(
extraShare
));
scoreRule
.
setExtra
(
JSONUtil
.
toJsonStr
(
extraShare
));
}
else
{
}
else
{
throw
exception
(
SCORE_RULE_NOT_EXISTS
);
throw
exception
(
SCORE_RULE_NOT_EXISTS
,
"scoreRuleType error"
);
}
}
}
}
private
void
verifyOrderVRule
(
List
<
ScoreRuleOrderVExtraVO
.
OrderVRule
>
extraOrderVRule
)
{
private
void
verifyOrderVRule
(
List
<
ScoreRuleOrderVExtraVO
.
OrderVRule
>
extraOrderVRule
)
{
if
(
extraOrderVRule
==
null
||
extraOrderVRule
.
isEmpty
())
{
if
(
extraOrderVRule
==
null
||
extraOrderVRule
.
isEmpty
())
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"orderVRule must not null"
);
}
}
int
low
=
0
;
int
low
=
0
;
for
(
ScoreRuleOrderVExtraVO
.
OrderVRule
orderVRule
:
extraOrderVRule
)
{
for
(
ScoreRuleOrderVExtraVO
.
OrderVRule
orderVRule
:
extraOrderVRule
)
{
if
(
orderVRule
.
getLow
()
<
low
||
orderVRule
.
getHigh
()
<=
orderVRule
.
getLow
()
||
orderVRule
.
getScore
()
<=
0
)
{
if
(
orderVRule
.
getLow
()
<
low
||
orderVRule
.
getHigh
()
<=
orderVRule
.
getLow
()
||
orderVRule
.
getScore
()
<=
0
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"ordervrule does not conform to the rules"
);
}
}
low
=
orderVRule
.
getHigh
();
low
=
orderVRule
.
getHigh
();
}
}
...
@@ -232,7 +235,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -232,7 +235,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
throw
exception
(
SCORE_RULE_NOT_EXISTS
);
throw
exception
(
SCORE_RULE_NOT_EXISTS
);
}
}
if
(
scoreRuleDO
.
getStatus
()
!=
ScoreRuleStatusEnum
.
DISABLED
.
getValue
())
{
if
(
scoreRuleDO
.
getStatus
()
!=
ScoreRuleStatusEnum
.
DISABLED
.
getValue
())
{
throw
exception
(
SCORE_RULE_DELETE_ERROR
);
throw
exception
(
SCORE_RULE_DELETE_ERROR
,
"only disabled rule can update"
);
}
}
// 删除
// 删除
scoreRuleMapper
.
deleteById
(
id
);
scoreRuleMapper
.
deleteById
(
id
);
...
@@ -266,6 +269,12 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -266,6 +269,12 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
@Override
@Override
public
PageResult
<
ScoreRuleBackVO
>
getScoreRulePage
(
ScoreRuleQueryVO
query
,
PageVO
page
)
{
public
PageResult
<
ScoreRuleBackVO
>
getScoreRulePage
(
ScoreRuleQueryVO
query
,
PageVO
page
)
{
PageResult
<
ScoreRuleDO
>
pageResult
=
scoreRuleMapper
.
selectPage
(
page
,
query
);
PageResult
<
ScoreRuleDO
>
pageResult
=
scoreRuleMapper
.
selectPage
(
page
,
query
);
pageResult
.
getList
().
forEach
(
scoreRuleDO
->
{
String
creator
=
adminUserApi
.
getUserName
(
scoreRuleDO
.
getCreator
());
scoreRuleDO
.
setCreator
(
creator
);
String
updater
=
adminUserApi
.
getUserName
(
scoreRuleDO
.
getUpdater
());
scoreRuleDO
.
setUpdater
(
updater
);
});
return
ScoreRuleConvert
.
INSTANCE
.
convertPage
(
pageResult
);
return
ScoreRuleConvert
.
INSTANCE
.
convertPage
(
pageResult
);
}
}
...
@@ -331,12 +340,12 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -331,12 +340,12 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
.
eq
(
ScoreRuleDO:
:
getStatus
,
ScoreRuleStatusEnum
.
ENABLED
.
getValue
());
.
eq
(
ScoreRuleDO:
:
getStatus
,
ScoreRuleStatusEnum
.
ENABLED
.
getValue
());
Long
count
=
scoreRuleMapper
.
selectCount
(
scoreRuleDOLambdaQuery
);
Long
count
=
scoreRuleMapper
.
selectCount
(
scoreRuleDOLambdaQuery
);
if
(
count
>
0
)
{
if
(
count
>
0
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"such rule is already enabled"
);
}
}
}
}
upScoreRuleDO
.
setStatus
(
scoreRuleStatusReqVO
.
getStatus
());
upScoreRuleDO
.
setStatus
(
scoreRuleStatusReqVO
.
getStatus
());
}
else
{
}
else
{
throw
exception
(
SCORE_RULE_UPDATE_ERROR
);
throw
exception
(
SCORE_RULE_UPDATE_ERROR
,
"status not allow"
);
}
}
scoreRuleMapper
.
updateById
(
upScoreRuleDO
);
scoreRuleMapper
.
updateById
(
upScoreRuleDO
);
scoreRuleRedisDao
.
deleteEnableScoreRule
(
scoreRuleDO
.
getType
());
scoreRuleRedisDao
.
deleteEnableScoreRule
(
scoreRuleDO
.
getType
());
...
@@ -364,12 +373,12 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -364,12 +373,12 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
throw
exception
(
SCORE_RULE_NOT_EXISTS
);
throw
exception
(
SCORE_RULE_NOT_EXISTS
);
}
}
if
(
scoreRuleDO
.
getStatus
()
!=
ScoreRuleStatusEnum
.
ENABLED
.
getValue
())
{
if
(
scoreRuleDO
.
getStatus
()
!=
ScoreRuleStatusEnum
.
ENABLED
.
getValue
())
{
throw
exception
(
SCORE_RULE_UPDATE_ERROR
);
throw
exception
(
SCORE_RULE_UPDATE_ERROR
,
"only enabled rule can delay"
);
}
}
Instant
now
=
Instant
.
now
();
Instant
now
=
Instant
.
now
();
//结束时间不能小于当前时间
//结束时间不能小于当前时间
if
(!
delayReqVO
.
getEndTime
().
toInstant
().
isAfter
(
now
)
||
!
delayReqVO
.
getEndTime
().
toInstant
().
isAfter
(
scoreRuleDO
.
getStartTime
().
toInstant
()))
{
if
(!
delayReqVO
.
getEndTime
().
toInstant
().
isAfter
(
now
)
||
!
delayReqVO
.
getEndTime
().
toInstant
().
isAfter
(
scoreRuleDO
.
getStartTime
().
toInstant
()))
{
throw
exception
(
SCORE_RULE_UPDATE_ERROR
);
throw
exception
(
SCORE_RULE_UPDATE_ERROR
,
"end time must after now and start time"
);
}
}
ScoreRuleDO
upScoreRuleDO
=
new
ScoreRuleDO
();
ScoreRuleDO
upScoreRuleDO
=
new
ScoreRuleDO
();
upScoreRuleDO
.
setId
(
delayReqVO
.
getId
());
upScoreRuleDO
.
setId
(
delayReqVO
.
getId
());
...
@@ -380,7 +389,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -380,7 +389,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
@Override
@Override
public
ScoreRuleDO
getEnabledOrderVScoreRuleByTransportType
(
Integer
transportType
)
{
public
ScoreRuleDO
getEnabledOrderVScoreRuleByTransportType
(
Integer
transportType
)
{
if
(
transportType
!=
TransportTypeEnum
.
OCEAN_LCL
.
getValue
()
&&
transportType
!=
TransportTypeEnum
.
SPECIAL_LINE_AIR_FREIGHT
.
getValue
())
{
if
(
transportType
!=
TransportTypeEnum
.
OCEAN_LCL
.
getValue
()
&&
transportType
!=
TransportTypeEnum
.
SPECIAL_LINE_AIR_FREIGHT
.
getValue
())
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"transportType must 1 or 3"
);
}
}
LambdaQuery
<
ScoreRuleDO
>
lambdaQuery
=
new
LambdaQuery
<>();
LambdaQuery
<
ScoreRuleDO
>
lambdaQuery
=
new
LambdaQuery
<>();
lambdaQuery
.
eq
(
ScoreRuleDO:
:
getStatus
,
ScoreRuleStatusEnum
.
ENABLED
.
getValue
())
lambdaQuery
.
eq
(
ScoreRuleDO:
:
getStatus
,
ScoreRuleStatusEnum
.
ENABLED
.
getValue
())
...
...
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/enums/ErrorCodeConstants.java
View file @
e8cd74aa
...
@@ -3,8 +3,7 @@ package cn.iocoder.yudao.module.reward.enums;
...
@@ -3,8 +3,7 @@ package cn.iocoder.yudao.module.reward.enums;
import
cn.iocoder.yudao.framework.common.exception.ErrorCode
;
import
cn.iocoder.yudao.framework.common.exception.ErrorCode
;
// TODO 待办:请将下面的错误码复制到 yudao-module-reward-api 模块的 ErrorCodeConstants 类中。注意,请给“TODO 补充编号”设置一个错误码编号!!!
// ========== 礼品错误码 ==========
// ========== 礼品 TODO 补充编号 ==========
public
interface
ErrorCodeConstants
{
public
interface
ErrorCodeConstants
{
ErrorCode
REWARD_NOT_EXISTS
=
new
ErrorCode
(
1010011001
,
"reward.do.not.exist"
);
ErrorCode
REWARD_NOT_EXISTS
=
new
ErrorCode
(
1010011001
,
"reward.do.not.exist"
);
ErrorCode
REWARD_ENDTIME_ERROR
=
new
ErrorCode
(
1001011002
,
"reward.end.time.less.than.now"
);
ErrorCode
REWARD_ENDTIME_ERROR
=
new
ErrorCode
(
1001011002
,
"reward.end.time.less.than.now"
);
...
@@ -13,16 +12,15 @@ public interface ErrorCodeConstants {
...
@@ -13,16 +12,15 @@ public interface ErrorCodeConstants {
ErrorCode
REWARD_STATUS_CHANGE_ERROR
=
new
ErrorCode
(
1001011005
,
"reward.status.change.error"
);
ErrorCode
REWARD_STATUS_CHANGE_ERROR
=
new
ErrorCode
(
1001011005
,
"reward.status.change.error"
);
ErrorCode
REWARD_STATUS_NOT_ALLOW_DELAY
=
new
ErrorCode
(
1001011006
,
"reward.status.not.allow.delay"
);
ErrorCode
REWARD_STATUS_NOT_ALLOW_DELAY
=
new
ErrorCode
(
1001011006
,
"reward.status.not.allow.delay"
);
ErrorCode
REWARD_STATUS_NOT_ALLOW_CREATE
=
new
ErrorCode
(
1001011007
,
"reward.status.not.allow.create"
);
ErrorCode
REWARD_STATUS_NOT_ALLOW_CREATE
=
new
ErrorCode
(
1001011007
,
"reward.status.not.allow.create"
);
ErrorCode
REWARD_START_OR_END_TIME_NOT_ALLOW_CREATE
=
new
ErrorCode
(
1001011008
,
"reward.time.not.allow"
);
ErrorCode
REWARD_START_OR_END_TIME_NOT_ALLOW
=
new
ErrorCode
(
1001011008
,
"reward.time.not.allow"
);
ErrorCode
REWARD_PICK_METHOD_NOT_ALLOW_CREATE
=
new
ErrorCode
(
1001011009
,
"领取方式不合法"
);
ErrorCode
REWARD_PICK_METHOD_NOT_ALLOW
=
new
ErrorCode
(
1001011009
,
"reward.pick.method.not.allow"
);
ErrorCode
REWARD_STATUS_NOT_ALLOW_UPDATE
=
new
ErrorCode
(
1001011010
,
"礼物状态不允许编辑"
);
ErrorCode
REWARD_STATUS_NOT_ALLOW_UPDATE
=
new
ErrorCode
(
1001011010
,
"reward.status.not.allow.update"
);
ErrorCode
REWARD_STATUS_NOT_ALLOW_ENABLE
=
new
ErrorCode
(
1001011011
,
"礼物不能启用"
);
ErrorCode
REWARD_STATUS_NOT_ALLOW_ENABLE
=
new
ErrorCode
(
1001011011
,
"reward.status.not.allow.enable"
);
ErrorCode
REWARD_NOT_ENABLE
=
new
ErrorCode
(
1001011012
,
"礼物未启用"
);
ErrorCode
REWARD_NOT_ENABLE
=
new
ErrorCode
(
1001011012
,
"reward.not.enable"
);
ErrorCode
REWARD_SCORE_NOT_ENOUGH
=
new
ErrorCode
(
1001011013
,
"会员积分不够"
);
ErrorCode
REWARD_SCORE_NOT_ENOUGH
=
new
ErrorCode
(
1001011013
,
"reward.score.not.enough:{}"
);
ErrorCode
REWARD_COUNT_NOT_ENOUGH
=
new
ErrorCode
(
1001011014
,
"礼品数量不够"
);
ErrorCode
REWARD_COUNT_NOT_ENOUGH
=
new
ErrorCode
(
1001011014
,
"reward.count.not.enough"
);
ErrorCode
REWARD_REDEEM_FAIL
=
new
ErrorCode
(
1001011015
,
"批量兑换失败"
);
ErrorCode
REWARD_REDEEM_COUNT_NOT_ALLOW
=
new
ErrorCode
(
1001011016
,
"reward.redeem.count.not.allow"
);
ErrorCode
REWARD_REDEEM_COUNT_NOT_ALLOW
=
new
ErrorCode
(
1001011016
,
"批量兑换每次最多十条"
);
ErrorCode
REWARD_REDEEM_ALLOW_COUNT_ERROR
=
new
ErrorCode
(
1001011017
,
"reward.redeem.allow.count.error:{}"
);
ErrorCode
REWARD_REDEEM_ALLOW_COUNT_ERROR
=
new
ErrorCode
(
1001011017
,
"超出允许兑换次数"
);
ErrorCode
REWARD_REDEEM_NOT_EXIST
=
new
ErrorCode
(
1001011018
,
"reward.redeem.not.exist"
);
ErrorCode
REWARD_REDEEM_NOT_EXIST
=
new
ErrorCode
(
1001011018
,
"reward.redeem.not.exist"
);
ErrorCode
REWARD_REDEEM_STATUS_ERROR
=
new
ErrorCode
(
1001011019
,
"reward.redeem.status.error"
);
ErrorCode
REWARD_REDEEM_STATUS_ERROR
=
new
ErrorCode
(
1001011019
,
"reward.redeem.status.error"
);
ErrorCode
REWARD_REDEEM_VERIFY_NO_PARAM
=
new
ErrorCode
(
1001011020
,
"reward.redeem.verify.no.param"
);
ErrorCode
REWARD_REDEEM_VERIFY_NO_PARAM
=
new
ErrorCode
(
1001011020
,
"reward.redeem.verify.no.param"
);
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/api/reward/RedeemRewardApiImpl.java
View file @
e8cd74aa
...
@@ -161,7 +161,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
...
@@ -161,7 +161,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
String
pickMethod
=
rewardDO
.
getPickMethod
();
String
pickMethod
=
rewardDO
.
getPickMethod
();
String
[]
split
=
pickMethod
.
split
(
","
);
String
[]
split
=
pickMethod
.
split
(
","
);
if
(!
Arrays
.
asList
(
split
).
contains
(
String
.
valueOf
(
redeemRewardReqVO
.
getRedeemType
())))
{
if
(!
Arrays
.
asList
(
split
).
contains
(
String
.
valueOf
(
redeemRewardReqVO
.
getRedeemType
())))
{
throw
exception
(
REWARD_PICK_METHOD_NOT_ALLOW
_CREATE
);
throw
exception
(
REWARD_PICK_METHOD_NOT_ALLOW
);
}
}
}
}
verifyMemberUser
(
redeemRewardReqVO
,
rewardDO
);
verifyMemberUser
(
redeemRewardReqVO
,
rewardDO
);
...
@@ -187,7 +187,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
...
@@ -187,7 +187,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
redeemReward
(
rewardDO
,
redeemRewardReqVO
.
getRewardCount
());
redeemReward
(
rewardDO
,
redeemRewardReqVO
.
getRewardCount
());
}
}
}
catch
(
ServiceException
e
)
{
}
catch
(
ServiceException
e
)
{
log
.
error
(
"batch redeem rewards exception
"
,
e
);
log
.
error
(
"batch redeem rewards exception
:{}"
,
e
.
getMessage
()
);
throw
e
;
throw
e
;
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
throw
exception
(
GET_LOCK_FAILED
);
throw
exception
(
GET_LOCK_FAILED
);
...
@@ -220,7 +220,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
...
@@ -220,7 +220,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
Integer
holdScore
=
memberUser
.
getHoldScore
();
Integer
holdScore
=
memberUser
.
getHoldScore
();
// 会员积分不够
// 会员积分不够
if
(
holdScore
<
rewardDO
.
getPointsRequire
()
*
redeemRewardReqVO
.
getRewardCount
())
{
if
(
holdScore
<
rewardDO
.
getPointsRequire
()
*
redeemRewardReqVO
.
getRewardCount
())
{
throw
exception
(
REWARD_SCORE_NOT_ENOUGH
);
throw
exception
(
REWARD_SCORE_NOT_ENOUGH
,
"userId:"
+
redeemRewardReqVO
.
getMemberId
()
+
",holdScore:"
+
holdScore
,
"requireScore:"
+
rewardDO
.
getPointsRequire
()
*
redeemRewardReqVO
.
getRewardCount
()
);
}
}
// 校验兑换次数
// 校验兑换次数
LambdaQueryWrapper
<
RewardRedeemDO
>
rewardRedeemDOWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
RewardRedeemDO
>
rewardRedeemDOWrapper
=
new
LambdaQueryWrapper
<>();
...
@@ -228,7 +228,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
...
@@ -228,7 +228,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
.
eq
(
RewardRedeemDO:
:
getMemberId
,
redeemRewardReqVO
.
getMemberId
());
.
eq
(
RewardRedeemDO:
:
getMemberId
,
redeemRewardReqVO
.
getMemberId
());
Long
count
=
rewardRedeemMapper
.
selectCount
(
rewardRedeemDOWrapper
);
Long
count
=
rewardRedeemMapper
.
selectCount
(
rewardRedeemDOWrapper
);
if
(
count
>
rewardDO
.
getAllowCount
())
{
if
(
count
>
rewardDO
.
getAllowCount
())
{
throw
exception
(
REWARD_REDEEM_ALLOW_COUNT_ERROR
);
throw
exception
(
REWARD_REDEEM_ALLOW_COUNT_ERROR
,
"userId:"
+
redeemRewardReqVO
.
getMemberId
()
+
",rewardId:"
+
redeemRewardReqVO
.
getRewardId
()
);
}
}
}
}
}
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/service/reward/RewardServiceImpl.java
View file @
e8cd74aa
...
@@ -54,11 +54,11 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
...
@@ -54,11 +54,11 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
//活动开始时间不能比活动结束时间晚,活动结束时间不能比当前时间早
//活动开始时间不能比活动结束时间晚,活动结束时间不能比当前时间早
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
())))
{
throw
exception
(
REWARD_START_OR_END_TIME_NOT_ALLOW
_CREATE
);
throw
exception
(
REWARD_START_OR_END_TIME_NOT_ALLOW
);
}
}
}
else
if
(
ObjectUtils
.
allNull
(
createReqVO
.
getStartTime
(),
createReqVO
.
getEndTime
()))
{
}
else
if
(
ObjectUtils
.
allNull
(
createReqVO
.
getStartTime
(),
createReqVO
.
getEndTime
()))
{
}
else
{
}
else
{
throw
exception
(
REWARD_START_OR_END_TIME_NOT_ALLOW
_CREATE
);
throw
exception
(
REWARD_START_OR_END_TIME_NOT_ALLOW
);
}
}
// 创建的礼品状态只能是启用或未启用
// 创建的礼品状态只能是启用或未启用
if
(
createReqVO
.
getStatus
()
!=
RewardStatusEnum
.
ENABLED
.
getValue
()
&&
createReqVO
.
getStatus
()
!=
RewardStatusEnum
.
DISABLED
.
getValue
())
{
if
(
createReqVO
.
getStatus
()
!=
RewardStatusEnum
.
ENABLED
.
getValue
()
&&
createReqVO
.
getStatus
()
!=
RewardStatusEnum
.
DISABLED
.
getValue
())
{
...
@@ -94,11 +94,11 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
...
@@ -94,11 +94,11 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
if
(
rewardDO
.
getStatus
()
==
RewardStatusEnum
.
DISABLED
.
getValue
())
{
if
(
rewardDO
.
getStatus
()
==
RewardStatusEnum
.
DISABLED
.
getValue
())
{
if
(
ObjectUtils
.
allNotNull
(
updateReqVO
.
getStartTime
(),
updateReqVO
.
getEndTime
()))
{
if
(
ObjectUtils
.
allNotNull
(
updateReqVO
.
getStartTime
(),
updateReqVO
.
getEndTime
()))
{
if
(
updateReqVO
.
getStartTime
().
after
((
updateReqVO
.
getEndTime
()))
||
updateReqVO
.
getEndTime
().
before
(
Date
.
from
(
Instant
.
now
())))
{
if
(
updateReqVO
.
getStartTime
().
after
((
updateReqVO
.
getEndTime
()))
||
updateReqVO
.
getEndTime
().
before
(
Date
.
from
(
Instant
.
now
())))
{
throw
exception
(
REWARD_START_OR_END_TIME_NOT_ALLOW
_CREATE
);
throw
exception
(
REWARD_START_OR_END_TIME_NOT_ALLOW
);
}
}
}
else
if
(
ObjectUtils
.
allNull
(
updateReqVO
.
getStartTime
(),
updateReqVO
.
getEndTime
()))
{
}
else
if
(
ObjectUtils
.
allNull
(
updateReqVO
.
getStartTime
(),
updateReqVO
.
getEndTime
()))
{
}
else
{
}
else
{
throw
exception
(
REWARD_START_OR_END_TIME_NOT_ALLOW
_CREATE
);
throw
exception
(
REWARD_START_OR_END_TIME_NOT_ALLOW
);
}
}
updateObj
=
RewardConvert
.
INSTANCE
.
convert
(
updateReqVO
);
updateObj
=
RewardConvert
.
INSTANCE
.
convert
(
updateReqVO
);
}
else
if
(
rewardDO
.
getStatus
()
==
RewardStatusEnum
.
ENABLED
.
getValue
())
{
//已启用可编辑剩余数量和备注
}
else
if
(
rewardDO
.
getStatus
()
==
RewardStatusEnum
.
ENABLED
.
getValue
())
{
//已启用可编辑剩余数量和备注
...
...
yudao-server/src/main/resources/i18n/messages_en.properties
View file @
e8cd74aa
...
@@ -1018,6 +1018,15 @@ reward.redeem.status.error = reward redeem record that is redeeming can edit or
...
@@ -1018,6 +1018,15 @@ reward.redeem.status.error = reward redeem record that is redeeming can edit or
reward.redeem.verify.no.param
=
Fee/Currency/Express/Express NO/Delivery Date/Sender/Recipient Address must be filled in
reward.redeem.verify.no.param
=
Fee/Currency/Express/Express NO/Delivery Date/Sender/Recipient Address must be filled in
reward.redeem.batch.verify.error
=
reward redeem record verify failed, please check record data : {}
reward.redeem.batch.verify.error
=
reward redeem record verify failed, please check record data : {}
reward.redeem.verify.back.status
=
record status must be redeemed
reward.redeem.verify.back.status
=
record status must be redeemed
reward.pick.method.not.allow
=
pick method not allow
reward.status.not.allow.update
=
reward status not allow update
reward.status.not.allow.enable
=
reward status not allow enable
reward.not.enable
=
reward is not enable
reward.score.not.enough
=
user score 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.allow.count.error
=
the number of redemptions allowed by the individual has been exceeded
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}
express.not.exist
=
express not exist
express.not.exist
=
express not exist
...
@@ -1027,3 +1036,11 @@ redeem.cancel.status.error = record status must be redeeming
...
@@ -1027,3 +1036,11 @@ redeem.cancel.status.error = record status must be redeeming
level.bound.range.error
=
upper count must greater than lower count
level.bound.range.error
=
upper count must greater than lower count
level.bound.range.conflict
=
score range exist conflict
level.bound.range.conflict
=
score range exist conflict
score.operate.idempotent.error
=
idempotent key 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
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 @
e8cd74aa
...
@@ -1014,6 +1014,15 @@ reward.status.change.error=\u793C\u54C1\u72B6\u6001\u64CD\u4F5C\u4E0D\u7B26\u540
...
@@ -1014,6 +1014,15 @@ reward.status.change.error=\u793C\u54C1\u72B6\u6001\u64CD\u4F5C\u4E0D\u7B26\u540
reward.status.not.allow.delay
=
\u
53EA
\u5141\u
8BB8
\u
5EF6
\u
671F
\u
542F
\u7528\u
72B6
\u6001\u
793C
\u
54C1
reward.status.not.allow.delay
=
\u
53EA
\u5141\u
8BB8
\u
5EF6
\u
671F
\u
542F
\u7528\u
72B6
\u6001\u
793C
\u
54C1
reward.status.not.allow.create
=
\u
521B
\u
5EFA
\u7684\u
793C
\u
54C1
\u
72B6
\u6001\u
53EA
\u
80FD
\u
662F
\u
542F
\u7528\u6216\u
672A
\u
542F
\u7528
reward.status.not.allow.create
=
\u
521B
\u
5EFA
\u7684\u
793C
\u
54C1
\u
72B6
\u6001\u
53EA
\u
80FD
\u
662F
\u
542F
\u7528\u6216\u
672A
\u
542F
\u7528
reward.time.not.allow
=
\u
6D3B
\u
52A8
\u
65F6
\u
95F4
\u
4E0D
\u5408\u
6CD5
reward.time.not.allow
=
\u
6D3B
\u
52A8
\u
65F6
\u
95F4
\u
4E0D
\u5408\u
6CD5
reward.pick.method.not.allow
=
\u
793C
\u
54C1
\u9886\u
53D6
\u
65B9
\u
5F0F
\u
4E0D
\u
652F
\u6301
reward.status.not.allow.update
=
\u
793C
\u
54C1
\u
72B6
\u6001\u
64CD
\u
4F5C
\u
4E0D
\u
7B26
\u5408\u
89C4
\u5219
reward.status.not.allow.enable
=
\u
793C
\u
54C1
\u
4E0D
\u5141\u
8BB8
\u
542F
\u7528
reward.not.enable
=
\u
793C
\u
54C1
\u
672A
\u
542F
\u7528
reward.score.not.enough
=
\u
79EF
\u5206\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.allow.count.error
=
\u
5DF2
\u
8D85
\u
51FA
\u
4E2A
\u
4EBA
\u5141\u
8BB8
\u5151\u6362\u
6B21
\u6570
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
reward.redeem.status.error
=
\u
53EA
\u6709\u5151\u6362\u
4E2D
\u
72B6
\u6001\u7684\u
8BB0
\u
5F55
\u
624D
\u5141\u
8BB8
\u
7F16
\u
8F91
\u6216\u6838\u9500
reward.redeem.status.error
=
\u
53EA
\u6709\u5151\u6362\u
4E2D
\u
72B6
\u6001\u7684\u
8BB0
\u
5F55
\u
624D
\u5141\u
8BB8
\u
7F16
\u
8F91
\u6216\u6838\u9500
...
@@ -1029,3 +1038,11 @@ redeem.cancel.status.error = \u5151\u6362\u4E2D\u72B6\u6001\u7684\u8BB0\u5F55\u6
...
@@ -1029,3 +1038,11 @@ redeem.cancel.status.error = \u5151\u6362\u4E2D\u72B6\u6001\u7684\u8BB0\u5F55\u6
level.bound.range.error
=
\u
4E0A
\u
754C
\u6570\u
503C
\u
5FC5
\u
987B
\u5927\u
4E8E
\u
4E0B
\u
754C
\u6570\u
503C
level.bound.range.error
=
\u
4E0A
\u
754C
\u6570\u
503C
\u
5FC5
\u
987B
\u5927\u
4E8E
\u
4E0B
\u
754C
\u6570\u
503C
level.bound.range.conflict
=
\u
79EF
\u5206\u8303\u
56F4
\u
5B58
\u5728\u
51B2
\u
7A81
level.bound.range.conflict
=
\u
79EF
\u5206\u8303\u
56F4
\u
5B58
\u5728\u
51B2
\u
7A81
score.operate.idempotent.error
=
\u
5E42
\u
7B49key
\u
51B2
\u
7A81
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
score.rule.update.error
=
\u
79EF
\u5206\u
89C4
\u5219\u
66F4
\u
65B0
\u5931\u
8D25
score.rule.delete.error
=
\u
79EF
\u5206\u
89C4
\u5219\u5220\u9664\u5931\u
8D25
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
\ 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