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
1161d1e5
Commit
1161d1e5
authored
Jun 21, 2025
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(重要提醒):业务新增提醒开发联调
1.使用登记作废
parent
97771423
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
12 deletions
+58
-12
CancellationEvent.java
...join/amos/boot/module/jg/biz/event/CancellationEvent.java
+8
-0
CancellationEventListener.java
...dule/jg/biz/event/listener/CancellationEventListener.java
+18
-0
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+32
-12
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/CancellationEvent.java
View file @
1161d1e5
...
@@ -4,6 +4,7 @@ import lombok.Getter;
...
@@ -4,6 +4,7 @@ import lombok.Getter;
import
org.springframework.context.ApplicationEvent
;
import
org.springframework.context.ApplicationEvent
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
/**
/**
* @author Administrator
* @author Administrator
...
@@ -13,6 +14,7 @@ public class CancellationEvent extends ApplicationEvent {
...
@@ -13,6 +14,7 @@ public class CancellationEvent extends ApplicationEvent {
private
List
<
String
>
records
;
private
List
<
String
>
records
;
private
Set
<
String
>
projectContraptionIds
;
/**
/**
* Create a new {@code ApplicationEvent}.
* Create a new {@code ApplicationEvent}.
*
*
...
@@ -23,4 +25,10 @@ public class CancellationEvent extends ApplicationEvent {
...
@@ -23,4 +25,10 @@ public class CancellationEvent extends ApplicationEvent {
super
(
source
);
super
(
source
);
this
.
records
=
records
;
this
.
records
=
records
;
}
}
public
CancellationEvent
(
Object
source
,
List
<
String
>
records
,
Set
<
String
>
projectContraptionIds
)
{
super
(
source
);
this
.
records
=
records
;
this
.
projectContraptionIds
=
projectContraptionIds
;
}
}
}
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 @
1161d1e5
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.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto
;
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.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.reminder.core.event.EquipCreateOrEditEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICommonService
;
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.IdxBizJgRegisterInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl
;
...
@@ -44,11 +48,24 @@ public class CancellationEventListener {
...
@@ -44,11 +48,24 @@ public class CancellationEventListener {
private
BlockingQueue
<
String
>
queue
=
new
LinkedBlockingQueue
<>();
private
BlockingQueue
<
String
>
queue
=
new
LinkedBlockingQueue
<>();
private
final
EventPublisher
publisher
;
@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
();
log
.
info
(
"收到作废消息:{}"
,
JSONObject
.
toJSONString
(
records
));
log
.
info
(
"收到作废消息:{}"
,
JSONObject
.
toJSONString
(
records
));
queue
.
addAll
(
records
);
queue
.
addAll
(
records
);
castEvent2EquipEditEvent
(
event
);
}
private
void
castEvent2EquipEditEvent
(
CancellationEvent
event
)
{
if
(
event
.
getProjectContraptionIds
()
!=
null
&&
!
event
.
getProjectContraptionIds
().
isEmpty
())
{
publisher
.
publish
(
new
EquipCreateOrEditEvent
(
this
,
BusinessTypeEnum
.
JG_NEW_PROJECT
.
name
(),
event
.
getProjectContraptionIds
(),
EquipCreateOrEditEvent
.
EquipType
.
project
));
}
}
private
void
castEvent2EquipEditEvent
(
String
record
)
{
publisher
.
publish
(
new
EquipCreateOrEditEvent
(
this
,
BusinessTypeEnum
.
JG_NEW_EQUIP
.
name
(),
Sets
.
newHashSet
(
record
),
EquipCreateOrEditEvent
.
EquipType
.
equip
));
}
}
@PostConstruct
@PostConstruct
...
@@ -104,6 +121,7 @@ public class CancellationEventListener {
...
@@ -104,6 +121,7 @@ public class CancellationEventListener {
}
}
esEquipmentCategoryDao
.
save
(
esEquipmentCategoryDto
);
esEquipmentCategoryDao
.
save
(
esEquipmentCategoryDto
);
});
});
castEvent2EquipEditEvent
(
record
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"设备作废异常:{}"
,
e
.
getMessage
());
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/service/impl/JgUseRegistrationServiceImpl.java
View file @
1161d1e5
...
@@ -3306,14 +3306,13 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3306,14 +3306,13 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 处理非批量导入数据,更新关联业务状态
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
// 统一处理设备的纳管状态【注册事务提交后的操作】
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask
(
records
);
Set
<
String
>
pIds
=
new
HashSet
<>();
pIds
.
add
(
jgUseRegistration
.
getProjectContraptionId
());
pIds
.
addAll
(
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
)));
registerAfterCommitTask
(
records
,
pIds
);
}
else
{
}
else
{
// 查询原工程装置及 useInfo 记录
// 查询原工程装置及 useInfo 记录
List
<
String
>
originProjectContraptionIds
=
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
));
List
<
String
>
originProjectContraptionIds
=
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
));
List
<
IdxBizJgProjectContraption
>
originProjectContraptionList
=
jgProjectContraptionService
.
lambdaQuery
()
.
in
(
BaseEntity:
:
getSequenceNbr
,
originProjectContraptionIds
)
.
list
();
records
=
idxBizJgUseInfoService
.
lambdaQuery
()
records
=
idxBizJgUseInfoService
.
lambdaQuery
()
.
select
(
IdxBizJgUseInfo:
:
getRecord
)
.
select
(
IdxBizJgUseInfo:
:
getRecord
)
.
in
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
originProjectContraptionIds
)
.
in
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
originProjectContraptionIds
)
...
@@ -3321,10 +3320,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3321,10 +3320,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.
stream
()
.
stream
()
.
map
(
IdxBizJgUseInfo:
:
getRecord
)
.
map
(
IdxBizJgUseInfo:
:
getRecord
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
Set
<
String
>
pIds
=
new
HashSet
<>();
// 统一处理设备的纳管状态
pIds
.
add
(
jgUseRegistration
.
getProjectContraptionId
());
registerAfterCommitTask
(
records
);
pIds
.
addAll
(
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
))
);
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
// 统一处理设备的纳管状态
registerAfterCommitTask
(
records
,
pIds
);
}
}
jgProjectContraptionService
.
updateById
(
projectContraption
);
jgProjectContraptionService
.
updateById
(
projectContraption
);
}
}
...
@@ -3379,7 +3380,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3379,7 +3380,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 处理非批量导入数据,更新关联业务状态
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
// 统一处理设备的纳管状态【注册事务提交后的操作】
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask
(
records
);
Set
<
String
>
pIds
=
new
HashSet
<>();
pIds
.
add
(
jgUseRegistration
.
getProjectContraptionId
());
pIds
.
addAll
(
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
)));
registerAfterCommitTask
(
records
,
pIds
);
}
else
{
}
else
{
// 查询原工程装置及 useInfo 记录
// 查询原工程装置及 useInfo 记录
List
<
String
>
originProjectContraptionIds
=
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
));
List
<
String
>
originProjectContraptionIds
=
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
));
...
@@ -3396,7 +3400,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3396,7 +3400,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
// 统一处理设备的纳管状态
// 统一处理设备的纳管状态
registerAfterCommitTask
(
records
);
Set
<
String
>
pIds
=
new
HashSet
<>();
pIds
.
add
(
jgUseRegistration
.
getProjectContraptionId
());
pIds
.
addAll
(
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
)));
registerAfterCommitTask
(
records
,
pIds
);
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
if
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
oldStatus
))
{
if
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
oldStatus
))
{
// 计算管道长度并更新
// 计算管道长度并更新
...
@@ -3421,9 +3428,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3421,9 +3428,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
this
.
updateTotalPieLineLength
(
null
,
jgUseRegistration
.
getProjectContraptionId
());
this
.
updateTotalPieLineLength
(
null
,
jgUseRegistration
.
getProjectContraptionId
());
}
}
// 统一处理设备的纳管状态【注册事务提交后的操作】
// 统一处理设备的纳管状态【注册事务提交后的操作】
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
this
.
rollBackForPieLine
(
jgUseRegistration
);
this
.
rollBackForPieLine
(
jgUseRegistration
);
registerAfterCommitTask
(
records
);
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
registerAfterCommitTask
(
records
,
Sets
.
newHashSet
(
jgUseRegistration
.
getProjectContraptionId
()));
}
}
}
}
//气瓶
//气瓶
...
@@ -3481,6 +3488,19 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3481,6 +3488,19 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
});
});
}
}
/**
* 注册事务提交后的同步操作
*/
private
void
registerAfterCommitTask
(
List
<
String
>
records
,
Set
<
String
>
projectContraptionIds
)
{
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
public
void
afterCommit
()
{
// 发布作废事件
eventPublisher
.
publish
(
new
CancellationEvent
(
this
,
records
,
projectContraptionIds
));
}
});
}
private
void
clearUseInfoOfEquip
(
JgUseRegistration
jgUseRegistration
)
{
private
void
clearUseInfoOfEquip
(
JgUseRegistration
jgUseRegistration
)
{
List
<
JgUseRegistrationEq
>
eqList
=
getJgUseRegistrationEqs
(
jgUseRegistration
);
List
<
JgUseRegistrationEq
>
eqList
=
getJgUseRegistrationEqs
(
jgUseRegistration
);
//非管道
//非管道
...
...
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