Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzwf
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzwf
提交
8670b119
提交
8670b119
编写于
3月 02, 2021
作者:
lengyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dynamic wf
上级
fd1f2ea1
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
118 行增加
和
81 行删除
+118
-81
WFCoreService.java
...izlab/core/workflow/extensions/service/WFCoreService.java
+65
-30
WFCoreResource.java
...n/java/cn/ibizlab/api/rest/extensions/WFCoreResource.java
+53
-51
未找到文件。
ibzwf-core/src/main/java/cn/ibizlab/core/workflow/extensions/service/WFCoreService.java
浏览文件 @
8670b119
...
...
@@ -122,11 +122,11 @@ public class WFCoreService
private
AuthenticationContext
createAuthenticationContext
()
{
UserIdAuthenticationContext
context
=
new
UserIdAuthenticationContext
();
UserIdAuthenticationContext
context
=
new
UserIdAuthenticationContext
();
AuthenticationUser
user
=
AuthenticationUser
.
getAuthenticationUser
();
FlowUser
principal
=
new
FlowUser
();
principal
.
setUser
(
user
);
String
token
=
""
;
FlowUser
principal
=
new
FlowUser
();
principal
.
setUser
(
user
);
String
token
=
""
;
ServletRequestAttributes
requestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
if
(
requestAttributes
!=
null
)
{
HttpServletRequest
request
=
requestAttributes
.
getRequest
();
...
...
@@ -139,8 +139,8 @@ public class WFCoreService
token
=
"Bearer "
+
jwtTokenUtil
.
generateToken
(
user
);
}
principal
.
setToken
(
token
);
context
.
setPrincipal
((
Principal
)
principal
);
principal
.
setToken
(
token
);
context
.
setPrincipal
((
Principal
)
principal
);
return
context
;
}
...
...
@@ -160,6 +160,13 @@ public class WFCoreService
return
definitionKeys
;
}
public
List
<
String
>
getDynaWorkflowKey
(
String
dynainstid
,
String
system
,
String
appname
,
String
entity
)
{
List
<
String
>
definitionKeys
=
new
ArrayList
<>();
for
(
WFProcessDefinition
wfdef:
wfModelService
.
getDynamicWorkflow
(
dynainstid
,
system
,
entity
))
definitionKeys
.
add
(
wfdef
.
getDefinitionkey
());
return
definitionKeys
;
}
public
List
<
WFProcessNode
>
getWFStep
(
String
system
,
String
appname
,
String
entity
)
{
List
<
WFProcessNode
>
rt
=
new
ArrayList
<>();
for
(
WFProcessDefinition
wfdef:
wfModelService
.
getWorkflow
(
system
,
entity
))
{
...
...
@@ -307,7 +314,7 @@ public class WFCoreService
}
public
List
<
WFTaskWay
>
getWFLinkByStep
(
String
system
,
String
appname
,
String
entity
,
String
processDefinitionKey
,
String
taskDefinitionKey
)
{
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
);
...
...
@@ -383,6 +390,36 @@ public class WFCoreService
return
""
;
}
public
Map
<
String
,
Map
<
String
,
Object
>>
getDynaBusinessKeys
(
String
system
,
String
appname
,
String
entity
,
String
dynainstid
,
String
userId
)
{
Map
<
String
,
Map
<
String
,
Object
>>
businessKeys
=
new
HashMap
<>();
if
(
StringUtils
.
isEmpty
(
userId
))
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
if
(
StringUtils
.
isEmpty
(
userId
)
&&
StringUtils
.
isEmpty
(
dynainstid
))
return
businessKeys
;
WFTaskSearchContext
context
=
new
WFTaskSearchContext
();
List
<
String
>
keys
=
this
.
getDynaWorkflowKey
(
dynainstid
,
system
,
appname
,
entity
);
if
(!
ObjectUtils
.
isEmpty
(
keys
)){
context
.
getSearchCond
().
in
(
"DefinitionKey"
,
keys
);
}
Page
<
WFTask
>
tasks
=
searchMyTask
(
context
);
if
(!
ObjectUtils
.
isEmpty
(
tasks
)){
for
(
WFTask
task:
tasks
.
getContent
())
{
Object
key
=
task
.
getProcessinstancebusinesskey
();
if
(
key
!=
null
)
{
String
str
=
key
.
toString
();
if
(
str
.
indexOf
(
":k-"
)>
0
)
str
=
str
.
split
(
":k-"
)[
1
];
Map
<
String
,
Object
>
params
=
new
HashMap
();
params
.
put
(
"srfprocessdefinitionkey"
,
task
.
getProcessdefinitionkey
());
params
.
put
(
"srftaskdefinitionkey"
,
task
.
getTaskdefinitionkey
());
businessKeys
.
put
(
str
,
params
);
}
}
}
return
businessKeys
;
}
public
List
<
String
>
getBusinessKeys
(
String
system
,
String
appname
,
String
entity
,
String
processDefinitionKey
,
String
taskDefinitionKey
,
String
userId
)
{
List
<
String
>
businessKeys
=
new
ArrayList
<>();
...
...
@@ -413,7 +450,7 @@ public class WFCoreService
}
public
WFProcessInstance
wfStart
(
String
system
,
String
appname
,
String
entity
,
String
businessKey
,
WFProcessInstance
instance
)
{
String
entity
,
String
businessKey
,
WFProcessInstance
instance
)
{
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
if
(
StringUtils
.
isEmpty
(
userId
))
throw
new
BadRequestAlertException
(
"未传入当前用户"
,
entity
,
businessKey
);
...
...
@@ -448,7 +485,7 @@ public class WFCoreService
variables
.
put
(
"wfversion"
,
version
);
//根据流程定义启动流程
Authentication
.
setAuthenticatedUserId
(
userId
);
Authentication
.
setAuthenticationContext
(
createAuthenticationContext
());
Authentication
.
setAuthenticationContext
(
createAuthenticationContext
());
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
processDefinitionKey
,
processInstanceBusinessKey
,
variables
);
//流程定时标识、业务标识、变量
instance
.
setBusinesskey
(
processInstanceBusinessKey
);
instance
.
setId
(
processInstance
.
getId
());
...
...
@@ -462,7 +499,7 @@ public class WFCoreService
}
public
List
<
WFTaskWay
>
getWFLink
(
String
system
,
String
appname
,
String
entity
,
String
businessKey
,
String
taskDefinitionKey
)
{
String
entity
,
String
businessKey
,
String
taskDefinitionKey
)
{
List
<
WFTaskWay
>
taskWays
=
new
ArrayList
<>();
String
processInstanceBusinessKey
=
system
+
":"
+
entity
+
":k-"
+
businessKey
;
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
...
...
@@ -535,7 +572,7 @@ public class WFCoreService
}
public
WFProcessInstance
wfsubmit
(
String
system
,
String
appname
,
String
entity
,
String
businessKey
,
String
taskId
,
WFTaskWay
taskWay
)
{
String
entity
,
String
businessKey
,
String
taskId
,
WFTaskWay
taskWay
)
{
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
if
(
StringUtils
.
isEmpty
(
userId
))
...
...
@@ -565,7 +602,7 @@ public class WFCoreService
//根据流程定义启动流程
Authentication
.
setAuthenticatedUserId
(
userId
);
Authentication
.
setAuthenticationContext
(
createAuthenticationContext
());
Authentication
.
setAuthenticationContext
(
createAuthenticationContext
());
taskService
.
complete
(
taskId
,
variables
,
transientVariables
);
WFProcessInstance
instance
=
new
WFProcessInstance
();
...
...
@@ -574,7 +611,7 @@ public class WFCoreService
}
public
WFProcessInstance
getWFHistory
(
String
system
,
String
appname
,
String
entity
,
String
businessKey
,
String
processInstanceId
)
String
entity
,
String
businessKey
,
String
processInstanceId
)
{
WFProcessInstance
wfProcessInstance
=
new
WFProcessInstance
();
String
processInstanceBusinessKey
=
system
+
":"
+
entity
+
":k-"
+
businessKey
;
...
...
@@ -737,22 +774,22 @@ public class WFCoreService
public
synchronized
boolean
wfdeploybpmns
(
List
bpmnfiles
){
if
(
bpmnfiles
.
size
()>
0
){
bpmnfiles
.
forEach
(
item
->{
Map
<
String
,
Object
>
bpmnfile
=
(
Map
)
item
;
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
bpmnfile
.
entrySet
())
{
InputStream
in
=
null
;
try
{
in
=
new
ByteArrayInputStream
(
String
.
valueOf
(
entry
.
getValue
()).
getBytes
());
wfdeploy
(
entry
.
getKey
(),
getBpmnFile
(
in
),
new
WFREModel
());
}
catch
(
Exception
e
)
{}
finally
{
if
(
in
!=
null
)
{
try
{
in
.
close
();
}
catch
(
IOException
e
)
{}
Map
<
String
,
Object
>
bpmnfile
=
(
Map
)
item
;
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
bpmnfile
.
entrySet
())
{
InputStream
in
=
null
;
try
{
in
=
new
ByteArrayInputStream
(
String
.
valueOf
(
entry
.
getValue
()).
getBytes
());
wfdeploy
(
entry
.
getKey
(),
getBpmnFile
(
in
),
new
WFREModel
());
}
catch
(
Exception
e
)
{}
finally
{
if
(
in
!=
null
)
{
try
{
in
.
close
();
}
catch
(
IOException
e
)
{}
}
}
}
}
}
);
}
return
true
;
...
...
@@ -899,7 +936,6 @@ public class WFCoreService
for
(
String
booking:
bookings
.
split
(
","
))
{
String
processDefinitionKey
;
if
(!
StringUtils
.
isEmpty
(
dynainstid
))
processDefinitionKey
=
"dyna-"
+
dynainstid
+
"-"
+
system
+
"-"
+
booking
+
"-"
+
params
[
1
];
else
...
...
@@ -987,7 +1023,7 @@ public class WFCoreService
try
{
if
(
is
!=
null
)
is
.
close
();
is
.
close
();
}
catch
(
Exception
exis
){}
try
{
...
...
@@ -1092,7 +1128,7 @@ public class WFCoreService
{
ServiceTask
task
=(
ServiceTask
)
delegateExecution
.
getCurrentFlowElement
();
//HashMap curUser=(HashMap)delegateExecution.getVariable("curuser");
FlowUser
curUser
=
FlowUser
.
getCurUser
();
FlowUser
curUser
=
FlowUser
.
getCurUser
();
String
businessKey
=(
String
)
delegateExecution
.
getVariable
(
"businessKey"
);
String
cloudServiceId
=(
String
)
delegateExecution
.
getVariable
(
"cloud-serviceid"
);
Map
entity
=(
Map
)
activedata
;
...
...
@@ -1231,7 +1267,6 @@ public class WFCoreService
}
}
}
return
strUsers
;
}
...
...
ibzwf-provider/ibzwf-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/WFCoreResource.java
浏览文件 @
8670b119
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.api.dto.WFTaskDTO
;
import
cn.ibizlab.api.mapping.WFGroupMapping
;
import
cn.ibizlab.api.mapping.WFTaskMapping
;
import
cn.ibizlab.core.workflow.domain.*
;
import
cn.ibizlab.core.workflow.extensions.service.WFCoreService
;
import
cn.ibizlab.core.workflow.filter.WFTaskSearchContext
;
import
cn.ibizlab.core.workflow.service.IWFTaskService
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -14,7 +11,6 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -23,7 +19,6 @@ 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
;
import
java.util.List
;
...
...
@@ -44,31 +39,38 @@ public class WFCoreResource
*/
private
static
final
String
mobFormTag
=
"process-mobform"
;
@Autowired
private
WFCoreService
wfCoreService
;
@Autowired
private
WFCoreService
wfCoreService
;
@Autowired
@Lazy
public
WFTaskMapping
wfTaskMapping
;
@ApiOperation
(
value
=
"getWFProcessDefinition"
,
tags
=
{
"WFProcessDefinition"
},
notes
=
"根据
系统实体
查找当前适配的工作流模型"
)
@ApiOperation
(
value
=
"getWFProcessDefinition"
,
tags
=
{
"WFProcessDefinition"
},
notes
=
"根据
动态实例
查找当前适配的工作流模型"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/{system}-app-{appname}/{dynainstid}/{entity}/process-definitions"
)
public
ResponseEntity
<
List
<
WFProcessDefinition
>>
getDynaWorkflow
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"dynainstid"
)
String
dynamic
,
@PathVariable
(
"entity"
)
String
entity
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
getDynamicWorkflow
(
dynamic
,
system
,
appname
,
entity
));
public
ResponseEntity
<
List
<
WFProcessDefinition
>>
getDynaWorkflow
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"dynainstid"
)
String
dynainstid
,
@PathVariable
(
"entity"
)
String
entity
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
getDynamicWorkflow
(
dynainstid
,
system
,
appname
,
entity
));
}
@ApiOperation
(
value
=
"getBusinessKeys"
,
tags
=
{
"String"
},
notes
=
"根据动态实例查询我的待办主键清单"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/{system}-user-{userId}/{dynainstid}/{entity}/tasks"
)
public
ResponseEntity
<
Map
<
String
,
Map
<
String
,
Object
>>>
getDynaBusinesskeysByUserId
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"userId"
)
String
userId
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"dynainstid"
)
String
dynainstid
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
getDynaBusinessKeys
(
system
,
""
,
entity
,
dynainstid
,
userId
));
}
@ApiOperation
(
value
=
"getWFProcessDefinition"
,
tags
=
{
"WFProcessDefinition"
},
notes
=
"根据系统实体查找当前适配的工作流模型"
)
@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
,
@PathVariable
(
"entity"
)
String
entity
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
null
);
}
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
=
"/{system}-app-{appname}/{entity}/process-definitions-nodes"
)
public
ResponseEntity
<
List
<
WFProcessNode
>>
getwfstep
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
)
{
@PathVariable
(
"entity"
)
String
entity
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
getWFStep2
(
system
,
appname
,
entity
));
}
...
...
@@ -76,17 +78,17 @@ public class WFCoreResource
@ApiOperation
(
value
=
"wfstart"
,
tags
=
{
"WFProcessInstance"
},
notes
=
"启动工作流"
)
@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
)
{
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"businessKey"
)
String
businessKey
,
@RequestBody
WFProcessInstance
instance
)
{
instance
.
setBusinesskey
(
businessKey
);
return
ResponseEntity
.
ok
(
wfCoreService
.
wfStart
(
system
,
appname
,
entity
,
businessKey
,
instance
));
return
ResponseEntity
.
ok
(
wfCoreService
.
wfStart
(
system
,
appname
,
entity
,
businessKey
,
instance
));
}
@ApiOperation
(
value
=
"getWayByBusinessKey"
,
tags
=
{
"WFTaskWay"
},
notes
=
"根据业务主键和当前步骤获取操作路径"
)
@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
)
{
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"businessKey"
)
String
businessKey
,
@PathVariable
(
"taskDefinitionKey"
)
String
taskDefinitionKey
)
{
List
<
WFTaskWay
>
taskWays
=
wfCoreService
.
getWFLink
(
system
,
appname
,
entity
,
businessKey
,
taskDefinitionKey
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
headers
(
getHeader
()).
body
(
taskWays
);
}
...
...
@@ -94,8 +96,8 @@ public class WFCoreResource
@ApiOperation
(
value
=
"getWayByProcessDefinitionKey"
,
tags
=
{
"WFStepWay"
},
notes
=
"根据流程和当前步骤获取操作路径"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/{system}-app-{appname}/{entity}/process-definitions/{processDefinitionKey}/usertasks/{taskDefinitionKey}/ways"
)
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
)
{
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"processDefinitionKey"
)
String
processDefinitionKey
,
@PathVariable
(
"taskDefinitionKey"
)
String
taskDefinitionKey
)
{
List
<
WFTaskWay
>
taskWays
=
wfCoreService
.
getWFLinkByStep
(
system
,
appname
,
entity
,
processDefinitionKey
,
taskDefinitionKey
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
headers
(
getHeader
()).
body
(
taskWays
);
}
...
...
@@ -103,29 +105,29 @@ public class WFCoreResource
@ApiOperation
(
value
=
"getWayByTaskId"
,
tags
=
{
"WFTaskWay"
},
notes
=
"根据业务主键和当前步骤获取操作路径"
)
@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
)
{
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"businessKey"
)
String
businessKey
,
@PathVariable
(
"taskId"
)
String
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
=
"根据业务主键获取审批意见记录"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/{system}-app-{appname}/{entity}/{businessKey}/process-instances/{processInstanceId}/history"
)
public
ResponseEntity
<
WFProcessInstance
>
getWFHistory
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"businessKey"
)
String
businessKey
,
@PathVariable
(
"processInstanceId"
)
String
processInstanceId
)
{
if
(
StringUtils
.
isEmpty
(
processInstanceId
)||
"null"
.
equals
(
processInstanceId
)||
"alls"
.
equals
(
processInstanceId
))
processInstanceId
=
""
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
getWFHistory
(
system
,
appname
,
entity
,
businessKey
,
processInstanceId
));
}
@ApiOperation
(
value
=
"getWFHistory"
,
tags
=
{
"getWFHistory"
},
notes
=
"根据业务主键获取审批意见记录"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/{system}-app-{appname}/{entity}/{businessKey}/process-instances/{processInstanceId}/history"
)
public
ResponseEntity
<
WFProcessInstance
>
getWFHistory
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"businessKey"
)
String
businessKey
,
@PathVariable
(
"processInstanceId"
)
String
processInstanceId
)
{
if
(
StringUtils
.
isEmpty
(
processInstanceId
)||
"null"
.
equals
(
processInstanceId
)||
"alls"
.
equals
(
processInstanceId
))
processInstanceId
=
""
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
getWFHistory
(
system
,
appname
,
entity
,
businessKey
,
processInstanceId
));
}
//@PreAuthorize("hasPermission(#entity,'WFSTART',this.getEntity())")
@ApiOperation
(
value
=
"wfsubmit"
,
tags
=
{
"Submit"
},
notes
=
"工作流执行步骤"
)
@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
)
{
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"businessKey"
)
String
businessKey
,
@PathVariable
(
"taskId"
)
String
taskId
,
@RequestBody
WFTaskWay
taskWay
)
{
WFProcessInstance
instance
=
new
WFProcessInstance
();
return
ResponseEntity
.
ok
(
wfCoreService
.
wfsubmit
(
system
,
appname
,
entity
,
businessKey
,
taskId
,
taskWay
));
}
...
...
@@ -134,10 +136,10 @@ public class WFCoreResource
@ApiOperation
(
value
=
"wfsubmitbatch"
,
tags
=
{
"SubmitBatch"
},
notes
=
"批量工作流执行步骤"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/{system}-app-{appname}/{entity}/process-definitions/{processDefinitionKey}/usertasks/{taskDefinitionKey}/ways/{sequenceFlowId}/submit"
)
public
ResponseEntity
<
Boolean
>
wfsubmit
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"processDefinitionKey"
)
String
processDefinitionKey
,
@PathVariable
(
"taskDefinitionKey"
)
String
taskDefinitionKey
,
@PathVariable
(
"sequenceFlowId"
)
String
sequenceFlowId
,
@RequestBody
List
<
Map
>
businessList
)
{
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"processDefinitionKey"
)
String
processDefinitionKey
,
@PathVariable
(
"taskDefinitionKey"
)
String
taskDefinitionKey
,
@PathVariable
(
"sequenceFlowId"
)
String
sequenceFlowId
,
@RequestBody
List
<
Map
>
businessList
)
{
WFProcessInstance
instance
=
new
WFProcessInstance
();
businessList
.
forEach
(
business
->
{
...
...
@@ -159,8 +161,8 @@ public class WFCoreResource
@ApiOperation
(
value
=
"getBusinessKeys"
,
tags
=
{
"String"
},
notes
=
"根据流程步骤查询我的待办主键清单"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/{system}-app-{appname}/{entity}/process-definitions/{processDefinitionKey}/usertasks/{taskDefinitionKey}/tasks"
)
public
ResponseEntity
<
List
<
String
>>
getbusinesskeys
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"processDefinitionKey"
)
String
processDefinitionKey
,
@PathVariable
(
"taskDefinitionKey"
)
String
taskDefinitionKey
)
{
if
(
StringUtils
.
isEmpty
(
appname
)||
"null"
.
equals
(
appname
)||
"alls"
.
equals
(
appname
))
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"processDefinitionKey"
)
String
processDefinitionKey
,
@PathVariable
(
"taskDefinitionKey"
)
String
taskDefinitionKey
)
{
if
(
StringUtils
.
isEmpty
(
appname
)||
"null"
.
equals
(
appname
)||
"alls"
.
equals
(
appname
))
appname
=
""
;
if
(
StringUtils
.
isEmpty
(
processDefinitionKey
)||
"null"
.
equals
(
processDefinitionKey
)||
"alls"
.
equals
(
processDefinitionKey
))
processDefinitionKey
=
""
;
...
...
@@ -172,7 +174,7 @@ public class WFCoreResource
@ApiOperation
(
value
=
"getBusinessKeys"
,
tags
=
{
"String"
},
notes
=
"根据流程步骤查询我的待办主键清单"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/{system}-user-{userId}/{entity}/process-definitions/{processDefinitionKey}/usertasks/{taskDefinitionKey}/tasks"
)
public
ResponseEntity
<
List
<
String
>>
getbusinesskeysByUserId
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"userId"
)
String
userId
,
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"processDefinitionKey"
)
String
processDefinitionKey
,
@PathVariable
(
"taskDefinitionKey"
)
String
taskDefinitionKey
)
{
@PathVariable
(
"entity"
)
String
entity
,
@PathVariable
(
"processDefinitionKey"
)
String
processDefinitionKey
,
@PathVariable
(
"taskDefinitionKey"
)
String
taskDefinitionKey
)
{
if
(
StringUtils
.
isEmpty
(
processDefinitionKey
)||
"null"
.
equals
(
processDefinitionKey
)||
"alls"
.
equals
(
processDefinitionKey
))
processDefinitionKey
=
""
;
if
(
StringUtils
.
isEmpty
(
taskDefinitionKey
)||
"null"
.
equals
(
taskDefinitionKey
)||
"alls"
.
equals
(
taskDefinitionKey
))
...
...
@@ -183,7 +185,7 @@ public class WFCoreResource
@ApiOperation
(
value
=
"获取我的系统待办"
,
tags
=
{
"工作流任务"
}
,
notes
=
"获取我的系统待办"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/{system}-app-{appname}/mytasks"
)
public
ResponseEntity
<
List
<
WFTask
>>
fetchDefault
(
@PathVariable
(
"system"
)
String
system
,
WFTaskSearchContext
context
)
{
context
.
setN_definitionkey_leftlike
(
system
);
context
.
setN_definitionkey_leftlike
(
system
);
Page
<
WFTask
>
domains
=
wfCoreService
.
searchMyTask
(
context
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
header
(
"x-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageNumber
()))
...
...
@@ -212,20 +214,20 @@ public class WFCoreResource
.
header
(
"x-per-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageSize
()))
.
header
(
"x-total"
,
String
.
valueOf
(
domains
.
getTotalElements
()))
.
body
(
domains
.
getContent
());
}
}
@RequestMapping
(
value
=
"/mytasks/{processDefinitionKey}/{type}/{businessKey}/usertasks/{taskDefinitionKey}"
,
method
=
RequestMethod
.
GET
)
public
ResponseEntity
openTask
(
@PathVariable
(
"processDefinitionKey"
)
final
String
processDefinitionKey
,
@PathVariable
(
"type"
)
final
String
type
,
@PathVariable
(
"businessKey"
)
final
String
businessKey
,
@PathVariable
(
"taskDefinitionKey"
)
final
String
taskDefinitionKey
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
@PathVariable
(
"businessKey"
)
final
String
businessKey
,
@PathVariable
(
"taskDefinitionKey"
)
final
String
taskDefinitionKey
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
String
path
=
wfCoreService
.
getTaskUrl
(
type
,
processDefinitionKey
,
""
,
businessKey
,
taskDefinitionKey
);
if
(
StringUtils
.
isEmpty
(
path
))
throw
new
BadRequestAlertException
(
"未找到待办任务处理页"
,
""
,
""
);
return
ResponseEntity
.
status
(
HttpStatus
.
MOVED_PERMANENTLY
).
header
(
HttpHeaders
.
LOCATION
,
path
).
build
();
}
}
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/deploybpmn"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/deploybpmn"
)
public
ResponseEntity
<
Boolean
>
deployBpmnFile
(
@RequestBody
List
<
Map
<
String
,
Object
>>
bpmnfiles
){
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
wfCoreService
.
wfdeploybpmns
(
bpmnfiles
));
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录