小而美企业网站建设,学建站论坛,网站建设 教学大纲,可以做围棋题的网站springCloud集成activiti5.22.0流程引擎 点关注不迷路#xff0c;欢迎再访#xff01; 精简博客内容#xff0c;尽量已行业术语来分享。 努力做到对每一位认可自己的读者负责。 帮助别人的同时更是丰富自己的良机。 文章目录 springCloud集成activiti5.22.0流程引擎一.Sprin…springCloud集成activiti5.22.0流程引擎 点关注不迷路欢迎再访 精简博客内容尽量已行业术语来分享。 努力做到对每一位认可自己的读者负责。 帮助别人的同时更是丰富自己的良机。 文章目录 springCloud集成activiti5.22.0流程引擎一.Spring boot2.x与Activiti 5.22.0整合1.POM文件中添加依赖 二.制作bpmn流程文件创建bpmn文件 三.流程演示分支审批 一.Spring boot2.x与Activiti 5.22.0整合
1.POM文件中添加依赖
dependencygroupIdorg.activiti/groupIdartifactIdactiviti-spring-boot-starter-basic/artifactIdversion5.22.0/versionexclusions!-- 排除activiti的mybatis避免和外面的mybatis-plus冲突 --exclusionartifactIdmybatis/artifactIdgroupIdorg.mybatis/groupId/exclusion/exclusions
/dependency二.制作bpmn流程文件
创建bpmn文件
右键该文件夹New–BPMN File 创建名为leave_flow的流程文件
文件名xxx.bpmn 更改为 “xxx.bpmn.xml” 注: 因为activiti的默认流程图格式是bpmn, 但是idea必须xml格式才能生成图片, 所以改为这样, 后面部署流程的时候才可以部署上去, 否则是存不进数据库.
?xml version1.0 encodingUTF-8 standaloneyes?
definitions xmlnshttp://www.omg.org/spec/BPMN/20100524/MODEL xmlns:activitihttp://activiti.org/bpmn xmlns:bpmndihttp://www.omg.org/spec/BPMN/20100524/DI xmlns:dchttp://www.omg.org/spec/DD/20100524/DC xmlns:dihttp://www.omg.org/spec/DD/20100524/DI xmlns:tnshttp://www.activiti.org/testm1723732311976 xmlns:xsdhttp://www.w3.org/2001/XMLSchema xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance expressionLanguagehttp://www.w3.org/1999/XPath idm1723732311976 name targetNamespacehttp://www.activiti.org/testm1723732311976 typeLanguagehttp://www.w3.org/2001/XMLSchemaprocess idleaveProcess isClosedfalse isExecutabletrue name请假审批流程 processTypeNonestartEvent idSTEP1 name开始/userTask activiti:assignee${userId} activiti:exclusivetrue idSTEP2 name员工/userTask activiti:assignee${userId} activiti:exclusivetrue idSTEP3 name经理/endEvent idSTEP4 name结束/sequenceFlow id_6 sourceRefSTEP1 targetRefSTEP2/sequenceFlow id_7 sourceRefSTEP2 targetRefSTEP3/exclusiveGateway gatewayDirectionUnspecified id_8 nameExclusiveGateway/sequenceFlow id_2 name同意 sourceRef_8 targetRefSTEP4conditionExpression xsi:typetFormalExpression![CDATA[${accept”同意”}]]/conditionExpression/sequenceFlowsequenceFlow id_3 sourceRefSTEP3 targetRef_8/sequenceFlow id_4 name驳回 sourceRef_8 targetRefSTEP2conditionExpression xsi:typetFormalExpression![CDATA[${accept”驳回”}]]/conditionExpression/sequenceFlow/processbpmndi:BPMNDiagram documentationbackground#3C3F41;count1;horizontalcount1;orientation0;width842.4;height1195.2;imageableWidth832.4;imageableHeight1185.2;imageableX5.0;imageableY5.0 idDiagram-_1 nameNew Diagrambpmndi:BPMNPlane bpmnElementleaveProcessbpmndi:BPMNShape bpmnElementSTEP1 idShape-STEP1dc:Bounds height32.0 width32.0 x160.0 y40.0/bpmndi:BPMNLabeldc:Bounds height32.0 width32.0 x0.0 y0.0//bpmndi:BPMNLabel/bpmndi:BPMNShapebpmndi:BPMNShape bpmnElementSTEP2 idShape-STEP2dc:Bounds height55.0 width85.0 x130.0 y145.0/bpmndi:BPMNLabeldc:Bounds height55.0 width85.0 x0.0 y0.0//bpmndi:BPMNLabel/bpmndi:BPMNShapebpmndi:BPMNShape bpmnElementSTEP3 idShape-STEP3dc:Bounds height55.0 width85.0 x135.0 y275.0/bpmndi:BPMNLabeldc:Bounds height55.0 width85.0 x0.0 y0.0//bpmndi:BPMNLabel/bpmndi:BPMNShapebpmndi:BPMNShape bpmnElementSTEP4 idShape-STEP4dc:Bounds height32.0 width32.0 x325.0 y525.0/bpmndi:BPMNLabeldc:Bounds height32.0 width32.0 x0.0 y0.0//bpmndi:BPMNLabel/bpmndi:BPMNShapebpmndi:BPMNShape bpmnElement_8 idShape-_8 isMarkerVisiblefalsedc:Bounds height32.0 width32.0 x325.0 y400.0/bpmndi:BPMNLabeldc:Bounds height32.0 width32.0 x0.0 y0.0//bpmndi:BPMNLabel/bpmndi:BPMNShapebpmndi:BPMNEdge bpmnElement_2 idBPMNEdge__2 sourceElement_8 targetElementSTEP4di:waypoint x341.0 y432.0/di:waypoint x341.0 y525.0/bpmndi:BPMNLabeldc:Bounds height0.0 width0.0 x0.0 y0.0//bpmndi:BPMNLabel/bpmndi:BPMNEdgebpmndi:BPMNEdge bpmnElement_3 idBPMNEdge__3 sourceElementSTEP3 targetElement_8di:waypoint x175.0 y330.0/di:waypoint x175.0 y410.0/di:waypoint x331.0 y410.0/bpmndi:BPMNLabeldc:Bounds height0.0 width0.0 x0.0 y0.0//bpmndi:BPMNLabel/bpmndi:BPMNEdgebpmndi:BPMNEdge bpmnElement_4 idBPMNEdge__4 sourceElement_8 targetElementSTEP2di:waypoint x340.0 y401.0/di:waypoint x340.0 y285.0/di:waypoint x215.0 y172.5/bpmndi:BPMNLabeldc:Bounds height0.0 width0.0 x0.0 y0.0//bpmndi:BPMNLabel/bpmndi:BPMNEdgebpmndi:BPMNEdge bpmnElement_6 idBPMNEdge__6 sourceElementSTEP1 targetElementSTEP2di:waypoint x176.0 y72.0/di:waypoint x176.0 y145.0/bpmndi:BPMNLabeldc:Bounds height0.0 width0.0 x0.0 y0.0//bpmndi:BPMNLabel/bpmndi:BPMNEdgebpmndi:BPMNEdge bpmnElement_7 idBPMNEdge__7 sourceElementSTEP2 targetElementSTEP3di:waypoint x175.0 y200.0/di:waypoint x175.0 y275.0/bpmndi:BPMNLabeldc:Bounds height0.0 width0.0 x0.0 y0.0//bpmndi:BPMNLabel/bpmndi:BPMNEdge/bpmndi:BPMNPlane/bpmndi:BPMNDiagram
/definitions三.流程演示
分支审批 Overridepublic void assginLeaveWorkFlow(String processInstanceId,int isAccept,String userId) {MapString,Object map new HashMap();//得到当前实例下的taskTask task taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();taskService.addComment(task.getId(), processInstanceId, 审核人是否同意该请假流程);if(isAccept 0){map.put(accept,同意);task.setAssignee(userId);map.put(userId, userId);}else{map.put(accept,驳回);//审核驳回后task.setAssignee(发起人);map.put(auditor,发起人);}task.setDescription(请假的描述信息);//执行当前这个工作流任务taskService.saveTask(task);taskService.complete(task.getId(), map);}