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
9bb083b3
Commit
9bb083b3
authored
Jul 31, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
积分规则接口校验
parent
45bceac6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
21 deletions
+38
-21
ScoreRuleController.java
...ember/controller/admin/scoreRule/ScoreRuleController.java
+2
-2
ScoreRuleServiceImpl.java
...module/member/service/scoreRule/ScoreRuleServiceImpl.java
+36
-19
No files found.
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/admin/scoreRule/ScoreRuleController.java
View file @
9bb083b3
...
@@ -110,9 +110,9 @@ public class ScoreRuleController {
...
@@ -110,9 +110,9 @@ public class ScoreRuleController {
return
success
(
true
);
return
success
(
true
);
}
}
@GetMapping
(
"/
getWarehouseTreeRegionL
ist"
)
@GetMapping
(
"/
warehouse-tree-region-l
ist"
)
@ApiOperation
(
"获得目的国、目的城市、目的仓列表"
)
@ApiOperation
(
"获得目的国、目的城市、目的仓列表"
)
public
CommonResult
<
List
<
WarehouseTreeRegionVO
>>
W
arehouseTreeRegionList
()
{
public
CommonResult
<
List
<
WarehouseTreeRegionVO
>>
w
arehouseTreeRegionList
()
{
List
<
WarehouseTreeRegionVO
>
listIn
=
warehouseService
.
getWarehouseTreeRegionList
(
1
);
List
<
WarehouseTreeRegionVO
>
listIn
=
warehouseService
.
getWarehouseTreeRegionList
(
1
);
List
<
WarehouseTreeRegionVO
>
listOut
=
warehouseService
.
getWarehouseTreeRegionList
(
2
);
List
<
WarehouseTreeRegionVO
>
listOut
=
warehouseService
.
getWarehouseTreeRegionList
(
2
);
List
<
WarehouseTreeRegionVO
>
list
=
ListUtils
.
sum
(
listIn
,
listOut
);
List
<
WarehouseTreeRegionVO
>
list
=
ListUtils
.
sum
(
listIn
,
listOut
);
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/scoreRule/ScoreRuleServiceImpl.java
View file @
9bb083b3
...
@@ -47,7 +47,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -47,7 +47,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
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
);
}
}
verifyCommon
(
scoreRule
);
verifyCommon
(
createReqVO
);
Integer
scoreRuleType
=
scoreRule
.
getType
();
Integer
scoreRuleType
=
scoreRule
.
getType
();
verifyAndSetExtraDO
(
createReqVO
,
scoreRuleType
,
scoreRule
);
verifyAndSetExtraDO
(
createReqVO
,
scoreRuleType
,
scoreRule
);
scoreRuleMapper
.
insert
(
scoreRule
);
scoreRuleMapper
.
insert
(
scoreRule
);
...
@@ -55,29 +55,48 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -55,29 +55,48 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
return
scoreRule
.
getId
();
return
scoreRule
.
getId
();
}
}
private
void
verifyCommon
(
ScoreRule
DO
scoreRule
)
{
private
void
verifyCommon
(
ScoreRule
BaseVO
scoreRuleIn
)
{
//校验公共入参
//校验公共入参
if
(
scoreRule
.
getGetScoreOnce
()
<=
0
)
{
if
(
scoreRule
In
.
getGetScoreOnce
()
<=
0
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
}
}
if
(
scoreRule
.
getMaxScoreTotal
()
<=
0
)
{
if
(
scoreRule
In
.
getMaxScoreTotal
()
<=
0
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
}
}
if
(
scoreRule
.
getStartTime
().
after
((
scoreRule
.
getEndTime
()))
||
scoreRule
.
getEndTime
().
before
(
Date
.
from
(
Instant
.
now
())))
{
if
(
scoreRule
In
.
getStartTime
().
after
((
scoreRuleIn
.
getEndTime
()))
||
scoreRuleIn
.
getEndTime
().
before
(
Date
.
from
(
Instant
.
now
())))
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
}
}
if
(
scoreRule
.
getScorePeriod
()
<=
0
)
{
if
(
scoreRule
In
.
getScorePeriod
()
<=
0
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
}
}
//如果是启用,校验同一个规则下,有效期内有没有重复的规则设置,分享不校验
//如果是启用,校验同一个规则下,有效期内有没有重复的规则设置,分享不校验
。海运空运分开算
if
(
scoreRule
.
getStatus
()
==
ScoreRuleStatusEnum
.
ENABLED
.
getValue
()
&&
scoreRule
.
getType
()
!=
ScoreRuleTypeEnum
.
SHARE
.
getValue
())
{
if
(
scoreRule
In
.
getStatus
()
==
ScoreRuleStatusEnum
.
ENABLED
.
getValue
()
&&
scoreRuleIn
.
getType
()
!=
ScoreRuleTypeEnum
.
SHARE
.
getValue
())
{
LambdaQuery
<
ScoreRuleDO
>
scoreRuleDOLambdaQuery
=
new
LambdaQuery
<>();
LambdaQuery
<
ScoreRuleDO
>
scoreRuleDOLambdaQuery
=
new
LambdaQuery
<>();
scoreRuleDOLambdaQuery
.
eq
(
ScoreRuleDO:
:
getStatus
,
ScoreRuleStatusEnum
.
ENABLED
.
getValue
())
scoreRuleDOLambdaQuery
.
eq
(
ScoreRuleDO:
:
getStatus
,
ScoreRuleStatusEnum
.
ENABLED
.
getValue
())
.
eq
(
ScoreRuleDO:
:
getType
,
scoreRule
.
getType
())
.
eq
(
ScoreRuleDO:
:
getType
,
scoreRuleIn
.
getType
());
.
eq
(
ScoreRuleDO:
:
getStatus
,
ScoreRuleStatusEnum
.
ENABLED
.
getValue
());
if
(
scoreRuleIn
.
getType
()
==
ScoreRuleTypeEnum
.
ORDER_V
.
getValue
())
{
Long
count
=
scoreRuleMapper
.
selectCount
(
scoreRuleDOLambdaQuery
);
ScoreRuleOrderVExtraVO
extraOrderV
=
scoreRuleIn
.
getExtraOrderV
();
if
(
count
>
0
)
{
if
(
extraOrderV
==
null
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
}
Integer
transportType
=
extraOrderV
.
getTransportType
();
if
(
transportType
!=
TransportType
.
OCEAN_LCL
.
getValue
()
&&
transportType
!=
TransportType
.
SPECIAL_LINE_AIR_FREIGHT
.
getValue
())
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
}
List
<
ScoreRuleDO
>
scoreRuleDOS
=
scoreRuleMapper
.
selectList
(
scoreRuleDOLambdaQuery
);
if
(
scoreRuleDOS
!=
null
&&
!
scoreRuleDOS
.
isEmpty
())
{
for
(
ScoreRuleDO
scoreRuleDO
:
scoreRuleDOS
)
{
ScoreRuleOrderVExtraVO
bean
=
JSONUtil
.
toBean
(
scoreRuleDO
.
getExtra
(),
ScoreRuleOrderVExtraVO
.
class
);
if
(
Objects
.
equals
(
bean
.
getTransportType
(),
transportType
))
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
}
}
}
}
else
{
Long
count
=
scoreRuleMapper
.
selectCount
(
scoreRuleDOLambdaQuery
);
if
(
count
>
0
)
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
}
}
}
}
}
}
}
...
@@ -93,7 +112,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -93,7 +112,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
throw
exception
(
SCORE_RULE_UPDATE_ERROR
);
throw
exception
(
SCORE_RULE_UPDATE_ERROR
);
}
}
ScoreRuleDO
scoreRule
=
ScoreRuleConvert
.
INSTANCE
.
convert
(
updateReqVO
);
ScoreRuleDO
scoreRule
=
ScoreRuleConvert
.
INSTANCE
.
convert
(
updateReqVO
);
verifyCommon
(
scoreRule
);
verifyCommon
(
updateReqVO
);
verifyAndSetExtraDO
(
updateReqVO
,
updateReqVO
.
getType
(),
scoreRule
);
verifyAndSetExtraDO
(
updateReqVO
,
updateReqVO
.
getType
(),
scoreRule
);
// 更新
// 更新
scoreRuleMapper
.
updateById
(
scoreRule
);
scoreRuleMapper
.
updateById
(
scoreRule
);
...
@@ -115,7 +134,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -115,7 +134,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
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
);
}
}
if
(
extraOrderV
.
getTransportType
()
!=
TransportType
.
OCEAN_LCL
.
getValue
()
&&
extraOrderV
.
get
FirstOrder
()
!=
TransportType
.
SPECIAL_LINE_AIR_FREIGHT
.
getValue
())
{
if
(
extraOrderV
.
getTransportType
()
!=
TransportType
.
OCEAN_LCL
.
getValue
()
&&
extraOrderV
.
get
TransportType
()
!=
TransportType
.
SPECIAL_LINE_AIR_FREIGHT
.
getValue
())
{
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
throw
exception
(
SCORE_RULE_FIELD_ERROR
);
}
}
if
(
StringUtils
.
isAnyBlank
(
extraOrderV
.
getTargetCountry
(),
extraOrderV
.
getTargetCity
(),
extraOrderV
.
getReceiveAddr
(),
extraOrderV
.
getOrderEntry
()))
{
if
(
StringUtils
.
isAnyBlank
(
extraOrderV
.
getTargetCountry
(),
extraOrderV
.
getTargetCity
(),
extraOrderV
.
getReceiveAddr
(),
extraOrderV
.
getOrderEntry
()))
{
...
@@ -208,15 +227,13 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
...
@@ -208,15 +227,13 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
@Override
@Override
public
List
<
ScoreRuleBackVO
>
getScoreRuleList
(
Collection
<
Long
>
ids
)
{
public
List
<
ScoreRuleBackVO
>
getScoreRuleList
(
Collection
<
Long
>
ids
)
{
List
<
ScoreRuleDO
>
scoreRuleDOS
=
scoreRuleMapper
.
selectBatchIds
(
ids
);
List
<
ScoreRuleDO
>
scoreRuleDOS
=
scoreRuleMapper
.
selectBatchIds
(
ids
);
List
<
ScoreRuleBackVO
>
scoreRuleBackVOS
=
ScoreRuleConvert
.
INSTANCE
.
convertList
(
scoreRuleDOS
);
return
ScoreRuleConvert
.
INSTANCE
.
convertList
(
scoreRuleDOS
);
return
scoreRuleBackVOS
;
}
}
@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
<
ScoreRuleBackVO
>
scoreRuleBackVOPageResult
=
ScoreRuleConvert
.
INSTANCE
.
convertPage
(
pageResult
);
return
ScoreRuleConvert
.
INSTANCE
.
convertPage
(
pageResult
);
return
scoreRuleBackVOPageResult
;
}
}
/**
/**
...
...
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