如何检查网站死链,wordpress验证码国内,手机怎么进入pc端,合肥高端网站设计接上一篇#xff1a; 第14篇#xff1a;Flowable-BPMN操作流程之任务完成 https://blog.csdn.net/weixin_40816738/article/details/102902647 文章目录一、背景二、定义三、流程准备四、流程文件五、控制器六、流程通过验证6.1. 创建新流程6.2. 启动流程6.3. 控制台查看任务… 接上一篇 第14篇Flowable-BPMN操作流程之任务完成 https://blog.csdn.net/weixin_40816738/article/details/102902647 文章目录一、背景二、定义三、流程准备四、流程文件五、控制器六、流程通过验证6.1. 创建新流程6.2. 启动流程6.3. 控制台查看任务ID6.4. 通过流程6.5. 查看流程图七、流程拒绝验证7.1. 创建新流程7.2. 启动流程7.3. 控制台查看任务ID7.4. 拒绝流程7.5. 查看流程图一、背景
流程在审批的过程中需要进行一些判断然后再看下一步怎么走完成判断逻辑的是网关排他网关就是其中的一种。
二、定义
排他网关也叫异或XOR网关或更技术性的叫法 基于数据的排他网关 用来在流程中实现决策。 当流程执行到这个网关所有外出顺序流都会被处理一遍。 其中条件解析为true的顺序流或者没有设置条件概念上在顺序流上定义了一个’true’ 会被选中让流程继续运行。简单理解条件为True继续执行False将不执行。
三、流程准备
我们在Modeler中给我们的流程配置一个排他网关添加后流程如下 在排他网关的到结束的连接线上配置好网关是否通过的条件比如审核通过我们设置为${outcome‘通过’},当走到这里流程变量outcome为通过的时候将会走审核通过这个流程等于拒绝的时候走下面的流程参数配置如下图所示:
四、流程文件
流程文件内容如下
?xml version1.0 encodingUTF-8?
definitions xmlnshttp://www.omg.org/spec/BPMN/20100524/MODEL xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlns:xsdhttp://www.w3.org/2001/XMLSchema xmlns:flowablehttp://flowable.org/bpmn xmlns:bpmndihttp://www.omg.org/spec/BPMN/20100524/DI xmlns:omgdchttp://www.omg.org/spec/DD/20100524/DC xmlns:omgdihttp://www.omg.org/spec/DD/20100524/DI typeLanguagehttp://www.w3.org/2001/XMLSchema expressionLanguagehttp://www.w3.org/1999/XPath targetNamespacehttp://www.flowable.org/processdefprocess idtest_bpmn name测试BPMN模型 isExecutabletruedocumentation测试BPMN模型/documentationstartEvent idstart name开始/startEventendEvent idend name通过结束/endEventuserTask idtestUser name用户任务测试 flowable:assigneeadminextensionElementsflowable:taskListener eventcreate classcom.hyj.flowlistener.CommonUserStartListener/flowable:taskListenermodeler:initiator-can-complete xmlns:modelerhttp://flowable.org/modeler![CDATA[false]]/modeler:initiator-can-complete/extensionElements/userTasksequenceFlow idsid-8D834F3C-45A8-4C88-9AD1-1AC426CC9002 sourceRefstart targetReftestUser/sequenceFlowexclusiveGateway idex_gateway_check name审核结果/exclusiveGatewaysequenceFlow idsid-50731902-EF37-4E07-9DED-2E83F7EB54B7 sourceReftestUser targetRefex_gateway_check/sequenceFlowendEvent idend_fail name失败结束/endEventsequenceFlow idcheck_fail name审核拒绝 sourceRefex_gateway_check targetRefend_failconditionExpression xsi:typetFormalExpression![CDATA[${outcome拒绝}]]/conditionExpression/sequenceFlowsequenceFlow idcheck_ok name审核通过 sourceRefex_gateway_check targetRefendconditionExpression xsi:typetFormalExpression![CDATA[${outcome通过}]]/conditionExpression/sequenceFlow/processbpmndi:BPMNDiagram idBPMNDiagram_test_bpmnbpmndi:BPMNPlane bpmnElementtest_bpmn idBPMNPlane_test_bpmnbpmndi:BPMNShape bpmnElementstart idBPMNShape_startomgdc:Bounds height30.0 width30.0 x210.0 y120.0/omgdc:Bounds/bpmndi:BPMNShapebpmndi:BPMNShape bpmnElementend idBPMNShape_endomgdc:Bounds height28.0 width28.0 x630.0 y60.0/omgdc:Bounds/bpmndi:BPMNShapebpmndi:BPMNShape bpmnElementtestUser idBPMNShape_testUseromgdc:Bounds height80.0 width100.0 x315.0 y95.0/omgdc:Bounds/bpmndi:BPMNShapebpmndi:BPMNShape bpmnElementex_gateway_check idBPMNShape_ex_gateway_checkomgdc:Bounds height40.0 width40.0 x480.0 y115.0/omgdc:Bounds/bpmndi:BPMNShapebpmndi:BPMNShape bpmnElementend_fail idBPMNShape_end_failomgdc:Bounds height28.0 width28.0 x630.0 y180.0/omgdc:Bounds/bpmndi:BPMNShapebpmndi:BPMNEdge bpmnElementcheck_fail idBPMNEdge_check_failomgdi:waypoint x500.5 y154.4338310580205/omgdi:waypointomgdi:waypoint x500.5 y194.0/omgdi:waypointomgdi:waypoint x630.0 y194.0/omgdi:waypoint/bpmndi:BPMNEdgebpmndi:BPMNEdge bpmnElementsid-8D834F3C-45A8-4C88-9AD1-1AC426CC9002 idBPMNEdge_sid-8D834F3C-45A8-4C88-9AD1-1AC426CC9002omgdi:waypoint x239.94999779398907 y135.0/omgdi:waypointomgdi:waypoint x315.0 y135.0/omgdi:waypoint/bpmndi:BPMNEdgebpmndi:BPMNEdge bpmnElementsid-50731902-EF37-4E07-9DED-2E83F7EB54B7 idBPMNEdge_sid-50731902-EF37-4E07-9DED-2E83F7EB54B7omgdi:waypoint x414.95000000000005 y135.0/omgdi:waypointomgdi:waypoint x480.0 y135.0/omgdi:waypoint/bpmndi:BPMNEdgebpmndi:BPMNEdge bpmnElementcheck_ok idBPMNEdge_check_okomgdi:waypoint x500.5 y115.5/omgdi:waypointomgdi:waypoint x500.5 y74.0/omgdi:waypointomgdi:waypoint x630.0 y74.0/omgdi:waypoint/bpmndi:BPMNEdge/bpmndi:BPMNPlane/bpmndi:BPMNDiagram
/definitions五、控制器
控制器原来直接是个完成任务现在我们方便起见拆分为2个一个是通过任务一个是拒绝任务如果你的排他网关使用的都是该参数那么就可以通用。
RequestMapping(/accept)ResponseBodypublic MapString,Object acceptTask(RequestBody RequestParam(required false) MapString,String paras){MapString,Object res new HashMap();MapString,String data new HashMap();if (MapUtils.isEmpty(paras)){res.put(msg,请输入任务参数);res.put(res,0);res.put(data,data);return res;}String taskId paras.get(taskId);if (StringUtils.isEmpty(taskId)){res.put(msg,请输入任务ID);res.put(res,0);res.put(data,data);return res;}MapString,Object flowParasnew HashMap();flowParas.putAll(paras);flowParas.put(outcome,通过);boolean bok flowService.completeTask(taskId,flowParas);if (bok){data.put(taskId,taskId);res.put(msg,通过任务成功);res.put(res,1);}else {data.put(taskId,taskId);res.put(msg,通过任务失败);res.put(res,0);}res.put(data,data);return res;}RequestMapping(/reject)ResponseBodypublic MapString,Object rejectTask(RequestBody RequestParam(required false) MapString,String paras){MapString,Object res new HashMap();MapString,String data new HashMap();if (MapUtils.isEmpty(paras)){res.put(msg,请输入任务参数);res.put(res,0);res.put(data,data);return res;}String taskId paras.get(taskId);if (StringUtils.isEmpty(taskId)){res.put(msg,请输入任务ID);res.put(res,0);res.put(data,data);return res;}MapString,Object flowParasnew HashMap();flowParas.putAll(paras);flowParas.put(outcome,拒绝);boolean bok flowService.completeTask(taskId,flowParas);if (bok){data.put(taskId,taskId);res.put(msg,拒绝任务成功);res.put(res,1);}else {data.put(taskId,taskId);res.put(msg,拒绝任务失败);res.put(res,0);}res.put(data,data);return res;}
六、流程通过验证
6.1. 创建新流程
使用测试BPMN模型4.bpmn20.xml的流程配置文件输入创建地址完成创建。 http://localhost:8989/flow/create
6.2. 启动流程
http://localhost:8989/flow/start?processKeytest_bpmn 输入改地址完成流程启动
6.3. 控制台查看任务ID
此时查看流程后台会打印当前的任务ID
6.4. 通过流程
输入新增的通过地址完成流程审批 http://localhost:8989/flow/accept?taskId99bb7920-0082-11ea-8f3c-f8a2d6bfea5a
6.5. 查看流程图
进入流程查看地址: http://localhost:8989/flow/processDiagram?processId8f9bf5e7-0083-11ea-9dbd-f8a2d6bfea5a 查看我们的审批流程走到了最后而拒绝没有发生变化说明排他网关成功的区分了两个流程流程进展如下图所示:
七、流程拒绝验证
7.1. 创建新流程
替换罪行的流程配置文件输入创建地址完成创建。 http://localhost:8989/flow/create
7.2. 启动流程
http://localhost:8989/flow/start?processKeytest_bpmn 输入改地址完成流程启动
processId976c4c43-0106-11ea-85ad-f8a2d6bfea5a7.3. 控制台查看任务ID
此时查看流程后台会打印当前的任务ID
7.4. 拒绝流程
输入新增的通过地址完成流程审批 http://localhost:8989/flow/reject?taskId9774b0b9-0106-11ea-85ad-f8a2d6bfea5a
7.5. 查看流程图
进入流程查看地址: http://localhost:8989/flow/processDiagram?processId976c4c43-0106-11ea-85ad-f8a2d6bfea5a ,查看我们的审批流程走到了最后而拒绝没有发生变化说明排他网关成功的区分了两个流程流程进展如下图所示: 代码下载
gitlab链接https://gitlab.com/gb-heima/flowablestudy/tree/master/flowablelech15
码云链接https://gitee.com/gb_90/flowable-study/tree/master/flowablelech15