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
c22db50e
Commit
c22db50e
authored
Jun 06, 2024
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
充装检查合格率es查询修改(fillingResult,checkResult使用keyword)
parent
50ccbc8e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
25 deletions
+7
-25
CylinderAreaDataServiceImpl.java
...der/flc/biz/service/impl/CylinderAreaDataServiceImpl.java
+7
-25
No files found.
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/service/impl/CylinderAreaDataServiceImpl.java
View file @
c22db50e
...
...
@@ -27,6 +27,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.text.DecimalFormat
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -118,7 +119,7 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
long
totalResult
=
searchEsCount
(
false
,
true
,
regionCode
,
appId
);
result5
.
put
(
"name"
,
"充装检查率(%)"
);
if
(
totalAll
!=
0
)
{
result5
.
put
(
"value"
,
(
totalCheck
/
totalAll
)
*
100
);
result5
.
put
(
"value"
,
new
DecimalFormat
(
"#.00"
).
format
(((
double
)
totalCheck
/
totalAll
)
*
100
)
);
}
else
{
result5
.
put
(
"value"
,
0
);
}
...
...
@@ -126,7 +127,7 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
Map
<
String
,
Object
>
result6
=
Maps
.
newHashMap
();
result6
.
put
(
"name"
,
"充装检查合格率(%)"
);
if
(
totalAll
!=
0
)
{
result6
.
put
(
"value"
,
(
totalResult
/
totalAll
)
*
100
);
result6
.
put
(
"value"
,
new
DecimalFormat
(
"#.00"
).
format
(((
double
)
totalResult
/
totalAll
)
*
100
)
);
}
else
{
result6
.
put
(
"value"
,
0
);
}
...
...
@@ -183,9 +184,8 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
}
private
long
searchEsCount
(
Boolean
checkOk
,
Boolean
resultOk
,
String
regionCode
,
String
appId
)
{
CountRequest
countRequest
=
new
CountRequest
();
countRequest
.
indices
(
"cylinder_filling"
);
// countRequest.indices("tb_test_index");
CountRequest
countRequest
=
new
CountRequest
(
"cylinder_filling_tb3"
);
// countRequest.indices("cylinder_filling");
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
if
(
checkOk
)
{
//匹配充装前检查和充装后检查都有数据
...
...
@@ -196,27 +196,9 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
}
if
(
resultOk
)
{
//匹配充装前检查和充装后检查都有数据
// 定义脚本查询参数
// Map<String, Object> params = new HashMap<>();
// // 脚本内容,检查多个字段的值
// String scriptBody = " boolean allMatch = true;\n" +
// " for (String field : ['fillingResult', 'checkResult']) {\n" +
// " if (doc[field].value != params['matchValue']) {\n" +
// " allMatch = false;\n" +
// " break;\n" +
// " }\n" +
// " }\n" +
// " return allMatch;\n";
// String resultOkMatchValue = "合格";
// params.put("matchValue", resultOkMatchValue);
// // 构建脚本查询
// Script script = new Script(ScriptType.INLINE,"painless", scriptBody, params);
// // 使用ScriptQueryBuilder构造查询条件
// ScriptQueryBuilder scriptQuery = QueryBuilders.scriptQuery(script);
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
matchQuery
(
"fillingResult"
,
"合格"
));
meBuilder
.
must
(
QueryBuilders
.
matchQuery
(
"checkResult"
,
"合格"
));
// meBuilder.must(scriptQuery);
meBuilder
.
must
(
QueryBuilders
.
termQuery
(
"fillingResult.keyword"
,
"合格"
));
meBuilder
.
must
(
QueryBuilders
.
termQuery
(
"checkResult.keyword"
,
"合格"
));
boolMust
.
must
(
meBuilder
);
}
...
...
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