Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzwf
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzwf
提交
f832715e
提交
f832715e
编写于
11月 16, 2022
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
同步动态版工作流能力:
1、支持流程启动表单、流程辅助功能表单配置。 2、支持工作流超时配置。 3、支持流程版本启用配置。 4、优化计算待办任务处理页逻辑。 5、支持流程跳转、流程重启、流程撤回。
上级
77a4786c
变更
4
展开全部
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
422 行增加
和
52 行删除
+422
-52
ProcessInstanceListener.java
...workflow/extensions/listener/ProcessInstanceListener.java
+52
-8
WFCoreService.java
...izlab/core/workflow/extensions/service/WFCoreService.java
+329
-35
WFCoreResource.java
...n/java/cn/ibizlab/api/rest/extensions/WFCoreResource.java
+35
-7
ProcFunction.java
...til/src/main/java/cn/ibizlab/util/enums/ProcFunction.java
+6
-2
未找到文件。
ibzwf-core/src/main/java/cn/ibizlab/core/workflow/extensions/listener/ProcessInstanceListener.java
浏览文件 @
f832715e
...
...
@@ -5,19 +5,18 @@ import cn.ibizlab.core.workflow.extensions.domain.FlowUser;
import
cn.ibizlab.core.workflow.extensions.service.WFCoreService
;
import
cn.ibizlab.core.workflow.extensions.service.WFModelService
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.security.AuthenticationUser
;
import
cn.ibizlab.util.service.RemoteService
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.flowable.bpmn.model.FormProperty
;
import
org.flowable.bpmn.model.UserTask
;
import
org.flowable.common.engine.api.delegate.event.AbstractFlowableEventListener
;
import
org.flowable.common.engine.api.delegate.event.FlowableEngineEventType
;
import
org.flowable.common.engine.api.delegate.event.FlowableEvent
;
import
org.flowable.common.engine.api.delegate.event.FlowableEventType
;
import
org.flowable.common.engine.api.delegate.event.*
;
import
org.flowable.common.engine.impl.event.FlowableEntityEventImpl
;
import
org.flowable.engine.TaskService
;
import
org.flowable.engine.delegate.DelegateExecution
;
import
org.flowable.engine.delegate.event.FlowableProcessEngineEvent
;
import
org.flowable.engine.delegate.event.impl.FlowableActivityEventImpl
;
import
org.flowable.engine.delegate.event.impl.FlowableEntityWithVariablesEventImpl
;
import
org.flowable.engine.delegate.event.impl.FlowableMultiInstanceActivityEventImpl
;
...
...
@@ -25,9 +24,11 @@ import org.flowable.engine.delegate.event.impl.FlowableProcessStartedEventImpl;
import
org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl
;
import
org.flowable.identitylink.api.IdentityLinkType
;
import
org.flowable.identitylink.service.impl.persistence.entity.IdentityLinkEntity
;
import
org.flowable.job.service.impl.persistence.entity.JobEntity
;
import
org.flowable.task.api.Task
;
import
org.flowable.task.service.impl.persistence.entity.TaskEntity
;
import
org.flowable.task.service.impl.persistence.entity.TaskEntityImpl
;
import
org.flowable.ui.common.service.exception.BadRequestException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.expression.MapAccessor
;
...
...
@@ -46,7 +47,6 @@ import java.util.*;
@Component
public
class
ProcessInstanceListener
extends
AbstractFlowableEventListener
{
@Autowired
@Lazy
private
WFModelService
wfModelService
;
...
...
@@ -138,7 +138,7 @@ public class ProcessInstanceListener extends AbstractFlowableEventListener {
}
}
}
else
if
(
evt
instanceof
org
.
flowable
.
engine
.
delegate
.
event
.
impl
.
FlowableMultiInstanceActivityEventImpl
){
else
if
(
evt
instanceof
FlowableMultiInstanceActivityEventImpl
){
try
{
FlowableMultiInstanceActivityEventImpl
event
=
(
FlowableMultiInstanceActivityEventImpl
)
evt
;
// 多实例(会签)
...
...
@@ -319,7 +319,6 @@ public class ProcessInstanceListener extends AbstractFlowableEventListener {
String
token
=
curUser
.
getToken
();
remoteService
.
getClient
(
cloudServiceid
).
put
(
entity
+
"/"
+
businessKey
,
token
,
callbackArg
);
}
System
.
out
.
println
(
"流程结束"
);
}
}
...
...
@@ -395,6 +394,52 @@ public class ProcessInstanceListener extends AbstractFlowableEventListener {
}
}
}
//超时处理
else
if
(
evt
instanceof
FlowableEngineEntityEvent
&&
FlowableEngineEventType
.
TIMER_FIRED
==
evt
.
getType
())
{
FlowableEngineEntityEvent
event
=
(
FlowableEngineEntityEvent
)
evt
;
if
(
event
.
getEntity
()
==
null
||
!(
event
.
getEntity
()
instanceof
JobEntity
)){
throw
new
BadRequestException
(
"执行工作流超时发生错误,超时作业参数格式不正确"
);
}
JobEntity
jobEntity
=
(
JobEntity
)
event
.
getEntity
();
String
strTenantId
=
jobEntity
.
getTenantId
();
if
(
StringUtils
.
isEmpty
(
strTenantId
)){
throw
new
BadRequestException
(
String
.
format
(
"执行超时作业[%s]发生异常,超时作业未配置租户标识"
,
jobEntity
.
getId
()));
}
DelegateExecution
delegateExecution
=
getDelegateExecution
(
event
,
false
);
Object
systemId
=
delegateExecution
.
getVariable
(
"system"
);
if
(
ObjectUtils
.
isEmpty
(
systemId
)){
throw
new
BadRequestException
(
"执行超时作业[%s]发生异常,未能从流程实例变量中获取系统标识"
,
jobEntity
.
getId
());
}
//构造超时用户身份
AuthenticationUser
user
=
AuthenticationUser
.
setAuthenticationUser
(
"SYSTEM"
,
"内置用户"
);
user
.
setSrfsystemid
(
systemId
.
toString
());
user
.
setSrfdcid
(
strTenantId
);
}
}
/**
* 获取流程执行器
* @param evt
* @param bTryMode
* @return
*/
protected
DelegateExecution
getDelegateExecution
(
FlowableEvent
evt
,
boolean
bTryMode
)
{
DelegateExecution
delegateExecution
=
null
;
if
(
evt
instanceof
FlowableProcessEngineEvent
)
{
delegateExecution
=
((
FlowableProcessEngineEvent
)
evt
).
getExecution
();
if
(
delegateExecution
!=
null
)
{
return
delegateExecution
;
}
}
if
(
bTryMode
)
{
return
null
;
}
throw
new
BadRequestException
(
String
.
format
(
"上下文执行对象无效"
));
}
@Override
...
...
@@ -402,5 +447,4 @@ public class ProcessInstanceListener extends AbstractFlowableEventListener {
return
true
;
}
}
\ No newline at end of file
ibzwf-core/src/main/java/cn/ibizlab/core/workflow/extensions/service/WFCoreService.java
浏览文件 @
f832715e
此差异已折叠。
点击以展开。
ibzwf-provider/ibzwf-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/WFCoreResource.java
浏览文件 @
f832715e
...
...
@@ -297,7 +297,7 @@ public class WFCoreResource
if
(
StringUtils
.
isEmpty
(
path
))
throw
new
BadRequestAlertException
(
"未找到待办任务处理页"
,
""
,
""
);
return
ResponseEntity
.
status
(
HttpStatus
.
MOVED_PERMANENTLY
).
header
(
HttpHeaders
.
LOCATION
,
path
).
build
(
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
path
);
}
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/deploybpmn"
)
...
...
@@ -305,6 +305,27 @@ public class WFCoreResource
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
wfdeploybpmns
(
bpmnfiles
));
}
@ApiOperation
(
value
=
"withDraw"
,
tags
=
{
"withDraw"
},
notes
=
"根据实例将流程撤回前一步"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/{system}-app-{appname}/{entity}/{businessKey}/tasks/{taskId}/withdraw"
)
public
ResponseEntity
<
Boolean
>
withDraw
(
@PathVariable
(
"taskId"
)
String
taskId
,
@RequestBody
WFTaskWay
taskWay
){
return
ResponseEntity
.
ok
(
wfCoreService
.
withDraw
(
taskId
,
taskWay
));
}
@ApiOperation
(
value
=
"dataAccessMode"
,
tags
=
{
"流程跳转"
},
notes
=
"流程跳转"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/{system}-{entity}/{businessKey}/process-instances/{processInstanceId}/jump"
)
public
ResponseEntity
<
Boolean
>
jump
(
@PathVariable
(
"processInstanceId"
)
String
processInstanceId
,
@RequestBody
WFProcessInstance
instance
)
{
instance
.
setId
(
processInstanceId
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
jump
(
instance
));
}
@ApiOperation
(
value
=
"restartwf"
,
tags
=
{
"重启流程"
},
notes
=
"重启流程"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/{system}-{entity}/{businessKey}/process-instances/{processInstanceId}/restart"
)
public
ResponseEntity
<
Boolean
>
restart
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"businessKey"
)
String
businessKey
,
@PathVariable
(
"processInstanceId"
)
String
processInstanceId
,
@RequestBody
WFProcessInstance
instance
)
{
instance
.
setId
(
processInstanceId
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
restart
(
system
,
entity
,
businessKey
,
instance
));
}
@ApiOperation
(
value
=
"前加签任务"
,
tags
=
{
"工作流前加签任务"
}
,
notes
=
"前加签任务"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/{system}-app-{appname}/{entity}/{businessKey}/tasks/{taskId}/beforesign"
)
public
ResponseEntity
<
Boolean
>
beforeSign
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
...
...
@@ -314,15 +335,22 @@ public class WFCoreResource
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
beforeSign
(
system
,
appname
,
entity
,
businessKey
,
taskId
,
taskWay
));
}
@ApiOperation
(
value
=
"
后加签任务"
,
tags
=
{
"工作流后加签任务"
},
notes
=
"前加签
任务"
)
@ApiOperation
(
value
=
"
转办任务"
,
tags
=
{
"工作流转办任务"
},
notes
=
"转办
任务"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/{system}-app-{appname}/{entity}/{businessKey}/tasks/{taskId}/transfer"
)
public
ResponseEntity
<
Boolean
>
afterS
ign
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"businessKey"
)
String
businessKey
,
@PathVariable
(
"taskId"
)
String
taskId
,
@RequestBody
WFTaskWay
taskWay
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
afterS
ign
(
system
,
appname
,
entity
,
businessKey
,
taskId
,
taskWay
));
public
ResponseEntity
<
Boolean
>
reass
ign
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"businessKey"
)
String
businessKey
,
@PathVariable
(
"taskId"
)
String
taskId
,
@RequestBody
WFTaskWay
taskWay
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
reass
ign
(
system
,
appname
,
entity
,
businessKey
,
taskId
,
taskWay
));
}
@ApiOperation
(
value
=
"将文件抄送给选定人员"
,
tags
=
{
"将文件抄送给选定人员"
}
,
notes
=
"将文件抄送给选定人员"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/{system}-app-{appname}/{entity}/{businessKey}/tasks/{taskId}/sendcopy"
)
public
ResponseEntity
<
Boolean
>
sendCopy
(
@PathVariable
(
"taskId"
)
String
taskId
,
@RequestBody
WFTaskWay
taskWay
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
sendCopy
(
taskId
,
taskWay
));
}
/**
* 将流程表单设置到响应头中
*/
...
...
ibzwf-util/src/main/java/cn/ibizlab/util/enums/ProcFunction.java
浏览文件 @
f832715e
...
...
@@ -6,13 +6,17 @@ package cn.ibizlab.util.enums;
public
enum
ProcFunction
{
SENDBACK
(
"sendback"
,
"退回"
),
WITHDRAW
(
"withdraw"
,
"撤回"
),
SUPPLYINFO
(
"supplyinfo"
,
"补充信息"
),
ADDSTEPBEFORE
(
"addstepbefore"
,
"前加签"
),
ADDSTEPAFTER
(
"addstepafter"
,
"后加签"
),
TAKEADVICE
(
"takeadvice"
,
"征求意见"
),
SENDCOPY
(
"sendcopy"
,
"抄送"
),
TRANSFER
(
"transfer"
,
"转办"
),
FINISH
(
"finish"
,
"完成"
);
REASSIGN
(
"reassign"
,
"转办"
),
FINISH
(
"finish"
,
"完成"
),
JUMP
(
"jump"
,
"跳转"
),
TIMEOUT
(
"timeout"
,
"超时"
),
RESTART
(
"restart"
,
"重启流程"
);
ProcFunction
(
String
value
,
String
text
)
{
this
.
value
=
value
;
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录