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
5a5ca1cf
Commit
5a5ca1cf
authored
Jul 16, 2025
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(core): 添加设备统计无子节点判断功能
parent
9ab4bc81
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
9 deletions
+28
-9
TzsCustomFilterMapper.java
...t/module/statistics/api/mapper/TzsCustomFilterMapper.java
+2
-0
TzsCustomFilterMapper.xml
...s-api/src/main/resources/mapper/TzsCustomFilterMapper.xml
+3
-0
ComprehensiveStatisticalAnalysisServiceImpl.java
...ice/impl/ComprehensiveStatisticalAnalysisServiceImpl.java
+23
-9
No files found.
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/java/com/yeejoin/amos/boot/module/statistics/api/mapper/TzsCustomFilterMapper.java
View file @
5a5ca1cf
...
...
@@ -20,5 +20,7 @@ public interface TzsCustomFilterMapper extends BaseMapper<TzsCustomFilter> {
@MapKey
(
"key"
)
List
<
Map
<
String
,
Object
>>
selectEquipmentCategoryByParentId
(
@Param
(
"parentId"
)
String
parentId
);
Integer
selectEquipmentCategoryCountByParentId
(
@Param
(
"parentId"
)
String
parentId
);
JSONArray
queryEquCategory
(
@Param
(
"type"
)
String
type
,
@Param
(
"description"
)
String
description
);
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/resources/mapper/TzsCustomFilterMapper.xml
View file @
5a5ca1cf
...
...
@@ -25,4 +25,7 @@
AND parent_id = (SELECT id FROM tz_equipment_category where code = #{type})
</if>
</select>
<select
id=
"selectEquipmentCategoryCountByParentId"
resultType=
"java.lang.Integer"
>
select count(1) from tz_equipment_category where is_delete = 0 and parent_id = #{parentId}
</select>
</mapper>
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 @
5a5ca1cf
...
...
@@ -100,6 +100,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
private
final
TzsCustomFilterMapper
tzsCustomFilterMapper
;
private
final
DataDictionaryServiceImpl
dataDictionaryService
;
private
final
EmqKeeper
emqKeeper
;
private
final
EquipmentCategoryMapper
tzEquipmentCategoryMapper
;
private
final
StCommonServiceImpl
stCommonService
;
private
final
RestHighLevelClient
restHighLevelClient
;
...
...
@@ -1628,6 +1629,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
/**
* 需要资质的人员查询构造条件
* 无资质:需要资质但是没有填写
*
* @return
*/
private
BoolQueryBuilder
getNotLicencesBuilderWithPerson
()
{
...
...
@@ -1647,6 +1649,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
/**
* 无资质要求的人员查询构造条件
* 无资质要求:不需要资质
*
* @return
*/
private
BoolQueryBuilder
getNotNeedLicencesBuilderWithPerson
()
{
...
...
@@ -2856,12 +2859,10 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
Long
equipCount
=
staticCountByGroup
.
values
().
stream
().
reduce
(
0L
,
Long:
:
sum
);
tabTotalMap
.
put
(
StatisticalAnalysisEnum
.
equip
.
getCode
(),
equipCount
);
List
<
String
>
codes
=
new
ArrayList
<>();
// 组装数据
List
<
Map
<
String
,
Object
>>
dataMapList
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
categoryMap
:
staticCountByGroupMap
)
{
String
code
=
categoryMap
.
get
(
"value"
).
toString
();
codes
.
add
(
code
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"key"
,
categoryMap
.
get
(
"key"
));
map
.
put
(
"label"
,
categoryMap
.
get
(
"label"
));
...
...
@@ -2869,6 +2870,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
map
.
put
(
"fieldKey"
,
groupField
.
replace
(
"_CODE"
,
""
));
map
.
put
(
"value"
,
staticCountByGroup
.
containsKey
(
code
)
?
staticCountByGroup
.
get
(
code
)
:
0L
);
map
.
put
(
"img"
,
dpEquipPhotoPrefix
+
code
+
dpEquipPhotoSuffix
);
Integer
count
=
tzsCustomFilterMapper
.
selectEquipmentCategoryCountByParentId
(
categoryMap
.
get
(
"key"
).
toString
());
map
.
put
(
"noChild"
,
0
==
count
?
Boolean
.
TRUE
:
Boolean
.
FALSE
);
map
.
put
(
"measurementUnit"
,
"台套"
);
// 统计该分类下的数据完整性的分组数量 DATA_QUALITY_SCORE
BoolQueryBuilder
scoreQuery
=
QueryBuilderUtils
.
copyBoolQuery
(
boolMust
);
...
...
@@ -2888,7 +2891,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
}
// 统计种类/类别/品种数据不对的数据字段
if
(!
ObjectUtils
.
isEmpty
(
staticCountByGroup
))
{
if
(!
ObjectUtils
.
isEmpty
(
staticCountByGroup
))
{
statisticOtherCount
(
request
,
dataMapList
,
staticCountByGroup
,
boolMust
,
groupField
);
}
...
...
@@ -2913,7 +2916,11 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
otherCount
+=
staticCountByGroup
.
get
(
key
);
// 统计该分类下的数据完整性的分组数量 DATA_QUALITY_SCORE
BoolQueryBuilder
scoreQuery
=
QueryBuilderUtils
.
copyBoolQuery
(
boolMust
);
scoreQuery
.
must
(
QueryBuilders
.
termQuery
(
groupField
,
key
));
if
(
key
.
equals
(
"NA"
))
{
scoreQuery
.
mustNot
(
QueryBuilders
.
existsQuery
(
groupField
));
}
else
{
scoreQuery
.
must
(
QueryBuilders
.
termQuery
(
groupField
,
key
));
}
SearchSourceBuilder
scoreBuilder
=
new
SearchSourceBuilder
();
Map
<
String
,
Long
>
scoreCountByGroup
=
new
HashMap
<>();
getStatisticCountByGroup
(
request
,
scoreBuilder
,
scoreQuery
,
"DATA_QUALITY_SCORE"
,
scoreCountByGroup
);
...
...
@@ -2924,7 +2931,11 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
// 统计该分类下红黄绿码分别的分组数量 NEXT_INSPECT_DATE
Map
<
String
,
Long
>
nextInspectCountByGroup
=
new
HashMap
<>();
BoolQueryBuilder
nextInspectQuery
=
QueryBuilderUtils
.
copyBoolQuery
(
boolMust
);
nextInspectQuery
.
must
(
QueryBuilders
.
termQuery
(
groupField
,
key
));
if
(
key
.
equals
(
"NA"
))
{
nextInspectQuery
.
mustNot
(
QueryBuilders
.
existsQuery
(
groupField
));
}
else
{
nextInspectQuery
.
must
(
QueryBuilders
.
termQuery
(
groupField
,
key
));
}
getStatisticCountByDate
(
StatisticalAnalysisEnum
.
equip
.
getKey
(),
"NEXT_INSPECT_DATE"
,
nextInspectQuery
,
nextInspectCountByGroup
);
redCount
+=
nextInspectCountByGroup
.
containsKey
(
"red"
)
?
nextInspectCountByGroup
.
get
(
"red"
)
:
0L
;
yellowCount
+=
nextInspectCountByGroup
.
containsKey
(
"yellow"
)
?
nextInspectCountByGroup
.
get
(
"yellow"
)
:
0L
;
...
...
@@ -2940,12 +2951,12 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
map
.
put
(
"value"
,
otherCount
);
map
.
put
(
"img"
,
dpEquipPhotoPrefix
+
type
+
dpEquipPhotoSuffix
);
map
.
put
(
"measurementUnit"
,
"台套"
);
Map
<
String
,
Long
>
scoreCount
=
new
HashMap
<>();
Map
<
String
,
Long
>
scoreCount
=
new
HashMap
<>();
scoreCount
.
put
(
"1"
,
oneCount
);
scoreCount
.
put
(
"2"
,
twoCount
);
scoreCount
.
put
(
"3"
,
threeCount
);
map
.
put
(
"DATA_QUALITY_SCORE"
,
scoreCount
);
Map
<
String
,
Long
>
nextInspectCount
=
new
HashMap
<>();
Map
<
String
,
Long
>
nextInspectCount
=
new
HashMap
<>();
nextInspectCount
.
put
(
"red"
,
redCount
);
nextInspectCount
.
put
(
"yellow"
,
yellowCount
);
nextInspectCount
.
put
(
"green"
,
greenCount
);
...
...
@@ -2978,9 +2989,12 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
}
private
void
getStatisticCountByGroup
(
SearchRequest
request
,
SearchSourceBuilder
builder
,
BoolQueryBuilder
boolMust
,
String
groupField
,
Map
<
String
,
Long
>
staticCountByGroup
)
{
builder
.
query
(
boolMust
);
builder
.
aggregation
(
AggregationBuilders
.
terms
(
"groupCount"
).
field
(
groupField
).
size
(
50
));
if
(
groupField
.
equals
(
"DATA_QUALITY_SCORE"
))
{
builder
.
aggregation
(
AggregationBuilders
.
terms
(
"groupCount"
).
field
(
groupField
).
missing
(
99
).
size
(
50
));
}
else
{
builder
.
aggregation
(
AggregationBuilders
.
terms
(
"groupCount"
).
field
(
groupField
).
missing
(
"NA"
).
size
(
50
));
}
request
.
source
(
builder
);
try
{
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
...
...
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