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
cfe940d8
Commit
cfe940d8
authored
Sep 14, 2023
by
zhangsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公共方法添加
parent
033f6fee
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
10 deletions
+58
-10
CommonConstans.java
.../amos/boot/module/jxiop/biz/constants/CommonConstans.java
+1
-0
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+48
-2
MonitorFanIndicatorImpl.java
...odule/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
+9
-8
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 @
cfe940d8
...
...
@@ -85,6 +85,7 @@ public class CommonConstans {
public
static
final
String
QueryStringSystemType
=
"systemType"
;
public
static
final
String
QueryStringEquipmentNumber
=
"equipmentNumber"
;
public
static
final
String
QueryStringValue
=
"value"
;
public
static
final
String
QueryStringValueKeyword
=
"value.keyword"
;
public
static
final
String
QueryStringDataType
=
"dataType"
;
public
static
final
String
QueryStringDisplayName
=
"displayName"
;
public
static
final
String
QueryStringIsAlarm
=
"isAlarm"
;
...
...
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 @
cfe940d8
...
...
@@ -461,8 +461,51 @@ public class CommonServiceImpl {
}
if
(!
ObjectUtils
.
isEmpty
(
shouldQuerCondtion
))
{
for
(
String
key
:
shouldQuerCondtion
.
keySet
())
{
// queryBuilder.should(QueryBuilders.wildcardQuery(key, shouldQuerCondtion.get(key)));
queryBuilder
.
must
(
QueryBuilders
.
matchQuery
(
key
,
shouldQuerCondtion
.
get
(
key
)));
queryBuilder
.
should
(
QueryBuilders
.
wildcardQuery
(
key
,
shouldQuerCondtion
.
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
;
}
/**
* 根据查询条件获取列表信息
*
* @param mustQuerCondtion
* @param shouldQuerCondtion
* @param tClass
* @param <T>
* @param likeMap 模糊字段查询
* @return
*/
public
<
T
>
List
<
T
>
getListDataByCondtionsAndLike
(
Map
<
String
,
List
<
String
>>
mustQuerCondtion
,
Map
<
String
,
String
>
shouldQuerCondtion
,
Class
<
T
>
tClass
,
Map
<
String
,
String
>
likeMap
)
{
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
(
likeMap
))
{
for
(
String
key
:
likeMap
.
keySet
())
{
MatchPhraseQueryBuilder
queryBuilder1
=
QueryBuilders
.
matchPhraseQuery
(
key
,
"*"
+
likeMap
.
get
(
key
)
+
"*"
);
queryBuilder
.
must
(
queryBuilder1
);
}
}
...
...
@@ -478,6 +521,9 @@ 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
))
{
...
...
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 @
cfe940d8
...
...
@@ -787,7 +787,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Map
<
String
,
List
<
String
>>
queryCondtion
=
new
HashMap
<>();
queryCondtion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
gatewayId
));
Map
<
String
,
String
>
shouldCodtion
=
new
HashMap
<>();
shouldCodtion
.
put
(
CommonConstans
.
QueryStringFrontMoudle
,
frontModule
);
shouldCodtion
.
put
(
"frontModule"
,
frontModule
);
shouldCodtion
.
put
(
CommonConstans
.
QueryStringDisplayName
,
"合位"
);
List
<
ESEquipments
>
listData
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
shouldCodtion
,
ESEquipments
.
class
);
List
<
Map
<
String
,
Object
>>
statusMaps
=
new
ArrayList
<>();
...
...
@@ -1697,21 +1697,21 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
queryConditon
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
Arrays
.
asList
(
"总直流功率"
));
queryConditon
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
gatewayId
));
Map
<
String
,
String
>
shouldConditon
=
new
HashMap
<>();
shouldConditon
.
put
(
CommonConstans
.
QueryString
EquipmentIndexNam
e
,
"逆变器"
);
shouldConditon
.
put
(
CommonConstans
.
QueryString
FrontMoudl
e
,
"逆变器"
);
List
<
ESEquipments
>
listData
=
commonServiceImpl
.
getListDataByCondtions
(
queryConditon
,
shouldConditon
,
ESEquipments
.
class
);
Map
<
String
,
List
<
String
>>
queryConditon1
=
new
HashMap
<>();
queryConditon1
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
Arrays
.
asList
(
"有功功率"
));
queryConditon1
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
gatewayId
));
Map
<
String
,
String
>
shouldConditon1
=
new
HashMap
<>();
shouldConditon1
.
put
(
CommonConstans
.
QueryString
EquipmentIndexNam
e
,
"逆变器"
);
List
<
ESEquipments
>
listData1
=
commonServiceImpl
.
getListDataByCondtions
(
queryConditon
,
shouldConditon
,
ESEquipments
.
class
);
shouldConditon1
.
put
(
CommonConstans
.
QueryString
FrontMoudl
e
,
"逆变器"
);
List
<
ESEquipments
>
listData1
=
commonServiceImpl
.
getListDataByCondtions
(
queryConditon
1
,
shouldConditon1
,
ESEquipments
.
class
);
// 将两组数据合并成一个集合中 将总直流功率数据 放入 另一个集合的valueLable中
for
(
ESEquipments
listDatum
:
listData
)
{
for
(
ESEquipments
esEquipments
:
listData1
)
{
if
(
esEquipments
.
getEquipmentNumber
().
equals
(
listDatum
.
getEquipmentNumber
()))
{
esEquipments
.
setValueLabel
(
listDatum
.
getValue
());
esEquipments
.
setValueLabel
(
listDatum
.
getValue
Double
().
toString
());
}
}
}
...
...
@@ -1726,7 +1726,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
,
Double
.
parseDouble
(
esEquipments
.
getValue
Double
().
toString
())));
map
.
put
(
"valueLabel"
+
number
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
Double
.
parseDouble
(
esEquipments
.
getValueLabel
())));
map
.
put
(
"state"
+
number
,
equipStatesMap
.
get
(
esEquipments
.
getEquipmentNumber
()));
maps
.
add
(
map
);
...
...
@@ -2045,8 +2045,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List
<
ESEquipments
>
totalEquipmentList
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondition
,
shouldCondition
,
ESEquipments
.
class
);
totalEquipmentList
.
forEach
(
indicatorsDto
->
result
.
put
(
indicatorsDto
.
getEquipmentNumber
(),
"正常运行"
));
Map
<
String
,
List
<
String
>>
queryCondition1
=
new
HashMap
<>();
queryCondition
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
Arrays
.
asList
(
"运行"
,
"待机"
,
"故障停机"
,
"告警运行"
,
"限额运行"
,
"停机"
,
"通讯故障"
,
"'降额运行'"
));
queryCondition
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
gatewayId
));
queryCondition1
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
Arrays
.
asList
(
"运行"
,
"待机"
,
"故障停机"
,
"告警运行"
,
"限额运行"
,
"停机"
,
"通讯故障"
,
"'降额运行'"
));
queryCondition1
.
put
(
CommonConstans
.
QueryStringValueKeyword
,
Arrays
.
asList
(
"true"
));
queryCondition1
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
gatewayId
));
List
<
ESEquipments
>
indicatorsDtoList
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondition1
,
shouldCondition
,
ESEquipments
.
class
);
indicatorsDtoList
.
forEach
(
esEquipments
->
{
if
(!
"运行"
.
equals
(
esEquipments
.
getEquipmentIndexName
()))
{
...
...
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