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
cb2ac403
Commit
cb2ac403
authored
Mar 28, 2025
by
韩桐桐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
大屏应急统计调整
parent
8043834c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
YJDPStatisticsServiceImpl.java
...statistcs/biz/service/impl/YJDPStatisticsServiceImpl.java
+25
-4
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/YJDPStatisticsServiceImpl.java
View file @
cb2ac403
...
@@ -41,7 +41,6 @@ import org.elasticsearch.search.aggregations.AggregationBuilders;
...
@@ -41,7 +41,6 @@ import org.elasticsearch.search.aggregations.AggregationBuilders;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder
;
import
org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
...
@@ -97,6 +96,10 @@ public class YJDPStatisticsServiceImpl {
...
@@ -97,6 +96,10 @@ public class YJDPStatisticsServiceImpl {
* 电梯设备品种
* 电梯设备品种
*/
*/
private
final
static
String
ELEVATOR_EQU_DEFINE_CODES
=
"3410,3420,3430,3310,3320,3210,3220,3120,3130,3110"
;
private
final
static
String
ELEVATOR_EQU_DEFINE_CODES
=
"3410,3420,3430,3310,3320,3210,3220,3120,3130,3110"
;
/**
* 电梯种类
*/
private
final
static
String
ELEVATOR_EQU_LIST_CODE
=
"3000"
;
public
YJDPStatisticsServiceImpl
(
AlertCalledMapper
alertCalledMapper
,
AlertRescueStatisticsMapper
alertRescueStatisticsMapper
,
AlertUseUnitStatisticsMapper
alertUseUnitStatisticsMapper
,
AlertStatisticsMapper
alertStatisticsMapper
,
DispatchTaskMapper
dispatchTaskMapper
,
RestHighLevelClient
restHighLevelClient
,
StCommonServiceImpl
stCommonService
,
DataDictionaryServiceImpl
dataDictionaryService
)
{
public
YJDPStatisticsServiceImpl
(
AlertCalledMapper
alertCalledMapper
,
AlertRescueStatisticsMapper
alertRescueStatisticsMapper
,
AlertUseUnitStatisticsMapper
alertUseUnitStatisticsMapper
,
AlertStatisticsMapper
alertStatisticsMapper
,
DispatchTaskMapper
dispatchTaskMapper
,
RestHighLevelClient
restHighLevelClient
,
StCommonServiceImpl
stCommonService
,
DataDictionaryServiceImpl
dataDictionaryService
)
{
...
@@ -463,7 +466,17 @@ public class YJDPStatisticsServiceImpl {
...
@@ -463,7 +466,17 @@ public class YJDPStatisticsServiceImpl {
Map
<
String
,
Long
>
alertTypeNumMap
=
countDtos
.
stream
().
collect
(
Collectors
.
toMap
(
CountDto:
:
getKeyStr
,
CountDto:
:
getLongValue
));
Map
<
String
,
Long
>
alertTypeNumMap
=
countDtos
.
stream
().
collect
(
Collectors
.
toMap
(
CountDto:
:
getKeyStr
,
CountDto:
:
getLongValue
));
Map
<
String
,
Long
>
equDefineNumMap
=
staticsElevatorByEquDefine
(
filterParamDto
.
getCityCode
());
Map
<
String
,
Long
>
equDefineNumMap
=
staticsElevatorByEquDefine
(
filterParamDto
.
getCityCode
());
// 电梯总量(台)
// 电梯总量(台)
result
.
put
(
"dtCount"
,
equDefineNumMap
.
values
().
stream
().
mapToLong
(
e
->
e
).
sum
());
Long
dtCount
=
equDefineNumMap
.
getOrDefault
(
ELEVATOR_EQU_LIST_CODE
,
0L
);
result
.
put
(
"dtCount"
,
dtCount
);
// 无设备品种的电梯数量(台)
long
dtEquDefineCount
=
equDefineNumMap
.
entrySet
()
.
stream
()
.
filter
(
entry
->
!
ELEVATOR_EQU_LIST_CODE
.
equals
(
entry
.
getKey
()))
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
))
.
values
()
.
stream
()
.
mapToLong
(
e
->
e
).
sum
();
result
.
put
(
"dtCountNotEquDefine"
,
dtCount
-
dtEquDefineCount
);
// 曳引驱动乘客电梯(台)
// 曳引驱动乘客电梯(台)
result
.
put
(
"zyqdcjdtCount"
,
equDefineNumMap
.
getOrDefault
(
"3110"
,
0L
));
result
.
put
(
"zyqdcjdtCount"
,
equDefineNumMap
.
getOrDefault
(
"3110"
,
0L
));
// 曳引驱动载货电梯(台)
// 曳引驱动载货电梯(台)
...
@@ -560,16 +573,24 @@ public class YJDPStatisticsServiceImpl {
...
@@ -560,16 +573,24 @@ public class YJDPStatisticsServiceImpl {
// 且设备品种3级,按照真实的过滤,防止有脏数据
// 且设备品种3级,按照真实的过滤,防止有脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_DEFINE_CODE.keyword"
,
ELEVATOR_EQU_DEFINE_CODES
.
split
(
","
)));
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_DEFINE_CODE.keyword"
,
ELEVATOR_EQU_DEFINE_CODES
.
split
(
","
)));
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
ELEVATOR_EQU_LIST_CODE
));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
builder
.
query
(
boolMust
);
builder
.
size
(
0
);
// 原因默认10个,由于业务最多有10个,担心有脏数据,故多查询
// 原因默认10个,由于业务最多有10个,担心有脏数据,故多查询
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"count_by_equ_define_code"
).
field
(
"EQU_DEFINE_CODE.keyword"
).
size
(
20
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"count_by_equ_define_code"
).
field
(
"EQU_DEFINE_CODE.keyword"
).
size
(
20
);
builder
.
aggregation
(
aggregationBuilder
);
builder
.
aggregation
(
aggregationBuilder
);
TermsAggregationBuilder
aggregationBuilder1
=
AggregationBuilders
.
terms
(
"count_by_equ_list_code"
).
field
(
"EQU_LIST_CODE"
).
size
(
20
);
builder
.
aggregation
(
aggregationBuilder1
);
request
.
source
(
builder
);
request
.
source
(
builder
);
try
{
try
{
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
Terms
terms
=
response
.
getAggregations
().
get
(
"count_by_equ_define_code"
);
Terms
equDefineTerms
=
response
.
getAggregations
().
get
(
"count_by_equ_define_code"
);
for
(
Terms
.
Bucket
bucket
:
terms
.
getBuckets
())
{
for
(
Terms
.
Bucket
bucket
:
equDefineTerms
.
getBuckets
())
{
countMap
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
());
}
Terms
equListTerms
=
response
.
getAggregations
().
get
(
"count_by_equ_list_code"
);
for
(
Terms
.
Bucket
bucket
:
equListTerms
.
getBuckets
())
{
countMap
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
());
countMap
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
());
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
...
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