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
3c0464fa
Commit
3c0464fa
authored
Sep 18, 2023
by
zhangsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文档问题处理
parent
b25328ce
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
14 deletions
+60
-14
CommonConstans.java
.../amos/boot/module/jxiop/biz/constants/CommonConstans.java
+3
-0
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+44
-4
MonitorFanIndicatorImpl.java
...odule/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
+13
-10
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/constants/CommonConstans.java
View file @
3c0464fa
...
...
@@ -90,6 +90,9 @@ public class CommonConstans {
public
static
final
String
QueryStringEquipmentNumberKeyword
=
"equipmentNumber.keyword"
;
public
static
final
String
QueryStringValue
=
"value"
;
public
static
final
String
QueryStringValueKeyword
=
"value.keyword"
;
public
static
final
String
QueryStringValueLabel
=
"valueLabel"
;
public
static
final
String
QueryStringValueLabelKeyword
=
"valueLabel.keyword"
;
public
static
final
String
QueryStringDataType
=
"dataType"
;
public
static
final
String
QueryStringDisplayName
=
"displayName"
;
public
static
final
String
QueryStringDisplayNameKeyword
=
"displayName.keyword"
;
...
...
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 @
3c0464fa
...
...
@@ -18,10 +18,9 @@ import com.yeejoin.amos.boot.module.jxiop.biz.initdata.StationCacheDataInit;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SjglZsjZsbtzMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.repository.ESEquipmentsRepository
;
import
com.yeejoin.amos.component.influxdb.InfluxdbUtil
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.MatchPhraseQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.index.query.WildcardQueryBuilder
;
import
org.elasticsearch.index.query.*
;
import
org.elasticsearch.script.Script
;
import
org.elasticsearch.script.ScriptType
;
import
org.elasticsearch.search.aggregations.Aggregation
;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.Aggregations
;
...
...
@@ -598,4 +597,45 @@ public class CommonServiceImpl {
}
return
null
;
}
public
<
T
>
List
<
T
>
getListDataByCondtionsByValueNotEqValueLabel
(
Map
<
String
,
List
<
String
>>
mustQuerCondtion
,
Map
<
String
,
String
>
shouldQuerCondtion
,
Map
<
String
,
String
>
notMustQuerCondtion
,
Class
<
T
>
tClass
)
{
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
(
notMustQuerCondtion
))
{
for
(
String
key
:
notMustQuerCondtion
.
keySet
())
{
queryBuilder
.
mustNot
(
QueryBuilders
.
termsQuery
(
key
,
notMustQuerCondtion
.
get
(
key
)));
}
}
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"param1"
,
""
);
Script
script
=
new
Script
(
ScriptType
.
INLINE
,
Script
.
DEFAULT_SCRIPT_LANG
,
"doc['value.keyword'].value != doc['valueLabel.keyword'].value + params.param1"
,
params
);
ScriptQueryBuilder
scriptQueryBuilder
=
QueryBuilders
.
scriptQuery
(
script
);
queryBuilder
.
filter
(
scriptQueryBuilder
);
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 @
3c0464fa
...
...
@@ -131,7 +131,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
waringData
=
waringData
.
stream
().
filter
(
esEquipments
->
esEquipments
.
getEquipmentNumber
().
equals
(
equipmentNumber
)).
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtils
.
isNotEmpty
(
waringData
))
{
waringData
=
waringData
.
stream
().
sorted
(
Comparator
.
comparing
(
ESEquipments:
:
getCreatedTime
).
reversed
()).
collect
(
Collectors
.
toList
()).
subList
(((
current
-
1
)
*
size
),(
current
*
size
));
Integer
newSize
=
waringData
.
size
()
>=
size
?
size
:
waringData
.
size
();
waringData
=
waringData
.
stream
().
sorted
(
Comparator
.
comparing
(
ESEquipments:
:
getCreatedTime
).
reversed
()).
collect
(
Collectors
.
toList
()).
subList
(((
current
-
1
)
*
newSize
),(
current
*
newSize
));
}
//对于查询到的告警信息进行按照时间顺序进行排序
DataGridMock
DataGridMock
=
new
DataGridMock
(
current
,
!
waringData
.
isEmpty
()
?
waringData
.
size
()
:
0
,
false
,
current
,
waringData
);
...
...
@@ -155,14 +156,16 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
String
gateway
=
stationBasic
.
getFanGatewayId
();
Map
<
String
,
List
<
String
>>
queryCodntion
=
new
HashMap
<>();
queryCodntion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
gateway
));
queryCodntion
.
put
(
CommonConstans
.
QueryStringIsAlarm
,
Arrays
.
asList
(
"1"
));
List
<
ESEquipments
>
alldata
=
commonServiceImpl
.
getListDataByCondtions
(
queryCodntion
,
null
,
ESEquipments
.
class
);
List
<
ESEquipments
>
waringData
=
alldata
.
stream
().
filter
(
esEquipments
->
!
esEquipments
.
getValue
().
equals
(
"0.0"
)&&!
esEquipments
.
getValue
().
equals
(
esEquipments
.
getValueLabel
())).
collect
(
Collectors
.
toList
());
String
table
=
gateway
;
queryCodntion
.
put
(
CommonConstans
.
QueryStringIsAlarmKeyword
,
Arrays
.
asList
(
"1"
));
HashMap
<
String
,
String
>
notMustMap
=
new
HashMap
<>();
notMustMap
.
put
(
CommonConstans
.
QueryStringValueKeyword
,
"0.0"
);
notMustMap
.
put
(
CommonConstans
.
QueryStringValueLabelKeyword
,
"0.0"
);
List
<
ESEquipments
>
waringData
=
commonServiceImpl
.
getListDataByCondtionsByValueNotEqValueLabel
(
queryCodntion
,
null
,
notMustMap
,
ESEquipments
.
class
);
if
(
StringUtils
.
isNotEmpty
(
equipmentNumber
))
{
waringData
=
waringData
.
stream
().
filter
(
esEquipments
->
esEquipments
.
getEquipmentNumber
().
equals
(
equipmentNumber
)&&
esEquipments
.
getEquipmentSpecificName
().
contains
(
"风机"
)).
collect
(
Collectors
.
toList
());
}
List
<
ESEquipments
>
lisSort
=
waringData
.
stream
().
sorted
(
Comparator
.
comparing
(
ESEquipments:
:
getCreatedTime
).
reversed
()).
collect
(
Collectors
.
toList
()).
subList
(((
current
-
1
)
*
size
),(
current
*
size
));
Integer
newSize
=
waringData
.
size
()
>=
size
?
size
:
waringData
.
size
();
List
<
ESEquipments
>
lisSort
=
waringData
.
stream
().
sorted
(
Comparator
.
comparing
(
ESEquipments:
:
getCreatedTime
).
reversed
()).
collect
(
Collectors
.
toList
()).
subList
(((
current
-
1
)
*
newSize
),(
current
*
newSize
));
//对于查询到的告警信息进行按照时间顺序进行排序
//构建平台数据
DataGridMock
DataGridMock
=
new
DataGridMock
(
current
,
!
waringData
.
isEmpty
()
?
waringData
.
size
():
0
,
false
,
current
,
lisSort
);
...
...
@@ -774,10 +777,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public
List
<
Map
<
String
,
Object
>>
getAnalogQuantity
(
String
gatewayId
,
String
frontModule
,
String
systemType
)
{
Map
<
String
,
List
<
String
>>
queryCondtion
=
new
HashMap
<>();
queryCondtion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
gatewayId
));
Map
<
String
,
String
>
shouldCondtion
=
new
HashMap
<>();
shouldCondtion
.
put
(
CommonConstans
.
QueryStringFrontMoudle
,
frontModule
);
shouldCondtion
.
put
(
CommonConstans
.
QueryStringSystemType
,
systemType
);
List
<
ESEquipments
>
esEquipmentsList
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
shouldCondtion
,
ESEquipments
.
class
);
Map
<
String
,
String
>
likeMap
=
new
HashMap
<>();
likeMap
.
put
(
CommonConstans
.
QueryStringFrontMoudleNotKeyWord
,
frontModule
);
likeMap
.
put
(
CommonConstans
.
QueryStringSystemType
,
systemType
);
List
<
ESEquipments
>
esEquipmentsList
=
commonServiceImpl
.
getListDataByCondtions
AndLike
(
queryCondtion
,
null
,
ESEquipments
.
class
,
likeMap
);
List
<
ESEquipments
>
listData
=
esEquipmentsList
.
stream
().
filter
(
esEquipments
->
!
esEquipments
.
getDisplayName
().
equals
(
""
)).
collect
(
Collectors
.
toList
());
List
<
Map
<
String
,
Object
>>
statusMaps
=
new
ArrayList
<>();
for
(
ESEquipments
listDatum
:
listData
)
{
...
...
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