Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
workflow-core
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
workflow-core
Commits
c77a1008
提交
c77a1008
authored
3月 15, 2021
作者:
ww1xhqc
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
52d395be
c0d2b523
隐藏空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
154 行增加
和
42 行删除
+154
-42
README.md
README.md
+122
-3
image-20210315130344008.png
images/image-20210315130344008.png
+0
-0
image-20210315131337443.png
images/image-20210315131337443.png
+0
-0
image-20210315131641756.png
images/image-20210315131641756.png
+0
-0
image-20210315131723560.png
images/image-20210315131723560.png
+0
-0
image-20210315132120952.png
images/image-20210315132120952.png
+0
-0
image-20210315132126849.png
images/image-20210315132126849.png
+0
-0
image-20210315132632917.png
images/image-20210315132632917.png
+0
-0
image-20210315132852126.png
images/image-20210315132852126.png
+0
-0
image-20210315132859363.png
images/image-20210315132859363.png
+0
-0
ResultObj.java
...ain/java/com/tykj/workflowcore/base/result/ResultObj.java
+0
-3
ResultUtil.java
...in/java/com/tykj/workflowcore/base/result/ResultUtil.java
+1
-1
FlowsInfoController.java
...wcore/workflow_editer/controller/FlowsInfoController.java
+3
-13
WorkFlowController.java
...owcore/workflow_editer/controller/WorkFlowController.java
+0
-4
FlowsInfo.java
...m/tykj/workflowcore/workflow_editer/entity/FlowsInfo.java
+1
-1
FlowInfoServiceImpl.java
...ore/workflow_editer/service/impl/FlowInfoServiceImpl.java
+0
-1
WorkFlowServiceImpl.java
...ore/workflow_editer/service/impl/WorkFlowServiceImpl.java
+27
-16
没有找到文件。
README.md
浏览文件 @
c77a1008
...
@@ -56,7 +56,8 @@
...
@@ -56,7 +56,8 @@
│ └─frame --核心逻辑所在位置
│ └─frame --核心逻辑所在位置
```
```
## 使用方式
## 使用方式
### 安装
### 后端安装
#### maven
#### maven
```
```
<dependency>
<dependency>
...
@@ -69,7 +70,7 @@
...
@@ -69,7 +70,7 @@
1.
获取 workflow-core-0.0.1-SNAPSHOT.jar
1.
获取 workflow-core-0.0.1-SNAPSHOT.jar
2.
在你自己项目的根目录下创建lib文件夹 并将 jar 包放入
2.
在你自己项目的根目录下创建lib文件夹 并将 jar 包放入
3.
pom 添加 如下
3.
pom 添加 如下
```
```
<dependency>
<dependency>
<groupId>com.tykj</groupId>
<groupId>com.tykj</groupId>
...
@@ -79,7 +80,11 @@
...
@@ -79,7 +80,11 @@
<systemPath>${basedir}/lib/workflow-core-0.0.1-SNAPSHOT.jar</systemPath>
<systemPath>${basedir}/lib/workflow-core-0.0.1-SNAPSHOT.jar</systemPath>
</dependency>
</dependency>
```
```
### 调用
### 前端安装
```
npm install workflow-form
```
### 配置
1.
在springboot 启动类上添加注解 @EnableWorkFlowCore
1.
在springboot 启动类上添加注解 @EnableWorkFlowCore
```
```
@EnableWorkFlowCore
@EnableWorkFlowCore
...
@@ -145,5 +150,119 @@ public class FlowUserServiceImpl implements UserService {
...
@@ -145,5 +150,119 @@ public class FlowUserServiceImpl implements UserService {
}
}
```
```
### 使用
1.
工作流部分
1.
建立数据模型

2.
建立流程

3.
为节点配置页面


4.
配置节点的审核人

