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
af252cde
Commit
af252cde
authored
Mar 05, 2026
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(jg) :安全追溯
1.安全追溯更新es优化按照单字段更新
parent
16efe4f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
10 deletions
+22
-10
SafetyProblemTracingServiceImpl.java
.../jg/biz/service/impl/SafetyProblemTracingServiceImpl.java
+22
-10
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/SafetyProblemTracingServiceImpl.java
View file @
af252cde
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.map.MapUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
...
...
@@ -16,6 +17,7 @@ import com.google.common.collect.Maps;
import
com.google.common.collect.Sets
;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant
;
import
com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.SafetyProblemTracingDto
;
...
...
@@ -27,6 +29,7 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import
com.yeejoin.amos.boot.module.jg.api.mapper.SafetyProblemTracingMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.ISafetyProblemTracingService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipWaitRefreshDataQualityScore
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgMaintenanceRecordInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo
;
...
...
@@ -71,6 +74,9 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
@Autowired
CommonMapper
commonMapper
;
@Autowired
private
EsBulkService
esBulkService
;
/**
* 分页查询
*/
...
...
@@ -332,16 +338,21 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
}
catch
(
Exception
e
)
{
log
.
error
(
"Other表更新失败,设备record:{},错误原因:{}"
,
records
,
e
.
getMessage
(),
e
);
}
// 分批更新
Lists
.
partition
(
new
ArrayList
<>(
records
),
100
).
forEach
(
partition
->
{
try
{
// es更新
esBulkService
.
bulkUpdateFieldsByIds
(
this
.
buildUpdateFields
(
partition
),
TZSCommonConstant
.
ES_INDEX_NAME_JG_ALL
);
}
catch
(
Exception
e
)
{
log
.
error
(
"安全追溯实时更新ES状态更新失败,数据为:「{}」"
,
partition
,
e
);
}
});
log
.
info
(
"ES状态更新成功,记录数:{}"
,
records
.
size
());
}
// 更新ES状态(添加异常处理)
try
{
Iterable
<
ESEquipmentCategoryDto
>
esEquipmentIter
=
esEquipmentCategory
.
findAllById
(
records
);
esEquipmentIter
.
forEach
(
dto
->
dto
.
setProblemStatus
(
SafetyProblemStatusEnum
.
HANDLED
.
getCode
()));
esEquipmentCategory
.
saveAll
(
esEquipmentIter
);
log
.
info
(
"ES状态更新成功,记录数:{}"
,
records
.
size
());
}
catch
(
Exception
e
)
{
log
.
error
(
"ES状态更新失败,设备record:{},错误原因:{}"
,
records
,
e
.
getMessage
(),
e
);
}
protected
Map
<
String
,
Map
<
String
,
Object
>>
buildUpdateFields
(
List
<
String
>
records
)
{
Map
<
String
,
Map
<
String
,
Object
>>
fieldMap
=
new
HashMap
<>();
records
.
forEach
(
record
->
fieldMap
.
put
(
record
,
MapUtil
.
of
(
"problemStatus"
,
SafetyProblemStatusEnum
.
HANDLED
.
getCode
())));
return
fieldMap
;
}
}
\ No newline at end of file
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