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
c0317601
Commit
c0317601
authored
Sep 22, 2025
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(jg):已纳管管道编辑bug处理
parent
70a2fb63
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
387 additions
and
341 deletions
+387
-341
NewProjectEditUpdateService.java
...t/process/biz/newProject/NewProjectEditUpdateService.java
+4
-1
CommonEquipDataProcessService.java
...biz/edit/process/equip/CommonEquipDataProcessService.java
+4
-1
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+8
-0
JgChangeRegistrationUnitServiceImpl.java
...biz/service/impl/JgChangeRegistrationUnitServiceImpl.java
+371
-339
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/process/biz/newProject/NewProjectEditUpdateService.java
View file @
c0317601
...
...
@@ -31,7 +31,10 @@ public class NewProjectEditUpdateService {
public
void
updateBizInfo
(
String
projectContraptionId
)
{
IdxBizJgProjectContraption
projectContraption
=
commonEquipDataProcessService
.
getIdxBizJgProjectContraptionServiceImpl
().
getOne
(
new
LambdaQueryWrapper
<
IdxBizJgProjectContraption
>().
eq
(
BaseEntity:
:
getSequenceNbr
,
projectContraptionId
).
select
(
BaseEntity:
:
getSequenceNbr
,
IdxBizJgProjectContraption:
:
getUseRegistrationCode
));
// 按照装置id查询装置下管道,更新为已纳管状态写入使用登记证编号
List
<
IdxBizJgUseInfo
>
useInfos
=
useInfoService
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgUseInfo
>().
eq
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
projectContraptionId
).
eq
(
IdxBizJgUseInfo:
:
getIsIntoManagement
,
false
).
select
(
IdxBizJgUseInfo:
:
getRecord
,
TzsBaseEntity:
:
getSequenceNbr
));
List
<
IdxBizJgUseInfo
>
useInfos
=
useInfoService
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgUseInfo
>()
.
eq
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
projectContraptionId
)
//.eq(IdxBizJgUseInfo::getIsIntoManagement, false)修改已纳管管道编辑使用登记证号,不更新bug
.
select
(
IdxBizJgUseInfo:
:
getRecord
,
TzsBaseEntity:
:
getSequenceNbr
));
useInfos
.
parallelStream
().
forEach
(
e
->
{
commonEquipDataProcessService
.
setNewPipelineUseState
(
e
,
projectContraption
.
getUseRegistrationCode
());
commonEquipDataProcessService
.
updateUseOrgCode2NewPipeline
(
e
,
projectContraption
.
getUseRegistrationCode
());
...
...
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/CommonEquipDataProcessService.java
View file @
c0317601
...
...
@@ -1137,7 +1137,10 @@ public class CommonEquipDataProcessService {
}
public
void
updatePipeline2InUse
(
String
projectContraptionId
,
String
useRegistrationCode
)
{
List
<
IdxBizJgUseInfo
>
useInfos
=
idxBizJgUseInfoService
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgUseInfo
>().
eq
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
projectContraptionId
).
eq
(
IdxBizJgUseInfo:
:
getIsIntoManagement
,
false
).
select
(
TzsBaseEntity:
:
getSequenceNbr
,
IdxBizJgUseInfo:
:
getRecord
));
List
<
IdxBizJgUseInfo
>
useInfos
=
idxBizJgUseInfoService
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgUseInfo
>()
.
eq
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
projectContraptionId
)
.
eq
(
IdxBizJgUseInfo:
:
getIsIntoManagement
,
false
)
.
select
(
TzsBaseEntity:
:
getSequenceNbr
,
IdxBizJgUseInfo:
:
getRecord
));
useInfos
.
parallelStream
().
forEach
(
e
->
{
this
.
setNewPipelineUseState
(
e
,
useRegistrationCode
);
this
.
updateUseOrgCode2NewPipeline
(
e
,
useRegistrationCode
);
...
...
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/IdxBizJgRegisterInfoServiceImpl.java
View file @
c0317601
...
...
@@ -206,6 +206,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private
static
final
Map
<
String
,
String
>
regionCodeOrgCodeMap
=
new
ConcurrentHashMap
<>();
public
static
final
String
CAR_NUMBER
=
"CAR_NUMBER"
;
public
static
final
String
USE_UNIT_NAME
=
"USE_UNIT_NAME"
;
private
static
final
String
PRODUCT_NAME
=
"PRODUCT_NAME"
;
// 需要转化成jsonObject的附件字段
public
static
String
[]
jsonFields
=
{
"insOtherAccessories"
,
"installContractAttachment"
,
"installProxyStatementAttachment"
};
private
final
List
<
String
>
resultError
=
new
ArrayList
<>();
...
...
@@ -2746,6 +2747,13 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
pBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"USE_PLACE"
,
"*"
+
param
+
"*"
));
boolMust
.
must
(
pBuilder
);
}
// 设备名称
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
PRODUCT_NAME
)))
{
BoolQueryBuilder
elcBuilder
=
QueryBuilders
.
boolQuery
();
String
test
=
QueryParser
.
escape
(
map
.
getString
(
PRODUCT_NAME
));
elcBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
PRODUCT_NAME
,
test
));
boolMust
.
must
(
elcBuilder
);
}
// 设备状态
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"EQU_STATE"
)))
{
BoolQueryBuilder
esBuilder
=
QueryBuilders
.
boolQuery
();
...
...
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 @
c0317601
...
...
@@ -25,7 +25,9 @@ import com.yeejoin.amos.boot.module.jg.api.enums.*;
import
com.yeejoin.amos.boot.module.jg.api.mapper.*
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationUnitService
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
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.event.publisher.EventPublisher
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient
;
...
...
@@ -327,175 +329,187 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
*/
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
public
JgChangeRegistrationUnitDto
updateInstallationNotice
(
String
submitType
,
JgChangeRegistrationUnitDto
noticeDto
,
String
op
,
ReginParams
reginParams
)
{
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
}
if
(
PipelineEnum
.
PRESSURE_PIPELINE
.
getCode
().
equals
(
noticeDto
.
getEquListCode
()))
{
dealProjectContraptionToUpdate
(
submitType
,
noticeDto
,
op
,
reginParams
);
}
else
{
// 字段转换
this
.
convertField
(
noticeDto
);
// 获取单位变更使用登记证列表
List
<
Map
<
String
,
Object
>>
registrationList
=
noticeDto
.
getRegistrationList
();
if
(
CollectionUtils
.
isEmpty
(
registrationList
))
{
throw
new
BadRequest
(
"使用登记证不能为空"
);
}
//根据使用登记证查询设备
List
<
Long
>
registrationIdList
=
registrationList
.
stream
().
filter
(
v
->
v
.
containsKey
(
"sequenceNbr"
)
&&
ObjectUtils
.
isNotEmpty
(
v
.
get
(
"sequenceNbr"
))
&&
canConvertToLong
(
v
.
get
(
"sequenceNbr"
).
toString
()))
.
map
(
v
->
Long
.
parseLong
(
v
.
get
(
"sequenceNbr"
).
toString
())).
collect
(
Collectors
.
toList
());
// 获取单位变更设备列表
if
(
CollectionUtils
.
isEmpty
(
registrationIdList
))
{
throw
new
BadRequest
(
"使用登记证不能为空"
);
}
List
<
JSONObject
>
deviceList
=
registrationManageService
.
queryEquByCertificateSeqList
(
registrationIdList
);
// 获取单位变更设备列表
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"使用登记证下无设备"
);
}
//场车区分区外还是区内
if
(
EQU_CODE_CC
.
equals
(
noticeDto
.
getEquListCode
()))
{
String
city
=
Objects
.
toString
(
noticeDto
.
getCity
(),
""
);
String
userCity
=
Optional
.
ofNullable
(
city
).
map
(
c
->
c
.
split
(
"_"
)[
0
]).
orElseThrow
(()
->
new
BadRequest
(
"请选择地市后暂存!"
));
this
.
validateDeviceCity
(
deviceList
,
userCity
,
"0"
.
equals
(
noticeDto
.
getChangeType
()));
this
.
setEquAddress
(
noticeDto
);
try
{
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
}
ArrayList
<
String
>
roleListAll
=
new
ArrayList
<>();
ArrayList
<
String
>
roleListNext
=
new
ArrayList
<>();
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 发起流程
if
(!
StringUtils
.
hasText
(
noticeDto
.
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
(
noticeDto
.
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
(
noticeDto
,
notice
);
notice
.
setChangeCertificate
(
noticeDto
.
getChangeCertificate
());
notice
.
setRemark
(
noticeDto
.
getRemark
());
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
roleListAll
);
if
(
PipelineEnum
.
PRESSURE_PIPELINE
.
getCode
().
equals
(
noticeDto
.
getEquListCode
()))
{
dealProjectContraptionToUpdate
(
submitType
,
noticeDto
,
op
,
reginParams
);
}
else
{
// 字段转换
this
.
convertField
(
noticeDto
);
// 获取单位变更使用登记证列表
List
<
Map
<
String
,
Object
>>
registrationList
=
noticeDto
.
getRegistrationList
();
if
(
CollectionUtils
.
isEmpty
(
registrationList
))
{
throw
new
BadRequest
(
"使用登记证不能为空"
);
}
//根据使用登记证查询设备
List
<
Long
>
registrationIdList
=
registrationList
.
stream
().
filter
(
v
->
v
.
containsKey
(
"sequenceNbr"
)
&&
ObjectUtils
.
isNotEmpty
(
v
.
get
(
"sequenceNbr"
))
&&
canConvertToLong
(
v
.
get
(
"sequenceNbr"
).
toString
()))
.
map
(
v
->
Long
.
parseLong
(
v
.
get
(
"sequenceNbr"
).
toString
())).
collect
(
Collectors
.
toList
());
// 获取单位变更设备列表
if
(
CollectionUtils
.
isEmpty
(
registrationIdList
))
{
throw
new
BadRequest
(
"使用登记证不能为空"
);
}
List
<
JSONObject
>
deviceList
=
registrationManageService
.
queryEquByCertificateSeqList
(
registrationIdList
);
// 获取单位变更设备列表
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"使用登记证下无设备"
);
}
//场车区分区外还是区内
if
(
EQU_CODE_CC
.
equals
(
noticeDto
.
getEquListCode
()))
{
String
city
=
Objects
.
toString
(
noticeDto
.
getCity
(),
""
);
String
userCity
=
Optional
.
ofNullable
(
city
).
map
(
c
->
c
.
split
(
"_"
)[
0
]).
orElseThrow
(()
->
new
BadRequest
(
"请选择地市后暂存!"
));
this
.
validateDeviceCity
(
deviceList
,
userCity
,
"0"
.
equals
(
noticeDto
.
getChangeType
()));
this
.
setEquAddress
(
noticeDto
);
}
ArrayList
<
String
>
roleListAll
=
new
ArrayList
<>();
ArrayList
<
String
>
roleListNext
=
new
ArrayList
<>();
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 发起流程
if
(!
StringUtils
.
hasText
(
noticeDto
.
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
(
noticeDto
.
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
(
noticeDto
,
notice
);
notice
.
setChangeCertificate
(
noticeDto
.
getChangeCertificate
());
notice
.
setRemark
(
noticeDto
.
getRemark
());
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
roleListAll
);
}
else
{
notice
.
setInstanceStatus
(
String
.
join
(
","
,
roleListAll
));
}
notice
.
setInstanceId
(
instanceId
);
notice
.
setNextTaskId
(
nextTaskId
);
notice
.
setSupervisoryCode
(
noticeDto
.
getSupervisoryCode
());
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
{
notice
.
setInstanceStatus
(
String
.
join
(
","
,
roleListAll
));
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
String
taskId
=
noticeDto
.
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
(
noticeDto
.
getInstanceStatus
())
&&
(
noticeDto
.
getStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getReject
())
||
noticeDto
.
getStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getRollBack
())))
{
map
.
put
(
"approvalStatus"
,
"提交"
);
}
task
.
setVariable
(
map
);
//执行流程
task
.
setNextExecuteUserCompanyCode
(
noticeDto
.
getReceiveCompanyCode
());
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
completeOrReject
(
taskId
,
task
,
op
);
JgChangeRegistrationUnit
bean
=
new
JgChangeRegistrationUnit
();
BeanUtils
.
copyProperties
(
noticeDto
,
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
().
size
()
>
0
)
{
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
));
}
notice
.
setInstanceId
(
instanceId
);
notice
.
setNextTaskId
(
nextTaskId
);
notice
.
setSupervisoryCode
(
noticeDto
.
getSupervisoryCode
());
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
=
noticeDto
.
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
(
noticeDto
.
getInstanceStatus
())
&&
(
noticeDto
.
getStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getReject
())
||
noticeDto
.
getStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getRollBack
())))
{
map
.
put
(
"approvalStatus"
,
"提交"
);
}
task
.
setVariable
(
map
);
//执行流程
task
.
setNextExecuteUserCompanyCode
(
noticeDto
.
getReceiveCompanyCode
());
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
completeOrReject
(
taskId
,
task
,
op
);
JgChangeRegistrationUnit
bean
=
new
JgChangeRegistrationUnit
();
BeanUtils
.
copyProperties
(
noticeDto
,
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
().
size
()
>
0
)
{
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
(
noticeDto
,
bean
);
setNewUnitInfo
(
reginParams
,
bean
);
JgChangeRegistrationUnitMapper
.
updateById
(
bean
);
}
List
<
JgChangeRegistrationUnitEq
>
jgRelationEquipList
=
new
ArrayList
<>();
deviceList
.
forEach
(
device
->
{
JgChangeRegistrationUnitEq
unitEq
=
new
JgChangeRegistrationUnitEq
();
if
(
device
.
containsKey
(
"USE_ORG_CODE"
))
{
unitEq
.
setRegistrationCertificate
(
device
.
getString
(
"USE_ORG_CODE"
));
//使用登记证主键
}
if
(
device
.
containsKey
(
"SEQUENCE_NBR"
))
{
unitEq
.
setEquId
(
device
.
getString
(
"SEQUENCE_NBR"
));
//设备主键
List
<
JgChangeRegistrationUnitEq
>
jgRelationEquipList
=
new
ArrayList
<>();
deviceList
.
forEach
(
device
->
{
JgChangeRegistrationUnitEq
unitEq
=
new
JgChangeRegistrationUnitEq
();
if
(
device
.
containsKey
(
"USE_ORG_CODE"
))
{
unitEq
.
setRegistrationCertificate
(
device
.
getString
(
"USE_ORG_CODE"
));
//使用登记证主键
}
if
(
device
.
containsKey
(
"SEQUENCE_NBR"
))
{
unitEq
.
setEquId
(
device
.
getString
(
"SEQUENCE_NBR"
));
//设备主键
}
unitEq
.
setUnitChangeRegistrationId
(
noticeDto
.
getSequenceNbr
().
toString
());
//单位变更业务主键
unitEq
.
setDeviceInfo
(
JSONObject
.
toJSONString
(
device
));
//设备信息json
jgRelationEquipList
.
add
(
unitEq
);
});
JgRegistrationHistory
jgRegistrationHistory
=
new
JgRegistrationHistory
();
//登记类别
jgRegistrationHistory
.
setRegistrationClass
(
"单位变更登记"
);
jgRegistrationHistory
.
setCurrentDocumentId
(
noticeDto
.
getApplyNo
());
//使用登记证历史数据
jgRegistrationHistory
.
setChangeData
(
JSONObject
.
toJSONString
(
registrationList
));
//先删除之前设备关系数据,在插入最新设备关系数据
registrationUnitEqService
.
getBaseMapper
().
delete
(
new
LambdaQueryWrapper
<
JgChangeRegistrationUnitEq
>()
.
eq
(
JgChangeRegistrationUnitEq:
:
getUnitChangeRegistrationId
,
noticeDto
.
getSequenceNbr
()));
registrationUnitEqService
.
saveBatch
(
jgRelationEquipList
);
//先删除之前未提交的历史使用登记证信息,在插入最新的使用登记证信息
registrationHistoryService
.
getBaseMapper
().
delete
(
new
LambdaQueryWrapper
<
JgRegistrationHistory
>()
.
eq
(
JgRegistrationHistory:
:
getCurrentDocumentId
,
noticeDto
.
getApplyNo
()));
registrationHistoryService
.
save
(
jgRegistrationHistory
);
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
//如果是提交,用于校验设备是否已经在流程中,如果不在标记设备已经在流程中
CompanyBo
company
=
reginParams
.
getCompany
();
deviceList
.
forEach
(
jsonObject
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
equipRepeatUsedCheck
(
String
.
valueOf
(
jsonObject
.
get
(
"SEQUENCE_NBR"
)),
CompanyTypeEnum
.
INDIVIDUAL
.
getName
().
equals
(
company
.
getCompanyType
())
?
company
.
getCompanyCode
().
split
(
"_"
)[
1
]
:
company
.
getCompanyCode
()));
}
unitEq
.
setUnitChangeRegistrationId
(
noticeDto
.
getSequenceNbr
().
toString
());
//单位变更业务主键
unitEq
.
setDeviceInfo
(
JSONObject
.
toJSONString
(
device
));
//设备信息json
jgRelationEquipList
.
add
(
unitEq
);
});
JgRegistrationHistory
jgRegistrationHistory
=
new
JgRegistrationHistory
();
//登记类别
jgRegistrationHistory
.
setRegistrationClass
(
"单位变更登记"
);
jgRegistrationHistory
.
setCurrentDocumentId
(
noticeDto
.
getApplyNo
());
//使用登记证历史数据
jgRegistrationHistory
.
setChangeData
(
JSONObject
.
toJSONString
(
registrationList
));
//先删除之前设备关系数据,在插入最新设备关系数据
registrationUnitEqService
.
getBaseMapper
().
delete
(
new
LambdaQueryWrapper
<
JgChangeRegistrationUnitEq
>()
.
eq
(
JgChangeRegistrationUnitEq:
:
getUnitChangeRegistrationId
,
noticeDto
.
getSequenceNbr
()));
registrationUnitEqService
.
saveBatch
(
jgRelationEquipList
);
//先删除之前未提交的历史使用登记证信息,在插入最新的使用登记证信息
registrationHistoryService
.
getBaseMapper
().
delete
(
new
LambdaQueryWrapper
<
JgRegistrationHistory
>()
.
eq
(
JgRegistrationHistory:
:
getCurrentDocumentId
,
noticeDto
.
getApplyNo
()));
registrationHistoryService
.
save
(
jgRegistrationHistory
);
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
//如果是提交,用于校验设备是否已经在流程中,如果不在标记设备已经在流程中
CompanyBo
company
=
reginParams
.
getCompany
();
deviceList
.
forEach
(
jsonObject
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
equipRepeatUsedCheck
(
String
.
valueOf
(
jsonObject
.
get
(
"SEQUENCE_NBR"
)),
CompanyTypeEnum
.
INDIVIDUAL
.
getName
().
equals
(
company
.
getCompanyType
())
?
company
.
getCompanyCode
().
split
(
"_"
)[
1
]
:
company
.
getCompanyCode
()));
}
return
noticeDto
;
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
e
;
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
new
BadRequest
(
e
.
getMessage
());
}
finally
{
FlowingEquipRedisContext
.
clean
();
}
return
noticeDto
;
}
/**
...
...
@@ -802,199 +816,217 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
@Override
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
JgChangeRegistrationUnitDto
>
saveNotice
(
String
submitType
,
JSONObject
map
,
ReginParams
reginParams
)
{
JgChangeRegistrationUnitDto
model
=
BeanUtil
.
toBeanIgnoreError
(
map
.
get
(
"changeRegisInfo"
),
JgChangeRegistrationUnitDto
.
class
);
Map
<
String
,
Object
>
tableData
=
(
Map
<
String
,
Object
>)
map
.
get
(
"changeRegisInfo"
);
String
[]
taskName
=
new
String
[]{
"流程结束"
};
// 字段转换
convertField
(
model
);
// 获取单位变更使用登记证列表
List
<
Map
<
String
,
Object
>>
registrationList
=
model
.
getRegistrationList
();
if
(
CollectionUtils
.
isEmpty
(
registrationList
))
{
throw
new
BadRequest
(
"使用登记证不能为空"
);
}
//根据使用登记证查询设备
List
<
Long
>
registrationIdList
=
new
ArrayList
<>();
//使用登记证id
List
<
String
>
registrationNoList
=
new
ArrayList
<>();
//使用登记证编号
for
(
Map
<
String
,
Object
>
objectMap
:
registrationList
)
{
if
(
objectMap
.
containsKey
(
"sequenceNbr"
)
&&
ObjectUtils
.
isNotEmpty
(
objectMap
.
get
(
"sequenceNbr"
))
&&
canConvertToLong
(
objectMap
.
get
(
"sequenceNbr"
).
toString
()))
{
registrationIdList
.
add
(
Long
.
parseLong
(
objectMap
.
get
(
"sequenceNbr"
).
toString
()));
try
{
JgChangeRegistrationUnitDto
model
=
BeanUtil
.
toBeanIgnoreError
(
map
.
get
(
"changeRegisInfo"
),
JgChangeRegistrationUnitDto
.
class
);
Map
<
String
,
Object
>
tableData
=
(
Map
<
String
,
Object
>)
map
.
get
(
"changeRegisInfo"
);
String
[]
taskName
=
new
String
[]{
"流程结束"
};
// 字段转换
convertField
(
model
);
// 获取单位变更使用登记证列表
List
<
Map
<
String
,
Object
>>
registrationList
=
model
.
getRegistrationList
();
if
(
CollectionUtils
.
isEmpty
(
registrationList
))
{
throw
new
BadRequest
(
"使用登记证不能为空"
);
}
if
(
objectMap
.
containsKey
(
"useRegistrationCode"
)
&&
ObjectUtils
.
isNotEmpty
(
objectMap
.
get
(
"useRegistrationCode"
)))
{
registrationNoList
.
add
(
objectMap
.
get
(
"useRegistrationCode"
).
toString
());
//根据使用登记证查询设备
List
<
Long
>
registrationIdList
=
new
ArrayList
<>();
//使用登记证id
List
<
String
>
registrationNoList
=
new
ArrayList
<>();
//使用登记证编号
for
(
Map
<
String
,
Object
>
objectMap
:
registrationList
)
{
if
(
objectMap
.
containsKey
(
"sequenceNbr"
)
&&
ObjectUtils
.
isNotEmpty
(
objectMap
.
get
(
"sequenceNbr"
))
&&
canConvertToLong
(
objectMap
.
get
(
"sequenceNbr"
).
toString
()))
{
registrationIdList
.
add
(
Long
.
parseLong
(
objectMap
.
get
(
"sequenceNbr"
).
toString
()));
}
if
(
objectMap
.
containsKey
(
"useRegistrationCode"
)
&&
ObjectUtils
.
isNotEmpty
(
objectMap
.
get
(
"useRegistrationCode"
)))
{
registrationNoList
.
add
(
objectMap
.
get
(
"useRegistrationCode"
).
toString
());
}
}
if
(
CollectionUtils
.
isEmpty
(
registrationIdList
))
{
throw
new
BadRequest
(
"使用登记证不能为空"
);
}
}
if
(
CollectionUtils
.
isEmpty
(
registrationIdList
))
{
throw
new
BadRequest
(
"使用登记证不能为空"
);
}
List
<
JSONObject
>
deviceList
=
registrationManageService
.
queryEquByCertificateSeqList
(
registrationIdList
);
// 获取单位变更设备列表
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"使用登记证下无设备"
);
}
//场车区分区外还是区内
if
(
EQU_CODE_CC
.
equals
(
model
.
getEquListCode
()))
{
String
city
=
Objects
.
toString
(
tableData
.
get
(
"city"
),
""
);
String
userCity
=
Optional
.
ofNullable
(
city
).
map
(
c
->
c
.
split
(
"_"
)[
0
]).
orElseThrow
(()
->
new
BadRequest
(
"请选择地市后暂存!"
));
this
.
validateDeviceCity
(
deviceList
,
userCity
,
"0"
.
equals
(
model
.
getChangeType
()));
this
.
setEquAddress
(
model
);
}
List
<
JSONObject
>
deviceList
=
registrationManageService
.
queryEquByCertificateSeqList
(
registrationIdList
);
// 获取单位变更单号
ResponseModel
<
List
<
String
>>
listResponseModel
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
DWBG
.
getCode
(),
1
);
List
<
String
>
applyNoList
=
listResponseModel
.
getResult
();
if
(
CollectionUtils
.
isEmpty
(
applyNoList
))
{
log
.
error
(
"生成申请变更单位编码失败"
);
return
new
ArrayList
<>();
}
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
//放在最后面防止前面有异常
//如果是提交,用于校验设备是否已经在流程中,如果不在标记设备已经在流程中
CompanyBo
company
=
reginParams
.
getCompany
();
deviceList
.
forEach
(
jsonObject
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
equipRepeatUsedCheck
(
String
.
valueOf
(
jsonObject
.
get
(
"SEQUENCE_NBR"
)),
CompanyTypeEnum
.
INDIVIDUAL
.
getName
().
equals
(
company
.
getCompanyType
())
?
company
.
getCompanyCode
().
split
(
"_"
)[
1
]
:
company
.
getCompanyCode
()));
}
ArrayList
<
String
>
roleListFirst
=
new
ArrayList
<>();
List
<
String
>
instanceIdList
=
new
ArrayList
<>();
List
<
String
>
nextExecutorUserIds
=
new
ArrayList
<>();
List
<
String
>
taskIds
=
new
ArrayList
<>();
List
<
WorkflowResultDto
>
workflowResultDtos
=
new
ArrayList
<>();
String
nextExecutorRoleIds
=
""
;
// 判断当前是否为提交
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
//发起流程
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
.
setNextExecuteUserCompanyCode
(
model
.
getReceiveCompanyCode
());
dto
.
setCompleteFirstTask
(
true
);
list
.
add
(
dto
);
actWorkflowBatchDTO
.
setProcess
(
list
);
List
<
ProcessTaskDTO
>
processTaskDTOS
=
cmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
);
workflowResultDtos
=
commonServiceImpl
.
buildWorkFlowInfo
(
processTaskDTOS
);
nextExecutorRoleIds
=
workflowResultDtos
.
get
(
0
).
getNextExecutorRoleIds
();
nextExecutorUserIds
.
add
(
workflowResultDtos
.
get
(
0
).
getNextExecutorUserIds
());
for
(
WorkflowResultDto
processTaskDTO
:
workflowResultDtos
)
{
instanceIdList
.
add
(
processTaskDTO
.
getInstanceId
());
taskIds
.
add
(
processTaskDTO
.
getNextTaskId
());
// 获取单位变更设备列表
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"使用登记证下无设备"
);
}
//场车区分区外还是区内
if
(
EQU_CODE_CC
.
equals
(
model
.
getEquListCode
()))
{
String
city
=
Objects
.
toString
(
tableData
.
get
(
"city"
),
""
);
String
userCity
=
Optional
.
ofNullable
(
city
).
map
(
c
->
c
.
split
(
"_"
)[
0
]).
orElseThrow
(()
->
new
BadRequest
(
"请选择地市后暂存!"
));
this
.
validateDeviceCity
(
deviceList
,
userCity
,
"0"
.
equals
(
model
.
getChangeType
()));
this
.
setEquAddress
(
model
);
}
}
String
finalNextExecutorRoleIds
=
nextExecutorRoleIds
;
CompanyBo
companyBo
=
commonServiceImpl
.
getOneCompany
(
model
.
getReceiveCompanyCode
());
model
.
setApplyNo
(
applyNoList
.
get
(
0
));
model
.
setReceiveCompanyOrgCode
(
companyBo
.
getOrgCode
());
model
.
setCreateUserId
(
RequestContext
.
getExeUserId
());
model
.
setApplyDate
(
new
Date
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
model
.
setNextExecutorIds
(
finalNextExecutorRoleIds
);
model
.
setInstanceStatus
(
String
.
join
(
","
,
roleListFirst
));
model
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
model
.
setStatus
(
taskName
[
0
]);
}
if
(!
CollectionUtils
.
isEmpty
(
nextExecutorUserIds
))
{
model
.
setNextExecuteUserIds
(
nextExecutorUserIds
.
get
(
0
));
}
if
(!
CollectionUtils
.
isEmpty
(
instanceIdList
))
{
model
.
setInstanceId
(
instanceIdList
.
get
(
0
));
model
.
setStatus
(
WorkFlowStatusEnum
.
UNITCHANGE_RECEIVE
.
getPass
());
}
else
{
model
.
setStatus
(
WorkFlowStatusEnum
.
UNITCHANGE_SUBMIT
.
getPass
());
}
if
(!
CollectionUtils
.
isEmpty
(
taskIds
))
{
model
.
setNextTaskId
(
taskIds
.
get
(
0
));
}
model
.
setSequenceNbr
(
sequence
.
nextId
());
model
.
setCreateDate
(
new
Date
());
model
.
setCreateUserName
(
reginParams
.
getUserModel
().
getRealName
());
model
.
setUseRegistCode
(
String
.
join
(
","
,
registrationNoList
));
model
.
setEquList
(
registrationList
.
get
(
0
).
get
(
"equList"
).
toString
());
JgChangeRegistrationUnit
registrationUnit
=
new
JgChangeRegistrationUnit
();
BeanUtils
.
copyProperties
(
model
,
registrationUnit
);
setNewUnitInfo
(
reginParams
,
registrationUnit
);
JgChangeRegistrationUnitMapper
.
insert
(
registrationUnit
);
// 获取单位变更单号
ResponseModel
<
List
<
String
>>
listResponseModel
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
DWBG
.
getCode
(),
1
);
List
<
String
>
applyNoList
=
listResponseModel
.
getResult
();
if
(
CollectionUtils
.
isEmpty
(
applyNoList
))
{
log
.
error
(
"生成申请变更单位编码失败"
);
return
new
ArrayList
<>();
}
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
//放在最后面防止前面有异常
//如果是提交,用于校验设备是否已经在流程中,如果不在标记设备已经在流程中
CompanyBo
company
=
reginParams
.
getCompany
();
deviceList
.
forEach
(
jsonObject
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
equipRepeatUsedCheck
(
String
.
valueOf
(
jsonObject
.
get
(
"SEQUENCE_NBR"
)),
CompanyTypeEnum
.
INDIVIDUAL
.
getName
().
equals
(
company
.
getCompanyType
())
?
company
.
getCompanyCode
().
split
(
"_"
)[
1
]
:
company
.
getCompanyCode
()));
}
ArrayList
<
String
>
roleListFirst
=
new
ArrayList
<>();
List
<
String
>
instanceIdList
=
new
ArrayList
<>();
List
<
String
>
nextExecutorUserIds
=
new
ArrayList
<>();
List
<
String
>
taskIds
=
new
ArrayList
<>();
List
<
WorkflowResultDto
>
workflowResultDtos
=
new
ArrayList
<>();
String
nextExecutorRoleIds
=
""
;
// 判断当前是否为提交
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
//发起流程
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
.
setNextExecuteUserCompanyCode
(
model
.
getReceiveCompanyCode
());
dto
.
setCompleteFirstTask
(
true
);
list
.
add
(
dto
);
actWorkflowBatchDTO
.
setProcess
(
list
);
List
<
ProcessTaskDTO
>
processTaskDTOS
=
cmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
);
workflowResultDtos
=
commonServiceImpl
.
buildWorkFlowInfo
(
processTaskDTOS
);
nextExecutorRoleIds
=
workflowResultDtos
.
get
(
0
).
getNextExecutorRoleIds
();
nextExecutorUserIds
.
add
(
workflowResultDtos
.
get
(
0
).
getNextExecutorUserIds
());
for
(
WorkflowResultDto
processTaskDTO
:
workflowResultDtos
)
{
instanceIdList
.
add
(
processTaskDTO
.
getInstanceId
());
taskIds
.
add
(
processTaskDTO
.
getNextTaskId
());
}
}
List
<
TaskModelDto
>
modelDtos
=
new
ArrayList
<>();
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
TaskMessageDto
ta
=
new
TaskMessageDto
();
ta
.
setInstanceId
(
registrationUnit
.
getInstanceId
());
ta
.
setStatus
(
registrationUnit
.
getStatus
());
ta
.
setPromoter
(
registrationUnit
.
getPromoter
());
ta
.
setNextExecuteUserIds
(
registrationUnit
.
getNextExecuteUserIds
());
ta
.
setSequenceNbr
(
registrationUnit
.
getSequenceNbr
());
ta
.
setNextTaskId
(
registrationUnit
.
getNextTaskId
());
taskModelDto
.
setModel
(
ta
);
taskModelDto
.
setFlowCreateDate
(
new
Date
());
taskModelDto
.
setTaskName
(
workflowResultDtos
.
get
(
0
).
getNextTaskName
());
taskModelDto
.
setFlowCode
(
registrationUnit
.
getNextTaskId
());
taskModelDto
.
setTaskContent
(
this
.
buildTaskContent
(
registrationUnit
));
taskModelDto
.
setTaskCode
(
registrationUnit
.
getApplyNo
());
taskModelDto
.
setTaskType
(
BusinessTypeEnum
.
JG_COMPANY_CHANGE_REGISTRATION
.
getCode
());
taskModelDto
.
setTaskTypeLabel
(
BusinessTypeEnum
.
JG_COMPANY_CHANGE_REGISTRATION
.
getName
());
taskModelDto
.
setRelationId
(
registrationUnit
.
getInstanceId
());
taskModelDto
.
setExecuteUserIds
(
workflowResultDtos
.
get
(
0
).
getNextExecutorUserIds
());
taskModelDto
.
setTaskStatusLabel
(
"未处理"
);
taskModelDto
.
setFlowStatus
(
commonServiceImpl
.
getDictionaryCodeByName
(
WorkFlowStatusEnum
.
UNITCHANGE_RECEIVE
.
getPass
()));
taskModelDto
.
setFlowStatusLabel
(
WorkFlowStatusEnum
.
UNITCHANGE_RECEIVE
.
getPass
());
taskModelDto
.
setStartUserId
(
RequestContext
.
getExeUserId
());
taskModelDto
.
setStartUser
(
workflowResultDtos
.
get
(
0
).
getStartUserName
());
taskModelDto
.
setStartUserCompanyName
(
reginParams
.
getCompany
().
getCompanyName
());
taskModelDto
.
setStartDate
(
new
Date
());
taskModelDto
.
setNextExecuteUser
(
workflowResultDtos
.
get
(
0
).
getNextExecutorRoleIds
());
modelDtos
.
add
(
taskModelDto
);
}
else
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
//行数据
taskModelDto
.
setModel
(
registrationUnit
);
//摘要 按原有规则组装
taskModelDto
.
setTaskContent
(
this
.
buildTaskContent
(
registrationUnit
));
//申请单号
taskModelDto
.
setTaskCode
(
registrationUnit
.
getApplyNo
());
//业务类型枚举code值
taskModelDto
.
setTaskType
(
BusinessTypeEnum
.
JG_COMPANY_CHANGE_REGISTRATION
.
getCode
());
////业务主键
taskModelDto
.
setRelationId
(
registrationUnit
.
getSequenceNbr
()
+
""
);
modelDtos
.
add
(
taskModelDto
);
String
finalNextExecutorRoleIds
=
nextExecutorRoleIds
;
CompanyBo
companyBo
=
commonServiceImpl
.
getOneCompany
(
model
.
getReceiveCompanyCode
());
model
.
setApplyNo
(
applyNoList
.
get
(
0
));
model
.
setReceiveCompanyOrgCode
(
companyBo
.
getOrgCode
());
model
.
setCreateUserId
(
RequestContext
.
getExeUserId
());
model
.
setApplyDate
(
new
Date
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
model
.
setNextExecutorIds
(
finalNextExecutorRoleIds
);
model
.
setInstanceStatus
(
String
.
join
(
","
,
roleListFirst
));
model
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
model
.
setStatus
(
taskName
[
0
]);
}
if
(!
CollectionUtils
.
isEmpty
(
nextExecutorUserIds
))
{
model
.
setNextExecuteUserIds
(
nextExecutorUserIds
.
get
(
0
));
}
if
(!
CollectionUtils
.
isEmpty
(
instanceIdList
))
{
model
.
setInstanceId
(
instanceIdList
.
get
(
0
));
model
.
setStatus
(
WorkFlowStatusEnum
.
UNITCHANGE_RECEIVE
.
getPass
());
}
else
{
model
.
setStatus
(
WorkFlowStatusEnum
.
UNITCHANGE_SUBMIT
.
getPass
());
}
if
(!
CollectionUtils
.
isEmpty
(
taskIds
))
{
model
.
setNextTaskId
(
taskIds
.
get
(
0
));
}
model
.
setSequenceNbr
(
sequence
.
nextId
());
model
.
setCreateDate
(
new
Date
());
model
.
setCreateUserName
(
reginParams
.
getUserModel
().
getRealName
());
model
.
setUseRegistCode
(
String
.
join
(
","
,
registrationNoList
));
model
.
setEquList
(
registrationList
.
get
(
0
).
get
(
"equList"
).
toString
());
JgChangeRegistrationUnit
registrationUnit
=
new
JgChangeRegistrationUnit
();
BeanUtils
.
copyProperties
(
model
,
registrationUnit
);
setNewUnitInfo
(
reginParams
,
registrationUnit
);
JgChangeRegistrationUnitMapper
.
insert
(
registrationUnit
);
List
<
TaskModelDto
>
modelDtos
=
new
ArrayList
<>();
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
TaskMessageDto
ta
=
new
TaskMessageDto
();
ta
.
setInstanceId
(
registrationUnit
.
getInstanceId
());
ta
.
setStatus
(
registrationUnit
.
getStatus
());
ta
.
setPromoter
(
registrationUnit
.
getPromoter
());
ta
.
setNextExecuteUserIds
(
registrationUnit
.
getNextExecuteUserIds
());
ta
.
setSequenceNbr
(
registrationUnit
.
getSequenceNbr
());
ta
.
setNextTaskId
(
registrationUnit
.
getNextTaskId
());
taskModelDto
.
setModel
(
ta
);
taskModelDto
.
setFlowCreateDate
(
new
Date
());
taskModelDto
.
setTaskName
(
workflowResultDtos
.
get
(
0
).
getNextTaskName
());
taskModelDto
.
setFlowCode
(
registrationUnit
.
getNextTaskId
());
taskModelDto
.
setTaskContent
(
this
.
buildTaskContent
(
registrationUnit
));
taskModelDto
.
setTaskCode
(
registrationUnit
.
getApplyNo
());
taskModelDto
.
setTaskType
(
BusinessTypeEnum
.
JG_COMPANY_CHANGE_REGISTRATION
.
getCode
());
taskModelDto
.
setTaskTypeLabel
(
BusinessTypeEnum
.
JG_COMPANY_CHANGE_REGISTRATION
.
getName
());
taskModelDto
.
setRelationId
(
registrationUnit
.
getInstanceId
());
taskModelDto
.
setExecuteUserIds
(
workflowResultDtos
.
get
(
0
).
getNextExecutorUserIds
());
taskModelDto
.
setTaskStatusLabel
(
"未处理"
);
taskModelDto
.
setFlowStatus
(
commonServiceImpl
.
getDictionaryCodeByName
(
WorkFlowStatusEnum
.
UNITCHANGE_RECEIVE
.
getPass
()));
taskModelDto
.
setFlowStatusLabel
(
WorkFlowStatusEnum
.
UNITCHANGE_RECEIVE
.
getPass
());
taskModelDto
.
setStartUserId
(
RequestContext
.
getExeUserId
());
taskModelDto
.
setStartUser
(
workflowResultDtos
.
get
(
0
).
getStartUserName
());
taskModelDto
.
setStartUserCompanyName
(
reginParams
.
getCompany
().
getCompanyName
());
taskModelDto
.
setStartDate
(
new
Date
());
taskModelDto
.
setNextExecuteUser
(
workflowResultDtos
.
get
(
0
).
getNextExecutorRoleIds
());
modelDtos
.
add
(
taskModelDto
);
}
else
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
//行数据
taskModelDto
.
setModel
(
registrationUnit
);
//摘要 按原有规则组装
taskModelDto
.
setTaskContent
(
this
.
buildTaskContent
(
registrationUnit
));
//申请单号
taskModelDto
.
setTaskCode
(
registrationUnit
.
getApplyNo
());
//业务类型枚举code值
taskModelDto
.
setTaskType
(
BusinessTypeEnum
.
JG_COMPANY_CHANGE_REGISTRATION
.
getCode
());
////业务主键
taskModelDto
.
setRelationId
(
registrationUnit
.
getSequenceNbr
()
+
""
);
modelDtos
.
add
(
taskModelDto
);
// }
}
commonServiceImpl
.
saveExecuteFlowData2Redis
(
registrationUnit
.
getInstanceId
(),
buildInstanceRuntimeData
(
registrationUnit
));
commonServiceImpl
.
buildTaskModel
(
modelDtos
);
List
<
JgChangeRegistrationUnitEq
>
jgRelationEquipList
=
new
ArrayList
<>();
deviceList
.
forEach
(
device
->
{
JgChangeRegistrationUnitEq
unitEq
=
new
JgChangeRegistrationUnitEq
();
if
(
device
.
containsKey
(
"USE_ORG_CODE"
))
{
unitEq
.
setRegistrationCertificate
(
device
.
getString
(
"USE_ORG_CODE"
));
//使用登记证主键
}
if
(
device
.
containsKey
(
"SEQUENCE_NBR"
))
{
unitEq
.
setEquId
(
device
.
getString
(
"SEQUENCE_NBR"
));
//设备主键
}
unitEq
.
setUnitChangeRegistrationId
(
registrationUnit
.
getSequenceNbr
().
toString
());
//单位变更业务主键
unitEq
.
setDeviceInfo
(
JSONObject
.
toJSONString
(
device
));
//设备信息json
jgRelationEquipList
.
add
(
unitEq
);
});
JgRegistrationHistory
jgRegistrationHistory
=
new
JgRegistrationHistory
();
//登记类别
jgRegistrationHistory
.
setRegistrationClass
(
"单位变更登记"
);
jgRegistrationHistory
.
setCurrentDocumentId
(
registrationUnit
.
getApplyNo
());
//使用登记证历史数据
jgRegistrationHistory
.
setChangeData
(
JSONObject
.
toJSONString
(
registrationList
));
//先删除之前设备关系数据,在插入最新设备关系数据
registrationUnitEqService
.
getBaseMapper
().
delete
(
new
LambdaQueryWrapper
<
JgChangeRegistrationUnitEq
>()
.
eq
(
JgChangeRegistrationUnitEq:
:
getUnitChangeRegistrationId
,
registrationUnit
.
getSequenceNbr
()));
registrationUnitEqService
.
saveBatch
(
jgRelationEquipList
);
//先删除之前未提交的历史使用登记证信息,在插入最新的使用登记证信息
registrationHistoryService
.
getBaseMapper
().
delete
(
new
LambdaQueryWrapper
<
JgRegistrationHistory
>()
.
eq
(
JgRegistrationHistory:
:
getCurrentDocumentId
,
registrationUnit
.
getApplyNo
()));
registrationHistoryService
.
save
(
jgRegistrationHistory
);
return
Collections
.
singletonList
(
model
);
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
e
;
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
new
BadRequest
(
e
.
getMessage
());
}
finally
{
FlowingEquipRedisContext
.
clean
();
}
commonServiceImpl
.
saveExecuteFlowData2Redis
(
registrationUnit
.
getInstanceId
(),
buildInstanceRuntimeData
(
registrationUnit
));
commonServiceImpl
.
buildTaskModel
(
modelDtos
);
}
List
<
JgChangeRegistrationUnitEq
>
jgRelationEquipList
=
new
ArrayList
<>();
deviceList
.
forEach
(
device
->
{
JgChangeRegistrationUnitEq
unitEq
=
new
JgChangeRegistrationUnitEq
();
if
(
device
.
containsKey
(
"USE_ORG_CODE"
))
{
unitEq
.
setRegistrationCertificate
(
device
.
getString
(
"USE_ORG_CODE"
));
//使用登记证主键
}
if
(
device
.
containsKey
(
"SEQUENCE_NBR"
))
{
unitEq
.
setEquId
(
device
.
getString
(
"SEQUENCE_NBR"
));
//设备主键
}
unitEq
.
setUnitChangeRegistrationId
(
registrationUnit
.
getSequenceNbr
().
toString
());
//单位变更业务主键
unitEq
.
setDeviceInfo
(
JSONObject
.
toJSONString
(
device
));
//设备信息json
jgRelationEquipList
.
add
(
unitEq
);
private
void
rollBackForDelRedisData
()
{
FlowingEquipRedisContext
.
getContext
().
forEach
(
e
->
{
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
).
delDataForCheckWithKey
(
e
.
getData
(),
e
.
getRedisKey
());
});
JgRegistrationHistory
jgRegistrationHistory
=
new
JgRegistrationHistory
();
//登记类别
jgRegistrationHistory
.
setRegistrationClass
(
"单位变更登记"
);
jgRegistrationHistory
.
setCurrentDocumentId
(
registrationUnit
.
getApplyNo
());
//使用登记证历史数据
jgRegistrationHistory
.
setChangeData
(
JSONObject
.
toJSONString
(
registrationList
));
//先删除之前设备关系数据,在插入最新设备关系数据
registrationUnitEqService
.
getBaseMapper
().
delete
(
new
LambdaQueryWrapper
<
JgChangeRegistrationUnitEq
>()
.
eq
(
JgChangeRegistrationUnitEq:
:
getUnitChangeRegistrationId
,
registrationUnit
.
getSequenceNbr
()));
registrationUnitEqService
.
saveBatch
(
jgRelationEquipList
);
//先删除之前未提交的历史使用登记证信息,在插入最新的使用登记证信息
registrationHistoryService
.
getBaseMapper
().
delete
(
new
LambdaQueryWrapper
<
JgRegistrationHistory
>()
.
eq
(
JgRegistrationHistory:
:
getCurrentDocumentId
,
registrationUnit
.
getApplyNo
()));
registrationHistoryService
.
save
(
jgRegistrationHistory
);
return
Collections
.
singletonList
(
model
);
}
public
void
setEquAddress
(
JgChangeRegistrationUnitDto
model
)
{
...
...
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