Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f28bb7de
authored
Jul 26, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实现获取区块列表
1 parent
40795dcb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
2 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessBlockServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessBlockServiceImpl.java
View file @
f28bb7d
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.common.ListUtils
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.dao.MapBlockInfoMPDao
;
import
com.dituhui.pea.order.dao.OrgGroupMPDao
;
import
com.dituhui.pea.order.dao.OrgTeamMPDao
;
import
com.dituhui.pea.order.dto.BusinessServerBlocksRespDTO
;
import
com.dituhui.pea.order.entity.MapBlockInfo
;
import
com.dituhui.pea.order.entity.OrgGroup
;
import
com.dituhui.pea.order.entity.OrgTeam
;
import
com.dituhui.pea.order.service.BusinessBlockService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Slf4j
@Service
public
class
BusinessBlockServiceImpl
implements
BusinessBlockService
{
@Autowired
private
OrgTeamMPDao
orgTeamMPDao
;
@Autowired
private
MapBlockInfoMPDao
mapBlockInfoMPDao
;
@Autowired
private
OrgGroupMPDao
orgGroupMPDao
;
@Override
public
Result
<?>
businessServerBlocks
(
String
levelType
,
String
levelValue
,
int
page
,
int
size
,
String
layerId
,
String
teamId
)
{
BusinessServerBlocksRespDTO
resp
=
new
BusinessServerBlocksRespDTO
();
LambdaQueryWrapper
<
OrgTeam
>
lqwTeam
=
new
LambdaQueryWrapper
<>();
lqwTeam
.
eq
(
levelType
.
equals
(
"cluster"
),
OrgTeam:
:
getClusterId
,
levelValue
);
lqwTeam
.
eq
(
levelType
.
equals
(
"branch"
),
OrgTeam:
:
getBranchId
,
levelValue
);
lqwTeam
.
eq
(
levelType
.
equals
(
"group"
),
OrgTeam:
:
getGroupId
,
levelValue
);
lqwTeam
.
eq
(
StringUtils
.
isNotEmpty
(
teamId
),
OrgTeam:
:
getTeamId
,
teamId
);
List
<
OrgTeam
>
teams
=
orgTeamMPDao
.
selectList
(
lqwTeam
);
if
(
ListUtils
.
isEmpty
(
teams
))
{
resp
.
setTotal
(
0
);
resp
.
setPages
(
1
);
resp
.
setPageCurrent
(
1
);
resp
.
setPageSize
(
size
);
resp
.
setTip
(
""
);
resp
.
setContent
(
new
ArrayList
<>());
return
Result
.
success
(
null
);
}
// 获得teamId与team的映射
Map
<
String
,
OrgTeam
>
teamMapping
=
new
HashMap
<>();
for
(
OrgTeam
t:
teams
){
teamMapping
.
put
(
t
.
getTeamId
(),
t
);
}
// teamId列表
List
<
String
>
teamIds
=
teams
.
stream
().
map
(
OrgTeam:
:
getTeamId
).
collect
(
Collectors
.
toList
());
// 获取groupId集合
Set
<
String
>
groupIds
=
teams
.
stream
().
map
(
OrgTeam:
:
getGroupId
).
collect
(
Collectors
.
toSet
());
List
<
OrgGroup
>
groups
=
orgGroupMPDao
.
selectByGroupIds
(
new
ArrayList
<>(
groupIds
));
Map
<
String
,
String
>
groupMapping
=
groups
.
stream
().
collect
(
Collectors
.
toMap
(
OrgGroup:
:
getGroupId
,
OrgGroup:
:
getGroupName
));
Page
<
MapBlockInfo
>
pg
=
new
Page
<>(
page
,
size
);
LambdaQueryWrapper
<
MapBlockInfo
>
lqwBlock
=
new
LambdaQueryWrapper
<>();
lqwBlock
.
in
(
MapBlockInfo:
:
getTeamId
,
teamIds
);
lqwBlock
.
eq
(
StringUtils
.
isNotEmpty
(
layerId
),
MapBlockInfo:
:
getLayerId
,
layerId
);
lqwBlock
.
orderByAsc
(
MapBlockInfo:
:
getTeamId
);
mapBlockInfoMPDao
.
selectPage
(
pg
,
lqwBlock
);
List
<
BusinessServerBlocksRespDTO
.
Block
>
blocks
=
new
ArrayList
<>();
for
(
MapBlockInfo
b:
pg
.
getRecords
()){
BusinessServerBlocksRespDTO
.
Block
block
=
new
BusinessServerBlocksRespDTO
.
Block
();
OrgTeam
team
=
teamMapping
.
get
(
b
.
getTeamId
());
String
groupId
=
team
.
getGroupId
();
String
groupName
=
groupMapping
.
get
(
groupId
);
block
.
setId
(
b
.
getBlockId
());
block
.
setGroupId
(
groupId
);
block
.
setGroupName
(
groupName
);
block
.
setLayerId
(
b
.
getLayerId
());
block
.
setLayerName
(
b
.
getLayer
());
block
.
setTeamId
(
b
.
getTeamId
());
block
.
setTeamName
(
team
.
getTeamName
());
block
.
setArea
(
b
.
getArea
().
toString
());
block
.
setUpdateTime
(
TimeUtils
.
IsoLocalDateTime2String
(
b
.
getUpdateTime
()));
blocks
.
add
(
block
);
}
resp
.
setTotal
(
pg
.
getTotal
());
resp
.
setPages
(
pg
.
getPages
());
resp
.
setPageCurrent
(
pg
.
getCurrent
());
resp
.
setPageSize
(
pg
.
getSize
());
resp
.
setTip
(
""
);
resp
.
setContent
(
blocks
);
return
null
;
}
...
...
@@ -19,12 +112,12 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
}
@Override
public
Result
<?>
businessServiceBlockDelete
(
String
i
d
)
{
public
Result
<?>
businessServiceBlockDelete
(
String
blockI
d
)
{
return
null
;
}
@Override
public
Result
<?>
saasBaseDataLayerUrl
(
String
i
d
)
{
public
Result
<?>
saasBaseDataLayerUrl
(
String
blockI
d
)
{
return
null
;
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment