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
72fcb711
Commit
72fcb711
authored
Jun 21, 2025
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(重要提醒):业务新增提醒开发联调
1.使用登记作废
parent
f717b20e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
59 deletions
+82
-59
CancellationEventListener.java
...dule/jg/biz/event/listener/CancellationEventListener.java
+4
-58
ManageStatusDataUpdateService.java
.../jg/biz/event/listener/ManageStatusDataUpdateService.java
+77
-0
EquipOperationEventHandler.java
...inder/core/event/listener/EquipOperationEventHandler.java
+1
-1
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/event/listener/CancellationEventListener.java
View file @
72fcb711
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
event
.
listener
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
event
.
listener
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.Sets
;
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.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.biz.event.CancellationEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.event.CancellationEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher
;
import
com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICommonService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -21,7 +13,6 @@ import org.springframework.stereotype.Component;
...
@@ -21,7 +13,6 @@ import org.springframework.stereotype.Component;
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Executors
;
...
@@ -38,18 +29,12 @@ public class CancellationEventListener {
...
@@ -38,18 +29,12 @@ public class CancellationEventListener {
@Value
(
"${cancellation.deal.thread.number:1}"
)
@Value
(
"${cancellation.deal.thread.number:1}"
)
private
int
threadNumber
;
private
int
threadNumber
;
private
final
ICommonService
commonService
;
private
final
BlockingQueue
<
String
>
queue
=
new
LinkedBlockingQueue
<>();
private
final
ESEquipmentCategory
esEquipmentCategoryDao
;
private
final
IdxBizJgUseInfoServiceImpl
idxBizJgUseInfoService
;
private
final
IdxBizJgRegisterInfoServiceImpl
idxBizJgRegisterInfoService
;
private
BlockingQueue
<
String
>
queue
=
new
LinkedBlockingQueue
<>();
private
final
EventPublisher
publisher
;
private
final
EventPublisher
publisher
;
private
final
ManageStatusDataUpdateService
updateService
;
@EventListener
(
value
=
CancellationEvent
.
class
)
@EventListener
(
value
=
CancellationEvent
.
class
)
public
void
handleTransactionalEvent
(
CancellationEvent
event
)
{
public
void
handleTransactionalEvent
(
CancellationEvent
event
)
{
List
<
String
>
records
=
event
.
getRecords
();
List
<
String
>
records
=
event
.
getRecords
();
...
@@ -64,10 +49,6 @@ public class CancellationEventListener {
...
@@ -64,10 +49,6 @@ public class CancellationEventListener {
}
}
}
}
private
void
castEvent2EquipEditEvent
(
String
record
)
{
publisher
.
publish
(
new
EquipCreateOrEditEvent
(
this
,
BusinessTypeEnum
.
JG_NEW_EQUIP
.
name
(),
Sets
.
newHashSet
(
record
),
EquipCreateOrEditEvent
.
EquipType
.
equip
));
}
@PostConstruct
@PostConstruct
public
void
init
()
{
public
void
init
()
{
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
threadNumber
,
r
->
{
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
threadNumber
,
r
->
{
...
@@ -81,7 +62,7 @@ public class CancellationEventListener {
...
@@ -81,7 +62,7 @@ public class CancellationEventListener {
try
{
try
{
String
record
=
queue
.
take
();
String
record
=
queue
.
take
();
log
.
info
(
"线程 {} 开始处理 record: {}"
,
Thread
.
currentThread
().
getName
(),
record
);
log
.
info
(
"线程 {} 开始处理 record: {}"
,
Thread
.
currentThread
().
getName
(),
record
);
this
.
dealData
(
record
);
updateService
.
dealData
(
record
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
}
}
...
@@ -91,40 +72,5 @@ public class CancellationEventListener {
...
@@ -91,40 +72,5 @@ public class CancellationEventListener {
}
}
}
}
private
void
dealData
(
String
record
)
{
log
.
info
(
"开始检查设备的引用:{}"
,
record
);
// 所有业务单据(除去作废、删除状态单据),有在引用设备的则不修改设备纳管状态
Boolean
inUsed
=
commonService
.
checkEquipIsUsed
(
record
);
// 无引用则进行修改纳管状态为未纳管
if
(!
inUsed
)
{
log
.
info
(
"进行设备作废处理:{}"
,
record
);
try
{
// 更新已纳管为未纳管 - 数据库
idxBizJgUseInfoService
.
lambdaUpdate
()
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
record
)
.
set
(
IdxBizJgUseInfo:
:
getIsIntoManagement
,
false
)
.
update
();
// 清除系统自动生成的设备代码`equCode`
boolean
isRegisterUpdated
=
idxBizJgRegisterInfoService
.
lambdaUpdate
()
.
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
record
)
.
eq
(
IdxBizJgRegisterInfo:
:
getEquCodeType
,
"2"
)
.
set
(
IdxBizJgRegisterInfo:
:
getEquCode
,
null
)
.
update
();
// 同步修改ES数据
Optional
<
ESEquipmentCategoryDto
>
optional
=
esEquipmentCategoryDao
.
findById
(
record
);
optional
.
ifPresent
(
esEquipmentCategoryDto
->
{
esEquipmentCategoryDto
.
setIS_INTO_MANAGEMENT
(
false
);
if
(
isRegisterUpdated
)
{
esEquipmentCategoryDto
.
setEQU_CODE
(
null
);
}
esEquipmentCategoryDao
.
save
(
esEquipmentCategoryDto
);
});
castEvent2EquipEditEvent
(
record
);
}
catch
(
Exception
e
)
{
log
.
error
(
"设备作废异常:{}"
,
e
.
getMessage
());
}
}
}
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/event/listener/ManageStatusDataUpdateService.java
0 → 100644
View file @
72fcb711
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
event
.
listener
;
import
com.google.common.collect.Sets
;
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.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICommonService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Optional
;
@Service
@Slf4j
@RequiredArgsConstructor
public
class
ManageStatusDataUpdateService
{
private
final
EventPublisher
publisher
;
private
final
ICommonService
commonService
;
private
final
ESEquipmentCategory
esEquipmentCategoryDao
;
private
final
IdxBizJgUseInfoServiceImpl
idxBizJgUseInfoService
;
private
final
IdxBizJgRegisterInfoServiceImpl
idxBizJgRegisterInfoService
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
dealData
(
String
record
)
{
log
.
info
(
"开始检查设备的引用:{}"
,
record
);
// 所有业务单据(除去作废、删除状态单据),有在引用设备的则不修改设备纳管状态
Boolean
inUsed
=
commonService
.
checkEquipIsUsed
(
record
);
// 无引用则进行修改纳管状态为未纳管
if
(!
inUsed
)
{
log
.
info
(
"进行设备作废处理:{}"
,
record
);
try
{
// 更新已纳管为未纳管 - 数据库
idxBizJgUseInfoService
.
lambdaUpdate
()
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
record
)
.
set
(
IdxBizJgUseInfo:
:
getIsIntoManagement
,
false
)
.
update
();
// 清除系统自动生成的设备代码`equCode`
boolean
isRegisterUpdated
=
idxBizJgRegisterInfoService
.
lambdaUpdate
()
.
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
record
)
.
eq
(
IdxBizJgRegisterInfo:
:
getEquCodeType
,
"2"
)
.
set
(
IdxBizJgRegisterInfo:
:
getEquCode
,
null
)
.
update
();
// 同步修改ES数据
Optional
<
ESEquipmentCategoryDto
>
optional
=
esEquipmentCategoryDao
.
findById
(
record
);
optional
.
ifPresent
(
esEquipmentCategoryDto
->
{
esEquipmentCategoryDto
.
setIS_INTO_MANAGEMENT
(
false
);
if
(
isRegisterUpdated
)
{
esEquipmentCategoryDto
.
setEQU_CODE
(
null
);
}
esEquipmentCategoryDao
.
save
(
esEquipmentCategoryDto
);
});
castEvent2EquipEditEvent
(
record
);
}
catch
(
Exception
e
)
{
log
.
error
(
"设备作废异常:{}"
,
e
.
getMessage
());
}
}
}
private
void
castEvent2EquipEditEvent
(
String
record
)
{
publisher
.
publish
(
new
EquipCreateOrEditEvent
(
this
,
BusinessTypeEnum
.
JG_NEW_EQUIP
.
name
(),
Sets
.
newHashSet
(
record
),
EquipCreateOrEditEvent
.
EquipType
.
equip
));
}
}
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/listener/EquipOperationEventHandler.java
View file @
72fcb711
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
reminder
.
core
.
event
.
listener
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
reminder
.
core
.
event
.
listener
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.biz.factory.QualityScoreUpdateFactory
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.biz.factory.QualityScoreUpdateFactory
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
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