Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzwf
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzwf
提交
7747a234
提交
7747a234
编写于
5月 04, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
工作流编程
上级
fd4af240
变更
8
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
181 行增加
和
43 行删除
+181
-43
ProcessInstanceListener.java
...lab/core/extensions/listener/ProcessInstanceListener.java
+72
-0
WFCoreService.java
...ava/cn/ibizlab/core/extensions/service/WFCoreService.java
+20
-19
WFMemberShipService.java
.../ibizlab/core/extensions/service/WFMemberShipService.java
+45
-0
WFModelService.java
...va/cn/ibizlab/core/extensions/service/WFModelService.java
+6
-4
pom.xml
ibzwf-dependencies/pom.xml
+14
-0
WFCoreResource.java
...n/java/cn/ibizlab/api/rest/extensions/WFCoreResource.java
+11
-11
pom.xml
ibzwf-util/pom.xml
+7
-9
application-sys.yml
ibzwf-util/src/main/resources/application-sys.yml
+6
-0
未找到文件。
ibzwf-core/src/main/java/cn/ibizlab/core/extensions/listener/ProcessInstanceListener.java
0 → 100644
浏览文件 @
7747a234
package
cn
.
ibizlab
.
core
.
extensions
.
listener
;
import
lombok.extern.slf4j.Slf4j
;
import
org.flowable.bpmn.model.UserTask
;
import
org.flowable.common.engine.api.delegate.event.*
;
import
org.flowable.common.engine.api.delegate.event.FlowableEngineEventType
;
import
org.flowable.common.engine.impl.event.FlowableEngineEventImpl
;
import
org.flowable.engine.RepositoryService
;
import
org.flowable.engine.RuntimeService
;
import
org.flowable.engine.delegate.event.impl.FlowableEntityEventImpl
;
import
org.flowable.task.service.impl.persistence.entity.TaskEntity
;
import
org.flowable.task.service.impl.persistence.entity.TaskEntityImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
java.util.List
;
/**
* 流程实例监听器,监听流程实例启动、流转、结束状态
* 1.流程状态发生变化时,将实例信息同步到统一工作流平台
* 2.到达流程节点时,调用统一接口,查询当前节点办理人并设置到引擎中
*/
@Slf4j
@Component
public
class
ProcessInstanceListener
implements
FlowableEventListener
{
@Override
public
void
onEvent
(
FlowableEvent
evt
)
{
if
(
evt
instanceof
FlowableEntityEventImpl
)
{
FlowableEntityEventImpl
event
=((
FlowableEntityEventImpl
)
evt
);
// 当前节点任务实体
// TODO 获取到了taskEntity 自己做每个节点的前置操作
FlowableEventType
eventType
=
event
.
getType
();
//待办创建
if
(
eventType
==
FlowableEngineEventType
.
TASK_CREATED
){
TaskEntity
taskEntity
=
(
TaskEntity
)
event
.
getEntity
();
System
.
out
.
println
(
"创建任务"
);
}
//待办分配
else
if
(
eventType
==
FlowableEngineEventType
.
TASK_ASSIGNED
){
TaskEntity
taskEntity
=
(
TaskEntity
)
event
.
getEntity
();
System
.
out
.
println
(
"分配任务"
);
}
//待办完成
else
if
(
eventType
==
FlowableEngineEventType
.
TASK_COMPLETED
){
TaskEntity
taskEntity
=
(
TaskEntity
)
event
.
getEntity
();
System
.
out
.
println
(
"完成任务"
);
}
}
}
@Override
public
boolean
isFailOnException
()
{
return
false
;
}
@Override
public
boolean
isFireOnTransactionLifecycleEvent
()
{
return
false
;
}
@Override
public
String
getOnTransaction
()
{
return
null
;
}
}
\ No newline at end of file
ibzwf-core/src/main/java/cn/ibizlab/core/extensions/service/WFCoreService.java
浏览文件 @
7747a234
...
...
@@ -5,37 +5,34 @@ import cn.ibizlab.core.workflow.domain.WFProcessInstance;
import
cn.ibizlab.core.workflow.domain.WFProcessNode
;
import
cn.ibizlab.core.workflow.domain.WFTaskWay
;
import
cn.ibizlab.core.workflow.service.IWFProcessDefinitionService
;
import
cn.ibizlab.util.domain.EntityBase
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.security.AuthenticationUser
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.activiti.api.process.runtime.ProcessRuntime
;
import
org.activiti.api.task.runtime.TaskRuntime
;
import
org.activiti.bpmn.model.FlowElement
;
import
org.activiti.bpmn.model.SequenceFlow
;
import
org.activiti.bpmn.model.UserTask
;
import
org.activiti.engine.HistoryService
;
import
org.activiti.engine.RepositoryService
;
import
org.activiti.engine.RuntimeService
;
import
org.activiti.engine.TaskService
;
import
org.activiti.engine.delegate.DelegateExecution
;
import
org.activiti.engine.impl.identity.Authentication
;
import
org.activiti.engine.repository.ProcessDefinition
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.Task
;
import
org.activiti.engine.task.TaskQuery
;
import
org.flowable.bpmn.model.FlowElement
;
import
org.flowable.bpmn.model.SequenceFlow
;
import
org.flowable.bpmn.model.UserTask
;
import
org.flowable.common.engine.impl.identity.Authentication
;
import
org.flowable.engine.HistoryService
;
import
org.flowable.engine.RepositoryService
;
import
org.flowable.engine.RuntimeService
;
import
org.flowable.engine.TaskService
;
import
org.flowable.engine.delegate.DelegateExecution
;
import
org.flowable.engine.repository.ProcessDefinition
;
import
org.flowable.engine.runtime.ProcessInstance
;
import
org.flowable.task.api.Task
;
import
org.flowable.task.api.TaskQuery
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.sql.Timestamp
;
import
java.util.*
;
@Service
public
class
WFCoreService
{
@Autowired
private
ProcessRuntime
processRuntime
;
@Autowired
private
TaskRuntime
taskRuntime
;
@Autowired
private
RepositoryService
repositoryService
;
@Autowired
...
...
@@ -295,4 +292,8 @@ public class WFCoreService
return
new
Timestamp
(
new
java
.
util
.
Date
().
getTime
());
}
public
String
getGroupUsers
(
String
groupId
,
AuthenticationUser
user
,
EntityBase
activedata
)
{
return
"ibzadmin|123456"
;
}
}
ibzwf-core/src/main/java/cn/ibizlab/core/extensions/service/WFMemberShipService.java
0 → 100644
浏览文件 @
7747a234
package
cn
.
ibizlab
.
core
.
extensions
.
service
;
import
cn.ibizlab.core.workflow.domain.WFGroup
;
import
cn.ibizlab.core.workflow.domain.WFProcessDefinition
;
import
cn.ibizlab.core.workflow.service.IWFGroupService
;
import
cn.ibizlab.core.workflow.service.IWFMemberService
;
import
cn.ibizlab.core.workflow.service.IWFProcessDefinitionService
;
import
cn.ibizlab.core.workflow.service.IWFUserService
;
import
cn.ibizlab.util.domain.EntityBase
;
import
cn.ibizlab.util.security.AuthenticationUser
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.flowable.bpmn.model.FlowElement
;
import
org.flowable.bpmn.model.UserTask
;
import
org.flowable.engine.RepositoryService
;
import
org.flowable.engine.repository.ProcessDefinition
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.*
;
@Service
public
class
WFMemberShipService
{
@Autowired
private
IWFGroupService
iwfGroupService
;
@Autowired
private
IWFMemberService
memberService
;
@Autowired
private
IWFUserService
iwfUserService
;
public
List
<
String
>
getUsersByGroupByPOrg
(
String
groupId
,
AuthenticationUser
user
,
EntityBase
activedata
)
{
List
<
String
>
users
=
new
ArrayList
<>();
WFGroup
group
=
iwfGroupService
.
get
(
groupId
);
if
(
StringUtils
.
isEmpty
(
group
.
getGroupscope
()))
return
users
;
return
users
;
}
}
ibzwf-core/src/main/java/cn/ibizlab/core/extensions/service/WFModelService.java
浏览文件 @
7747a234
...
...
@@ -4,15 +4,17 @@ import cn.ibizlab.core.workflow.domain.WFProcessDefinition;
import
cn.ibizlab.core.workflow.domain.WFProcessNode
;
import
cn.ibizlab.core.workflow.service.IWFProcessDefinitionService
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.
activiti
.bpmn.model.FlowElement
;
import
org.
activiti
.bpmn.model.UserTask
;
import
org.
activiti
.engine.RepositoryService
;
import
org.
activiti
.engine.repository.ProcessDefinition
;
import
org.
flowable
.bpmn.model.FlowElement
;
import
org.
flowable
.bpmn.model.UserTask
;
import
org.
flowable
.engine.RepositoryService
;
import
org.
flowable
.engine.repository.ProcessDefinition
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.*
;
@Service
public
class
WFModelService
{
...
...
ibzwf-dependencies/pom.xml
浏览文件 @
7747a234
...
...
@@ -49,6 +49,8 @@
<!-- Activity -->
<activiti.version>
7.1.0.M2
</activiti.version>
<flowable.version>
6.4.2
</flowable.version>
<maven-jar-plugin.version>
3.1.1
</maven-jar-plugin.version>
<!--logstash-logback-encoder-->
<logstash.version>
5.2
</logstash.version>
...
...
@@ -181,6 +183,18 @@
<version>
${activiti.version}
</version>
</dependency>
<dependency>
<groupId>
org.flowable
</groupId>
<artifactId>
flowable-spring-boot-starter
</artifactId>
<version>
${flowable.version}
</version>
</dependency>
<dependency>
<groupId>
org.flowable
</groupId>
<artifactId>
flowable-json-converter
</artifactId>
<version>
${flowable.version}
</version>
</dependency>
<!-- Error -->
<!-- Security -->
...
...
ibzwf-provider/ibzwf-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/WFCoreResource.java
浏览文件 @
7747a234
...
...
@@ -25,54 +25,54 @@ public class WFCoreResource
@ApiOperation
(
value
=
"getWFProcessDefinition"
,
tags
=
{
"WFProcessDefinition"
},
notes
=
"根据系统实体查找当前适配的工作流模型"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/
wfcore/
{system}-app-{appname}/{entity}/process-definitions"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/{system}-app-{appname}/{entity}/process-definitions"
)
public
ResponseEntity
<
List
<
WFProcessDefinition
>>
getworkflow
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
null
);
}
@ApiOperation
(
value
=
"getStepByEntity"
,
tags
=
{
"WFProcessNode"
},
notes
=
"根据系统实体查找当前适配的工作流模型步骤"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/
wfcore/
{system}-app-{appname}/{entity}/process-definitions-nodes"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/{system}-app-{appname}/{entity}/process-definitions-nodes"
)
public
ResponseEntity
<
List
<
WFProcessNode
>>
getwfstep
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
null
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
getWFStep
(
system
,
appname
,
entity
)
);
}
@PreAuthorize
(
"hasPermission(#entity,'WFSTART',this.getEntity())"
)
@ApiOperation
(
value
=
"wfstart"
,
tags
=
{
"WFProcessInstance"
},
notes
=
"启动工作流"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/
wfcore/
{system}-app-{appname}/{entity}/{businessKey}/process-instances"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/{system}-app-{appname}/{entity}/{businessKey}/process-instances"
)
public
ResponseEntity
<
WFProcessInstance
>
wfstart
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"businessKey"
)
String
businessKey
,
@RequestBody
WFProcessInstance
instance
)
{
instance
.
setBusinesskey
(
businessKey
);
return
ResponseEntity
.
ok
(
instance
);
return
ResponseEntity
.
ok
(
wfCoreService
.
wfStart
(
system
,
appname
,
entity
,
businessKey
,
instance
)
);
}
@ApiOperation
(
value
=
"getWayByBusinessKey"
,
tags
=
{
"WFTaskWay"
},
notes
=
"根据业务主键和当前步骤获取操作路径"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/
wfcore/
{system}-app-{appname}/{entity}/{businessKey}/usertasks/{taskDefinitionKey}/ways"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/{system}-app-{appname}/{entity}/{businessKey}/usertasks/{taskDefinitionKey}/ways"
)
public
ResponseEntity
<
List
<
WFTaskWay
>>
getwflink
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"businessKey"
)
String
businessKey
,
@PathVariable
(
"taskDefinitionKey"
)
String
taskDefinitionKey
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
null
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
getWFLink
(
system
,
appname
,
entity
,
businessKey
,
taskDefinitionKey
)
);
}
@ApiOperation
(
value
=
"getWayByTaskId"
,
tags
=
{
"WFTaskWay"
},
notes
=
"根据业务主键和当前步骤获取操作路径"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/
wfcore/
{system}-app-{appname}/{entity}/{businessKey}/tasks/{taskId}/ways"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/{system}-app-{appname}/{entity}/{businessKey}/tasks/{taskId}/ways"
)
public
ResponseEntity
<
List
<
WFTaskWay
>>
gettasklink
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"businessKey"
)
String
businessKey
,
@PathVariable
(
"taskId"
)
String
taskId
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
null
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
getTaskLink
(
system
,
appname
,
entity
,
businessKey
,
taskId
)
);
}
@PreAuthorize
(
"hasPermission(#entity,'WFSTART',this.getEntity())"
)
@ApiOperation
(
value
=
"wfsubmit"
,
tags
=
{
"WFProcessInstance"
},
notes
=
"工作流执行步骤"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/
wfcore/
{system}-app-{appname}/{entity}/{businessKey}/tasks/{taskId}"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/{system}-app-{appname}/{entity}/{businessKey}/tasks/{taskId}"
)
public
ResponseEntity
<
WFProcessInstance
>
wfsubmit
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"businessKey"
)
String
businessKey
,
@PathVariable
(
"taskId"
)
String
taskId
,
@RequestBody
WFTaskWay
taskWay
)
{
WFProcessInstance
instance
=
new
WFProcessInstance
();
return
ResponseEntity
.
ok
(
instance
);
return
ResponseEntity
.
ok
(
wfCoreService
.
wfsubmit
(
system
,
appname
,
entity
,
businessKey
,
taskId
,
taskWay
)
);
}
...
...
ibzwf-util/pom.xml
浏览文件 @
7747a234
...
...
@@ -54,19 +54,17 @@
<artifactId>
problem-spring-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.activiti
</groupId>
<artifactId>
activiti-spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.
activiti
</groupId>
<artifactId>
activiti-json-conve
rter
</artifactId>
<groupId>
org.
flowable
</groupId>
<artifactId>
flowable-spring-boot-sta
rter
</artifactId>
</dependency>
<dependency>
<groupId>
org.
activiti
</groupId>
<artifactId>
activiti-image-generato
r
</artifactId>
<groupId>
org.
flowable
</groupId>
<artifactId>
flowable-json-converte
r
</artifactId>
</dependency>
</dependencies>
</project>
ibzwf-util/src/main/resources/application-sys.yml
浏览文件 @
7747a234
...
...
@@ -31,6 +31,12 @@ spring:
defaultSchema
:
a_A_5d9d78509
conf
:
classpath:liquibase/master.xml
flowable
:
#关闭定时任务JOB
async-executor-activate
:
false
# 将databaseSchemaUpdate设置为true。当Flowable发现库与数据库表结构不一致时,会自动将数据库表结构升级至新版本。
database-schema-update
:
true
#Mybatis-plus配置
mybatis-plus
:
global-config
:
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录