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
acabca76
Commit
acabca76
authored
Jan 17, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.适配工作流错误 去掉try catch
parent
836ddc50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
92 deletions
+79
-92
JgChangeRegistrationNameServiceImpl.java
...biz/service/impl/JgChangeRegistrationNameServiceImpl.java
+79
-92
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgChangeRegistrationNameServiceImpl.java
View file @
acabca76
...
...
@@ -48,7 +48,6 @@ import org.springframework.util.StringUtils;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.*
;
...
...
@@ -143,28 +142,23 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
String
nextUserIds
=
""
;
if
(
"1"
.
equals
(
submitType
))
{
// 发起流程
try
{
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
"unitRename"
);
dto
.
setBusinessKey
(
applyNo
);
dto
.
setCompleteFirstTask
(
true
);
// 启动并执行下一步人单位传接收单位的code
dto
.
setNextExecuteUserCompanyCode
(
this
.
getReceiveCompanyCode
(
model
));
list
.
add
(
dto
);
actWorkflowBatchDTO
.
setProcess
(
list
);
processTasks
=
cmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
);
this
.
buildRoleList
(
processTasks
,
roleListNext
,
roleListAll
);
instanceId
=
processTasks
.
get
(
0
).
getProcessInstance
().
getId
();
nextTaskId
=
processTasks
.
get
(
0
).
getNextTask
().
get
(
0
).
getId
();
taskName
[
0
]
=
processTasks
.
get
(
0
).
getNextTask
().
get
(
0
).
getName
();
List
<
WorkflowResultDto
>
workflowResultDtos
=
commonService
.
buildWorkFlowInfo
(
processTasks
);
nextUserIds
=
workflowResultDtos
.
get
(
0
).
getNextExecutorUserIds
();
}
catch
(
Exception
e
)
{
log
.
error
(
"提交失败:{}"
,
e
);
throw
new
BadRequest
(
"提交失败"
+
e
.
getMessage
());
}
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
"unitRename"
);
dto
.
setBusinessKey
(
applyNo
);
dto
.
setCompleteFirstTask
(
true
);
// 启动并执行下一步人单位传接收单位的code
dto
.
setNextExecuteUserCompanyCode
(
this
.
getReceiveCompanyCode
(
model
));
list
.
add
(
dto
);
actWorkflowBatchDTO
.
setProcess
(
list
);
processTasks
=
cmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
);
this
.
buildRoleList
(
processTasks
,
roleListNext
,
roleListAll
);
instanceId
=
processTasks
.
get
(
0
).
getProcessInstance
().
getId
();
nextTaskId
=
processTasks
.
get
(
0
).
getNextTask
().
get
(
0
).
getId
();
taskName
[
0
]
=
processTasks
.
get
(
0
).
getNextTask
().
get
(
0
).
getName
();
List
<
WorkflowResultDto
>
workflowResultDtos
=
commonService
.
buildWorkFlowInfo
(
processTasks
);
nextUserIds
=
workflowResultDtos
.
get
(
0
).
getNextExecutorUserIds
();
}
JgChangeRegistrationName
dto
=
new
JgChangeRegistrationName
();
// 字段转换
...
...
@@ -219,7 +213,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
// 提交创建待办逻辑
if
(
"1"
.
equals
(
submitType
))
{
//提交时先删除之前的暂存待办数据
commonService
.
deleteTaskModel
(
dto
.
getSequenceNbr
()
+
""
);
commonService
.
deleteTaskModel
(
dto
.
getSequenceNbr
()
+
""
);
// 创建待办
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
taskModelDto
.
setFlowCreateDate
(
dto
.
getApplyDate
());
...
...
@@ -262,7 +256,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
//业务类型枚举code值
taskModelDto
.
setTaskType
(
BusinessTypeEnum
.
JG_NAME_CHANGE_REGISTRATION
.
getCode
());
//业务主键
taskModelDto
.
setRelationId
(
dto
.
getSequenceNbr
()
+
""
);
taskModelDto
.
setRelationId
(
dto
.
getSequenceNbr
()
+
""
);
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
}
}
...
...
@@ -295,37 +289,33 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
if
(
"1"
.
equals
(
submitType
))
{
//发起流程
if
(!
StringUtils
.
hasText
(
jgChangeRegistrationName
.
getInstanceId
()))
{
try
{
List
<
ProcessTaskDTO
>
processTasks
=
new
ArrayList
<>();
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
"unitRename"
);
dto
.
setBusinessKey
(
jgChangeRegistrationName
.
getApplyNo
());
dto
.
setCompleteFirstTask
(
true
);
// 启动并执行下一步人单位传接收单位的code
dto
.
setNextExecuteUserCompanyCode
(
jgChangeRegistrationName
.
getReceiveOrgCode
());
list
.
add
(
dto
);
actWorkflowBatchDTO
.
setProcess
(
list
);
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
=
commonService
.
buildWorkFlowInfo
(
processTasks
);
String
nextUserIds
=
workflowResultDtos
.
get
(
0
).
getNextExecutorUserIds
();
jgChangeRegistrationName
.
setInstanceStatus
(
String
.
join
(
","
,
roleListAll
));
jgChangeRegistrationName
.
setInstanceId
(
instanceId
);
jgChangeRegistrationName
.
setNextExecutorIds
(
String
.
join
(
","
,
roleListNext
));
jgChangeRegistrationName
.
setNextTaskId
(
nextTaskId
);
jgChangeRegistrationName
.
setNextExecuteUserIds
(
nextUserIds
);
jgChangeRegistrationName
.
setAuditStatus
(
WorkFlowStatusEnum
.
UNIT_RENAME_RECEIVE
.
getPass
());
// 创建待办
createTaskModel
(
jgChangeRegistrationName
,
taskName
,
"1"
,
nextUserIds
);
}
catch
(
Exception
e
)
{
log
.
error
(
"提交失败:{}"
,
e
);
throw
new
BadRequest
(
"提交失败"
+
e
.
getMessage
());
}
List
<
ProcessTaskDTO
>
processTasks
=
new
ArrayList
<>();
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
"unitRename"
);
dto
.
setBusinessKey
(
jgChangeRegistrationName
.
getApplyNo
());
dto
.
setCompleteFirstTask
(
true
);
// 启动并执行下一步人单位传接收单位的code
dto
.
setNextExecuteUserCompanyCode
(
jgChangeRegistrationName
.
getReceiveOrgCode
());
list
.
add
(
dto
);
actWorkflowBatchDTO
.
setProcess
(
list
);
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
=
commonService
.
buildWorkFlowInfo
(
processTasks
);
String
nextUserIds
=
workflowResultDtos
.
get
(
0
).
getNextExecutorUserIds
();
jgChangeRegistrationName
.
setInstanceStatus
(
String
.
join
(
","
,
roleListAll
));
jgChangeRegistrationName
.
setInstanceId
(
instanceId
);
jgChangeRegistrationName
.
setNextExecutorIds
(
String
.
join
(
","
,
roleListNext
));
jgChangeRegistrationName
.
setNextTaskId
(
nextTaskId
);
jgChangeRegistrationName
.
setNextExecuteUserIds
(
nextUserIds
);
jgChangeRegistrationName
.
setAuditStatus
(
WorkFlowStatusEnum
.
UNIT_RENAME_RECEIVE
.
getPass
());
// 创建待办
createTaskModel
(
jgChangeRegistrationName
,
taskName
,
"1"
,
nextUserIds
);
}
else
{
// 执行一步
ProcessTaskDTO
processTaskDTO
=
submit
(
op
,
jgChangeRegistrationName
);
...
...
@@ -392,12 +382,12 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
private
String
getPageTypeForReject
(
String
operate
,
String
auditStatus
)
{
// 驳回
if
(
"1"
.
equals
(
operate
))
{
if
(
"1"
.
equals
(
operate
))
{
// 且驳回到的节点为使用单位提交 则可编辑
if
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getPass
().
equals
(
auditStatus
)
||
if
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getPass
().
equals
(
auditStatus
)
||
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getReject
().
equals
(
auditStatus
)
||
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getRollBack
().
equals
(
auditStatus
)
){
)
{
// urlInfo.json 文件的 pageType
return
"edit"
;
}
...
...
@@ -413,7 +403,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
jgChangeRegistrationName
.
getNextTaskId
());
dto
.
setComment
(
"提交流程"
);
dto
.
setNextExecuteUserCompanyCode
(
this
.
getNextUserOrgCode
(
operate
,
jgChangeRegistrationName
));
dto
.
setNextExecuteUserCompanyCode
(
this
.
getNextUserOrgCode
(
operate
,
jgChangeRegistrationName
));
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"approvalStatus"
,
operate
);
dto
.
setVariable
(
map
);
...
...
@@ -476,17 +466,17 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
jsonObject
.
put
(
"taskType"
,
BusinessTypeEnum
.
JG_NAME_CHANGE_REGISTRATION
.
getCode
());
jsonObject
.
put
(
"flowStatus"
,
this
.
getTaskCodeByName
(
jgChangeRegistrationName
.
getAuditStatus
()));
jsonObject
.
put
(
"flowStatusLabel"
,
jgChangeRegistrationName
.
getAuditStatus
());
jsonObject
.
put
(
"changeCertificate"
,
null
);
jsonObject
.
put
(
"changeCertificate"
,
null
);
// 判断撤回后当前的节点,如果当前节点为提交节点则页面可编辑
jsonObject
.
put
(
"pageType"
,
this
.
getPageTypeByCurrentNode
(
jgChangeRegistrationName
.
getAuditStatus
()));
jsonObject
.
put
(
"pageType"
,
this
.
getPageTypeByCurrentNode
(
jgChangeRegistrationName
.
getAuditStatus
()));
commonService
.
rollbackTask
(
instanceId
,
jsonObject
);
}
private
String
getPageTypeByCurrentNode
(
String
auditStatus
)
{
if
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getPass
().
equals
(
auditStatus
)
||
if
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getPass
().
equals
(
auditStatus
)
||
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getReject
().
equals
(
auditStatus
)
||
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getRollBack
().
equals
(
auditStatus
)
){
)
{
// urlInfo.json 文件的 pageType
return
"edit"
;
}
else
{
...
...
@@ -497,45 +487,42 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
)
{
try
{
JgChangeRegistrationName
jgChangeRegistrationName
=
this
.
getBaseMapper
().
selectById
(
id
);
String
taskId
=
jgChangeRegistrationName
.
getNextTaskId
();
//组装信息
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
taskId
);
dto
.
setComment
(
comment
);
dto
.
setNextExecuteUserCompanyCode
(
this
.
getNextUserOrgCode
(
operate
,
jgChangeRegistrationName
));
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"approvalStatus"
,
operate
);
if
(!
ObjectUtils
.
isEmpty
(
jgChangeRegistrationName
.
getInstanceStatus
())
&&
(
jgChangeRegistrationName
.
getAuditStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getReject
())
||
jgChangeRegistrationName
.
getAuditStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getRollBack
())))
{
map
.
put
(
"approvalStatus"
,
"提交"
);
}
dto
.
setVariable
(
map
);
//执行流程
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
complete
(
taskId
,
dto
);
// 更新下一步执行人、创建待办
updateExecuteIds
(
instanceId
,
id
,
operate
,
processTaskDTO
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
JgChangeRegistrationName
jgChangeRegistrationName
=
this
.
getBaseMapper
().
selectById
(
id
);
String
taskId
=
jgChangeRegistrationName
.
getNextTaskId
();
//组装信息
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
taskId
);
dto
.
setComment
(
comment
);
dto
.
setNextExecuteUserCompanyCode
(
this
.
getNextUserOrgCode
(
operate
,
jgChangeRegistrationName
));
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"approvalStatus"
,
operate
);
if
(!
ObjectUtils
.
isEmpty
(
jgChangeRegistrationName
.
getInstanceStatus
())
&&
(
jgChangeRegistrationName
.
getAuditStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getReject
())
||
jgChangeRegistrationName
.
getAuditStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_SUBMIT
.
getRollBack
())))
{
map
.
put
(
"approvalStatus"
,
"提交"
);
}
dto
.
setVariable
(
map
);
//执行流程
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
complete
(
taskId
,
dto
);
// 更新下一步执行人、创建待办
updateExecuteIds
(
instanceId
,
id
,
operate
,
processTaskDTO
);
}
private
String
getNextUserOrgCode
(
String
operate
,
JgChangeRegistrationName
jgChangeRegistrationName
)
{
if
(
"0"
.
equals
(
operate
))
{
if
(
"0"
.
equals
(
operate
))
{
// 执行通过节点,单位code为接收机构单位信息
return
jgChangeRegistrationName
.
getReceiveOrgCode
();
}
if
(
jgChangeRegistrationName
.
getAuditStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_RECEIVE
.
getPass
())
||
jgChangeRegistrationName
.
getAuditStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_RECEIVE
.
getReject
())
||
jgChangeRegistrationName
.
getAuditStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_RECEIVE
.
getRollBack
())){
if
(
jgChangeRegistrationName
.
getAuditStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_RECEIVE
.
getPass
())
||
jgChangeRegistrationName
.
getAuditStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_RECEIVE
.
getReject
())
||
jgChangeRegistrationName
.
getAuditStatus
().
equals
(
WorkFlowStatusEnum
.
UNIT_RENAME_RECEIVE
.
getRollBack
()))
{
// 驳回且当前节点为一键节点时,单位code为发起人单位信息
return
jgChangeRegistrationName
.
getUseUnitCreditCode
();
}
// 2、3级驳回时,单位code为接收单位code
return
jgChangeRegistrationName
.
getReceiveOrgCode
();
return
jgChangeRegistrationName
.
getReceiveOrgCode
();
}
public
void
updateExecuteIds
(
String
instanceId
,
Long
sequenceNbr
,
String
operate
,
ProcessTaskDTO
processTaskDTO
)
{
...
...
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