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
1c06a8df
Commit
1c06a8df
authored
Jul 11, 2025
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增设备状态统计方法
parent
c1bc90f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
1 deletion
+38
-1
ComprehensiveStatisticalAnalysisServiceImpl.java
...ice/impl/ComprehensiveStatisticalAnalysisServiceImpl.java
+38
-1
No files found.
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/service/impl/ComprehensiveStatisticalAnalysisServiceImpl.java
View file @
1c06a8df
...
@@ -49,6 +49,7 @@ import org.elasticsearch.index.query.TermsQueryBuilder;
...
@@ -49,6 +49,7 @@ import org.elasticsearch.index.query.TermsQueryBuilder;
import
org.elasticsearch.search.SearchHit
;
import
org.elasticsearch.search.SearchHit
;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.bucket.nested.ParsedNested
;
import
org.elasticsearch.search.aggregations.bucket.nested.ParsedNested
;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.metrics.ParsedSum
;
import
org.elasticsearch.search.aggregations.metrics.ParsedSum
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.elasticsearch.search.sort.FieldSortBuilder
;
import
org.elasticsearch.search.sort.FieldSortBuilder
;
...
@@ -964,7 +965,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -964,7 +965,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
sum
.
put
(
"name"
,
"设备总数(台套)"
);
sum
.
put
(
"name"
,
"设备总数(台套)"
);
sum
.
put
(
"value"
,
totle
);
sum
.
put
(
"value"
,
totle
);
statics
.
add
(
sum
);
statics
.
add
(
sum
);
getEquipStatusStatic
(
boolMust
,
builder
,
statics
);
if
(
ObjectUtils
.
isEmpty
(
filterParams
)
||
!
filterParams
.
containsKey
(
"EQU_LIST"
))
{
if
(
ObjectUtils
.
isEmpty
(
filterParams
)
||
!
filterParams
.
containsKey
(
"EQU_LIST"
))
{
filterParams
=
new
JSONObject
();
filterParams
=
new
JSONObject
();
JSONArray
jsonArray
=
new
JSONArray
();
JSONArray
jsonArray
=
new
JSONArray
();
...
@@ -1004,6 +1005,42 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -1004,6 +1005,42 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
return
result
;
return
result
;
}
}
private
void
getEquipStatusStatic
(
BoolQueryBuilder
boolMust
,
SearchSourceBuilder
builder
,
List
<
Map
<
String
,
Object
>>
statics
)
{
SearchRequest
request
=
new
SearchRequest
();
request
.
indices
(
StatisticalAnalysisEnum
.
equip
.
getKey
());
builder
.
query
(
boolMust
);
builder
.
aggregation
(
AggregationBuilders
.
terms
(
"equipStatus"
).
field
(
"EQU_STATE"
).
missing
(
99
));
request
.
source
(
builder
);
Map
<
String
,
Long
>
staticsMap
=
new
HashMap
<>();
try
{
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
Terms
terms
=
response
.
getAggregations
().
get
(
"equipStatus"
);
for
(
Terms
.
Bucket
bucket
:
terms
.
getBuckets
())
{
String
key
=
bucket
.
getKeyAsString
();
long
docCount
=
bucket
.
getDocCount
();
staticsMap
.
put
(
key
,
docCount
);
}
Map
<
String
,
Object
>
zyMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
tyMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
otherMap
=
new
HashMap
<>();
long
zy
=
staticsMap
.
get
(
EquipStateEnum
.
ZY
.
getCode
());
long
ty
=
staticsMap
.
get
(
EquipStateEnum
.
TY
.
getCode
());
long
other
=
staticsMap
.
get
(
"0"
)
+
staticsMap
.
get
(
EquipStateEnum
.
BF
.
getCode
())
+
staticsMap
.
get
(
EquipStateEnum
.
ZX
.
getCode
())
+
staticsMap
.
get
(
EquipStateEnum
.
WZT
.
getCode
());
zyMap
.
put
(
"name"
,
"在用"
);
zyMap
.
put
(
"value"
,
zy
);
tyMap
.
put
(
"name"
,
"停用"
);
tyMap
.
put
(
"value"
,
ty
);
otherMap
.
put
(
"name"
,
"其他"
);
otherMap
.
put
(
"value"
,
other
);
statics
.
add
(
zyMap
);
statics
.
add
(
tyMap
);
statics
.
add
(
otherMap
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
private
BigDecimal
getPipeLength
(
BoolQueryBuilder
boolMust
,
SearchSourceBuilder
builder
)
{
private
BigDecimal
getPipeLength
(
BoolQueryBuilder
boolMust
,
SearchSourceBuilder
builder
)
{
SearchRequest
request
=
new
SearchRequest
();
SearchRequest
request
=
new
SearchRequest
();
request
.
indices
(
StatisticalAnalysisEnum
.
equip
.
getKey
());
request
.
indices
(
StatisticalAnalysisEnum
.
equip
.
getKey
());
...
...
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