Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzwf
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzwf
提交
5e81e604
提交
5e81e604
编写于
5月 03, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
工作流编程
上级
77e28278
变更
4
展开全部
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
447 行增加
和
0 行删除
+447
-0
WFCoreService.java
...ava/cn/ibizlab/core/extensions/service/WFCoreService.java
+276
-0
WFModelService.java
...va/cn/ibizlab/core/extensions/service/WFModelService.java
+77
-0
WFCoreResource.java
...n/java/cn/ibizlab/api/rest/extensions/WFCoreResource.java
+80
-0
pom.xml
ibzwf-util/pom.xml
+14
-0
未找到文件。
ibzwf-core/src/main/java/cn/ibizlab/core/extensions/service/WFCoreService.java
0 → 100644
浏览文件 @
5e81e604
此差异已折叠。
点击以展开。
ibzwf-core/src/main/java/cn/ibizlab/core/extensions/service/WFModelService.java
0 → 100644
浏览文件 @
5e81e604
package
cn
.
ibizlab
.
core
.
extensions
.
service
;
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.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.StringUtils
;
import
java.util.*
;
public
class
WFModelService
{
@Autowired
private
RepositoryService
repositoryService
;
@Autowired
private
IWFProcessDefinitionService
iwfProcessDefinitionService
;
public
List
<
WFProcessDefinition
>
getWorkflow
(
String
system
,
String
entity
)
{
return
iwfProcessDefinitionService
.
list
(
new
QueryWrapper
<
WFProcessDefinition
>().
likeRight
(
"definitionkey"
,
system
+
"-"
+
entity
+
"-"
).
eq
(
"modelenable"
,
1
).
orderByDesc
(
"modelversion"
));
}
public
LinkedHashMap
<
String
,
UserTask
>
getModelStepByKey
(
String
definitionkey
)
{
LinkedHashMap
<
String
,
UserTask
>
allTask
=
new
LinkedHashMap
<
String
,
UserTask
>();
List
<
ProcessDefinition
>
list
=
repositoryService
.
createProcessDefinitionQuery
().
processDefinitionKey
(
definitionkey
).
orderByProcessDefinitionVersion
().
desc
().
list
();
boolean
blastest
=
true
;
for
(
ProcessDefinition
def
:
list
)
{
LinkedHashMap
<
String
,
UserTask
>
userTasks
=
getModelStepById
(
def
.
getId
());
if
(
blastest
){
allTask
.
putAll
(
userTasks
);
blastest
=
false
;
}
else
{
for
(
String
key:
userTasks
.
keySet
())
{
if
(!
allTask
.
containsKey
(
key
))
{
String
taskName
=
userTasks
.
get
(
key
).
getName
()
+
"-历史版本v"
+
def
.
getVersion
();
userTasks
.
get
(
key
).
setName
(
taskName
);
allTask
.
put
(
key
,
userTasks
.
get
(
key
));
}
}
}
}
return
allTask
;
}
public
LinkedHashMap
<
String
,
UserTask
>
getModelStepById
(
String
definitionid
)
{
LinkedHashMap
<
String
,
UserTask
>
userTasks
=
new
LinkedHashMap
<
String
,
UserTask
>();
Map
<
String
,
UserTask
>
map
=
new
HashMap
<>();
for
(
FlowElement
f:
repositoryService
.
getBpmnModel
(
definitionid
).
getMainProcess
().
getFlowElements
())
{
if
(
f
instanceof
UserTask
)
{
map
.
put
(
f
.
getId
(),(
UserTask
)
f
);
}
}
List
<
Map
.
Entry
<
String
,
UserTask
>>
infoIds
=
new
ArrayList
<
Map
.
Entry
<
String
,
UserTask
>>(
map
.
entrySet
());
Collections
.
sort
(
infoIds
,
new
Comparator
<
Map
.
Entry
<
String
,
UserTask
>>()
{
public
int
compare
(
Map
.
Entry
<
String
,
UserTask
>
o1
,
Map
.
Entry
<
String
,
UserTask
>
o2
)
{
String
p1
=
o1
.
getKey
();
String
p2
=
o2
.
getKey
();
return
p1
.
compareTo
(
p2
);
}
});
for
(
Map
.
Entry
<
String
,
UserTask
>
entity
:
infoIds
){
userTasks
.
put
(
entity
.
getKey
(),
entity
.
getValue
());
System
.
out
.
println
(
entity
.
getKey
());
}
return
userTasks
;
}
}
ibzwf-provider/ibzwf-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/WFCoreResource.java
0 → 100644
浏览文件 @
5e81e604
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.core.workflow.domain.*
;
import
cn.ibizlab.core.extensions.service.WFCoreService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
@Slf4j
@Api
(
tags
=
{
"wfcore"
})
@RestController
(
"api-wfcore"
)
@RequestMapping
(
""
)
public
class
WFCoreResource
{
@Autowired
private
WFCoreService
wfCoreService
;
@ApiOperation
(
value
=
"getWFProcessDefinition"
,
tags
=
{
"WFProcessDefinition"
},
notes
=
"根据系统实体查找当前适配的工作流模型"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/wfcore/{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"
)
public
ResponseEntity
<
List
<
WFProcessNode
>>
getwfstep
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"appname"
)
String
appname
,
@PathVariable
(
"entity"
)
String
entity
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
null
);
}
@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"
)
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
);
}
@ApiOperation
(
value
=
"getWayByBusinessKey"
,
tags
=
{
"WFTaskWay"
},
notes
=
"根据业务主键和当前步骤获取操作路径"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/wfcore/{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
);
}
@ApiOperation
(
value
=
"getWayByTaskId"
,
tags
=
{
"WFTaskWay"
},
notes
=
"根据业务主键和当前步骤获取操作路径"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/wfcore/{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
);
}
@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}"
)
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
);
}
}
ibzwf-util/pom.xml
浏览文件 @
5e81e604
...
@@ -54,5 +54,19 @@
...
@@ -54,5 +54,19 @@
<artifactId>
problem-spring-web
</artifactId>
<artifactId>
problem-spring-web
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
org.activiti
</groupId>
<artifactId>
activiti-spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.activiti
</groupId>
<artifactId>
activiti-json-converter
</artifactId>
</dependency>
<dependency>
<groupId>
org.activiti
</groupId>
<artifactId>
activiti-image-generator
</artifactId>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录