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
b35efad6
Commit
b35efad6
authored
Nov 10, 2025
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:(jg):气瓶单位变更功能开发
parent
881f2dfe
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
628 additions
and
17 deletions
+628
-17
JgChangeRegistrationUnit.java
...s/boot/module/jg/api/entity/JgChangeRegistrationUnit.java
+11
-0
JgUseRegistrationMapper.xml
...api/src/main/resources/mapper/JgUseRegistrationMapper.xml
+10
-3
UseRegisterUpdateService.java
...dit/process/biz/useRegister/UseRegisterUpdateService.java
+3
-2
JgChangeRegistrationUnitServiceImpl.java
...biz/service/impl/JgChangeRegistrationUnitServiceImpl.java
+604
-12
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/entity/JgChangeRegistrationUnit.java
View file @
b35efad6
...
@@ -239,6 +239,17 @@ public class JgChangeRegistrationUnit extends BaseEntity {
...
@@ -239,6 +239,17 @@ public class JgChangeRegistrationUnit extends BaseEntity {
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
equDefine
;
private
String
equDefine
;
/**
/**
* 设备品种代码
*/
@TableField
(
exist
=
false
)
private
String
equDefineCode
;
/**
* 设备类别
*/
@TableField
(
exist
=
false
)
private
String
equCategory
;
/**
*工作流下一节点任务id
*工作流下一节点任务id
*/
*/
@TableField
(
value
=
"next_task_id"
)
@TableField
(
value
=
"next_task_id"
)
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgUseRegistrationMapper.xml
View file @
b35efad6
...
@@ -1303,11 +1303,18 @@
...
@@ -1303,11 +1303,18 @@
</otherwise>
</otherwise>
</choose>
</choose>
</if>
</if>
<if
test=
"jsonObject.useUnitCreditCode != null and jsonObject.useUnitCreditCode != '' and jsonObject.record == null"
>
<choose>
<!--气瓶单位变更使用登记证号 + 单位信用代码联合查询 -->
<when
test=
"jsonObject.useRegistCode != null and jsonObject.useRegistCode != ''"
>
and ri."USE_ORG_CODE" = #{jsonObject.useRegistCode}
and ui."USE_UNIT_CREDIT_CODE" = #{jsonObject.useUnitCreditCode}
</when>
<!-- 否则根据社会信用代码查询(仅限未登记的) -->
<when
test=
"jsonObject.useUnitCreditCode != null and jsonObject.useUnitCreditCode != '' and jsonObject.record == null"
>
and ui."USE_UNIT_CREDIT_CODE" = #{jsonObject.useUnitCreditCode}
and ui."USE_UNIT_CREDIT_CODE" = #{jsonObject.useUnitCreditCode}
-- 限制 没有做过使用登记的
and (ri."USE_ORG_CODE" is null or ri."USE_ORG_CODE" = '')
and (ri."USE_ORG_CODE" is null or ri."USE_ORG_CODE" = '')
</if>
</when>
</choose>
<choose>
<choose>
<when
test=
"jsonObject.record != null and jsonObject.record != ''"
>
<when
test=
"jsonObject.record != null and jsonObject.record != ''"
>
and ui."RECORD" = #{jsonObject.record}
and ui."RECORD" = #{jsonObject.record}
...
...
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/useRegister/UseRegisterUpdateService.java
View file @
b35efad6
...
@@ -24,6 +24,7 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
...
@@ -24,6 +24,7 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
...
@@ -105,8 +106,8 @@ public class UseRegisterUpdateService {
...
@@ -105,8 +106,8 @@ public class UseRegisterUpdateService {
*/
*/
public
void
updateUseRegistrationInfo
(
String
bizId
,
List
<
FieldChangeMeta
>
allChangeColumns
)
{
public
void
updateUseRegistrationInfo
(
String
bizId
,
List
<
FieldChangeMeta
>
allChangeColumns
)
{
Map
<
String
,
Object
>
useRegistrationMap
=
jgUseRegistrationService
.
getJgUseRegistrationMapper
().
getUseRegistrationDetail
(
bizId
);
Map
<
String
,
Object
>
useRegistrationMap
=
jgUseRegistrationService
.
getJgUseRegistrationMapper
().
getUseRegistrationDetail
(
bizId
);
JgUseRegistration
jgUseRegistration
=
jgUseRegistrationService
.
getById
(
useRegistrationMap
.
get
(
"UseRegistratSequenceNbr"
).
toString
(
));
JgUseRegistration
jgUseRegistration
=
jgUseRegistrationService
.
getById
(
MapUtils
.
getString
(
useRegistrationMap
,
"UseRegistratSequenceNbr"
));
JgRegistrationHistory
jgRegistrationHistory
=
jgRegistrationHistoryService
.
getDteailByRecord
(
bizId
,
useRegistrationMap
.
get
(
"UseRegistratSequenceNbr"
).
toString
(
));
JgRegistrationHistory
jgRegistrationHistory
=
jgRegistrationHistoryService
.
getDteailByRecord
(
bizId
,
MapUtils
.
getString
(
useRegistrationMap
,
"UseRegistratSequenceNbr"
));
allChangeColumns
.
forEach
(
meta
->
{
allChangeColumns
.
forEach
(
meta
->
{
if
(!
ValidationUtil
.
isEmpty
(
jgUseRegistration
))
{
if
(!
ValidationUtil
.
isEmpty
(
jgUseRegistration
))
{
// 更新接收机构
// 更新接收机构
...
...
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/JgChangeRegistrationUnitServiceImpl.java
View file @
b35efad6
...
@@ -348,7 +348,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
...
@@ -348,7 +348,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
if
(
PipelineEnum
.
PRESSURE_PIPELINE
.
getCode
().
equals
(
noticeDto
.
getEquListCode
()))
{
if
(
PipelineEnum
.
PRESSURE_PIPELINE
.
getCode
().
equals
(
noticeDto
.
getEquListCode
()))
{
dealProjectContraptionToUpdate
(
submitType
,
noticeDto
,
op
,
reginParams
);
dealProjectContraptionToUpdate
(
submitType
,
noticeDto
,
op
,
reginParams
);
}
else
if
(
CylinderTypeEnum
.
CYLINDER
.
getCode
().
equals
(
noticeDto
.
getEquCategoryCode
()))
{
}
else
if
(
CylinderTypeEnum
.
CYLINDER
.
getCode
().
equals
(
noticeDto
.
getEquCategoryCode
()))
{
return
this
.
dealCylinderToUpdate
(
submitType
,
noticeDto
,
op
,
reginParams
);
dealCylinderToUpdate1
(
submitType
,
noticeDto
,
op
,
reginParams
);
}
else
{
}
else
{
// 字段转换
// 字段转换
this
.
convertField
(
noticeDto
);
this
.
convertField
(
noticeDto
);
...
@@ -526,6 +526,347 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
...
@@ -526,6 +526,347 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
}
}
}
}
private
void
dealCylinderToUpdate1
(
String
submitType
,
JgChangeRegistrationUnitDto
changeRegistrationUnitDto
,
String
op
,
ReginParams
reginParams
)
{
// 字段转换
this
.
convertField
(
changeRegistrationUnitDto
);
// 获取单位变更设备列表
List
<
Map
<
String
,
Object
>>
deviceList
=
changeRegistrationUnitDto
.
getDeviceList
();
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"请选择设备后提交"
);
}
String
applyNo
=
changeRegistrationUnitDto
.
getApplyNo
();
List
<
String
>
applyNoList
=
ValidationUtil
.
isEmpty
(
applyNo
)
?
Optional
.
ofNullable
(
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
DWBG
.
getCode
(),
1
))
.
filter
(
r
->
r
.
getStatus
()
==
HttpStatus
.
OK
.
value
()
&&
!
CollectionUtils
.
isEmpty
(
r
.
getResult
()))
.
map
(
ResponseModel:
:
getResult
)
.
orElseThrow
(()
->
new
BadRequest
(
"生成申请变更单位编码失败!"
))
:
Collections
.
singletonList
(
applyNo
);
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
//放在最后面防止前面有异常
//如果是提交,用于校验设备是否已经在流程中,如果不在标记设备已经在流程中
CompanyBo
company
=
reginParams
.
getCompany
();
deviceList
.
forEach
(
jsonObject
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
equipRepeatUsedCheck
(
String
.
valueOf
(
jsonObject
.
get
(
RECORD
)),
CompanyTypeEnum
.
INDIVIDUAL
.
getName
().
equals
(
company
.
getCompanyType
())
?
company
.
getCompanyCode
().
split
(
"_"
)[
1
]
:
company
.
getCompanyCode
()));
}
ArrayList
<
String
>
roleListAll
=
new
ArrayList
<>();
ArrayList
<
String
>
roleListNext
=
new
ArrayList
<>();
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 发起流程
if
(!
StringUtils
.
hasText
(
changeRegistrationUnitDto
.
getInstanceId
()))
{
List
<
ProcessTaskDTO
>
processTasks
=
new
ArrayList
<>();
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
String
.
valueOf
(
new
Date
().
getTime
()));
dto
.
setCompleteFirstTask
(
true
);
list
.
add
(
dto
);
actWorkflowBatchDTO
.
setProcess
(
list
);
dto
.
setNextExecuteUserCompanyCode
(
changeRegistrationUnitDto
.
getReceiveCompanyCode
());
processTasks
=
cmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
);
String
instanceId
=
processTasks
.
get
(
0
).
getProcessInstance
().
getId
();
String
nextTaskId
=
processTasks
.
get
(
0
).
getNextTask
().
get
(
0
).
getId
();
String
taskname
=
processTasks
.
get
(
0
).
getNextTask
().
get
(
0
).
getName
();
this
.
buildRoleList
(
processTasks
,
roleListNext
,
roleListAll
);
List
<
WorkflowResultDto
>
workflowResultDtos
=
commonServiceImpl
.
buildWorkFlowInfo
(
processTasks
);
String
nextUserIds
=
workflowResultDtos
.
get
(
0
).
getNextExecutorUserIds
();
JgChangeRegistrationUnit
notice
=
new
JgChangeRegistrationUnit
();
BeanUtils
.
copyProperties
(
changeRegistrationUnitDto
,
notice
);
notice
.
setChangeCertificate
(
changeRegistrationUnitDto
.
getChangeCertificate
());
notice
.
setRemark
(
changeRegistrationUnitDto
.
getRemark
());
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
roleListAll
);
}
else
{
notice
.
setInstanceStatus
(
String
.
join
(
","
,
roleListAll
));
}
notice
.
setInstanceId
(
instanceId
);
notice
.
setNextTaskId
(
nextTaskId
);
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecutorIds
(
String
.
join
(
","
,
roleListNext
));
notice
.
setStatus
(
WorkFlowStatusEnum
.
UNITCHANGE_RECEIVE
.
getPass
());
notice
.
setNextExecuteUserIds
(
nextUserIds
);
setNewUnitInfo
(
reginParams
,
notice
);
JgChangeRegistrationUnitMapper
.
updateById
(
notice
);
commonServiceImpl
.
deleteTasksByRelationId
(
notice
.
getSequenceNbr
()
+
""
);
createTaskModel
(
notice
,
taskname
,
"1"
,
nextUserIds
);
commonServiceImpl
.
saveExecuteFlowData2Redis
(
notice
.
getInstanceId
(),
buildInstanceRuntimeData
(
notice
));
}
else
{
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
String
taskId
=
changeRegistrationUnitDto
.
getNextTaskId
();
//组装信息
TaskResultDTO
task
=
new
TaskResultDTO
();
task
.
setResultCode
(
"approvalStatus"
);
task
.
setTaskId
(
taskId
);
task
.
setComment
(
""
);
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"approvalStatus"
,
op
);
if
(!
ObjectUtils
.
isEmpty
(
changeRegistrationUnitDto
.
getInstanceStatus
())
&&
(
changeRegistrationUnitDto
.
getStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getReject
())
||
changeRegistrationUnitDto
.
getStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getRollBack
())))
{
map
.
put
(
"approvalStatus"
,
"提交"
);
}
task
.
setVariable
(
map
);
//执行流程
task
.
setNextExecuteUserCompanyCode
(
changeRegistrationUnitDto
.
getReceiveCompanyCode
());
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
completeOrReject
(
taskId
,
task
,
op
);
JgChangeRegistrationUnit
bean
=
new
JgChangeRegistrationUnit
();
BeanUtils
.
copyProperties
(
changeRegistrationUnitDto
,
bean
);
String
taskCode
=
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
();
String
taskName1
=
""
;
String
nextTaskId
=
""
;
this
.
buildRoleList
(
Collections
.
singletonList
(
processTaskDTO
),
roleList
,
roleListAll
);
List
<
WorkflowResultDto
>
workflowResultDtos
=
commonServiceImpl
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
));
String
nextUserIds
=
workflowResultDtos
.
get
(
0
).
getNextExecutorUserIds
();
if
(
processTaskDTO
!=
null
&&
processTaskDTO
.
getNextTask
()
!=
null
&&
!
processTaskDTO
.
getNextTask
().
isEmpty
())
{
taskCode
=
processTaskDTO
.
getNextTask
().
get
(
0
).
getKey
();
taskName1
=
processTaskDTO
.
getNextTask
().
get
(
0
).
getName
();
nextTaskId
=
processTaskDTO
.
getNextTask
().
get
(
0
).
getId
();
}
bean
.
setNextExecutorIds
(
String
.
join
(
","
,
roleList
));
if
(!
ObjectUtils
.
isEmpty
(
bean
.
getInstanceStatus
()))
{
bean
.
setInstanceStatus
(
bean
.
getInstanceStatus
()
+
","
+
String
.
join
(
","
,
roleList
));
}
else
{
bean
.
setInstanceStatus
(
String
.
join
(
","
,
roleList
));
}
bean
.
setNextTaskId
(
nextTaskId
);
bean
.
setPromoter
(
RequestContext
.
getExeUserId
());
bean
.
setStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getPass
());
executeOneStep
(
bean
,
taskName1
,
nextUserIds
,
op
);
bean
.
setNextExecuteUserIds
(
nextUserIds
);
setNewUnitInfo
(
reginParams
,
bean
);
JgChangeRegistrationUnitMapper
.
updateById
(
bean
);
commonServiceImpl
.
saveExecuteFlowData2Redis
(
bean
.
getInstanceId
(),
buildInstanceRuntimeData
(
bean
));
}
}
else
{
JgChangeRegistrationUnit
bean
=
new
JgChangeRegistrationUnit
();
BeanUtils
.
copyProperties
(
changeRegistrationUnitDto
,
bean
);
setNewUnitInfo
(
reginParams
,
bean
);
JgChangeRegistrationUnitMapper
.
updateById
(
bean
);
}
List
<
JgChangeRegistrationUnitEq
>
jgRelationEquipList
=
new
ArrayList
<>();
deviceList
.
forEach
(
device
->
{
JgChangeRegistrationUnitEq
unitEq
=
new
JgChangeRegistrationUnitEq
();
unitEq
.
setRegistrationCertificate
(
changeRegistrationUnitDto
.
getUseRegistrationCertificate
());
unitEq
.
setEquId
(
Objects
.
toString
(
device
.
get
(
RECORD
)));
unitEq
.
setUnitChangeRegistrationId
(
changeRegistrationUnitDto
.
getSequenceNbr
().
toString
());
unitEq
.
setDeviceInfo
(
JSONObject
.
toJSONString
(
device
));
//设备信息json
jgRelationEquipList
.
add
(
unitEq
);
});
JgRegistrationHistory
jgRegistrationHistory
=
new
JgRegistrationHistory
();
//登记类别
jgRegistrationHistory
.
setRegistrationClass
(
"单位变更登记"
);
jgRegistrationHistory
.
setCurrentDocumentId
(
changeRegistrationUnitDto
.
getApplyNo
());
//使用登记证历史数据
jgRegistrationHistory
.
setChangeData
(
JSON
.
toJSONString
(
deviceList
));
//先删除之前设备关系数据,在插入最新设备关系数据
registrationUnitEqService
.
getBaseMapper
().
delete
(
new
LambdaQueryWrapper
<
JgChangeRegistrationUnitEq
>()
.
eq
(
JgChangeRegistrationUnitEq:
:
getUnitChangeRegistrationId
,
changeRegistrationUnitDto
.
getSequenceNbr
()));
registrationUnitEqService
.
saveBatch
(
jgRelationEquipList
);
//先删除之前未提交的历史使用登记证信息,在插入最新的使用登记证信息
registrationHistoryService
.
getBaseMapper
().
delete
(
new
LambdaQueryWrapper
<
JgRegistrationHistory
>()
.
eq
(
JgRegistrationHistory:
:
getCurrentDocumentId
,
changeRegistrationUnitDto
.
getApplyNo
()));
registrationHistoryService
.
save
(
jgRegistrationHistory
);
}
/**
* 气瓶单位变更业务
* @param submitType 提交类型
* @param dto 提交参数
* @param op
* @param reginParams
*/
private
void
saveOrUpdateCylinder
(
String
submitType
,
JgChangeRegistrationUnitDto
dto
,
String
op
,
ReginParams
reginParams
)
{
// 1️⃣ 字段转换与前置校验
convertField
(
dto
);
validateDeviceList
(
dto
.
getDeviceList
());
// 2️⃣ 获取申请编号
List
<
String
>
applyNoList
=
resolveApplyNo
(
dto
);
dto
.
setApplyNo
(
applyNoList
.
get
(
0
));
// 3️⃣ 校验设备是否正在流程中
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
validateEquipUsed
(
dto
.
getDeviceList
(),
reginParams
);
}
// 4️⃣ 流程逻辑统一处理
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
handleFlow
(
dto
,
op
,
reginParams
);
}
else
{
handleSaveOnly
(
dto
,
reginParams
);
}
// 5️⃣ 保存设备关系与历史
saveUnitEquipAndHistory
(
dto
);
}
private
void
validateDeviceList
(
List
<
Map
<
String
,
Object
>>
deviceList
)
{
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"请选择设备后提交"
);
}
}
private
List
<
String
>
resolveApplyNo
(
JgChangeRegistrationUnitDto
dto
)
{
if
(
ValidationUtil
.
isEmpty
(
dto
.
getApplyNo
()))
{
return
Optional
.
ofNullable
(
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
DWBG
.
getCode
(),
1
)
).
filter
(
r
->
r
.
getStatus
()
==
HttpStatus
.
OK
.
value
()
&&
CollUtil
.
isNotEmpty
(
r
.
getResult
()))
.
map
(
ResponseModel:
:
getResult
)
.
orElseThrow
(()
->
new
BadRequest
(
"生成申请变更单位编码失败!"
));
}
return
Collections
.
singletonList
(
dto
.
getApplyNo
());
}
private
void
validateEquipUsed
(
List
<
Map
<
String
,
Object
>>
deviceList
,
ReginParams
reginParams
)
{
CompanyBo
company
=
reginParams
.
getCompany
();
String
companyCode
=
CompanyTypeEnum
.
INDIVIDUAL
.
getName
().
equals
(
company
.
getCompanyType
())
?
company
.
getCompanyCode
().
split
(
"_"
)[
1
]
:
company
.
getCompanyCode
();
deviceList
.
forEach
(
json
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
equipRepeatUsedCheck
(
String
.
valueOf
(
json
.
get
(
RECORD
)),
companyCode
));
}
private
void
handleFlow
(
JgChangeRegistrationUnitDto
dto
,
String
op
,
ReginParams
reginParams
)
{
if
(!
StringUtils
.
hasText
(
dto
.
getInstanceId
()))
{
startNewFlow
(
dto
,
reginParams
);
}
else
{
updateExistingFlow
(
dto
,
op
,
reginParams
);
}
}
private
void
startNewFlow
(
JgChangeRegistrationUnitDto
dto
,
ReginParams
reginParams
)
{
ActWorkflowStartDTO
startDTO
=
new
ActWorkflowStartDTO
();
startDTO
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
startDTO
.
setBusinessKey
(
String
.
valueOf
(
System
.
currentTimeMillis
()));
startDTO
.
setCompleteFirstTask
(
true
);
startDTO
.
setNextExecuteUserCompanyCode
(
dto
.
getReceiveCompanyCode
());
ActWorkflowBatchDTO
batch
=
new
ActWorkflowBatchDTO
();
batch
.
setProcess
(
Collections
.
singletonList
(
startDTO
));
List
<
ProcessTaskDTO
>
processTasks
=
cmWorkflowService
.
startBatch
(
batch
);
ProcessTaskDTO
first
=
processTasks
.
get
(
0
);
String
instanceId
=
first
.
getProcessInstance
().
getId
();
String
nextTaskId
=
first
.
getNextTask
().
get
(
0
).
getId
();
String
taskName
=
first
.
getNextTask
().
get
(
0
).
getName
();
ArrayList
<
String
>
roleListAll
=
new
ArrayList
<>();
ArrayList
<
String
>
roleListNext
=
new
ArrayList
<>();
buildRoleList
(
processTasks
,
roleListNext
,
roleListAll
);
List
<
WorkflowResultDto
>
workflowInfos
=
commonServiceImpl
.
buildWorkFlowInfo
(
processTasks
);
String
nextUserIds
=
workflowInfos
.
get
(
0
).
getNextExecutorUserIds
();
JgChangeRegistrationUnit
entity
=
new
JgChangeRegistrationUnit
();
BeanUtils
.
copyProperties
(
dto
,
entity
);
entity
.
setInstanceId
(
instanceId
);
entity
.
setNextTaskId
(
nextTaskId
);
entity
.
setPromoter
(
RequestContext
.
getExeUserId
());
entity
.
setNextExecutorIds
(
String
.
join
(
","
,
roleListNext
));
entity
.
setNextExecuteUserIds
(
nextUserIds
);
entity
.
setStatus
(
WorkFlowStatusEnum
.
UNITCHANGE_RECEIVE
.
getPass
());
entity
.
setInstanceStatus
(
String
.
join
(
","
,
roleListAll
));
setNewUnitInfo
(
reginParams
,
entity
);
JgChangeRegistrationUnitMapper
.
updateById
(
entity
);
commonServiceImpl
.
deleteTasksByRelationId
(
entity
.
getSequenceNbr
()
+
""
);
createTaskModel
(
entity
,
taskName
,
"1"
,
nextUserIds
);
commonServiceImpl
.
saveExecuteFlowData2Redis
(
entity
.
getInstanceId
(),
buildInstanceRuntimeData
(
entity
));
}
private
void
handleProcessUpdate
(
JgChangeRegistrationUnitDto
dto
,
ProcessTaskDTO
processTask
,
String
op
,
ReginParams
reginParams
)
{
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
ArrayList
<
String
>
roleListAll
=
new
ArrayList
<>();
buildRoleList
(
Collections
.
singletonList
(
processTask
),
roleList
,
roleListAll
);
List
<
WorkflowResultDto
>
workflowInfos
=
commonServiceImpl
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTask
));
String
nextUserIds
=
workflowInfos
.
get
(
0
).
getNextExecutorUserIds
();
String
taskCode
=
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
();
String
taskName
=
""
;
String
nextTaskId
=
""
;
if
(
processTask
.
getNextTask
()
!=
null
&&
!
processTask
.
getNextTask
().
isEmpty
())
{
taskCode
=
processTask
.
getNextTask
().
get
(
0
).
getKey
();
taskName
=
processTask
.
getNextTask
().
get
(
0
).
getName
();
nextTaskId
=
processTask
.
getNextTask
().
get
(
0
).
getId
();
}
JgChangeRegistrationUnit
entity
=
new
JgChangeRegistrationUnit
();
BeanUtils
.
copyProperties
(
dto
,
entity
);
entity
.
setNextTaskId
(
nextTaskId
);
entity
.
setPromoter
(
RequestContext
.
getExeUserId
());
entity
.
setNextExecutorIds
(
String
.
join
(
","
,
roleList
));
entity
.
setNextExecuteUserIds
(
nextUserIds
);
entity
.
setInstanceStatus
(
String
.
join
(
","
,
roleListAll
));
entity
.
setStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getPass
());
executeOneStep
(
entity
,
taskName
,
nextUserIds
,
op
);
setNewUnitInfo
(
reginParams
,
entity
);
JgChangeRegistrationUnitMapper
.
updateById
(
entity
);
commonServiceImpl
.
saveExecuteFlowData2Redis
(
entity
.
getInstanceId
(),
buildInstanceRuntimeData
(
entity
));
}
private
void
updateExistingFlow
(
JgChangeRegistrationUnitDto
dto
,
String
op
,
ReginParams
reginParams
)
{
String
taskId
=
dto
.
getNextTaskId
();
TaskResultDTO
task
=
new
TaskResultDTO
();
task
.
setResultCode
(
"approvalStatus"
);
task
.
setTaskId
(
taskId
);
task
.
setComment
(
""
);
HashMap
<
String
,
Object
>
variable
=
new
HashMap
<>();
variable
.
put
(
"approvalStatus"
,
op
);
if
(!
ObjectUtils
.
isEmpty
(
dto
.
getInstanceStatus
())
&&
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getReject
().
equals
(
dto
.
getStatus
())
||
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getRollBack
().
equals
(
dto
.
getStatus
())))
{
variable
.
put
(
"approvalStatus"
,
"提交"
);
}
task
.
setVariable
(
variable
);
task
.
setNextExecuteUserCompanyCode
(
dto
.
getReceiveCompanyCode
());
ProcessTaskDTO
processTask
=
cmWorkflowService
.
completeOrReject
(
taskId
,
task
,
op
);
handleProcessUpdate
(
dto
,
processTask
,
op
,
reginParams
);
}
private
void
handleSaveOnly
(
JgChangeRegistrationUnitDto
dto
,
ReginParams
reginParams
)
{
JgChangeRegistrationUnit
entity
=
new
JgChangeRegistrationUnit
();
BeanUtils
.
copyProperties
(
dto
,
entity
);
setNewUnitInfo
(
reginParams
,
entity
);
JgChangeRegistrationUnitMapper
.
updateById
(
entity
);
}
private
void
saveUnitEquipAndHistory
(
JgChangeRegistrationUnitDto
dto
)
{
List
<
Map
<
String
,
Object
>>
deviceList
=
dto
.
getDeviceList
();
List
<
JgChangeRegistrationUnitEq
>
unitEqs
=
deviceList
.
stream
().
map
(
device
->
{
JgChangeRegistrationUnitEq
eq
=
new
JgChangeRegistrationUnitEq
();
eq
.
setRegistrationCertificate
(
dto
.
getUseRegistrationCertificate
());
eq
.
setEquId
(
String
.
valueOf
(
device
.
get
(
RECORD
)));
eq
.
setUnitChangeRegistrationId
(
dto
.
getSequenceNbr
().
toString
());
eq
.
setDeviceInfo
(
JSONObject
.
toJSONString
(
device
));
return
eq
;
}).
collect
(
Collectors
.
toList
());
registrationUnitEqService
.
remove
(
new
LambdaQueryWrapper
<
JgChangeRegistrationUnitEq
>()
.
eq
(
JgChangeRegistrationUnitEq:
:
getUnitChangeRegistrationId
,
dto
.
getSequenceNbr
()));
registrationUnitEqService
.
saveBatch
(
unitEqs
);
JgRegistrationHistory
history
=
new
JgRegistrationHistory
();
history
.
setRegistrationClass
(
"单位变更登记"
);
history
.
setCurrentDocumentId
(
dto
.
getApplyNo
());
history
.
setChangeData
(
JSON
.
toJSONString
(
deviceList
));
registrationHistoryService
.
remove
(
new
LambdaQueryWrapper
<
JgRegistrationHistory
>()
.
eq
(
JgRegistrationHistory:
:
getCurrentDocumentId
,
dto
.
getApplyNo
()));
registrationHistoryService
.
save
(
history
);
}
/**
/**
* 气瓶单位变更业务
* 气瓶单位变更业务
* @param submitType
* @param submitType
...
@@ -533,7 +874,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
...
@@ -533,7 +874,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
* @param op
* @param op
* @param reginParams
* @param reginParams
*/
*/
private
JgChangeRegistrationUnitDto
dealCylinderTo
Updat
e
(
String
submitType
,
JgChangeRegistrationUnitDto
changeRegistrationUnitDto
,
String
op
,
ReginParams
reginParams
)
{
private
JgChangeRegistrationUnitDto
dealCylinderTo
Sav
e
(
String
submitType
,
JgChangeRegistrationUnitDto
changeRegistrationUnitDto
,
String
op
,
ReginParams
reginParams
)
{
String
[]
taskName
=
new
String
[]{
"流程结束"
};
String
[]
taskName
=
new
String
[]{
"流程结束"
};
// 字段转换
// 字段转换
this
.
convertField
(
changeRegistrationUnitDto
);
this
.
convertField
(
changeRegistrationUnitDto
);
...
@@ -1006,7 +1347,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
...
@@ -1006,7 +1347,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
// 字段转换
// 字段转换
convertField
(
model
);
convertField
(
model
);
if
(
CylinderTypeEnum
.
CYLINDER
.
getCode
().
equals
(
model
.
getEquCategoryCode
()))
{
if
(
CylinderTypeEnum
.
CYLINDER
.
getCode
().
equals
(
model
.
getEquCategoryCode
()))
{
return
Collections
.
singletonList
(
this
.
dealCylinderToUpdate
(
submitType
,
model
,
""
,
reginParams
)
);
this
.
dealCylinderToSave
(
submitType
,
model
,
""
,
reginParams
);
}
else
{
}
else
{
// 获取单位变更使用登记证列表
// 获取单位变更使用登记证列表
List
<
Map
<
String
,
Object
>>
registrationList
=
model
.
getRegistrationList
();
List
<
Map
<
String
,
Object
>>
registrationList
=
model
.
getRegistrationList
();
...
@@ -1195,6 +1536,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
...
@@ -1195,6 +1536,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
registrationHistoryService
.
save
(
jgRegistrationHistory
);
registrationHistoryService
.
save
(
jgRegistrationHistory
);
return
Collections
.
singletonList
(
model
);
return
Collections
.
singletonList
(
model
);
}
}
return
Collections
.
singletonList
(
model
);
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
this
.
rollBackForDelRedisData
();
...
@@ -1328,6 +1670,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
...
@@ -1328,6 +1670,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
model
.
setReceiveOrgName
(
receiveOrgCodeList
[
1
]);
model
.
setReceiveOrgName
(
receiveOrgCodeList
[
1
]);
}
}
}
}
this
.
setEquAddress
(
model
);
}
}
...
@@ -1744,7 +2087,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
...
@@ -1744,7 +2087,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
* @param registration 单位变更主表数据
* @param registration 单位变更主表数据
* @param op 通过
* @param op 通过
*/
*/
private
void
dealCylinderAuditPassData
(
JgChangeRegistrationUnitDto
dto
,
String
nextTaskId
,
JgChangeRegistrationUnit
registration
,
String
op
)
{
private
void
dealCylinderAuditPassData
1
(
JgChangeRegistrationUnitDto
dto
,
String
nextTaskId
,
JgChangeRegistrationUnit
registration
,
String
op
)
{
List
<
Map
<
String
,
Object
>>
deviceList
=
dto
.
getDeviceList
();
List
<
Map
<
String
,
Object
>>
deviceList
=
dto
.
getDeviceList
();
if
(
CollUtil
.
isEmpty
(
deviceList
))
{
if
(
CollUtil
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"设备列表不能为空!"
);
throw
new
BadRequest
(
"设备列表不能为空!"
);
...
@@ -1808,7 +2151,6 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
...
@@ -1808,7 +2151,6 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
.
setAddress
(
dto
.
getFullAddress
())
.
setAddress
(
dto
.
getFullAddress
())
.
setCity
(
dto
.
getCity
())
.
setCity
(
dto
.
getCity
())
.
setCounty
(
dto
.
getCounty
())
.
setCounty
(
dto
.
getCounty
())
.
setAddress
(
dto
.
getEquAddress
())
.
setFactoryUseSiteStreet
(
dto
.
getStreet
())
.
setFactoryUseSiteStreet
(
dto
.
getStreet
())
.
setUseDate
(
dto
.
getUseDate
()));
.
setUseDate
(
dto
.
getUseDate
()));
}
}
...
@@ -1901,6 +2243,239 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
...
@@ -1901,6 +2243,239 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
this
.
delRepeatUseEquipData
(
registration
.
getApplyNo
(),
registration
.
getStatus
(),
registration
.
getNewUseUnitCreditCode
());
this
.
delRepeatUseEquipData
(
registration
.
getApplyNo
(),
registration
.
getStatus
(),
registration
.
getNewUseUnitCreditCode
());
}
}
/**
* 处理气瓶单位变更三级审核完成后数据
*/
private
void
dealCylinderAuditPassData
(
JgChangeRegistrationUnitDto
dto
,
String
nextTaskId
,
JgChangeRegistrationUnit
registration
,
String
op
)
{
List
<
Map
<
String
,
Object
>>
deviceList
=
dto
.
getDeviceList
();
if
(
CollUtil
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"设备列表不能为空!"
);
}
// 1. 更新代办
registration
.
setNextTaskId
(
nextTaskId
);
TaskV2Model
taskV2Model
=
updateTaskModel
(
registration
,
op
);
// 2. 确定使用登记证代码(优先复用已有,否者生成)
AtomicReference
<
Boolean
>
existedRegistrationFlag
=
new
AtomicReference
<>(
Boolean
.
FALSE
);
String
useRegistrationCode
=
findOrGenerateUseRegistrationCode
(
dto
,
registration
,
deviceList
,
existedRegistrationFlag
);
// 3. ES批量更新参数 & 需要变更的设备列表
List
<
String
>
records
=
new
ArrayList
<>(
deviceList
.
size
());
Map
<
String
,
Map
<
String
,
Object
>>
esUpdateMap
=
new
HashMap
<>();
// 4. 更新产权单位信息
TzBaseEnterpriseInfo
enterpriseInfo
=
Optional
.
ofNullable
(
dto
.
getEstateUnitSeq
())
.
filter
(
ObjectUtils:
:
isNotEmpty
)
.
map
(
tzBaseEnterpriseInfoMapper:
:
selectById
)
.
orElse
(
null
);
// 提取设备信息(只取第一个)
if
(
CollUtil
.
isNotEmpty
(
deviceList
))
{
Map
<
String
,
Object
>
first
=
deviceList
.
get
(
0
);
registration
.
setEquCategory
(
MapUtils
.
getString
(
first
,
"equCategoryName"
));
registration
.
setEquDefine
(
MapUtils
.
getString
(
first
,
"equDefineName"
));
registration
.
setEquDefineCode
(
MapUtils
.
getString
(
first
,
"equDefine"
));
}
// 5.更新useInfo、属地、注册信息,准备ES更新内容
for
(
Map
<
String
,
Object
>
device
:
deviceList
)
{
String
record
=
MapUtils
.
getString
(
device
,
RECORD
);
records
.
add
(
record
);
IdxBizJgUseInfo
useInfo
=
fetchUseInfoByRecord
(
record
);
if
(
useInfo
!=
null
)
{
updateUseInfoFields
(
useInfo
,
dto
,
registration
,
enterpriseInfo
);
useInfoMapper
.
updateById
(
useInfo
);
}
// 更新属地
if
(!
ObjectUtils
.
isEmpty
(
dto
.
getOrgBranchCode
()))
{
updateSupervisionInfo
(
record
,
registration
);
}
// 更新注册表中 useOrgCode
updateRegisterInfo
(
record
,
useRegistrationCode
);
// 准备 ES 更新参数
Map
<
String
,
Object
>
esParams
=
buildEsUpdateParams
(
useInfo
,
registration
,
useRegistrationCode
);
esUpdateMap
.
put
(
record
,
esParams
);
}
// 6. 批量调用ES更新
if
(!
esUpdateMap
.
isEmpty
())
{
tzsServiceFeignClient
.
commonUpdateEsDataByIds
(
esUpdateMap
);
}
// 7. 新增或更新使用登记证管理表
upsertUseRegistrationManage
(
registration
,
useRegistrationCode
,
existedRegistrationFlag
.
get
());
// 8. 发送变更消息、保存变更记录、创建设备履历等后置处理
this
.
sendDataRefreshMsg
(
registration
);
this
.
saveRecord
(
registration
);
this
.
createResume
(
records
,
registration
,
taskV2Model
.
getRoutePath
());
// 9. 更新主表并刷新 redis 实时流程数据
JgChangeRegistrationUnitMapper
.
updateById
(
registration
);
commonServiceImpl
.
saveExecuteFlowData2Redis
(
dto
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
registration
));
// 10. 删除重复使用标识
this
.
delRepeatUseEquipData
(
registration
.
getApplyNo
(),
registration
.
getStatus
(),
registration
.
getNewUseUnitCreditCode
());
}
private
String
findOrGenerateUseRegistrationCode
(
JgChangeRegistrationUnitDto
dto
,
JgChangeRegistrationUnit
registration
,
List
<
Map
<
String
,
Object
>>
deviceList
,
AtomicReference
<
Boolean
>
existedFlag
)
{
// 查询新单位存在的已登记使用登记证(只取以 "瓶30" 开头的)系统生成的证号
JgUseRegistrationManageDto
queryDto
=
new
JgUseRegistrationManageDto
();
queryDto
.
setCertificateStatus
(
CertificateStatusEnum
.
YIDENGJI
.
getName
());
queryDto
.
setUseUnitCreditCode
(
registration
.
getNewUseUnitCreditCode
());
List
<
JgUseRegistrationManageDto
>
found
=
jgUseRegistrationManageMapper
.
queryByUseUnitCreditCode
(
queryDto
);
if
(!
CollectionUtils
.
isEmpty
(
found
))
{
for
(
JgUseRegistrationManageDto
m
:
found
)
{
String
code
=
m
.
getUseRegistrationCode
();
if
(
StringUtils
.
hasText
(
code
)
&&
code
.
startsWith
(
"瓶30"
))
{
existedFlag
.
set
(
Boolean
.
TRUE
);
return
code
;
}
}
}
// 若企业没有系统生成的使用登记证,则生成(使用第一个设备ID)
String
firstRecord
=
Objects
.
toString
(
deviceList
.
get
(
0
).
get
(
RECORD
),
null
);
return
commonServiceImpl
.
generateRegistrationCode
(
firstRecord
,
dto
.
getReceiveCompanyCode
(),
true
);
}
private
IdxBizJgUseInfo
fetchUseInfoByRecord
(
String
record
)
{
LambdaQueryWrapper
<
IdxBizJgUseInfo
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
record
);
return
useInfoMapper
.
selectOne
(
wrapper
);
}
private
void
updateUseInfoFields
(
IdxBizJgUseInfo
useInfo
,
JgChangeRegistrationUnitDto
dto
,
JgChangeRegistrationUnit
registration
,
TzBaseEnterpriseInfo
enterpriseInfo
)
{
if
(
enterpriseInfo
!=
null
)
{
useInfo
.
setEstateUnitCreditCode
(
enterpriseInfo
.
getUseUnitCode
())
.
setEstateUnitName
(
enterpriseInfo
.
getUseUnit
());
}
String
safetyManager
=
Optional
.
ofNullable
(
dto
.
getSafetyManager
())
.
map
(
s
->
s
.
split
(
","
))
.
filter
(
arr
->
arr
.
length
>
1
)
.
map
(
arr
->
arr
[
1
])
.
orElse
(
""
);
useInfo
.
setPhone
(
dto
.
getPhone
());
useInfo
.
setUseUnitCreditCode
(
registration
.
getNewUseUnitCreditCode
());
useInfo
.
setUseUnitName
(
registration
.
getNewUseUnitName
());
useInfo
.
setSafetyManager
(
safetyManager
);
// 地区/地址字段回填(保持原字段赋值顺序与语义)
useInfo
.
setProvinceName
(
"陕西省"
)
.
setProvince
(
dto
.
getProvince
())
.
setCity
(
dto
.
getCity
())
.
setCityName
(
getRegionNameByCode
(
"city"
,
dto
.
getCity
()))
.
setCounty
(
dto
.
getCounty
())
.
setCountyName
(
getRegionNameByCode
(
"region"
,
dto
.
getCounty
()))
.
setFactoryUseSiteStreet
(
dto
.
getStreet
())
.
setStreetName
(
getRegionNameByCode
(
"street"
,
dto
.
getStreet
()))
.
setAddress
(
dto
.
getFullAddress
())
.
setUseDate
(
dto
.
getUseDate
());
}
private
void
updateSupervisionInfo
(
String
record
,
JgChangeRegistrationUnit
registration
)
{
// 查询上级公司信息(保留原逻辑)
HashMap
<
String
,
Object
>
parentMessage
=
(
HashMap
<
String
,
Object
>)
Privilege
.
companyClient
.
queryByOrgcode
(
registration
.
getOrgBranchCode
()).
getResult
();
CompanyModel
parentModel
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
parentMessage
.
get
(
"compnay"
)),
CompanyModel
.
class
);
IdxBizJgSupervisionInfo
supervision
=
new
IdxBizJgSupervisionInfo
();
supervision
.
setOrgBranchCode
(
registration
.
getOrgBranchCode
());
supervision
.
setOrgBranchName
(
registration
.
getOrgBranchName
());
supervision
.
setCompanyOrgBranchCode
(
parentModel
.
getCompanyCode
());
LambdaQueryWrapper
<
IdxBizJgSupervisionInfo
>
eq
=
new
QueryWrapper
<
IdxBizJgSupervisionInfo
>().
lambda
()
.
eq
(
IdxBizJgSupervisionInfo:
:
getRecord
,
record
);
idxBizJgSupervisionInfoMapper
.
update
(
supervision
,
eq
);
}
private
void
updateRegisterInfo
(
String
record
,
String
useRegistrationCode
)
{
LambdaUpdateWrapper
<
IdxBizJgRegisterInfo
>
update
=
new
UpdateWrapper
<
IdxBizJgRegisterInfo
>().
lambda
()
.
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
record
)
.
set
(
true
,
IdxBizJgRegisterInfo:
:
getUseOrgCode
,
useRegistrationCode
);
idxBizJgRegisterInfoService
.
update
(
update
);
}
private
Map
<
String
,
Object
>
buildEsUpdateParams
(
IdxBizJgUseInfo
useInfo
,
JgChangeRegistrationUnit
registration
,
String
useRegistrationCode
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"USE_UNIT_CREDIT_CODE"
,
registration
.
getNewUseUnitCreditCode
());
params
.
put
(
"USE_UNIT_NAME"
,
registration
.
getNewUseUnitName
());
params
.
put
(
"REC_DATE"
,
new
Date
());
if
(
useInfo
!=
null
)
{
params
.
put
(
"USE_PLACE"
,
joinWithSeparator
(
"/"
,
useInfo
.
getProvinceName
(),
useInfo
.
getCityName
(),
useInfo
.
getCountyName
(),
useInfo
.
getStreetName
()));
params
.
put
(
"USE_PLACE_CODE"
,
joinWithSeparator
(
"#"
,
useInfo
.
getProvince
(),
useInfo
.
getCity
(),
useInfo
.
getCounty
(),
useInfo
.
getFactoryUseSiteStreet
()));
}
params
.
put
(
"ORG_BRANCH_CODE"
,
registration
.
getOrgBranchCode
());
params
.
put
(
"ORG_BRANCH_NAME"
,
registration
.
getOrgBranchName
());
params
.
put
(
"USE_ORG_CODE"
,
useRegistrationCode
);
return
params
;
}
private
void
upsertUseRegistrationManage
(
JgChangeRegistrationUnit
registration
,
String
useRegistrationCode
,
boolean
existed
)
{
Map
<
String
,
String
>
equType
=
new
HashMap
<>();
equType
.
put
(
"equListCode"
,
registration
.
getEquListCode
());
equType
.
put
(
"equCategoryCode"
,
registration
.
getEquCategoryCode
());
if
(
existed
)
{
// 查询并更新已有管理表记录
LambdaQueryWrapper
<
JgUseRegistrationManage
>
q
=
new
LambdaQueryWrapper
<>();
q
.
eq
(
JgUseRegistrationManage:
:
getUseRegistrationCode
,
useRegistrationCode
)
.
isNotNull
(
JgUseRegistrationManage:
:
getUseRegistrationCode
)
.
eq
(
JgUseRegistrationManage:
:
getCertificateStatus
,
"已登记"
)
.
eq
(
BaseEntity:
:
getIsDelete
,
false
);
JgUseRegistrationManage
manage
=
useRegistrationManageService
.
getBaseMapper
().
selectOne
(
q
);
if
(
manage
!=
null
)
{
manage
.
setAuditPassDate
(
registration
.
getAuditPassDate
());
manage
.
setVersion
(
manage
.
getVersion
()
+
1
);
manage
.
setChangeReason
(
BusinessTypeEnum
.
JG_COMPANY_CHANGE_REGISTRATION
.
getName
());
manage
.
setRecUserId
(
registration
.
getCreateUserId
());
useRegistrationManageService
.
updateById
(
manage
);
}
}
else
{
// 新增证管理信息
JgUseRegistrationManage
newManage
=
new
JgUseRegistrationManage
();
newManage
.
setSequenceNbr
(
sequence
.
nextId
());
newManage
.
setUseRegistrationCode
(
useRegistrationCode
);
newManage
.
setUseUnitName
(
registration
.
getNewUseUnitName
());
newManage
.
setUseUnitCreditCode
(
registration
.
getNewUseUnitCreditCode
());
newManage
.
setReceiveOrgName
(
registration
.
getReceiveOrgName
());
newManage
.
setReceiveCompanyCode
(
registration
.
getReceiveOrgCode
());
newManage
.
setAuditPassDate
(
registration
.
getAuditPassDate
());
newManage
.
setVersion
(
1
);
newManage
.
setRegType
(
"使用登记"
);
newManage
.
setManageType
(
"unit"
);
newManage
.
setApplyNo
(
registration
.
getApplyNo
());
newManage
.
setEquUseAddress
(
registration
.
getEquAddress
());
newManage
.
setRegDate
(
new
Date
());
newManage
.
setEquList
(
registration
.
getEquList
());
newManage
.
setEquListCode
(
registration
.
getEquListCode
());
newManage
.
setEquCategory
(
registration
.
getEquCategory
());
newManage
.
setEquCategoryCode
(
registration
.
getEquCategoryCode
());
newManage
.
setEquDefine
(
registration
.
getEquDefine
());
newManage
.
setEquDefineCode
(
registration
.
getEquDefineCode
());
newManage
.
setCertificateStatus
(
CertificateStatusEnum
.
YIDENGJI
.
getName
());
newManage
.
setChangeReason
(
BusinessTypeEnum
.
JG_COMPANY_CHANGE_REGISTRATION
.
getName
());
newManage
.
setRecUserName
(
registration
.
getCreateUserName
());
newManage
.
setRecUserId
(
registration
.
getCreateUserId
());
newManage
.
setRecDate
(
new
Date
());
newManage
.
setCreateUserId
(
registration
.
getCreateUserId
());
newManage
.
setCreateDate
(
new
Date
());
if
(!
ObjectUtils
.
isEmpty
(
registration
.
getNewUseUnitCreditCode
()))
{
TzBaseEnterpriseInfo
info
=
tzBaseEnterpriseInfoMapper
.
selectOne
(
new
QueryWrapper
<
TzBaseEnterpriseInfo
>().
eq
(
"use_unit_code"
,
registration
.
getNewUseUnitCreditCode
()));
if
(
info
!=
null
)
{
newManage
.
setUseUnitAddress
(
info
.
getAddress
());
}
}
newManage
.
setSuperviseOrgCode
(
registration
.
getOrgBranchCode
());
newManage
.
setSuperviseOrgName
(
registration
.
getOrgBranchName
());
newManage
.
setCertificateNo
(
commonServiceImpl
.
generateCertificateNo
(
equType
,
new
Date
(),
registration
.
getReceiveCompanyCode
()));
useRegistrationManageService
.
save
(
newManage
);
}
}
private
void
updateUseInfoAddress
(
IdxBizJgUseInfo
useInfo
,
JgChangeRegistrationUnit
registration
)
{
private
void
updateUseInfoAddress
(
IdxBizJgUseInfo
useInfo
,
JgChangeRegistrationUnit
registration
)
{
useInfo
.
setProvince
(
registration
.
getProvince
());
useInfo
.
setProvince
(
registration
.
getProvince
());
useInfo
.
setCity
(
registration
.
getCity
());
useInfo
.
setCity
(
registration
.
getCity
());
...
@@ -2187,16 +2762,25 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
...
@@ -2187,16 +2762,25 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
//根据使用登记证查询设备
//根据使用登记证查询设备
for
(
Object
o
:
registrationList
)
{
for
(
Object
o
:
registrationList
)
{
JSONObject
parseObject
=
JSON
.
parseObject
(
o
.
toString
());
JSONObject
parseObject
=
JSON
.
parseObject
(
o
.
toString
());
if
(
parseObject
.
containsKey
(
SEQUENCE_NBR
)
&&
ObjectUtils
.
isNotEmpty
(
parseObject
.
get
(
SEQUENCE_NBR
)))
{
if
(
parseObject
.
containsKey
(
"sequenceNbr"
)
&&
ObjectUtils
.
isNotEmpty
(
parseObject
.
get
(
"sequenceNbr"
))
&&
registrationIdList
.
add
(
MapUtils
.
getLongValue
(
parseObject
,
SEQUENCE_NBR
));
canConvertToLong
(
parseObject
.
get
(
"sequenceNbr"
).
toString
()))
{
projectContraptionIdList
.
add
(
MapUtils
.
getString
(
parseObject
,
SEQUENCE_NBR
));
registrationIdList
.
add
(
Long
.
parseLong
(
parseObject
.
get
(
"sequenceNbr"
).
toString
()));
projectContraptionIdList
.
add
(
parseObject
.
get
(
"sequenceNbr"
).
toString
());
}
}
}
}
if
(
CollectionUtils
.
isEmpty
(
registrationIdList
))
{
return
;
}
List
<
String
>
records
=
new
ArrayList
<>();
List
<
String
>
records
=
new
ArrayList
<>();
String
equListCode
=
JSON
.
parseObject
(
registrationList
.
get
(
0
).
toString
()).
getString
(
"equList"
);
JSONObject
firstObj
=
registrationList
.
stream
()
.
findFirst
()
.
map
(
Object:
:
toString
)
.
map
(
JSON:
:
parseObject
)
.
orElse
(
new
JSONObject
());
String
equListCode
=
Optional
.
ofNullable
(
firstObj
.
getString
(
"equList"
))
.
filter
(
ObjectUtils:
:
isNotEmpty
)
.
orElse
(
null
);
String
equCategoryCode
=
Optional
.
ofNullable
(
firstObj
.
getString
(
"equCategory"
))
.
filter
(
ObjectUtils:
:
isNotEmpty
)
.
orElse
(
null
);
if
(
PipelineEnum
.
PRESSURE_PIPELINE
.
getCode
().
equals
(
equListCode
))
{
if
(
PipelineEnum
.
PRESSURE_PIPELINE
.
getCode
().
equals
(
equListCode
))
{
JgChangeRegistrationUnit
registrationUnit
=
this
.
lambdaQuery
().
eq
(
JgChangeRegistrationUnit:
:
getApplyNo
,
applyNo
)
JgChangeRegistrationUnit
registrationUnit
=
this
.
lambdaQuery
().
eq
(
JgChangeRegistrationUnit:
:
getApplyNo
,
applyNo
)
.
eq
(
JgChangeRegistrationUnit:
:
getIsDelete
,
false
)
.
eq
(
JgChangeRegistrationUnit:
:
getIsDelete
,
false
)
...
@@ -2211,6 +2795,14 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
...
@@ -2211,6 +2795,14 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
changeRegistrationUnitEqs
.
forEach
(
item
->
records
.
add
(
item
.
getEquId
()));
changeRegistrationUnitEqs
.
forEach
(
item
->
records
.
add
(
item
.
getEquId
()));
}
}
}
}
}
else
if
(
CylinderTypeEnum
.
CYLINDER
.
getCode
().
equals
(
equCategoryCode
))
{
records
.
addAll
(
registrationList
.
stream
()
.
map
(
Object:
:
toString
)
.
map
(
JSON:
:
parseObject
)
.
map
(
obj
->
obj
.
getString
(
"sequenceNbr"
))
.
filter
(
ObjectUtils:
:
isNotEmpty
)
.
collect
(
Collectors
.
toList
())
);
}
else
{
}
else
{
List
<
JSONObject
>
equList
=
registrationManageService
.
queryEquByCertificateSeqList
(
registrationIdList
);
List
<
JSONObject
>
equList
=
registrationManageService
.
queryEquByCertificateSeqList
(
registrationIdList
);
// 获取单位变更设备列表
// 获取单位变更设备列表
...
...
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