Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
c046251c
Commit
c046251c
authored
Jul 22, 2024
by
lilongyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、全域、片区健康状态指数接口优化,不存在的数据补全
parent
fe0ce735
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
47 deletions
+64
-47
TDBigScreenAnalyseController.java
...le/jxiop/biz/controller/TDBigScreenAnalyseController.java
+64
-47
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/TDBigScreenAnalyseController.java
View file @
c046251c
...
@@ -17,7 +17,9 @@ import java.util.List;
...
@@ -17,7 +17,9 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.function.Predicate
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -457,58 +459,29 @@ public class TDBigScreenAnalyseController extends BaseController {
...
@@ -457,58 +459,29 @@ public class TDBigScreenAnalyseController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"
片区、场站设备健康状态指数 "
,
notes
=
"片区、场站
设备健康状态指数 "
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"
全域片区设备健康状态指数 "
,
notes
=
"全域片区
设备健康状态指数 "
)
@GetMapping
(
value
=
"/getHealthInfoByMinute"
)
@GetMapping
(
value
=
"/get
Area
HealthInfoByMinute"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getHealthInfoBy
Minute
(
@RequestParam
(
required
=
false
)
String
areaCode
)
{
public
ResponseModel
<
Map
<
String
,
Object
>>
getHealthInfoBy
AreaAndMinute
(
)
{
LambdaQueryWrapper
<
FanHealthIndex
>
wrapper
=
new
LambdaQueryWrapper
<
FanHealthIndex
>();
LambdaQueryWrapper
<
FanHealthIndex
>
wrapper
=
new
LambdaQueryWrapper
<
FanHealthIndex
>();
wrapper
.
orderByDesc
(
FanHealthIndex:
:
getTs
);
wrapper
.
orderByDesc
(
FanHealthIndex:
:
getTs
);
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisType
,
"按10分钟"
);
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisType
,
"按10分钟"
);
if
(
CharSequenceUtil
.
isNotEmpty
(
areaCode
))
{
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisObjType
,
"片区"
);
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisObjType
,
"场站"
);
wrapper
.
like
(
FanHealthIndex:
:
getArea
,
"%"
+
areaCode
+
"%"
);
}
else
{
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisObjType
,
"片区"
);
}
List
<
Object
>
seriesData
=
new
ArrayList
<>();
List
<
String
>
axisData
=
new
ArrayList
<>();
List
<
FanHealthIndex
>
fanHealthIndexList
=
fanHealthIndexMapper
.
selectList
(
wrapper
);
List
<
FanHealthIndex
>
fanHealthIndexList
=
fanHealthIndexMapper
.
selectList
(
wrapper
);
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
if
(
CharSequenceUtil
.
isNotEmpty
(
areaCode
))
{
Map
<
String
,
List
<
FanHealthIndex
>>
groupedData
=
fanHealthIndexList
.
stream
()
Map
<
String
,
Map
<
String
,
List
<
FanHealthIndex
>>>
groupedData
=
fanHealthIndexList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
FanHealthIndex:
:
getArea
));
.
collect
(
Collectors
.
groupingBy
(
FanHealthIndex:
:
getArea
,
Collectors
.
groupingBy
(
FanHealthIndex:
:
getStation
)));
Map
<
String
,
FanHealthIndex
>
latestData
=
groupedData
.
values
().
stream
().
map
(
list
->
list
.
stream
()
Map
<
String
,
Map
<
String
,
FanHealthIndex
>>
latestData
=
groupedData
.
entrySet
().
stream
()
.
max
(
Comparator
.
comparing
(
FanHealthIndex:
:
getTs
))
.
collect
(
Collectors
.
toMap
(
.
get
()).
collect
(
Collectors
.
toMap
(
FanHealthIndex:
:
getArea
,
Function
.
identity
()));
Map
.
Entry
::
getKey
,
List
<
String
>
axisData
=
latestData
.
values
().
stream
().
map
(
t
->
t
.
getArea
()).
collect
(
Collectors
.
toList
());
e
->
e
.
getValue
().
values
().
stream
()
List
<
String
>
list
=
Arrays
.
asList
(
"华北区域"
,
"东北区域"
,
"华东区域"
,
"华南区域"
,
"西南区域"
,
"西北区域"
,
"华中区域"
);
.
map
(
list
->
list
.
stream
()
List
<
String
>
finalList
=
Stream
.
concat
(
axisData
.
stream
(),
list
.
stream
()).
distinct
().
collect
(
Collectors
.
toList
());
.
max
(
Comparator
.
comparing
(
FanHealthIndex:
:
getTs
))
List
<
Object
>
seriesData
=
new
ArrayList
<>();
.
get
())
latestData
.
values
().
forEach
(
item
->
{
.
collect
(
Collectors
.
toMap
(
FanHealthIndex:
:
getStation
,
Function
.
identity
()))
Predicate
<
String
>
condition
=
finalList:
:
contains
;
));
seriesData
.
add
(
condition
.
test
(
item
.
getArea
())
?
String
.
valueOf
(
BigDecimal
.
valueOf
(
item
.
getHealthIndex
()))
:
"100.0"
);
List
<
Object
>
finalSeriesData
=
new
ArrayList
<>();
});
List
<
String
>
finalAxisData
=
new
ArrayList
<>();
resultMap
.
put
(
"axisData"
,
finalList
);
latestData
.
values
().
forEach
(
s
->
{
s
.
forEach
((
k
,
v
)
->
{
finalSeriesData
.
add
(
v
.
getHealthIndex
());
finalAxisData
.
add
(
v
.
getStation
());
});
});
seriesData
.
addAll
(
finalSeriesData
);
axisData
.
addAll
(
finalAxisData
);
}
else
{
Map
<
String
,
List
<
FanHealthIndex
>>
groupedData
=
fanHealthIndexList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
FanHealthIndex:
:
getArea
));
Map
<
String
,
FanHealthIndex
>
latestData
=
groupedData
.
values
().
stream
().
map
(
list
->
list
.
stream
()
.
max
(
Comparator
.
comparing
(
FanHealthIndex:
:
getTs
))
.
get
())
.
collect
(
Collectors
.
toMap
(
FanHealthIndex:
:
getArea
,
Function
.
identity
()));
seriesData
=
latestData
.
values
().
stream
().
map
(
t
->
String
.
valueOf
(
BigDecimal
.
valueOf
(
t
.
getHealthIndex
())
.
setScale
(
1
,
BigDecimal
.
ROUND_HALF_UP
))).
collect
(
Collectors
.
toList
());
axisData
=
latestData
.
values
().
stream
().
map
(
t
->
t
.
getArea
()).
collect
(
Collectors
.
toList
());
}
resultMap
.
put
(
"axisData"
,
axisData
);
resultMap
.
put
(
"seriesData"
,
seriesData
);
resultMap
.
put
(
"seriesData"
,
seriesData
);
return
ResponseHelper
.
buildResponse
(
resultMap
);
return
ResponseHelper
.
buildResponse
(
resultMap
);
}
}
...
@@ -516,6 +489,50 @@ public class TDBigScreenAnalyseController extends BaseController {
...
@@ -516,6 +489,50 @@ public class TDBigScreenAnalyseController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"片区场站设备健康状态指数 "
,
notes
=
"片区场站设备健康状态指数 "
)
@GetMapping
(
value
=
"/getStationHealthInfoByMinute"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getHealthInfoByStationAndMinute
(
@RequestParam
(
required
=
false
)
String
areaCode
)
{
LambdaQueryWrapper
<
FanHealthIndex
>
wrapper
=
new
LambdaQueryWrapper
<
FanHealthIndex
>();
wrapper
.
orderByDesc
(
FanHealthIndex:
:
getTs
);
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisType
,
"按10分钟"
);
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisObjType
,
"场站"
);
wrapper
.
like
(
FanHealthIndex:
:
getArea
,
"%"
+
areaCode
+
"%"
);
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
List
<
FanHealthIndex
>
fanHealthIndexList
=
fanHealthIndexMapper
.
selectList
(
wrapper
);
LambdaQueryWrapper
<
PvHealthIndex
>
pvWrapper
=
new
LambdaQueryWrapper
<
PvHealthIndex
>();
pvWrapper
.
orderByDesc
(
PvHealthIndex:
:
getTs
);
pvWrapper
.
eq
(
PvHealthIndex:
:
getAnalysisType
,
"按10分钟"
);
pvWrapper
.
eq
(
PvHealthIndex:
:
getAnalysisObjType
,
"场站"
);
pvWrapper
.
like
(
PvHealthIndex:
:
getArea
,
"%"
+
areaCode
+
"%"
);
List
<
PvHealthIndex
>
pvHealthIndexList
=
pvHealthIndexMapper
.
selectList
(
pvWrapper
);
Map
<
String
,
List
<
FanHealthIndex
>>
fanHealthGroupedData
=
fanHealthIndexList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
FanHealthIndex:
:
getArea
));
Map
<
String
,
FanHealthIndex
>
fanHealthLatestData
=
fanHealthGroupedData
.
values
().
stream
().
map
(
list
->
list
.
stream
()
.
max
(
Comparator
.
comparing
(
FanHealthIndex:
:
getTs
))
.
get
()).
collect
(
Collectors
.
toMap
(
FanHealthIndex:
:
getArea
,
Function
.
identity
()));
Map
<
String
,
List
<
PvHealthIndex
>>
pvHealthGroupedData
=
pvHealthIndexList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
PvHealthIndex:
:
getStation
));
Map
<
String
,
PvHealthIndex
>
pvHealthLatestData
=
pvHealthGroupedData
.
values
().
stream
().
map
(
list
->
list
.
stream
()
.
max
(
Comparator
.
comparing
(
PvHealthIndex:
:
getTs
))
.
get
()).
collect
(
Collectors
.
toMap
(
PvHealthIndex:
:
getStation
,
Function
.
identity
()));
List
<
String
>
finalAxisData
=
new
ArrayList
<>();
List
<
Object
>
finaleSeriesData
=
new
ArrayList
<>();
finalAxisData
.
addAll
(
fanHealthLatestData
.
values
().
stream
().
map
(
t
->
t
.
getArea
()).
collect
(
Collectors
.
toList
()));
finalAxisData
.
addAll
(
pvHealthLatestData
.
values
().
stream
().
map
(
t
->
t
.
getArea
()).
collect
(
Collectors
.
toList
()));
finaleSeriesData
.
addAll
(
fanHealthLatestData
.
values
().
stream
().
map
(
t
->
String
.
valueOf
(
BigDecimal
.
valueOf
(
t
.
getHealthIndex
()))).
collect
(
Collectors
.
toList
()));
finaleSeriesData
.
addAll
(
pvHealthLatestData
.
values
().
stream
().
map
(
t
->
String
.
valueOf
(
BigDecimal
.
valueOf
(
t
.
getHealthIndex
()))).
collect
(
Collectors
.
toList
()));
resultMap
.
put
(
"axisData"
,
finalAxisData
);
resultMap
.
put
(
"seriesData"
,
finaleSeriesData
);
return
ResponseHelper
.
buildResponse
(
resultMap
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"全域各场站设备实时预警处置信息"
,
notes
=
"全域各场站设备实时预警处置信息"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"全域各场站设备实时预警处置信息"
,
notes
=
"全域各场站设备实时预警处置信息"
)
@GetMapping
(
value
=
"/getEquipWarningInfoByPage"
)
@GetMapping
(
value
=
"/getEquipWarningInfoByPage"
)
public
ResponseModel
<
IPage
<
FanWarningRecord
>>
getEquipWarningInfoByPage
(
public
ResponseModel
<
IPage
<
FanWarningRecord
>>
getEquipWarningInfoByPage
(
...
...
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