Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-new-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
device-new-platform
Commits
96e311f7
Commit
96e311f7
authored
Sep 20, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加区域点击
parent
a004c1eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
common-lib/src/main/java/com/mortals/xhx/feign/site/ISiteFeign.java
.../src/main/java/com/mortals/xhx/feign/site/ISiteFeign.java
+4
-4
device-manager/src/main/java/com/mortals/xhx/module/sitestat/service/impl/SitestatServiceImpl.java
...xhx/module/sitestat/service/impl/SitestatServiceImpl.java
+15
-10
No files found.
common-lib/src/main/java/com/mortals/xhx/feign/site/ISiteFeign.java
View file @
96e311f7
...
...
@@ -85,8 +85,8 @@ public interface ISiteFeign extends IFeign {
* @param sitePdu
* @return
*/
@PostMapping
(
value
=
"/site/getFlatSitesByAreaIds"
,
headers
=
{
"Content-Type=application/json;charset=UTF-8"
}
)
Rest
<
List
<
SitePdu
>>
getFlatSitesByAreaIds
(
@RequestBody
SitePdu
sitePdu
);
@PostMapping
(
value
=
"/site/getFlatSitesByAreaIds"
)
String
getFlatSitesByAreaIds
(
@RequestBody
SitePdu
sitePdu
);
...
...
@@ -131,8 +131,8 @@ class SiteFeignFallbackFactory implements FallbackFactory<ISiteFeign> {
}
@Override
public
Rest
<
List
<
SitePdu
>>
getFlatSitesByAreaIds
(
SitePdu
sitePdu
)
{
return
Rest
.
fail
(
"暂时无法获取站点子站点,请稍后再试!"
);
public
String
getFlatSitesByAreaIds
(
SitePdu
sitePdu
)
{
return
JSON
.
toJSONString
(
Rest
.
fail
(
"暂时无法获取站点子站点,请稍后再试!"
)
);
}
};
}
...
...
device-manager/src/main/java/com/mortals/xhx/module/sitestat/service/impl/SitestatServiceImpl.java
View file @
96e311f7
...
...
@@ -2,6 +2,7 @@ package com.mortals.xhx.module.sitestat.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
...
...
@@ -70,7 +71,7 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si
public
Result
<
SitestatEntity
>
find
(
SitestatEntity
entity
,
PageInfo
pageInfo
,
Context
context
)
throws
AppException
{
Result
<
SitestatEntity
>
res
=
new
Result
<>();
//根据站点查询所以站点子集列表
Result
<
SitestatEntity
>
sitestatsAreaResult
=
getSitestatEntityResultByArea
(
entity
,
pageInfo
,
context
,
res
);
Result
<
SitestatEntity
>
sitestatsAreaResult
=
getSitestatEntityResultByArea
(
entity
,
pageInfo
,
context
,
res
);
if
(
sitestatsAreaResult
!=
null
)
return
sitestatsAreaResult
;
Result
<
SitestatEntity
>
sitestatsResult
=
getSitestatsResult
(
entity
,
pageInfo
,
res
);
...
...
@@ -85,7 +86,7 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si
if
(
ObjectUtils
.
isEmpty
(
entity
.
getSiteId
()))
return
null
;
if
(
platFormType
.
equalsIgnoreCase
(
PlatformTypeEnum
.
STANDALONE
.
getValue
()))
{
//根据返回的id 筛选列表
Map
<
Long
,
SitestatEntity
>
collectMap
=
this
.
find
(
new
SitestatEntity
(),
context
).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getSiteId
(),
y
->
y
,(
o
,
n
)->
n
));
Map
<
Long
,
SitestatEntity
>
collectMap
=
this
.
find
(
new
SitestatEntity
(),
context
).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getSiteId
(),
y
->
y
,
(
o
,
n
)
->
n
));
List
<
SitestatEntity
>
list
=
this
.
siteService
.
find
(
new
SiteQuery
().
id
(
entity
.
getSiteId
())).
stream
().
filter
(
f
->
collectMap
.
containsKey
(
f
.
getId
())).
map
(
m
->
collectMap
.
get
(
m
.
getId
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getSiteName
()))
{
list
=
MemoryPagination
.
search
(
entity
.
getSiteName
(),
list
);
...
...
@@ -98,15 +99,15 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si
SitePdu
sitePdu
=
new
SitePdu
();
sitePdu
.
setId
(
entity
.
getSiteId
());
Rest
<
List
<
SitePdu
>>
result
=
siteFeign
.
getFlatSitesBySiteId
(
sitePdu
);
// log.info("siteList:{}",JSON.toJSONString(result));
// log.info("siteList:{}",JSON.toJSONString(result));
if
(
result
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
//根据返回的id 筛选列表
Map
<
Long
,
SitestatEntity
>
collectMap
=
this
.
find
(
new
SitestatEntity
(),
context
).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getSiteId
(),
y
->
y
,(
o
,
n
)->
n
));
Map
<
Long
,
SitestatEntity
>
collectMap
=
this
.
find
(
new
SitestatEntity
(),
context
).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getSiteId
(),
y
->
y
,
(
o
,
n
)
->
n
));
List
<
SitestatEntity
>
list
=
result
.
getData
().
stream
().
filter
(
f
->
collectMap
.
containsKey
(
f
.
getId
())).
map
(
m
->
collectMap
.
get
(
m
.
getId
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getSiteName
()))
{
list
=
MemoryPagination
.
search
(
entity
.
getSiteName
(),
list
);
}
// log.info("siteStatList:{}",JSON.toJSONString(list));
// log.info("siteStatList:{}",JSON.toJSONString(list));
pageInfo
.
setTotalResult
(
list
.
size
());
List
<
SitestatEntity
>
siteStatList
=
MemoryPagination
.
pagination
(
list
,
pageInfo
.
getCurrPage
(),
pageInfo
.
getPrePageResult
());
res
.
setList
(
siteStatList
);
...
...
@@ -185,7 +186,7 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si
if
(
ObjectUtils
.
isEmpty
(
entity
.
getAreaCode
()))
return
null
;
if
(
platFormType
.
equalsIgnoreCase
(
PlatformTypeEnum
.
STANDALONE
.
getValue
()))
{
//根据返回的id 筛选列表 todo
Map
<
Long
,
SitestatEntity
>
collectMap
=
this
.
find
(
new
SitestatEntity
(),
context
).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getSiteId
(),
y
->
y
,(
o
,
n
)->
n
));
Map
<
Long
,
SitestatEntity
>
collectMap
=
this
.
find
(
new
SitestatEntity
(),
context
).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getSiteId
(),
y
->
y
,
(
o
,
n
)
->
n
));
List
<
SitestatEntity
>
list
=
this
.
siteService
.
find
(
new
SiteQuery
().
id
(
entity
.
getSiteId
())).
stream
().
filter
(
f
->
collectMap
.
containsKey
(
f
.
getId
())).
map
(
m
->
collectMap
.
get
(
m
.
getId
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getSiteName
()))
{
list
=
MemoryPagination
.
search
(
entity
.
getSiteName
(),
list
);
...
...
@@ -199,16 +200,20 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si
List
<
String
>
areaCodeList
=
new
ArrayList
<>();
areaCodeList
.
add
(
entity
.
getAreaCode
());
sitePdu
.
setAreaCodeList
(
areaCodeList
);
Rest
<
List
<
SitePdu
>>
result
=
siteFeign
.
getFlatSitesByAreaIds
(
sitePdu
);
log
.
info
(
"areaSiteList:{}"
,
JSON
.
toJSONString
(
result
));
String
resp
=
siteFeign
.
getFlatSitesByAreaIds
(
sitePdu
);
log
.
info
(
"areaSiteList:{}"
,
JSON
.
toJSONString
(
resp
));
Rest
<
List
<
SitePdu
>>
result
=
JSON
.
parseObject
(
resp
,
new
TypeReference
<
Rest
<
List
<
SitePdu
>>>()
{
});
if
(
result
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
//根据返回的id 筛选列表
Map
<
Long
,
SitestatEntity
>
collectMap
=
this
.
find
(
new
SitestatEntity
(),
context
).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getSiteId
(),
y
->
y
,(
o
,
n
)->
n
));
Map
<
Long
,
SitestatEntity
>
collectMap
=
this
.
find
(
new
SitestatEntity
(),
context
).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getSiteId
(),
y
->
y
,
(
o
,
n
)
->
n
));
List
<
SitestatEntity
>
list
=
result
.
getData
().
stream
().
filter
(
f
->
collectMap
.
containsKey
(
f
.
getId
())).
map
(
m
->
collectMap
.
get
(
m
.
getId
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getSiteName
()))
{
list
=
MemoryPagination
.
search
(
entity
.
getSiteName
(),
list
);
}
// log.info("siteStatList:{}",JSON.toJSONString(list));
// log.info("siteStatList:{}",JSON.toJSONString(list));
pageInfo
.
setTotalResult
(
list
.
size
());
List
<
SitestatEntity
>
siteStatList
=
MemoryPagination
.
pagination
(
list
,
pageInfo
.
getCurrPage
(),
pageInfo
.
getPrePageResult
());
res
.
setList
(
siteStatList
);
...
...
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