parent
36be3b289d
commit
3abfdcb083
@ -0,0 +1,17 @@ |
|||||||
|
package com.zilber.boot.activiti.listen; |
||||||
|
|
||||||
|
import org.activiti.engine.delegate.DelegateExecution; |
||||||
|
import org.activiti.engine.delegate.ExecutionListener; |
||||||
|
|
||||||
|
public class ApplyListener implements ExecutionListener { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void notify(DelegateExecution execution) { |
||||||
|
String eventName = execution.getEventName(); |
||||||
|
if ("start".endsWith(eventName)) { |
||||||
|
System.out.println("流程 start==="); |
||||||
|
} else if ("end".endsWith(eventName)) { |
||||||
|
System.out.println("流程 end==="); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
package com.zilber.boot.activiti.listen; |
||||||
|
|
||||||
|
import org.activiti.engine.delegate.DelegateTask; |
||||||
|
import org.activiti.engine.delegate.TaskListener; |
||||||
|
|
||||||
|
public class ApplyTaskListener implements TaskListener { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void notify(DelegateTask delegateTask) { |
||||||
|
System.out.println("===========进来了=============="); |
||||||
|
String eventName = delegateTask.getEventName(); |
||||||
|
if ("create".endsWith(eventName)) { |
||||||
|
System.out.println("任务create===" + delegateTask.getName()); |
||||||
|
} else if ("complete".endsWith(eventName)) { |
||||||
|
System.out.println("任务task complete===" + delegateTask.getName()); |
||||||
|
} else if ("delete".endsWith(eventName)) { |
||||||
|
System.out.println("任务task delete===" + delegateTask.getName()); |
||||||
|
} else if ("assignment".endsWith(eventName)) { |
||||||
|
System.out.println("任务task assignment===" + delegateTask.getName()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,57 @@ |
|||||||
|
package com.zilber.boot.framework.config; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.DbType; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
import org.springframework.transaction.annotation.EnableTransactionManagement; |
||||||
|
|
||||||
|
@EnableTransactionManagement(proxyTargetClass = true) |
||||||
|
@Configuration |
||||||
|
public class MybatisPlusConfig { |
||||||
|
|
||||||
|
@Bean |
||||||
|
public MybatisPlusInterceptor mybatisPlusInterceptor() |
||||||
|
{ |
||||||
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
||||||
|
// 分页插件
|
||||||
|
interceptor.addInnerInterceptor(paginationInnerInterceptor()); |
||||||
|
// 乐观锁插件
|
||||||
|
interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor()); |
||||||
|
// 阻断插件
|
||||||
|
interceptor.addInnerInterceptor(blockAttackInnerInterceptor()); |
||||||
|
return interceptor; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页插件,自动识别数据库类型 https://baomidou.com/guide/interceptor-pagination.html
|
||||||
|
*/ |
||||||
|
public PaginationInnerInterceptor paginationInnerInterceptor() |
||||||
|
{ |
||||||
|
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); |
||||||
|
// 设置数据库类型为mysql
|
||||||
|
paginationInnerInterceptor.setDbType(DbType.MYSQL); |
||||||
|
// 设置最大单页限制数量,默认 500 条,-1 不受限制
|
||||||
|
paginationInnerInterceptor.setMaxLimit(-1L); |
||||||
|
return paginationInnerInterceptor; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 乐观锁插件 https://baomidou.com/guide/interceptor-optimistic-locker.html
|
||||||
|
*/ |
||||||
|
public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() |
||||||
|
{ |
||||||
|
return new OptimisticLockerInnerInterceptor(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 如果是对全表的删除或更新操作,就会终止该操作 https://baomidou.com/guide/interceptor-block-attack.html
|
||||||
|
*/ |
||||||
|
public BlockAttackInnerInterceptor blockAttackInnerInterceptor() |
||||||
|
{ |
||||||
|
return new BlockAttackInnerInterceptor(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,170 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef"> |
||||||
|
<process id="daily" name="daily" isExecutable="true"> |
||||||
|
<extensionElements> |
||||||
|
<activiti:executionListener class="com.zilber.boot.activiti.listen.ApplyListener" event="start" /> |
||||||
|
<activiti:executionListener class="com.zilber.boot.activiti.listen.ApplyListener" event="end" /> |
||||||
|
</extensionElements> |
||||||
|
<startEvent id="Event_0w0afi8" name="开始"> |
||||||
|
<outgoing>Flow_1jlgqlw</outgoing> |
||||||
|
</startEvent> |
||||||
|
<sequenceFlow id="Flow_1jlgqlw" sourceRef="Event_0w0afi8" targetRef="Activity_144t788" /> |
||||||
|
<userTask id="Activity_144t788" name="请假申请" activiti:assignee="${ower}"> |
||||||
|
<extensionElements> |
||||||
|
<activiti:taskListener class="com.zilber.boot.activiti.listen.ApplyTaskListener" event="complete" /> |
||||||
|
<activiti:taskListener class="com.zilber.boot.activiti.listen.ApplyTaskListener" event="create" /> |
||||||
|
</extensionElements> |
||||||
|
<incoming>Flow_1jlgqlw</incoming> |
||||||
|
<outgoing>Flow_0ul7x96</outgoing> |
||||||
|
</userTask> |
||||||
|
<exclusiveGateway id="Gateway_0de3wfg"> |
||||||
|
<incoming>Flow_0ul7x96</incoming> |
||||||
|
<outgoing>Flow_0v4r83w</outgoing> |
||||||
|
<outgoing>Flow_1gr0gbv</outgoing> |
||||||
|
</exclusiveGateway> |
||||||
|
<sequenceFlow id="Flow_0ul7x96" sourceRef="Activity_144t788" targetRef="Gateway_0de3wfg" /> |
||||||
|
<sequenceFlow id="Flow_0v4r83w" sourceRef="Gateway_0de3wfg" targetRef="Activity_1p56jq4"> |
||||||
|
<conditionExpression xsi:type="tFormalExpression">${day>3}</conditionExpression> |
||||||
|
</sequenceFlow> |
||||||
|
<sequenceFlow id="Flow_1gr0gbv" sourceRef="Gateway_0de3wfg" targetRef="Activity_1ygbeoa"> |
||||||
|
<conditionExpression xsi:type="tFormalExpression">${day<=3}</conditionExpression> |
||||||
|
</sequenceFlow> |
||||||
|
<sequenceFlow id="Flow_0kudbee" sourceRef="Activity_1ygbeoa" targetRef="Activity_13m5c8m"> |
||||||
|
<conditionExpression xsi:type="tFormalExpression">${status== 1}</conditionExpression> |
||||||
|
</sequenceFlow> |
||||||
|
<sequenceFlow id="Flow_09xp52x" sourceRef="Activity_1p56jq4" targetRef="Activity_13m5c8m"> |
||||||
|
<conditionExpression xsi:type="tFormalExpression">${status==1}</conditionExpression> |
||||||
|
</sequenceFlow> |
||||||
|
<endEvent id="Event_16bkb2x" name="结束"> |
||||||
|
<incoming>Flow_0f94ru3</incoming> |
||||||
|
</endEvent> |
||||||
|
<sequenceFlow id="Flow_0f94ru3" sourceRef="Activity_13m5c8m" targetRef="Event_16bkb2x" /> |
||||||
|
<endEvent id="Event_1bn5u87" name="结束"> |
||||||
|
<incoming>Flow_1s5r7c7</incoming> |
||||||
|
</endEvent> |
||||||
|
<sequenceFlow id="Flow_1s5r7c7" sourceRef="Activity_1ygbeoa" targetRef="Event_1bn5u87"> |
||||||
|
<conditionExpression xsi:type="tFormalExpression">${status==0}</conditionExpression> |
||||||
|
</sequenceFlow> |
||||||
|
<endEvent id="Event_04eisc3" name="结束"> |
||||||
|
<incoming>Flow_0vre5aw</incoming> |
||||||
|
</endEvent> |
||||||
|
<sequenceFlow id="Flow_0vre5aw" sourceRef="Activity_1p56jq4" targetRef="Event_04eisc3"> |
||||||
|
<conditionExpression xsi:type="tFormalExpression">${status==0}</conditionExpression> |
||||||
|
</sequenceFlow> |
||||||
|
<userTask id="Activity_1ygbeoa" name="人事审批" activiti:assignee="${hr}"> |
||||||
|
<extensionElements> |
||||||
|
<activiti:taskListener class="com.zilber.boot.activiti.listen.ApplyTaskListener" event="complete" /> |
||||||
|
<activiti:taskListener class="com.zilber.boot.activiti.listen.ApplyTaskListener" event="create" /> |
||||||
|
</extensionElements> |
||||||
|
<incoming>Flow_1gr0gbv</incoming> |
||||||
|
<outgoing>Flow_0kudbee</outgoing> |
||||||
|
<outgoing>Flow_1s5r7c7</outgoing> |
||||||
|
</userTask> |
||||||
|
<userTask id="Activity_1p56jq4" name="经理审批" activiti:assignee="${manger}"> |
||||||
|
<extensionElements> |
||||||
|
<activiti:taskListener class="com.zilber.boot.activiti.listen.ApplyTaskListener" event="complete" /> |
||||||
|
<activiti:taskListener class="com.zilber.boot.activiti.listen.ApplyTaskListener" event="create" /> |
||||||
|
</extensionElements> |
||||||
|
<incoming>Flow_0v4r83w</incoming> |
||||||
|
<outgoing>Flow_09xp52x</outgoing> |
||||||
|
<outgoing>Flow_0vre5aw</outgoing> |
||||||
|
</userTask> |
||||||
|
<userTask id="Activity_13m5c8m" name="总经理审批" activiti:assignee="${ceo}"> |
||||||
|
<extensionElements> |
||||||
|
<activiti:taskListener class="com.zilber.boot.activiti.listen.ApplyTaskListener" event="create" /> |
||||||
|
<activiti:taskListener class="com.zilber.boot.activiti.listen.ApplyTaskListener" event="complete" /> |
||||||
|
</extensionElements> |
||||||
|
<incoming>Flow_0kudbee</incoming> |
||||||
|
<incoming>Flow_09xp52x</incoming> |
||||||
|
<outgoing>Flow_0f94ru3</outgoing> |
||||||
|
</userTask> |
||||||
|
</process> |
||||||
|
<bpmndi:BPMNDiagram id="BPMNDiagram_daily"> |
||||||
|
<bpmndi:BPMNPlane id="BPMNPlane_daily" bpmnElement="daily"> |
||||||
|
<bpmndi:BPMNShape id="Event_0w0afi8_di" bpmnElement="Event_0w0afi8"> |
||||||
|
<omgdc:Bounds x="442" y="102" width="36" height="36" /> |
||||||
|
<bpmndi:BPMNLabel> |
||||||
|
<omgdc:Bounds x="449" y="78" width="22" height="14" /> |
||||||
|
</bpmndi:BPMNLabel> |
||||||
|
</bpmndi:BPMNShape> |
||||||
|
<bpmndi:BPMNShape id="Activity_0atbqot_di" bpmnElement="Activity_144t788"> |
||||||
|
<omgdc:Bounds x="410" y="180" width="100" height="80" /> |
||||||
|
<bpmndi:BPMNLabel /> |
||||||
|
</bpmndi:BPMNShape> |
||||||
|
<bpmndi:BPMNShape id="Gateway_0de3wfg_di" bpmnElement="Gateway_0de3wfg" isMarkerVisible="true"> |
||||||
|
<omgdc:Bounds x="435" y="315" width="50" height="50" /> |
||||||
|
</bpmndi:BPMNShape> |
||||||
|
<bpmndi:BPMNShape id="Event_16bkb2x_di" bpmnElement="Event_16bkb2x"> |
||||||
|
<omgdc:Bounds x="442" y="752" width="36" height="36" /> |
||||||
|
<bpmndi:BPMNLabel> |
||||||
|
<omgdc:Bounds x="449" y="795" width="22" height="14" /> |
||||||
|
</bpmndi:BPMNLabel> |
||||||
|
</bpmndi:BPMNShape> |
||||||
|
<bpmndi:BPMNShape id="Event_1bn5u87_di" bpmnElement="Event_1bn5u87"> |
||||||
|
<omgdc:Bounds x="152" y="472" width="36" height="36" /> |
||||||
|
<bpmndi:BPMNLabel> |
||||||
|
<omgdc:Bounds x="159" y="515" width="22" height="14" /> |
||||||
|
</bpmndi:BPMNLabel> |
||||||
|
</bpmndi:BPMNShape> |
||||||
|
<bpmndi:BPMNShape id="Event_04eisc3_di" bpmnElement="Event_04eisc3"> |
||||||
|
<omgdc:Bounds x="752" y="472" width="36" height="36" /> |
||||||
|
<bpmndi:BPMNLabel> |
||||||
|
<omgdc:Bounds x="759" y="515" width="22" height="14" /> |
||||||
|
</bpmndi:BPMNLabel> |
||||||
|
</bpmndi:BPMNShape> |
||||||
|
<bpmndi:BPMNShape id="Activity_1ceyxkn_di" bpmnElement="Activity_1ygbeoa"> |
||||||
|
<omgdc:Bounds x="270" y="450" width="100" height="80" /> |
||||||
|
</bpmndi:BPMNShape> |
||||||
|
<bpmndi:BPMNShape id="Activity_16971ee_di" bpmnElement="Activity_1p56jq4"> |
||||||
|
<omgdc:Bounds x="580" y="450" width="100" height="80" /> |
||||||
|
<bpmndi:BPMNLabel /> |
||||||
|
</bpmndi:BPMNShape> |
||||||
|
<bpmndi:BPMNShape id="Activity_1cupe7b_di" bpmnElement="Activity_13m5c8m"> |
||||||
|
<omgdc:Bounds x="410" y="560" width="100" height="80" /> |
||||||
|
<bpmndi:BPMNLabel /> |
||||||
|
</bpmndi:BPMNShape> |
||||||
|
<bpmndi:BPMNEdge id="Flow_1jlgqlw_di" bpmnElement="Flow_1jlgqlw"> |
||||||
|
<omgdi:waypoint x="460" y="138" /> |
||||||
|
<omgdi:waypoint x="460" y="180" /> |
||||||
|
</bpmndi:BPMNEdge> |
||||||
|
<bpmndi:BPMNEdge id="Flow_0ul7x96_di" bpmnElement="Flow_0ul7x96"> |
||||||
|
<omgdi:waypoint x="460" y="260" /> |
||||||
|
<omgdi:waypoint x="460" y="315" /> |
||||||
|
</bpmndi:BPMNEdge> |
||||||
|
<bpmndi:BPMNEdge id="Flow_0v4r83w_di" bpmnElement="Flow_0v4r83w"> |
||||||
|
<omgdi:waypoint x="460" y="365" /> |
||||||
|
<omgdi:waypoint x="460" y="390" /> |
||||||
|
<omgdi:waypoint x="630" y="390" /> |
||||||
|
<omgdi:waypoint x="630" y="450" /> |
||||||
|
</bpmndi:BPMNEdge> |
||||||
|
<bpmndi:BPMNEdge id="Flow_1gr0gbv_di" bpmnElement="Flow_1gr0gbv"> |
||||||
|
<omgdi:waypoint x="460" y="365" /> |
||||||
|
<omgdi:waypoint x="460" y="390" /> |
||||||
|
<omgdi:waypoint x="320" y="390" /> |
||||||
|
<omgdi:waypoint x="320" y="450" /> |
||||||
|
</bpmndi:BPMNEdge> |
||||||
|
<bpmndi:BPMNEdge id="Flow_0kudbee_di" bpmnElement="Flow_0kudbee"> |
||||||
|
<omgdi:waypoint x="320" y="530" /> |
||||||
|
<omgdi:waypoint x="320" y="600" /> |
||||||
|
<omgdi:waypoint x="410" y="600" /> |
||||||
|
</bpmndi:BPMNEdge> |
||||||
|
<bpmndi:BPMNEdge id="Flow_09xp52x_di" bpmnElement="Flow_09xp52x"> |
||||||
|
<omgdi:waypoint x="630" y="530" /> |
||||||
|
<omgdi:waypoint x="630" y="600" /> |
||||||
|
<omgdi:waypoint x="510" y="600" /> |
||||||
|
</bpmndi:BPMNEdge> |
||||||
|
<bpmndi:BPMNEdge id="Flow_0f94ru3_di" bpmnElement="Flow_0f94ru3"> |
||||||
|
<omgdi:waypoint x="460" y="640" /> |
||||||
|
<omgdi:waypoint x="460" y="752" /> |
||||||
|
</bpmndi:BPMNEdge> |
||||||
|
<bpmndi:BPMNEdge id="Flow_1s5r7c7_di" bpmnElement="Flow_1s5r7c7"> |
||||||
|
<omgdi:waypoint x="270" y="490" /> |
||||||
|
<omgdi:waypoint x="188" y="490" /> |
||||||
|
</bpmndi:BPMNEdge> |
||||||
|
<bpmndi:BPMNEdge id="Flow_0vre5aw_di" bpmnElement="Flow_0vre5aw"> |
||||||
|
<omgdi:waypoint x="680" y="490" /> |
||||||
|
<omgdi:waypoint x="752" y="490" /> |
||||||
|
</bpmndi:BPMNEdge> |
||||||
|
</bpmndi:BPMNPlane> |
||||||
|
</bpmndi:BPMNDiagram> |
||||||
|
</definitions> |
Loading…
Reference in new issue