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
e6601a53
Commit
e6601a53
authored
Oct 15, 2025
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(jg):修复设备事件发布时的空值处理问题
- 在设备记录和装置ID列表中移除null元素,避免发布空事件 - 添加对设备使用信息和注册信息的空值校验,防止空指针异常 - 使用事务同步回调确保设备创建事件在事务提交后发送 - 对项目装置信息增加空值检查,提升系统稳定性
parent
c8d91a90
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
8 deletions
+25
-8
EquipQualityScoreUpdateService.java
...re/event/service/impl/EquipQualityScoreUpdateService.java
+4
-0
ProjectQualityScoreUpdateService.java
.../event/service/impl/ProjectQualityScoreUpdateService.java
+3
-0
DataHandlerServiceImpl.java
...ot/module/jg/biz/service/impl/DataHandlerServiceImpl.java
+2
-0
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+16
-8
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/reminder/core/event/service/impl/EquipQualityScoreUpdateService.java
View file @
e6601a53
...
@@ -25,6 +25,7 @@ import lombok.RequiredArgsConstructor;
...
@@ -25,6 +25,7 @@ import lombok.RequiredArgsConstructor;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.util.*
;
import
java.util.*
;
...
@@ -59,6 +60,9 @@ public class EquipQualityScoreUpdateService extends DefaultQualityScoreUpdateSer
...
@@ -59,6 +60,9 @@ public class EquipQualityScoreUpdateService extends DefaultQualityScoreUpdateSer
MatchItemDto
matchItemDto
=
MatchItemDto
.
builder
().
build
();
MatchItemDto
matchItemDto
=
MatchItemDto
.
builder
().
build
();
IdxBizJgUseInfo
useInfo
=
getIdxBizJgUseInfo
(
record
);
IdxBizJgUseInfo
useInfo
=
getIdxBizJgUseInfo
(
record
);
IdxBizJgRegisterInfo
registerInfo
=
getIdxBizJgRegisterInfo
(
record
);
IdxBizJgRegisterInfo
registerInfo
=
getIdxBizJgRegisterInfo
(
record
);
if
(
ValidationUtil
.
isEmpty
(
useInfo
)
||
ValidationUtil
.
isEmpty
(
registerInfo
))
{
return
null
;
}
matchItemDto
.
setBizType
(
bizType
);
matchItemDto
.
setBizType
(
bizType
);
matchItemDto
.
setEquList
(
registerInfo
.
getEquList
());
matchItemDto
.
setEquList
(
registerInfo
.
getEquList
());
matchItemDto
.
setEquCategory
(
registerInfo
.
getEquCategory
());
matchItemDto
.
setEquCategory
(
registerInfo
.
getEquCategory
());
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/reminder/core/event/service/impl/ProjectQualityScoreUpdateService.java
View file @
e6601a53
...
@@ -57,6 +57,9 @@ public class ProjectQualityScoreUpdateService extends DefaultQualityScoreUpdateS
...
@@ -57,6 +57,9 @@ public class ProjectQualityScoreUpdateService extends DefaultQualityScoreUpdateS
private
Integer
getReminderLevel
(
String
bizType
,
String
projectContraptionId
)
{
private
Integer
getReminderLevel
(
String
bizType
,
String
projectContraptionId
)
{
IdxBizJgProjectContraption
projectContraption
=
idxBizJgProjectContraptionService
.
getById
(
projectContraptionId
);
IdxBizJgProjectContraption
projectContraption
=
idxBizJgProjectContraptionService
.
getById
(
projectContraptionId
);
if
(
ValidationUtil
.
isEmpty
(
projectContraption
))
{
return
null
;
}
MatchItemDto
matchItemDto
=
MatchItemDto
.
builder
().
build
();
MatchItemDto
matchItemDto
=
MatchItemDto
.
builder
().
build
();
matchItemDto
.
setBizType
(
bizType
);
matchItemDto
.
setBizType
(
bizType
);
matchItemDto
.
setEquList
(
projectContraption
.
getEquList
());
matchItemDto
.
setEquList
(
projectContraption
.
getEquList
());
...
...
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/DataHandlerServiceImpl.java
View file @
e6601a53
...
@@ -2395,6 +2395,7 @@ public class DataHandlerServiceImpl {
...
@@ -2395,6 +2395,7 @@ public class DataHandlerServiceImpl {
esEquipmentCategoryList
.
size
(),
projectContraptionIds
.
size
(),
equipRecord
.
size
());
esEquipmentCategoryList
.
size
(),
projectContraptionIds
.
size
(),
equipRecord
.
size
());
if
(!
ValidationUtil
.
isEmpty
(
equipRecord
))
{
if
(!
ValidationUtil
.
isEmpty
(
equipRecord
))
{
equipRecord
.
remove
(
null
);
log
.
info
(
"发布设备事件,设备数量: {}"
,
equipRecord
.
size
());
log
.
info
(
"发布设备事件,设备数量: {}"
,
equipRecord
.
size
());
eventPublisher
.
publish
(
new
EquipCreateOrEditEvent
(
eventPublisher
.
publish
(
new
EquipCreateOrEditEvent
(
this
,
this
,
...
@@ -2405,6 +2406,7 @@ public class DataHandlerServiceImpl {
...
@@ -2405,6 +2406,7 @@ public class DataHandlerServiceImpl {
}
}
if
(!
ValidationUtil
.
isEmpty
(
projectContraptionIds
))
{
if
(!
ValidationUtil
.
isEmpty
(
projectContraptionIds
))
{
projectContraptionIds
.
remove
(
null
);
log
.
info
(
"发布装置设备事件,设备数量: {}"
,
projectContraptionIds
.
size
());
log
.
info
(
"发布装置设备事件,设备数量: {}"
,
projectContraptionIds
.
size
());
eventPublisher
.
publish
(
new
EquipCreateOrEditEvent
(
eventPublisher
.
publish
(
new
EquipCreateOrEditEvent
(
this
,
this
,
...
...
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/IdxBizJgRegisterInfoServiceImpl.java
View file @
e6601a53
...
@@ -84,6 +84,8 @@ import org.springframework.http.HttpStatus;
...
@@ -84,6 +84,8 @@ import org.springframework.http.HttpStatus;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.support.TransactionSynchronization
;
import
org.springframework.transaction.support.TransactionSynchronizationManager
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
...
@@ -4712,14 +4714,20 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
...
@@ -4712,14 +4714,20 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
futures
.
add
(
CompletableFuture
.
runAsync
(()
->
esEquipmentCategory
.
saveAll
(
esEquipmentCategoryList
),
executor
));
futures
.
add
(
CompletableFuture
.
runAsync
(()
->
esEquipmentCategory
.
saveAll
(
esEquipmentCategoryList
),
executor
));
CompletableFuture
.
allOf
(
futures
.
toArray
(
new
CompletableFuture
[
0
])).
join
();
CompletableFuture
.
allOf
(
futures
.
toArray
(
new
CompletableFuture
[
0
])).
join
();
eventPublisher
.
publish
(
// 使用事务同步回调确保事件在事务提交后发送
new
EquipCreateOrEditEvent
(
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
this
,
@Override
BusinessTypeEnum
.
JG_NEW_EQUIP
.
name
(),
public
void
afterCommit
()
{
recordSet
,
eventPublisher
.
publish
(
EquipCreateOrEditEvent
.
EquipType
.
equip
new
EquipCreateOrEditEvent
(
)
this
,
);
BusinessTypeEnum
.
JG_NEW_EQUIP
.
name
(),
recordSet
,
EquipCreateOrEditEvent
.
EquipType
.
equip
)
);
}
});
return
String
.
format
(
"导入完成,成功导入: %d 条数据!"
,
useInfoList
.
size
());
return
String
.
format
(
"导入完成,成功导入: %d 条数据!"
,
useInfoList
.
size
());
}
}
// 定义线程池,CPU 核数 * 2,避免阻塞主线程
// 定义线程池,CPU 核数 * 2,避免阻塞主线程
...
...
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