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
af64c633
Commit
af64c633
authored
Jan 22, 2025
by
韩桐桐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(jg):BUG 26910 【现场需求】登记证管理中,历史设备登记的普通气瓶,状态为空,新增气瓶的状态为在用
parent
0eaf9b9d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
178 additions
and
128 deletions
+178
-128
DataHandlerMapper.java
...oin/amos/boot/module/jg/api/mapper/DataHandlerMapper.java
+56
-0
DataHandlerController.java
.../boot/module/jg/biz/controller/DataHandlerController.java
+11
-0
DataHandlerServiceImpl.java
...ot/module/jg/biz/service/impl/DataHandlerServiceImpl.java
+111
-128
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/mapper/DataHandlerMapper.java
0 → 100644
View file @
af64c633
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo
;
import
org.apache.ibatis.annotations.Select
;
import
org.checkerframework.checker.index.qual.SameLen
;
import
java.util.List
;
/**
* 用于业务变更过程中的历史数据处理的mapper层
*/
public
interface
DataHandlerMapper
{
@Select
(
"SELECT ui.\"RECORD\" \n"
+
"FROM \"amos_tzs_biz\".\"idx_biz_jg_use_info\" ui \n"
+
"INNER JOIN \"amos_tzs_biz\".\"idx_biz_jg_register_info\" ri \n"
+
" ON ui.\"RECORD\" = ri.\"RECORD\"\n"
+
"WHERE ui.\"DATA_SOURCE\" = 'jg_his' \n"
+
"AND ui.\"EQU_STATE\" IS NULL \n"
+
"AND ri.\"EQU_CATEGORY\" = '2300' \n"
+
"AND NOT EXISTS (\n"
+
" SELECT 1 \n"
+
" FROM amos_tzs_biz.tzs_jg_scrap_cancel_eq sceq\n"
+
" INNER JOIN amos_tzs_biz.tzs_jg_scrap_cancel sc \n"
+
" ON sceq.\"equip_transfer_id\" = sc.\"sequence_nbr\"\n"
+
" WHERE sc.\"audit_status\" = '已完成' \n"
+
" AND sceq.\"equ_id\" = ui.\"RECORD\"\n"
+
")\n"
+
"AND NOT EXISTS (\n"
+
" SELECT 1 \n"
+
" FROM amos_tzs_biz.tzs_jg_enable_disable_eq edeq\n"
+
" INNER JOIN amos_tzs_biz.tzs_jg_enable_disable ed \n"
+
" ON edeq.\"enable_disable_apply_id\" = ed.\"sequence_nbr\"\n"
+
" WHERE ed.\"audit_status\" = '已完成' \n"
+
" AND edeq.\"equ_id\" = ui.\"RECORD\"\n"
+
")"
)
List
<
String
>
selectOrdinaryHisGasCylinder
();
@Select
(
"SELECT ui.\"RECORD\" \n"
+
"FROM \"amos_tzs_biz\".\"idx_biz_jg_use_info\" ui \n"
+
"INNER JOIN \"amos_tzs_biz\".\"idx_biz_jg_register_info\" ri \n"
+
" ON ui.\"RECORD\" = ri.\"RECORD\"\n"
+
"WHERE ui.\"DATA_SOURCE\" = 'jg' \n"
+
"AND ui.\"EQU_STATE\" IS NULL \n"
+
"AND ri.\"EQU_CATEGORY\" = '2300' \n"
+
"AND NOT EXISTS (\n"
+
" SELECT 1 \n"
+
" FROM amos_tzs_biz.tzs_jg_use_registration_eq ureq\n"
+
" INNER JOIN amos_tzs_biz.tzs_jg_use_registration ur \n"
+
" ON ureq.\"equip_transfer_id\" = ur.\"sequence_nbr\"\n"
+
" WHERE ur.\"status\" = '已完成' \n"
+
" AND ureq.\"equ_id\" = ui.\"RECORD\"\n"
+
")"
)
List
<
String
>
selectOrdinaryGasCylinder
();
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/DataHandlerController.java
View file @
af64c633
...
...
@@ -136,4 +136,15 @@ public class DataHandlerController extends BaseController {
public
ResponseModel
<
Boolean
>
writeProjectContraptionIdInJgUseRegistration
()
{
return
ResponseHelper
.
buildResponse
(
dataHandlerService
.
writeProjectContraptionIdInJgUseRegistration
());
}
/**
* BUG 26910 【现场需求】登记证管理中,历史设备登记的普通气瓶,状态为空,新增气瓶的状态为在用
* 将历史导入的普通气瓶和正常导入的普通气瓶刷入设备状态
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"将历史导入的普通气瓶和正常导入的普通气瓶刷入设备状态"
,
notes
=
"将历史导入的普通气瓶和正常导入的普通气瓶刷入设备状态"
)
@GetMapping
(
value
=
"/ordinaryGasCylinder/equState"
)
public
ResponseModel
<
String
>
ordinaryGasCylinderWriteEquState
()
{
return
ResponseHelper
.
buildResponse
(
dataHandlerService
.
ordinaryGasCylinderWriteEquState
());
}
}
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/DataHandlerServiceImpl.java
View file @
af64c633
...
...
@@ -19,12 +19,15 @@ import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeEqDto;
import
com.yeejoin.amos.boot.module.jg.api.dto.PieLineEquipContraptionDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.*
;
import
com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.DataHandlerMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeEqMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.*
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.*
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -39,6 +42,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.atomic.AtomicReference
;
...
...
@@ -52,74 +56,33 @@ import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNot
*/
@Slf4j
@Service
@RequiredArgsConstructor
public
class
DataHandlerServiceImpl
{
@Resource
private
ObjectMapper
objectMapper
;
@Resource
private
JgRegistrationHistoryServiceImpl
registrationHistoryService
;
@Resource
private
JgInstallationNoticeServiceImpl
installationNoticeService
;
@Resource
private
JgUseRegistrationServiceImpl
useRegistrationService
;
@Resource
private
JgUseRegistrationEqServiceImpl
useRegistrationEqService
;
@Resource
private
JgInstallationNoticeEqServiceImpl
installationNoticeEqService
;
@Resource
private
IdxBizJgUseInfoServiceImpl
useInfoService
;
@Resource
private
SnowflakeIdUtil
sequence
;
@Resource
private
IdxBizJgProjectContraptionServiceImpl
projectContraptionService
;
@Resource
private
IdxBizJgProjectConstructionMapper
projectConstructionMapper
;
@Resource
private
IdxBizJgTechParamsPipelineServiceImpl
techParamsPipelineService
;
@Resource
private
EquipmentCategoryMapper
equipmentCategoryMapper
;
@Resource
private
IdxBizJgRegisterInfoServiceImpl
registerInfoService
;
@Resource
private
IdxBizJgSupervisionInfoServiceImpl
supervisionInfoService
;
@Resource
private
IdxBizJgFactoryInfoServiceImpl
factoryInfoService
;
@Resource
private
ESEquipmentCategory
esEquipmentCategory
;
@Resource
TzBaseEnterpriseInfoMapper
tzBaseEnterpriseInfoMapper
;
@Resource
private
JgInstallationNoticeEqMapper
jgInstallationNoticeEqMapper
;
@Resource
private
DataDictionaryMapper
dataDictionaryMapper
;
@Resource
IdxBizJgProjectInspectionMapper
projectInspectionMapper
;
@Resource
IIdxBizJgInspectionDetectionInfoService
iIdxBizJgInspectionDetectionInfoService
;
@Autowired
private
IdxBizJgProjectContraptionMapper
idxBizJgProjectContraptionMapper
;
@Autowired
private
JgInstallationNoticeMapper
jgInstallationNoticeMapper
;
private
final
ObjectMapper
objectMapper
;
private
final
JgRegistrationHistoryServiceImpl
registrationHistoryService
;
private
final
JgInstallationNoticeServiceImpl
installationNoticeService
;
private
final
JgUseRegistrationServiceImpl
useRegistrationService
;
private
final
JgUseRegistrationEqServiceImpl
useRegistrationEqService
;
private
final
JgInstallationNoticeEqServiceImpl
installationNoticeEqService
;
private
final
IdxBizJgUseInfoServiceImpl
useInfoService
;
private
final
SnowflakeIdUtil
sequence
;
private
final
IdxBizJgProjectContraptionServiceImpl
projectContraptionService
;
private
final
IdxBizJgProjectConstructionMapper
projectConstructionMapper
;
private
final
IdxBizJgTechParamsPipelineServiceImpl
techParamsPipelineService
;
private
final
EquipmentCategoryMapper
equipmentCategoryMapper
;
private
final
IdxBizJgRegisterInfoServiceImpl
registerInfoService
;
private
final
IdxBizJgSupervisionInfoServiceImpl
supervisionInfoService
;
private
final
IdxBizJgFactoryInfoServiceImpl
factoryInfoService
;
private
final
ESEquipmentCategory
esEquipmentCategory
;
private
final
TzBaseEnterpriseInfoMapper
tzBaseEnterpriseInfoMapper
;
private
final
JgInstallationNoticeEqMapper
jgInstallationNoticeEqMapper
;
private
final
DataDictionaryMapper
dataDictionaryMapper
;
private
final
IdxBizJgProjectInspectionMapper
projectInspectionMapper
;
private
final
IIdxBizJgInspectionDetectionInfoService
iIdxBizJgInspectionDetectionInfoService
;
private
final
IdxBizJgProjectContraptionMapper
idxBizJgProjectContraptionMapper
;
private
final
JgInstallationNoticeMapper
jgInstallationNoticeMapper
;
private
final
DataHandlerMapper
dataHandlerMapper
;
/**
...
...
@@ -129,13 +92,13 @@ public class DataHandlerServiceImpl {
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
deviceListInFormWithInstallNotice
()
{
List
<
JgInstallationNotice
>
noticeList
=
installationNoticeService
.
list
(
new
LambdaQueryWrapper
<
JgInstallationNotice
>()
.
eq
(
JgInstallationNotice:
:
getEquCategoryCode
,
"8300"
));
List
<
JgInstallationNotice
>
noticeList
=
installationNoticeService
.
list
(
new
LambdaQueryWrapper
<
JgInstallationNotice
>().
eq
(
JgInstallationNotice:
:
getEquCategoryCode
,
"8300"
));
List
<
JgRegistrationHistory
>
jgRegistrationHistories
=
noticeList
.
stream
()
.
map
(
notice
->
{
JgRegistrationHistory
history
=
getRegistrationHistory
(
String
.
valueOf
(
notice
.
getSequenceNbr
()));
if
(
history
==
null
)
return
null
;
if
(
history
==
null
)
return
null
;
try
{
Map
<
String
,
Object
>
hisData
=
objectMapper
.
readValue
(
history
.
getChangeData
(),
...
...
@@ -415,7 +378,7 @@ public class DataHandlerServiceImpl {
.
eq
(
IdxBizJgUseInfo:
:
getProjectContraption
,
projectContraption
)
.
list
();
//技术参数表
//
技术参数表
List
<
IdxBizJgTechParamsPipeline
>
idxBizJgTechParamsPipelines
=
useInfos
.
isEmpty
()
?
new
ArrayList
<>()
:
techParamsPipelineService
.
lambdaQuery
()
.
in
(
IdxBizJgTechParamsPipeline:
:
getRecord
,
useInfos
.
stream
()
...
...
@@ -515,36 +478,34 @@ public class DataHandlerServiceImpl {
}
private
void
filledHisRegCylinderByUnit
()
{
List
<
JgUseRegistration
>
useRegistrations
=
useRegistrationService
.
list
(
new
LambdaQueryWrapper
<
JgUseRegistration
>()
.
isNull
(
JgUseRegistration:
:
getSupervisionOrgCode
).
eq
(
JgUseRegistration:
:
getManageType
,
"unit"
).
eq
(
JgUseRegistration:
:
getRegType
,
"1"
).
select
(
BaseEntity:
:
getSequenceNbr
,
JgUseRegistration:
:
getUseUnitCreditCode
));
List
<
JgUseRegistration
>
useRegistrations
=
useRegistrationService
.
list
(
new
LambdaQueryWrapper
<
JgUseRegistration
>().
isNull
(
JgUseRegistration:
:
getSupervisionOrgCode
).
eq
(
JgUseRegistration:
:
getManageType
,
"unit"
).
eq
(
JgUseRegistration:
:
getRegType
,
"1"
).
select
(
BaseEntity:
:
getSequenceNbr
,
JgUseRegistration:
:
getUseUnitCreditCode
));
Map
<
String
,
String
>
unitSuperOrgCodeMap
=
new
ConcurrentHashMap
<>();
useRegistrations
.
parallelStream
().
forEach
(
u
->
{
useRegistrations
.
parallelStream
().
forEach
(
u
->
{
LambdaUpdateWrapper
<
JgUseRegistration
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
JgUseRegistration:
:
getSequenceNbr
,
u
.
getSequenceNbr
());
if
(
unitSuperOrgCodeMap
.
get
(
u
.
getUseUnitCreditCode
())
!=
null
)
{
if
(
unitSuperOrgCodeMap
.
get
(
u
.
getUseUnitCreditCode
())
!=
null
)
{
updateWrapper
.
set
(
JgUseRegistration:
:
getSupervisionOrgCode
,
unitSuperOrgCodeMap
.
get
(
u
.
getUseUnitCreditCode
()));
}
else
{
TzBaseEnterpriseInfo
baseEnterpriseInfo
=
tzBaseEnterpriseInfoMapper
.
selectByUseUnitCode
(
u
.
getUseUnitCreditCode
());
if
(
baseEnterpriseInfo
!=
null
)
{
if
(
baseEnterpriseInfo
!=
null
)
{
unitSuperOrgCodeMap
.
put
(
u
.
getUseUnitCreditCode
(),
baseEnterpriseInfo
.
getSuperviseOrgCode
());
updateWrapper
.
set
(
JgUseRegistration:
:
getSupervisionOrgCode
,
baseEnterpriseInfo
.
getSuperviseOrgCode
());
}
else
{
updateWrapper
.
set
(
JgUseRegistration:
:
getSupervisionOrgCode
,
null
);
}
}
useRegistrationService
.
update
(
null
,
updateWrapper
);
useRegistrationService
.
update
(
null
,
updateWrapper
);
});
}
private
void
filledDataFromHistory
()
{
List
<
JgUseRegistration
>
useRegistrations
=
useRegistrationService
.
list
(
new
LambdaQueryWrapper
<
JgUseRegistration
>().
isNull
(
JgUseRegistration:
:
getSupervisionOrgCode
).
select
(
BaseEntity:
:
getSequenceNbr
));
useRegistrations
.
parallelStream
().
forEach
(
u
->
{
useRegistrations
.
parallelStream
().
forEach
(
u
->
{
JgRegistrationHistory
history
=
getRegistrationHistory
(
u
.
getSequenceNbr
()
+
""
);
if
(
history
!=
null
)
{
if
(
history
!=
null
)
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
history
.
getChangeData
());
String
orgBranchCodeWithName
=
jsonObject
.
getString
(
"orgBranchCode"
);
if
(
orgBranchCodeWithName
!=
null
&&
!
orgBranchCodeWithName
.
isEmpty
())
{
if
(
orgBranchCodeWithName
!=
null
&&
!
orgBranchCodeWithName
.
isEmpty
())
{
u
.
setSupervisionOrgCode
(
orgBranchCodeWithName
.
split
(
"_"
)[
0
]);
LambdaUpdateWrapper
<
JgUseRegistration
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
set
(
JgUseRegistration:
:
getSupervisionOrgCode
,
u
.
getSupervisionOrgCode
());
...
...
@@ -560,7 +521,7 @@ public class DataHandlerServiceImpl {
// 1.安装告知完成但是设备状态未非已纳管状态:设备的idx_biz_jg_use_info表的IS_INTO_MANAGEMENT刷为已纳管, es的IS_INTO_MANAGEMENT刷为已纳管
List
<
JgInstallationNoticeEq
>
eqs
=
jgInstallationNoticeEqMapper
.
selectErrorRecordOfInIntoManage
();
log
.
info
(
"处理前统计:1.安装告知完成但是设备状态未非已纳管状态的设备数量:{}"
,
eqs
.
size
());
for
(
JgInstallationNoticeEq
eq
:
eqs
)
{
for
(
JgInstallationNoticeEq
eq
:
eqs
)
{
// 使用信息表刷已纳管
useInfoService
.
lambdaUpdate
()
.
set
(
IdxBizJgUseInfo:
:
getIsIntoManagement
,
true
)
...
...
@@ -569,8 +530,8 @@ public class DataHandlerServiceImpl {
// es刷已纳管
Optional
<
ESEquipmentCategoryDto
>
equInfosWithEs
=
esEquipmentCategory
.
findById
(
eq
.
getEquId
());
equInfosWithEs
.
ifPresent
(
equInfoEs
->
{
equInfoEs
.
setIS_INTO_MANAGEMENT
(
true
);
esEquipmentCategory
.
save
(
equInfoEs
);
equInfoEs
.
setIS_INTO_MANAGEMENT
(
true
);
esEquipmentCategory
.
save
(
equInfoEs
);
});
}
// 2.安装告知非已作废,但是缺少装置id的数据处理:创建装置、写入安装告知表project_contraption_id、写入设备es的装置id,设备使用信息表的projectContraptionId
...
...
@@ -578,16 +539,14 @@ public class DataHandlerServiceImpl {
log
.
info
(
"处理前统计:2.安装告知非已作废,但是缺少装置id安装告知单据数量:{}"
,
noticeList
.
size
());
List
<
IdxBizJgProjectContraption
>
projectContraptionList
=
new
ArrayList
<>();
Map
<
Long
,
List
<
String
>>
projectContraptionIdRecordsMap
=
new
HashMap
<>();
for
(
JgInstallationNotice
installationNotice
:
noticeList
)
{
List
<
JgInstallationNoticeEq
>
noticeEqs
=
installationNoticeEqService
.
list
(
new
LambdaQueryWrapper
<
JgInstallationNoticeEq
>().
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
installationNotice
.
getSequenceNbr
()).
select
(
JgInstallationNoticeEq:
:
getEquId
,
JgInstallationNoticeEq:
:
getInformNumber
));
if
(
noticeEqs
.
isEmpty
())
{
for
(
JgInstallationNotice
installationNotice
:
noticeList
)
{
List
<
JgInstallationNoticeEq
>
noticeEqs
=
installationNoticeEqService
.
list
(
new
LambdaQueryWrapper
<
JgInstallationNoticeEq
>().
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
installationNotice
.
getSequenceNbr
()).
select
(
JgInstallationNoticeEq:
:
getEquId
,
JgInstallationNoticeEq:
:
getInformNumber
));
if
(
noticeEqs
.
isEmpty
())
{
continue
;
}
List
<
String
>
records
=
noticeEqs
.
stream
().
map
(
JgInstallationNoticeEq:
:
getEquId
).
collect
(
Collectors
.
toList
());
List
<
IdxBizJgUseInfo
>
useInfos
=
useInfoService
.
lambdaQuery
()
.
in
(
IdxBizJgUseInfo:
:
getRecord
,
records
)
.
list
();
//技术参数表
List
<
IdxBizJgUseInfo
>
useInfos
=
useInfoService
.
lambdaQuery
().
in
(
IdxBizJgUseInfo:
:
getRecord
,
records
).
list
();
// 技术参数表
List
<
IdxBizJgTechParamsPipeline
>
idxBizJgTechParamsPipelines
=
useInfos
.
isEmpty
()
?
new
ArrayList
<>()
:
techParamsPipelineService
.
lambdaQuery
()
.
in
(
IdxBizJgTechParamsPipeline:
:
getRecord
,
records
)
...
...
@@ -661,16 +620,16 @@ public class DataHandlerServiceImpl {
projectContraptionList
.
add
(
idxBizJgProjectContraption
);
}
// 创建装置
if
(!
projectContraptionList
.
isEmpty
())
{
if
(!
projectContraptionList
.
isEmpty
())
{
projectContraptionService
.
saveBatch
(
projectContraptionList
);
}
// 更新设备es的装置id、使用信息的装置id
projectContraptionIdRecordsMap
.
forEach
((
k
,
v
)->
{
projectContraptionIdRecordsMap
.
forEach
((
k
,
v
)
->
{
Iterable
<
ESEquipmentCategoryDto
>
equipmentCategories
=
esEquipmentCategory
.
findAllById
(
v
);
equipmentCategories
.
forEach
(
e
->
e
.
setProjectContraptionId
(
k
+
""
));
equipmentCategories
.
forEach
(
e
->
e
.
setProjectContraptionId
(
k
+
""
));
esEquipmentCategory
.
saveAll
(
equipmentCategories
);
Collection
<
IdxBizJgUseInfo
>
useInfos
=
useInfoService
.
listByIds
(
v
);
useInfos
.
forEach
(
u
->
{
Collection
<
IdxBizJgUseInfo
>
useInfos
=
useInfoService
.
listByIds
(
v
);
useInfos
.
forEach
(
u
->
{
LambdaUpdateWrapper
<
IdxBizJgUseInfo
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
u
.
getRecord
());
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
u
.
getProjectContraptionId
());
...
...
@@ -691,7 +650,7 @@ public class DataHandlerServiceImpl {
}
private
void
saveProjectConstructionAfterFinish
(
JgInstallationNotice
installationNotice
,
boolean
isFinish
,
List
<
JgInstallationNoticeEq
>
eqs
,
Long
sequenceNbr
,
List
<
String
>
records
)
{
if
(
isFinish
)
{
if
(
isFinish
)
{
IdxBizJgProjectConstruction
idxBizJgProjectConstruction
=
new
IdxBizJgProjectConstruction
();
idxBizJgProjectConstruction
.
setUscUnitCreditCode
(
installationNotice
.
getInstallUnitCreditCode
());
idxBizJgProjectConstruction
.
setUscUnitName
(
installationNotice
.
getInstallUnitName
());
...
...
@@ -729,29 +688,26 @@ public class DataHandlerServiceImpl {
}
private
List
<
JgInstallationNotice
>
getErrorInstallNoticeData
()
{
return
installationNoticeService
.
list
(
new
LambdaQueryWrapper
<
JgInstallationNotice
>()
.
ne
(
JgInstallationNotice:
:
getNoticeStatus
,
FlowStatusEnum
.
TO_BE_DISCARD
.
getCode
())
.
ne
(
JgInstallationNotice:
:
getProjectContraption
,
""
)
.
isNull
(
JgInstallationNotice:
:
getProjectContraptionId
));
return
installationNoticeService
.
list
(
new
LambdaQueryWrapper
<
JgInstallationNotice
>().
ne
(
JgInstallationNotice:
:
getNoticeStatus
,
FlowStatusEnum
.
TO_BE_DISCARD
.
getCode
()).
ne
(
JgInstallationNotice:
:
getProjectContraption
,
""
).
isNull
(
JgInstallationNotice:
:
getProjectContraptionId
));
}
/**
* 刷使用登记缺少装置id的管道的登记数据:1.填充装置id;2.已完成状状态清除装置表的安装单位信息字段,补充使用信息字段
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
projectContraptionUseRegisterDataDeal
(){
public
void
projectContraptionUseRegisterDataDeal
()
{
// 查询使用登记:非作废状态 有装置名称但是缺少装置id的使用登记单据进行数据处理
List
<
JgUseRegistration
>
useRegistrations
=
getUseRegisterOfError
();
log
.
info
(
"处理前统计:1.使用登记装置id历史数据填充,存在缺少装置id的单据数量:{}"
,
useRegistrations
.
size
());
// 循环按照使用登记的eq表关联安装告知eq表,在安装告知主表查询装置id
for
(
JgUseRegistration
useRegistration
:
useRegistrations
)
{
for
(
JgUseRegistration
useRegistration
:
useRegistrations
)
{
// 登记的关联的告知单据【逻辑按照eq进行关联】
JgInstallationNotice
installationNotice
=
installationNoticeService
.
getBaseMapper
().
selectNoticeDataByUseRegisterId
(
useRegistration
.
getSequenceNbr
()
+
""
);
if
(
installationNotice
!=
null
&&
StringUtils
.
isNotEmpty
(
installationNotice
.
getProjectContraptionId
()))
{
if
(
installationNotice
!=
null
&&
StringUtils
.
isNotEmpty
(
installationNotice
.
getProjectContraptionId
()))
{
// 0.填充装置id
useRegistration
.
setProjectContraptionId
(
installationNotice
.
getProjectContraptionId
());
// 1.已完成状状态清除装置表的安装单位信息字段,填充使用信息数据,创建装置检验信息表
if
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
useRegistration
.
getStatus
()))
{
if
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
useRegistration
.
getStatus
()))
{
updateProjectContraptionAfter
(
useRegistration
,
installationNotice
);
// 创建装置检验流水信息
createProjectInspectInfoAfter
(
useRegistration
);
...
...
@@ -770,11 +726,11 @@ public class DataHandlerServiceImpl {
private
void
updateProjectContraptionAfter
(
JgUseRegistration
useRegistration
,
JgInstallationNotice
installationNotice
)
{
// 特殊处理 将任意一个的 record 放入到remark字段
IdxBizJgUseInfo
useInfo
=
getIdxBizJgUseInfo
(
installationNotice
.
getRemark
());
if
(
useInfo
!=
null
)
{
if
(
useInfo
!=
null
)
{
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
BaseEntity:
:
getSequenceNbr
,
installationNotice
.
getProjectContraptionId
());
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getUscUnitCreditCode
,
null
);
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getUscUnitName
,
null
);
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getUscUnitCreditCode
,
null
);
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getUscUnitName
,
null
);
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getUseRegistrationCode
,
useRegistration
.
getUseRegistrationCode
());
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getProvince
,
useInfo
.
getProvince
());
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getProvinceName
,
useInfo
.
getProvinceName
());
...
...
@@ -792,12 +748,12 @@ public class DataHandlerServiceImpl {
private
void
createProjectInspectInfoAfter
(
JgUseRegistration
useRegistration
)
{
JgRegistrationHistory
jgRegistrationHistory
=
getRegistrationHistory
(
useRegistration
.
getSequenceNbr
()
+
""
);
if
(
jgRegistrationHistory
!=
null
)
{
if
(
jgRegistrationHistory
!=
null
)
{
JSONObject
mapData
=
JSONObject
.
parseObject
(
jgRegistrationHistory
.
getChangeData
());
IdxBizJgProjectInspection
inspectionDetectionInfo
=
new
IdxBizJgProjectInspection
();
BeanUtil
.
copyProperties
(
mapData
,
inspectionDetectionInfo
);
// 兼容最早的老数据,管道的检验信息单独维护
if
(
inspectionDetectionInfo
.
getInspectConclusion
()
==
null
&&
mapData
.
containsKey
(
"equipmentLists"
))
{
if
(
inspectionDetectionInfo
.
getInspectConclusion
()
==
null
&&
mapData
.
containsKey
(
"equipmentLists"
))
{
List
<
Map
<
String
,
Object
>>
equipmentLists
=
null
;
try
{
equipmentLists
=
objectMapper
.
readValue
(
...
...
@@ -805,7 +761,7 @@ public class DataHandlerServiceImpl {
new
TypeReference
<
ArrayList
<
Map
<
String
,
Object
>>>()
{
}
);
if
(!
equipmentLists
.
isEmpty
())
{
if
(!
equipmentLists
.
isEmpty
())
{
Object
record
=
equipmentLists
.
get
(
0
).
get
(
"record"
);
IdxBizJgInspectionDetectionInfo
idxBizJgInspectionDetectionInfo
=
iIdxBizJgInspectionDetectionInfoService
.
queryNewestDetailByRecord
(
String
.
valueOf
(
record
));
BeanUtil
.
copyProperties
(
idxBizJgInspectionDetectionInfo
,
inspectionDetectionInfo
);
...
...
@@ -831,14 +787,11 @@ public class DataHandlerServiceImpl {
/**
* 查询非作废状态的装置名称不为空,装置id为空或者null的使用登记数据
*
* @return 符合条件列表
*/
private
List
<
JgUseRegistration
>
getUseRegisterOfError
()
{
return
useRegistrationService
.
getBaseMapper
().
selectList
(
new
LambdaQueryWrapper
<
JgUseRegistration
>()
.
ne
(
JgUseRegistration:
:
getStatus
,
FlowStatusEnum
.
TO_BE_DISCARD
.
getName
())
.
ne
(
JgUseRegistration:
:
getProjectContraption
,
""
)
.
isNull
(
JgUseRegistration:
:
getProjectContraptionId
)
.
select
(
BaseEntity:
:
getSequenceNbr
,
JgUseRegistration:
:
getProjectContraption
,
JgUseRegistration:
:
getUseRegistrationCode
,
JgUseRegistration:
:
getStatus
,
JgUseRegistration:
:
getAuditPassDate
));
private
List
<
JgUseRegistration
>
getUseRegisterOfError
()
{
return
useRegistrationService
.
getBaseMapper
().
selectList
(
new
LambdaQueryWrapper
<
JgUseRegistration
>().
ne
(
JgUseRegistration:
:
getStatus
,
FlowStatusEnum
.
TO_BE_DISCARD
.
getName
()).
ne
(
JgUseRegistration:
:
getProjectContraption
,
""
).
isNull
(
JgUseRegistration:
:
getProjectContraptionId
).
select
(
BaseEntity:
:
getSequenceNbr
,
JgUseRegistration:
:
getProjectContraption
,
JgUseRegistration:
:
getUseRegistrationCode
,
JgUseRegistration:
:
getStatus
,
JgUseRegistration:
:
getAuditPassDate
));
}
/**
...
...
@@ -848,7 +801,7 @@ public class DataHandlerServiceImpl {
public
void
projectContraptionInfoUpdateV2
()
{
List
<
IdxBizJgProjectContraption
>
projectConstructions
=
idxBizJgProjectContraptionMapper
.
selectErrorManagementProject
();
log
.
info
(
"处理前:安装告知审批完成但是装置是否纳管状态不正确的数据量:{}"
,
projectConstructions
.
size
());
projectConstructions
.
parallelStream
().
forEach
(
p
->
{
projectConstructions
.
parallelStream
().
forEach
(
p
->
{
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
BaseEntity:
:
getSequenceNbr
,
p
.
getSequenceNbr
());
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getUscUnitName
,
p
.
getUscUnitName
());
...
...
@@ -867,7 +820,7 @@ public class DataHandlerServiceImpl {
public
void
projectUseInfoUpdateV3
()
{
List
<
JgInstallationNoticeEq
>
eqs
=
jgInstallationNoticeEqMapper
.
selectPCIdNeErrorPieLineInUseInfo
();
log
.
info
(
"处理前:查询安装告知(非删除、已作废)的装置id和设备的使用信息装置id不一样的设备:{}"
,
eqs
.
size
());
eqs
.
forEach
(
eq
->
{
eqs
.
forEach
(
eq
->
{
Optional
<
ESEquipmentCategoryDto
>
equInfosWithEs
=
esEquipmentCategory
.
findById
(
eq
.
getEquId
());
equInfosWithEs
.
ifPresent
(
equInfoEs
->
{
LambdaUpdateWrapper
<
IdxBizJgUseInfo
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
...
...
@@ -885,11 +838,9 @@ public class DataHandlerServiceImpl {
// 1220上线时, 已完成安装告知管道未写入装置的施工信息表的告知单据查询
List
<
JgInstallationNotice
>
noticeList
=
getNotInsertProjectConstructionInstallNotice
();
log
.
info
(
"处理前统计:1.管道已完成安装告知,但是未写入装置的施工信息表的告知单据数量:{}"
,
noticeList
.
size
());
for
(
JgInstallationNotice
installationNotice
:
noticeList
){
List
<
JgInstallationNoticeEq
>
noticeEqs
=
installationNoticeEqService
.
list
(
new
LambdaQueryWrapper
<
JgInstallationNoticeEq
>()
.
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
installationNotice
.
getSequenceNbr
()).
select
(
JgInstallationNoticeEq:
:
getEquId
));
if
(
noticeEqs
.
isEmpty
()){
for
(
JgInstallationNotice
installationNotice
:
noticeList
)
{
List
<
JgInstallationNoticeEq
>
noticeEqs
=
installationNoticeEqService
.
list
(
new
LambdaQueryWrapper
<
JgInstallationNoticeEq
>().
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
installationNotice
.
getSequenceNbr
()).
select
(
JgInstallationNoticeEq:
:
getEquId
));
if
(
noticeEqs
.
isEmpty
())
{
continue
;
}
List
<
String
>
records
=
noticeEqs
.
stream
().
map
(
JgInstallationNoticeEq:
:
getEquId
).
collect
(
Collectors
.
toList
());
...
...
@@ -913,7 +864,7 @@ public class DataHandlerServiceImpl {
public
void
projectUseInfoUpdateV4
()
{
List
<
PieLineEquipContraptionDto
>
eqs
=
jgInstallationNoticeEqMapper
.
selectPCIdNeErrorPieLineInUseInfo2
();
log
.
info
(
"处理前:查询管道的装置id与安装告知的装置id的不一样管道设备:{}"
,
eqs
.
size
());
eqs
.
forEach
(
eq
->
{
eqs
.
forEach
(
eq
->
{
// 1.已安装告知单据为准更新es
Optional
<
ESEquipmentCategoryDto
>
equInfosWithEs
=
esEquipmentCategory
.
findById
(
eq
.
getRecord
());
equInfosWithEs
.
ifPresent
(
equInfoEs
->
{
...
...
@@ -939,11 +890,9 @@ public class DataHandlerServiceImpl {
public
void
projectUseInfoUpdateV5
()
{
List
<
PieLineEquipContraptionDto
>
eqs
=
jgInstallationNoticeEqMapper
.
selectPCIdNeErrorPieLineInUseInfo3
();
log
.
info
(
"处理前:一个管道在多个安装告知里,安装告知的装置id的不一样管道设备:{}"
,
eqs
.
size
());
eqs
.
forEach
(
eq
->
{
eqs
.
forEach
(
eq
->
{
JgInstallationNoticeEqDto
jgInstallationNoticeEqDto
=
jgInstallationNoticeEqMapper
.
selectLatestNoticeByRecord
(
eq
.
getRecord
());
JgInstallationNotice
jgInstallationNotice
=
jgInstallationNoticeMapper
.
selectOne
(
new
LambdaQueryWrapper
<
JgInstallationNotice
>()
.
eq
(
BaseEntity:
:
getSequenceNbr
,
jgInstallationNoticeEqDto
.
getEquipTransferId
())
.
select
(
JgInstallationNotice:
:
getProjectContraptionId
,
JgInstallationNotice:
:
getProjectContraption
));
JgInstallationNotice
jgInstallationNotice
=
jgInstallationNoticeMapper
.
selectOne
(
new
LambdaQueryWrapper
<
JgInstallationNotice
>().
eq
(
BaseEntity:
:
getSequenceNbr
,
jgInstallationNoticeEqDto
.
getEquipTransferId
()).
select
(
JgInstallationNotice:
:
getProjectContraptionId
,
JgInstallationNotice:
:
getProjectContraption
));
// 1.已安装告知单据为准更新es
Optional
<
ESEquipmentCategoryDto
>
equInfosWithEs
=
esEquipmentCategory
.
findById
(
eq
.
getRecord
());
equInfosWithEs
.
ifPresent
(
equInfoEs
->
{
...
...
@@ -991,4 +940,38 @@ public class DataHandlerServiceImpl {
}
return
true
;
}
/**
* 将历史导入的普通气瓶和正常导入的普通气瓶刷入设备状态
*
* @return result
*/
public
String
ordinaryGasCylinderWriteEquState
()
{
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
// 所有的历史导入的普通气瓶 dataSource = 'jg_his' + 过滤出做了报废注销启用停用的业务设备 设备状态为 在用 (EquimentEnum.ZAIYONG.getCode())
List
<
String
>
allHisRecords
=
dataHandlerMapper
.
selectOrdinaryHisGasCylinder
();
useInfoService
.
lambdaUpdate
().
in
(
IdxBizJgUseInfo:
:
getRecord
,
allHisRecords
).
set
(
IdxBizJgUseInfo:
:
getEquState
,
EquimentEnum
.
ZAIYONG
.
getCode
()).
update
();
allHisRecords
.
forEach
(
record
->
{
Optional
<
ESEquipmentCategoryDto
>
categoryDto
=
esEquipmentCategory
.
findById
(
record
);
categoryDto
.
ifPresent
(
categoryEs
->
{
categoryEs
.
setEQU_STATE
(
EquimentEnum
.
ZAIYONG
.
getCode
());
esEquipmentCategory
.
save
(
categoryEs
);
});
});
// 所有的正常导入的普通气瓶 dataSource = 'jg' + 过滤出做了使用登记业务的设备 设备状态为 未登记 (EquimentEnum.WEIDENGJI.getCode())
List
<
String
>
allRecords
=
dataHandlerMapper
.
selectOrdinaryGasCylinder
();
useInfoService
.
lambdaUpdate
().
in
(
IdxBizJgUseInfo:
:
getRecord
,
allRecords
).
set
(
IdxBizJgUseInfo:
:
getEquState
,
EquimentEnum
.
WEIDENGJI
.
getCode
()).
update
();
allRecords
.
forEach
(
record
->
{
Optional
<
ESEquipmentCategoryDto
>
categoryDto
=
esEquipmentCategory
.
findById
(
record
);
categoryDto
.
ifPresent
(
categoryEs
->
{
categoryEs
.
setEQU_STATE
(
EquimentEnum
.
WEIDENGJI
.
getCode
());
esEquipmentCategory
.
save
(
categoryEs
);
});
});
stopWatch
.
stop
();
return
String
.
format
(
"刷入数据%s条,耗时:%s秒"
,
allHisRecords
.
size
()
+
allRecords
.
size
(),
stopWatch
.
getTotalTimeSeconds
());
}
}
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