Skip to content

Commit 0258cf0

Browse files
committed
add readme
1 parent d2db073 commit 0258cf0

30 files changed

+155
-80
lines changed

example/example-application/src/main/java/com/codingapi/example/runner/FlowHolderRegister.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.codingapi.example.runner;
22

3-
import com.codingapi.springboot.flow.content.FlowHolder;
3+
import com.codingapi.springboot.flow.content.FlowSessionBeanRegister;
44
import lombok.AllArgsConstructor;
55
import org.springframework.boot.ApplicationArguments;
66
import org.springframework.boot.ApplicationRunner;
@@ -16,7 +16,7 @@ public class FlowHolderRegister implements ApplicationRunner {
1616
@Override
1717
public void run(ApplicationArguments args) throws Exception {
1818
//注册spring容器
19-
FlowHolder.getInstance().register(spring);
19+
FlowSessionBeanRegister.getInstance().register(spring);
2020
}
2121

2222
}

springboot-starter-flow/README.md

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,39 @@
1-
# 流程引擎的开发
1+
# springboot-starter-flow 流程引擎
22

33
流程引擎支持的功能需要包括:
44

5-
流程的设计,支持json schema [待支持,通过定义Builder来支持]
6-
流程绑定对象,将绑定的对象参与流程的审批条件控制 [已支持]
7-
流程待办消息的自定义标题能力 [已支持]
8-
流程的待办数据、已办数据、发起数据查询、已办分为:超期待办查询、普通的已办 [待支持,通过查询数据来支撑]
9-
流程的异常处理机制,当下一节点没有获取到时运用走异常补偿机制 [已支持]
10-
发起流程 [已支持]
11-
发起流程时需要保存流程数据,在流程流转过程中不使用新的数据,而是使用发起时的数据
12-
审批流程(审批通过、审批拒绝) [已支持]
13-
撤回流程,在下级节点尚未审批时,上级节点可以撤回流程。
14-
强制干预,允许特定用户强制更改流程的流转过程
15-
超时设置,设置超时以后在超时时间内未发起的处理的流程,需要自动提示延期提醒 [已支持]
16-
转办,允许用户将自己的流程转给其他人来办理。
17-
抄送,允许用户在流程后将审批结果抄送给其他人,此时人员仅能查看流程的结果情况 [待支持,发送消息提醒即可]
18-
催办,允许用户在提交流程以后即已办中尚未结束的流程下,可以点击催办给当前审批者发生提醒消息。[待支持,发送消息提醒即可]
19-
委托,就是将本应该是我来设置办理的流程,直接委托给了其他人来设置。
5+
支持的功能如下:
6+
7+
流程管理
8+
1. build模式的流程设计
9+
2. schema模式的流程设计
10+
3. 流程的启用与禁用
11+
4. 流程快照的存储
12+
13+
流程设计
14+
1. 支持自定义节点与节点关系
15+
2. 支持自定义节点的操作用户,可通过groovy脚本定义
16+
3. 支持流程消息标题的自定义能力,可通过groovy脚本定义
17+
4. 支持流程异常状态的自定义能力,可通过groovy脚本定义
18+
5. 提供流程操作过程中的事件,可以做业务定制与延伸
19+
20+
21+
流程能力
22+
1. 流程发起
23+
在设计完成以后并启用以后,可通过FlowService对象发起流程。
24+
2. 流程审批
25+
流程的审批支持同意与拒绝,以及审批意见的填写。
26+
3. 流程撤销
27+
流程的发起以后,在下一节点的流程待审批且未读之前可以撤销流程。
28+
4. 流程转办
29+
流程的审批过程中,可以将流程转办给其他人员审批。
30+
5. 流程委托
31+
可设置用户的委托人,委托人可以代理委托人审批流程。
32+
6. 流程催办
33+
流程的审批过程中,可以催办审批人员,催办将会发送催办事件消息。
34+
7. 流程查询
35+
可以查询流程的待办、已办、超时、延期、全部流程等数据。
36+
8. 流程干预
37+
设置流程管理员的人员,可以对流程进行干预,可以直接对其他人的流程进行审批。
38+
9. 流程延期
39+
流程的审批过程中,可以延期流程的审批时间。

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/build/FlowWorkBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
import com.codingapi.springboot.flow.user.IFlowOperator;
1313
import com.codingapi.springboot.flow.utils.IDGenerator;
1414

