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
db2eabb5
Commit
db2eabb5
authored
Nov 03, 2023
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.优化健康指数按照时刻生成预计记录的效率
parent
3f7ae5d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
106 additions
and
79 deletions
+106
-79
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+106
-79
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
View file @
db2eabb5
...
@@ -1286,9 +1286,7 @@ public class CommonServiceImpl {
...
@@ -1286,9 +1286,7 @@ public class CommonServiceImpl {
queryBuilder
.
should
(
QueryBuilders
.
wildcardQuery
(
key
,
shouldQuerCondtion
.
get
(
key
)));
queryBuilder
.
should
(
QueryBuilders
.
wildcardQuery
(
key
,
shouldQuerCondtion
.
get
(
key
)));
}
}
}
}
Query
query
=
new
NativeSearchQueryBuilder
()
Query
query
=
new
NativeSearchQueryBuilder
().
withQuery
(
queryBuilder
).
build
();
.
withQuery
(
queryBuilder
)
.
build
();
query
.
setTrackTotalHits
(
true
);
query
.
setTrackTotalHits
(
true
);
SearchHits
search
=
elasticsearchTemplate
.
search
(
query
,
tClass
);
SearchHits
search
=
elasticsearchTemplate
.
search
(
query
,
tClass
);
if
(
search
.
hasSearchHits
())
{
if
(
search
.
hasSearchHits
())
{
...
@@ -1452,8 +1450,8 @@ public class CommonServiceImpl {
...
@@ -1452,8 +1450,8 @@ public class CommonServiceImpl {
}
}
// @Scheduled(cron = "0 0/10 * * * ?")
// @Scheduled(cron = "0 0/10 * * * ?")
@Async
(
"async"
)
//
@Async("async")
public
void
healthWarningMinuteByFan
()
{
public
void
healthWarningMinuteByFan
()
{
if
(!
openHealth
)
{
if
(!
openHealth
)
{
...
@@ -1461,7 +1459,7 @@ public class CommonServiceImpl {
...
@@ -1461,7 +1459,7 @@ public class CommonServiceImpl {
}
}
String
format
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:00"
);
String
format
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:00"
);
Date
time
=
DateUtil
.
parse
(
format
,
"yyyy-MM-dd HH:mm:00"
);
Date
time
=
DateUtil
.
parse
(
format
,
"yyyy-MM-dd HH:mm:00"
);
logger
.
info
(
"风机---------------------健康指数时间----"
+
time
);
logger
.
info
(
"风机---------------------健康指数时间----"
+
time
);
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
List
<
IdxBizFanPointProcessVariableClassificationDto
>
data
=
idxBizFanPointProcessVariableClassificationMapper
.
getInfluxDBData
();
List
<
IdxBizFanPointProcessVariableClassificationDto
>
data
=
idxBizFanPointProcessVariableClassificationMapper
.
getInfluxDBData
();
Map
<
String
,
List
<
IdxBizFanPointProcessVariableClassificationDto
>>
maps
=
data
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizFanPointProcessVariableClassificationDto:
:
getGatewayId
));
Map
<
String
,
List
<
IdxBizFanPointProcessVariableClassificationDto
>>
maps
=
data
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizFanPointProcessVariableClassificationDto:
:
getGatewayId
));
...
@@ -1512,11 +1510,16 @@ public class CommonServiceImpl {
...
@@ -1512,11 +1510,16 @@ public class CommonServiceImpl {
// // TODO: handle exception
// // TODO: handle exception
// }
// }
// }
// }
Map
<
String
,
Float
>
indicatorDataListAllMap
=
indicatorDataListAll
.
stream
().
collect
(
Collectors
.
toMap
(
indicatorData
->
indicatorData
.
getAddress
()
+
"_"
+
indicatorData
.
getGatewayId
(),
IndicatorData:
:
getValueF
));
Map
<
String
,
Float
>
indicatorDataListAllMap
=
indicatorDataListAll
.
stream
().
collect
(
Collectors
.
toMap
(
indicatorData
->
indicatorData
.
getAddress
()
+
"_"
+
indicatorData
.
getGatewayId
(),
IndicatorData:
:
getValueF
));
//将测点id与值处理成map
HashMap
<
String
,
Double
>
idxBizFanPointProcessVariableClassificationDtoIdValueMap
=
new
HashMap
<>();
for
(
IdxBizFanPointProcessVariableClassificationDto
datum
:
data
)
{
for
(
IdxBizFanPointProcessVariableClassificationDto
datum
:
data
)
{
Double
currentValue
=
Double
.
valueOf
(
indicatorDataListAllMap
.
get
(
datum
.
getIndexAddress
()
+
"_"
+
datum
.
getGatewayId
()));
Double
currentValue
=
Double
.
valueOf
(
indicatorDataListAllMap
.
get
(
datum
.
getIndexAddress
()
+
"_"
+
datum
.
getGatewayId
()));
if
(!
ObjectUtils
.
isEmpty
(
currentValue
))
{
if
(!
ObjectUtils
.
isEmpty
(
currentValue
))
{
datum
.
setCurrentValue
(
currentValue
);
datum
.
setCurrentValue
(
currentValue
);
idxBizFanPointProcessVariableClassificationDtoIdValueMap
.
put
(
datum
.
getSequenceNbr
(),
currentValue
);
}
else
{
idxBizFanPointProcessVariableClassificationDtoIdValueMap
.
put
(
datum
.
getSequenceNbr
(),
0.0
);
}
}
// for (ESEquipments equipment : equipments) {
// for (ESEquipments equipment : equipments) {
// if (equipment.getAddress().equals(datum.getIndexAddress()) && equipment.getGatewayId().equals(datum.getGatewayId())) {
// if (equipment.getAddress().equals(datum.getIndexAddress()) && equipment.getGatewayId().equals(datum.getGatewayId())) {
...
@@ -1545,31 +1548,53 @@ public class CommonServiceImpl {
...
@@ -1545,31 +1548,53 @@ public class CommonServiceImpl {
List
<
String
>
ProcessPoint2Id
=
new
ArrayList
<>();
List
<
String
>
ProcessPoint2Id
=
new
ArrayList
<>();
List
<
String
>
ProcessPoint3Id
=
new
ArrayList
<>();
List
<
String
>
ProcessPoint3Id
=
new
ArrayList
<>();
List
<
String
>
analysisVariableIds
=
new
ArrayList
<>();
List
<
String
>
analysisVariableIds
=
new
ArrayList
<>();
idxBizUhefs
.
forEach
(
idxBizFanPointVarCentralValue
->
{
if
(
ObjectUtils
.
isEmpty
(
idxBizFanPointVarCentralValue
.
getProcess1Min
()))
{
idxBizFanPointVarCentralValue
.
setProcess1Min
(
Double
.
NEGATIVE_INFINITY
);
}
if
(
ObjectUtils
.
isEmpty
(
idxBizFanPointVarCentralValue
.
getProcess2Min
()))
{
idxBizFanPointVarCentralValue
.
setProcess2Min
(
Double
.
NEGATIVE_INFINITY
);
}
if
(
ObjectUtils
.
isEmpty
(
idxBizFanPointVarCentralValue
.
getProcess3Min
()))
{
idxBizFanPointVarCentralValue
.
setProcess3Min
(
Double
.
NEGATIVE_INFINITY
);
}
if
(
ObjectUtils
.
isEmpty
(
idxBizFanPointVarCentralValue
.
getProcess1Max
()))
{
idxBizFanPointVarCentralValue
.
setProcess1Max
(
Double
.
POSITIVE_INFINITY
);
}
if
(
ObjectUtils
.
isEmpty
(
idxBizFanPointVarCentralValue
.
getPorcess2Max
()))
{
idxBizFanPointVarCentralValue
.
setPorcess2Max
(
Double
.
POSITIVE_INFINITY
);
}
if
(
ObjectUtils
.
isEmpty
(
idxBizFanPointVarCentralValue
.
getProcess3Max
()))
{
idxBizFanPointVarCentralValue
.
setProcess3Max
(
Double
.
POSITIVE_INFINITY
);
}
});
for
(
IdxBizFanPointVarCentralValue
idxBizUhef
:
idxBizUhefs
)
{
for
(
IdxBizFanPointVarCentralValue
idxBizUhef
:
idxBizUhefs
)
{
double
value1
=
0.00
;
double
value1
=
0.00
;
double
value2
=
0.00
;
double
value2
=
0.00
;
double
value3
=
0.00
;
double
value3
=
0.00
;
double
value4
=
0.00
;
double
value4
=
0.00
;
for
(
IdxBizFanPointProcessVariableClassificationDto
datum
:
data
)
{
// for (IdxBizFanPointProcessVariableClassificationDto datum : data) {
if
(
idxBizUhef
.
getProcessPoint1Id
().
equals
(
datum
.
getSequenceNbr
()))
{
// if (idxBizUhef.getProcessPoint1Id().equals(datum.getSequenceNbr())) {
value1
=
datum
.
getCurrentValue
()
==
null
?
0.0
:
datum
.
getCurrentValue
();
// value1 = datum.getCurrentValue() == null ? 0.0 : datum.getCurrentValue();
}
// }
if
(
idxBizUhef
.
getProcessPoint2Id
().
equals
(
datum
.
getSequenceNbr
()))
{
// if (idxBizUhef.getProcessPoint2Id().equals(datum.getSequenceNbr())) {
value2
=
datum
.
getCurrentValue
()
==
null
?
0.0
:
datum
.
getCurrentValue
();
// value2 = datum.getCurrentValue() == null ? 0.0 : datum.getCurrentValue();
}
// }
if
(
idxBizUhef
.
getProcessPoint3Id
().
equals
(
datum
.
getSequenceNbr
()))
{
// if (idxBizUhef.getProcessPoint3Id().equals(datum.getSequenceNbr())) {
value3
=
datum
.
getCurrentValue
()
==
null
?
0.0
:
datum
.
getCurrentValue
();
// value3 = datum.getCurrentValue() == null ? 0.0 : datum.getCurrentValue();
}
// }
if
(
idxBizUhef
.
getAnalysisPointId
().
equals
(
datum
.
getSequenceNbr
()))
{
// if (idxBizUhef.getAnalysisPointId().equals(datum.getSequenceNbr())) {
value4
=
datum
.
getCurrentValue
()
==
null
?
0.0
:
datum
.
getCurrentValue
();
// value4 = datum.getCurrentValue() == null ? 0.0 : datum.getCurrentValue();
}
// }
}
// }
value1
=
idxBizFanPointProcessVariableClassificationDtoIdValueMap
.
get
(
idxBizUhef
.
getProcessPoint1Id
());
value2
=
idxBizFanPointProcessVariableClassificationDtoIdValueMap
.
get
(
idxBizUhef
.
getProcessPoint2Id
());
if
((
null
==
idxBizUhef
.
getProcess1Min
()
||
idxBizUhef
.
getProcess1Min
()
<=
value1
)
&&
(
null
==
idxBizUhef
.
getProcess1Max
()
||
value1
<=
idxBizUhef
.
getProcess1Max
())
value3
=
idxBizFanPointProcessVariableClassificationDtoIdValueMap
.
get
(
idxBizUhef
.
getProcessPoint3Id
());
&&
(
null
==
idxBizUhef
.
getProcess2Min
()
||
idxBizUhef
.
getProcess2Min
()
<=
value2
)
&&
(
null
==
idxBizUhef
.
getPorcess2Max
()
||
value2
<=
idxBizUhef
.
getPorcess2Max
())
value4
=
idxBizFanPointProcessVariableClassificationDtoIdValueMap
.
get
(
idxBizUhef
.
getAnalysisPointId
());
&&
(
null
==
idxBizUhef
.
getProcess3Min
()
||
idxBizUhef
.
getProcess3Min
()
<=
value3
)
&&
(
null
==
idxBizUhef
.
getProcess3Max
()
||
value3
<=
idxBizUhef
.
getProcess3Max
()))
{
if
(
idxBizUhef
.
getProcess1Min
()
<=
value1
&&
value1
<=
idxBizUhef
.
getProcess1Max
()
&&
idxBizUhef
.
getProcess2Min
()
<=
value2
&&
value2
<=
idxBizUhef
.
getPorcess2Max
()
&&
idxBizUhef
.
getProcess3Min
()
<=
value3
&&
value3
<=
idxBizUhef
.
getProcess3Max
())
{
if
(!
analysisVariableIdList
.
contains
(
idxBizUhef
.
getAnalysisPointId
()))
{
if
(!
analysisVariableIdList
.
contains
(
idxBizUhef
.
getAnalysisPointId
()))
{
analysisVariableList
.
add
(
value4
);
analysisVariableList
.
add
(
value4
);
analysisVariable
.
add
(
value4
);
analysisVariable
.
add
(
value4
);
...
@@ -1601,16 +1626,7 @@ public class CommonServiceImpl {
...
@@ -1601,16 +1626,7 @@ public class CommonServiceImpl {
requestMap
.
put
(
"analysisVariableId"
,
analysisVariableIdList
);
requestMap
.
put
(
"analysisVariableId"
,
analysisVariableIdList
);
Table
healthData
=
Table
.
create
(
"healthData"
);
Table
healthData
=
Table
.
create
(
"healthData"
);
healthData
.
addColumns
(
DoubleColumn
.
create
(
"analysisVariable"
,
analysisVariable
),
healthData
.
addColumns
(
DoubleColumn
.
create
(
"analysisVariable"
,
analysisVariable
),
DoubleColumn
.
create
(
"stdDev"
,
stdDev
),
DoubleColumn
.
create
(
"centerValue"
,
centerValue
),
StringColumn
.
create
(
"ProcessPoint1Id"
,
ProcessPoint1Id
),
DoubleColumn
.
create
(
"ProcessPoint1"
,
ProcessPoint1
),
StringColumn
.
create
(
"ProcessPoint2Id"
,
ProcessPoint2Id
),
DoubleColumn
.
create
(
"ProcessPoint2"
,
ProcessPoint2
),
StringColumn
.
create
(
"ProcessPoint3Id"
,
ProcessPoint3Id
),
DoubleColumn
.
create
(
"ProcessPoint3"
,
ProcessPoint3
),
StringColumn
.
create
(
"analysisVariableId"
,
analysisVariableIds
));
DoubleColumn
.
create
(
"stdDev"
,
stdDev
),
DoubleColumn
.
create
(
"centerValue"
,
centerValue
),
StringColumn
.
create
(
"ProcessPoint1Id"
,
ProcessPoint1Id
),
DoubleColumn
.
create
(
"ProcessPoint1"
,
ProcessPoint1
),
StringColumn
.
create
(
"ProcessPoint2Id"
,
ProcessPoint2Id
),
DoubleColumn
.
create
(
"ProcessPoint2"
,
ProcessPoint2
),
StringColumn
.
create
(
"ProcessPoint3Id"
,
ProcessPoint3Id
),
DoubleColumn
.
create
(
"ProcessPoint3"
,
ProcessPoint3
),
StringColumn
.
create
(
"analysisVariableId"
,
analysisVariableIds
));
logger
.
info
(
"------------------------------------------开始调用健康指数计算算法开始----------------------------------------"
);
logger
.
info
(
"------------------------------------------开始调用健康指数计算算法开始----------------------------------------"
);
String
response
=
HttpUtil
.
createPost
(
baseUrlZSFX
).
body
(
JSON
.
toJSONString
(
requestMap
)).
execute
().
body
();
String
response
=
HttpUtil
.
createPost
(
baseUrlZSFX
).
body
(
JSON
.
toJSONString
(
requestMap
)).
execute
().
body
();
...
@@ -1624,8 +1640,7 @@ public class CommonServiceImpl {
...
@@ -1624,8 +1640,7 @@ public class CommonServiceImpl {
List
<
Double
>
scoreValue
=
JSONObject
.
parseArray
(
scoreValueArray
.
toJSONString
(),
Double
.
class
);
List
<
Double
>
scoreValue
=
JSONObject
.
parseArray
(
scoreValueArray
.
toJSONString
(),
Double
.
class
);
List
<
Double
>
indexValue
=
JSONObject
.
parseArray
(
indexValueArray
.
toJSONString
(),
Double
.
class
);
List
<
Double
>
indexValue
=
JSONObject
.
parseArray
(
indexValueArray
.
toJSONString
(),
Double
.
class
);
// Table resultTable = Table.create("healthData");
// Table resultTable = Table.create("healthData");
healthData
.
addColumns
(
StringColumn
.
create
(
"analysisVariableIdResult"
,
jsonArrayToStringList
),
healthData
.
addColumns
(
StringColumn
.
create
(
"analysisVariableIdResult"
,
jsonArrayToStringList
),
DoubleColumn
.
create
(
"indexValue"
,
indexValue
),
DoubleColumn
.
create
(
"scoreValue"
,
scoreValue
));
DoubleColumn
.
create
(
"indexValue"
,
indexValue
),
DoubleColumn
.
create
(
"scoreValue"
,
scoreValue
));
System
.
out
.
println
(
healthData
.
print
());
System
.
out
.
println
(
healthData
.
print
());
try
{
try
{
healthData
.
write
().
csv
(
new
Date
().
getTime
()
+
"fj.csv"
);
healthData
.
write
().
csv
(
new
Date
().
getTime
()
+
"fj.csv"
);
...
@@ -1638,7 +1653,6 @@ public class CommonServiceImpl {
...
@@ -1638,7 +1653,6 @@ public class CommonServiceImpl {
queryWrapper
.
in
(
IdxBizFanPointProcessVariableClassification:
:
getSequenceNbr
,
jsonArrayToStringList
);
queryWrapper
.
in
(
IdxBizFanPointProcessVariableClassification:
:
getSequenceNbr
,
jsonArrayToStringList
);
List
<
IdxBizFanPointProcessVariableClassification
>
list
=
idxBizFanPointProcessVariableClassificationMapper
.
selectList
(
queryWrapper
);
List
<
IdxBizFanPointProcessVariableClassification
>
list
=
idxBizFanPointProcessVariableClassificationMapper
.
selectList
(
queryWrapper
);
List
<
IdxBizFanHealthIndex
>
idxBizFanHealthIndexs
=
new
ArrayList
<>();
List
<
IdxBizFanHealthIndex
>
idxBizFanHealthIndexs
=
new
ArrayList
<>();
Set
<
String
>
stations
=
list
.
stream
().
map
(
IdxBizFanPointProcessVariableClassification:
:
getStation
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
stations
=
list
.
stream
().
map
(
IdxBizFanPointProcessVariableClassification:
:
getStation
).
collect
(
Collectors
.
toSet
());
LambdaQueryWrapper
<
IdxBizFanHealthLevel
>
query
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
IdxBizFanHealthLevel
>
query
=
new
LambdaQueryWrapper
<>();
...
@@ -1659,8 +1673,7 @@ public class CommonServiceImpl {
...
@@ -1659,8 +1673,7 @@ public class CommonServiceImpl {
idxBizFanHealthIndex
.
setWeigth
(
1.0
);
idxBizFanHealthIndex
.
setWeigth
(
1.0
);
//获取健康指数对应等级
//获取健康指数对应等级
for
(
IdxBizFanHealthLevel
idxBizFanHealthLevel
:
idxBizFanHealthLevels
)
{
for
(
IdxBizFanHealthLevel
idxBizFanHealthLevel
:
idxBizFanHealthLevels
)
{
if
(
indexValueArray
.
getDoubleValue
(
i
)
<=
idxBizFanHealthLevel
.
getGroupUpperLimit
()
if
(
indexValueArray
.
getDoubleValue
(
i
)
<=
idxBizFanHealthLevel
.
getGroupUpperLimit
()
&&
indexValueArray
.
getDoubleValue
(
i
)
>=
idxBizFanHealthLevel
.
getGroupLowerLimit
())
{
&&
indexValueArray
.
getDoubleValue
(
i
)
>=
idxBizFanHealthLevel
.
getGroupLowerLimit
())
{
idxBizFanHealthIndex
.
setHealthLevel
(
idxBizFanHealthLevel
.
getHealthLevel
());
idxBizFanHealthIndex
.
setHealthLevel
(
idxBizFanHealthLevel
.
getHealthLevel
());
}
}
...
@@ -1739,15 +1752,15 @@ public class CommonServiceImpl {
...
@@ -1739,15 +1752,15 @@ public class CommonServiceImpl {
// @Scheduled(cron = "0 0/10 * * * ?")
// @Scheduled(cron = "0 0/10 * * * ?")
@Async
(
"async"
)
//
@Async("async")
public
void
healthWarningMinuteByPv
()
{
public
void
healthWarningMinuteByPv
()
{
if
(!
openHealth
)
{
if
(!
openHealth
)
{
return
;
return
;
}
}
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
String
format
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:m
m
:00"
);
String
format
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:m
0
:00"
);
Date
time
=
DateUtil
.
parse
(
format
,
"yyyy-MM-dd HH:m
m
:00"
);
Date
time
=
DateUtil
.
parse
(
format
,
"yyyy-MM-dd HH:m
0
:00"
);
logger
.
info
(
"光伏---------------------健康指数时间----"
+
time
);
logger
.
info
(
"光伏---------------------健康指数时间----"
+
time
);
List
<
IdxBizPvPointProcessVariableClassificationDto
>
data
=
idxBizPvPointProcessVariableClassificationMapper
.
getInfluxDBData
();
List
<
IdxBizPvPointProcessVariableClassificationDto
>
data
=
idxBizPvPointProcessVariableClassificationMapper
.
getInfluxDBData
();
Map
<
String
,
List
<
IdxBizPvPointProcessVariableClassificationDto
>>
maps
=
data
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizPvPointProcessVariableClassificationDto:
:
getGatewayId
));
Map
<
String
,
List
<
IdxBizPvPointProcessVariableClassificationDto
>>
maps
=
data
.
stream
().
collect
(
Collectors
.
groupingBy
(
IdxBizPvPointProcessVariableClassificationDto:
:
getGatewayId
));
// BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery();
// BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery();
...
@@ -1780,13 +1793,17 @@ public class CommonServiceImpl {
...
@@ -1780,13 +1793,17 @@ public class CommonServiceImpl {
// } catch (Exception e) {
// } catch (Exception e) {
// // TODO: handle exception
// // TODO: handle exception
// }
// }
Map
<
String
,
Float
>
indicatorDataListAllMap
=
indicatorDataListAll
.
stream
().
collect
(
Collectors
.
toMap
(
indicatorData
->
indicatorData
.
getAddress
()
+
"_"
+
indicatorData
.
getGatewayId
(),
IndicatorData:
:
getValueF
));
Map
<
String
,
Float
>
indicatorDataListAllMap
=
indicatorDataListAll
.
stream
().
collect
(
Collectors
.
toMap
(
indicatorData
->
indicatorData
.
getAddress
()
+
"_"
+
indicatorData
.
getGatewayId
(),
IndicatorData:
:
getValueF
));
HashMap
<
String
,
Double
>
idxBizPvPointProcessVariableClassificationDtoIdValueMap
=
new
HashMap
<>();
for
(
IdxBizPvPointProcessVariableClassificationDto
datum
:
data
)
{
for
(
IdxBizPvPointProcessVariableClassificationDto
datum
:
data
)
{
// for (ESEquipments equipment : equipments) {
// for (ESEquipments equipment : equipments) {
// if (equipment.getAddress().equals(datum.getIndexAddress()) && equipment.getGatewayId().equals(datum.getGatewayId())) {
// if (equipment.getAddress().equals(datum.getIndexAddress()) && equipment.getGatewayId().equals(datum.getGatewayId())) {
Double
currentValue
=
Double
.
valueOf
(
indicatorDataListAllMap
.
get
(
datum
.
getIndexAddress
()
+
"_"
+
datum
.
getGatewayId
()));
Double
currentValue
=
Double
.
valueOf
(
indicatorDataListAllMap
.
get
(
datum
.
getIndexAddress
()
+
"_"
+
datum
.
getGatewayId
()));
if
(!
ObjectUtils
.
isEmpty
(
currentValue
))
{
if
(!
ObjectUtils
.
isEmpty
(
currentValue
))
{
datum
.
setCurrentValue
(
currentValue
);
datum
.
setCurrentValue
(
currentValue
);
idxBizPvPointProcessVariableClassificationDtoIdValueMap
.
put
(
datum
.
getSequenceNbr
(),
currentValue
);
}
else
{
idxBizPvPointProcessVariableClassificationDtoIdValueMap
.
put
(
datum
.
getSequenceNbr
(),
0.0
);
}
}
// }
// }
// }
// }
...
@@ -1811,29 +1828,50 @@ public class CommonServiceImpl {
...
@@ -1811,29 +1828,50 @@ public class CommonServiceImpl {
List
<
String
>
ProcessPoint2Id
=
new
ArrayList
<>();
List
<
String
>
ProcessPoint2Id
=
new
ArrayList
<>();
List
<
String
>
ProcessPoint3Id
=
new
ArrayList
<>();
List
<
String
>
ProcessPoint3Id
=
new
ArrayList
<>();
List
<
String
>
analysisVariableIds
=
new
ArrayList
<>();
List
<
String
>
analysisVariableIds
=
new
ArrayList
<>();
idxBizUhefs
.
forEach
(
idxBizPvPointVarCentralValue
->
{
if
(
ObjectUtils
.
isEmpty
(
idxBizPvPointVarCentralValue
.
getProcess1Min
()))
{
idxBizPvPointVarCentralValue
.
setProcess1Min
(
Double
.
NEGATIVE_INFINITY
);
}
if
(
ObjectUtils
.
isEmpty
(
idxBizPvPointVarCentralValue
.
getProcess2Min
()))
{
idxBizPvPointVarCentralValue
.
setProcess2Min
(
Double
.
NEGATIVE_INFINITY
);
}
if
(
ObjectUtils
.
isEmpty
(
idxBizPvPointVarCentralValue
.
getProcess3Min
()))
{
idxBizPvPointVarCentralValue
.
setProcess3Min
(
Double
.
NEGATIVE_INFINITY
);
}
if
(
ObjectUtils
.
isEmpty
(
idxBizPvPointVarCentralValue
.
getProcess1Max
()))
{
idxBizPvPointVarCentralValue
.
setProcess1Max
(
Double
.
POSITIVE_INFINITY
);
}
if
(
ObjectUtils
.
isEmpty
(
idxBizPvPointVarCentralValue
.
getProcess2Max
()))
{
idxBizPvPointVarCentralValue
.
setProcess2Max
(
Double
.
POSITIVE_INFINITY
);
}
if
(
ObjectUtils
.
isEmpty
(
idxBizPvPointVarCentralValue
.
getProcess3Max
()))
{
idxBizPvPointVarCentralValue
.
setProcess3Max
(
Double
.
POSITIVE_INFINITY
);
}
});
for
(
IdxBizPvPointVarCentralValue
idxBizUhef
:
idxBizUhefs
)
{
for
(
IdxBizPvPointVarCentralValue
idxBizUhef
:
idxBizUhefs
)
{
double
value1
=
0.00
;
double
value1
=
0.00
;
double
value2
=
0.00
;
double
value2
=
0.00
;
double
value3
=
0.00
;
double
value3
=
0.00
;
double
value4
=
0.00
;
double
value4
=
0.00
;
for
(
IdxBizPvPointProcessVariableClassificationDto
datum
:
data
)
{
// for (IdxBizPvPointProcessVariableClassificationDto datum : data) {
if
(
idxBizUhef
.
getProcessPoint1Id
().
equals
(
datum
.
getSequenceNbr
()))
{
// if (idxBizUhef.getProcessPoint1Id().equals(datum.getSequenceNbr())) {
value1
=
datum
.
getCurrentValue
();
// value1 = datum.getCurrentValue();
}
// }
if
(
idxBizUhef
.
getProcessPoint2Id
().
equals
(
datum
.
getSequenceNbr
()))
{
// if (idxBizUhef.getProcessPoint2Id().equals(datum.getSequenceNbr())) {
value2
=
datum
.
getCurrentValue
();
// value2 = datum.getCurrentValue();
}
// }
if
(
idxBizUhef
.
getProcessPoint3Id
().
equals
(
datum
.
getSequenceNbr
()))
{
// if (idxBizUhef.getProcessPoint3Id().equals(datum.getSequenceNbr())) {
value3
=
datum
.
getCurrentValue
();
// value3 = datum.getCurrentValue();
}
// }
if
(
idxBizUhef
.
getAnalysisPointId
().
equals
(
datum
.
getSequenceNbr
()))
{
// if (idxBizUhef.getAnalysisPointId().equals(datum.getSequenceNbr())) {
value4
=
datum
.
getCurrentValue
();
// value4 = datum.getCurrentValue();
}
// }
}
// }
if
((
null
==
idxBizUhef
.
getProcess1Min
()
||
idxBizUhef
.
getProcess1Min
()
<=
value1
)
&&
(
null
==
idxBizUhef
.
getProcess1Max
()
||
value1
<=
idxBizUhef
.
getProcess1Max
())
value1
=
idxBizPvPointProcessVariableClassificationDtoIdValueMap
.
get
(
idxBizUhef
.
getProcessPoint1Id
());
&&
(
null
==
idxBizUhef
.
getProcess2Min
()
||
idxBizUhef
.
getProcess2Min
()
<=
value2
)
&&
(
null
==
idxBizUhef
.
getProcess2Max
()
||
value2
<=
idxBizUhef
.
getProcess2Max
())
value2
=
idxBizPvPointProcessVariableClassificationDtoIdValueMap
.
get
(
idxBizUhef
.
getProcessPoint2Id
());
&&
(
null
==
idxBizUhef
.
getProcess3Min
()
||
idxBizUhef
.
getProcess3Min
()
<=
value3
)
&&
(
null
==
idxBizUhef
.
getProcess3Max
()
||
value3
<=
idxBizUhef
.
getProcess3Max
()))
{
value3
=
idxBizPvPointProcessVariableClassificationDtoIdValueMap
.
get
(
idxBizUhef
.
getProcessPoint3Id
());
value4
=
idxBizPvPointProcessVariableClassificationDtoIdValueMap
.
get
(
idxBizUhef
.
getAnalysisPointId
());
if
(
idxBizUhef
.
getProcess1Min
()
<=
value1
&&
value1
<=
idxBizUhef
.
getProcess1Max
()
&&
idxBizUhef
.
getProcess2Min
()
<=
value2
&&
value2
<=
idxBizUhef
.
getProcess2Max
()
&&
idxBizUhef
.
getProcess3Min
()
<=
value3
&&
value3
<=
idxBizUhef
.
getProcess3Max
())
{
if
(!
analysisVariableIdList
.
contains
(
idxBizUhef
.
getAnalysisPointId
()))
{
if
(!
analysisVariableIdList
.
contains
(
idxBizUhef
.
getAnalysisPointId
()))
{
analysisVariableList
.
add
(
value4
);
analysisVariableList
.
add
(
value4
);
analysisVariable
.
add
(
value4
);
analysisVariable
.
add
(
value4
);
...
@@ -1865,16 +1903,7 @@ public class CommonServiceImpl {
...
@@ -1865,16 +1903,7 @@ public class CommonServiceImpl {
requestMap
.
put
(
"analysisVariableId"
,
analysisVariableIdList
);
requestMap
.
put
(
"analysisVariableId"
,
analysisVariableIdList
);
Table
healthData
=
Table
.
create
(
"healthData"
);
Table
healthData
=
Table
.
create
(
"healthData"
);
healthData
.
addColumns
(
DoubleColumn
.
create
(
"analysisVariable"
,
analysisVariable
),
healthData
.
addColumns
(
DoubleColumn
.
create
(
"analysisVariable"
,
analysisVariable
),
DoubleColumn
.
create
(
"stdDev"
,
stdDev
),
DoubleColumn
.
create
(
"centerValue"
,
centerValue
),
StringColumn
.
create
(
"ProcessPoint1Id"
,
ProcessPoint1Id
),
DoubleColumn
.
create
(
"ProcessPoint1"
,
ProcessPoint1
),
StringColumn
.
create
(
"ProcessPoint2Id"
,
ProcessPoint2Id
),
DoubleColumn
.
create
(
"ProcessPoint2"
,
ProcessPoint2
),
StringColumn
.
create
(
"ProcessPoint3Id"
,
ProcessPoint3Id
),
DoubleColumn
.
create
(
"ProcessPoint3"
,
ProcessPoint3
),
StringColumn
.
create
(
"analysisVariableId"
,
analysisVariableIds
));
DoubleColumn
.
create
(
"stdDev"
,
stdDev
),
DoubleColumn
.
create
(
"centerValue"
,
centerValue
),
StringColumn
.
create
(
"ProcessPoint1Id"
,
ProcessPoint1Id
),
DoubleColumn
.
create
(
"ProcessPoint1"
,
ProcessPoint1
),
StringColumn
.
create
(
"ProcessPoint2Id"
,
ProcessPoint2Id
),
DoubleColumn
.
create
(
"ProcessPoint2"
,
ProcessPoint2
),
StringColumn
.
create
(
"ProcessPoint3Id"
,
ProcessPoint3Id
),
DoubleColumn
.
create
(
"ProcessPoint3"
,
ProcessPoint3
),
StringColumn
.
create
(
"analysisVariableId"
,
analysisVariableIds
));
logger
.
info
(
"------------------------------------------开始调用健康指数计算算法开始----------------------------------------"
);
logger
.
info
(
"------------------------------------------开始调用健康指数计算算法开始----------------------------------------"
);
String
response
=
HttpUtil
.
createPost
(
baseUrlZSFX
).
body
(
JSON
.
toJSONString
(
requestMap
)).
execute
().
body
();
String
response
=
HttpUtil
.
createPost
(
baseUrlZSFX
).
body
(
JSON
.
toJSONString
(
requestMap
)).
execute
().
body
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
response
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
response
);
...
@@ -1886,8 +1915,7 @@ public class CommonServiceImpl {
...
@@ -1886,8 +1915,7 @@ public class CommonServiceImpl {
List
<
Double
>
scoreValue
=
JSONObject
.
parseArray
(
scoreValueArray
.
toJSONString
(),
Double
.
class
);
List
<
Double
>
scoreValue
=
JSONObject
.
parseArray
(
scoreValueArray
.
toJSONString
(),
Double
.
class
);
List
<
Double
>
indexValue
=
JSONObject
.
parseArray
(
indexValueArray
.
toJSONString
(),
Double
.
class
);
List
<
Double
>
indexValue
=
JSONObject
.
parseArray
(
indexValueArray
.
toJSONString
(),
Double
.
class
);
// Table resultTable = Table.create("healthData");
// Table resultTable = Table.create("healthData");
healthData
.
addColumns
(
StringColumn
.
create
(
"analysisVariableIdResult"
,
jsonArrayToStringList
),
healthData
.
addColumns
(
StringColumn
.
create
(
"analysisVariableIdResult"
,
jsonArrayToStringList
),
DoubleColumn
.
create
(
"indexValue"
,
indexValue
),
DoubleColumn
.
create
(
"scoreValue"
,
scoreValue
));
DoubleColumn
.
create
(
"indexValue"
,
indexValue
),
DoubleColumn
.
create
(
"scoreValue"
,
scoreValue
));
System
.
out
.
println
(
healthData
.
print
());
System
.
out
.
println
(
healthData
.
print
());
try
{
try
{
healthData
.
write
().
csv
(
new
Date
().
getTime
()
+
"gf.csv"
);
healthData
.
write
().
csv
(
new
Date
().
getTime
()
+
"gf.csv"
);
...
@@ -1924,8 +1952,7 @@ public class CommonServiceImpl {
...
@@ -1924,8 +1952,7 @@ public class CommonServiceImpl {
//获取健康指数对应等级
//获取健康指数对应等级
for
(
IdxBizPvHealthLevel
idxBizFanHealthLevel
:
idxBizFanHealthLevels
)
{
for
(
IdxBizPvHealthLevel
idxBizFanHealthLevel
:
idxBizFanHealthLevels
)
{
if
(
indexValueArray
.
getDoubleValue
(
i
)
<=
idxBizFanHealthLevel
.
getGroupUpperLimit
()
if
(
indexValueArray
.
getDoubleValue
(
i
)
<=
idxBizFanHealthLevel
.
getGroupUpperLimit
()
&&
indexValueArray
.
getDoubleValue
(
i
)
>=
idxBizFanHealthLevel
.
getGroupLowerLimit
())
{
&&
indexValueArray
.
getDoubleValue
(
i
)
>=
idxBizFanHealthLevel
.
getGroupLowerLimit
())
{
idxBizPvHealthIndex
.
setHealthLevel
(
idxBizFanHealthLevel
.
getHealthLevel
());
idxBizPvHealthIndex
.
setHealthLevel
(
idxBizFanHealthLevel
.
getHealthLevel
());
}
}
...
...
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