Skip to content

Commit c29d7c9

Browse files
authored
Merge pull request #37 from codingapi/dev
Dev
2 parents 2f46924 + 8ede604 commit c29d7c9

52 files changed

Lines changed: 1315 additions & 313 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

flow-engine-example/src/main/java/com/codingapi/example/entity/User.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ public boolean isFlowManager() {
6565

6666
@Override
6767
public IFlowOperator forwardOperator() {
68-
return GatewayContext.getInstance().getFlowOperator(flowOperatorId);
68+
if(flowOperatorId!=null && flowOperatorId > 0){
69+
return GatewayContext.getInstance().getFlowOperator(flowOperatorId);
70+
}
71+
return null;
6972
}
7073
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
static/

flow-engine-framework/src/main/java/com/codingapi/flow/node/nodes/EndNode.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ public List<FlowRecord> generateCurrentRecords(FlowSession session) {
4242

4343
@Override
4444
public void fillNewRecord(FlowSession session, FlowRecord flowRecord) {
45-
flowRecord.setTitle("over");
46-
flowRecord.setCurrentOperatorId(-1);
47-
45+
flowRecord.over();
4846
IFlowAction currentAction = session.getCurrentAction();
4947
// 标记当前流程结束
5048
FlowRecord latestRecord = session.getCurrentRecord();

flow-engine-framework/src/main/java/com/codingapi/flow/pojo/request/FlowActionRequest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ public class FlowActionRequest {
3131
private FlowAdviceBody advice;
3232

3333

34+
public void updateOperatorId(long operatorId) {
35+
if (advice != null) {
36+
advice.setOperatorId(operatorId);
37+
}
38+
}
39+
40+
3441
public FlowAdvice toFlowAdvice(Workflow workflow, IFlowAction flowAction) {
3542
FlowAdvice flowAdvice = new FlowAdvice();
3643
flowAdvice.setAdvice(advice.getAdvice());

flow-engine-framework/src/main/java/com/codingapi/flow/pojo/request/FlowCreateRequest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ public class FlowCreateRequest {
3131
*/
3232
private long operatorId;
3333

34+
/**
35+
* 父流程id
36+
*/
37+
private long parentRecordId;
38+
39+
3440
public FlowActionRequest toActionRequest(long recordId) {
3541
FlowActionRequest flowActionRequest = new FlowActionRequest();
3642
flowActionRequest.setFormData(this.getFormData());
@@ -56,4 +62,7 @@ public void verify() {
5662
}
5763
}
5864

65+
public boolean isSubProcess() {
66+
return this.parentRecordId!=0;
67+
}
5968
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.codingapi.flow.pojo.request;
2+
3+
import lombok.Data;
4+
import lombok.NoArgsConstructor;
5+
6+
/**
7+
* 流程详情请求
8+
*/
9+
@Data
10+
@NoArgsConstructor
11+
public class FlowDetailRequest {
12+
/**
13+
* 详情id,可以是workId或者是recordId
14+
*/
15+
private String id;
16+
/**
17+
* 流程的操作人Id
18+
*/
19+
private long operatorId;
20+
21+
public boolean isCreateWorkflow() {
22+
return !id.matches("^[0-9]+$");
23+
}
24+
25+
public FlowDetailRequest(long id,long operatorId){
26+
this.id = String.valueOf(id);
27+
this.operatorId = operatorId;
28+
}
29+
30+
public FlowDetailRequest(String id, long operatorId) {
31+
this.id = id;
32+
this.operatorId = operatorId;
33+
}
34+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.codingapi.flow.pojo.request;
2+
3+
import lombok.Data;
4+
import lombok.NoArgsConstructor;
5+
6+
import java.util.Map;
7+
8+
/**
9+
* 流程节点记录请求
10+
*/
11+
@Data
12+
@NoArgsConstructor
13+
public class FlowProcessNodeRequest {
14+
/**
15+
* 详情id,可以是workId或者是recordId
16+
*/
17+
private String id;
18+
19+
/**
20+
* 流程的操作人Id
21+
*/
22+
private long operatorId;
23+
24+
/**
25+
* 表单数据
26+
*/
27+
private Map<String, Object> formData;
28+
29+
public FlowProcessNodeRequest(long id, long operatorId, Map<String, Object> formData) {
30+
this.id = String.valueOf(id);
31+
this.operatorId = operatorId;
32+
this.formData = formData;
33+
}
34+
35+
public FlowProcessNodeRequest(String id, long operatorId, Map<String, Object> formData) {
36+
this.id = id;
37+
this.operatorId = operatorId;
38+
this.formData = formData;
39+
}
40+
41+
public boolean isCreateWorkflow() {
42+
return !id.matches("^[0-9]+$");
43+
}
44+
}

flow-engine-framework/src/main/java/com/codingapi/flow/pojo/request/FlowRevokeRequest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import lombok.Data;
66
import lombok.NoArgsConstructor;
77

8+
/**
9+
* 流程撤回请求
10+
*/
811
@Data
912
@NoArgsConstructor
1013
@AllArgsConstructor

flow-engine-framework/src/main/java/com/codingapi/flow/pojo/request/FlowUrgeRequest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import lombok.Data;
66
import lombok.NoArgsConstructor;
77

8+
/**
9+
* 流程催办请求
10+
*/
811
@Data
912
@NoArgsConstructor
1013
@AllArgsConstructor

flow-engine-framework/src/main/java/com/codingapi/flow/pojo/response/FlowContent.java

Lines changed: 25 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
import com.codingapi.flow.action.IFlowAction;
44
import com.codingapi.flow.form.FormMeta;
5+
import com.codingapi.flow.manager.ActionManager;
56
import com.codingapi.flow.manager.NodeStrategyManager;
6-
import com.codingapi.flow.manager.OperatorManager;
77
import com.codingapi.flow.node.IFlowNode;
88
import com.codingapi.flow.operator.IFlowOperator;
99
import com.codingapi.flow.record.FlowRecord;
10-
import com.codingapi.flow.session.FlowSession;
11-
import com.codingapi.flow.strategy.node.OperatorLoadStrategy;
1210
import com.codingapi.flow.workflow.Workflow;
1311
import lombok.Data;
1412

@@ -26,15 +24,31 @@ public class FlowContent {
2624
* 流程记录编号
2725
*/
2826
private long recordId;
27+
2928
/**
3029
* 流程编号
3130
*/
32-
private String workflowCode;
31+
private String workId;
32+
33+
/**
34+
* 流程编码
35+
*/
36+
private String workCode;
3337
/**
3438
* 流程视图
3539
*/
3640
private String view;
3741

42+
/**
43+
* 审批意见是否必填
44+
*/
45+
private boolean adviceNullable;
46+
47+
/**
48+
* 签名是否必填
49+
*/
50+
private boolean signable;
51+
3852
/**
3953
* 表单元数据
4054
*/
@@ -79,37 +93,21 @@ public class FlowContent {
7993
*/
8094
private List<History> histories;
8195

82-
/**
83-
* 下一审批
84-
*/
85-
private List<NextNode> nextNodes;
86-
87-
public void pushNextNodes(FlowSession flowSession, List<IFlowNode> nextNodes) {
88-
List<NextNode> nextNodeList = new ArrayList<>();
89-
for (IFlowNode node : nextNodes){
90-
NextNode nextNode = new NextNode();
91-
nextNode.setNodeId(node.getId());
92-
nextNode.setNodeName(node.getName());
93-
nextNode.setNodeType(node.getType());
94-
95-
NodeStrategyManager nodeStrategyManager = node.strategyManager();
96-
OperatorManager operatorManager = nodeStrategyManager.loadOperators(flowSession);
97-
nextNode.setOperators(operatorManager.getOperators().stream().map(FlowOperator::new).toList());
98-
99-
nextNodeList.add(nextNode);
100-
}
101-
this.nextNodes = nextNodeList;
102-
}
10396

10497
public void pushCurrentNode(IFlowNode currentNode) {
105-
this.actions = currentNode.actionManager().getActions();
98+
ActionManager actionManager = currentNode.actionManager();
99+
NodeStrategyManager strategyManager = currentNode.strategyManager();
100+
this.actions = actionManager.getActions();
101+
this.adviceNullable = strategyManager.isEnableAdvice();
102+
this.signable = strategyManager.isEnableSignable();
106103
Map<String,Object> nodeData = currentNode.toMap();
107104
this.view = (String) nodeData.get("view");
108105
}
109106

110107
public void pushWorkflow(Workflow workflow) {
111108
this.form = workflow.getForm();
112-
this.workflowCode = workflow.getCode();
109+
this.workCode = workflow.getCode();
110+
this.workId = workflow.getId();
113111
}
114112

115113
public void pushRecords(FlowRecord record, List<FlowRecord> mergeRecords) {
@@ -155,30 +153,6 @@ public void pushCurrentOperator(IFlowOperator currentOperator) {
155153
}
156154

157155

158-
/**
159-
* 流程图
160-
*/
161-
@Data
162-
public static class NextNode{
163-
/**
164-
* 节点名称
165-
*/
166-
private String nodeId;
167-
/**
168-
* 节点名称
169-
*/
170-
private String nodeName;
171-
/**
172-
* 节点类型
173-
*/
174-
private String nodeType;
175-
176-
/**
177-
* 节点审批人
178-
*/
179-
private List<FlowOperator> operators;
180-
}
181-
182156
@Data
183157
public static class History{
184158
/**

0 commit comments

Comments
 (0)