Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzwf
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzwf
提交
8a35ca51
提交
8a35ca51
编写于
11月 10, 2020
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
流程表单
上级
3a843875
变更
2
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
103 行增加
和
5 行删除
+103
-5
WFCoreService.java
...izlab/core/workflow/extensions/service/WFCoreService.java
+67
-1
WFCoreResource.java
...n/java/cn/ibizlab/api/rest/extensions/WFCoreResource.java
+36
-4
未找到文件。
ibzwf-core/src/main/java/cn/ibizlab/core/workflow/extensions/service/WFCoreService.java
浏览文件 @
8a35ca51
...
...
@@ -60,6 +60,7 @@ import org.springframework.data.domain.PageImpl;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.DigestUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
...
...
@@ -232,9 +233,10 @@ public class WFCoreService
public
List
<
WFTaskWay
>
getWFLinkByStep
(
String
system
,
String
appname
,
String
entity
,
String
processDefinitionKey
,
String
taskDefinitionKey
)
{
List
<
WFTaskWay
>
taskWays
=
new
ArrayList
<>();
if
((!
StringUtils
.
isEmpty
(
processDefinitionKey
))&&(!
StringUtils
.
isEmpty
(
taskDefinitionKey
)))
{
UserTask
userTask
=
wfModelService
.
getModelStepByKey
(
processDefinitionKey
).
get
(
taskDefinitionKey
);
//设置流程表单
setProcessForm
(
userTask
);
if
(
userTask
!=
null
&&
userTask
.
getOutgoingFlows
()!=
null
)
{
for
(
SequenceFlow
sequenceFlow:
userTask
.
getOutgoingFlows
())
{
WFTaskWay
way
=
new
WFTaskWay
();
...
...
@@ -242,6 +244,8 @@ public class WFCoreService
way
.
setSequenceflowname
(
sequenceFlow
.
getName
());
way
.
setProcessdefinitionkey
(
processDefinitionKey
);
way
.
setTaskdefinitionkey
(
taskDefinitionKey
);
//设置流程交互表单
setTaskWayForm
(
sequenceFlow
,
way
);
taskWays
.
add
(
way
);
}
}
...
...
@@ -397,6 +401,8 @@ public class WFCoreService
Task
task
=
list
.
get
(
0
);
if
((!
StringUtils
.
isEmpty
(
task
.
getProcessDefinitionId
()))&&(!
StringUtils
.
isEmpty
(
task
.
getTaskDefinitionKey
())))
{
UserTask
userTask
=
wfModelService
.
getModelStepById
(
task
.
getProcessDefinitionId
()).
get
(
task
.
getTaskDefinitionKey
());
//设置流程表单
setProcessForm
(
userTask
);
if
(
userTask
!=
null
&&
userTask
.
getOutgoingFlows
()!=
null
)
{
for
(
SequenceFlow
sequenceFlow:
userTask
.
getOutgoingFlows
())
{
WFTaskWay
way
=
new
WFTaskWay
();
...
...
@@ -408,6 +414,8 @@ public class WFCoreService
way
.
setProcessinstanceid
(
task
.
getProcessInstanceId
());
way
.
setTaskdefinitionkey
(
task
.
getTaskDefinitionKey
());
way
.
setProcessinstancebusinesskey
(
processInstanceBusinessKey
);
//设置流程交互表单
setTaskWayForm
(
sequenceFlow
,
way
);
taskWays
.
add
(
way
);
}
}
...
...
@@ -428,6 +436,8 @@ public class WFCoreService
Task
task
=
list
.
get
(
0
);
if
((!
StringUtils
.
isEmpty
(
task
.
getProcessDefinitionId
()))&&(!
StringUtils
.
isEmpty
(
task
.
getTaskDefinitionKey
())))
{
UserTask
userTask
=
wfModelService
.
getModelStepById
(
task
.
getProcessDefinitionId
()).
get
(
task
.
getTaskDefinitionKey
());
//设置流程表单
setProcessForm
(
userTask
);
if
(
userTask
!=
null
&&
userTask
.
getOutgoingFlows
()!=
null
)
{
for
(
SequenceFlow
sequenceFlow:
userTask
.
getOutgoingFlows
())
{
WFTaskWay
way
=
new
WFTaskWay
();
...
...
@@ -439,6 +449,8 @@ public class WFCoreService
way
.
setProcessinstanceid
(
task
.
getProcessInstanceId
());
way
.
setTaskdefinitionkey
(
task
.
getTaskDefinitionKey
());
way
.
setProcessinstancebusinesskey
(
processInstanceBusinessKey
);
//设置流程交互表单
setTaskWayForm
(
sequenceFlow
,
way
);
taskWays
.
add
(
way
);
}
}
...
...
@@ -1156,4 +1168,58 @@ public class WFCoreService
return
null
;
}
}
/**
* 设置流程表单
* @param sequenceFlow
* @param way
*/
private
void
setTaskWayForm
(
SequenceFlow
sequenceFlow
,
WFTaskWay
way
){
if
(!
ObjectUtils
.
isEmpty
(
sequenceFlow
.
getExtensionElements
())){
List
<
ExtensionElement
>
formProps
=
sequenceFlow
.
getExtensionElements
().
get
(
"form"
);
if
(!
ObjectUtils
.
isEmpty
(
formProps
)){
for
(
ExtensionElement
prop
:
formProps
){
if
(!
ObjectUtils
.
isEmpty
(
prop
.
getAttributes
())){
for
(
String
attribute
:
prop
.
getAttributes
().
keySet
()){
List
<
ExtensionAttribute
>
attributes
=
prop
.
getAttributes
().
get
(
attribute
);
if
(!
ObjectUtils
.
isEmpty
(
attributes
)){
for
(
ExtensionAttribute
param:
attributes
){
way
.
set
(
param
.
getName
(),
param
.
getValue
());
}
}
}
}
}
}
}
}
/**
* 将流程表单设置到请求头中
* @param userTask
*/
private
void
setProcessForm
(
UserTask
userTask
){
Object
objReq
=
RequestContextHolder
.
currentRequestAttributes
();
if
(!
ObjectUtils
.
isEmpty
(
objReq
)
&&
objReq
instanceof
ServletRequestAttributes
){
ServletRequestAttributes
attr
=
(
ServletRequestAttributes
)
RequestContextHolder
.
currentRequestAttributes
();
HttpServletRequest
req
=
attr
.
getRequest
();
if
(!
ObjectUtils
.
isEmpty
(
userTask
)
&&
!
ObjectUtils
.
isEmpty
(
userTask
.
getExtensionElements
())){
List
<
ExtensionElement
>
formProps
=
userTask
.
getExtensionElements
().
get
(
"form"
);
if
(!
ObjectUtils
.
isEmpty
(
formProps
)){
for
(
ExtensionElement
prop
:
formProps
){
if
(!
ObjectUtils
.
isEmpty
(
prop
.
getAttributes
())){
for
(
String
attribute
:
prop
.
getAttributes
().
keySet
()){
List
<
ExtensionAttribute
>
attributes
=
prop
.
getAttributes
().
get
(
attribute
);
if
(!
ObjectUtils
.
isEmpty
(
attributes
)){
for
(
ExtensionAttribute
param:
attributes
){
req
.
setAttribute
(
param
.
getName
(),
param
.
getValue
());
}
}
}
}
}
}
}
}
}
}
ibzwf-provider/ibzwf-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/WFCoreResource.java
浏览文件 @
8a35ca51
...
...
@@ -14,8 +14,11 @@ import org.springframework.data.domain.Page;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -28,6 +31,14 @@ import java.util.Map;
@RequestMapping
(
""
)
public
class
WFCoreResource
{
/**
* 流程PC表单标记
*/
private
static
final
String
formTag
=
"process-form"
;
/**
* 流程移动端表单标记
*/
private
static
final
String
mobFormTag
=
"process-mobform"
;
@Autowired
private
WFCoreService
wfCoreService
;
...
...
@@ -35,7 +46,6 @@ public class WFCoreResource
@Autowired
private
IWFTaskService
taskService
;
@ApiOperation
(
value
=
"getWFProcessDefinition"
,
tags
=
{
"WFProcessDefinition"
},
notes
=
"根据系统实体查找当前适配的工作流模型"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/{system}-app-{appname}/{entity}/process-definitions"
)
public
ResponseEntity
<
List
<
WFProcessDefinition
>>
getworkflow
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
...
...
@@ -65,7 +75,8 @@ public class WFCoreResource
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
(
wfCoreService
.
getWFLink
(
system
,
appname
,
entity
,
businessKey
,
taskDefinitionKey
));
List
<
WFTaskWay
>
taskWays
=
wfCoreService
.
getWFLink
(
system
,
appname
,
entity
,
businessKey
,
taskDefinitionKey
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
headers
(
getHeader
()).
body
(
taskWays
);
}
@ApiOperation
(
value
=
"getWayByProcessDefinitionKey"
,
tags
=
{
"WFStepWay"
},
notes
=
"根据流程和当前步骤获取操作路径"
)
...
...
@@ -73,7 +84,8 @@ public class WFCoreResource
public
ResponseEntity
<
List
<
WFTaskWay
>>
getWayByDefKey
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"processDefinitionKey"
)
String
processDefinitionKey
,
@PathVariable
(
"taskDefinitionKey"
)
String
taskDefinitionKey
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
getWFLinkByStep
(
system
,
appname
,
entity
,
processDefinitionKey
,
taskDefinitionKey
));
List
<
WFTaskWay
>
taskWays
=
wfCoreService
.
getWFLinkByStep
(
system
,
appname
,
entity
,
processDefinitionKey
,
taskDefinitionKey
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
headers
(
getHeader
()).
body
(
taskWays
);
}
@ApiOperation
(
value
=
"getWayByTaskId"
,
tags
=
{
"WFTaskWay"
},
notes
=
"根据业务主键和当前步骤获取操作路径"
)
...
...
@@ -81,7 +93,8 @@ public class WFCoreResource
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
(
wfCoreService
.
getTaskLink
(
system
,
appname
,
entity
,
businessKey
,
taskId
));
List
<
WFTaskWay
>
taskWays
=
wfCoreService
.
getTaskLink
(
system
,
appname
,
entity
,
businessKey
,
taskId
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
headers
(
getHeader
()).
body
(
taskWays
);
}
@ApiOperation
(
value
=
"getWFHistory"
,
tags
=
{
"getWFHistory"
},
notes
=
"根据业务主键获取审批意见记录"
)
...
...
@@ -194,4 +207,23 @@ public class WFCoreResource
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
wfdeploybpmns
(
bpmnfiles
));
}
/**
* 将流程表单设置到响应头中
*/
private
HttpHeaders
getHeader
()
{
Object
objReq
=
RequestContextHolder
.
currentRequestAttributes
();
HttpHeaders
headers
=
new
HttpHeaders
();
if
(!
ObjectUtils
.
isEmpty
(
objReq
)
&&
objReq
instanceof
ServletRequestAttributes
){
ServletRequestAttributes
attr
=
(
ServletRequestAttributes
)
RequestContextHolder
.
currentRequestAttributes
();
HttpServletRequest
req
=
attr
.
getRequest
();
Object
form
=
req
.
getAttribute
(
formTag
);
Object
mobForm
=
req
.
getAttribute
(
mobFormTag
);
if
(!
ObjectUtils
.
isEmpty
(
form
))
headers
.
set
(
formTag
,
String
.
valueOf
(
form
));
if
(!
ObjectUtils
.
isEmpty
(
mobForm
))
headers
.
set
(
mobFormTag
,
String
.
valueOf
(
mobForm
));
}
return
headers
;
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录