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
958e4d48
Commit
958e4d48
authored
Feb 04, 2026
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(设备创建) :使用登记作废
1.写es移动到最后执行
parent
470ee84f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
243 additions
and
34 deletions
+243
-34
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+243
-34
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/JgUseRegistrationServiceImpl.java
View file @
958e4d48
...
@@ -138,14 +138,14 @@ import java.util.function.Function;
...
@@ -138,14 +138,14 @@ import java.util.function.Function;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.IntStream
;
import
java.util.stream.IntStream
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
import
java.util.stream.StreamSupport
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
import
java.util.zip.ZipOutputStream
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
constant
.
TZSCommonConstant
.
ES_INDEX_NAME_USE_REGISTRATION_INFO
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
constant
.
TZSCommonConstant
.
ES_INDEX_NAME_USE_REGISTRATION_INFO
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
entity
.
EsUseRegistrationInfo
.
UNDERSCORE_TO_CAMEL
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
entity
.
EsUseRegistrationInfo
.
UNDERSCORE_TO_CAMEL
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
.
CommonServiceImpl
.
getCompanyType
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
.
CommonServiceImpl
.
getCompanyType
;
import
static
java
.
util
.
stream
.
Collectors
.
toList
;
import
static
java
.
util
.
stream
.
Collectors
.*;
import
static
java
.
util
.
stream
.
Collectors
.
toSet
;
/**
/**
* 服务实现类
* 服务实现类
...
@@ -3437,6 +3437,31 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3437,6 +3437,31 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
}
}
}
private
void
processElseDataByStatusSet
(
String
flowStatus
,
JgUseRegistration
jgUseRegistration
)
{
switch
(
flowStatus
)
{
case
"使用单位待提交"
:
// 1.删除暂存时生成的待办
commonServiceImpl
.
deleteTasksByRelationId
(
jgUseRegistration
.
getSequenceNbr
()
+
""
);
break
;
case
"已完成"
:
// 1.删除与设备的关系,设备可再次发起使用登记
this
.
clearUseInfoOfEquipSet
(
jgUseRegistration
);
// 2.清空redis(缓存的流程中及已完成使用登记的设备)
this
.
clearDataForCheckEquipRepeatUsed
(
jgUseRegistration
);
// 3.作废对应的使用登记证
this
.
invalidUseRegistrationCertificate
(
jgUseRegistration
);
break
;
default
:
// 流程中
// 1.待办任务更新为已完成
this
.
finishedTask
(
jgUseRegistration
);
// 2.终止流程-工作流报错暂时注释掉
cmWorkflowService
.
stopProcess
(
jgUseRegistration
.
getInstanceId
(),
jgUseRegistration
.
getCancelReason
());
// 3.清空redis(缓存的流程中及已完成使用登记的设备)
this
.
clearDataForCheckEquipRepeatUsed
(
jgUseRegistration
);
}
}
/**
/**
* 使用登记单条作废
* 使用登记单条作废
*
*
...
@@ -3468,6 +3493,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3468,6 +3493,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if
(!
ValidationUtil
.
isEmpty
(
jgUseRegistration
.
getProjectContraptionId
()))
{
if
(!
ValidationUtil
.
isEmpty
(
jgUseRegistration
.
getProjectContraptionId
()))
{
records
=
idxBizJgUseInfoService
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgUseInfo
>().
eq
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
jgUseRegistration
.
getProjectContraptionId
()).
select
(
IdxBizJgUseInfo:
:
getRecord
)).
stream
().
map
(
IdxBizJgUseInfo:
:
getRecord
).
collect
(
toList
());
records
=
idxBizJgUseInfoService
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgUseInfo
>().
eq
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
jgUseRegistration
.
getProjectContraptionId
()).
select
(
IdxBizJgUseInfo:
:
getRecord
)).
stream
().
map
(
IdxBizJgUseInfo:
:
getRecord
).
collect
(
toList
());
}
}
Iterable
<
ESEquipmentCategoryDto
>
equipmentCategoryDtosSnapshot
=
esEquipmentCategory
.
findAllById
(
records
);
Iterable
<
ESEquipmentInfo
>
esEquipmentInfosSnapshot
=
esEquipmentDao
.
findAllById
(
records
);
try
{
// 构建设备删除的 DTO 列表
// 构建设备删除的 DTO 列表
List
<
ESEquipmentCategoryDto
>
esDtoList
=
records
.
stream
().
map
(
v
->
{
List
<
ESEquipmentCategoryDto
>
esDtoList
=
records
.
stream
().
map
(
v
->
{
ESEquipmentCategoryDto
esDto
=
new
ESEquipmentCategoryDto
();
ESEquipmentCategoryDto
esDto
=
new
ESEquipmentCategoryDto
();
...
@@ -3476,16 +3504,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3476,16 +3504,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
//删除涉及的19张表的数据
//删除涉及的19张表的数据
superviseInfoMapper
.
deleteDataAll
(
records
);
superviseInfoMapper
.
deleteDataAll
(
records
);
//删除es中的数据
esEquipmentCategory
.
deleteAll
(
esDtoList
);
// 构建设备删除的 新索引的DTO 列表
// 构建设备删除的 新索引的DTO 列表
List
<
ESEquipmentInfo
>
esNewDtoList
=
records
.
stream
().
map
(
v
->
{
List
<
ESEquipmentInfo
>
esNewDtoList
=
records
.
stream
().
map
(
v
->
{
ESEquipmentInfo
esDto
=
new
ESEquipmentInfo
();
ESEquipmentInfo
esDto
=
new
ESEquipmentInfo
();
esDto
.
setSEQUENCE_NBR
(
v
);
esDto
.
setSEQUENCE_NBR
(
v
);
return
esDto
;
return
esDto
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
//删除es新索引中的数据
esEquipmentDao
.
deleteAll
(
esNewDtoList
);
//作废使用登记证 & 生成使用登记证的流水
//作废使用登记证 & 生成使用登记证的流水
this
.
invalidUseRegistrationCertificate
(
jgUseRegistration
);
this
.
invalidUseRegistrationCertificate
(
jgUseRegistration
);
// 单据逻辑删除
// 单据逻辑删除
...
@@ -3494,6 +3518,21 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3494,6 +3518,21 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if
(!
ValidationUtil
.
isEmpty
(
jgUseRegistration
.
getProjectContraptionId
()))
{
if
(!
ValidationUtil
.
isEmpty
(
jgUseRegistration
.
getProjectContraptionId
()))
{
idxBizJgProjectContraptionMapper
.
delete
(
new
LambdaQueryWrapper
<
IdxBizJgProjectContraption
>().
eq
(
IdxBizJgProjectContraption:
:
getSequenceNbr
,
jgUseRegistration
.
getProjectContraptionId
()));
idxBizJgProjectContraptionMapper
.
delete
(
new
LambdaQueryWrapper
<
IdxBizJgProjectContraption
>().
eq
(
IdxBizJgProjectContraption:
:
getSequenceNbr
,
jgUseRegistration
.
getProjectContraptionId
()));
}
}
this
.
updateById
(
jgUseRegistration
);
//删除es中的数据
esEquipmentCategory
.
deleteAll
(
esDtoList
);
//删除es新索引中的数据
esEquipmentDao
.
deleteAll
(
esNewDtoList
);
}
catch
(
Exception
e
)
{
// 报错时回滚
if
(
equipmentCategoryDtosSnapshot
.
iterator
().
hasNext
()){
esEquipmentCategory
.
saveAll
(
equipmentCategoryDtosSnapshot
);
}
if
(
esEquipmentInfosSnapshot
.
iterator
().
hasNext
()){
esEquipmentDao
.
saveAll
(
esEquipmentInfosSnapshot
);
}
throw
new
RuntimeException
(
e
);
}
}
else
{
}
else
{
//判断是否管道
//判断是否管道
if
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
oldStatus
)
&&
if
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
oldStatus
)
&&
...
@@ -3514,24 +3553,22 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3514,24 +3553,22 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
}
}
}
if
(
jgUseRegistration
.
getProjectContraptionId
()
!=
null
)
{
if
(
jgUseRegistration
.
getProjectContraptionId
()
!=
null
)
{
//2.合并后作废
//2.合并后作废
if
(!
jgUseRegistration
.
getOriginProjectContraptionIds
().
contains
(
jgUseRegistration
.
getProjectContraptionId
()))
{
if
(!
jgUseRegistration
.
getOriginProjectContraptionIds
().
contains
(
jgUseRegistration
.
getProjectContraptionId
()))
{
List
<
String
>
mergePipelineRecords
=
eqList
.
stream
()
.
filter
(
v
->
jgUseRegistration
.
getOriginProjectContraptionIds
().
contains
(
v
.
getOriginProjectContraptionId
())).
map
(
JgUseRegistrationEq:
:
getEquId
).
collect
(
toList
());
List
<
ESEquipmentCategoryDto
>
equipmentCategoryDtosSnapshot
=
StreamSupport
.
stream
(
esEquipmentCategory
.
findAllById
(
mergePipelineRecords
).
spliterator
(),
false
).
collect
(
toList
());
List
<
ESEquipmentInfo
>
esEquipmentInfosSnapshot
=
StreamSupport
.
stream
(
esEquipmentDao
.
findAllById
(
mergePipelineRecords
).
spliterator
(),
false
).
collect
(
toList
());
Map
<
String
,
ESEquipmentCategoryDto
>
equipmentCategoryDtoMap
=
equipmentCategoryDtosSnapshot
.
stream
().
collect
(
toMap
(
ESEquipmentCategoryDto:
:
getSEQUENCE_NBR
,
e
->
BeanUtil
.
copyProperties
(
e
,
ESEquipmentCategoryDto
.
class
)));
Map
<
String
,
ESEquipmentInfo
>
esEquipmentInfoDtoMap
=
esEquipmentInfosSnapshot
.
stream
().
collect
(
toMap
(
ESEquipmentInfo:
:
getSEQUENCE_NBR
,
e
->
BeanUtil
.
copyProperties
(
e
,
ESEquipmentInfo
.
class
)));
Boolean
isRollBack
=
useRegisterBackupManager
.
restore
(
jgUseRegistration
.
getSequenceNbr
()
+
""
);
Boolean
isRollBack
=
useRegisterBackupManager
.
restore
(
jgUseRegistration
.
getSequenceNbr
()
+
""
);
try
{
if
(
isRollBack
)
{
// 进行过编辑逻辑
if
(
isRollBack
)
{
// 进行过编辑逻辑
// 1.还原子工程装置的下的管道信息(装置id)
// 1.还原子工程装置的下的管道信息(装置id)
eqList
.
stream
()
eqList
.
stream
()
.
filter
(
v
->
jgUseRegistration
.
getOriginProjectContraptionIds
().
contains
(
v
.
getOriginProjectContraptionId
()))
.
filter
(
v
->
jgUseRegistration
.
getOriginProjectContraptionIds
().
contains
(
v
.
getOriginProjectContraptionId
()))
.
forEach
(
v
->
esEquipmentCategory
.
findById
(
v
.
getEquId
()).
ifPresent
(
equInfoEs
->
{
.
forEach
(
v
->
{
equInfoEs
.
setProjectContraptionId
(
v
.
getOriginProjectContraptionId
());
esEquipmentCategory
.
save
(
equInfoEs
);
Optional
<
ESEquipmentInfo
>
esEquipmentInfoOp
=
esEquipmentDao
.
findById
(
v
.
getEquId
());
if
(
esEquipmentInfoOp
.
isPresent
()){
ESEquipmentInfo
esEquipmentInfo
=
esEquipmentInfoOp
.
get
();
esEquipmentInfo
.
setProjectContraptionId
(
v
.
getOriginProjectContraptionId
());
esEquipmentDao
.
save
(
esEquipmentInfo
);
}
LambdaQueryWrapper
<
IdxBizJgUseInfo
>
lambda
=
new
QueryWrapper
<
IdxBizJgUseInfo
>().
lambda
();
LambdaQueryWrapper
<
IdxBizJgUseInfo
>
lambda
=
new
QueryWrapper
<
IdxBizJgUseInfo
>().
lambda
();
lambda
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
String
.
valueOf
(
v
.
getEquId
()));
lambda
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
String
.
valueOf
(
v
.
getEquId
()));
IdxBizJgUseInfo
useInfo
=
useInfoMapper
.
selectOne
(
lambda
);
IdxBizJgUseInfo
useInfo
=
useInfoMapper
.
selectOne
(
lambda
);
...
@@ -3539,6 +3576,19 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3539,6 +3576,19 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
useInfoMapper
.
updateById
(
useInfo
);
useInfoMapper
.
updateById
(
useInfo
);
IdxBizJgProjectContraption
originProjectContraption
=
jgProjectContraptionService
.
getById
(
v
.
getOriginProjectContraptionId
());
IdxBizJgProjectContraption
originProjectContraption
=
jgProjectContraptionService
.
getById
(
v
.
getOriginProjectContraptionId
());
Optional
.
ofNullable
(
equipmentCategoryDtoMap
.
get
(
v
.
getEquId
())).
ifPresent
(
p
->{
p
.
setProjectContraptionId
(
String
.
valueOf
(
originProjectContraption
.
getSequenceNbr
()));
p
.
setPROJECT_CONTRAPTION
(
originProjectContraption
.
getProjectContraption
());
p
.
setOrgBranchCode
(
originProjectContraption
.
getOrgCode
());
p
.
setORG_BRANCH_NAME
(
originProjectContraption
.
getOrgName
());
});
Optional
.
ofNullable
(
esEquipmentInfoDtoMap
.
get
(
v
.
getEquId
())).
ifPresent
(
p
->{
p
.
setProjectContraptionId
(
String
.
valueOf
(
originProjectContraption
.
getSequenceNbr
()));
p
.
setPROJECT_CONTRAPTION
(
originProjectContraption
.
getProjectContraption
());
p
.
setORG_BRANCH_CODE
(
originProjectContraption
.
getOrgCode
());
p
.
setORG_BRANCH_NAME
(
originProjectContraption
.
getOrgName
());
});
//还原 原工程装置下equCode和监管码
//还原 原工程装置下equCode和监管码
LambdaUpdateWrapper
<
IdxBizJgRegisterInfo
>
updateWrapper
=
new
UpdateWrapper
<
IdxBizJgRegisterInfo
>().
lambda
()
LambdaUpdateWrapper
<
IdxBizJgRegisterInfo
>
updateWrapper
=
new
UpdateWrapper
<
IdxBizJgRegisterInfo
>().
lambda
()
.
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
v
.
getEquId
());
.
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
v
.
getEquId
());
...
@@ -3551,7 +3601,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3551,7 +3601,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
IdxBizJgOtherInfo
idxBizJgOtherInfo
=
new
IdxBizJgOtherInfo
();
IdxBizJgOtherInfo
idxBizJgOtherInfo
=
new
IdxBizJgOtherInfo
();
idxBizJgOtherInfo
.
setSupervisoryCode
(
originProjectContraption
.
getSupervisoryCode
());
idxBizJgOtherInfo
.
setSupervisoryCode
(
originProjectContraption
.
getSupervisoryCode
());
otherInfoMapper
.
update
(
idxBizJgOtherInfo
,
otherInfoLambdaUpdateWrapper
);
otherInfoMapper
.
update
(
idxBizJgOtherInfo
,
otherInfoLambdaUpdateWrapper
);
})
);
}
);
// 2.根据工程装置ID查询工程装置父级,重置子工程装置父级为空
// 2.根据工程装置ID查询工程装置父级,重置子工程装置父级为空
jgProjectContraptionService
.
update
(
jgProjectContraptionService
.
update
(
new
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>()
new
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>()
...
@@ -3605,10 +3655,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3605,10 +3655,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
else
{
// 未进行过编辑逻辑,走原来逻辑
}
else
{
// 未进行过编辑逻辑,走原来逻辑
eqList
.
stream
()
eqList
.
stream
()
.
filter
(
v
->
jgUseRegistration
.
getOriginProjectContraptionIds
().
contains
(
v
.
getOriginProjectContraptionId
()))
.
filter
(
v
->
jgUseRegistration
.
getOriginProjectContraptionIds
().
contains
(
v
.
getOriginProjectContraptionId
()))
.
forEach
(
v
->
esEquipmentCategory
.
findById
(
v
.
getEquId
()).
ifPresent
(
equInfoEs
->
{
.
forEach
(
v
->
{
equInfoEs
.
setProjectContraptionId
(
v
.
getOriginProjectContraptionId
());
esEquipmentCategory
.
save
(
equInfoEs
);
LambdaQueryWrapper
<
IdxBizJgUseInfo
>
lambda
=
new
QueryWrapper
<
IdxBizJgUseInfo
>().
lambda
();
LambdaQueryWrapper
<
IdxBizJgUseInfo
>
lambda
=
new
QueryWrapper
<
IdxBizJgUseInfo
>().
lambda
();
lambda
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
String
.
valueOf
(
v
.
getEquId
()));
lambda
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
String
.
valueOf
(
v
.
getEquId
()));
IdxBizJgUseInfo
useInfo
=
useInfoMapper
.
selectOne
(
lambda
);
IdxBizJgUseInfo
useInfo
=
useInfoMapper
.
selectOne
(
lambda
);
...
@@ -3616,6 +3663,18 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3616,6 +3663,18 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
useInfoMapper
.
updateById
(
useInfo
);
useInfoMapper
.
updateById
(
useInfo
);
IdxBizJgProjectContraption
originProjectContraption
=
jgProjectContraptionService
.
getById
(
v
.
getOriginProjectContraptionId
());
IdxBizJgProjectContraption
originProjectContraption
=
jgProjectContraptionService
.
getById
(
v
.
getOriginProjectContraptionId
());
Optional
.
ofNullable
(
equipmentCategoryDtoMap
.
get
(
v
.
getEquId
())).
ifPresent
(
p
->{
p
.
setProjectContraptionId
(
String
.
valueOf
(
originProjectContraption
.
getSequenceNbr
()));
p
.
setPROJECT_CONTRAPTION
(
originProjectContraption
.
getProjectContraption
());
p
.
setOrgBranchCode
(
originProjectContraption
.
getOrgCode
());
p
.
setORG_BRANCH_NAME
(
originProjectContraption
.
getOrgName
());
});
Optional
.
ofNullable
(
esEquipmentInfoDtoMap
.
get
(
v
.
getEquId
())).
ifPresent
(
p
->{
p
.
setProjectContraptionId
(
String
.
valueOf
(
originProjectContraption
.
getSequenceNbr
()));
p
.
setPROJECT_CONTRAPTION
(
originProjectContraption
.
getProjectContraption
());
p
.
setORG_BRANCH_CODE
(
originProjectContraption
.
getOrgCode
());
p
.
setORG_BRANCH_NAME
(
originProjectContraption
.
getOrgName
());
});
//还原 原工程装置下equCode和监管码
//还原 原工程装置下equCode和监管码
LambdaUpdateWrapper
<
IdxBizJgRegisterInfo
>
updateWrapper
=
new
UpdateWrapper
<
IdxBizJgRegisterInfo
>().
lambda
()
LambdaUpdateWrapper
<
IdxBizJgRegisterInfo
>
updateWrapper
=
new
UpdateWrapper
<
IdxBizJgRegisterInfo
>().
lambda
()
.
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
v
.
getEquId
());
.
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
v
.
getEquId
());
...
@@ -3628,7 +3687,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3628,7 +3687,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
IdxBizJgOtherInfo
idxBizJgOtherInfo
=
new
IdxBizJgOtherInfo
();
IdxBizJgOtherInfo
idxBizJgOtherInfo
=
new
IdxBizJgOtherInfo
();
idxBizJgOtherInfo
.
setSupervisoryCode
(
originProjectContraption
.
getSupervisoryCode
());
idxBizJgOtherInfo
.
setSupervisoryCode
(
originProjectContraption
.
getSupervisoryCode
());
otherInfoMapper
.
update
(
idxBizJgOtherInfo
,
otherInfoLambdaUpdateWrapper
);
otherInfoMapper
.
update
(
idxBizJgOtherInfo
,
otherInfoLambdaUpdateWrapper
);
})
);
}
);
//2.根据工程装置ID查询工程装置父级,重置子工程装置父级为空
//2.根据工程装置ID查询工程装置父级,重置子工程装置父级为空
jgProjectContraptionService
.
update
(
jgProjectContraptionService
.
update
(
new
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>()
new
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>()
...
@@ -3691,6 +3750,18 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3691,6 +3750,18 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
jgProjectContraptionService
.
updateById
(
projectContraption
);
jgProjectContraptionService
.
updateById
(
projectContraption
);
}
}
}
}
this
.
updateById
(
jgUseRegistration
);
esEquipmentCategory
.
saveAll
(
equipmentCategoryDtoMap
.
values
());
esEquipmentDao
.
saveAll
(
esEquipmentInfoDtoMap
.
values
());
}
catch
(
Exception
e
)
{
if
(!
equipmentCategoryDtosSnapshot
.
isEmpty
()){
esEquipmentCategory
.
saveAll
(
equipmentCategoryDtosSnapshot
);
}
if
(!
esEquipmentInfosSnapshot
.
isEmpty
()){
esEquipmentDao
.
saveAll
(
esEquipmentInfosSnapshot
);
}
throw
new
RuntimeException
(
e
);
}
}
}
//1.子工程装置作废,正常逻辑
//1.子工程装置作废,正常逻辑
else
{
else
{
...
@@ -3704,25 +3775,81 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3704,25 +3775,81 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
this
.
rollBackForPieLine
(
jgUseRegistration
);
this
.
rollBackForPieLine
(
jgUseRegistration
);
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
registerAfterCommitTask
(
records
,
Sets
.
newHashSet
(
jgUseRegistration
.
getProjectContraptionId
()));
registerAfterCommitTask
(
records
,
Sets
.
newHashSet
(
jgUseRegistration
.
getProjectContraptionId
()));
this
.
updateById
(
jgUseRegistration
);
}
}
}
}
//气瓶
//气瓶
else
{
else
{
Iterable
<
ESEquipmentCategoryDto
>
equipmentCategoryDtosSnapshot
=
esEquipmentCategory
.
findAllById
(
records
);
Iterable
<
ESEquipmentInfo
>
esEquipmentInfosSnapshot
=
esEquipmentDao
.
findAllById
(
records
);
try
{
this
.
updateById
(
jgUseRegistration
);
// 处理非批量导入数据,更新关联业务状态
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
processElseDataByStatusSet
(
oldStatus
,
jgUseRegistration
);
// es数据处理 提出来便于进行异常回调
if
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
oldStatus
))
{
List
<
ESEquipmentCategoryDto
>
equipmentCategoryDtos
=
new
ArrayList
<>();
List
<
ESEquipmentInfo
>
esEquipmentInfos
=
new
ArrayList
<>();
buildEsInfoForRollBack
(
records
,
jgUseRegistration
,
equipmentCategoryDtos
,
esEquipmentInfos
);
if
(!
equipmentCategoryDtos
.
isEmpty
())
{
esEquipmentCategory
.
saveAll
(
equipmentCategoryDtos
);
}
if
(!
esEquipmentInfos
.
isEmpty
())
{
esEquipmentDao
.
saveAll
(
esEquipmentInfos
);
}
}
// 统一处理设备的纳管状态【注册事务提交后的操作】
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask
(
records
);
registerAfterCommitTask
(
records
);
}
catch
(
Exception
e
)
{
// 报错时按照快照数据恢复
if
(
oldStatus
.
equals
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
()))
{
if
(
equipmentCategoryDtosSnapshot
.
iterator
().
hasNext
()){
esEquipmentCategory
.
saveAll
(
equipmentCategoryDtosSnapshot
);
}
if
(
esEquipmentInfosSnapshot
.
iterator
().
hasNext
()){
esEquipmentDao
.
saveAll
(
esEquipmentInfosSnapshot
);
}
}
throw
new
RuntimeException
(
e
);
}
}
}
}
}
}
}
//台套办理
//台套办理
else
{
else
{
Iterable
<
ESEquipmentCategoryDto
>
equipmentCategoryDtosSnapshot
=
esEquipmentCategory
.
findAllById
(
records
);
Iterable
<
ESEquipmentInfo
>
esEquipmentInfosSnapshot
=
esEquipmentDao
.
findAllById
(
records
);
try
{
this
.
updateById
(
jgUseRegistration
);
// 处理非批量导入数据,更新关联业务状态
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
processElseDataByStatusSet
(
oldStatus
,
jgUseRegistration
);
// es数据处理 提出来便于进行异常回调
if
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
oldStatus
))
{
List
<
ESEquipmentCategoryDto
>
equipmentCategoryDtos
=
new
ArrayList
<>();
List
<
ESEquipmentInfo
>
esEquipmentInfos
=
new
ArrayList
<>();
buildEsInfoForRollBack
(
records
,
jgUseRegistration
,
equipmentCategoryDtos
,
esEquipmentInfos
);
if
(!
equipmentCategoryDtos
.
isEmpty
()){
esEquipmentCategory
.
saveAll
(
equipmentCategoryDtos
);
}
if
(!
esEquipmentInfos
.
isEmpty
()){
esEquipmentDao
.
saveAll
(
esEquipmentInfos
);
}
}
// 统一处理设备的纳管状态【注册事务提交后的操作】
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask
(
records
);
registerAfterCommitTask
(
records
);
}
catch
(
Exception
e
)
{
// 报错时按照快照数据恢复
if
(
oldStatus
.
equals
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
()))
{
if
(
equipmentCategoryDtosSnapshot
.
iterator
().
hasNext
()){
esEquipmentCategory
.
saveAll
(
equipmentCategoryDtosSnapshot
);
}
if
(
equipmentCategoryDtosSnapshot
.
iterator
().
hasNext
()){
esEquipmentDao
.
saveAll
(
esEquipmentInfosSnapshot
);
}
}
throw
new
RuntimeException
(
e
);
}
}
}
this
.
updateById
(
jgUseRegistration
);
return
jgUseRegistration
;
return
jgUseRegistration
;
}
}
...
@@ -3783,14 +3910,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3783,14 +3910,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
Boolean
flag
=
Boolean
.
FALSE
;
Boolean
flag
=
Boolean
.
FALSE
;
LambdaQueryWrapper
<
IdxBizJgRegisterInfo
>
lambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
IdxBizJgRegisterInfo
>
lambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
lambdaQueryWrapper
.
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
record
);
lambdaQueryWrapper
.
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
record
);
IdxBizJgRegisterInfo
idxBizJgRegisterInfo
=
idxBizJgRegisterInfoMapper
.
selectOne
(
lambdaQueryWrapper
);
if
(!
ObjectUtils
.
isEmpty
(
idxBizJgRegisterInfo
))
{
String
equCategory
=
idxBizJgRegisterInfo
.
getEquCategory
();
List
<
String
>
codes
=
UseRegisterCancelEquipEnum
.
getCodes
();
if
(
codes
.
contains
(
equCategory
))
{
flag
=
Boolean
.
TRUE
;
}
}
// 1.使用信息表部分字段赋空
// 1.使用信息表部分字段赋空
this
.
rollBackUseInfo
(
record
,
flag
);
this
.
rollBackUseInfo
(
record
,
flag
);
// 2.回滚更新idx_biz_jg_register_info表
// 2.回滚更新idx_biz_jg_register_info表
...
@@ -3812,6 +3931,31 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3812,6 +3931,31 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
}
}
}
private
void
clearUseInfoOfEquipSet
(
JgUseRegistration
jgUseRegistration
)
{
List
<
JgUseRegistrationEq
>
eqList
=
getJgUseRegistrationEqs
(
jgUseRegistration
);
eqList
.
forEach
(
e
->
{
String
record
=
e
.
getEquId
();
Boolean
flag
=
Boolean
.
FALSE
;
LambdaQueryWrapper
<
IdxBizJgRegisterInfo
>
lambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
lambdaQueryWrapper
.
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
record
);
// 1.使用信息表部分字段赋空
this
.
rollBackUseInfo
(
record
,
flag
);
// 2.回滚更新idx_biz_jg_register_info表
this
.
rollBackRegisterInfo
(
record
,
jgUseRegistration
);
// 3.回滚更新idx_biz_jg_supervision_info表
this
.
rollBackSupervisionInfo
(
record
);
// 4.历史设备处理
this
.
dealHisRegEquipData
(
jgUseRegistration
,
record
);
});
Set
<
String
>
equipTransferIds
=
eqList
.
stream
()
.
map
(
JgUseRegistrationEq:
:
getEquipTransferId
)
.
filter
(
Objects:
:
nonNull
)
.
collect
(
Collectors
.
toSet
());
if
(!
equipTransferIds
.
isEmpty
())
{
jgResumeInfoService
.
deleteBatchByBusinessId
(
equipTransferIds
);
}
}
private
void
rollBackForPieLine
(
JgUseRegistration
jgUseRegistration
)
{
private
void
rollBackForPieLine
(
JgUseRegistration
jgUseRegistration
)
{
if
(!
StringUtils
.
isEmpty
(
jgUseRegistration
.
getProjectContraptionId
()))
{
if
(!
StringUtils
.
isEmpty
(
jgUseRegistration
.
getProjectContraptionId
()))
{
// 清除使用登记证编号
// 清除使用登记证编号
...
@@ -3893,6 +4037,71 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -3893,6 +4037,71 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
return
jgRelationEquipMapper
.
selectList
(
eqLambdaQueryWrapper
);
return
jgRelationEquipMapper
.
selectList
(
eqLambdaQueryWrapper
);
}
}
private
void
buildEsInfoForRollBack
(
List
<
String
>
records
,
JgUseRegistration
jgUseRegistration
,
List
<
ESEquipmentCategoryDto
>
equipmentCategoryDtos
,
List
<
ESEquipmentInfo
>
esEquipmentInfos
)
{
for
(
String
record:
records
){
LambdaQueryWrapper
<
IdxBizJgConstructionInfo
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
select
(
IdxBizJgConstructionInfo:
:
getUscUnitCreditCode
,
IdxBizJgConstructionInfo:
:
getUscUnitName
,
IdxBizJgConstructionInfo:
:
getInformCode
,
IdxBizJgConstructionInfo:
:
getInformFilePath
)
.
eq
(
IdxBizJgConstructionInfo:
:
getRecord
,
record
)
.
orderByDesc
(
TzsBaseEntity:
:
getRecDate
)
.
last
(
"limit 1"
);
IdxBizJgConstructionInfo
jgConstructionInfo
=
constructionInfoMapper
.
selectOne
(
wrapper
);
IdxBizJgOtherInfo
otherInfo
=
otherInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgOtherInfo
>()
.
eq
(
IdxBizJgOtherInfo:
:
getRecord
,
record
)
.
select
(
IdxBizJgOtherInfo:
:
getSupervisoryCode
,
IdxBizJgOtherInfo:
:
getCode96333Type
));
Optional
<
ESEquipmentCategoryDto
>
optional
=
esEquipmentCategory
.
findById
(
record
);
Optional
<
ESEquipmentInfo
>
esEquipmentDaoOptional
=
esEquipmentDao
.
findById
(
record
);
if
(
optional
.
isPresent
())
{
ESEquipmentCategoryDto
esEquipmentCategoryDto
=
optional
.
get
();
// 非历史有证设备,作废清除使用登记证编号
if
(!
"1"
.
equals
(
jgUseRegistration
.
getRegType
()))
{
esEquipmentCategoryDto
.
setUSE_ORG_CODE
(
null
);
}
// 历史有证设备、历史无证设备,系统生成的96333清空
if
((
"1"
.
equals
(
jgUseRegistration
.
getRegType
())
||
"2"
.
equals
(
jgUseRegistration
.
getRegType
()))
&&
"2"
.
equals
(
otherInfo
.
getCode96333Type
()))
{
esEquipmentCategoryDto
.
setCODE96333
(
null
);
}
esEquipmentCategoryDto
.
setUSE_ORG_CODE
(
null
);
//esEquipmentCategoryDto.setSTATUS(null);
esEquipmentCategoryDto
.
setEQU_STATE
(
null
);
esEquipmentCategoryDto
.
setOrgBranchCode
(
null
);
esEquipmentCategoryDto
.
setORG_BRANCH_NAME
(
null
);
if
(
jgConstructionInfo
!=
null
)
{
esEquipmentCategoryDto
.
setUSC_UNIT_NAME
(
jgConstructionInfo
.
getUscUnitName
());
esEquipmentCategoryDto
.
setUSC_UNIT_CREDIT_CODE
(
jgConstructionInfo
.
getUscUnitCreditCode
());
}
equipmentCategoryDtos
.
add
(
esEquipmentCategoryDto
);
}
if
(
esEquipmentDaoOptional
.
isPresent
())
{
ESEquipmentInfo
esEquipmentInfo
=
esEquipmentDaoOptional
.
get
();
// 非历史有证设备,作废清除使用登记证编号
if
(!
"1"
.
equals
(
jgUseRegistration
.
getRegType
()))
{
esEquipmentInfo
.
setUSE_ORG_CODE
(
null
);
}
// 历史有证设备、历史无证设备,系统生成的96333清空
if
((
"1"
.
equals
(
jgUseRegistration
.
getRegType
())
||
"2"
.
equals
(
jgUseRegistration
.
getRegType
()))
&&
"2"
.
equals
(
otherInfo
.
getCode96333Type
()))
{
esEquipmentInfo
.
setCODE96333
(
null
);
}
esEquipmentInfo
.
setUSE_ORG_CODE
(
null
);
//esEquipmentCategoryDto.setSTATUS(null);
esEquipmentInfo
.
setEQU_STATE
(
null
);
esEquipmentInfo
.
setORG_BRANCH_CODE
(
null
);
esEquipmentInfo
.
setORG_BRANCH_NAME
(
null
);
if
(
jgConstructionInfo
!=
null
)
{
esEquipmentInfo
.
setUSC_UNIT_NAME
(
jgConstructionInfo
.
getUscUnitName
());
esEquipmentInfo
.
setUSC_UNIT_CREDIT_CODE
(
jgConstructionInfo
.
getUscUnitCreditCode
());
}
esEquipmentInfos
.
add
(
esEquipmentInfo
);
}
}
}
private
void
rollBackForEquipEsInfo
(
String
record
,
Boolean
flag
,
JgUseRegistration
jgUseRegistration
)
{
private
void
rollBackForEquipEsInfo
(
String
record
,
Boolean
flag
,
JgUseRegistration
jgUseRegistration
)
{
LambdaQueryWrapper
<
IdxBizJgConstructionInfo
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
IdxBizJgConstructionInfo
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
select
(
IdxBizJgConstructionInfo:
:
getUscUnitCreditCode
,
wrapper
.
select
(
IdxBizJgConstructionInfo:
:
getUscUnitCreditCode
,
...
...
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