Skip to content

Commit 2110234

Browse files
authored
Merge pull request #109 from codingapi/dev
fix #108
2 parents b607475 + 4fab298 commit 2110234

File tree

23 files changed

+167
-21
lines changed

23 files changed

+167
-21
lines changed

example/example-app/example-app-cmd-domain/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.springboot</groupId>
88
<artifactId>example-app</artifactId>
9-
<version>3.3.69</version>
9+
<version>3.3.70</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

example/example-app/example-app-cmd-meta/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.springboot</groupId>
88
<artifactId>example-app</artifactId>
9-
<version>3.3.69</version>
9+
<version>3.3.70</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

example/example-app/example-app-query/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.springboot</groupId>
88
<artifactId>example-app</artifactId>
9-
<version>3.3.69</version>
9+
<version>3.3.70</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

example/example-app/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.springboot</groupId>
88
<artifactId>springboot-example</artifactId>
9-
<version>3.3.69</version>
9+
<version>3.3.70</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212
<packaging>pom</packaging>

example/example-domain/example-domain-leave/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.springboot</groupId>
88
<artifactId>example-domain</artifactId>
9-
<version>3.3.69</version>
9+
<version>3.3.70</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

example/example-domain/example-domain-user/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.springboot</groupId>
88
<artifactId>example-domain</artifactId>
9-
<version>3.3.69</version>
9+
<version>3.3.70</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

example/example-domain/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-example</artifactId>
8-
<version>3.3.69</version>
8+
<version>3.3.70</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111
<modelVersion>4.0.0</modelVersion>

example/example-infra/example-infra-flow/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>example-infra</artifactId>
8-
<version>3.3.69</version>
8+
<version>3.3.70</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

example/example-infra/example-infra-jpa/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>example-infra</artifactId>
8-
<version>3.3.69</version>
8+
<version>3.3.70</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

example/example-infra/example-infra-security/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.springboot</groupId>
88
<artifactId>example-infra</artifactId>
9-
<version>3.3.69</version>
9+
<version>3.3.70</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

example/example-infra/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.codingapi.springboot</groupId>
88
<artifactId>springboot-example</artifactId>
9-
<version>3.3.69</version>
9+
<version>3.3.70</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212
<packaging>pom</packaging>

example/example-interface/pom.xml

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

1212
<artifactId>example-interface</artifactId>

example/example-server/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-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.69</version>
8+
<version>3.3.70</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</parent>
2020

2121
<artifactId>springboot-example</artifactId>
22-
<version>3.3.69</version>
22+
<version>3.3.70</version>
2323

2424
<name>springboot-example</name>
2525
<description>springboot-example project for Spring Boot</description>

pom.xml

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

1313
<groupId>com.codingapi.springboot</groupId>
1414
<artifactId>springboot-parent</artifactId>
15-
<version>3.3.69</version>
15+
<version>3.3.70</version>
1616

1717
<url>https://github.com/codingapi/springboot-framewrok</url>
1818
<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
<groupId>com.codingapi.springboot</groupId>
88
<artifactId>springboot-parent</artifactId>
9-
<version>3.3.69</version>
9+
<version>3.3.70</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>3.3.69</version>
8+
<version>3.3.70</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>3.3.69</version>
9+
<version>3.3.70</version>
1010
</parent>
1111

