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
62f23b58
Commit
62f23b58
authored
Aug 07, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
积分规则列表返回字段优化
parent
3ba25141
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
ScoreRuleServiceImpl.java
...module/member/service/scoreRule/ScoreRuleServiceImpl.java
+16
-7
No files found.
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/scoreRule/ScoreRuleServiceImpl.java
View file @
62f23b58
...
...
@@ -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.ScoreRuleShareExtraVO
;
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.lang3.StringUtils
;
import
org.jetbrains.annotations.NotNull
;
...
...
@@ -50,6 +51,8 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
private
ScoreRuleRedisDao
scoreRuleRedisDao
;
@Resource
private
WarehouseService
warehouseService
;
@Resource
private
AdminUserApi
adminUserApi
;
@Override
public
Long
createScoreRule
(
ScoreRuleCreateReqVO
createReqVO
)
{
...
...
@@ -208,7 +211,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
}
scoreRule
.
setExtra
(
JSONUtil
.
toJsonStr
(
extraShare
));
}
else
{
throw
exception
(
SCORE_RULE_NOT_EXISTS
,
"scoreRuleType error"
);
throw
exception
(
SCORE_RULE_NOT_EXISTS
,
"scoreRuleType error"
);
}
}
...
...
@@ -219,7 +222,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
int
low
=
0
;
for
(
ScoreRuleOrderVExtraVO
.
OrderVRule
orderVRule
:
extraOrderVRule
)
{
if
(
orderVRule
.
getLow
()
<
low
||
orderVRule
.
getHigh
()
<=
orderVRule
.
getLow
()
||
orderVRule
.
getScore
()
<=
0
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"ordervrule does not conform to the rules"
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"ordervrule does not conform to the rules"
);
}
low
=
orderVRule
.
getHigh
();
}
...
...
@@ -266,6 +269,12 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
@Override
public
PageResult
<
ScoreRuleBackVO
>
getScoreRulePage
(
ScoreRuleQueryVO
query
,
PageVO
page
)
{
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
);
}
...
...
@@ -331,12 +340,12 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
.
eq
(
ScoreRuleDO:
:
getStatus
,
ScoreRuleStatusEnum
.
ENABLED
.
getValue
());
Long
count
=
scoreRuleMapper
.
selectCount
(
scoreRuleDOLambdaQuery
);
if
(
count
>
0
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"such rule is already enabled"
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"such rule is already enabled"
);
}
}
upScoreRuleDO
.
setStatus
(
scoreRuleStatusReqVO
.
getStatus
());
}
else
{
throw
exception
(
SCORE_RULE_UPDATE_ERROR
,
"status not allow"
);
throw
exception
(
SCORE_RULE_UPDATE_ERROR
,
"status not allow"
);
}
scoreRuleMapper
.
updateById
(
upScoreRuleDO
);
scoreRuleRedisDao
.
deleteEnableScoreRule
(
scoreRuleDO
.
getType
());
...
...
@@ -364,12 +373,12 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
throw
exception
(
SCORE_RULE_NOT_EXISTS
);
}
if
(
scoreRuleDO
.
getStatus
()
!=
ScoreRuleStatusEnum
.
ENABLED
.
getValue
())
{
throw
exception
(
SCORE_RULE_UPDATE_ERROR
,
"only enabled rule can delay"
);
throw
exception
(
SCORE_RULE_UPDATE_ERROR
,
"only enabled rule can delay"
);
}
Instant
now
=
Instant
.
now
();
//结束时间不能小于当前时间
if
(!
delayReqVO
.
getEndTime
().
toInstant
().
isAfter
(
now
)
||
!
delayReqVO
.
getEndTime
().
toInstant
().
isAfter
(
scoreRuleDO
.
getStartTime
().
toInstant
()))
{
throw
exception
(
SCORE_RULE_UPDATE_ERROR
,
"end time must after now and start time"
);
throw
exception
(
SCORE_RULE_UPDATE_ERROR
,
"end time must after now and start time"
);
}
ScoreRuleDO
upScoreRuleDO
=
new
ScoreRuleDO
();
upScoreRuleDO
.
setId
(
delayReqVO
.
getId
());
...
...
@@ -380,7 +389,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
@Override
public
ScoreRuleDO
getEnabledOrderVScoreRuleByTransportType
(
Integer
transportType
)
{
if
(
transportType
!=
TransportTypeEnum
.
OCEAN_LCL
.
getValue
()
&&
transportType
!=
TransportTypeEnum
.
SPECIAL_LINE_AIR_FREIGHT
.
getValue
())
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"transportType must 1 or 3"
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
,
"transportType must 1 or 3"
);
}
LambdaQuery
<
ScoreRuleDO
>
lambdaQuery
=
new
LambdaQuery
<>();
lambdaQuery
.
eq
(
ScoreRuleDO:
:
getStatus
,
ScoreRuleStatusEnum
.
ENABLED
.
getValue
())
...
...
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