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
3836e4bb
Commit
3836e4bb
authored
Sep 14, 2023
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码
parent
94c86e6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
17 deletions
+50
-17
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+34
-1
MonitorFanIndicatorImpl.java
...odule/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
+16
-16
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 @
3836e4bb
...
...
@@ -458,7 +458,6 @@ public class CommonServiceImpl {
queryBuilder
.
should
(
QueryBuilders
.
wildcardQuery
(
key
,
shouldQuerCondtion
.
get
(
key
)));
}
}
Query
query
=
new
NativeSearchQueryBuilder
()
.
withQuery
(
queryBuilder
)
.
build
();
...
...
@@ -471,6 +470,8 @@ public class CommonServiceImpl {
}
return
null
;
}
public
<
T
>
List
<
T
>
getListDataByCondtions
(
Map
<
String
,
List
<
String
>>
mustQuerCondtion
,
Map
<
String
,
String
>
shouldQuerCondtion
,
Map
<
String
,
String
>
notMustQuerCondtion
,
Class
<
T
>
tClass
)
{
BoolQueryBuilder
queryBuilder
=
QueryBuilders
.
boolQuery
();
if
(!
ObjectUtils
.
isEmpty
(
mustQuerCondtion
))
{
...
...
@@ -513,4 +514,36 @@ public class CommonServiceImpl {
result
=
equipments
.
stream
().
filter
(
esEquipments
->
esEquipments
.
getEquipmentIndexName
().
equals
(
indexName
)).
mapToDouble
(
ESEquipments:
:
getValueDouble
).
sum
();
return
result
;
}
public
<
T
>
List
<
T
>
getListDataByCondtions
(
Map
<
String
,
List
<
String
>>
mustQuerCondtion
,
Map
<
String
,
String
>
shouldQuerCondtion
,
Class
<
T
>
tClass
,
Map
<
String
,
String
>
likeQuerCondtion
)
{
BoolQueryBuilder
queryBuilder
=
QueryBuilders
.
boolQuery
();
if
(!
ObjectUtils
.
isEmpty
(
mustQuerCondtion
))
{
for
(
String
key
:
mustQuerCondtion
.
keySet
())
{
List
<
String
>
va
=
mustQuerCondtion
.
get
(
key
);
queryBuilder
.
must
(
QueryBuilders
.
termsQuery
(
key
,
va
));
}
}
if
(!
ObjectUtils
.
isEmpty
(
shouldQuerCondtion
))
{
for
(
String
key
:
shouldQuerCondtion
.
keySet
())
{
queryBuilder
.
should
(
QueryBuilders
.
wildcardQuery
(
key
,
shouldQuerCondtion
.
get
(
key
)));
}
}
if
(!
ObjectUtils
.
isEmpty
(
likeQuerCondtion
))
{
for
(
String
key
:
likeQuerCondtion
.
keySet
())
{
queryBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
key
,
"*"
+
likeQuerCondtion
.
get
(
key
)+
"*"
));
}
}
Query
query
=
new
NativeSearchQueryBuilder
()
.
withQuery
(
queryBuilder
)
.
build
();
query
.
setTrackTotalHits
(
true
);
SearchHits
search
=
elasticsearchTemplate
.
search
(
query
,
tClass
);
if
(
search
.
hasSearchHits
())
{
List
<
SearchHit
<
T
>>
searchHitList
=
search
.
getSearchHits
();
List
<
T
>
list
=
searchHitList
.
stream
().
map
(
hit
->
hit
.
getContent
()).
collect
(
Collectors
.
toList
());
return
list
;
}
return
null
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
View file @
3836e4bb
...
...
@@ -280,8 +280,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
queryCondtion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
stationBasic
.
getFanGatewayId
()));
List
<
ESEquipments
>
result
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
null
,
ESEquipments
.
class
);
Map
<
String
,
List
<
String
>>
queryCondtion1
=
new
HashMap
<>();
queryCondtion
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
Arrays
.
asList
(
"发电
状态"
));
queryCondtion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
stationBasic
.
getFanGatewayId
()));
queryCondtion
1
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
Arrays
.
asList
(
"报警
状态"
));
queryCondtion
1
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
stationBasic
.
getFanGatewayId
()));
List
<
ESEquipments
>
equipNumList
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion1
,
null
,
ESEquipments
.
class
);
Map
<
String
,
String
>
collect
=
result
.
stream
().
collect
(
Collectors
.
toMap
(
ESEquipments:
:
getEquipmentNumber
,
ESEquipments:
:
getEquipmentIndexName
,
(
item1
,
item2
)
->
item1
));
equipNumList
.
forEach
(
item
->
{
...
...
@@ -366,7 +366,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
ESEquipments
esEquipments
=
result
.
get
(
i
);
if
(
esEquipments
.
getEquipmentIndexName
().
contains
(
"温度"
))
{
xList
.
add
(
esEquipments
.
getEquipmentIndexName
());
yList
.
add
(
esEquipments
.
getValue
());
yList
.
add
(
esEquipments
.
getValue
Double
().
toString
());
}
}
realTimeTemperatureResult
.
put
(
"axisData"
,
xList
);
...
...
@@ -786,18 +786,18 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public
void
getStatusJDX
(
String
gatewayId
,
String
stationId
,
String
frontModule
)
{
Map
<
String
,
List
<
String
>>
queryCondtion
=
new
HashMap
<>();
queryCondtion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
gatewayId
));
Map
<
String
,
String
>
should
Codtion
=
new
HashMap
<>();
should
Codtion
.
put
(
CommonConstans
.
QueryStringFrontMoudle
,
frontModule
);
shouldCodtion
.
put
(
CommonConstans
.
QueryStringDisplayName
,
"合位"
);
List
<
ESEquipments
>
listData
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
shouldCodtion
,
ESEquipments
.
class
);
Map
<
String
,
String
>
like
Codtion
=
new
HashMap
<>();
like
Codtion
.
put
(
CommonConstans
.
QueryStringFrontMoudle
,
frontModule
);
likeCodtion
.
put
(
CommonConstans
.
QueryStringDisplayName
+
".keyword"
,
"合位"
);
List
<
ESEquipments
>
listData
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
null
,
ESEquipments
.
class
,
likeCodtion
);
List
<
Map
<
String
,
Object
>>
statusMaps
=
new
ArrayList
<>();
Map
<
String
,
List
<
ESEquipments
>>
collect
=
listData
.
stream
().
collect
(
Collectors
.
groupingBy
(
ESEquipments:
:
getFrontModule
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
for
(
String
s
:
collect
.
keySet
())
{
Map
<
String
,
Object
>
statusMap
=
new
HashMap
<>();
if
(
frontModule
.
equals
(
"前光"
))
{
shouldCodtion
.
remove
(
CommonConstans
.
QueryStringDisplayName
);
shouldCodtion
.
put
(
CommonConstans
.
QueryStringSystemType
,
"模拟量"
);
List
<
ESEquipments
>
value
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
shouldCodtion
,
ESEquipments
.
class
);
likeCodtion
.
remove
(
CommonConstans
.
QueryStringDisplayName
+
".keyword"
);
likeCodtion
.
put
(
CommonConstans
.
QueryStringSystemType
+
".keyword"
,
"模拟量"
);
List
<
ESEquipments
>
value
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
null
,
ESEquipments
.
class
,
likeCodtion
);
for
(
ESEquipments
indicatorsDto
:
value
)
{
Double
aDouble
=
Double
.
valueOf
(
indicatorsDto
.
getValue
());
statusMap
.
put
(
indicatorsDto
.
getDisplayName
()
+
"Value"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
aDouble
));
...
...
@@ -859,7 +859,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
for
(
ESEquipments
listDatum
:
listData
)
{
for
(
ESEquipments
indicatorsDto
:
listData1
)
{
if
(
listDatum
.
getEquipmentNumber
().
equals
(
indicatorsDto
.
getEquipmentNumber
()))
{
listDatum
.
setValueLabel
(
indicatorsDto
.
getValue
(
));
listDatum
.
setValueLabel
(
String
.
valueOf
(
indicatorsDto
.
getValueDouble
()/
1000
));
}
}
...
...
@@ -869,7 +869,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
map
.
put
(
"title"
,
prefix
+
listDatum
.
getEquipmentNumber
());
//用于参数传递
map
.
put
(
"title1"
,
listDatum
.
getEquipmentNumber
());
map
.
put
(
"windSpeed"
,
listDatum
.
getValue
());
map
.
put
(
"windSpeed"
,
listDatum
.
getValue
Double
());
map
.
put
(
"power"
,
listDatum
.
getValueLabel
());
//获取风机状态如果获取到的状态为空-则默认为正常运行状态
String
fantStatus
=
ObjectUtils
.
isEmpty
(
fanstatutsHashMap
.
get
(
listDatum
.
getEquipmentNumber
()))
?
"通讯中断"
:
fanstatutsHashMap
.
get
(
listDatum
.
getEquipmentNumber
());
...
...
@@ -1586,10 +1586,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List
<
ESEquipments
>
dtos
=
list1
.
stream
().
filter
(
e
->
e
.
getEquipmentNumber
().
equals
(
s
)).
collect
(
Collectors
.
toList
());
if
(!
ValidationUtil
.
isEmpty
(
dtos
))
{
for
(
ESEquipments
esEquipments
:
indicatorsDtos
)
{
lsv
=
lsv
+
Math
.
pow
(
Double
.
parseDouble
(
esEquipments
.
getValue
())
-
Double
.
parseDouble
(
dtos
.
get
(
0
).
getValue
()
),
2
);
lsv
=
lsv
+
Math
.
pow
(
esEquipments
.
getValueDouble
()
-
dtos
.
get
(
0
).
getValueDouble
(
),
2
);
}
}
lsv
=
Math
.
sqrt
(
lsv
)
/
Double
.
parseDouble
(
dtos
.
get
(
0
).
getValue
()
);
lsv
=
Math
.
sqrt
(
lsv
)
/
dtos
.
get
(
0
).
getValueDouble
(
);
}
...
...
@@ -1710,7 +1710,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
for
(
ESEquipments
listDatum
:
listData
)
{
for
(
ESEquipments
esEquipments
:
listData1
)
{
if
(
esEquipments
.
getEquipmentNumber
().
equals
(
listDatum
.
getEquipmentNumber
()))
{
esEquipments
.
setValueLabel
(
listDatum
.
getValue
());
esEquipments
.
setValueLabel
(
listDatum
.
getValue
Double
().
toString
());
}
}
}
...
...
@@ -1725,7 +1725,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
String
number
=
equipNum
.
substring
(
equipNum
.
length
()
-
1
);
map
.
put
(
"titie"
,
String
.
valueOf
(
num
));
map
.
put
(
"titie"
+
number
,
equipNum
);
map
.
put
(
"value"
+
number
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
Double
.
parseDouble
(
esEquipments
.
getValue
()
)));
map
.
put
(
"value"
+
number
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
esEquipments
.
getValueDouble
(
)));
map
.
put
(
"valueLabel"
+
number
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
Double
.
parseDouble
(
esEquipments
.
getValueLabel
())));
map
.
put
(
"state"
+
number
,
equipStatesMap
.
get
(
esEquipments
.
getEquipmentNumber
()));
maps
.
add
(
map
);
...
...
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