1212
<name>springboot-starter-flow</name>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ public void loadDefaultBackNode(FlowRecord currentRecord) {
119119
boolean startRemove = false;
120120
for(FlowRecord historyRecord: historyRecords){
121121
if(startRemove){
122+
if(historyRecord.getNodeCode().equals(currentRecord.getNodeCode())){
123+
continue;
124+
}
122125
this.nextNode = flowWork.getNodeByCode(historyRecord.getNodeCode());
123126
this.nextOperator = historyRecord.getCurrentOperator();
124127
this.backOperator = historyRecord.getCurrentOperator();
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
package com.codingapi.springboot.flow.test;
2+
3+
import com.codingapi.springboot.flow.build.FlowWorkBuilder;
4+
import com.codingapi.springboot.flow.domain.FlowWork;
5+
import com.codingapi.springboot.flow.domain.Opinion;
6+
import com.codingapi.springboot.flow.em.ApprovalType;
7+
import com.codingapi.springboot.flow.flow.Leave;
8+
import com.codingapi.springboot.flow.matcher.OperatorMatcher;
9+
import com.codingapi.springboot.flow.record.FlowRecord;
10+
import com.codingapi.springboot.flow.repository.*;
11+
import com.codingapi.springboot.flow.service.FlowService;
12+
import com.codingapi.springboot.flow.user.User;
13+
import org.junit.jupiter.api.Test;
14+
import org.springframework.data.domain.PageRequest;
15+
16+
import java.util.List;
17+
18+
import static org.junit.jupiter.api.Assertions.assertEquals;
19+
20+
public class FlowTest3 {
21+
22+
private final UserRepository userRepository = new UserRepository();
23+
private final FlowWorkRepository flowWorkRepository = new FlowWorkRepositoryImpl();
24+
private final FlowRecordRepositoryImpl flowRecordRepository = new FlowRecordRepositoryImpl();
25+
private final FlowBindDataRepositoryImpl flowBindDataRepository = new FlowBindDataRepositoryImpl();
26+
private final LeaveRepository leaveRepository = new LeaveRepository();
27+
private final FlowBackupRepository flowBackupRepository = new FlowBackupRepositoryImpl();
28+
private final FlowProcessRepository flowProcessRepository = new FlowProcessRepositoryImpl(flowBackupRepository, userRepository);
29+
private final FlowService flowService = new FlowService(flowWorkRepository, flowRecordRepository, flowBindDataRepository, userRepository, flowProcessRepository, flowBackupRepository);
30+
31+
32+
/**
33+
* 一直退回的测试
34+
*/
35+
@Test
36+
void rejectAllTest() {
37+
PageRequest pageRequest = PageRequest.of(0, 1000);
38+
39+
User user = new User("张飞");
40+
userRepository.save(user);
41+
42+
User dept = new User("刘备");
43+
userRepository.save(dept);
44+
45+
User boss = new User("诸葛亮");
46+
userRepository.save(boss);
47+
48+
FlowWork flowWork = FlowWorkBuilder.builder(user)
49+
.title("请假流程")
50+
.skipIfSameApprover(true)
51+
.nodes()
52+
.node("开始节点", "start", "default", ApprovalType.UN_SIGN, OperatorMatcher.anyOperatorMatcher())
53+
.node("部门负责人审批", "dept", "default", ApprovalType.UN_SIGN, OperatorMatcher.specifyOperatorMatcher(user.getUserId(), boss.getUserId()))
54+
.node("分管领导审批", "office", "default", ApprovalType.UN_SIGN, OperatorMatcher.specifyOperatorMatcher(dept.getUserId()))
55+
.node("总经理审批", "manager", "default", ApprovalType.UN_SIGN, OperatorMatcher.specifyOperatorMatcher(boss.getUserId()))
56+
.node("结束节点", "over", "default", ApprovalType.UN_SIGN, OperatorMatcher.anyOperatorMatcher())
57+
.relations()
58+
.relation("部门负责人审批", "start", "dept")
59+
.relation("分管领导审批", "dept", "office")
60+
.relation("总经理审批", "office", "manager")
61+
.relation("结束节点", "manager", "over")
62+
.build();
63+
64+
flowWorkRepository.save(flowWork);
65+
66+
String workCode = flowWork.getCode();
67+
68+
Leave leave = new Leave("我要出去看看");
69+
leaveRepository.save(leave);
70+
71+
// 创建流程
72+
flowService.startFlow(workCode, user, leave, "发起流程");
73+
74+
// 查看我的待办
75+
List<FlowRecord> userTodos = flowRecordRepository.findTodoByOperatorId(user.getUserId(), pageRequest).getContent();
76+
assertEquals(1, userTodos.size());
77+
78+
// 提交流程
79+
FlowRecord userTodo = userTodos.get(0);
80+
flowService.submitFlow(userTodo.getId(), user, leave, Opinion.pass("同意"));
81+
82+
// 查看部门经理的待办
83+
List<FlowRecord> deptTodos = flowRecordRepository.findTodoByOperatorId(dept.getUserId(), pageRequest).getContent();
84+
assertEquals(1, deptTodos.size());
85+
86+
// 提交部门经理的审批
87+
FlowRecord deptTodo = deptTodos.get(0);
88+
flowService.submitFlow(deptTodo.getId(), dept, leave, Opinion.reject("不同意"));
89+
90+
userTodos = flowRecordRepository.findTodoByOperatorId(user.getUserId(), pageRequest).getContent();
91+
assertEquals(1, userTodos.size());
92+
93+
// 提交流程
94+
userTodo = userTodos.get(0);
95+
flowService.submitFlow(userTodo.getId(), user, leave, Opinion.reject("不同意"));
96+
97+
List<FlowRecord> records = flowRecordRepository.findAll(pageRequest).getContent();
98+
99+
userTodos = flowRecordRepository.findTodoByOperatorId(user.getUserId(), pageRequest).getContent();
100+
assertEquals(1, userTodos.size());
101+
102+
userTodo = userTodos.get(0);
103+
104+
System.out.println(userTodo.getNodeCode());
105+
106+
assertEquals("start", userTodo.getNodeCode());
107+
108+
// 提交流程
109+
userTodo = userTodos.get(0);
110+
flowService.submitFlow(userTodo.getId(), user, leave, Opinion.pass("同意"));
111+
112+
// 查看部门经理的待办
113+
deptTodos = flowRecordRepository.findTodoByOperatorId(dept.getUserId(), pageRequest).getContent();
114+
assertEquals(1, deptTodos.size());
115+
116+
// 提交部门经理的审批
117+
deptTodo = deptTodos.get(0);
118+
flowService.submitFlow(deptTodo.getId(), dept, leave, Opinion.reject("不同意"));
119+
120+
121+
userTodos = flowRecordRepository.findTodoByOperatorId(user.getUserId(), pageRequest).getContent();
122+
assertEquals(1, userTodos.size());
123+
124+
// 提交流程
125+
userTodo = userTodos.get(0);
126+
flowService.submitFlow(userTodo.getId(), user, leave, Opinion.reject("不同意"));
127+
128+
129+
userTodos = flowRecordRepository.findTodoByOperatorId(user.getUserId(), pageRequest).getContent();
130+
assertEquals(1, userTodos.size());
131+
132+
userTodo = userTodos.get(0);
133+
134+
System.out.println(userTodo.getNodeCode());
135+
136+
assertEquals("start", userTodo.getNodeCode());
137+
138+
records = flowRecordRepository.findAll(pageRequest).getContent();
139+
assertEquals(11, records.size());
140+
141+
142+
}
143+
}

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>3.3.69</version>
9+
<version>3.3.70</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>3.3.69</version>
8+
<version>3.3.70</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 3.3.69
2+
CodingApi SpringBoot-Starter 3.3.70
33
springboot version (${spring-boot.version})
44
------------------------------------------------------

0 commit comments

Comments
 (0)