Skip to content

Commit e16d97a

Browse files
committed
fix skipIfSameApprover reject bug
1 parent e7c00f7 commit e16d97a

File tree

25 files changed

+112
-22
lines changed

25 files changed

+112
-22
lines changed

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

+1-1
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.68</version>
9+
<version>3.3.69</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

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

+1-1
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.68</version>
9+
<version>3.3.69</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

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

+1-1
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.68</version>
9+
<version>3.3.69</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

example/example-app/pom.xml

+1-1
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.68</version>
9+
<version>3.3.69</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212
<packaging>pom</packaging>

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

+1-1
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.68</version>
9+
<version>3.3.69</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

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

+1-1
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.68</version>
9+
<version>3.3.69</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

example/example-domain/pom.xml

+1-1
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.68</version>
8+
<version>3.3.69</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111
<modelVersion>4.0.0</modelVersion>

example/example-infra/example-infra-flow/pom.xml

+1-1
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.68</version>
8+
<version>3.3.69</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

example/example-infra/example-infra-jpa/pom.xml

+1-1
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.68</version>
8+
<version>3.3.69</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

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

+1-1
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.68</version>
9+
<version>3.3.69</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

example/example-infra/pom.xml

+1-1
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.68</version>
9+
<version>3.3.69</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212
<packaging>pom</packaging>

example/example-interface/pom.xml

+1-1
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.68</version>
9+
<version>3.3.69</version>
1010
</parent>
1111

1212
<artifactId>example-interface</artifactId>

example/example-server/pom.xml

+1-1
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.68</version>
8+
<version>3.3.69</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</parent>
2020

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

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

pom.xml

+1-1
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.68</version>
15+
<version>3.3.69</version>
1616

1717
<url>https://github.com/codingapi/springboot-framewrok</url>
1818
<name>springboot-parent</name>

springboot-starter-data-authorization/pom.xml

+1-1
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.68</version>
9+
<version>3.3.69</version>
1010
</parent>
1111

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

springboot-starter-data-fast/pom.xml

+1-1
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.68</version>
8+
<version>3.3.69</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

springboot-starter-flow/pom.xml

+1-1
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.68</version>
9+
<version>3.3.69</version>
1010
</parent>
1111

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

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/pojo/FlowResult.java

+4
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@ public List<FlowRecord> matchRecordByOperator(IFlowOperator operator){
3737
public boolean isOver() {
3838
return records.stream().allMatch(FlowRecord::isOverNode);
3939
}
40+
41+
public boolean isStart() {
42+
return records.stream().allMatch(FlowRecord::isStartNode);
43+
}
4044
}

springboot-starter-flow/src/main/java/com/codingapi/springboot/flow/record/FlowRecord.java

