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
030ef710
Commit
030ef710
authored
Jul 09, 2025
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
parent
4b1d4a85
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
28 deletions
+18
-28
ComprehensiveStatisticalAnalysisServiceImpl.java
...ice/impl/ComprehensiveStatisticalAnalysisServiceImpl.java
+18
-28
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 @
030ef710
...
...
@@ -971,21 +971,12 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
String
path
=
"techParams"
;
String
nestedFieldKey
=
path
+
".paramKey"
;
String
tail
=
"BIG_DECIMAL"
.
equals
(
fieldType
)
?
".doubleValue"
:
".strValue"
;
NestedQueryBuilder
keyNestedQuery
=
QueryBuilders
.
nestedQuery
(
path
,
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
termsQuery
(
nestedFieldKey
,
paramKey
)),
ScoreMode
.
Avg
);
if
(
isCustom
)
{
builder
.
add
(
keyNestedQuery
,
andOr
);
}
else
{
boolMust
.
must
(
keyNestedQuery
);
}
TermsQueryBuilder
termsQueryBuilder
=
QueryBuilders
.
termsQuery
(
nestedFieldKey
,
paramKey
);
switch
(
condition
)
{
case
"eq"
:
NestedQueryBuilder
eqQuery
=
QueryBuilders
.
nestedQuery
(
path
,
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
termsQuery
(
path
+
tail
,
value
)),
QueryBuilders
.
boolQuery
().
must
(
termsQueryBuilder
).
must
(
QueryBuilders
.
termsQuery
(
path
+
tail
,
value
)),
ScoreMode
.
Avg
);
if
(
isCustom
)
{
...
...
@@ -995,10 +986,9 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
}
break
;
case
"neq"
:
boolMust
.
must
(
keyNestedQuery
);
NestedQueryBuilder
neqQuery
=
QueryBuilders
.
nestedQuery
(
path
,
QueryBuilders
.
boolQuery
().
mustNot
(
QueryBuilders
.
termsQuery
(
path
+
tail
,
value
)),
QueryBuilders
.
boolQuery
().
must
(
termsQueryBuilder
).
must
Not
(
QueryBuilders
.
termsQuery
(
path
+
tail
,
value
)),
ScoreMode
.
Avg
);
if
(
isCustom
)
{
...
...
@@ -1010,7 +1000,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
case
"like"
:
NestedQueryBuilder
likeQuery
=
QueryBuilders
.
nestedQuery
(
path
,
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
wildcardQuery
(
path
+
tail
,
"*"
+
value
+
"*"
)),
QueryBuilders
.
boolQuery
().
must
(
termsQueryBuilder
).
must
(
QueryBuilders
.
wildcardQuery
(
path
+
tail
,
"*"
+
value
+
"*"
)),
ScoreMode
.
Avg
);
if
(
isCustom
)
{
...
...
@@ -1022,7 +1012,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
case
"notLike"
:
NestedQueryBuilder
notLikeQuery
=
QueryBuilders
.
nestedQuery
(
path
,
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
wildcardQuery
(
path
+
tail
,
"*"
+
value
+
"*"
)),
QueryBuilders
.
boolQuery
().
must
(
termsQueryBuilder
).
must
(
QueryBuilders
.
wildcardQuery
(
path
+
tail
,
"*"
+
value
+
"*"
)),
ScoreMode
.
Avg
);
if
(
isCustom
)
{
...
...
@@ -1034,7 +1024,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
case
"gt"
:
NestedQueryBuilder
gtQuery
=
QueryBuilders
.
nestedQuery
(
path
,
QueryBuilders
.
rangeQuery
(
path
+
tail
).
gt
(
value
.
toString
(
)),
QueryBuilders
.
boolQuery
().
must
(
termsQueryBuilder
).
filter
(
QueryBuilders
.
rangeQuery
(
path
+
tail
).
gt
(
value
.
toString
()
)),
ScoreMode
.
Avg
);
if
(
isCustom
)
{
...
...
@@ -1046,7 +1036,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
case
"gte"
:
NestedQueryBuilder
gteQuery
=
QueryBuilders
.
nestedQuery
(
path
,
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
rangeQuery
(
path
+
tail
).
gte
(
value
.
toString
())),
QueryBuilders
.
boolQuery
().
must
(
termsQueryBuilder
).
must
(
QueryBuilders
.
rangeQuery
(
path
+
tail
).
gte
(
value
.
toString
())),
ScoreMode
.
Avg
);
if
(
isCustom
)
{
...
...
@@ -1058,7 +1048,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
case
"lt"
:
NestedQueryBuilder
ltQuery
=
QueryBuilders
.
nestedQuery
(
path
,
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
rangeQuery
(
path
+
tail
).
lt
(
value
.
toString
())),
QueryBuilders
.
boolQuery
().
must
(
termsQueryBuilder
).
must
(
QueryBuilders
.
rangeQuery
(
path
+
tail
).
lt
(
value
.
toString
())),
ScoreMode
.
Avg
);
if
(
isCustom
)
{
...
...
@@ -1070,7 +1060,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
case
"lte"
:
NestedQueryBuilder
lteQuery
=
QueryBuilders
.
nestedQuery
(
path
,
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
rangeQuery
(
path
+
tail
).
lte
(
value
.
toString
())),
QueryBuilders
.
boolQuery
().
must
(
termsQueryBuilder
).
must
(
QueryBuilders
.
rangeQuery
(
path
+
tail
).
lte
(
value
.
toString
())),
ScoreMode
.
Avg
);
if
(
isCustom
)
{
...
...
@@ -1083,7 +1073,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
JSONArray
btValues
=
(
JSONArray
)
value
;
NestedQueryBuilder
betweenQuery
=
QueryBuilders
.
nestedQuery
(
path
,
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
rangeQuery
(
path
+
tail
).
gte
(
Double
.
parseDouble
(
btValues
.
get
(
0
).
toString
())).
lte
(
Double
.
parseDouble
(
btValues
.
get
(
1
).
toString
()))),
QueryBuilders
.
boolQuery
().
must
(
termsQueryBuilder
).
must
(
QueryBuilders
.
rangeQuery
(
path
+
tail
).
gte
(
Double
.
parseDouble
(
btValues
.
get
(
0
).
toString
())).
lte
(
Double
.
parseDouble
(
btValues
.
get
(
1
).
toString
()))),
ScoreMode
.
Avg
);
if
(
isCustom
)
{
...
...
@@ -1096,7 +1086,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
JSONArray
inValues
=
(
JSONArray
)
value
;
NestedQueryBuilder
inQuery
=
QueryBuilders
.
nestedQuery
(
path
,
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
termsQuery
(
path
+
tail
,
inValues
)),
QueryBuilders
.
boolQuery
().
must
(
termsQueryBuilder
).
must
(
QueryBuilders
.
termsQuery
(
path
+
tail
,
inValues
)),
ScoreMode
.
Avg
);
if
(
isCustom
)
{
...
...
@@ -1109,7 +1099,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
JSONArray
notInValues
=
(
JSONArray
)
value
;
NestedQueryBuilder
notInQuery
=
QueryBuilders
.
nestedQuery
(
path
,
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
termsQuery
(
path
+
tail
,
notInValues
)),
QueryBuilders
.
boolQuery
().
must
(
termsQueryBuilder
).
must
(
QueryBuilders
.
termsQuery
(
path
+
tail
,
notInValues
)),
ScoreMode
.
Avg
);
if
(
isCustom
)
{
...
...
@@ -1914,7 +1904,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
// 开始下载提醒
this
.
startDownLoadMsg
(
fileName
,
uuid
);
// 查询数据
JSONArray
records
=
this
.
exportDataAsyncBatchSe
ra
ch
(
filter
);
JSONArray
records
=
this
.
exportDataAsyncBatchSe
ar
ch
(
filter
);
MultipartFile
templateExcelFile
;
// 数据转化 + 附件生成
if
(
StatisticalAnalysisEnum
.
equip
.
getCode
().
equals
(
businessType
))
{
...
...
@@ -1935,11 +1925,11 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
.
fluentPut
(
"time"
,
new
Date
().
getTime
()));
}
public
JSONArray
exportDataAsyncBatchSe
ra
ch
(
JSONObject
filter
)
{
public
JSONArray
exportDataAsyncBatchSe
ar
ch
(
JSONObject
filter
)
{
JSONArray
result
=
new
JSONArray
();
int
PAGE_SIZE
=
1000
;
int
pageSize
=
1000
;
// 查询首页数据
filter
.
fluentPut
(
"size"
,
PAGE_SIZE
).
fluentPut
(
"current"
,
1
);
filter
.
fluentPut
(
"size"
,
pageSize
).
fluentPut
(
"current"
,
1
);
JSONObject
jsonData1
=
this
.
queryForPage
(
filter
);
// 获取 result -> pageData -> records
JSONObject
pageData1
=
jsonData1
.
getJSONObject
(
"pageData"
);
...
...
@@ -1947,7 +1937,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
result
.
addAll
(
records1
);
long
total
=
pageData1
.
getLong
(
"total"
);
int
totalPage
=
(
int
)
Math
.
ceil
((
double
)
total
/
PAGE_SIZE
);
int
totalPage
=
(
int
)
Math
.
ceil
((
double
)
total
/
pageSize
);
// 用于收集所有分页结果
List
<
CompletableFuture
<
JSONArray
>>
futures
=
new
ArrayList
<>();
...
...
@@ -1959,7 +1949,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
CompletableFuture
<
JSONArray
>
future
=
CompletableFuture
.
supplyAsync
(()
->
{
// 恢复上下文到子线程
contextWrapper
.
apply
();
filter
.
fluentPut
(
"size"
,
PAGE_SIZE
).
fluentPut
(
"current"
,
pageIndex
);
filter
.
fluentPut
(
"size"
,
pageSize
).
fluentPut
(
"current"
,
pageIndex
);
JSONObject
jsonData2
=
this
.
queryForPage
(
filter
);
// 获取 result -> pageData -> records
JSONObject
pageData2
=
jsonData2
.
getJSONObject
(
"pageData"
);
...
...
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