Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Z
zlmy-cloud
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
zlmy
zlmy-cloud
Commits
0feec04b
Commit
0feec04b
authored
Jul 07, 2025
by
Rensq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化危险作业停止子任务
parent
b9d3c53a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
1 deletion
+60
-1
THazardWorkPlanServiceImpl.java
...odule/hazard/service/impl/THazardWorkPlanServiceImpl.java
+11
-1
RuTaskService.java
...main/java/com/testor/module/wf/service/RuTaskService.java
+6
-0
RuTaskServiceImpl.java
.../com/testor/module/wf/service/impl/RuTaskServiceImpl.java
+43
-0
No files found.
zlmy-modules/zlmy-boot/src/main/java/com/testor/module/hazard/service/impl/THazardWorkPlanServiceImpl.java
View file @
0feec04b
...
...
@@ -64,8 +64,16 @@ import org.apache.poi.xwpf.usermodel.Document;
import
org.apache.poi.xwpf.usermodel.XWPFDocument
;
import
org.apache.poi.xwpf.usermodel.XWPFPictureData
;
import
org.apache.xmlbeans.XmlOptions
;
import
org.flowable.bpmn.model.BpmnModel
;
import
org.flowable.bpmn.model.EndEvent
;
import
org.flowable.bpmn.model.Process
;
import
org.flowable.common.engine.impl.identity.Authentication
;
import
org.flowable.engine.RepositoryService
;
import
org.flowable.engine.RuntimeService
;
import
org.flowable.engine.TaskService
;
import
org.flowable.engine.runtime.Execution
;
import
org.flowable.engine.runtime.ProcessInstance
;
import
org.flowable.task.api.Task
;
import
org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBody
;
import
org.quartz.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -1022,6 +1030,7 @@ public class THazardWorkPlanServiceImpl extends SuperServiceImpl<THazardWorkPlan
}
//关闭主流程数据
runtimeService
.
deleteProcessInstance
(
byId
.
getProcessId
(),
opinion
);
ruTaskService
.
stopProcess
(
byId
.
getProcessId
());
cancelChildTasks
(
completeTask
);
THazardWorkPlan
tHazardWorkPlan
=
new
THazardWorkPlan
();
tHazardWorkPlan
.
setId
(
completeTask
.
getBizId
());
...
...
@@ -1037,7 +1046,8 @@ public class THazardWorkPlanServiceImpl extends SuperServiceImpl<THazardWorkPlan
List
<
THazardConditionConfirmationRecord
>
tHazardConditionConfirmationRecords
=
tHazardConditionConfirmationRecordService
.
list
(
new
QueryWrapper
<
THazardConditionConfirmationRecord
>().
eq
(
THazardConditionConfirmationRecord
.
PLAN_ID
,
bizId
));
for
(
THazardConditionConfirmationRecord
tHazardConditionConfirmationRecord
:
tHazardConditionConfirmationRecords
)
{
runtimeService
.
deleteProcessInstance
(
tHazardConditionConfirmationRecord
.
getProcessId
(),
"取消作业"
);
ruTaskService
.
stopProcess
(
tHazardConditionConfirmationRecord
.
getProcessId
());
//runtimeService.deleteProcessInstance(, "取消作业");
tHazardConditionConfirmationRecord
.
setRemarks
(
"取消作业"
);
tHazardConditionConfirmationRecordService
.
updateById
(
tHazardConditionConfirmationRecord
);
}
...
...
zlmy-modules/zlmy-boot/src/main/java/com/testor/module/wf/service/RuTaskService.java
View file @
0feec04b
...
...
@@ -50,4 +50,10 @@ public interface RuTaskService {
*/
List
<
String
>
getNextNameTasks
(
String
taskId
,
Map
<
String
,
Object
>
variables
);
/**
* 停止流程
* @param processInstanceId
*/
void
stopProcess
(
String
processInstanceId
);
}
zlmy-modules/zlmy-boot/src/main/java/com/testor/module/wf/service/impl/RuTaskServiceImpl.java
View file @
0feec04b
...
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.xiaoymin.knife4j.core.util.StrUtil
;
import
com.testor.common.core.utils.StringUtils
;
import
com.testor.module.hazard.model.enums.WorkPlanStatusEnum
;
import
com.testor.module.wf.dao.RuTaskDao
;
import
com.testor.module.wf.service.RuTaskService
;
import
com.testor.module.wf.utils.CastUtils
;
...
...
@@ -14,6 +15,7 @@ import com.testor.module.wf.utils.VariableUtils;
import
com.testor.module.wf.vo.ProcessDefListRequestVO
;
import
com.tongtech.tfw.backend.common.biz.constants.BizConstants
;
import
com.tongtech.tfw.backend.common.biz.models.BaseResponseList
;
import
com.tongtech.tfw.backend.common.context.ContextUtils
;
import
com.tongtech.tfw.backend.core.helper.StringHelper
;
import
com.tongtech.tfw.backend.core.helper.bean.BeanHelper
;
import
com.tongtech.tfw.workflow.apis.definition.model.domain.ActReDeployment
;
...
...
@@ -24,9 +26,14 @@ import com.tongtech.tfw.workflow.apis.definition.service.ActReProcdefService;
import
com.tongtech.tfw.workflow.apis.task.model.dto.HisTask
;
import
com.tongtech.tfw.workflow.apis.task.model.dto.HisTaskListRequest
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.flowable.bpmn.model.*
;
import
org.flowable.bpmn.model.Process
;
import
org.flowable.common.engine.impl.identity.Authentication
;
import
org.flowable.engine.*
;
import
org.flowable.engine.repository.ProcessDefinition
;
import
org.flowable.engine.runtime.Execution
;
import
org.flowable.engine.runtime.ProcessInstance
;
import
org.flowable.idm.api.Group
;
import
org.flowable.idm.api.User
;
import
org.flowable.task.api.Task
;
...
...
@@ -248,6 +255,42 @@ public class RuTaskServiceImpl implements RuTaskService {
return
nextFlowNodeNames
;
}
@Override
public
void
stopProcess
(
String
processInstanceId
)
{
String
loginUserId
=
ContextUtils
.
getLoginUserId
();
List
<
Task
>
taskList
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstanceId
).
list
();
if
(
CollectionUtils
.
isEmpty
(
taskList
))
{
throw
new
RuntimeException
(
"流程未启动或已执行完成,取消申请失败"
);
}
ProcessInstance
processInstance
=
runtimeService
.
createProcessInstanceQuery
()
.
processInstanceId
(
processInstanceId
).
singleResult
();
BpmnModel
bpmnModel
=
repositoryService
.
getBpmnModel
(
processInstance
.
getProcessDefinitionId
());
if
(
Objects
.
nonNull
(
bpmnModel
))
{
Process
process
=
bpmnModel
.
getMainProcess
();
List
<
EndEvent
>
endNodes
=
process
.
findFlowElementsOfType
(
EndEvent
.
class
,
false
);
if
(
CollectionUtils
.
isNotEmpty
(
endNodes
))
{
Authentication
.
setAuthenticatedUserId
(
loginUserId
);
runtimeService
.
setVariable
(
processInstance
.
getId
(),
"processStatus"
,
WorkPlanStatusEnum
.
CANCELED
.
getValue
());
for
(
Task
task
:
taskList
)
{
taskService
.
addComment
(
task
.
getId
(),
processInstance
.
getProcessInstanceId
(),
WorkPlanStatusEnum
.
CANCELED
.
getValue
()
,
"取消流程"
);
}
// 获取当前流程最后一个节点
String
endId
=
endNodes
.
get
(
0
).
getId
();
List
<
Execution
>
executions
=
runtimeService
.
createExecutionQuery
()
.
parentId
(
processInstance
.
getProcessInstanceId
()).
list
();
List
<
String
>
executionIds
=
new
ArrayList
<>();
executions
.
forEach
(
execution
->
executionIds
.
add
(
execution
.
getId
()));
// 变更流程为已结束状态
runtimeService
.
createChangeActivityStateBuilder
()
.
moveExecutionsToSingleActivityId
(
executionIds
,
endId
).
changeState
();
}
}
}
/**
* 获取下一任务节点集合
...
...
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