2.
宿主系统部分
1.
查询可发起流程
```
接口返回值示例
{
"message": "查询成功",
"data": {
"content": [
{
"id": 2,
"createdTime": "2021-03-15T03:00:48.028+00:00",
"updatedTime": "2021-03-15T03:10:33.009+00:00",
"deleted": 0,
"userId": null,
"userName": null,
"flowName": "测试1",
"resourceName": "processId_2850e08d-0e3d-4925-93f6-adce8a9e2246bpmn20.xml",
"flowKey": "processId_2850e08d-0e3d-4925-93f6-adce8a9e2246",
//前端组件需要使用该数据
"state": 0,
"filePath": "\\xml\\processId_2850e08d-0e3d-4925-93f6-adce8a9e2246bpmn20.xml",
"flowDescribe": "测试2",
"startId": null,
"startPageId": 1, //前端组件需要使用该数据
"processInstanceId": null,
"deployId": "a4c408b0-853a-11eb-81c9-d2c637ad090d"
},
{
"id": 3,
"createdTime": "2021-03-15T03:17:30.914+00:00",
"updatedTime": "2021-03-15T03:17:31.850+00:00",
"deleted": 0,
"userId": null,
"userName": null,
"flowName": "测试流程1",
"resourceName": "processId_560c6b5c-8be5-40b8-852f-8e174346e9c8bpmn20.xml",
"flowKey": "processId_560c6b5c-8be5-40b8-852f-8e174346e9c8",
"state": 0,
"filePath": "\\xml\\processId_560c6b5c-8be5-40b8-852f-8e174346e9c8bpmn20.xml",
"flowDescribe": "测试流程描述1",
"startId": null,
"startPageId": null,
"processInstanceId": null,
"deployId": "fa83de4c-853c-11eb-81c9-d2c637ad090d"
}
],
"pageable": {
"sort": {
"sorted": false,
"unsorted": true,
"empty": true
},
"offset": 0,
"pageSize": 15,
"pageNumber": 0,
"paged": true,
"unpaged": false
},
"totalElements": 2,
"last": true,
"totalPages": 1,
"number": 0,
"size": 15,
"sort": {
"sorted": false,
"unsorted": true,
"empty": true
},
"numberOfElements": 2,
"first": true,
"empty": false
}
}
```
2.
渲染页面
```
fromUtil.creatFrom(pageId,flowKey)
```
(渲染出来的表单页面中的逻辑由工作流控制,用户完成表单所有操作后页面会自动关闭)
3.
模拟效果


