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
ee8a1640
Commit
ee8a1640
authored
Jan 05, 2026
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:(jg):导入功能去掉异步执行,避免用户取消操作导致脏数据
parent
cb3ef711
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
45 deletions
+22
-45
DataDockServiceImpl.java
.../boot/module/jg/biz/service/impl/DataDockServiceImpl.java
+14
-31
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+8
-14
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/DataDockServiceImpl.java
View file @
ee8a1640
...
...
@@ -192,8 +192,6 @@ public class DataDockServiceImpl {
* @param equLists 数据集
* @return 保存结果
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
xiAnSaveEquipmentData
(
List
<
Map
<
String
,
Object
>>
equLists
)
{
RequestContextWrapper
contextWrapper
=
RequestContextWrapper
.
capture
();
Set
<
String
>
recordSet
=
new
HashSet
<>();
...
...
@@ -214,6 +212,7 @@ public class DataDockServiceImpl {
}
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
saveEquipmentDataInTransaction
(
Map
<
String
,
Object
>
equ
,
String
dataSource
,
String
remark
)
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
CompanyBo
company
=
reginParams
.
getCompany
();
...
...
@@ -2350,35 +2349,19 @@ public class DataDockServiceImpl {
}
CompletableFuture
<
Void
>
useInfoFuture
=
CompletableFuture
.
runAsync
(
()
->
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgUseInfoMapper
,
useInfoList
,
"使用信息"
));
CompletableFuture
<
Void
>
designInfoFuture
=
CompletableFuture
.
runAsync
(
()
->
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgDesignInfoMapper
,
designInfoList
,
"设计信息"
));
CompletableFuture
<
Void
>
constructionFuture
=
CompletableFuture
.
runAsync
(
()
->
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgConstructionInfoMapper
,
constructionInfoList
,
"施工信息"
));
CompletableFuture
<
Void
>
factoryFuture
=
CompletableFuture
.
runAsync
(
()
->
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgFactoryInfoMapper
,
factoryInfoList
,
"制造信息"
));
CompletableFuture
<
Void
>
registerFuture
=
CompletableFuture
.
runAsync
(
()
->
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgRegisterInfoMapper
,
registerInfoList
,
"登记信息"
));
CompletableFuture
<
Void
>
otherFuture
=
CompletableFuture
.
runAsync
(
()
->
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgOtherInfoMapper
,
otherInfoList
,
"其他信息"
));
CompletableFuture
<
Void
>
supervisionFuture
=
CompletableFuture
.
runAsync
(
()
->
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgSupervisionInfoMapper
,
supervisionInfoList
,
"监管信息"
));
CompletableFuture
<
Void
>
paramsPipelineFuture
=
CompletableFuture
.
runAsync
(
()
->
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgTechParamsPipelineMapper
,
paramsPipelineList
,
"管道参数信息"
));
CompletableFuture
<
Void
>
inspectionFuture
=
CompletableFuture
.
runAsync
(
()
->
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgInspectionDetectionInfoMapper
,
inspectionDetectionInfoList
,
"检验检测信息"
));
CompletableFuture
<
Void
>
esFuture
=
CompletableFuture
.
runAsync
(()
->
{
if
(!
esEquipmentCategoryList
.
isEmpty
())
{
esEquipmentCategory
.
saveAll
(
esEquipmentCategoryList
);
log
.
info
(
"ES批量保存完成,数量:{}"
,
esEquipmentCategoryList
.
size
());
}
});
CompletableFuture
.
allOf
(
useInfoFuture
,
designInfoFuture
,
constructionFuture
,
factoryFuture
,
registerFuture
,
otherFuture
,
supervisionFuture
,
paramsPipelineFuture
,
inspectionFuture
,
esFuture
).
join
();
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgUseInfoMapper
,
useInfoList
,
"使用信息"
);
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgDesignInfoMapper
,
designInfoList
,
"设计信息"
);
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgConstructionInfoMapper
,
constructionInfoList
,
"施工信息"
);
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgFactoryInfoMapper
,
factoryInfoList
,
"制造信息"
);
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgRegisterInfoMapper
,
registerInfoList
,
"登记信息"
);
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgOtherInfoMapper
,
otherInfoList
,
"其他信息"
);
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgSupervisionInfoMapper
,
supervisionInfoList
,
"监管信息"
);
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgTechParamsPipelineMapper
,
paramsPipelineList
,
"管道参数信息"
);
idxBizJgRegisterInfoServiceImpl
.
batchInsert
(
idxBizJgInspectionDetectionInfoMapper
,
inspectionDetectionInfoList
,
"检验检测信息"
);
if
(!
esEquipmentCategoryList
.
isEmpty
())
{
esEquipmentCategory
.
saveAll
(
esEquipmentCategoryList
);
log
.
info
(
"ES批量保存完成,数量:{}"
,
esEquipmentCategoryList
.
size
());
}
log
.
info
(
"所有批量操作完成"
);
return
recordList
;
}
...
...
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 @
ee8a1640
...
...
@@ -4808,18 +4808,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
batchInsert
(
idxBizJgUseInfoMapper
,
useInfoList
,
"使用信息"
);
batchInsert
(
idxBizJgRegisterInfoMapper
,
registerInfoList
,
"注册信息"
);
List
<
CompletableFuture
<
Void
>>
futures
=
new
ArrayList
<>();
futures
.
add
(
CompletableFuture
.
runAsync
(()
->
batchInsert
(
idxBizJgSupervisionInfoMapper
,
supervisionInfoList
,
"监督信息"
),
executor
));
futures
.
add
(
CompletableFuture
.
runAsync
(()
->
batchInsert
(
idxBizJgDesignInfoMapper
,
designInfoList
,
"设计信息"
),
executor
));
futures
.
add
(
CompletableFuture
.
runAsync
(()
->
batchInsert
(
idxBizJgFactoryInfoMapper
,
factoryInfoList
,
"制造信息"
),
executor
));
futures
.
add
(
CompletableFuture
.
runAsync
(()
->
batchInsert
(
otherInfoMapper
,
otherInfoList
,
"其他信息"
),
executor
));
futures
.
add
(
CompletableFuture
.
runAsync
(()
->
batchInsert
(
idxBizJgTechParamsVesselMapper
,
paramsVesselList
,
"容器参数信息"
),
executor
));
futures
.
add
(
CompletableFuture
.
runAsync
(()
->
batchInsert
(
idxBizJgInspectionDetectionInfoMapper
,
inspectionDetectionInfoList
,
"检验检测信息"
),
executor
));
futures
.
add
(
CompletableFuture
.
runAsync
(()
->
batchInsert
(
certificateChangeRecordEqMapper
,
jgCertificateChangeRecordEqList
,
"登记证关系信息"
),
executor
));
futures
.
add
(
CompletableFuture
.
runAsync
(()
->
esEquipmentCategory
.
saveAll
(
esEquipmentCategoryList
),
executor
));
CompletableFuture
.
allOf
(
futures
.
toArray
(
new
CompletableFuture
[
0
])).
join
();
batchInsert
(
idxBizJgSupervisionInfoMapper
,
supervisionInfoList
,
"监督信息"
);
batchInsert
(
idxBizJgDesignInfoMapper
,
designInfoList
,
"设计信息"
);
batchInsert
(
idxBizJgFactoryInfoMapper
,
factoryInfoList
,
"制造信息"
);
batchInsert
(
otherInfoMapper
,
otherInfoList
,
"其他信息"
);
batchInsert
(
idxBizJgTechParamsVesselMapper
,
paramsVesselList
,
"容器参数信息"
);
batchInsert
(
idxBizJgInspectionDetectionInfoMapper
,
inspectionDetectionInfoList
,
"检验检测信息"
);
batchInsert
(
certificateChangeRecordEqMapper
,
jgCertificateChangeRecordEqList
,
"登记证关系信息"
);
esEquipmentCategory
.
saveAll
(
esEquipmentCategoryList
);
// 使用事务同步回调确保事件在事务提交后发送
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
...
...
@@ -4836,8 +4832,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
});
return
String
.
format
(
"导入完成,成功导入: %d 条数据!"
,
useInfoList
.
size
());
}
// 定义线程池,CPU 核数 * 2,避免阻塞主线程
ExecutorService
executor
=
Executors
.
newFixedThreadPool
(
Runtime
.
getRuntime
().
availableProcessors
()
*
2
);
/** 通用批量插入方法 */
public
<
T
>
void
batchInsert
(
CustomBaseMapper
<
T
>
mapper
,
List
<
T
>
list
,
String
name
)
{
...
...
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