Skip to content

Commit 26b650c

Browse files
committed
update 2.9.26
1 parent ef27002 commit 26b650c

File tree

12 files changed

+141
-8
lines changed

12 files changed

+141
-8
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<groupId>com.codingapi.springboot</groupId>
1717
<artifactId>springboot-parent</artifactId>
18-
<version>2.9.25</version>
18+
<version>2.9.26</version>
1919

2020
<url>https://github.com/codingapi/springboot-framewrok</url>
2121
<name>springboot-parent</name>

springboot-starter-data-authorization/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>springboot-parent</artifactId>
88
<groupId>com.codingapi.springboot</groupId>
9-
<version>2.9.25</version>
9+
<version>2.9.26</version>
1010
</parent>
1111

1212
<artifactId>springboot-starter-data-authorization</artifactId>

springboot-starter-data-fast/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-parent</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>2.9.25</version>
8+
<version>2.9.26</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

springboot-starter-flow/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>springboot-parent</artifactId>
88
<groupId>com.codingapi.springboot</groupId>
9-
<version>2.9.25</version>
9+
<version>2.9.26</version>
1010
</parent>
1111

1212
<name>springboot-starter-flow</name>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.codingapi.springboot.flow.pojo;
2+
3+
import com.codingapi.springboot.flow.domain.FlowNode;
4+
import lombok.Getter;
5+
6+
import java.util.ArrayList;
7+
import java.util.List;
8+
9+
@Getter
10+
public class FlowStepResult {
11+
12+
private final List<FlowNode> flowNodes;
13+
14+
public FlowStepResult() {
15+
this.flowNodes = new ArrayList<>();
16+
}
17+
18+
public void addFlowNode(FlowNode flowNode) {
19+
this.flowNodes.add(flowNode);
20+
}
21+
22+
23+
public void print(){
24+
for (FlowNode flowNode : flowNodes) {
25+
System.out.println("flowNode = " + flowNode.getName());
26+
}
27+
}
28+
}

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/service/FlowService.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.codingapi.springboot.flow.domain.Opinion;
55
import com.codingapi.springboot.flow.pojo.FlowDetail;
66
import com.codingapi.springboot.flow.pojo.FlowResult;
7+
import com.codingapi.springboot.flow.pojo.FlowStepResult;
78
import com.codingapi.springboot.flow.pojo.FlowSubmitResult;
89
import com.codingapi.springboot.flow.repository.*;
910
import com.codingapi.springboot.flow.result.MessageResult;
@@ -188,6 +189,18 @@ public FlowSubmitResult trySubmitFlow(long recordId, IFlowOperator currentOperat
188189
}
189190

190191

