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
b4eb682d
Commit
b4eb682d
authored
Jun 06, 2025
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(大编辑):管道增减功能开发
1.改造告知增加装置查询
parent
f788f847
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
343 additions
and
103 deletions
+343
-103
DataBackupManager.java
...mos/boot/module/jg/biz/edit/backup/DataBackupManager.java
+1
-1
DefaultEquipBackupManager.java
.../module/jg/biz/edit/backup/DefaultEquipBackupManager.java
+3
-3
EquipBackupHandler.java
...os/boot/module/jg/biz/edit/backup/EquipBackupHandler.java
+75
-17
TechParamsBackupService.java
...ot/module/jg/biz/edit/backup/TechParamsBackupService.java
+96
-0
DefaultBizDataChangeHandler.java
.../jg/biz/edit/process/biz/DefaultBizDataChangeHandler.java
+5
-1
SingleEquipChangeProcess.java
...e/jg/biz/edit/process/equip/SingleEquipChangeProcess.java
+4
-1
SingleProjectEquipChangeProcess.java
...z/edit/process/equip/SingleProjectEquipChangeProcess.java
+2
-1
IEquipChangeDataProcessStrategy.java
...ocess/equip/strategy/IEquipChangeDataProcessStrategy.java
+4
-1
JgChangeRegistrationReformServiceImpl.java
...z/service/impl/JgChangeRegistrationReformServiceImpl.java
+28
-0
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+125
-78
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/edit/backup/DataBackupManager.java
View file @
b4eb682d
...
...
@@ -6,5 +6,5 @@ import java.util.List;
public
interface
DataBackupManager
{
void
backup
(
String
key
);
void
restore
(
String
key
);
Boolean
restore
(
String
key
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/backup/DefaultEquipBackupManager.java
View file @
b4eb682d
...
...
@@ -21,9 +21,9 @@ public abstract class DefaultEquipBackupManager implements DataBackupManager {
handler
.
backup2Db
(
getBizType
(),
bizId
,
getRecords
(
bizId
));
}
public
void
restore
(
String
bizId
)
{
public
Boolean
restore
(
String
bizId
)
{
EquipBackupHandler
handler
=
applicationContext
.
getBean
(
EquipBackupHandler
.
class
);
handler
.
restoreFormBackup
(
getBizType
(),
bizId
);
return
handler
.
restoreFormBackup
(
getBizType
(),
bizId
);
}
public
void
updateLastOne
(
String
bizId
,
List
<
FieldChangeMeta
>
changeMetas
)
{
...
...
@@ -39,7 +39,7 @@ public abstract class DefaultEquipBackupManager implements DataBackupManager {
public
List
<
IdxBizJgPipelineOperationHist
>
listAll
(
String
bizId
){
EquipBackupHandler
handler
=
applicationContext
.
getBean
(
EquipBackupHandler
.
class
);
return
handler
.
list
Backup
(
getBizType
(),
bizId
);
return
handler
.
list
AllBackupOfOneBizId
(
getBizType
(),
bizId
);
}
public
abstract
List
<
String
>
getRecords
(
String
bizId
);
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/backup/EquipBackupHandler.java
View file @
b4eb682d
...
...
@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import
com.yeejoin.amos.boot.module.jg.api.entity.IdxBizJgPipelineOperationHist
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.*
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.*
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.SuperviseInfoMapper
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
...
...
@@ -25,7 +26,22 @@ public class EquipBackupHandler {
private
final
IdxBizJgRegisterInfoServiceImpl
registerInfoService
;
private
final
IdxBizJgSupervisionInfoServiceImpl
supervisionInfoService
;
private
final
IdxBizJgFactoryInfoServiceImpl
factoryInfoService
;
private
final
IdxBizJgConstructionInfoServiceImpl
constructionInfoService
;
private
final
IdxBizJgInspectionDetectionInfoServiceImpl
inspectionDetectionInfoService
;
private
final
ESEquipmentCategory
equipmentCategory
;
private
final
TechParamsBackupService
techParamsBackupService
;
private
final
SuperviseInfoMapper
superviseInfoMapper
;
private
final
static
String
BACKUP_JSON_KEY_OTHER_INFO
=
"otherInfo"
;
private
final
static
String
BACKUP_JSON_KEY_USE_INFO
=
"useInfo"
;
private
final
static
String
BACKUP_JSON_KEY_REGISTER_INFO
=
"registerInfo"
;
private
final
static
String
BACKUP_JSON_KEY_SUPERVISION_INFO
=
"supervisionInfo"
;
private
final
static
String
BACKUP_JSON_KEY_FACTORY_INFO
=
"factoryInfo"
;
private
final
static
String
BACKUP_JSON_KEY_CONSTRUCTION_INFO
=
"constructionInfoList"
;
private
final
static
String
BACKUP_JSON_KEY_INSPECTION_DETECTION_INFO
=
"inspectionDetectionInfoList"
;
private
final
static
String
BACKUP_JSON_KEY_INSPECTION_ES_INFO
=
"esInfo"
;
private
final
static
String
BACKUP_JSON_KEY_TECH_PARAM_INFO
=
"techParamInfo"
;
public
void
backup2Db
(
String
bizType
,
String
bizId
,
List
<
String
>
records
)
{
IdxBizJgPipelineOperationHist
deleteHistory
=
pipelineDeleteHistoryService
.
getOne
(
new
LambdaQueryWrapper
<
IdxBizJgPipelineOperationHist
>().
eq
(
IdxBizJgPipelineOperationHist:
:
getBizType
,
bizType
).
eq
(
IdxBizJgPipelineOperationHist:
:
getBizId
,
bizId
).
orderByDesc
(
IdxBizJgPipelineOperationHist:
:
getVersion
).
last
(
"limit 1"
));
...
...
@@ -56,49 +72,91 @@ public class EquipBackupHandler {
private
String
buildDeleteData
(
List
<
String
>
records
)
{
List
<
Map
<
String
,
Object
>>
data
=
records
.
stream
().
map
(
record
->
{
IdxBizJgRegisterInfo
registerInfo
=
registerInfoService
.
getOneData
(
record
);
Map
<
String
,
Object
>
item
=
new
HashMap
<>();
item
.
put
(
"otherInfo"
,
otherInfoService
.
getOneData
(
record
));
item
.
put
(
"registerInfo"
,
registerInfoService
.
getOneData
(
record
));
item
.
put
(
"supervisionInfo"
,
supervisionInfoService
.
getOneData
(
record
));
item
.
put
(
"factoryInfo"
,
factoryInfoService
.
getOneData
(
record
));
item
.
put
(
"useInfo"
,
useInfoService
.
getOneData
(
record
));
item
.
put
(
BACKUP_JSON_KEY_OTHER_INFO
,
otherInfoService
.
getOneData
(
record
));
item
.
put
(
BACKUP_JSON_KEY_REGISTER_INFO
,
registerInfo
);
item
.
put
(
BACKUP_JSON_KEY_SUPERVISION_INFO
,
supervisionInfoService
.
getOneData
(
record
));
item
.
put
(
BACKUP_JSON_KEY_FACTORY_INFO
,
factoryInfoService
.
getOneData
(
record
));
item
.
put
(
BACKUP_JSON_KEY_USE_INFO
,
useInfoService
.
getOneData
(
record
));
// 技术参数
item
.
put
(
BACKUP_JSON_KEY_TECH_PARAM_INFO
,
this
.
getTechParamByEquListAndRecord
(
registerInfo
.
getEquList
(),
record
));
// 检验流水数组
item
.
put
(
BACKUP_JSON_KEY_INSPECTION_DETECTION_INFO
,
this
.
getInspectList
(
record
));
// 施工流水
item
.
put
(
BACKUP_JSON_KEY_CONSTRUCTION_INFO
,
this
.
getConstructionList
(
record
));
Optional
<
ESEquipmentCategoryDto
>
op
=
equipmentCategory
.
findById
(
record
);
op
.
ifPresent
(
e
->
item
.
put
(
"esInfo"
,
e
));
op
.
ifPresent
(
e
->
item
.
put
(
BACKUP_JSON_KEY_INSPECTION_ES_INFO
,
e
));
return
item
;
}).
collect
(
Collectors
.
toList
());
return
JSONObject
.
toJSONString
(
data
);
}
private
List
<
IdxBizJgConstructionInfo
>
getConstructionList
(
String
record
)
{
return
constructionInfoService
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgConstructionInfo
>().
eq
(
IdxBizJgConstructionInfo:
:
getRecord
,
record
));
}
private
List
<
IdxBizJgInspectionDetectionInfo
>
getInspectList
(
String
record
)
{
return
inspectionDetectionInfoService
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgInspectionDetectionInfo
>().
eq
(
IdxBizJgInspectionDetectionInfo:
:
getRecord
,
record
));
}
private
Object
getTechParamByEquListAndRecord
(
String
equList
,
String
record
)
{
return
techParamsBackupService
.
getTechParams
(
equList
,
record
);
}
/**
* 在最小版本中恢复数据
*
* @param bizType 业务类型
* @param bizId 业务唯一标识
* @return 是否存在编辑记录-存在则恢复
*/
public
void
restoreFormBackup
(
String
bizType
,
String
bizId
)
{
public
Boolean
restoreFormBackup
(
String
bizType
,
String
bizId
)
{
List
<
IdxBizJgPipelineOperationHist
>
opHisList
=
pipelineDeleteHistoryService
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgPipelineOperationHist
>()
.
eq
(
IdxBizJgPipelineOperationHist:
:
getBizType
,
bizType
)
.
eq
(
IdxBizJgPipelineOperationHist:
:
getBizId
,
bizId
).
orderByAsc
(
IdxBizJgPipelineOperationHist:
:
getVersion
));
if
(!
opHisList
.
isEmpty
())
{
IdxBizJgPipelineOperationHist
deleteHistory
=
opHisList
.
get
(
0
);
Optional
.
ofNullable
(
deleteHistory
.
getOData
()).
ifPresent
(
oData
->
{
List
<
JSONObject
>
deleteEqs
=
JSONObject
.
parseArray
(
deleteHistory
.
getOData
(),
JSONObject
.
class
);
// 按照最小的版本恢复数据
IdxBizJgPipelineOperationHist
operationHist
=
opHisList
.
get
(
0
);
Optional
.
ofNullable
(
operationHist
.
getOData
()).
ifPresent
(
oData
->
{
List
<
JSONObject
>
deleteEqs
=
JSONObject
.
parseArray
(
operationHist
.
getOData
(),
JSONObject
.
class
);
deleteEqs
.
forEach
(
eq
->
{
IdxBizJgOtherInfo
otherInfo
=
JSONObject
.
parseObject
(
eq
.
getString
(
"otherInfo"
),
IdxBizJgOtherInfo
.
class
);
IdxBizJgRegisterInfo
registerInfo
=
JSONObject
.
parseObject
(
eq
.
getString
(
"registerInfo"
),
IdxBizJgRegisterInfo
.
class
);
IdxBizJgSupervisionInfo
supervisionInfo
=
JSONObject
.
parseObject
(
eq
.
getString
(
"supervisionInfo"
),
IdxBizJgSupervisionInfo
.
class
);
IdxBizJgFactoryInfo
factoryInfo
=
JSONObject
.
parseObject
(
eq
.
getString
(
"factoryInfo"
),
IdxBizJgFactoryInfo
.
class
);
IdxBizJgUseInfo
useInfo
=
JSONObject
.
parseObject
(
eq
.
getString
(
"useInfo"
),
IdxBizJgUseInfo
.
class
);
IdxBizJgOtherInfo
otherInfo
=
JSONObject
.
parseObject
(
eq
.
getString
(
BACKUP_JSON_KEY_OTHER_INFO
),
IdxBizJgOtherInfo
.
class
);
IdxBizJgRegisterInfo
registerInfo
=
JSONObject
.
parseObject
(
eq
.
getString
(
BACKUP_JSON_KEY_REGISTER_INFO
),
IdxBizJgRegisterInfo
.
class
);
IdxBizJgSupervisionInfo
supervisionInfo
=
JSONObject
.
parseObject
(
eq
.
getString
(
BACKUP_JSON_KEY_SUPERVISION_INFO
),
IdxBizJgSupervisionInfo
.
class
);
IdxBizJgFactoryInfo
factoryInfo
=
JSONObject
.
parseObject
(
eq
.
getString
(
BACKUP_JSON_KEY_FACTORY_INFO
),
IdxBizJgFactoryInfo
.
class
);
IdxBizJgUseInfo
useInfo
=
JSONObject
.
parseObject
(
eq
.
getString
(
BACKUP_JSON_KEY_USE_INFO
),
IdxBizJgUseInfo
.
class
);
otherInfoService
.
save
(
otherInfo
);
registerInfoService
.
save
(
registerInfo
);
supervisionInfoService
.
save
(
supervisionInfo
);
factoryInfoService
.
save
(
factoryInfo
);
useInfoService
.
save
(
useInfo
);
equipmentCategory
.
save
(
JSONObject
.
parseObject
(
eq
.
getString
(
"esInfo"
),
ESEquipmentCategoryDto
.
class
));
// 检验流水
List
<
IdxBizJgInspectionDetectionInfo
>
inspectionDetectionInfos
=
JSONObject
.
parseArray
(
eq
.
getString
(
BACKUP_JSON_KEY_INSPECTION_DETECTION_INFO
),
IdxBizJgInspectionDetectionInfo
.
class
);
if
(!
inspectionDetectionInfos
.
isEmpty
())
{
inspectionDetectionInfoService
.
saveBatch
(
inspectionDetectionInfos
);
}
// 施工流水
List
<
IdxBizJgConstructionInfo
>
constructionInfoList
=
JSONObject
.
parseArray
(
eq
.
getString
(
BACKUP_JSON_KEY_CONSTRUCTION_INFO
),
IdxBizJgConstructionInfo
.
class
);
if
(!
constructionInfoList
.
isEmpty
())
{
constructionInfoService
.
saveBatch
(
constructionInfoList
);
}
// 技术参数
techParamsBackupService
.
save
(
registerInfo
.
getEquList
(),
eq
.
getString
(
BACKUP_JSON_KEY_TECH_PARAM_INFO
));
// 设备es数据
equipmentCategory
.
save
(
JSONObject
.
parseObject
(
eq
.
getString
(
BACKUP_JSON_KEY_INSPECTION_ES_INFO
),
ESEquipmentCategoryDto
.
class
));
});
});
// insert的删除
List
<
String
>
insertIds
=
opHisList
.
stream
().
flatMap
(
o
->
o
.
getInsertPipelines
().
stream
()).
collect
(
Collectors
.
toList
());
insertIds
.
remove
(
null
);
insertIds
.
remove
(
""
);
if
(!
insertIds
.
isEmpty
())
{
superviseInfoMapper
.
deleteDataAll
(
insertIds
);
}
}
return
!
opHisList
.
isEmpty
();
}
public
void
updateOperateRecords
(
String
bizId
,
String
bizType
,
List
<
String
>
insertRecord
,
List
<
String
>
deleteRecords
)
{
...
...
@@ -110,7 +168,7 @@ public class EquipBackupHandler {
}
}
public
List
<
IdxBizJgPipelineOperationHist
>
list
Backup
(
String
bizType
,
String
bizId
)
{
public
List
<
IdxBizJgPipelineOperationHist
>
list
AllBackupOfOneBizId
(
String
bizType
,
String
bizId
)
{
return
pipelineDeleteHistoryService
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgPipelineOperationHist
>()
.
eq
(
IdxBizJgPipelineOperationHist:
:
getBizType
,
bizType
)
.
eq
(
IdxBizJgPipelineOperationHist:
:
getBizId
,
bizId
).
orderByAsc
(
IdxBizJgPipelineOperationHist:
:
getVersion
));
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/backup/TechParamsBackupService.java
0 → 100644
View file @
b4eb682d
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
backup
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.biz.service.*
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.*
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Component
;
import
java.util.Objects
;
@Component
@RequiredArgsConstructor
public
class
TechParamsBackupService
{
private
final
IIdxBizJgTechParamsElevatorService
iIdxBizJgTechParamsElevatorService
;
private
final
IIdxBizJgTechParamsVehicleService
iIdxBizJgTechParamsVehicleService
;
private
final
IIdxBizJgTechParamsRopewayService
iIdxBizJgTechParamsRopewayService
;
private
final
IIdxBizJgTechParamsRidesService
iIdxBizJgTechParamsRidesService
;
private
final
IIdxBizJgTechParamsBoilerService
iIdxBizJgTechParamsBoilerService
;
private
final
IIdxBizJgTechParamsVesselService
iIdxBizJgTechParamsVesselService
;
private
final
IIdxBizJgTechParamsPipelineService
iIdxBizJgTechParamsPipelineService
;
private
final
IIdxBizJgTechParamsLiftingService
iIdxBizJgTechParamsLiftingService
;
public
Object
getTechParams
(
String
equList
,
String
record
)
{
EquipmentClassifityEnum
equipmentClassifityEnum
=
EquipmentClassifityEnum
.
getOne
(
equList
);
switch
(
Objects
.
requireNonNull
(
equipmentClassifityEnum
))
{
case
GL:
// 锅炉
return
iIdxBizJgTechParamsBoilerService
.
getOneData
(
record
);
case
YLRQ:
// 压力容器
return
iIdxBizJgTechParamsVesselService
.
getOneData
(
record
);
case
DT:
// 电梯
return
iIdxBizJgTechParamsElevatorService
.
getOneData
(
record
);
case
QZJX:
// 起重机械
return
iIdxBizJgTechParamsLiftingService
.
getOneData
(
record
);
case
CC:
// 场(厂)内专用机动车辆
return
iIdxBizJgTechParamsVehicleService
.
getOneData
(
record
);
case
YLSS:
// 大型游乐设施
return
iIdxBizJgTechParamsRidesService
.
getOneData
(
record
);
case
YLGD:
// 压力管道
return
iIdxBizJgTechParamsPipelineService
.
getOneData
(
record
);
case
KYSD:
// 客运索道
return
iIdxBizJgTechParamsRopewayService
.
getOneData
(
record
);
default
:
break
;
}
return
null
;
}
public
void
save
(
String
equList
,
String
json
)
{
EquipmentClassifityEnum
equipmentClassifityEnum
=
EquipmentClassifityEnum
.
getOne
(
equList
);
switch
(
Objects
.
requireNonNull
(
equipmentClassifityEnum
))
{
case
GL:
// 锅炉
IdxBizJgTechParamsBoiler
bizJgTechParamsBoiler
=
JSONObject
.
parseObject
(
json
,
IdxBizJgTechParamsBoiler
.
class
);
iIdxBizJgTechParamsBoilerService
.
save
(
bizJgTechParamsBoiler
);
case
YLRQ:
// 压力容器
IdxBizJgTechParamsVessel
techParamsVessel
=
JSONObject
.
parseObject
(
json
,
IdxBizJgTechParamsVessel
.
class
);
iIdxBizJgTechParamsVesselService
.
save
(
techParamsVessel
);
case
DT:
// 电梯
IdxBizJgTechParamsElevator
techParamsElevator
=
JSONObject
.
parseObject
(
json
,
IdxBizJgTechParamsElevator
.
class
);
iIdxBizJgTechParamsElevatorService
.
save
(
techParamsElevator
);
case
QZJX:
// 起重机械
IdxBizJgTechParamsLifting
jgTechParamsLifting
=
JSONObject
.
parseObject
(
json
,
IdxBizJgTechParamsLifting
.
class
);
iIdxBizJgTechParamsLiftingService
.
save
(
jgTechParamsLifting
);
case
CC:
// 场(厂)内专用机动车辆
IdxBizJgTechParamsVehicle
techParamsVehicle
=
JSONObject
.
parseObject
(
json
,
IdxBizJgTechParamsVehicle
.
class
);
iIdxBizJgTechParamsVehicleService
.
save
(
techParamsVehicle
);
case
YLSS:
// 大型游乐设施
IdxBizJgTechParamsRides
techParamsRides
=
JSONObject
.
parseObject
(
json
,
IdxBizJgTechParamsRides
.
class
);
iIdxBizJgTechParamsRidesService
.
save
(
techParamsRides
);
case
YLGD:
// 压力管道
IdxBizJgTechParamsPipeline
techParamsPipeline
=
JSONObject
.
parseObject
(
json
,
IdxBizJgTechParamsPipeline
.
class
);
iIdxBizJgTechParamsPipelineService
.
save
(
techParamsPipeline
);
case
KYSD:
// 客运索道
IdxBizJgTechParamsRopeway
techParamsRopeway
=
JSONObject
.
parseObject
(
json
,
IdxBizJgTechParamsRopeway
.
class
);
iIdxBizJgTechParamsRopewayService
.
save
(
techParamsRopeway
);
default
:
break
;
}
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/biz/DefaultBizDataChangeHandler.java
View file @
b4eb682d
...
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.module.jg.api.dto.BizRelationDataDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta
;
import
com.yeejoin.amos.boot.module.jg.api.dto.PipelineChangeItemDto
;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipDataProcessStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.controller.BizDataChangeController
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.core.IEventPublisher
;
...
...
@@ -45,7 +46,7 @@ public abstract class DefaultBizDataChangeHandler<U extends BaseBizDataChangeEve
changeData
.
remove
(
"changeReason"
);
changeData
.
remove
(
"changeAttachment"
);
IEquipChangeDataProcessStrategy
dataProcessor
=
EquipDataProcessStrategyContext
.
getStrategy
(
model
);
List
<
FieldChangeMeta
>
allChangeColumns
=
dataProcessor
.
handle
(
changeData
,
bizId
);
List
<
FieldChangeMeta
>
allChangeColumns
=
dataProcessor
.
handle
(
changeData
,
bizId
,
this
::
callBack
);
List
<
FieldChangeMeta
>
bizEditColumns
=
postSave
(
bizId
,
applyNo
,
model
,
changeData
,
allChangeColumns
);
allChangeColumns
.
addAll
(
bizEditColumns
);
// 发送数据变更消息
...
...
@@ -53,6 +54,9 @@ public abstract class DefaultBizDataChangeHandler<U extends BaseBizDataChangeEve
}
}
private
void
callBack
(
Map
<
String
,
List
<
PipelineChangeItemDto
>>
stringListMap
)
{
}
public
abstract
void
preSave
(
String
bizId
,
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
);
private
void
publish2OtherBiz
(
List
<
FieldChangeMeta
>
allChangeColumns
,
String
applyNo
,
JSONObject
oData
,
ReginParams
selectedOrgInfo
)
{
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/equip/SingleEquipChangeProcess.java
View file @
b4eb682d
...
...
@@ -7,6 +7,8 @@ import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import
com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity
;
import
com.yeejoin.amos.boot.module.jg.api.common.BizCommonConstant
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta
;
import
com.yeejoin.amos.boot.module.jg.api.dto.PieLineDesignChangeDataDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.PipelineChangeItemDto
;
import
com.yeejoin.amos.boot.module.jg.api.enums.CylinderTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.DefaultBizDataChangeHandler
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy
;
...
...
@@ -20,6 +22,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Consumer
;
/**
* 单个维护设备-策略实现类
...
...
@@ -32,7 +35,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
private
final
CommonEquipDataProcessService
commonEquipDataProcessService
;
@Override
public
List
<
FieldChangeMeta
>
handle
(
Map
<
String
,
Object
>
changeData
,
String
record
)
{
public
List
<
FieldChangeMeta
>
handle
(
Map
<
String
,
Object
>
changeData
,
String
record
,
Consumer
<
Map
<
String
,
List
<
PipelineChangeItemDto
>>>
callBack
)
{
JSONObject
changeJson
=
new
JSONObject
(
changeData
);
List
<
FieldChangeMeta
>
allChangeColumns
=
new
ArrayList
<>();
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/equip/SingleProjectEquipChangeProcess.java
View file @
b4eb682d
...
...
@@ -19,6 +19,7 @@ import org.springframework.stereotype.Component;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.*
;
import
java.util.function.Consumer
;
/**
* 单个装置维护-策略实现类
...
...
@@ -33,7 +34,7 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS
@Override
public
List
<
FieldChangeMeta
>
handle
(
Map
<
String
,
Object
>
changeData
,
String
projectContraptionId
)
{
public
List
<
FieldChangeMeta
>
handle
(
Map
<
String
,
Object
>
changeData
,
String
projectContraptionId
,
Consumer
<
Map
<
String
,
List
<
PipelineChangeItemDto
>>>
callBack
)
{
JSONObject
data
=
(
JSONObject
)
changeData
;
// 新增编辑的管道------------------tableData
JSONArray
insertOrEditPieLines
=
data
.
getJSONArray
(
RequestChangeData
.
multiDataKey
);
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/equip/strategy/IEquipChangeDataProcessStrategy.java
View file @
b4eb682d
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
process
.
equip
.
strategy
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta
;
import
com.yeejoin.amos.boot.module.jg.api.dto.PipelineChangeItemDto
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Consumer
;
/**
* 处理监策略类
...
...
@@ -21,5 +23,6 @@ public interface IEquipChangeDataProcessStrategy {
/**
* 处理
*/
List
<
FieldChangeMeta
>
handle
(
Map
<
String
,
Object
>
changeData
,
String
defaultChangeId
);
List
<
FieldChangeMeta
>
handle
(
Map
<
String
,
Object
>
changeData
,
String
defaultChangeId
,
Consumer
<
Map
<
String
,
List
<
PipelineChangeItemDto
>>>
callBack
);
}
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/JgChangeRegistrationReformServiceImpl.java
View file @
b4eb682d
...
...
@@ -32,6 +32,7 @@ import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.permission.FillingEditPermForCurrentUser
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.changeRegistrationReform.ChangeRegisterReformBackupManager
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.service.*
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.*
;
...
...
@@ -183,6 +184,11 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
@Autowired
private
JgRegistrationHistoryServiceImpl
jgRegistrationHistoryServiceImpl
;
@Autowired
private
ChangeRegisterReformBackupManager
backupManager
;
@Autowired
private
IdxBizJgTechParamsPipelineServiceImpl
idxBizJgTechParamsPipelineServiceImpl
;
/***
* @deprecated 根据查询调教获取分页对象
* @param dto 查询的dto对象
...
...
@@ -1480,9 +1486,31 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
iCmWorkflowService
.
stopProcess
(
jgChangeRegistrationReform
.
getInstanceId
(),
jgChangeRegistrationReform
.
getCancelReason
());
// 3.清空redis(缓存的流程中的设备)
this
.
clearDataForCheckEquipRepeatUsed2
(
jgChangeRegistrationReform
);
if
(
jgChangeRegistrationReform
.
getProjectContraptionId
()!=
null
){
// 编辑过则按照编辑的数据进行恢复管道信息
Boolean
isRollBack
=
backupManager
.
restore
(
jgChangeRegistrationReform
.
getSequenceNbr
()
+
""
);
if
(
isRollBack
){
// 进行过编辑逻辑
// 1.原装置、新装置重新计算管道长度
this
.
updateTotalPieLineLength
(
jgChangeRegistrationReform
.
getProjectContraptionId
());
}
}
}
}
private
void
updateTotalPieLineLength
(
String
pid
)
{
List
<
String
>
records
=
idxBizJgUseInfoService
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgUseInfo
>().
in
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
pid
)).
stream
().
map
(
IdxBizJgUseInfo:
:
getRecord
).
collect
(
toList
());
List
<
IdxBizJgTechParamsPipeline
>
paramsPipelines
=
idxBizJgTechParamsPipelineServiceImpl
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgTechParamsPipeline
>().
in
(
IdxBizJgTechParamsPipeline:
:
getRecord
,
records
).
select
(
IdxBizJgTechParamsPipeline:
:
getRecord
,
IdxBizJgTechParamsPipeline:
:
getPipeLength
));
double
totalLength
=
paramsPipelines
.
stream
()
.
map
(
IdxBizJgTechParamsPipeline:
:
getPipeLength
)
// 先提取长度字符串
.
filter
(
Objects:
:
nonNull
)
// 过滤掉null值
.
mapToDouble
(
Double:
:
parseDouble
)
// 解析字符串为double并转为DoubleStream
.
sum
();
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getPipelineLength
,
totalLength
);
updateWrapper
.
eq
(
BaseEntity:
:
getSequenceNbr
,
pid
);
jgProjectContraptionService
.
update
(
updateWrapper
);
}
private
void
finishedTask
(
JgChangeRegistrationReform
jgChangeRegistrationReform
)
{
HashMap
<
String
,
Object
>
taskMap
=
new
HashMap
<>();
taskMap
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
());
...
...
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 @
b4eb682d
...
...
@@ -41,6 +41,7 @@ import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.permission.FillingEditPermForCurrentUser
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.useRegister.UseRegisterBackupManager
;
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.feign.TzsServiceFeignClient
;
...
...
@@ -249,6 +250,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
@Autowired
private
IdxBizJgInspectionDetectionInfoServiceImpl
inspectionDetectionInfoService
;
@Autowired
private
UseRegisterBackupManager
useRegisterBackupManager
;
@Autowired
private
IdxBizJgTechParamsPipelineServiceImpl
idxBizJgTechParamsPipelineServiceImpl
;
/**
* @param auditPassDate 通过时间
...
...
@@ -3121,6 +3127,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if
(
"unit"
.
equals
(
jgUseRegistration
.
getManageType
())){
//单位办理-历史作废
if
(
"1"
.
equals
(
jgUseRegistration
.
getRegType
())){
// 管道增减特殊作废逻辑,管道全量数据为装置下的所有管道(已完成时,编辑装置进行增减不会修改eq表,所以eq表不是全量管道)
if
(!
ValidationUtil
.
isEmpty
(
jgUseRegistration
.
getProjectContraptionId
())){
records
=
idxBizJgUseInfoService
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgUseInfo
>().
eq
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
jgUseRegistration
.
getProjectContraptionId
())).
stream
().
map
(
IdxBizJgUseInfo:
:
getRecord
).
collect
(
toList
());
}
// 构建设备删除的 DTO 列表
List
<
ESEquipmentCategoryDto
>
esDtoList
=
records
.
stream
().
map
(
v
->
{
ESEquipmentCategoryDto
esDto
=
new
ESEquipmentCategoryDto
();
...
...
@@ -3161,90 +3171,108 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if
(
jgUseRegistration
.
getProjectContraptionId
()
!=
null
)
{
//2.合并后作废
if
(!
jgUseRegistration
.
getOriginProjectContraptionIds
().
contains
(
jgUseRegistration
.
getProjectContraptionId
())){
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
>()
.
in
(
BaseEntity:
:
getSequenceNbr
,
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
)))
.
set
(
IdxBizJgProjectContraption:
:
getProjectContraptionParentId
,
null
)
);
JgRegistrationHistory
history
=
jgRegistrationHistoryService
.
queryLatestRegistrationHistory
(
Long
.
valueOf
(
jgUseRegistration
.
getProjectContraptionId
()));
if
(
history
!=
null
&&
history
.
getChangeData
()
!=
null
)
{
JSONObject
hisJson
=
JSON
.
parseObject
(
history
.
getChangeData
());
boolean
isFirstMerge
=
Optional
.
ofNullable
(
hisJson
.
get
(
"isFirstMerge"
))
.
map
(
Boolean
.
class
::
cast
)
.
orElse
(
false
);
//合并到无证总工程
IdxBizJgProjectContraption
projectContraption
=
jgProjectContraptionService
.
getById
(
jgUseRegistration
.
getProjectContraptionId
());
if
(
isFirstMerge
)
{
projectContraption
.
setIsIntoManagement
(
false
);
projectContraption
.
setIsFirstMerge
(
true
);
projectContraption
.
setSupervisoryCode
(
null
);
projectContraption
.
setEquCode
(
null
);
projectContraption
.
setUseRegistrationCode
(
null
);
projectContraption
.
setPipelineLength
(
0.0
);
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask
(
records
);
}
else
{
// 查询原工程装置及 useInfo 记录
List
<
String
>
originProjectContraptionIds
=
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
));
List
<
IdxBizJgProjectContraption
>
originProjectContraptionList
=
jgProjectContraptionService
.
lambdaQuery
()
.
in
(
BaseEntity:
:
getSequenceNbr
,
originProjectContraptionIds
)
.
list
();
records
=
idxBizJgUseInfoService
.
lambdaQuery
()
.
select
(
IdxBizJgUseInfo:
:
getRecord
)
.
in
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
originProjectContraptionIds
)
.
list
()
.
stream
()
.
map
(
IdxBizJgUseInfo:
:
getRecord
)
.
collect
(
Collectors
.
toList
());
// 统一处理设备的纳管状态
registerAfterCommitTask
(
records
);
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
if
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
oldStatus
))
{
// 计算管道长度并更新
double
originPipelineLength
=
originProjectContraptionList
.
stream
()
.
map
(
IdxBizJgProjectContraption:
:
getPipelineLength
)
.
filter
(
Objects:
:
nonNull
)
.
mapToDouble
(
Double:
:
doubleValue
)
.
sum
();
projectContraption
.
setPipelineLength
(
projectContraption
.
getPipelineLength
()
-
originPipelineLength
);
Boolean
isRollBack
=
useRegisterBackupManager
.
restore
(
jgUseRegistration
.
getSequenceNbr
()
+
""
);
if
(
isRollBack
){
// 进行过编辑逻辑
// 1.根据工程装置ID查询工程装置父级,重置子工程装置父级为空
jgProjectContraptionService
.
update
(
new
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>()
.
in
(
BaseEntity:
:
getSequenceNbr
,
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
)))
.
set
(
IdxBizJgProjectContraption:
:
getProjectContraptionParentId
,
null
)
);
// 2.原装置、新装置重新计算管道长度
this
.
updateTotalPieLineLength
(
jgUseRegistration
.
getOriginProjectContraptionIds
(),
jgUseRegistration
.
getProjectContraptionId
());
}
else
{
// 为进行过编辑逻辑,走原来逻辑
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
>()
.
in
(
BaseEntity:
:
getSequenceNbr
,
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
)))
.
set
(
IdxBizJgProjectContraption:
:
getProjectContraptionParentId
,
null
)
);
JgRegistrationHistory
history
=
jgRegistrationHistoryService
.
queryLatestRegistrationHistory
(
Long
.
valueOf
(
jgUseRegistration
.
getProjectContraptionId
()));
if
(
history
!=
null
&&
history
.
getChangeData
()
!=
null
)
{
JSONObject
hisJson
=
JSON
.
parseObject
(
history
.
getChangeData
());
boolean
isFirstMerge
=
Optional
.
ofNullable
(
hisJson
.
get
(
"isFirstMerge"
))
.
map
(
Boolean
.
class
::
cast
)
.
orElse
(
false
);
//合并到无证总工程
IdxBizJgProjectContraption
projectContraption
=
jgProjectContraptionService
.
getById
(
jgUseRegistration
.
getProjectContraptionId
());
if
(
isFirstMerge
)
{
projectContraption
.
setIsIntoManagement
(
false
);
projectContraption
.
setIsFirstMerge
(
true
);
projectContraption
.
setSupervisoryCode
(
null
);
projectContraption
.
setEquCode
(
null
);
projectContraption
.
setUseRegistrationCode
(
null
);
projectContraption
.
setPipelineLength
(
0.0
);
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask
(
records
);
}
else
{
// 查询原工程装置及 useInfo 记录
List
<
String
>
originProjectContraptionIds
=
Arrays
.
asList
(
jgUseRegistration
.
getOriginProjectContraptionIds
().
split
(
","
));
List
<
IdxBizJgProjectContraption
>
originProjectContraptionList
=
jgProjectContraptionService
.
lambdaQuery
()
.
in
(
BaseEntity:
:
getSequenceNbr
,
originProjectContraptionIds
)
.
list
();
records
=
idxBizJgUseInfoService
.
lambdaQuery
()
.
select
(
IdxBizJgUseInfo:
:
getRecord
)
.
in
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
originProjectContraptionIds
)
.
list
()
.
stream
()
.
map
(
IdxBizJgUseInfo:
:
getRecord
)
.
collect
(
Collectors
.
toList
());
// 统一处理设备的纳管状态
registerAfterCommitTask
(
records
);
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
if
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
oldStatus
))
{
// 计算管道长度并更新
double
originPipelineLength
=
originProjectContraptionList
.
stream
()
.
map
(
IdxBizJgProjectContraption:
:
getPipelineLength
)
.
filter
(
Objects:
:
nonNull
)
.
mapToDouble
(
Double:
:
doubleValue
)
.
sum
();
projectContraption
.
setPipelineLength
(
projectContraption
.
getPipelineLength
()
-
originPipelineLength
);
}
}
jgProjectContraptionService
.
updateById
(
projectContraption
);
}
jgProjectContraptionService
.
updateById
(
projectContraption
);
}
}
//1.子工程装置作废,正常逻辑
else
{
// 编辑过则按照编辑的数据进行恢复管道信息
Boolean
isRollBack
=
useRegisterBackupManager
.
restore
(
jgUseRegistration
.
getSequenceNbr
()
+
""
);
if
(
isRollBack
){
// 进行过编辑逻辑
// 1.原装置、新装置重新计算管道长度
this
.
updateTotalPieLineLength
(
null
,
jgUseRegistration
.
getProjectContraptionId
());
}
// 统一处理设备的纳管状态【注册事务提交后的操作】
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
this
.
rollBackForPieLine
(
jgUseRegistration
);
...
...
@@ -3271,6 +3299,25 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
return
jgUseRegistration
;
}
private
void
updateTotalPieLineLength
(
String
originProjectContraptionIds
,
String
projectContraptionId
)
{
String
[]
oPids
=
originProjectContraptionIds
!=
null
?
originProjectContraptionIds
.
split
(
","
)
:
null
;
Set
<
String
>
pIds
=
new
HashSet
<>(
Arrays
.
asList
(
oPids
));
pIds
.
add
(
projectContraptionId
);
pIds
.
parallelStream
().
forEach
(
pid
->{
List
<
String
>
records
=
idxBizJgUseInfoService
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgUseInfo
>().
in
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
pid
)).
stream
().
map
(
IdxBizJgUseInfo:
:
getRecord
).
collect
(
toList
());
List
<
IdxBizJgTechParamsPipeline
>
paramsPipelines
=
idxBizJgTechParamsPipelineServiceImpl
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgTechParamsPipeline
>().
in
(
IdxBizJgTechParamsPipeline:
:
getRecord
,
records
).
select
(
IdxBizJgTechParamsPipeline:
:
getRecord
,
IdxBizJgTechParamsPipeline:
:
getPipeLength
));
double
totalLength
=
paramsPipelines
.
stream
()
.
map
(
IdxBizJgTechParamsPipeline:
:
getPipeLength
)
// 先提取长度字符串
.
filter
(
Objects:
:
nonNull
)
// 过滤掉null值
.
mapToDouble
(
Double:
:
parseDouble
)
// 解析字符串为double并转为DoubleStream
.
sum
();
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getPipelineLength
,
totalLength
);
updateWrapper
.
eq
(
BaseEntity:
:
getSequenceNbr
,
pid
);
jgProjectContraptionService
.
update
(
updateWrapper
);
});
}
/**
* 注册事务提交后的同步操作
*/
...
...
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