Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
e60994cc
Commit
e60994cc
authored
Dec 03, 2017
by
naan1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加流程图并测试
parent
098eee7d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
251 additions
and
5 deletions
+251
-5
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/handler/ManagerTaskHandler.java
+31
-0
guns-admin/src/main/resources/processes/ExpenseProcess.bpmn20.xml
+107
-0
guns-admin/src/test/java/com/stylefeng/guns/flowable/FlowableTest.java
+6
-5
guns-admin/src/test/resources/ExpenseProcess.bpmn20.xml
+107
-0
No files found.
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/handler/ManagerTaskHandler.java
0 → 100644
View file @
e60994cc
package
com
.
stylefeng
.
guns
.
modular
.
flowable
.
handler
;
import
com.stylefeng.guns.core.shiro.ShiroKit
;
import
com.stylefeng.guns.core.shiro.ShiroUser
;
import
org.flowable.engine.delegate.TaskListener
;
import
org.flowable.task.service.delegate.DelegateTask
;
/**
* 员工经理任务分配
*/
public
class
ManagerTaskHandler
implements
TaskListener
{
@Override
public
void
notify
(
DelegateTask
delegateTask
)
{
/**
* 获取当前用户
*/
ShiroUser
user
=
ShiroKit
.
getUser
();
/**
* 获取当前用户的上一级领导
*/
Integer
deptId
=
user
.
getDeptId
();
/**
* 设置个人任务的办理人
*/
delegateTask
.
setAssignee
(
""
);
}
}
guns-admin/src/main/resources/processes/ExpenseProcess.bpmn20.xml
0 → 100644
View file @
e60994cc
<?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:flowable=
"http://flowable.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.flowable.org/processdef"
>
<process
id=
"Expense"
name=
"ExpenseProcess"
isExecutable=
"true"
>
<documentation>
报销流程
</documentation>
<startEvent
id=
"start"
name=
"开始
"
></startEvent>
<userTask
id=
"fillTask"
name=
"出差报销"
flowable:assignee=
"${taskUser}"
>
<extensionElements>
<modeler:initiator-can-complete
xmlns:modeler=
"http://flowable.org/modeler"
>
<![CDATA[false]]>
</modeler:initiator-can-complete>
</extensionElements>
</userTask>
<exclusiveGateway
id=
"judgeTask"
></exclusiveGateway>
<userTask
id=
"directorTak"
name=
"经理审批"
>
<extensionElements>
<flowable:taskListener
event=
"create"
class=
"com.stylefeng.guns.modular.flowable.handler.ManagerTaskHandler"
></flowable:taskListener>
</extensionElements>
</userTask>
<userTask
id=
"bossTask"
name=
"老板审批"
>
<extensionElements>
<flowable:taskListener
event=
"create"
class=
"com.stylefeng.guns.modular.flowable.handler.ManagerTaskHandler"
></flowable:taskListener>
</extensionElements>
</userTask>
<endEvent
id=
"end"
name=
"结束"
></endEvent>
<sequenceFlow
id=
"directorNotPassFlow"
name=
"驳回"
sourceRef=
"directorTak"
targetRef=
"fillTask"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${outcome=='驳回'}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"bossNotPassFlow"
name=
"驳回"
sourceRef=
"bossTask"
targetRef=
"fillTask"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${outcome=='驳回'}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"flow1"
sourceRef=
"start"
targetRef=
"fillTask"
></sequenceFlow>
<sequenceFlow
id=
"flow2"
sourceRef=
"fillTask"
targetRef=
"judgeTask"
></sequenceFlow>
<sequenceFlow
id=
"judgeMore"
name=
"大于500元"
sourceRef=
"judgeTask"
targetRef=
"bossTask"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${money}>500]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"bossPassFlow"
name=
"通过"
sourceRef=
"bossTask"
targetRef=
"end"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${outcome=='通过'}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"directorPassFlow"
name=
"通过"
sourceRef=
"directorTak"
targetRef=
"end"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${outcome=='通过'}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"judgeLess"
name=
"小于500元"
sourceRef=
"judgeTask"
targetRef=
"directorTak"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${money}<=500]]>
</conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram
id=
"BPMNDiagram_Expense"
>
<bpmndi:BPMNPlane
bpmnElement=
"Expense"
id=
"BPMNPlane_Expense"
>
<bpmndi:BPMNShape
bpmnElement=
"start"
id=
"BPMNShape_start"
>
<omgdc:Bounds
height=
"30.0"
width=
"30.0"
x=
"285.0"
y=
"135.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape
bpmnElement=
"fillTask"
id=
"BPMNShape_fillTask"
>
<omgdc:Bounds
height=
"80.0"
width=
"100.0"
x=
"405.0"
y=
"110.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape
bpmnElement=
"judgeTask"
id=
"BPMNShape_judgeTask"
>
<omgdc:Bounds
height=
"40.0"
width=
"40.0"
x=
"585.0"
y=
"130.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape
bpmnElement=
"directorTak"
id=
"BPMNShape_directorTak"
>
<omgdc:Bounds
height=
"80.0"
width=
"100.0"
x=
"735.0"
y=
"110.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape
bpmnElement=
"bossTask"
id=
"BPMNShape_bossTask"
>
<omgdc:Bounds
height=
"80.0"
width=
"100.0"
x=
"555.0"
y=
"255.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape
bpmnElement=
"end"
id=
"BPMNShape_end"
>
<omgdc:Bounds
height=
"28.0"
width=
"28.0"
x=
"771.0"
y=
"281.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge
bpmnElement=
"flow1"
id=
"BPMNEdge_flow1"
>
<omgdi:waypoint
x=
"315.0"
y=
"150.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"405.0"
y=
"150.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"flow2"
id=
"BPMNEdge_flow2"
>
<omgdi:waypoint
x=
"505.0"
y=
"150.16611295681062"
></omgdi:waypoint>
<omgdi:waypoint
x=
"585.4333333333333"
y=
"150.43333333333334"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"judgeLess"
id=
"BPMNEdge_judgeLess"
>
<omgdi:waypoint
x=
"624.5530726256983"
y=
"150.44692737430168"
></omgdi:waypoint>
<omgdi:waypoint
x=
"735.0"
y=
"150.1392757660167"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"directorNotPassFlow"
id=
"BPMNEdge_directorNotPassFlow"
>
<omgdi:waypoint
x=
"785.0"
y=
"110.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"785.0"
y=
"37.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"455.0"
y=
"37.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"455.0"
y=
"110.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"bossPassFlow"
id=
"BPMNEdge_bossPassFlow"
>
<omgdi:waypoint
x=
"655.0"
y=
"295.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"771.0"
y=
"295.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"judgeMore"
id=
"BPMNEdge_judgeMore"
>
<omgdi:waypoint
x=
"605.4340277777778"
y=
"169.56597222222223"
></omgdi:waypoint>
<omgdi:waypoint
x=
"605.1384083044983"
y=
"255.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"directorPassFlow"
id=
"BPMNEdge_directorPassFlow"
>
<omgdi:waypoint
x=
"785.0"
y=
"190.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"785.0"
y=
"281.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"bossNotPassFlow"
id=
"BPMNEdge_bossNotPassFlow"
>
<omgdi:waypoint
x=
"555.0"
y=
"295.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"455.0"
y=
"295.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"455.0"
y=
"190.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
\ No newline at end of file
guns-admin/src/test/java/com/stylefeng/guns/flowable/FlowableTest.java
View file @
e60994cc
...
...
@@ -28,7 +28,7 @@ public class FlowableTest {
@Before
public
void
init
()
{
ProcessEngineConfiguration
cfg
=
new
StandaloneProcessEngineConfiguration
()
.
setJdbcUrl
(
"jdbc:mysql://127.0.0.1:3306/flowable?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull"
)
.
setJdbcUrl
(
"jdbc:mysql://127.0.0.1:3306/
guns_
flowable?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull"
)
.
setJdbcUsername
(
"root"
)
.
setJdbcPassword
(
"root"
)
.
setJdbcDriver
(
"com.mysql.jdbc.Driver"
)
...
...
@@ -44,7 +44,7 @@ public class FlowableTest {
public
void
deploy
()
{
RepositoryService
repositoryService
=
processEngine
.
getRepositoryService
();
Deployment
deployment
=
repositoryService
.
createDeployment
()
.
addClasspathResource
(
"
holiday-request
.bpmn20.xml"
)
.
addClasspathResource
(
"
ExpenseProcess
.bpmn20.xml"
)
.
deploy
();
ProcessDefinition
processDefinition
=
repositoryService
.
createProcessDefinitionQuery
()
...
...
@@ -58,7 +58,9 @@ public class FlowableTest {
*/
@Test
public
void
start
()
{
ProcessInstance
processInstance
=
processEngine
.
getRuntimeService
().
startProcessInstanceByKey
(
"holidayRequest"
);
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"taskUser"
,
"fsn"
);
ProcessInstance
processInstance
=
processEngine
.
getRuntimeService
().
startProcessInstanceByKey
(
"Expense"
,
map
);
System
.
out
.
println
(
"pid = "
+
processInstance
.
getId
());
System
.
out
.
println
(
"activityId = "
+
processInstance
.
getActivityId
());
System
.
out
.
println
(
"getProcessDefinitionId = "
+
processInstance
.
getProcessDefinitionId
());
...
...
@@ -89,8 +91,7 @@ public class FlowableTest {
*/
@Test
public
void
delProcess
()
{
processEngine
.
getRepositoryService
().
deleteDeployment
(
"22501"
,
true
);
processEngine
.
getRepositoryService
().
deleteDeployment
(
"25001"
,
true
);
processEngine
.
getRepositoryService
().
deleteDeployment
(
"1"
,
true
);
System
.
out
.
println
(
"删除成功"
);
}
...
...
guns-admin/src/test/resources/ExpenseProcess.bpmn20.xml
0 → 100644
View file @
e60994cc
<?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:flowable=
"http://flowable.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.flowable.org/processdef"
>
<process
id=
"Expense"
name=
"ExpenseProcess"
isExecutable=
"true"
>
<documentation>
报销流程
</documentation>
<startEvent
id=
"start"
name=
"开始
"
></startEvent>
<userTask
id=
"fillTask"
name=
"出差报销"
flowable:assignee=
"${taskUser}"
>
<extensionElements>
<modeler:initiator-can-complete
xmlns:modeler=
"http://flowable.org/modeler"
>
<![CDATA[false]]>
</modeler:initiator-can-complete>
</extensionElements>
</userTask>
<exclusiveGateway
id=
"judgeTask"
></exclusiveGateway>
<userTask
id=
"directorTak"
name=
"经理审批"
>
<extensionElements>
<flowable:taskListener
event=
"create"
class=
"com.stylefeng.guns.modular.flowable.handler.ManagerTaskHandler"
></flowable:taskListener>
</extensionElements>
</userTask>
<userTask
id=
"bossTask"
name=
"老板审批"
>
<extensionElements>
<flowable:taskListener
event=
"create"
class=
"com.stylefeng.guns.modular.flowable.handler.ManagerTaskHandler"
></flowable:taskListener>
</extensionElements>
</userTask>
<endEvent
id=
"end"
name=
"结束"
></endEvent>
<sequenceFlow
id=
"directorNotPassFlow"
name=
"驳回"
sourceRef=
"directorTak"
targetRef=
"fillTask"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${outcome=='驳回'}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"bossNotPassFlow"
name=
"驳回"
sourceRef=
"bossTask"
targetRef=
"fillTask"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${outcome=='驳回'}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"flow1"
sourceRef=
"start"
targetRef=
"fillTask"
></sequenceFlow>
<sequenceFlow
id=
"flow2"
sourceRef=
"fillTask"
targetRef=
"judgeTask"
></sequenceFlow>
<sequenceFlow
id=
"judgeMore"
name=
"大于500元"
sourceRef=
"judgeTask"
targetRef=
"bossTask"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${money}>500]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"bossPassFlow"
name=
"通过"
sourceRef=
"bossTask"
targetRef=
"end"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${outcome=='通过'}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"directorPassFlow"
name=
"通过"
sourceRef=
"directorTak"
targetRef=
"end"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${outcome=='通过'}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"judgeLess"
name=
"小于500元"
sourceRef=
"judgeTask"
targetRef=
"directorTak"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${money}<=500]]>
</conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram
id=
"BPMNDiagram_Expense"
>
<bpmndi:BPMNPlane
bpmnElement=
"Expense"
id=
"BPMNPlane_Expense"
>
<bpmndi:BPMNShape
bpmnElement=
"start"
id=
"BPMNShape_start"
>
<omgdc:Bounds
height=
"30.0"
width=
"30.0"
x=
"285.0"
y=
"135.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape
bpmnElement=
"fillTask"
id=
"BPMNShape_fillTask"
>
<omgdc:Bounds
height=
"80.0"
width=
"100.0"
x=
"405.0"
y=
"110.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape
bpmnElement=
"judgeTask"
id=
"BPMNShape_judgeTask"
>
<omgdc:Bounds
height=
"40.0"
width=
"40.0"
x=
"585.0"
y=
"130.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape
bpmnElement=
"directorTak"
id=
"BPMNShape_directorTak"
>
<omgdc:Bounds
height=
"80.0"
width=
"100.0"
x=
"735.0"
y=
"110.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape
bpmnElement=
"bossTask"
id=
"BPMNShape_bossTask"
>
<omgdc:Bounds
height=
"80.0"
width=
"100.0"
x=
"555.0"
y=
"255.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape
bpmnElement=
"end"
id=
"BPMNShape_end"
>
<omgdc:Bounds
height=
"28.0"
width=
"28.0"
x=
"771.0"
y=
"281.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge
bpmnElement=
"flow1"
id=
"BPMNEdge_flow1"
>
<omgdi:waypoint
x=
"315.0"
y=
"150.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"405.0"
y=
"150.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"flow2"
id=
"BPMNEdge_flow2"
>
<omgdi:waypoint
x=
"505.0"
y=
"150.16611295681062"
></omgdi:waypoint>
<omgdi:waypoint
x=
"585.4333333333333"
y=
"150.43333333333334"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"judgeLess"
id=
"BPMNEdge_judgeLess"
>
<omgdi:waypoint
x=
"624.5530726256983"
y=
"150.44692737430168"
></omgdi:waypoint>
<omgdi:waypoint
x=
"735.0"
y=
"150.1392757660167"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"directorNotPassFlow"
id=
"BPMNEdge_directorNotPassFlow"
>
<omgdi:waypoint
x=
"785.0"
y=
"110.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"785.0"
y=
"37.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"455.0"
y=
"37.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"455.0"
y=
"110.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"bossPassFlow"
id=
"BPMNEdge_bossPassFlow"
>
<omgdi:waypoint
x=
"655.0"
y=
"295.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"771.0"
y=
"295.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"judgeMore"
id=
"BPMNEdge_judgeMore"
>
<omgdi:waypoint
x=
"605.4340277777778"
y=
"169.56597222222223"
></omgdi:waypoint>
<omgdi:waypoint
x=
"605.1384083044983"
y=
"255.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"directorPassFlow"
id=
"BPMNEdge_directorPassFlow"
>
<omgdi:waypoint
x=
"785.0"
y=
"190.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"785.0"
y=
"281.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"bossNotPassFlow"
id=
"BPMNEdge_bossNotPassFlow"
>
<omgdi:waypoint
x=
"555.0"
y=
"295.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"455.0"
y=
"295.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"455.0"
y=
"190.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment