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 fa1eaee7
authored
Jul 27, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增获取图层列表接口
1 parent
13c90b45
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
24 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/BusinessBlockController.java
project-order/src/main/java/com/dituhui/pea/order/service/BusinessBlockService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessBlockServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/controller/BusinessBlockController.java
View file @
fa1eaee
...
...
@@ -30,15 +30,16 @@ public class BusinessBlockController {
@RequestParam
long
page
,
@RequestParam
long
size
,
@RequestParam
(
required
=
false
)
String
layerId
,
@RequestParam
(
required
=
false
)
String
teamId
)
{
Result
<?>
res
=
null
;
try
{
Result
<?>
res
=
null
;
try
{
res
=
businessBlockService
.
businessServerBlocks
(
levelType
,
levelValue
,
page
,
size
,
layerId
,
teamId
);
}
catch
(
BusinessException
e
){
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
}
/**
* 新增服务区块
*
...
...
@@ -50,9 +51,9 @@ public class BusinessBlockController {
public
Result
<?>
businessServiceBlockAdd
(
@RequestParam
String
layerId
,
@RequestParam
String
teamId
)
{
// 新增服务范围
Result
<?>
res
=
null
;
try
{
try
{
res
=
businessBlockService
.
businessServiceBlockAdd
(
layerId
,
teamId
);
}
catch
(
BusinessException
e
){
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
...
...
@@ -68,9 +69,9 @@ public class BusinessBlockController {
public
Result
<?>
businessServiceBlockRemove
(
@RequestParam
String
id
)
{
// 删除服务范围
Result
<?>
res
=
null
;
try
{
try
{
res
=
businessBlockService
.
businessServiceBlockRemove
(
id
);
}
catch
(
BusinessException
e
){
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
...
...
@@ -84,12 +85,32 @@ public class BusinessBlockController {
*/
@GetMapping
(
"/saas/baseData/layer/getUrl"
)
public
Result
<?>
saasBaseDataLayerUrl
(
@RequestParam
String
id
)
{
Result
<?>
res
=
null
;
try
{
Result
<?>
res
=
null
;
try
{
res
=
businessBlockService
.
saasBaseDataLayerUrl
(
id
);
}
catch
(
BusinessException
e
){
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
}
/**
* 获取图层列表
*
* @param levelType 组织层级类型
* @param levelValue 组织层级值
* @return
*/
@GetMapping
(
"/business/layer/list"
)
public
Result
<?>
businessSeverLayers
(
@RequestParam
String
levelType
,
@RequestParam
String
levelValue
)
{
Result
<?>
res
=
null
;
try
{
res
=
businessBlockService
.
businessServerLayers
(
levelType
,
levelValue
);
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
}
}
project-order/src/main/java/com/dituhui/pea/order/service/BusinessBlockService.java
View file @
fa1eaee
...
...
@@ -11,4 +11,6 @@ public interface BusinessBlockService {
Result
<?>
businessServiceBlockRemove
(
String
blockId
);
Result
<?>
saasBaseDataLayerUrl
(
String
blockId
);
Result
<?>
businessServerLayers
(
String
levelType
,
String
levelValue
);
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessBlockServiceImpl.java
View file @
fa1eaee
...
...
@@ -6,13 +6,9 @@ import com.dituhui.pea.common.BusinessException;
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.dao.*
;
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.entity.*
;
import
com.dituhui.pea.order.service.BusinessBlockService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -35,6 +31,12 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
@Autowired
private
OrgGroupMPDao
orgGroupMPDao
;
@Autowired
private
MapLayerMPDao
mapLayerMPDao
;
@Autowired
private
MapLayerCustomizeMPDao
mapLayerCustomizeMPDao
;
@Override
public
Result
<?>
businessServerBlocks
(
String
levelType
,
String
levelValue
,
long
page
,
long
size
,
String
layerId
,
String
teamId
)
{
BusinessServerBlocksRespDTO
resp
=
new
BusinessServerBlocksRespDTO
();
...
...
@@ -57,7 +59,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
// 获得teamId与team的映射
Map
<
String
,
OrgTeam
>
teamMapping
=
new
HashMap
<>();
for
(
OrgTeam
t:
teams
)
{
for
(
OrgTeam
t
:
teams
)
{
teamMapping
.
put
(
t
.
getTeamId
(),
t
);
}
...
...
@@ -78,7 +80,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
mapBlockInfoMPDao
.
selectPage
(
pg
,
lqwBlock
);
List
<
BusinessServerBlocksRespDTO
.
Block
>
blocks
=
new
ArrayList
<>();
for
(
MapBlockInfo
b:
pg
.
getRecords
())
{
for
(
MapBlockInfo
b
:
pg
.
getRecords
())
{
BusinessServerBlocksRespDTO
.
Block
block
=
new
BusinessServerBlocksRespDTO
.
Block
();
OrgTeam
team
=
teamMapping
.
get
(
b
.
getTeamId
());
...
...
@@ -109,14 +111,34 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
}
@Override
public
Result
<?>
businessServiceBlockAdd
(
String
layerId
,
String
teamId
)
{
return
null
;
public
Result
<?>
businessServiceBlockAdd
(
String
layerId
,
String
teamId
)
throws
BusinessException
{
MapLayerCustomize
layer
=
mapLayerCustomizeMPDao
.
getByLayerId
(
layerId
);
if
(
layer
==
null
)
{
throw
new
BusinessException
(
"图层标签不存在"
);
}
OrgTeam
team
=
orgTeamMPDao
.
getByTeamId
(
teamId
);
if
(
team
==
null
)
{
throw
new
BusinessException
(
"关联小队不存在"
);
}
MapBlockInfo
block
=
new
MapBlockInfo
();
block
.
setBlockId
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
block
.
setBlockName
(
team
.
getTeamName
());
//默认使用team name;
block
.
setBranchId
(
team
.
getBranchId
());
block
.
setGroupId
(
team
.
getGroupId
());
block
.
setTeamId
(
teamId
);
block
.
setLayer
(
layerId
);
block
.
setLayer
(
layer
.
getLayer
());
block
.
setStatus
(
1
);
mapBlockInfoMPDao
.
insert
(
block
);
return
Result
.
success
(
null
);
}
@Override
public
Result
<?>
businessServiceBlockRemove
(
String
blockId
)
throws
BusinessException
{
public
Result
<?>
businessServiceBlockRemove
(
String
blockId
)
throws
BusinessException
{
MapBlockInfo
block
=
mapBlockInfoMPDao
.
getByBlockId
(
blockId
);
if
(
block
==
null
)
{
if
(
block
==
null
)
{
throw
new
BusinessException
(
"区块不存在"
);
}
block
.
setStatus
(
0
);
...
...
@@ -125,9 +147,9 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
}
@Override
public
Result
<?>
saasBaseDataLayerUrl
(
String
blockId
)
throws
BusinessException
{
public
Result
<?>
saasBaseDataLayerUrl
(
String
blockId
)
throws
BusinessException
{
MapBlockInfo
block
=
mapBlockInfoMPDao
.
getByBlockId
(
blockId
);
if
(
block
==
null
)
{
if
(
block
==
null
)
{
throw
new
BusinessException
(
"区块不存在"
);
}
// 跳转规则: TODO
...
...
@@ -135,4 +157,40 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
res
.
put
(
"url"
,
"https://pea-test.bshg.com.cn/mlAutoLogin?userAccount=WVyjhzcOeIUc5rl74hdaqw==&password=qjOHxpQPXLnJP+Jq1CZGBQ==&jump=basedata&navHidden=true"
);
return
Result
.
success
(
res
);
}
@Override
public
Result
<?>
businessServerLayers
(
String
levelType
,
String
levelValue
)
{
List
<
Map
<
String
,
String
>>
items
=
new
ArrayList
<>();
// 获取通用图层
List
<
MapLayer
>
layers
=
mapLayerMPDao
.
selectList
(
null
);
for
(
MapLayer
r:
layers
){
Map
<
String
,
String
>
m
=
new
HashMap
<>();
m
.
put
(
"layerId"
,
r
.
getLayerId
());
m
.
put
(
"layerName"
,
r
.
getLayer
());
items
.
add
(
m
);
}
// 获取自定义图层(只有branch才能创建自定义图层)
LambdaQueryWrapper
<
OrgGroup
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
levelType
.
equals
(
"cluster"
),
OrgGroup:
:
getClusterId
,
levelValue
);
lqw
.
eq
(
levelType
.
equals
(
"branch"
),
OrgGroup:
:
getBranchId
,
levelValue
);
lqw
.
eq
(
levelType
.
equals
(
"group"
),
OrgGroup:
:
getGroupId
,
levelValue
);
Set
<
String
>
branchIds
=
orgGroupMPDao
.
selectList
(
lqw
).
stream
().
map
(
OrgGroup:
:
getBranchId
).
collect
(
Collectors
.
toSet
());
if
(
branchIds
.
isEmpty
())
{
return
Result
.
success
(
items
);
}
LambdaQueryWrapper
<
MapLayerCustomize
>
lqwLayer
=
new
LambdaQueryWrapper
<>();
lqwLayer
.
eq
(
MapLayerCustomize:
:
getDisabled
,
1
);
lqwLayer
.
in
(
MapLayerCustomize:
:
getBranchId
,
new
ArrayList
<>(
branchIds
));
List
<
MapLayerCustomize
>
layerCustomizes
=
mapLayerCustomizeMPDao
.
selectList
(
lqwLayer
);
for
(
MapLayerCustomize
r:
layerCustomizes
)
{
Map
<
String
,
String
>
m
=
new
HashMap
<>();
m
.
put
(
"layerId"
,
r
.
getLayerId
());
m
.
put
(
"layerName"
,
r
.
getLayer
());
items
.
add
(
m
);
}
return
Result
.
success
(
items
);
}
}
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