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
244abd0a
Commit
244abd0a
authored
Jul 24, 2025
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修改
parent
2b08a284
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
17 deletions
+38
-17
ComprehensiveStatisticalAnalysisServiceImpl.java
...ice/impl/ComprehensiveStatisticalAnalysisServiceImpl.java
+38
-17
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 @
244abd0a
...
@@ -991,7 +991,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -991,7 +991,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
JSONArray
equList
=
(
JSONArray
)
filterParams
.
get
(
"EQU_LIST"
);
JSONArray
equList
=
(
JSONArray
)
filterParams
.
get
(
"EQU_LIST"
);
if
(
ObjectUtils
.
isEmpty
(
equList
)
||
equList
.
contains
(
"8000"
)
||
equList
.
contains
(
"all"
))
{
if
(
ObjectUtils
.
isEmpty
(
equList
)
||
equList
.
contains
(
"8000"
)
||
equList
.
contains
(
"all"
))
{
// 获取压力管道长度
// 获取压力管道长度
BigDecimal
pipeLength
=
getPipeLength
(
pipeQuery
,
"pipeLength"
);
BigDecimal
pipeLength
=
getPipeLength
(
boolMust
,
builder
,
"pipeLength"
);
Map
<
String
,
Object
>
pipeMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
pipeMap
=
new
HashMap
<>();
pipeMap
.
put
(
"name"
,
"压力管道(千米)"
);
pipeMap
.
put
(
"name"
,
"压力管道(千米)"
);
pipeMap
.
put
(
"value"
,
pipeLength
.
divide
(
new
BigDecimal
(
1000
),
2
,
BigDecimal
.
ROUND_HALF_UP
));
pipeMap
.
put
(
"value"
,
pipeLength
.
divide
(
new
BigDecimal
(
1000
),
2
,
BigDecimal
.
ROUND_HALF_UP
));
...
@@ -1080,12 +1080,11 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -1080,12 +1080,11 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
if
(
"1"
.
equals
(
item
))
{
if
(
"1"
.
equals
(
item
))
{
queryBuilder
.
must
(
QueryBuilders
.
termsQuery
(
"IS_INTO_MANAGEMENT"
,
Boolean
.
TRUE
))
queryBuilder
.
must
(
QueryBuilders
.
termsQuery
(
"IS_INTO_MANAGEMENT"
,
Boolean
.
TRUE
))
.
must
(
existsQuery
(
"USE_ORG_CODE"
))
.
must
(
existsQuery
(
"USE_ORG_CODE"
))
.
mustNot
(
QueryBuilders
.
termQuery
(
"USE_ORG_CODE"
,
""
));
.
mustNot
(
QueryBuilders
.
termQuery
(
"USE_ORG_CODE"
,
""
));
}
else
{
}
else
{
queryBuilder
queryBuilder
.
should
(
QueryBuilders
.
boolQuery
().
mustNot
(
existsQuery
(
"IS_INTO_MANAGEMENT"
)))
.
should
(
QueryBuilders
.
boolQuery
().
mustNot
(
existsQuery
(
"IS_INTO_MANAGEMENT"
)))
.
should
(
QueryBuilders
.
boolQuery
().
mustNot
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
""
)))
.
should
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
Boolean
.
FALSE
))
.
should
(
QueryBuilders
.
termsQuery
(
"IS_INTO_MANAGEMENT"
,
Boolean
.
FALSE
))
.
should
(
QueryBuilders
.
boolQuery
().
mustNot
(
existsQuery
(
"USE_ORG_CODE"
)))
.
should
(
QueryBuilders
.
boolQuery
().
mustNot
(
existsQuery
(
"USE_ORG_CODE"
)))
.
should
(
QueryBuilders
.
termQuery
(
"USE_ORG_CODE"
,
""
))
.
should
(
QueryBuilders
.
termQuery
(
"USE_ORG_CODE"
,
""
))
.
minimumShouldMatch
(
1
);
.
minimumShouldMatch
(
1
);
...
@@ -1098,7 +1097,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -1098,7 +1097,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
JSONArray
dates
=
(
JSONArray
)
v
;
JSONArray
dates
=
(
JSONArray
)
v
;
String
startDate
=
dates
.
getString
(
0
);
String
startDate
=
dates
.
getString
(
0
);
String
endDate
=
dates
.
getString
(
1
);
String
endDate
=
dates
.
getString
(
1
);
if
(!
""
.
equals
(
startDate
)
&&
!
""
.
equals
(
endDate
))
{
if
(!
""
.
equals
(
startDate
)
&&
!
""
.
equals
(
endDate
))
{
boolMust
.
filter
(
QueryBuilders
.
rangeQuery
(
field
).
gte
(
startDate
).
lte
(
endDate
));
boolMust
.
filter
(
QueryBuilders
.
rangeQuery
(
field
).
gte
(
startDate
).
lte
(
endDate
));
}
}
}
else
if
(
k
.
equals
(
"EQU_LIST"
)
||
k
.
equals
(
"EQU_CATEGORY"
)
||
k
.
equals
(
"EQU_DEFINE"
)
||
k
.
equals
(
"DATA_QUALITY_SCORE"
))
{
}
else
if
(
k
.
equals
(
"EQU_LIST"
)
||
k
.
equals
(
"EQU_CATEGORY"
)
||
k
.
equals
(
"EQU_DEFINE"
)
||
k
.
equals
(
"DATA_QUALITY_SCORE"
))
{
...
@@ -1144,7 +1143,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -1144,7 +1143,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
QueryBuilders
.
rangeQuery
(
dateField
).
gte
(
startDate
).
lte
(
endDate
),
QueryBuilders
.
rangeQuery
(
dateField
).
gte
(
startDate
).
lte
(
endDate
),
ScoreMode
.
None
ScoreMode
.
None
);
);
if
(!
""
.
equals
(
startDate
)
&&
!
""
.
equals
(
endDate
))
{
if
(!
""
.
equals
(
startDate
)
&&
!
""
.
equals
(
endDate
))
{
boolMust
.
must
(
fieldQuery
);
boolMust
.
must
(
fieldQuery
);
boolMust
.
filter
(
dateQuery
);
boolMust
.
filter
(
dateQuery
);
}
}
...
@@ -1295,13 +1294,16 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -1295,13 +1294,16 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
return
ObjectUtils
.
isEmpty
(
response
)
?
0
:
response
.
getCount
();
return
ObjectUtils
.
isEmpty
(
response
)
?
0
:
response
.
getCount
();
}
}
private
BigDecimal
getPipeLength
(
BoolQueryBuilder
boolMust
,
String
countField
)
{
private
BigDecimal
getPipeLength
(
BoolQueryBuilder
boolMust
,
S
earchSourceBuilder
builder
,
S
tring
countField
)
{
SearchRequest
request
=
new
SearchRequest
();
SearchRequest
request
=
new
SearchRequest
();
request
.
indices
(
StatisticalAnalysisEnum
.
equip
.
getKey
());
request
.
indices
(
StatisticalAnalysisEnum
.
equip
.
getKey
());
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
BigDecimal
pipeLong
;
BigDecimal
pipeLong
;
BoolQueryBuilder
pipeLengthQuery
=
QueryBuilderUtils
.
copyBoolQuery
(
boolMust
);
pipeLengthQuery
.
must
(
QueryBuilders
.
existsQuery
(
"pipeLength"
));
pipeLengthQuery
.
must
(
existsQuery
(
"SUPERVISORY_CODE"
));
pipeLengthQuery
.
mustNot
(
QueryBuilders
.
termQuery
(
"SUPERVISORY_CODE"
,
""
));
SumAggregationBuilder
pipeLengthAgg
=
AggregationBuilders
.
sum
(
countField
).
field
(
"pipeLength"
).
missing
(
0
);
SumAggregationBuilder
pipeLengthAgg
=
AggregationBuilders
.
sum
(
countField
).
field
(
"pipeLength"
).
missing
(
0
);
builder
.
query
(
boolMust
);
builder
.
query
(
pipeLengthQuery
);
builder
.
aggregation
(
pipeLengthAgg
).
size
(
0
);
builder
.
aggregation
(
pipeLengthAgg
).
size
(
0
);
request
.
source
(
builder
);
request
.
source
(
builder
);
try
{
try
{
...
@@ -1333,6 +1335,20 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -1333,6 +1335,20 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
String
nestedFieldKey
=
path
+
".paramKey"
;
String
nestedFieldKey
=
path
+
".paramKey"
;
String
tail
=
"BIG_DECIMAL"
.
equals
(
fieldType
)
?
".doubleValue"
:
".strValue"
;
String
tail
=
"BIG_DECIMAL"
.
equals
(
fieldType
)
?
".doubleValue"
:
".strValue"
;
TermsQueryBuilder
termsQueryBuilder
=
QueryBuilders
.
termsQuery
(
nestedFieldKey
,
paramKey
);
TermsQueryBuilder
termsQueryBuilder
=
QueryBuilders
.
termsQuery
(
nestedFieldKey
,
paramKey
);
if
(
"chargingMedium"
.
equals
(
paramKey
))
{
List
<
DictionarieValueModel
>
fillingMedium
=
Systemctl
.
dictionarieClient
.
dictValues
(
"FILLING_MEDIUM"
).
getResult
();
Object
finalValue
=
value
;
List
<
DictionarieValueModel
>
collect
=
fillingMedium
.
stream
().
filter
(
e
->
e
.
getDictDataValue
().
contains
(
finalValue
.
toString
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
collect
))
{
if
(
collect
.
size
()
==
1
)
{
value
=
collect
.
get
(
0
).
getDictDataKey
();
}
if
(
collect
.
size
()
>
1
)
{
value
=
collect
.
stream
().
map
(
DictionarieValueModel:
:
getDictDataKey
).
collect
(
Collectors
.
toList
());
condition
=
"in"
;
}
}
}
switch
(
condition
)
{
switch
(
condition
)
{
case
"eq"
:
case
"eq"
:
NestedQueryBuilder
eqQuery
=
QueryBuilders
.
nestedQuery
(
NestedQueryBuilder
eqQuery
=
QueryBuilders
.
nestedQuery
(
...
@@ -1444,7 +1460,14 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -1444,7 +1460,14 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
}
}
break
;
break
;
case
"in"
:
case
"in"
:
JSONArray
inValues
=
(
JSONArray
)
value
;
JSONArray
inValues
=
new
JSONArray
();
if
(
value
instanceof
JSONArray
)
{
inValues
=
(
JSONArray
)
value
;
}
if
(
value
instanceof
List
)
{
// value转化为jsONArray
inValues
.
addAll
((
List
)
value
);
}
NestedQueryBuilder
inQuery
=
QueryBuilders
.
nestedQuery
(
NestedQueryBuilder
inQuery
=
QueryBuilders
.
nestedQuery
(
path
,
path
,
QueryBuilders
.
boolQuery
().
must
(
termsQueryBuilder
).
must
(
QueryBuilders
.
termsQuery
(
path
+
tail
,
inValues
)),
QueryBuilders
.
boolQuery
().
must
(
termsQueryBuilder
).
must
(
QueryBuilders
.
termsQuery
(
path
+
tail
,
inValues
)),
...
@@ -3046,7 +3069,6 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -3046,7 +3069,6 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
if
(
groupField
.
equals
(
"EQU_LIST_CODE"
))
{
if
(
groupField
.
equals
(
"EQU_LIST_CODE"
))
{
gasBoolQueryBuilder
=
QueryBuilderUtils
.
copyBoolQuery
(
boolMust
);
gasBoolQueryBuilder
=
QueryBuilderUtils
.
copyBoolQuery
(
boolMust
);
}
}
BoolQueryBuilder
pipeBoolMust
=
QueryBuilderUtils
.
copyBoolQuery
(
boolMust
);
if
(!
"2300"
.
equals
(
equipCode
))
{
if
(!
"2300"
.
equals
(
equipCode
))
{
boolMust
.
mustNot
(
QueryBuilders
.
matchQuery
(
"EQU_CATEGORY_CODE"
,
"2300"
));
boolMust
.
mustNot
(
QueryBuilders
.
matchQuery
(
"EQU_CATEGORY_CODE"
,
"2300"
));
}
}
...
@@ -3061,7 +3083,9 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -3061,7 +3083,9 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
tabTotalMap
.
put
(
StatisticalAnalysisEnum
.
equip
.
getCode
(),
otherCount
.
toString
());
tabTotalMap
.
put
(
StatisticalAnalysisEnum
.
equip
.
getCode
(),
otherCount
.
toString
());
List
<
String
>
codes
=
new
ArrayList
<>();
List
<
String
>
codes
=
new
ArrayList
<>();
BoolQueryBuilder
pipeBoolMust
=
QueryBuilderUtils
.
copyBoolQuery
(
boolMust
);
for
(
Map
<
String
,
Object
>
categoryMap
:
staticCountByGroupMap
)
{
for
(
Map
<
String
,
Object
>
categoryMap
:
staticCountByGroupMap
)
{
BoolQueryBuilder
queryBuilder
=
QueryBuilderUtils
.
copyBoolQuery
(
pipeBoolMust
);
String
code
=
categoryMap
.
get
(
"value"
).
toString
();
String
code
=
categoryMap
.
get
(
"value"
).
toString
();
codes
.
add
(
code
);
codes
.
add
(
code
);
// 去除类别中的气瓶
// 去除类别中的气瓶
...
@@ -3076,11 +3100,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -3076,11 +3100,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
map
.
put
(
"fieldKey"
,
groupField
.
replace
(
"_CODE"
,
""
));
map
.
put
(
"fieldKey"
,
groupField
.
replace
(
"_CODE"
,
""
));
Object
value
=
staticCountByGroup
.
containsKey
(
code
)
?
staticCountByGroup
.
get
(
code
)
:
0L
;
Object
value
=
staticCountByGroup
.
containsKey
(
code
)
?
staticCountByGroup
.
get
(
code
)
:
0L
;
if
(
code
.
startsWith
(
"8"
))
{
if
(
code
.
startsWith
(
"8"
))
{
pipeBoolMust
.
must
(
QueryBuilders
.
termQuery
(
groupField
,
code
));
queryBuilder
.
must
(
QueryBuilders
.
termQuery
(
groupField
,
code
));
pipeBoolMust
.
must
(
QueryBuilders
.
existsQuery
(
"pipeLength"
));
BigDecimal
pipeLength
=
getPipeLength
(
queryBuilder
,
builder
,
code
);
pipeBoolMust
.
must
(
existsQuery
(
"SUPERVISORY_CODE"
));
pipeBoolMust
.
mustNot
(
QueryBuilders
.
termQuery
(
"SUPERVISORY_CODE"
,
""
));
BigDecimal
pipeLength
=
getPipeLength
(
pipeBoolMust
,
code
);
value
=
pipeLength
.
divide
(
new
BigDecimal
(
1000
),
4
,
BigDecimal
.
ROUND_HALF_UP
);
value
=
pipeLength
.
divide
(
new
BigDecimal
(
1000
),
4
,
BigDecimal
.
ROUND_HALF_UP
);
}
}
map
.
put
(
"value"
,
value
);
map
.
put
(
"value"
,
value
);
...
@@ -3156,7 +3177,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -3156,7 +3177,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
if
(
groupField
.
equals
(
"EQU_DEFINE_CODE"
))
{
if
(
groupField
.
equals
(
"EQU_DEFINE_CODE"
))
{
pipeBoolMust
.
mustNot
(
QueryBuilders
.
termsQuery
(
"EQU_DEFINE_CODE"
,
codes
));
pipeBoolMust
.
mustNot
(
QueryBuilders
.
termsQuery
(
"EQU_DEFINE_CODE"
,
codes
));
}
}
BigDecimal
pipeLength
=
getPipeLength
(
pipeBoolMust
,
"other"
);
BigDecimal
pipeLength
=
getPipeLength
(
pipeBoolMust
,
builder
,
"other"
);
BigDecimal
divide
=
pipeLength
.
divide
(
new
BigDecimal
(
1000
),
4
,
BigDecimal
.
ROUND_HALF_UP
);
BigDecimal
divide
=
pipeLength
.
divide
(
new
BigDecimal
(
1000
),
4
,
BigDecimal
.
ROUND_HALF_UP
);
otherPipeLength
=
otherPipeLength
.
add
(
divide
);
otherPipeLength
=
otherPipeLength
.
add
(
divide
);
staticCountByGroup
.
put
(
"N/A"
,
otherPipeLength
);
staticCountByGroup
.
put
(
"N/A"
,
otherPipeLength
);
...
...
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