+4
Original file line numberDiff line numberDiff line change
@@ -450,4 +450,8 @@ public boolean isStartRecord() {
450450
public boolean isOverNode() {
451451
return this.nodeCode.equals(FlowNode.CODE_OVER);
452452
}
453+
454+
public boolean isStartNode() {
455+
return this.nodeCode.equals(FlowNode.CODE_START);
456+
}
453457
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ private void pushEvent(FlowRecord flowRecord, int eventState) {
230230
*/
231231
public FlowResult submitFlow() {
232232
FlowResult flowResult = this.submitCurrentFlow();
233-
if (this.isSkipIfSameApprover() && !flowResult.isOver()) {
233+
if (this.isSkipIfSameApprover() && !flowResult.isOver() && !flowResult.isStart()) {
234234
List<FlowRecord> flowRecords = flowResult.matchRecordByOperator(currentOperator);
235235
FlowResult result = flowResult;
236236
if (!flowRecords.isEmpty()) {

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

+82
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,88 @@ void postponedAndUrgeTest() {
711711

712712
}
713713

714+
/**
715+
* 一直退回的测试
716+
*/
717+
@Test
718+
void rejectAllTest() {
719+
PageRequest pageRequest = PageRequest.of(0, 1000);
720+
721+
User user = new User("张飞");
722+
userRepository.save(user);
723+
724+
User dept = new User("刘备");
725+
userRepository.save(dept);
726+
727+
User boss = new User("诸葛亮");
728+
userRepository.save(boss);
729+
730+
FlowWork flowWork = FlowWorkBuilder.builder(user)
731+
.title("请假流程")
732+
.skipIfSameApprover(true)
733+
.nodes()
734+
.node("开始节点", "start", "default", ApprovalType.UN_SIGN, OperatorMatcher.anyOperatorMatcher())
735+
.node("部门领导审批", "dept", "default", ApprovalType.UN_SIGN, OperatorMatcher.specifyOperatorMatcher(user.getUserId()))
736+
.node("办公室领导审批", "office", "default", ApprovalType.UN_SIGN, OperatorMatcher.specifyOperatorMatcher(dept.getUserId()))
737+
.node("总经理审批", "manager", "default", ApprovalType.UN_SIGN, OperatorMatcher.specifyOperatorMatcher(boss.getUserId()))
738+
.node("结束节点", "over", "default", ApprovalType.UN_SIGN, OperatorMatcher.anyOperatorMatcher())
739+
.relations()
740+
.relation("部门领导审批", "start", "dept")
741+
.relation("办公室领导审批", "dept", "office")
742+
.relation("总经理审批", "office", "manager")
743+
.relation("结束节点", "manager", "over")
744+
.build();
745+
746+
flowWorkRepository.save(flowWork);
747+
748+
String workCode = flowWork.getCode();
749+
750+
Leave leave = new Leave("我要出去看看");
751+
leaveRepository.save(leave);
752+
753+
// 创建流程
754+
flowService.startFlow(workCode, user, leave, "发起流程");
755+
756+
// 查看我的待办
757+
List<FlowRecord> userTodos = flowRecordRepository.findTodoByOperatorId(user.getUserId(), pageRequest).getContent();
758+
assertEquals(1, userTodos.size());
759+
760+
// 提交流程
761+
FlowRecord userTodo = userTodos.get(0);
762+
763+
// 查看流程详情
764+
FlowDetail flowDetail = flowService.detail(userTodo.getId());
765+
assertEquals("我要出去看看", ((Leave) flowDetail.getBindData()).getTitle());
766+
assertTrue(flowDetail.getFlowRecord().isUnRead());
767+
768+
769+
flowService.submitFlow(userTodo.getId(), user, leave, Opinion.pass("同意"));
770+
771+
// 查看部门经理的待办
772+
List<FlowRecord> deptTodos = flowRecordRepository.findTodoByOperatorId(dept.getUserId(), pageRequest).getContent();
773+
assertEquals(1, deptTodos.size());
774+
775+
// 提交部门经理的审批
776+
FlowRecord deptTodo = deptTodos.get(0);
777+
flowService.submitFlow(deptTodo.getId(), dept, leave, Opinion.reject("不同意"));
778+
779+
userTodos = flowRecordRepository.findTodoByOperatorId(user.getUserId(), pageRequest).getContent();
780+
assertEquals(1, userTodos.size());
781+
782+
// 提交流程
783+
userTodo = userTodos.get(0);
784+
flowService.submitFlow(userTodo.getId(), user, leave, Opinion.reject("不同意"));
785+
786+
userTodos = flowRecordRepository.findTodoByOperatorId(user.getUserId(), pageRequest).getContent();
787+
assertEquals(1, userTodos.size());
788+
789+
userTodo = userTodos.get(0);
790+
791+
System.out.println(userTodo.getNodeCode());
792+
793+
assertEquals("start", userTodo.getNodeCode());
794+
}
795+
714796
/**
715797
* 部门拒绝再提交测试
716798
*/

springboot-starter-security/pom.xml

+1-1
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.68</version>
9+
<version>3.3.69</version>
1010
</parent>
1111

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

springboot-starter/pom.xml

+1-1
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.68</version>
8+
<version>3.3.69</version>
99
</parent>
1010
<artifactId>springboot-starter</artifactId>
1111

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
------------------------------------------------------
2-
CodingApi SpringBoot-Starter 3.3.68
2+
CodingApi SpringBoot-Starter 3.3.69
33
springboot version (${spring-boot.version})
44
------------------------------------------------------

0 commit comments

Comments
 (0)