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
cbdbde69
Commit
cbdbde69
authored
Jan 08, 2026
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:(jg):批量导入接口修改
parent
1345952f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
42 deletions
+55
-42
DataDockServiceImpl.java
.../boot/module/jg/biz/service/impl/DataDockServiceImpl.java
+55
-42
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 @
cbdbde69
...
...
@@ -155,6 +155,7 @@ public class DataDockServiceImpl {
private
final
JgVehicleInformationMapper
jgVehicleInformationMapper
;
private
final
IdxBizJgRegisterInfoMapper
idxBizJgRegisterInfoMapper
;
private
final
ExcelImportErrorLogDao
excelImportErrorLogDao
;
private
final
SuperviseInfoMapper
superviseInfoMapper
;
// 设备分类表单id
public
static
final
String
EQUIP_CLASS_FORM_ID
=
"equipClass"
;
// 设备基本信息表单id
...
...
@@ -192,8 +193,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,18 +213,15 @@ 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
();
String
record
=
UUID
.
randomUUID
().
toString
();
try
{
// transactionTemplate.execute(status -> {
String
equList
=
String
.
valueOf
(
equ
.
get
(
"equList"
));
String
equCategory
=
String
.
valueOf
(
equ
.
get
(
"equCategory"
));
String
isCompleteXa
=
String
.
valueOf
(
equ
.
get
(
"isCompleteXa"
));
// 压力管道保存 工程装置表信息 必须在saveUseInfo之前进行,需要提前生成工程装置id
//saveProjectContraption(equ, equList, company, dataSource);
// 保存到设备表
String
equList
=
Objects
.
toString
(
equ
.
get
(
"equList"
),
null
);
String
equCategory
=
Objects
.
toString
(
equ
.
get
(
"equCategory"
),
null
);
String
isCompleteXa
=
Objects
.
toString
(
equ
.
get
(
"isCompleteXa"
),
null
);
saveUseInfo
(
equ
,
record
,
dataSource
,
remark
,
company
);
saveDesignInfo
(
equ
,
record
);
saveFactoryInfo
(
equ
,
record
);
...
...
@@ -233,24 +229,57 @@ public class DataDockServiceImpl {
saveSupervisionInfo
(
equ
,
record
);
saveOtherInfo
(
equ
,
record
,
equList
);
saveInspectInfo
(
equ
,
record
);
if
(
"安装改造维修单位"
.
equals
(
company
.
getCompanyType
())){
if
(
"安装改造维修单位"
.
equals
(
company
.
getCompanyType
()))
{
saveConstructionInfo
(
equ
,
record
,
company
);
}
// 保存技术参数
saveTechParams
(
equ
,
record
,
equList
);
// 保存到ES
saveEquInfoToEs
(
record
,
isCompleteXa
);
return
record
;
// });
}
catch
(
Exception
e
)
{
esEquipmentCategory
.
deleteById
(
record
);
e
.
printStackTrace
();
log
.
error
(
"{}数据:保存时出现异常,对应数据:{}"
,
dataSource
,
toJSONString
(
equ
));
log
.
error
(
"异常信息:{}"
,
e
.
getMessage
());
handleSaveException
(
e
,
equ
,
dataSource
,
record
);
throw
new
RuntimeException
(
e
);
}
}
private
void
handleSaveException
(
Exception
e
,
Map
<
String
,
Object
>
equ
,
String
dataSource
,
String
record
)
{
try
{
esEquipmentCategory
.
deleteById
(
record
);
}
catch
(
Exception
ex
)
{
log
.
warn
(
"ES 删除失败,record={}"
,
record
,
ex
);
}
try
{
superviseInfoMapper
.
deleteDataAll
(
Collections
.
singletonList
(
record
));
}
catch
(
Exception
ex
)
{
log
.
warn
(
"清理监督信息失败,record={}"
,
record
,
ex
);
}
String
traceInfo
=
Arrays
.
stream
(
e
.
getStackTrace
())
.
filter
(
x
->
x
.
getClassName
().
startsWith
(
"com.yeejoin"
))
.
map
(
x
->
x
.
getClassName
()
+
"."
+
x
.
getMethodName
()
+
":"
+
x
.
getLineNumber
())
.
collect
(
Collectors
.
toList
())
.
toString
();
try
{
ExcelImportErrorLogDto
errorLogDto
=
JSON
.
parseObject
(
toJSONString
(
equ
),
ExcelImportErrorLogDto
.
class
);
errorLogDto
.
setErrorInfo
(
e
.
getMessage
());
errorLogDto
.
setTraceInfo
(
traceInfo
);
errorLogDto
.
setCreateTime
(
new
Date
());
excelImportErrorLogDao
.
save
(
errorLogDto
);
}
catch
(
Exception
ex
)
{
log
.
warn
(
"保存 Excel 错误日志失败"
,
ex
);
}
log
.
error
(
"{} 数据保存失败,record={}"
,
dataSource
,
record
,
e
);
Map
<
String
,
String
>
errorResult
=
new
HashMap
<>();
errorResult
.
put
(
"id"
,
record
);
errorResult
.
put
(
"type"
,
"error"
);
errorResult
.
put
(
"msg"
,
Optional
.
ofNullable
(
e
.
getMessage
()).
orElse
(
"Unknown error: "
+
e
.
getClass
().
getName
()));
errorResult
.
put
(
"traceInfo"
,
traceInfo
);
throw
new
LocalBadRequest
(
toJSONString
(
errorResult
));
}
/**
* 保存施工信息表
*
...
...
@@ -2350,35 +2379,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
(()
->
{
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
());
}
});
CompletableFuture
.
allOf
(
useInfoFuture
,
designInfoFuture
,
constructionFuture
,
factoryFuture
,
registerFuture
,
otherFuture
,
supervisionFuture
,
paramsPipelineFuture
,
inspectionFuture
,
esFuture
).
join
();
log
.
info
(
"所有批量操作完成"
);
return
recordList
;
}
...
...
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