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
7ac47779
Commit
7ac47779
authored
Aug 12, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
仓库树状列表获取优化
parent
3d4559a6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
35 deletions
+35
-35
ScoreRuleServiceImpl.java
...module/member/service/scoreRule/ScoreRuleServiceImpl.java
+35
-35
No files found.
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/scoreRule/ScoreRuleServiceImpl.java
View file @
7ac47779
...
...
@@ -37,6 +37,7 @@ import org.springframework.validation.annotation.Validated;
import
javax.annotation.Resource
;
import
java.time.Instant
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
module
.
member
.
enums
.
ErrorCodeConstants
.*;
...
...
@@ -450,42 +451,41 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
@Override
public
List
<
WarehouseTreeRegionSimpleVO
>
getWarehouseTreeRegionListSimple
()
{
List
<
WarehouseTreeRegionVO
>
listIn
=
warehouseService
.
getWarehouseTreeRegionList
(
1
);
List
<
WarehouseTreeRegionVO
>
listOut
=
warehouseService
.
getWarehouseTreeRegionList
(
2
);
List
<
WarehouseTreeRegionVO
>
list
=
ListUtils
.
sum
(
listIn
,
listOut
);
ArrayList
<
WarehouseTreeRegionSimpleVO
>
warehouseTreeRegionSimpleVOS
=
new
ArrayList
<>();
for
(
WarehouseTreeRegionVO
warehouseTreeRegionVO
:
list
)
{
WarehouseTreeRegionSimpleVO
warehouseTreeRegionSimpleVO
=
new
WarehouseTreeRegionSimpleVO
();
warehouseTreeRegionSimpleVO
.
setId
(
warehouseTreeRegionVO
.
getGuojia
());
warehouseTreeRegionSimpleVO
.
setLabelZh
(
warehouseTreeRegionVO
.
getGuojiaName
().
replaceAll
(
"\t"
,
""
));
warehouseTreeRegionSimpleVO
.
setLabelEn
(
warehouseTreeRegionVO
.
getChildren
().
get
(
0
).
getGuojiaNameEn
());
ArrayList
<
WarehouseTreeRegionSimpleVO
.
WarehouseCity
>
warehouseCitiesSimple
=
new
ArrayList
<>();
for
(
WarehouseTreeRegionVO
warehouseTreeRegionVOChild
:
warehouseTreeRegionVO
.
getChildren
())
{
WarehouseTreeRegionSimpleVO
.
WarehouseCity
warehouseCity
=
new
WarehouseTreeRegionSimpleVO
.
WarehouseCity
();
warehouseCity
.
setId
(
warehouseTreeRegionVOChild
.
getShi
());
warehouseCity
.
setLabelZh
(
warehouseTreeRegionVOChild
.
getShiName
().
replaceAll
(
"\t"
,
""
));
warehouseCity
.
setLabelEn
(
warehouseTreeRegionVOChild
.
getShiNameEn
());
if
(
warehouseCitiesSimple
.
contains
(
warehouseCity
))
{
WarehouseTreeRegionSimpleVO
.
Warehouse
warehouse
=
new
WarehouseTreeRegionSimpleVO
.
Warehouse
();
warehouse
.
setId
(
warehouseTreeRegionVOChild
.
getId
());
warehouse
.
setLabelZh
(
warehouseTreeRegionVOChild
.
getTitleZh
());
warehouse
.
setLabelEn
(
warehouseTreeRegionVOChild
.
getTitleEn
());
warehouseCitiesSimple
.
get
(
warehouseCitiesSimple
.
indexOf
(
warehouseCity
)).
getChildren
().
add
(
warehouse
);
continue
;
}
ArrayList
<
WarehouseTreeRegionSimpleVO
.
Warehouse
>
warehouseSimples
=
new
ArrayList
<>();
List
<
WarehouseTreeRegionVO
>
list
=
ListUtils
.
sum
(
warehouseService
.
getWarehouseTreeRegionList
(
1
),
warehouseService
.
getWarehouseTreeRegionList
(
2
)
);
return
list
.
stream
().
map
(
this
::
convertToSimpleVO
).
collect
(
Collectors
.
toList
());
}
private
WarehouseTreeRegionSimpleVO
convertToSimpleVO
(
WarehouseTreeRegionVO
regionVO
)
{
WarehouseTreeRegionSimpleVO
simpleVO
=
new
WarehouseTreeRegionSimpleVO
();
simpleVO
.
setId
(
regionVO
.
getGuojia
());
simpleVO
.
setLabelZh
(
regionVO
.
getGuojiaName
().
trim
());
simpleVO
.
setLabelEn
(
regionVO
.
getChildren
().
isEmpty
()
?
""
:
regionVO
.
getChildren
().
get
(
0
).
getGuojiaNameEn
());
// 构建城市和仓库的树状结构
Map
<
Long
,
WarehouseTreeRegionSimpleVO
.
WarehouseCity
>
cityMap
=
new
LinkedHashMap
<>();
for
(
WarehouseTreeRegionVO
child
:
regionVO
.
getChildren
())
{
WarehouseTreeRegionSimpleVO
.
WarehouseCity
city
=
cityMap
.
computeIfAbsent
(
child
.
getShi
(),
key
->
{
WarehouseTreeRegionSimpleVO
.
WarehouseCity
newCity
=
new
WarehouseTreeRegionSimpleVO
.
WarehouseCity
();
newCity
.
setId
(
child
.
getShi
());
newCity
.
setLabelZh
(
child
.
getShiName
().
trim
());
newCity
.
setLabelEn
(
child
.
getShiNameEn
());
newCity
.
setChildren
(
new
ArrayList
<>());
return
newCity
;
});
WarehouseTreeRegionSimpleVO
.
Warehouse
warehouse
=
new
WarehouseTreeRegionSimpleVO
.
Warehouse
();
warehouse
.
setId
(
warehouseTreeRegionVOChild
.
getId
());
warehouse
.
setLabelZh
(
warehouseTreeRegionVOChild
.
getTitleZh
().
replaceAll
(
"\t"
,
""
));
warehouse
.
setLabelEn
(
warehouseTreeRegionVOChild
.
getTitleEn
());
warehouseSimples
.
add
(
warehouse
);
warehouseCity
.
setChildren
(
warehouseSimples
);
warehouseCitiesSimple
.
add
(
warehouseCity
);
warehouse
.
setId
(
child
.
getId
());
warehouse
.
setLabelZh
(
child
.
getTitleZh
().
trim
());
warehouse
.
setLabelEn
(
child
.
getTitleEn
());
city
.
getChildren
().
add
(
warehouse
);
}
warehouseTreeRegionSimpleVO
.
setChildren
(
warehouseCitiesSimple
);
warehouseTreeRegionSimpleVOS
.
add
(
warehouseTreeRegionSimpleVO
);
}
return
warehouseTreeRegionSimpleVOS
;
simpleVO
.
setChildren
(
new
ArrayList
<>(
cityMap
.
values
()));
return
simpleVO
;
}
@Override
...
...
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