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
4037bec5
Commit
4037bec5
authored
Feb 13, 2025
by
Lambertliu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(jg):作废功能bug修改
parent
0deca752
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
44 deletions
+78
-44
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+78
-44
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 @
4037bec5
...
...
@@ -2940,7 +2940,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if
(
"unit"
.
equals
(
jgUseRegistration
.
getManageType
())){
//单位办理-历史作废
if
(
"1"
.
equals
(
jgUseRegistration
.
getRegType
())){
jgUseRegistration
.
setStatus
(
FlowStatusEnum
.
TO_BE_DISCARD
.
getName
());
// 构建设备删除的 DTO 列表
List
<
ESEquipmentCategoryDto
>
esDtoList
=
records
.
stream
().
map
(
v
->
{
ESEquipmentCategoryDto
esDto
=
new
ESEquipmentCategoryDto
();
...
...
@@ -2959,41 +2958,59 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if
(!
ValidationUtil
.
isEmpty
(
jgUseRegistration
.
getProjectContraptionId
()))
{
idxBizJgProjectContraptionMapper
.
delete
(
new
LambdaQueryWrapper
<
IdxBizJgProjectContraption
>().
eq
(
IdxBizJgProjectContraption:
:
getSequenceNbr
,
jgUseRegistration
.
getProjectContraptionId
()));
}
}
else
{
if
(
jgUseRegistration
.
getUseRegistrationCode
().
startsWith
(
"管"
))
{
}
else
{
//判断是否管道
if
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
jgUseRegistration
.
getStatus
())
&&
jgUseRegistration
.
getUseRegistrationCode
().
startsWith
(
"管"
))
{
JgUseRegistration
lastUseRegistration
=
jgUseRegistrationMapper
.
selectOne
(
new
LambdaQueryWrapper
<
JgUseRegistration
>()
.
select
(
JgUseRegistration:
:
getApplyNo
)
.
eq
(
JgUseRegistration:
:
getProjectContraptionId
,
jgUseRegistration
.
getProjectContraptionId
())
.
ne
(
JgUseRegistration:
:
getStatus
,
"已作废"
)
.
eq
(
JgUseRegistration:
:
getIsDelete
,
false
)
.
orderByDesc
(
JgUseRegistration:
:
getApplyNo
)
.
last
(
"limit 1"
));
if
(
lastUseRegistration
!=
null
&&
!
lastUseRegistration
.
getApplyNo
().
equals
(
jgUseRegistration
.
getApplyNo
()))
{
throw
new
BadRequest
(
"作废失败,该使用登记证下有合并工程装置,请先作废最新单据后再作废此单据!"
);
}
if
(
jgUseRegistration
.
getProjectContraptionId
()
==
null
)
{
throw
new
BadRequest
(
"该作废单据没有工程装置,请联系管理员处理此单据!"
);
}
}
if
(
jgUseRegistration
.
getProjectContraptionId
()
!=
null
)
{
//2.合并后作废
if
(!
jgUseRegistration
.
getOriginProjectContraptionIds
().
contains
(
jgUseRegistration
.
getProjectContraptionId
())){
eqList
.
forEach
(
v
->{
// 1.根据eq关系表中保存的原工程装置与设备关系还原use_info和ES
esEquipmentCategory
.
findById
(
v
.
getEquId
()).
ifPresent
(
equInfoEs
->
{
equInfoEs
.
setProjectContraptionId
(
v
.
getOriginProjectContraptionId
());
esEquipmentCategory
.
save
(
equInfoEs
);
});
LambdaQueryWrapper
<
IdxBizJgUseInfo
>
lambda
=
new
QueryWrapper
<
IdxBizJgUseInfo
>().
lambda
();
lambda
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
String
.
valueOf
(
v
.
getEquId
()));
IdxBizJgUseInfo
useInfo
=
useInfoMapper
.
selectOne
(
lambda
);
useInfo
.
setProjectContraptionId
(
v
.
getOriginProjectContraptionId
());
useInfoMapper
.
updateById
(
useInfo
);
IdxBizJgProjectContraption
originProjectContraption
=
jgProjectContraptionService
.
getById
(
v
.
getOriginProjectContraptionId
());
//还原 原工程装置下equCode和监管码
LambdaUpdateWrapper
<
IdxBizJgRegisterInfo
>
updateWrapper
=
new
UpdateWrapper
<
IdxBizJgRegisterInfo
>().
lambda
()
.
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
v
.
getEquId
());
IdxBizJgRegisterInfo
idxBizJgRegisterInfo
=
new
IdxBizJgRegisterInfo
();
idxBizJgRegisterInfo
.
setEquCode
(
originProjectContraption
.
getEquCode
());
idxBizJgRegisterInfoMapper
.
update
(
idxBizJgRegisterInfo
,
updateWrapper
);
LambdaUpdateWrapper
<
IdxBizJgOtherInfo
>
otherInfoLambdaUpdateWrapper
=
new
UpdateWrapper
<
IdxBizJgOtherInfo
>().
lambda
()
.
eq
(
IdxBizJgOtherInfo:
:
getRecord
,
v
.
getEquId
());
IdxBizJgOtherInfo
idxBizJgOtherInfo
=
new
IdxBizJgOtherInfo
();
idxBizJgOtherInfo
.
setSupervisoryCode
(
originProjectContraption
.
getSupervisoryCode
());
otherInfoMapper
.
update
(
idxBizJgOtherInfo
,
otherInfoLambdaUpdateWrapper
);
}
);
//2.根据工程装置ID查询工程装置父级,重置工程装置父级为空
eqList
.
stream
()
.
filter
(
v
->
jgUseRegistration
.
getOriginProjectContraptionIds
().
contains
(
v
.
getOriginProjectContraptionId
()))
.
forEach
(
v
->
esEquipmentCategory
.
findById
(
v
.
getEquId
()).
ifPresent
(
equInfoEs
->
{
equInfoEs
.
setProjectContraptionId
(
v
.
getOriginProjectContraptionId
());
esEquipmentCategory
.
save
(
equInfoEs
);
LambdaQueryWrapper
<
IdxBizJgUseInfo
>
lambda
=
new
QueryWrapper
<
IdxBizJgUseInfo
>().
lambda
();
lambda
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
String
.
valueOf
(
v
.
getEquId
()));
IdxBizJgUseInfo
useInfo
=
useInfoMapper
.
selectOne
(
lambda
);
useInfo
.
setProjectContraptionId
(
v
.
getOriginProjectContraptionId
());
useInfoMapper
.
updateById
(
useInfo
);
IdxBizJgProjectContraption
originProjectContraption
=
jgProjectContraptionService
.
getById
(
v
.
getOriginProjectContraptionId
());
//还原 原工程装置下equCode和监管码
LambdaUpdateWrapper
<
IdxBizJgRegisterInfo
>
updateWrapper
=
new
UpdateWrapper
<
IdxBizJgRegisterInfo
>().
lambda
()
.
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
v
.
getEquId
());
IdxBizJgRegisterInfo
idxBizJgRegisterInfo
=
new
IdxBizJgRegisterInfo
();
idxBizJgRegisterInfo
.
setEquCode
(
originProjectContraption
.
getEquCode
());
idxBizJgRegisterInfoMapper
.
update
(
idxBizJgRegisterInfo
,
updateWrapper
);
LambdaUpdateWrapper
<
IdxBizJgOtherInfo
>
otherInfoLambdaUpdateWrapper
=
new
UpdateWrapper
<
IdxBizJgOtherInfo
>().
lambda
()
.
eq
(
IdxBizJgOtherInfo:
:
getRecord
,
v
.
getEquId
());
IdxBizJgOtherInfo
idxBizJgOtherInfo
=
new
IdxBizJgOtherInfo
();
idxBizJgOtherInfo
.
setSupervisoryCode
(
originProjectContraption
.
getSupervisoryCode
());
otherInfoMapper
.
update
(
idxBizJgOtherInfo
,
otherInfoLambdaUpdateWrapper
);
})
);
//2.根据工程装置ID查询工程装置父级,重置
子
工程装置父级为空
jgProjectContraptionService
.
update
(
new
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>()
.
eq
(
IdxBizJgProjectContraption:
:
getProjectContraptionParentId
,
jgUseRegistration
.
getProjectContraptionId
(
))
.
in
(
BaseEntity:
:
getSequenceNbr
,
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
)
))
.
set
(
IdxBizJgProjectContraption:
:
getProjectContraptionParentId
,
null
)
);
JgRegistrationHistory
history
=
jgRegistrationHistoryService
.
queryLatestRegistrationHistory
(
Long
.
valueOf
(
jgUseRegistration
.
getProjectContraptionId
()));
...
...
@@ -3001,41 +3018,58 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
JSONObject
hisJson
=
JSON
.
parseObject
(
history
.
getChangeData
());
boolean
isFirstMerge
=
(
boolean
)
hisJson
.
get
(
"isFirstMerge"
);
//合并到无证总工程
IdxBizJgProjectContraption
projectContraption
=
jgProjectContraptionService
.
getById
(
jgUseRegistration
.
getProjectContraptionId
());
if
(
isFirstMerge
)
{
IdxBizJgProjectContraption
projectContraption
=
jgProjectContraptionService
.
getById
(
jgUseRegistration
.
getProjectContraptionId
());
projectContraption
.
setIsIntoManagement
(
false
);
projectContraption
.
setIsFirstMerge
(
true
);
projectContraption
.
setSupervisoryCode
(
null
);
projectContraption
.
setEquCode
(
null
);
projectContraption
.
setUseRegistrationCode
(
null
);
jgProjectContraptionService
.
updateById
(
projectContraption
);
jgUseRegistration
.
setStatus
(
FlowStatusEnum
.
TO_BE_DISCARD
.
getName
());
projectContraption
.
setPipelineLength
(
0.0
);
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask
(
records
);
}
else
{
List
<
IdxBizJgUseInfo
>
useInfoRecords
=
idxBizJgUseInfoService
.
lambdaQuery
()
.
select
(
IdxBizJgUseInfo:
:
getRecord
)
.
in
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
)))
// 查询原工程装置及 useInfo 记录
List
<
String
>
originProjectContraptionIds
=
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
));
List
<
IdxBizJgProjectContraption
>
originProjectContraptionList
=
jgProjectContraptionService
.
lambdaQuery
()
.
in
(
BaseEntity:
:
getSequenceNbr
,
originProjectContraptionIds
)
.
list
();
records
=
useInfoRecords
.
stream
().
map
(
IdxBizJgUseInfo:
:
getRecord
).
collect
(
Collectors
.
toList
());
// 统一处理设备的纳管状态【注册事务提交后的操作】
records
=
idxBizJgUseInfoService
.
lambdaQuery
()
.
select
(
IdxBizJgUseInfo:
:
getRecord
)
.
in
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
originProjectContraptionIds
)
.
list
()
.
stream
()
.
map
(
IdxBizJgUseInfo:
:
getRecord
)
.
collect
(
Collectors
.
toList
());
// 统一处理设备的纳管状态
registerAfterCommitTask
(
records
);
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
// 计算管道长度并更新
double
originPipelineLength
=
originProjectContraptionList
.
stream
()
.
map
(
IdxBizJgProjectContraption:
:
getPipelineLength
)
.
filter
(
Objects:
:
nonNull
)
.
mapToDouble
(
Double:
:
doubleValue
)
.
sum
();
projectContraption
.
setPipelineLength
(
projectContraption
.
getPipelineLength
()
-
originPipelineLength
);
}
jgProjectContraptionService
.
updateById
(
projectContraption
);
}
}
//1.子工程装置作废,正常逻辑
else
{
jgUseRegistration
.
setStatus
(
FlowStatusEnum
.
TO_BE_DISCARD
.
getName
());
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask
(
records
);
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
}
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
}
//气瓶
else
{
jgUseRegistration
.
setStatus
(
FlowStatusEnum
.
TO_BE_DISCARD
.
getName
());
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
// 统一处理设备的纳管状态【注册事务提交后的操作】
...
...
@@ -3045,12 +3079,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
//台套办理
else
{
jgUseRegistration
.
setStatus
(
FlowStatusEnum
.
TO_BE_DISCARD
.
getName
());
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask
(
records
);
}
jgUseRegistration
.
setStatus
(
FlowStatusEnum
.
TO_BE_DISCARD
.
getName
());
this
.
updateById
(
jgUseRegistration
);
return
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