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
797bc8e6
Commit
797bc8e6
authored
Jul 17, 2025
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 气瓶提级完善
parent
11ea1e70
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
13 deletions
+67
-13
ComprehensiveStatisticalAnalysisServiceImpl.java
...ice/impl/ComprehensiveStatisticalAnalysisServiceImpl.java
+67
-13
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 @
797bc8e6
...
...
@@ -3011,6 +3011,10 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
}
id
=
jsonObject
.
getString
(
"key"
);
equipCode
=
jsonObject
.
getString
(
"code"
);
// 当前端点击气瓶时候,将分组字段修改为设备类别
if
(
equipCode
.
equals
(
"2300"
))
{
groupField
=
"EQU_DEFINE_CODE"
;
}
staticCountByGroupMap
=
tzsCustomFilterMapper
.
selectEquipmentCategoryByParentId
(
id
);
}
else
{
groupField
=
"EQU_LIST_CODE"
;
...
...
@@ -3020,9 +3024,14 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
boolMust
.
mustNot
(
QueryBuilders
.
termsQuery
(
"STATUS"
,
Arrays
.
asList
(
"草稿"
,
"已拒领"
,
"待认领"
)));
Map
<
String
,
Object
>
staticCountByGroup
=
new
HashMap
<>();
boolMust
.
mustNot
(
QueryBuilders
.
matchQuery
(
"EQU_CATEGORY_CODE"
,
"2300"
));
getStatisticCountByGroup
(
request
,
builder
,
boolMust
,
groupField
,
staticCountByGroup
);
// 组装数据
List
<
Map
<
String
,
Object
>>
dataMapList
=
new
ArrayList
<>();
// 当设备默认进入时候,提前复制前置查询条件,供气瓶提级使用
BoolQueryBuilder
gasBoolQueryBuilder
=
new
BoolQueryBuilder
();
if
(
groupField
.
equals
(
"EQU_LIST_CODE"
))
{
gasBoolQueryBuilder
=
QueryBuilderUtils
.
copyBoolQuery
(
boolMust
);
}
getStatisticCountByGroup
(
request
,
builder
,
boolMust
,
groupField
,
staticCountByGroup
,
"noGas"
);
AtomicReference
<
Long
>
otherCount
=
new
AtomicReference
<>(
0L
);
staticCountByGroup
.
forEach
((
key
,
value
)
->
{
...
...
@@ -3031,14 +3040,17 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
}
});
tabTotalMap
.
put
(
StatisticalAnalysisEnum
.
equip
.
getCode
(),
otherCount
.
toString
());
// 组装数据
List
<
Map
<
String
,
Object
>>
dataMapList
=
new
ArrayList
<>();
List
<
String
>
codes
=
new
ArrayList
<>();
BoolQueryBuilder
pipeBoolMust
=
QueryBuilderUtils
.
copyBoolQuery
(
boolMust
);
for
(
Map
<
String
,
Object
>
categoryMap
:
staticCountByGroupMap
)
{
BoolQueryBuilder
queryBuilder
=
QueryBuilderUtils
.
copyBoolQuery
(
pipeBoolMust
);
String
code
=
categoryMap
.
get
(
"value"
).
toString
();
codes
.
add
(
code
);
if
(
code
.
startsWith
(
"2300"
))
{
staticCountByGroup
.
remove
(
code
);
continue
;
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"key"
,
categoryMap
.
get
(
"key"
));
map
.
put
(
"label"
,
categoryMap
.
get
(
"label"
));
...
...
@@ -3061,7 +3073,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
scoreQuery
.
must
(
QueryBuilders
.
termQuery
(
groupField
,
code
));
SearchSourceBuilder
scoreBuilder
=
new
SearchSourceBuilder
();
Map
<
String
,
Object
>
scoreCountByGroup
=
new
HashMap
<>();
getStatisticCountByGroup
(
request
,
scoreBuilder
,
scoreQuery
,
"DATA_QUALITY_SCORE"
,
scoreCountByGroup
);
getStatisticCountByGroup
(
request
,
scoreBuilder
,
scoreQuery
,
"DATA_QUALITY_SCORE"
,
scoreCountByGroup
,
"scoreCount"
);
map
.
put
(
"DATA_QUALITY_SCORE"
,
scoreCountByGroup
);
// 统计该分类下红黄绿码分别的分组数量 NEXT_INSPECT_DATE
Map
<
String
,
Long
>
nextInspectCountByGroup
=
new
HashMap
<>();
...
...
@@ -3073,6 +3085,48 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
dataMapList
.
add
(
map
);
}
// 将气瓶提级
if
(
groupField
.
equals
(
"EQU_LIST_CODE"
))
{
List
<
Map
<
String
,
Object
>>
gasList
=
new
ArrayList
<>();
Map
<
String
,
Object
>
gas
=
new
HashMap
<>();
String
code
=
"2300"
;
String
fieldKey
=
"EQU_CATEGORY_CODE"
;
gas
.
put
(
"key"
,
"19"
);
gas
.
put
(
"label"
,
"气瓶"
);
gas
.
put
(
"value"
,
code
);
gasList
.
add
(
gas
);
Map
<
String
,
Object
>
gasCountByGroup
=
new
HashMap
<>();
gasBoolQueryBuilder
.
must
(
QueryBuilders
.
matchQuery
(
fieldKey
,
code
));
getStatisticCountByGroup
(
request
,
builder
,
gasBoolQueryBuilder
,
fieldKey
,
gasCountByGroup
,
"gas"
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"key"
,
gas
.
get
(
"key"
));
map
.
put
(
"label"
,
gas
.
get
(
"label"
));
map
.
put
(
"code"
,
gas
.
get
(
"value"
));
map
.
put
(
"fieldKey"
,
fieldKey
.
replace
(
"_CODE"
,
""
));
Object
value
=
gasCountByGroup
.
containsKey
(
code
)
?
gasCountByGroup
.
get
(
code
)
:
0L
;
map
.
put
(
"value"
,
value
);
map
.
put
(
"img"
,
dpEquipPhotoPrefix
+
code
+
dpEquipPhotoSuffix
);
Integer
count
=
tzsCustomFilterMapper
.
selectEquipmentCategoryCountByParentId
(
gas
.
get
(
"key"
).
toString
());
map
.
put
(
"noChild"
,
0
==
count
?
Boolean
.
TRUE
:
Boolean
.
FALSE
);
map
.
put
(
"measurementUnit"
,
"台套"
);
map
.
put
(
"noBottom"
,
Boolean
.
TRUE
);
// 统计该分类下的数据完整性的分组数量 DATA_QUALITY_SCORE
BoolQueryBuilder
scoreQuery
=
QueryBuilderUtils
.
copyBoolQuery
(
boolMust
);
scoreQuery
.
must
(
QueryBuilders
.
termQuery
(
fieldKey
,
code
));
SearchSourceBuilder
scoreBuilder
=
new
SearchSourceBuilder
();
Map
<
String
,
Object
>
scoreCountByGroup
=
new
HashMap
<>();
getStatisticCountByGroup
(
request
,
scoreBuilder
,
scoreQuery
,
"DATA_QUALITY_SCORE"
,
scoreCountByGroup
,
"scoreCount"
);
map
.
put
(
"DATA_QUALITY_SCORE"
,
scoreCountByGroup
);
// 统计该分类下红黄绿码分别的分组数量 NEXT_INSPECT_DATE
Map
<
String
,
Long
>
nextInspectCountByGroup
=
new
HashMap
<>();
BoolQueryBuilder
nextInspectQuery
=
QueryBuilderUtils
.
copyBoolQuery
(
boolMust
);
nextInspectQuery
.
must
(
QueryBuilders
.
termQuery
(
fieldKey
,
code
));
getStatisticCountByDate
(
StatisticalAnalysisEnum
.
equip
.
getKey
(),
"NEXT_INSPECT_DATE"
,
nextInspectQuery
,
nextInspectCountByGroup
);
map
.
put
(
"NEXT_INSPECT_DATE"
,
nextInspectCountByGroup
);
dataMapList
.
add
(
map
);
boolMust
.
mustNot
(
QueryBuilders
.
matchQuery
(
"EQU_CATEGORY_CODE"
,
"2300"
));
}
BigDecimal
otherPipeLength
=
new
BigDecimal
(
0
);
// 其他种类的
if
(!
groupField
.
equals
(
"EQU_LIST_CODE"
)
&&
!
ObjectUtils
.
isEmpty
(
equipCode
)
&&
equipCode
.
startsWith
(
"8"
))
{
...
...
@@ -3136,7 +3190,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
}
SearchSourceBuilder
scoreBuilder
=
new
SearchSourceBuilder
();
Map
<
String
,
Object
>
scoreCountByGroup
=
new
HashMap
<>();
getStatisticCountByGroup
(
request
,
scoreBuilder
,
scoreQuery
,
"DATA_QUALITY_SCORE"
,
scoreCountByGroup
);
getStatisticCountByGroup
(
request
,
scoreBuilder
,
scoreQuery
,
"DATA_QUALITY_SCORE"
,
scoreCountByGroup
,
"scoreCount"
);
oneCount
+=
scoreCountByGroup
.
containsKey
(
"1"
)
?
(
Long
)
scoreCountByGroup
.
get
(
"1"
)
:
0L
;
twoCount
+=
scoreCountByGroup
.
containsKey
(
"2"
)
?
(
Long
)
scoreCountByGroup
.
get
(
"2"
)
:
0L
;
threeCount
+=
scoreCountByGroup
.
containsKey
(
"3"
)
?
(
Long
)
scoreCountByGroup
.
get
(
"3"
)
:
0L
;
...
...
@@ -3163,8 +3217,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
map
.
put
(
"noChild"
,
Boolean
.
TRUE
);
map
.
put
(
"value"
,
isOther
?
otherPipeLength
:
otherCount
);
map
.
put
(
"img"
,
dpEquipPhotoPrefix
+
type
+
dpEquipPhotoSuffix
);
map
.
put
(
"measurementUnit"
,
equipCode
!=
null
&&
equipCode
.
startsWith
(
"8"
)
?
"千米"
:
"台套"
);
map
.
put
(
"noBottom"
,
equipCode
!=
null
&&
equipCode
.
startsWith
(
"8"
)
?
Boolean
.
TRUE
:
Boolean
.
FALSE
);
map
.
put
(
"measurementUnit"
,
equipCode
!=
null
&&
equipCode
.
startsWith
(
"8"
)
?
"千米"
:
"台套"
);
map
.
put
(
"noBottom"
,
equipCode
!=
null
&&
equipCode
.
startsWith
(
"8"
)
?
Boolean
.
TRUE
:
Boolean
.
FALSE
);
Map
<
String
,
Long
>
scoreCount
=
new
HashMap
<>();
scoreCount
.
put
(
"1"
,
oneCount
);
scoreCount
.
put
(
"2"
,
twoCount
);
...
...
@@ -3202,17 +3256,17 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
nextInspectCountByGroup
.
put
(
"gray"
,
noFieldCount
);
}
private
void
getStatisticCountByGroup
(
SearchRequest
request
,
SearchSourceBuilder
builder
,
BoolQueryBuilder
boolMust
,
String
groupField
,
Map
<
String
,
Object
>
staticCountByGroup
)
{
private
void
getStatisticCountByGroup
(
SearchRequest
request
,
SearchSourceBuilder
builder
,
BoolQueryBuilder
boolMust
,
String
groupField
,
Map
<
String
,
Object
>
staticCountByGroup
,
String
groupKey
)
{
builder
.
query
(
boolMust
);
if
(
groupField
.
equals
(
"DATA_QUALITY_SCORE"
))
{
builder
.
aggregation
(
AggregationBuilders
.
terms
(
"groupCount"
).
field
(
groupField
).
missing
(
99
).
size
(
50
));
builder
.
aggregation
(
AggregationBuilders
.
terms
(
groupKey
).
field
(
groupField
).
missing
(
99
).
size
(
50
));
}
else
{
builder
.
aggregation
(
AggregationBuilders
.
terms
(
"groupCount"
).
field
(
groupField
).
missing
(
"NA"
).
size
(
50
));
builder
.
aggregation
(
AggregationBuilders
.
terms
(
groupKey
).
field
(
groupField
).
missing
(
"NA"
).
size
(
50
));
}
request
.
source
(
builder
);
try
{
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
Terms
terms
=
response
.
getAggregations
().
get
(
"groupCount"
);
Terms
terms
=
response
.
getAggregations
().
get
(
groupKey
);
for
(
Terms
.
Bucket
bucket
:
terms
.
getBuckets
())
{
staticCountByGroup
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
());
}
...
...
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