15+
/**
16+
* 流程工作构建器
17+
*/
1518
public class FlowWorkBuilder {
1619

1720
private FlowWork work = null;

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/build/SchemaReader.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
import java.util.ArrayList;
1717
import java.util.List;
1818

19+
/**
20+
* 流程设计schema读取器
21+
*/
1922
public class SchemaReader {
2023

2124
private final JSONObject data;

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/content/FlowContent.java renamed to springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/content/FlowSession.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import java.util.List;
1414

1515
@Getter
16-
public class FlowContent {
16+
public class FlowSession {
1717

1818
private FlowWork flowWork;
1919
private FlowNode flowNode;
@@ -22,18 +22,18 @@ public class FlowContent {
2222
private IBindData bindData;
2323
private Opinion opinion;
2424
private List<FlowRecord> historyRecords;
25-
private FlowHolder holder;
25+
private FlowSessionBeanRegister holder;
2626

2727

28-
public FlowContent(FlowWork flowWork, FlowNode flowNode, IFlowOperator createOperator, IFlowOperator currentOperator, IBindData bindData, Opinion opinion,List<FlowRecord> historyRecords) {
28+
public FlowSession(FlowWork flowWork, FlowNode flowNode, IFlowOperator createOperator, IFlowOperator currentOperator, IBindData bindData, Opinion opinion, List<FlowRecord> historyRecords) {
2929
this.flowWork = flowWork;
3030
this.flowNode = flowNode;
3131
this.createOperator = createOperator;
3232
this.currentOperator = currentOperator;
3333
this.bindData = bindData;
3434
this.opinion = opinion;
3535
this.historyRecords = historyRecords;
36-
this.holder = FlowHolder.getInstance();
36+
this.holder = FlowSessionBeanRegister.getInstance();
3737
}
3838

3939

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/content/FlowHolder.java renamed to springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/content/FlowSessionBeanRegister.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
import org.springframework.context.ApplicationContext;
55

66
/**
7-
* 流程持有者
7+
* 流程回话 spring bean 注册对象
88
*/
9-
public class FlowHolder {
9+
public class FlowSessionBeanRegister {
1010

1111
@Getter
12-
private static final FlowHolder instance = new FlowHolder();
12+
private static final FlowSessionBeanRegister instance = new FlowSessionBeanRegister();
1313

14-
private FlowHolder() {
14+
private FlowSessionBeanRegister() {
1515
}
1616

1717
private ApplicationContext spring;

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/domain/FlowNode.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.codingapi.springboot.flow.domain;
22

33
import com.codingapi.springboot.flow.bind.BindDataSnapshot;
4-
import com.codingapi.springboot.flow.content.FlowContent;
4+
import com.codingapi.springboot.flow.content.FlowSession;
55
import com.codingapi.springboot.flow.em.*;
66
import com.codingapi.springboot.flow.error.ErrTrigger;
77
import com.codingapi.springboot.flow.error.ErrorResult;
@@ -167,11 +167,11 @@ public FlowNode(String id,
167167
/**
168168
* 加载节点的操作者
169169
*
170-
* @param flowContent 操作内容
170+
* @param flowSession 操作内容
171171
* @return 是否匹配
172172
*/
173-
public List<? extends IFlowOperator> loadFlowNodeOperator(FlowContent flowContent, FlowOperatorRepository flowOperatorRepository) {
174-
return flowOperatorRepository.findByIds(this.operatorMatcher.matcher(flowContent));
173+
public List<? extends IFlowOperator> loadFlowNodeOperator(FlowSession flowSession, FlowOperatorRepository flowOperatorRepository) {
174+
return flowOperatorRepository.findByIds(this.operatorMatcher.matcher(flowSession));
175175
}
176176

177177

@@ -245,11 +245,11 @@ public boolean isAnyOperatorMatcher() {
245245
/**
246246
* 异常匹配
247247
*
248-
* @param flowContent 操作内容
248+
* @param flowSession 操作内容
249249
*/
250-
public ErrorResult errMatcher(FlowContent flowContent) {
250+
public ErrorResult errMatcher(FlowSession flowSession) {
251251
if (errTrigger != null) {
252-
return errTrigger.trigger(flowContent);
252+
return errTrigger.trigger(flowSession);
253253
}
254254
return null;
255255
}
@@ -266,11 +266,11 @@ public boolean hasErrTrigger() {
266266
/**
267267
* 生成标题
268268
*
269-
* @param flowContent 流程内容
269+
* @param flowSession 流程内容
270270
* @return 标题
271271
*/
272-
public String generateTitle(FlowContent flowContent) {
273-
return titleGenerator.generate(flowContent);
272+
public String generateTitle(FlowSession flowSession) {
273+
return titleGenerator.generate(flowSession);
274274
}
275275

276276

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/domain/FlowRelation.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.codingapi.springboot.flow.domain;
22

3-
import com.codingapi.springboot.flow.content.FlowContent;
3+
import com.codingapi.springboot.flow.content.FlowSession;
44
import com.codingapi.springboot.flow.em.NodeType;
55
import com.codingapi.springboot.flow.serializable.FlowRelationSerializable;
66
import com.codingapi.springboot.flow.trigger.OutTrigger;
@@ -118,11 +118,11 @@ public FlowRelation(String id, String name, FlowNode source, FlowNode target, Ou
118118
/**
119119
* 触发条件
120120
*
121-
* @param flowContent 流程内容
121+
* @param flowSession 流程内容
122122
* @return 下一个节点
123123
*/
124-
public FlowNode trigger(FlowContent flowContent) {
125-
if (outTrigger.trigger(flowContent)) {
124+
public FlowNode trigger(FlowSession flowSession) {
125+
if (outTrigger.trigger(flowSession)) {
126126
return target;
127127
}
128128
return null;

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/error/ErrTrigger.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.codingapi.springboot.flow.error;
22

3-
import com.codingapi.springboot.flow.content.FlowContent;
3+
import com.codingapi.springboot.flow.content.FlowSession;
44
import groovy.lang.GroovyShell;
55
import groovy.lang.Script;
66
import lombok.Getter;
@@ -29,10 +29,10 @@ public ErrTrigger(String script) {
2929
/**
3030
* 触发
3131
*
32-
* @param flowContent 流程内容
32+
* @param flowSession 流程内容
3333
*/
34-
public ErrorResult trigger(FlowContent flowContent) {
35-
return (ErrorResult) runtime.invokeMethod("run", flowContent);
34+
public ErrorResult trigger(FlowSession flowSession) {
35+
return (ErrorResult) runtime.invokeMethod("run", flowSession);
3636
}
3737

3838
}

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/error/ErrorResult.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package com.codingapi.springboot.flow.error;
22

3+
4+
/**
5+
* 异常匹配的结果对象
6+
*/
37
public abstract class ErrorResult {
48

59
public boolean isNode(){

0 commit comments

Comments
 (0)