本文主要是介绍4-Springboot集成FLOWABLE之流程驳回,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目录标题
- 演示地址
- 效果
- 功能
- 后端代码
- 补充
演示地址
效果
功能
默认驳回到上一节点
后端代码
flowable自带驳回功能, 在源码ProcessInstanceResource.class
下已有该功能,不需要自己额外去写
@ApiOperation(value = "Change the state a process instance", tags = { "Process Instances" }, notes = "")@ApiResponses(value = {@ApiResponse(code = 200, message = "Indicates the process instance was found and change state activity was executed."),@ApiResponse(code = 409, message = "Indicates the requested process instance action cannot be executed since the process-instance is already activated/suspended."),@ApiResponse(code = 404, message = "Indicates the requested process instance was not found.")})@PostMapping(value = "/runtime/process-instances/{processInstanceId}/change-state", produces = "application/json")public void changeActivityState(@ApiParam(name = "processInstanceId") @PathVariable String processInstanceId,@RequestBody ExecutionChangeActivityStateRequest activityStateRequest, HttpServletRequest request) {if (restApiInterceptor != null) {restApiInterceptor.changeActivityState(activityStateRequest);}if (activityStateRequest.getCancelActivityIds() != null && activityStateRequest.getCancelActivityIds().size() == 1) {runtimeService.createChangeActivityStateBuilder().processInstanceId(processInstanceId).moveSingleActivityIdToActivityIds(activityStateRequest.getCancelActivityIds().get(0), activityStateRequest.getStartActivityIds()).changeState();} else if (activityStateRequest.getStartActivityIds() != null && activityStateRequest.getStartActivityIds().size() == 1) {runtimeService.createChangeActivityStateBuilder().processInstanceId(processInstanceId).moveActivityIdsToSingleActivityId(activityStateRequest.getCancelActivityIds(), activityStateRequest.getStartActivityIds().get(0)).changeState();}}
其中参数 ExecutionChangeActivityStateRequest的
cancelActivityIds指:需要驳回的节点,
startActivityIds指:驳回到的节点
这两个字段对应的是ACT_ID_字段的值。可以做到任意节点驳回。
protected List<String> cancelActivityIds;
protected List<String> startActivityIds;
补充
1、正在执行的流程的image
ProcessInstanceDiagramResource.class的getProcessInstanceDiagram方法
2、已完结的流程的image
ProcessDefinitionImageResource.class的getModelResource方法
下一篇:会签
这篇关于4-Springboot集成FLOWABLE之流程驳回的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!