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
ad0f5d43
Commit
ad0f5d43
authored
Jul 17, 2025
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(amos-boot-module-statistics): 优化设备总数统计逻辑- 修改了设备总数统计方法,不再直接使用 countMap 的总和
- 新增 queryHasSupervisoryCodeEquipCount 方法,专门用于统计已赋码设备数量
parent
8338e8fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
1 deletion
+42
-1
StCommonServiceImpl.java
...odule/statistcs/biz/service/impl/StCommonServiceImpl.java
+42
-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/StCommonServiceImpl.java
View file @
ad0f5d43
...
@@ -302,7 +302,8 @@ public class StCommonServiceImpl {
...
@@ -302,7 +302,8 @@ public class StCommonServiceImpl {
result
.
put
(
this
.
castCategoryCode2WebCode
(
c
.
getCode
()),
countMap
.
getOrDefault
(
c
.
getCode
(),
0L
));
result
.
put
(
this
.
castCategoryCode2WebCode
(
c
.
getCode
()),
countMap
.
getOrDefault
(
c
.
getCode
(),
0L
));
});
});
// 注意,求总数时:countMap不包括气瓶数量、压力管道数量(20240819修改)
// 注意,求总数时:countMap不包括气瓶数量、压力管道数量(20240819修改)
result
.
put
(
DPMapStatisticsItemEnum
.
TOTAL
.
getCode
(),
countMap
.
values
().
stream
().
mapToLong
(
e
->
e
).
sum
());
// 总数为已赋码设备数量,需要单独统计
result
.
put
(
DPMapStatisticsItemEnum
.
TOTAL
.
getCode
(),
queryHasSupervisoryCodeEquipCount
(
orgCode
,
isOrgBranchCodeExactMatch
,
cylinderNum
));
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
@@ -310,6 +311,46 @@ public class StCommonServiceImpl {
...
@@ -310,6 +311,46 @@ public class StCommonServiceImpl {
return
(
long
)
result
.
getOrDefault
(
DPMapStatisticsItemEnum
.
TOTAL
.
getCode
(),
0L
);
return
(
long
)
result
.
getOrDefault
(
DPMapStatisticsItemEnum
.
TOTAL
.
getCode
(),
0L
);
}
}
/**
* 统计已赋码设备数量
* @param orgCode
* @param isOrgBranchCodeExactMatch
* @param cylinderNum
* @return
*/
public
long
queryHasSupervisoryCodeEquipCount
(
String
orgCode
,
Boolean
isOrgBranchCodeExactMatch
,
long
cylinderNum
)
{
CountRequest
request
=
new
CountRequest
();
request
.
indices
(
"idx_biz_view_jg_all"
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
if
(
isOrgBranchCodeExactMatch
)
{
// 按照管辖机构区域信息精确查询
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgCode
)));
}
else
{
// 按照管辖机构区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgCode
)
+
"*"
));
}
//已赋码
boolMust
.
must
(
QueryBuilders
.
existsQuery
(
"SUPERVISORY_CODE"
));
boolMust
.
mustNot
(
QueryBuilders
.
termQuery
(
"SUPERVISORY_CODE"
,
"null"
));
//状态为已认领
String
[]
status
=
{
"草稿"
,
"已拒领"
,
"待认领"
};
boolMust
.
mustNot
(
QueryBuilders
.
termsQuery
(
"STATUS"
,
Arrays
.
asList
(
status
)));
// 且8大类,目的去掉脏数据。去掉管道统计
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
StCommonServiceImpl
.
getEquipmentCategory
().
stream
().
map
(
EquipmentCategoryDto:
:
getCode
).
filter
(
code
->
!
code
.
equals
(
EquipmentClassifityEnum
.
YLGD
.
getCode
())).
collect
(
Collectors
.
toList
())));
// 排除气瓶
boolMust
.
mustNot
(
QueryBuilders
.
termsQuery
(
"EQU_CATEGORY_CODE"
,
EQU_CATEGORY_CYLINDER
));
request
.
query
(
boolMust
);
long
count
;
try
{
CountResponse
response
=
restHighLevelClient
.
count
(
request
,
RequestOptions
.
DEFAULT
);
count
=
response
.
getCount
();
return
count
;
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
private
String
castCategoryCode2WebCode
(
String
category
)
{
private
String
castCategoryCode2WebCode
(
String
category
)
{
DPMapStatisticsItemEnum
itemEnum
=
DPMapStatisticsItemEnum
.
getInstanceByCategory
(
category
);
DPMapStatisticsItemEnum
itemEnum
=
DPMapStatisticsItemEnum
.
getInstanceByCategory
(
category
);
return
itemEnum
.
getCode
();
return
itemEnum
.
getCode
();
...
...
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