Commit 9c4648e54545d8f82ffb20734a4ace9eb33f0936
1 parent
40082c9b
【功能评审】Bpm:审批签名
Showing
4 changed files
with
16 additions
and
7 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmnVariableConstants.java
| @@ -58,7 +58,9 @@ public class BpmnVariableConstants { | @@ -58,7 +58,9 @@ public class BpmnVariableConstants { | ||
| 58 | * @see org.flowable.task.api.Task#getTaskLocalVariables() | 58 | * @see org.flowable.task.api.Task#getTaskLocalVariables() |
| 59 | */ | 59 | */ |
| 60 | public static final String TASK_VARIABLE_REASON = "TASK_REASON"; | 60 | public static final String TASK_VARIABLE_REASON = "TASK_REASON"; |
| 61 | - | 61 | + /** |
| 62 | + * 任务变量 - 签名图片 URL | ||
| 63 | + */ | ||
| 62 | public static final String TASK_SIGN_PIC_URL = "TASK_SIGN_PIC_URL"; | 64 | public static final String TASK_SIGN_PIC_URL = "TASK_SIGN_PIC_URL"; |
| 63 | 65 | ||
| 64 | } | 66 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/listener/BpmProcessInstanceEventListener.java
| @@ -39,10 +39,10 @@ public class BpmProcessInstanceEventListener extends AbstractFlowableEngineEvent | @@ -39,10 +39,10 @@ public class BpmProcessInstanceEventListener extends AbstractFlowableEngineEvent | ||
| 39 | processInstanceService.processProcessInstanceCompleted((ProcessInstance)event.getEntity()); | 39 | processInstanceService.processProcessInstanceCompleted((ProcessInstance)event.getEntity()); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | - @Override | ||
| 43 | - // 特殊情况:当跳转到 EndEvent 流程实例未结束, 会执行 deleteProcessInstance 方法。 | 42 | + @Override // 特殊情况:当跳转到 EndEvent 流程实例未结束, 会执行 deleteProcessInstance 方法 |
| 44 | protected void processCancelled(FlowableCancelledEvent event) { | 43 | protected void processCancelled(FlowableCancelledEvent event) { |
| 45 | ProcessInstance processInstance = processInstanceService.getProcessInstance(event.getProcessInstanceId()); | 44 | ProcessInstance processInstance = processInstanceService.getProcessInstance(event.getProcessInstanceId()); |
| 46 | processInstanceService.processProcessInstanceCompleted(processInstance); | 45 | processInstanceService.processProcessInstanceCompleted(processInstance); |
| 47 | } | 46 | } |
| 47 | + | ||
| 48 | } | 48 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/FlowableUtils.java
| @@ -213,6 +213,12 @@ public class FlowableUtils { | @@ -213,6 +213,12 @@ public class FlowableUtils { | ||
| 213 | return (String) task.getTaskLocalVariables().get(BpmnVariableConstants.TASK_VARIABLE_REASON); | 213 | return (String) task.getTaskLocalVariables().get(BpmnVariableConstants.TASK_VARIABLE_REASON); |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | + /** | ||
| 217 | + * 获得任务的签名图片 URL | ||
| 218 | + * | ||
| 219 | + * @param task 任务 | ||
| 220 | + * @return 签名图片 URL | ||
| 221 | + */ | ||
| 216 | public static String getTaskSignPicUrl(TaskInfo task) { | 222 | public static String getTaskSignPicUrl(TaskInfo task) { |
| 217 | return (String) task.getTaskLocalVariables().get(BpmnVariableConstants.TASK_SIGN_PIC_URL); | 223 | return (String) task.getTaskLocalVariables().get(BpmnVariableConstants.TASK_SIGN_PIC_URL); |
| 218 | } | 224 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
| @@ -859,10 +859,11 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -859,10 +859,11 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 859 | .moveActivityIdsToSingleActivityId(activityIds, endEvent.getId()) | 859 | .moveActivityIdsToSingleActivityId(activityIds, endEvent.getId()) |
| 860 | .changeState(); | 860 | .changeState(); |
| 861 | 861 | ||
| 862 | - // 3. 如果跳转到 EndEvent 流程还未结束, 执行 deleteProcessInstance 方法。 | ||
| 863 | - List<Execution> executionList = runtimeService.createExecutionQuery().processInstanceId(processInstanceId).list(); | ||
| 864 | - if (CollUtil.isNotEmpty(executionList)) { | ||
| 865 | - log.warn("执行跳转到 EndEvent 后, 流程实例未结束。执行 [deleteProcessInstance] 方法"); | 862 | + // 3. 特殊:如果跳转到 EndEvent 流程还未结束, 执行 deleteProcessInstance 方法 |
| 863 | + // TODO 芋艿:目前发现并行分支情况下,会存在这个情况,后续看看有没更好的方案; | ||
| 864 | + List<Execution> executions = runtimeService.createExecutionQuery().processInstanceId(processInstanceId).list(); | ||
| 865 | + if (CollUtil.isNotEmpty(executions)) { | ||
| 866 | + log.warn("[moveTaskToEnd][执行跳转到 EndEvent 后, 流程实例未结束,强制执行 deleteProcessInstance 方法]"); | ||
| 866 | runtimeService.deleteProcessInstance(processInstanceId, reason); | 867 | runtimeService.deleteProcessInstance(processInstanceId, reason); |
| 867 | } | 868 | } |
| 868 | } | 869 | } |