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
63dd1137
Commit
63dd1137
authored
Aug 09, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.统一设备过滤8大类 不使用脏数据
parent
d3564cca
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
23 deletions
+58
-23
JGDPStatisticsServiceImpl.java
...statistcs/biz/service/impl/JGDPStatisticsServiceImpl.java
+17
-3
JYJCDPStatisticsServiceImpl.java
...atistcs/biz/service/impl/JYJCDPStatisticsServiceImpl.java
+8
-0
StCommonServiceImpl.java
...odule/statistcs/biz/service/impl/StCommonServiceImpl.java
+11
-8
YJDPStatisticsServiceImpl.java
...statistcs/biz/service/impl/YJDPStatisticsServiceImpl.java
+3
-4
ZLDPStatisticsServiceImpl.java
...statistcs/biz/service/impl/ZLDPStatisticsServiceImpl.java
+19
-8
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/JGDPStatisticsServiceImpl.java
View file @
63dd1137
...
...
@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import
com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
...
...
@@ -409,7 +410,9 @@ public class JGDPStatisticsServiceImpl {
// 按照管辖机构区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgCode
)
+
"*"
));
// 设备状态过滤
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_STATE"
,
states
));
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_STATE"
,
Arrays
.
asList
(
states
)));
// 且8大类,目的去掉脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
StCommonServiceImpl
.
getEquipmentCategory
().
stream
().
map
(
EquipmentCategoryDto:
:
getCode
).
collect
(
Collectors
.
toList
())));
request
.
query
(
boolMust
);
try
{
CountResponse
response
=
restHighLevelClient
.
count
(
request
,
RequestOptions
.
DEFAULT
);
...
...
@@ -449,7 +452,7 @@ public class JGDPStatisticsServiceImpl {
* @return 临期设备的数量
*/
private
Long
staticsCenterMapCountDateTemporary
(
DPFilterParamDto
dpFilterParamDto
)
{
long
num
=
0
;
long
num
;
CountRequest
request
=
new
CountRequest
();
request
.
indices
(
"idx_biz_view_jg_all"
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
...
...
@@ -466,6 +469,8 @@ public class JGDPStatisticsServiceImpl {
// 且查询 下次检验日期 <= 当前天+30天 极为临期
long
currentDayAfter30DayTime
=
DateUtil
.
offsetDay
(
DateUtil
.
parse
(
DateUtil
.
today
(),
"yyy-MM-dd"
),
30
).
getTime
();
boolMust
.
must
(
QueryBuilders
.
rangeQuery
(
"NEXT_INSPECT_DATE"
).
gte
(
currentDayTime
).
lte
(
currentDayAfter30DayTime
));
// 且8大类,目的去掉脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
StCommonServiceImpl
.
getEquipmentCategory
().
stream
().
map
(
EquipmentCategoryDto:
:
getCode
).
collect
(
Collectors
.
toList
())));
request
.
query
(
boolMust
);
try
{
CountResponse
response
=
restHighLevelClient
.
count
(
request
,
RequestOptions
.
DEFAULT
);
...
...
@@ -499,6 +504,8 @@ public class JGDPStatisticsServiceImpl {
// 查询下次检验日期小于当前天的设备,即为超期检验超期设备
long
currentDayTime
=
DateUtil
.
parse
(
DateUtil
.
now
(),
"yyy-MM-dd"
).
getTime
();
boolMust
.
must
(
QueryBuilders
.
rangeQuery
(
"NEXT_INSPECT_DATE"
).
lt
(
currentDayTime
));
// 且8大类,目的去掉脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
StCommonServiceImpl
.
getEquipmentCategory
().
stream
().
map
(
EquipmentCategoryDto:
:
getCode
).
collect
(
Collectors
.
toList
())));
request
.
query
(
boolMust
);
try
{
CountResponse
response
=
restHighLevelClient
.
count
(
request
,
RequestOptions
.
DEFAULT
);
...
...
@@ -699,6 +706,8 @@ public class JGDPStatisticsServiceImpl {
}
// 按照管辖机构区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgCode
)
+
"*"
));
// 且8大类,目的去掉脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
StCommonServiceImpl
.
getEquipmentCategory
().
stream
().
map
(
EquipmentCategoryDto:
:
getCode
).
collect
(
Collectors
.
toList
())));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"EQU_STATE_COUNT"
).
field
(
"EQU_STATE"
).
size
(
20
);
...
...
@@ -744,6 +753,8 @@ public class JGDPStatisticsServiceImpl {
if
(
orgCode
!=
null
)
{
// 按照管辖机构区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgCode
)
+
"*"
));
// 且8大类,目的去掉脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
StCommonServiceImpl
.
getEquipmentCategory
().
stream
().
map
(
EquipmentCategoryDto:
:
getCode
).
collect
(
Collectors
.
toList
())));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
// 设备状态
...
...
@@ -1423,6 +1434,8 @@ public class JGDPStatisticsServiceImpl {
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
// 按照管辖机构区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgCode
)
+
"*"
));
// 且8大类,目的去掉脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
StCommonServiceImpl
.
getEquipmentCategory
().
stream
().
map
(
EquipmentCategoryDto:
:
getCode
).
collect
(
Collectors
.
toList
())));
request
.
query
(
boolMust
);
try
{
CountResponse
response
=
restHighLevelClient
.
count
(
request
,
RequestOptions
.
DEFAULT
);
...
...
@@ -1629,7 +1642,8 @@ public class JGDPStatisticsServiceImpl {
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgCode
)
+
"*"
));
// 设备类别精确查询气瓶
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
true
));
// 且8大类,目的去掉脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
StCommonServiceImpl
.
getEquipmentCategory
().
stream
().
map
(
EquipmentCategoryDto:
:
getCode
).
collect
(
Collectors
.
toList
())));
request
.
query
(
boolMust
);
try
{
CountResponse
response
=
restHighLevelClient
.
count
(
request
,
RequestOptions
.
DEFAULT
);
...
...
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/JYJCDPStatisticsServiceImpl.java
View file @
63dd1137
...
...
@@ -426,6 +426,8 @@ public class JYJCDPStatisticsServiceImpl {
// 且查询 下次检验日期 <= 当前天+30天 极为临期
long
currentDayAfter30DayTime
=
DateUtil
.
offsetDay
(
DateUtil
.
parse
(
DateUtil
.
today
(),
"yyy-MM-dd"
),
30
).
getTime
();
boolMust
.
must
(
QueryBuilders
.
rangeQuery
(
"NEXT_INSPECT_DATE"
).
gte
(
currentDayTime
).
lte
(
currentDayAfter30DayTime
));
// 且8大类,目的去掉脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
StCommonServiceImpl
.
getEquipmentCategory
().
stream
().
map
(
EquipmentCategoryDto:
:
getCode
).
collect
(
Collectors
.
toList
())));
request
.
query
(
boolMust
);
try
{
CountResponse
response
=
restHighLevelClient
.
count
(
request
,
RequestOptions
.
DEFAULT
);
...
...
@@ -449,6 +451,8 @@ public class JYJCDPStatisticsServiceImpl {
// 查询下次检验日期小于当前天的设备,即为超期检验超期设备
long
currentDayTime
=
DateUtil
.
parse
(
DateUtil
.
now
(),
"yyy-MM-dd"
).
getTime
();
boolMust
.
must
(
QueryBuilders
.
rangeQuery
(
"NEXT_INSPECT_DATE"
).
lt
(
currentDayTime
));
// 且8大类,目的去掉脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
StCommonServiceImpl
.
getEquipmentCategory
().
stream
().
map
(
EquipmentCategoryDto:
:
getCode
).
collect
(
Collectors
.
toList
())));
request
.
query
(
boolMust
);
try
{
CountResponse
response
=
restHighLevelClient
.
count
(
request
,
RequestOptions
.
DEFAULT
);
...
...
@@ -519,6 +523,8 @@ public class JYJCDPStatisticsServiceImpl {
long
currentDayTime
=
DateUtil
.
parse
(
DateUtil
.
today
(),
"yyy-MM-dd"
).
getTime
();
long
currentDayAfter30DayTime
=
DateUtil
.
offsetDay
(
DateUtil
.
parse
(
DateUtil
.
today
(),
"yyy-MM-dd"
),
30
).
getTime
();
boolMust
.
must
(
QueryBuilders
.
rangeQuery
(
"NEXT_INSPECT_DATE"
).
gte
(
currentDayTime
).
lte
(
currentDayAfter30DayTime
));
// 且8大类,目的去掉脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
StCommonServiceImpl
.
getEquipmentCategory
().
stream
().
map
(
EquipmentCategoryDto:
:
getCode
).
collect
(
Collectors
.
toList
())));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"count_by_equ_list_code"
).
field
(
"EQU_LIST_CODE"
);
...
...
@@ -555,6 +561,8 @@ public class JYJCDPStatisticsServiceImpl {
// 查询下次检验日期小于当前天的设备,即为超期检验超期设备
long
currentDayTime
=
DateUtil
.
parse
(
DateUtil
.
now
(),
"yyy-MM-dd"
).
getTime
();
boolMust
.
must
(
QueryBuilders
.
rangeQuery
(
"NEXT_INSPECT_DATE"
).
lt
(
currentDayTime
));
// 且8大类,目的去掉脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
StCommonServiceImpl
.
getEquipmentCategory
().
stream
().
map
(
EquipmentCategoryDto:
:
getCode
).
collect
(
Collectors
.
toList
())));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"count_by_equ_list_code"
).
field
(
"EQU_LIST_CODE"
);
...
...
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 @
63dd1137
...
...
@@ -204,10 +204,9 @@ public class StCommonServiceImpl {
// 按照管辖机构区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgCode
)
+
"*"
));
// 设备类别精确查询气瓶
boolMust
.
must
(
QueryBuilders
.
term
s
Query
(
"EQU_CATEGORY_CODE"
,
EQU_CATEGORY_CYLINDER
));
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"EQU_CATEGORY_CODE"
,
EQU_CATEGORY_CYLINDER
));
// 且在用状态设备
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"EQU_STATE"
,
EquimentEnum
.
ZAIYONG
.
getCode
()));
request
.
query
(
boolMust
);
try
{
CountResponse
response
=
restHighLevelClient
.
count
(
request
,
RequestOptions
.
DEFAULT
);
...
...
@@ -227,6 +226,8 @@ public class StCommonServiceImpl {
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgCode
)
+
"*"
));
// 且在用状态设备
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"EQU_STATE"
,
EquimentEnum
.
ZAIYONG
.
getCode
()));
// 且8大类,目的去掉脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
StCommonServiceImpl
.
getEquipmentCategory
().
stream
().
map
(
EquipmentCategoryDto:
:
getCode
).
collect
(
Collectors
.
toList
())));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
// 默认size为10 ,数据库有脏数据,所以需要多查询一些
...
...
@@ -238,12 +239,14 @@ public class StCommonServiceImpl {
Terms
terms
=
response
.
getAggregations
().
get
(
"count_by_equ_list_code"
);
Map
<
String
,
Long
>
countMap
=
new
HashMap
<>();
for
(
Terms
.
Bucket
bucket
:
terms
.
getBuckets
())
{
// 压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
if
(
bucket
.
getKeyAsString
().
equals
(
EquipmentClassifityEnum
.
YLRQ
.
getCode
()))
{
countMap
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
()
-
cylinderNum
);
}
else
if
(
equipmentCategoryDtos
.
stream
().
anyMatch
(
e
->
e
.
getCode
().
equalsIgnoreCase
(
bucket
.
getKeyAsString
())))
{
// 是八大类且非压力管道时(压力管道按照长度单独统计)
countMap
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
());
// 是八大类且排除掉脏数据[数据库存在equ_list_code汉字及其他]
if
(
equipmentCategoryDtos
.
stream
().
anyMatch
(
e
->
e
.
getCode
().
equalsIgnoreCase
(
bucket
.
getKeyAsString
())))
{
// 压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
if
(
bucket
.
getKeyAsString
().
equals
(
EquipmentClassifityEnum
.
YLRQ
.
getCode
())){
countMap
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
()
-
cylinderNum
);
}
else
{
countMap
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
());
}
}
}
// 按照8大类枚举,进行加工。目的:固定八大类防止没统计数据导致缺少分类、将设备种类的code换成前端定义的key
...
...
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 @
63dd1137
...
...
@@ -506,6 +506,8 @@ public class YJDPStatisticsServiceImpl {
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgCode
)
+
"*"
));
// 且在用状态设备
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"EQU_STATE"
,
EquimentEnum
.
ZAIYONG
.
getCode
()));
// 且设备品种3级,按照真实的过滤,防止有脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_DEFINE_CODE.keyword"
,
ELEVATOR_EQU_DEFINE_CODES
.
split
(
","
)));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
// 原因默认10个,由于业务最多有10个,担心有脏数据,故多查询
...
...
@@ -516,10 +518,7 @@ public class YJDPStatisticsServiceImpl {
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
Terms
terms
=
response
.
getAggregations
().
get
(
"count_by_equ_define_code"
);
for
(
Terms
.
Bucket
bucket
:
terms
.
getBuckets
())
{
// 按照真实的过滤,防止有脏数据
if
(
ELEVATOR_EQU_DEFINE_CODES
.
contains
(
bucket
.
getKeyAsString
()))
{
countMap
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
());
}
countMap
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
());
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
...
...
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/ZLDPStatisticsServiceImpl.java
View file @
63dd1137
...
...
@@ -10,11 +10,14 @@ import com.yeejoin.amos.boot.module.statistics.api.mapper.AlertStatisticsMapper;
import
com.yeejoin.amos.boot.module.common.api.enums.UnitTypeEnum
;
import
com.yeejoin.amos.boot.module.common.api.enums.UserPostEnum
;
import
com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum
;
import
org.apache.lucene.queryparser.classic.QueryParser
;
import
org.elasticsearch.action.search.SearchRequest
;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.client.RequestOptions
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.Aggregations
;
...
...
@@ -428,7 +431,7 @@ public class ZLDPStatisticsServiceImpl {
}
List
<
String
>
xlist
=
Arrays
.
asList
(
"制造单位"
,
"安改维单位"
,
"使用单位"
,
"设计单位"
,
"充装单位"
);
List
<
Integer
>
ylist
=
new
ArrayList
();
xlist
.
stream
().
forEach
(
x
->
{
xlist
.
forEach
(
x
->
{
ylist
.
add
(
dataMap
.
getOrDefault
(
x
,
0
));
});
Map
<
String
,
Object
>
returnMap
=
new
HashMap
<>();
...
...
@@ -448,7 +451,7 @@ public class ZLDPStatisticsServiceImpl {
List
<
DataDictionary
>
dataDictionaryList
=
iDataDictionaryService
.
getByType
(
"HYZGBM"
);
List
<
String
>
xlist
=
dataDictionaryList
.
stream
().
map
(
DataDictionary:
:
getName
).
collect
(
Collectors
.
toList
());
List
<
Object
>
ylist
=
new
ArrayList
();
dataDictionaryList
.
stream
().
forEach
(
x
->
{
dataDictionaryList
.
forEach
(
x
->
{
ylist
.
add
(
dataMap
.
getOrDefault
(
x
.
getCode
(),
0
));
});
Map
<
String
,
Object
>
returnMap
=
new
HashMap
<>();
...
...
@@ -459,18 +462,26 @@ public class ZLDPStatisticsServiceImpl {
public
List
<
Map
<
String
,
Object
>>
equipmentInformCount
(
DPFilterParamDto
screenDto
)
{
SearchRequest
searchRequest
=
new
SearchRequest
(
"idx_biz_view_jg_all"
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
List
<
DataDictionary
>
dataDictionaryList
=
iDataDictionaryService
.
getByType
(
"ADDRESS"
);
//设置模糊搜索
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
screenDto
.
getCityCode
());
List
<
Map
<
String
,
Object
>>
returnList
=
new
ArrayList
<>();
List
<
DataDictionary
>
dataDictionaryList
=
iDataDictionaryService
.
getByType
(
"ADDRESS"
);
if
(
orgCode
==
null
){
this
.
setEquipmentInformCountDefaultData
(
returnList
,
dataDictionaryList
);
return
returnList
;
}
searchSourceBuilder
.
query
(
QueryBuilders
.
boolQuery
()
.
must
(
QueryBuilders
.
wildcardQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgCode
)
+
"*"
)));
SearchRequest
searchRequest
=
new
SearchRequest
(
"idx_biz_view_jg_all"
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgCode
)
+
"*"
));
// 且8大类,目的去掉脏数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
StCommonServiceImpl
.
getEquipmentCategory
().
stream
().
map
(
EquipmentCategoryDto:
:
getCode
).
collect
(
Collectors
.
toList
())));
// 且在用状态设备
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"EQU_STATE"
,
EquimentEnum
.
ZAIYONG
.
getCode
()));
// 有监管码
boolMust
.
must
(
QueryBuilders
.
existsQuery
(
"SUPERVISORY_CODE"
));
boolMust
.
mustNot
(
QueryBuilders
.
termQuery
(
"SUPERVISORY_CODE"
,
"null"
));
searchSourceBuilder
.
query
(
boolMust
);
searchSourceBuilder
.
aggregation
(
AggregationBuilders
.
terms
(
"count_by_use_site_code"
).
field
(
"USE_SITE_CODE"
).
size
(
500
));
searchRequest
.
source
(
searchSourceBuilder
);
Map
<
String
,
Integer
>
dataMap
=
new
HashMap
<>();
...
...
@@ -487,7 +498,7 @@ public class ZLDPStatisticsServiceImpl {
long
docCount
=
bucket
.
getDocCount
();
dataMap
.
put
(
category
,
(
int
)
docCount
);
}
dataDictionaryList
.
stream
().
forEach
(
x
->
{
dataDictionaryList
.
forEach
(
x
->
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"name"
,
x
.
getName
());
map
.
put
(
"value"
,
dataMap
.
getOrDefault
(
x
.
getCode
(),
0
));
...
...
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