192+
/**
193+
* 获取流程执行节点
194+
*
195+
* @param workCode
196+
* @param currentOperator
197+
* @return
198+
*/
199+
public FlowStepResult getFlowStep(String workCode, IBindData bindData, IFlowOperator currentOperator) {
200+
FlowStepService flowStepService = new FlowStepService(workCode, currentOperator, bindData, flowServiceRepositoryHolder);
201+
return flowStepService.getFlowStep();
202+
}
203+
191204
/**
192205
* 尝试提交流程 (发起流程)
193206
*
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
package com.codingapi.springboot.flow.service.impl;
2+
3+
import com.codingapi.springboot.flow.bind.BindDataSnapshot;
4+
import com.codingapi.springboot.flow.bind.IBindData;
5+
import com.codingapi.springboot.flow.domain.FlowNode;
6+
import com.codingapi.springboot.flow.domain.FlowWork;
7+
import com.codingapi.springboot.flow.domain.Opinion;
8+
import com.codingapi.springboot.flow.pojo.FlowStepResult;
9+
import com.codingapi.springboot.flow.record.FlowRecord;
10+
import com.codingapi.springboot.flow.repository.FlowOperatorRepository;
11+
import com.codingapi.springboot.flow.repository.FlowRecordRepository;
12+
import com.codingapi.springboot.flow.service.FlowNodeService;
13+
import com.codingapi.springboot.flow.service.FlowServiceRepositoryHolder;
14+
import com.codingapi.springboot.flow.user.IFlowOperator;
15+
16+
import java.util.ArrayList;
17+
import java.util.List;
18+
19+
public class FlowStepService {
20+
private final FlowWork flowWork;
21+
22+
private final IFlowOperator currentOperator;
23+
private final IBindData bindData;
24+
private final FlowServiceRepositoryHolder flowServiceRepositoryHolder;
25+
26+
private FlowNodeService flowNodeService;
27+
private FlowNode flowNode;
28+
29+
public FlowStepService(String workCode, IFlowOperator currentOperator, IBindData bindData, FlowServiceRepositoryHolder flowServiceRepositoryHolder) {
30+
this.currentOperator = currentOperator;
31+
this.bindData = bindData;
32+
this.flowServiceRepositoryHolder = flowServiceRepositoryHolder;
33+
this.flowWork = flowServiceRepositoryHolder.getFlowWorkRepository().getFlowWorkByCode(workCode);
34+
}
35+
36+
37+
public FlowStepResult getFlowStep() {
38+
FlowStepResult flowStepResult = new FlowStepResult();
39+
// 获取开始节点
40+
FlowNode start = flowWork.getStartNode();
41+
if (start == null) {
42+
throw new IllegalArgumentException("start node not found");
43+
}
44+
45+
this.flowNode = start;
46+
// 设置开始流程的上一个流程id
47+
long preId = 0;
48+
49+
// 创建流程id
50+
String processId = "flow_" + System.currentTimeMillis();
51+
52+
List<FlowRecord> historyRecords = new ArrayList<>();
53+
54+
FlowOperatorRepository flowOperatorRepository = flowServiceRepositoryHolder.getFlowOperatorRepository();
55+
FlowRecordRepository flowRecordRepository = flowServiceRepositoryHolder.getFlowRecordRepository();
56+
57+
BindDataSnapshot snapshot = new BindDataSnapshot(bindData);
58+
flowNodeService = new FlowNodeService(flowOperatorRepository,
59+
flowRecordRepository,
60+
snapshot,
61+
Opinion.pass("同意"),
62+
currentOperator,
63+
currentOperator,
64+
historyRecords,
65+
flowWork,
66+
null,
67+
processId,
68+
preId);
69+
70+
flowNodeService.setNextNode(start);
71+
72+
this.flowNode = start;
73+
flowStepResult.addFlowNode(this.flowNode);
74+
75+
do {
76+
flowNodeService.loadNextPassNode(this.flowNode);
77+
this.flowNode = flowNodeService.getNextNode();
78+
flowStepResult.addFlowNode(this.flowNode);
79+
} while (!flowNode.isOverNode());
80+
81+
return flowStepResult;
82+
}
83+
}

springboot-starter-flow/src/test/java/com/codingapi/springboot/flow/test/CirculateTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.codingapi.springboot.flow.flow.Leave;
99
import com.codingapi.springboot.flow.matcher.OperatorMatcher;
1010
import com.codingapi.springboot.flow.pojo.FlowDetail;
11+
import com.codingapi.springboot.flow.pojo.FlowStepResult;
1112
import com.codingapi.springboot.flow.record.FlowRecord;
1213
import com.codingapi.springboot.flow.repository.*;
1314
import com.codingapi.springboot.flow.service.FlowService;
@@ -79,6 +80,10 @@ void circulate(){
7980
// 创建流程
8081
flowService.startFlow(workCode, user, leave, "发起流程");
8182

83+
84+
FlowStepResult result = flowService.getFlowStep(workCode, leave, user);
85+
result.print();
86+
8287
// 查看我的待办
8388
List<FlowRecord> userTodos = flowRecordRepository.findUnReadByOperatorId(user.getUserId(), pageRequest).getContent();
8489
assertEquals(1, userTodos.size());

springboot-starter-flow/src/test/java/com/codingapi/springboot/flow/test/FlowTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.codingapi.springboot.flow.flow.Leave;
99
import com.codingapi.springboot.flow.matcher.OperatorMatcher;
1010
import com.codingapi.springboot.flow.pojo.FlowDetail;
11+
import com.codingapi.springboot.flow.pojo.FlowStepResult;
1112
import com.codingapi.springboot.flow.pojo.FlowSubmitResult;
1213
import com.codingapi.springboot.flow.record.FlowRecord;
1314
import com.codingapi.springboot.flow.repository.*;
@@ -72,6 +73,9 @@ void entrustTest() {
7273
Leave leave = new Leave("我要出去看看");
7374
leaveRepository.save(leave);
7475

76+
FlowStepResult result = flowService.getFlowStep(workCode, leave, user);
77+
result.print();
78+
7579
// 创建流程
7680
flowService.startFlow(workCode, user, leave, "发起流程");
7781

@@ -898,7 +902,7 @@ void recallTest1() {
898902
* 删除流程测试
899903
*/
900904
@Test
901-
void removeTest1() {
905+
void removeTest() {
902906
PageRequest pageRequest = PageRequest.of(0, 1000);
903907

904908
User lorne = new User("lorne");

springboot-starter-security/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>springboot-parent</artifactId>
88
<groupId>com.codingapi.springboot</groupId>
9-
<version>2.9.25</version>
9+
<version>2.9.26</version>
1010
</parent>
1111

1212
<artifactId>springboot-starter-security</artifactId>

springboot-starter/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.codingapi.springboot</groupId>
77
<artifactId>springboot-parent</artifactId>
8-
<version>2.9.25</version>
8+
<version>2.9.26</version>
99
</parent>
1010
<artifactId>springboot-starter</artifactId>
1111

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
------------------------------------------------------
2-
CodingApi SpringBoot-Starter 2.9.25
2+
CodingApi SpringBoot-Starter 2.9.26
33
springboot version (${spring-boot.version})
44
------------------------------------------------------

0 commit comments

Comments
 (0)