images/image-20210315130344008.png
0 → 100644
浏览文件 @
c77a1008
69.7 KB
images/image-20210315131337443.png
0 → 100644
浏览文件 @
c77a1008
8.9 KB
images/image-20210315131641756.png
0 → 100644
浏览文件 @
c77a1008
56.0 KB
images/image-20210315131723560.png
0 → 100644
浏览文件 @
c77a1008
3.1 KB
images/image-20210315132120952.png
0 → 100644
浏览文件 @
c77a1008
12.7 KB
images/image-20210315132126849.png
0 → 100644
浏览文件 @
c77a1008
12.7 KB
images/image-20210315132632917.png
0 → 100644
浏览文件 @
c77a1008
162.6 KB
images/image-20210315132852126.png
0 → 100644
浏览文件 @
c77a1008
15.5 KB
images/image-20210315132859363.png
0 → 100644
浏览文件 @
c77a1008
14.1 KB
src/main/java/com/tykj/workflowcore/base/result/ResultObj.java
浏览文件 @
c77a1008
...
@@ -24,7 +24,4 @@ public class ResultObj<T> {
...
@@ -24,7 +24,4 @@ public class ResultObj<T> {
this
.
message
=
"no message"
;
this
.
message
=
"no message"
;
}
}
public
ResultObj
(
String
m
)
{
this
.
message
=
m
;
}
}
}
src/main/java/com/tykj/workflowcore/base/result/ResultUtil.java
浏览文件 @
c77a1008
...
@@ -25,7 +25,7 @@ public class ResultUtil<T> {
...
@@ -25,7 +25,7 @@ public class ResultUtil<T> {
* 成功返回结果
* 成功返回结果
*/
*/
public
static
<
T
>
ResponseEntity
<
ResultObj
<
T
>>
success
(
String
message
)
{
public
static
<
T
>
ResponseEntity
<
ResultObj
<
T
>>
success
(
String
message
)
{
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
message
));
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
null
,
message
));
}
}
/**
/**
...
...
src/main/java/com/tykj/workflowcore/workflow_editer/controller/FlowsInfoController.java
浏览文件 @
c77a1008
...
@@ -52,22 +52,12 @@ public class FlowsInfoController {
...
@@ -52,22 +52,12 @@ public class FlowsInfoController {
@GetMapping
(
"editFlow"
)
@GetMapping
(
"editFlow"
)
@ApiOperation
(
value
=
"编辑流程"
)
@ApiOperation
(
value
=
"编辑流程"
)
public
String
editFlow
(
Integer
id
){
public
ResponseEntity
editFlow
(
Integer
id
){
return
flowInfoService
.
editFlow
(
id
).
getFilePath
();
return
ResultUtil
.
success
(
flowInfoService
.
editFlow
(
id
),
"查询成功"
);
}
@GetMapping
(
"/deploy"
)
@ApiOperation
(
value
=
"部署流程"
,
notes
=
"部署成功"
)
public
ResponseEntity
deploy
(
Integer
id
)
throws
FileNotFoundException
{
//根据id 查询出flowsInfo
FlowsInfo
flowsInfo
=
flowInfoService
.
findById
(
id
);
if
(
flowsInfo
.
getState
()
==
0
){
return
ResultUtil
.
success
(
flowsInfo
.
getState
(),
"该流程已经被部署"
);
}
workFlowService
.
deployXml
(
flowsInfo
);
return
ResultUtil
.
success
(
flowsInfo
.
getState
(),
"流程部署成功"
);
}
}
@PostMapping
(
"/saveXml"
)
@PostMapping
(
"/saveXml"
)
@ApiOperation
(
value
=
"保存xml以及其他流程信息"
)
@ApiOperation
(
value
=
"保存xml以及其他流程信息"
)
public
ResponseEntity
saveXml
(
@RequestBody
FlowsInfoVo
flowsInfoVo
)
{
public
ResponseEntity
saveXml
(
@RequestBody
FlowsInfoVo
flowsInfoVo
)
{
...
...
src/main/java/com/tykj/workflowcore/workflow_editer/controller/WorkFlowController.java
浏览文件 @
c77a1008
...
@@ -27,9 +27,6 @@ import java.util.Map;
...
@@ -27,9 +27,6 @@ import java.util.Map;
@RequestMapping
(
"/workFlow"
)
@RequestMapping
(
"/workFlow"
)
public
class
WorkFlowController
{
public
class
WorkFlowController
{
@Autowired
private
FlowInfoService
flowInfoService
;
@Autowired
@Autowired
private
WorkFlowService
workFlowService
;
private
WorkFlowService
workFlowService
;
...
@@ -44,7 +41,6 @@ public class WorkFlowController {
...
@@ -44,7 +41,6 @@ public class WorkFlowController {
@PostMapping
(
"/findUserTask"
)
@PostMapping
(
"/findUserTask"
)
@ApiOperation
(
"任务个人待办列表"
)
@ApiOperation
(
"任务个人待办列表"
)
public
List
<
Map
<
String
,
Object
>>
findUserTask
(
@RequestBody
NextTaskVo
nextTaskVo
){
public
List
<
Map
<
String
,
Object
>>
findUserTask
(
@RequestBody
NextTaskVo
nextTaskVo
){
return
workFlowService
.
findTaskByUserId
(
nextTaskVo
);
return
workFlowService
.
findTaskByUserId
(
nextTaskVo
);
}
}
...
...
src/main/java/com/tykj/workflowcore/workflow_editer/entity/FlowsInfo.java
浏览文件 @
c77a1008
...
@@ -45,7 +45,7 @@ public class FlowsInfo extends BaseEntity {
...
@@ -45,7 +45,7 @@ public class FlowsInfo extends BaseEntity {
@ApiModelProperty
(
"流程主键"
)
@ApiModelProperty
(
"流程主键"
)
private
String
flowKey
;
private
String
flowKey
;
@ApiModelProperty
(
value
=
"部署状态"
,
notes
=
"0 已
部署,1 未部署
"
)
@ApiModelProperty
(
value
=
"部署状态"
,
notes
=
"0 已
启用,1 未启用
"
)
private
Integer
state
;
private
Integer
state
;
@ApiModelProperty
(
"文件路径"
)
@ApiModelProperty
(
"文件路径"
)
...
...
src/main/java/com/tykj/workflowcore/workflow_editer/service/impl/FlowInfoServiceImpl.java
浏览文件 @
c77a1008
...
@@ -53,7 +53,6 @@ public class FlowInfoServiceImpl implements FlowInfoService {
...
@@ -53,7 +53,6 @@ public class FlowInfoServiceImpl implements FlowInfoService {
FlowsInfo
byDesc
=
flowsInfoMapper
.
findByFlowKey
(
flowKey
);
FlowsInfo
byDesc
=
flowsInfoMapper
.
findByFlowKey
(
flowKey
);
byDesc
.
setFlowDescribe
(
describe
);
byDesc
.
setFlowDescribe
(
describe
);
// //进行更新
// //进行更新
// FlowsInfo flowsInfo = flowsInfoMapper.save(byDesc);
return
flowsInfoMapper
.
save
(
byDesc
);
return
flowsInfoMapper
.
save
(
byDesc
);
}
}
...
...
src/main/java/com/tykj/workflowcore/workflow_editer/service/impl/WorkFlowServiceImpl.java
浏览文件 @
c77a1008
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.tykj.workflowcore.api.entity.InvokeRequest
;
import
com.tykj.workflowcore.api.entity.InvokeRequest
;
import
com.tykj.workflowcore.api.entity.Parameter
;
import
com.tykj.workflowcore.api.entity.Parameter
;
import
com.tykj.workflowcore.api.service.SpringBeanService
;
import
com.tykj.workflowcore.api.service.SpringBeanService
;
import
com.tykj.workflowcore.base.result.ApiException
;
import
com.tykj.workflowcore.workflow_editer.entity.*
;
import
com.tykj.workflowcore.workflow_editer.entity.*
;
import
com.tykj.workflowcore.workflow_editer.dao.FlowsInfoMapper
;
import
com.tykj.workflowcore.workflow_editer.dao.FlowsInfoMapper
;
import
com.tykj.workflowcore.workflow_editer.entity.vo.*
;
import
com.tykj.workflowcore.workflow_editer.entity.vo.*
;
...
@@ -149,7 +150,7 @@ public class WorkFlowServiceImpl implements WorkFlowService {
...
@@ -149,7 +150,7 @@ public class WorkFlowServiceImpl implements WorkFlowService {
//生成xml文件
//生成xml文件
File
f
=
null
;
File
f
=
null
;
try
{
try
{
f
=
new
File
(
classLoader
.
getResource
(
""
).
getPath
()+
"/xml/
"
+
flowKey
+
"bpmn20.xml"
);
f
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\xml\\
"
+
flowKey
+
"bpmn20.xml"
);
// 判断文件是否存在
// 判断文件是否存在
if
(!
f
.
exists
()){
if
(!
f
.
exists
()){
f
.
createNewFile
();
f
.
createNewFile
();
...
@@ -188,8 +189,8 @@ public class WorkFlowServiceImpl implements WorkFlowService {
...
@@ -188,8 +189,8 @@ public class WorkFlowServiceImpl implements WorkFlowService {
}
}
FlowsInfo
flowsInfo
=
new
FlowsInfo
();
FlowsInfo
flowsInfo
=
new
FlowsInfo
();
BeanUtils
.
copyProperties
(
flowsInfoVo
,
flowsInfo
);
BeanUtils
.
copyProperties
(
flowsInfoVo
,
flowsInfo
);
flowsInfo
.
setResourceName
(
flowKey
+
"bpmn.xml"
);
flowsInfo
.
setResourceName
(
flowKey
+
"bpmn
20
.xml"
);
flowsInfo
.
setFilePath
(
classLoader
.
getResource
(
""
).
getPath
()+
"/xml/
"
+
flowKey
+
"bpmn20.xml"
);
flowsInfo
.
setFilePath
(
"\\xml\\
"
+
flowKey
+
"bpmn20.xml"
);
flowsInfo
.
setId
(
id
);
flowsInfo
.
setId
(
id
);
//更新并保存
//更新并保存
FlowsInfo
save
=
flowsInfoMapper
.
save
(
flowsInfo
);
FlowsInfo
save
=
flowsInfoMapper
.
save
(
flowsInfo
);
...
@@ -208,8 +209,8 @@ public class WorkFlowServiceImpl implements WorkFlowService {
...
@@ -208,8 +209,8 @@ public class WorkFlowServiceImpl implements WorkFlowService {
public
void
deployXml
(
FlowsInfo
flowsInfo
)
{
public
void
deployXml
(
FlowsInfo
flowsInfo
)
{
Deployment
deploy
=
null
;
Deployment
deploy
=
null
;
try
{
try
{
deploy
=
repositoryService
.
createDeployment
().
addInputStream
(
flowsInfo
.
getResourceName
(),
deploy
=
repositoryService
.
createDeployment
().
addInputStream
(
System
.
getProperty
(
"user.dir"
)+
flowsInfo
.
getResourceName
(),
new
FileInputStream
(
flowsInfo
.
getFilePath
())).
deploy
();
new
FileInputStream
(
System
.
getProperty
(
"user.dir"
)
+
flowsInfo
.
getFilePath
())).
deploy
();
}
catch
(
FileNotFoundException
e
)
{
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -335,15 +336,21 @@ public class WorkFlowServiceImpl implements WorkFlowService {
...
@@ -335,15 +336,21 @@ public class WorkFlowServiceImpl implements WorkFlowService {
//通过流程ID 查询出flowsInfo
//通过流程ID 查询出flowsInfo
FlowsInfo
flowsInfo
=
flowsInfoMapper
.
findById
(
id
).
get
();
FlowsInfo
flowsInfo
=
flowsInfoMapper
.
findById
(
id
).
get
();
String
flowKey
=
flowsInfo
.
getFlowKey
();
String
flowKey
=
flowsInfo
.
getFlowKey
();
if
(
flowsInfo
.
getState
()
==
0
){
List
<
Deployment
>
list
=
repositoryService
.
createDeploymentQuery
().
processDefinitionKey
(
flowKey
).
list
();
//挂起
if
(
list
!=
null
&&
list
.
size
()>
0
){
repositoryService
.
suspendProcessDefinitionByKey
(
flowKey
,
true
,
new
Date
());
if
(
flowsInfo
.
getState
()
==
0
){
flowsInfo
.
setState
(
1
);
//挂起
repositoryService
.
suspendProcessDefinitionByKey
(
flowKey
,
true
,
new
Date
());
flowsInfo
.
setState
(
1
);
}
else
{
//激活
repositoryService
.
activateProcessDefinitionByKey
(
flowKey
,
true
,
new
Date
());
flowsInfo
.
setState
(
0
);
}
}
else
{
}
else
{
//激活
throw
new
ApiException
(
"该流程未编辑流程图无法被启用"
);
repositoryService
.
activateProcessDefinitionByKey
(
flowKey
,
true
,
new
Date
());
flowsInfo
.
setState
(
0
);
}
}
flowsInfoMapper
.
save
(
flowsInfo
);
flowsInfoMapper
.
save
(
flowsInfo
);
}
}
...
@@ -351,10 +358,14 @@ public class WorkFlowServiceImpl implements WorkFlowService {
...
@@ -351,10 +358,14 @@ public class WorkFlowServiceImpl implements WorkFlowService {
@Override
@Override
public
void
deleteFlow
(
Integer
id
)
{
public
void
deleteFlow
(
Integer
id
)
{
//通过流程id查询出flowsInfo
//通过流程id查询出flowsInfo
FlowsInfo
flowsInfo
=
flowsInfoMapper
.
findById
(
id
).
get
();
Optional
<
FlowsInfo
>
flowsInfoMapperById
=
flowsInfoMapper
.
findById
(
id
);
if
(
flowsInfo
.
getState
()
==
0
){
if
(
flowsInfoMapperById
.
isPresent
()){
flowsInfo
.
setState
(
1
);
FlowsInfo
flowsInfo
=
flowsInfoMapperById
.
get
();
flowsInfoMapper
.
save
(
flowsInfo
);
if
(
flowsInfo
.
getState
()
==
0
){
flowsInfoMapper
.
deleteById
(
id
);
}
}
else
{
throw
new
ApiException
(
"流程不存在"
);
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论