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
579c077f
Commit
579c077f
authored
Jul 22, 2024
by
lilongyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、区域查询按照区域进行like查询
parent
ceda0a63
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
156 additions
and
16 deletions
+156
-16
TDBigScreenAnalyseController.java
...le/jxiop/biz/controller/TDBigScreenAnalyseController.java
+156
-16
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 @
579c077f
...
...
@@ -8,7 +8,6 @@ import java.text.ParseException;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Date
;
...
...
@@ -17,6 +16,7 @@ import java.util.LinkedHashSet;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang3.ObjectUtils
;
...
...
@@ -153,6 +153,7 @@ public class TDBigScreenAnalyseController extends BaseController {
LambdaQueryWrapper
<
FanHealthIndex
>
wrapper
=
new
LambdaQueryWrapper
<
FanHealthIndex
>();
wrapper
.
orderByDesc
(
FanHealthIndex:
:
getTs
);
wrapper
.
last
(
"limit 1"
);
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisType
,
"按10分钟"
);
if
(
CharSequenceUtil
.
isNotEmpty
(
stationCode
))
{
StationBasic
stationBasic
=
stationBasicMapper
.
selectById
(
stationCode
);
if
(
"FDZ"
.
equals
(
stationBasic
.
getStationType
()))
{
...
...
@@ -175,10 +176,16 @@ public class TDBigScreenAnalyseController extends BaseController {
}
return
ResponseHelper
.
buildResponse
(
stringBigDecimalHashMap
);
}
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisType
,
"按10分钟"
);
if
(
CharSequenceUtil
.
isNotEmpty
(
areaCode
))
{
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisObjType
,
"片区"
);
wrapper
.
like
(
FanHealthIndex:
:
getArea
,
"%"
+
areaCode
+
"%"
);
}
else
{
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisObjType
,
"全域"
);
}
FanHealthIndex
fanHealthIndex
=
fanHealthIndexMapper
.
selectOne
(
wrapper
);
stringBigDecimalHashMap
.
put
(
"value"
,
BigDecimal
.
valueOf
(
fanHealthIndex
.
getHealthIndex
()).
setScale
(
1
,
BigDecimal
.
ROUND_HALF_UP
));
stringBigDecimalHashMap
.
put
(
"value"
,
BigDecimal
.
valueOf
(
fanHealthIndex
.
getHealthIndex
()).
setScale
(
1
,
BigDecimal
.
ROUND_HALF_UP
));
return
ResponseHelper
.
buildResponse
(
stringBigDecimalHashMap
);
}
...
...
@@ -269,6 +276,91 @@ public class TDBigScreenAnalyseController extends BaseController {
return
ResponseHelper
.
buildResponse
(
resultMap
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"场站设备健康状态指数与趋势 - 折线图"
,
notes
=
"场站设备健康状态指数与趋势 - 折线图"
)
@GetMapping
(
value
=
"/getHealthListInfoByMinute"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getHealthListInfoByMinute
(
@RequestParam
(
required
=
false
)
String
areaCode
,
@RequestParam
(
required
=
false
)
String
stationCode
,
@RequestParam
(
required
=
false
)
String
area
,
@RequestParam
(
required
=
false
)
String
station
,
@RequestParam
(
required
=
false
)
String
analysisType
,
@RequestParam
(
required
=
false
)
Date
startTime
,
@RequestParam
(
required
=
false
)
Date
endTime
)
{
if
(
StrUtil
.
isNotEmpty
(
stationCode
))
{
StationBasic
stationBasic
=
stationBasicMapper
.
selectById
(
stationCode
);
stationCode
=
stationBasic
.
getFanGatewayId
();
}
else
if
(
StrUtil
.
isNotEmpty
(
station
))
{
// 由于命名不统一
StationBasic
stationBasic
=
stationBasicMapper
.
selectOne
(
new
LambdaQueryWrapper
<
StationBasic
>()
.
eq
(
StationBasic:
:
getStationName
,
station
.
substring
(
0
,
station
.
length
()
-
1
)
+
'场'
).
or
()
.
eq
(
StationBasic:
:
getStationName
,
station
.
substring
(
0
,
station
.
length
()
-
1
)
+
'站'
));
stationCode
=
stationBasic
.
getFanGatewayId
();
}
if
(
StrUtil
.
isNotEmpty
(
areaCode
))
{
areaCode
=
"%"
+
areaCode
+
"%"
;
}
else
if
(
StrUtil
.
isNotEmpty
(
area
))
{
areaCode
=
"%"
+
area
+
"%"
;
}
String
finalStationCode
=
stationCode
;
String
finalAreaCode
=
areaCode
;
List
<
String
>
valueList
;
List
<
String
>
dateList
;
List
<
Map
<
String
,
Object
>>
arrayList
=
new
ArrayList
<>();
HashMap
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
stringStringHashMap
=
new
HashMap
<>();
LambdaQueryWrapper
<
FanHealthIndex
>
wrapper
=
new
LambdaQueryWrapper
<
FanHealthIndex
>();
wrapper
.
orderByDesc
(
FanHealthIndex:
:
getTs
);
wrapper
.
last
(
"limit 15"
);
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisType
,
"按10分钟"
);
if
(
CharSequenceUtil
.
isNotEmpty
(
finalStationCode
))
{
StationBasic
stationBasic
=
stationBasicMapper
.
selectById
(
finalStationCode
);
if
(
"FDZ"
.
equals
(
stationBasic
.
getStationType
()))
{
stationCode
=
stationBasic
.
getFanGatewayId
();
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisObjType
,
"场站"
);
wrapper
.
eq
(
FanHealthIndex:
:
getGatewayId
,
stationCode
);
List
<
FanHealthIndex
>
fanHealthIndexList
=
fanHealthIndexMapper
.
selectList
(
wrapper
);
valueList
=
fanHealthIndexList
.
stream
().
map
(
t
->
String
.
valueOf
(
BigDecimal
.
valueOf
(
t
.
getHealthIndex
())
.
setScale
(
1
,
BigDecimal
.
ROUND_HALF_UP
))).
collect
(
Collectors
.
toList
());
dateList
=
fanHealthIndexList
.
stream
().
map
(
t
->
t
.
getRecDate
()).
collect
(
Collectors
.
toList
());
}
else
{
LambdaQueryWrapper
<
PvHealthIndex
>
pvwrapper
=
new
LambdaQueryWrapper
<
PvHealthIndex
>();
pvwrapper
.
eq
(
PvHealthIndex:
:
getAnalysisObjType
,
"场站"
);
pvwrapper
.
eq
(
PvHealthIndex:
:
getGatewayId
,
stationCode
);
pvwrapper
.
orderByDesc
(
PvHealthIndex:
:
getTs
);
pvwrapper
.
last
(
"limit 15"
);
List
<
PvHealthIndex
>
pvHealthIndexList
=
pvHealthIndexMapper
.
selectList
(
pvwrapper
);
valueList
=
pvHealthIndexList
.
stream
().
map
(
t
->
String
.
valueOf
(
BigDecimal
.
valueOf
(
t
.
getHealthIndex
())
.
setScale
(
1
,
BigDecimal
.
ROUND_HALF_UP
))).
collect
(
Collectors
.
toList
());
dateList
=
pvHealthIndexList
.
stream
().
map
(
t
->
t
.
getRecDate
()).
collect
(
Collectors
.
toList
());
}
stringStringHashMap
.
put
(
"data"
,
valueList
);
arrayList
.
add
(
stringStringHashMap
);
resultMap
.
put
(
"axisData"
,
dateList
);
resultMap
.
put
(
"seriesData"
,
arrayList
);
return
ResponseHelper
.
buildResponse
(
resultMap
);
}
if
(
CharSequenceUtil
.
isNotEmpty
(
finalAreaCode
))
{
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisObjType
,
"片区"
);
wrapper
.
like
(
FanHealthIndex:
:
getArea
,
finalAreaCode
);
}
else
{
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisObjType
,
"全域"
);
}
List
<
FanHealthIndex
>
fanHealthIndexList
=
fanHealthIndexMapper
.
selectList
(
wrapper
);
valueList
=
fanHealthIndexList
.
stream
().
map
(
t
->
String
.
valueOf
(
BigDecimal
.
valueOf
(
t
.
getHealthIndex
())
.
setScale
(
1
,
BigDecimal
.
ROUND_HALF_UP
))).
collect
(
Collectors
.
toList
());
dateList
=
fanHealthIndexList
.
stream
().
map
(
t
->
t
.
getRecDate
()).
collect
(
Collectors
.
toList
());
stringStringHashMap
.
put
(
"data"
,
valueList
);
arrayList
.
add
(
stringStringHashMap
);
resultMap
.
put
(
"axisData"
,
dateList
);
resultMap
.
put
(
"seriesData"
,
arrayList
);
return
ResponseHelper
.
buildResponse
(
resultMap
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"全域各片区设备预警情况(条) "
,
notes
=
"全域各片区设备预警情况(条) "
)
@GetMapping
(
value
=
"/getAllEquipAlarmInfo"
)
...
...
@@ -352,19 +444,7 @@ public class TDBigScreenAnalyseController extends BaseController {
List
<
String
>
list
=
new
ArrayList
<>();
// FeignClientResult<List<CompanyModel>> listFeignClientResult = Privilege.companyClient.queryAgencyList("AREA");
//
// List<CompanyModel> companyModels = new ArrayList<>();
//
// if (!ObjectUtils.isEmpty(listFeignClientResult)) {
// if (listFeignClientResult.getStatus() == 200) {
// companyModels = listFeignClientResult.getResult();
// } else {
// throw new RuntimeException(listFeignClientResult.getMessage());
// }
// }
// list = companyModels.stream().map(CompanyModel::getCompanyName).collect(Collectors.toList());
//
list
=
Arrays
.
asList
(
"华北区域"
,
"东北区域"
,
"华东区域"
,
"华南区域"
,
"西南区域"
,
"西北区域"
,
"华中区域"
);
...
...
@@ -375,6 +455,66 @@ public class TDBigScreenAnalyseController extends BaseController {
return
ResponseHelper
.
buildResponse
(
resultMap
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"片区、场站设备健康状态指数 "
,
notes
=
"片区、场站设备健康状态指数 "
)
@GetMapping
(
value
=
"/getHealthInfoByMinute"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getHealthInfoByMinute
(
@RequestParam
(
required
=
false
)
String
areaCode
)
{
LambdaQueryWrapper
<
FanHealthIndex
>
wrapper
=
new
LambdaQueryWrapper
<
FanHealthIndex
>();
wrapper
.
orderByDesc
(
FanHealthIndex:
:
getTs
);
wrapper
.
eq
(
FanHealthIndex:
:
getAnalysisType
,
"按10分钟"
);
if
(
CharSequenceUtil
.
isNotEmpty
(
areaCode
))
{
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
);
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
if
(
CharSequenceUtil
.
isNotEmpty
(
areaCode
))
{
Map
<
String
,
Map
<
String
,
List
<
FanHealthIndex
>>>
groupedData
=
fanHealthIndexList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
FanHealthIndex:
:
getArea
,
Collectors
.
groupingBy
(
FanHealthIndex:
:
getStation
)));
Map
<
String
,
Map
<
String
,
FanHealthIndex
>>
latestData
=
groupedData
.
entrySet
().
stream
()
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
e
->
e
.
getValue
().
values
().
stream
()
.
map
(
list
->
list
.
stream
()
.
max
(
Comparator
.
comparing
(
FanHealthIndex:
:
getTs
))
.
get
())
.
collect
(
Collectors
.
toMap
(
FanHealthIndex:
:
getStation
,
Function
.
identity
()))
));
List
<
Object
>
finalSeriesData
=
new
ArrayList
<>();
List
<
String
>
finalAxisData
=
new
ArrayList
<>();
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
);
return
ResponseHelper
.
buildResponse
(
resultMap
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"全域各场站设备实时预警处置信息"
,
notes
=
"全域各场站设备实时预警处置信息"
)
@GetMapping
(
value
=
"/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