Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
eafc944f
Commit
eafc944f
authored
Feb 19, 2024
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复如果es数据为空接口报错问题
parent
179470b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+12
-11
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
View file @
eafc944f
...
...
@@ -49,7 +49,7 @@ import java.util.stream.Collectors;
@Slf4j
public
class
CommonServiceImpl
{
// @Autowired
// @Autowired
// InfluxdbUtil influxdbUtil;
@Autowired
SjglZsjZsbtzMapper
sjglZsjZsbtzMapper
;
...
...
@@ -246,7 +246,7 @@ public class CommonServiceImpl {
}
catch
(
Exception
e
)
{
return
totalvalue
;
}
return
Double
.
valueOf
(
String
.
format
(
"%.4f"
,
totalvalue
));
return
Double
.
valueOf
(
String
.
format
(
"%.4f"
,
totalvalue
));
}
// public Double getTotalByIndicatiorAndParams(String gatewayId, String indicator, String querySql) {
...
...
@@ -371,10 +371,10 @@ public class CommonServiceImpl {
coal
.
setTitle
(
String
.
format
(
"%.2f"
,
(
totalSocialContribution
*
CommonConstans
.
standardCoal
)));
socialContributionDtoList
.
add
(
coal
);
toner
.
setUnit
(
CommonConstans
.
TAN_FEN_CHEN_ZHUBIANDIYACE
);
toner
.
setTitle
(
String
.
format
(
"%.2f"
,
(
totalSocialContribution
*
CommonConstans
.
toner
)));
toner
.
setTitle
(
String
.
format
(
"%.2f"
,
(
totalSocialContribution
*
CommonConstans
.
toner
)));
socialContributionDtoList
.
add
(
toner
);
so2
.
setUnit
(
CommonConstans
.
ER_YANG_HUA_LIU_ZHUBIANDIYACE
);
so2
.
setTitle
(
String
.
format
(
"%.2f"
,
(
totalSocialContribution
*
CommonConstans
.
sulfurDioxide
)));
so2
.
setTitle
(
String
.
format
(
"%.2f"
,
(
totalSocialContribution
*
CommonConstans
.
sulfurDioxide
)));
socialContributionDtoList
.
add
(
so2
);
socialContributionDtoPage
.
setRecords
(
socialContributionDtoList
);
socialContributionDtoPage
.
setTotal
(
100
);
...
...
@@ -391,11 +391,11 @@ public class CommonServiceImpl {
List
<
Region
>
regionList
=
regionMapper
.
selectList
(
new
QueryWrapper
<
Region
>().
eq
(
"LEVEL"
,
1
));
List
<
MapRegion
>
mapRegionList
=
mapRegionMapper
.
selectList
(
new
QueryWrapper
<
MapRegion
>().
isNotNull
(
"name"
));
List
<
StationBasic
>
stationBasicList
=
stationBasicMapper
.
selectList
(
new
QueryWrapper
<
StationBasic
>().
isNotNull
(
"belong_area"
));
//.isNotNull("fan_gateway_id"));
List
<
SjglZsjZsbtz
>
sjglZsjZsbtzList
=
sjglZsjZsbtzMapper
.
selectList
(
new
QueryWrapper
<
SjglZsjZsbtz
>().
isNotNull
(
"CAPACITYL"
).
eq
(
"is_del"
,
"0"
).
isNotNull
(
"WERKS"
));
//.isNotNull("fan_gateway_id"));
List
<
SjglZsjZsbtz
>
sjglZsjZsbtzList
=
sjglZsjZsbtzMapper
.
selectList
(
new
QueryWrapper
<
SjglZsjZsbtz
>().
isNotNull
(
"CAPACITYL"
).
eq
(
"is_del"
,
"0"
).
isNotNull
(
"WERKS"
));
for
(
int
i
=
0
;
i
<
stationBasicList
.
size
();
i
++)
{
StationBasic
stationBasic
=
stationBasicList
.
get
(
i
);
Double
StationCapactity
=
sjglZsjZsbtzList
.
stream
().
filter
(
sjglZsjZsbtz
->
sjglZsjZsbtz
.
getWerks
().
equals
(
stationBasic
.
getStationNumber
())
&&
!
StringUtils
.
isEmpty
(
sjglZsjZsbtz
.
getCapacityl
())).
collect
(
Collectors
.
toList
()).
stream
().
mapToDouble
(
l
->
Double
.
valueOf
(
l
.
getCapacityl
())).
sum
();
Double
StationCapactity
=
sjglZsjZsbtzList
.
stream
().
filter
(
sjglZsjZsbtz
->
sjglZsjZsbtz
.
getWerks
().
equals
(
stationBasic
.
getStationNumber
())
&&
!
StringUtils
.
isEmpty
(
sjglZsjZsbtz
.
getCapacityl
())).
collect
(
Collectors
.
toList
()).
stream
().
mapToDouble
(
l
->
Double
.
valueOf
(
l
.
getCapacityl
())).
sum
();
StationCacheInfoDto
stationCacheInfoDto
=
new
StationCacheInfoDto
();
stationCacheInfoDto
.
setStationId
(
stationBasic
.
getSequenceNbr
().
toString
());
stationCacheInfoDto
.
setStationName
(
stationBasic
.
getStationName
());
...
...
@@ -561,15 +561,16 @@ public class CommonServiceImpl {
public
Double
getAvagerByEquipmentIndxName
(
List
<
ESEquipments
>
equipments
,
String
indexName
)
{
Double
result
=
0.00
;
result
=
equipments
.
stream
().
filter
(
esEquipments
->
esEquipments
.
getEquipmentIndexName
().
equals
(
indexName
)).
filter
(
esEquipments
->
esEquipments
.
getValueF
()
!=
null
).
mapToDouble
(
ESEquipments:
:
getValueF
).
average
().
getAsDouble
();
if
(!
ObjectUtils
.
isEmpty
(
equipments
))
{
result
=
equipments
.
stream
().
filter
(
esEquipments
->
esEquipments
.
getEquipmentIndexName
().
equals
(
indexName
)).
filter
(
esEquipments
->
esEquipments
.
getValueF
()
!=
null
).
mapToDouble
(
ESEquipments:
:
getValueF
).
average
().
getAsDouble
();
}
return
result
;
}
public
Double
getSumByEquipmentIndxName
(
List
<
ESEquipments
>
equipments
,
String
indexName
)
{
Double
result
=
0.00
;
if
(
equipments
!=
null
)
{
result
=
equipments
.
stream
().
filter
(
esEquipments
->
esEquipments
.
getEquipmentIndexName
().
equals
(
indexName
)).
filter
(
esEquipments
->
esEquipments
.
getValueF
()
!=
null
).
mapToDouble
(
ESEquipments:
:
getValueF
).
sum
();
if
(
equipments
!=
null
)
{
result
=
equipments
.
stream
().
filter
(
esEquipments
->
esEquipments
.
getEquipmentIndexName
().
equals
(
indexName
)).
filter
(
esEquipments
->
esEquipments
.
getValueF
()
!=
null
).
mapToDouble
(
ESEquipments:
:
getValueF
).
sum
();
}
return
result
;
}
...
...
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