Skip to content

fix skipIfSameApprover reject bug #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/example-app/example-app-cmd-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-app/example-app-cmd-meta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-app/example-app-query/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>
<relativePath>../pom.xml</relativePath>
</parent>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/example-domain-leave/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-domain</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/example-domain-user/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-domain</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>
<relativePath>../pom.xml</relativePath>
</parent>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion example/example-interface/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>
</parent>

<artifactId>example-interface</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion example/example-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-example</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.3.68</version>
<version>3.3.69</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</parent>

<artifactId>springboot-example</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>

<name>springboot-example</name>
<description>springboot-example project for Spring Boot</description>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-parent</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>

<url>https://github.com/codingapi/springboot-framewrok</url>
<name>springboot-parent</name>
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-data-authorization/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-parent</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>
</parent>

<artifactId>springboot-starter-data-authorization</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-data-fast/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-parent</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.3.68</version>
<version>3.3.69</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>springboot-parent</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.3.68</version>
<version>3.3.69</version>
</parent>

<name>springboot-starter-flow</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ public List<FlowRecord> matchRecordByOperator(IFlowOperator operator){
public boolean isOver() {
return records.stream().allMatch(FlowRecord::isOverNode);
}

public boolean isStart() {
return records.stream().allMatch(FlowRecord::isStartNode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -450,4 +450,8 @@ public boolean isStartRecord() {
public boolean isOverNode() {
return this.nodeCode.equals(FlowNode.CODE_OVER);
}

public boolean isStartNode() {
return this.nodeCode.equals(FlowNode.CODE_START);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ private void pushEvent(FlowRecord flowRecord, int eventState) {
*/
public FlowResult submitFlow() {
FlowResult flowResult = this.submitCurrentFlow();
if (this.isSkipIfSameApprover() && !flowResult.isOver()) {
if (this.isSkipIfSameApprover() && !flowResult.isOver() && !flowResult.isStart()) {
List<FlowRecord> flowRecords = flowResult.matchRecordByOperator(currentOperator);
FlowResult result = flowResult;
if (!flowRecords.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,88 @@ void postponedAndUrgeTest() {

}

/**
* 一直退回的测试
*/
@Test
void rejectAllTest() {
PageRequest pageRequest = PageRequest.of(0, 1000);

User user = new User("张飞");
userRepository.save(user);

User dept = new User("刘备");
userRepository.save(dept);

User boss = new User("诸葛亮");
userRepository.save(boss);

FlowWork flowWork = FlowWorkBuilder.builder(user)
.title("请假流程")
.skipIfSameApprover(true)
.nodes()
.node("开始节点", "start", "default", ApprovalType.UN_SIGN, OperatorMatcher.anyOperatorMatcher())
.node("部门领导审批", "dept", "default", ApprovalType.UN_SIGN, OperatorMatcher.specifyOperatorMatcher(user.getUserId()))
.node("办公室领导审批", "office", "default", ApprovalType.UN_SIGN, OperatorMatcher.specifyOperatorMatcher(dept.getUserId()))
.node("总经理审批", "manager", "default", ApprovalType.UN_SIGN, OperatorMatcher.specifyOperatorMatcher(boss.getUserId()))
.node("结束节点", "over", "default", ApprovalType.UN_SIGN, OperatorMatcher.anyOperatorMatcher())
.relations()
.relation("部门领导审批", "start", "dept")
.relation("办公室领导审批", "dept", "office")
.relation("总经理审批", "office", "manager")
.relation("结束节点", "manager", "over")
.build();

flowWorkRepository.save(flowWork);

String workCode = flowWork.getCode();

Leave leave = new Leave("我要出去看看");
leaveRepository.save(leave);

// 创建流程
flowService.startFlow(workCode, user, leave, "发起流程");

// 查看我的待办
List<FlowRecord> userTodos = flowRecordRepository.findTodoByOperatorId(user.getUserId(), pageRequest).getContent();
assertEquals(1, userTodos.size());

// 提交流程
FlowRecord userTodo = userTodos.get(0);

// 查看流程详情
FlowDetail flowDetail = flowService.detail(userTodo.getId());
assertEquals("我要出去看看", ((Leave) flowDetail.getBindData()).getTitle());
assertTrue(flowDetail.getFlowRecord().isUnRead());


flowService.submitFlow(userTodo.getId(), user, leave, Opinion.pass("同意"));

// 查看部门经理的待办
List<FlowRecord> deptTodos = flowRecordRepository.findTodoByOperatorId(dept.getUserId(), pageRequest).getContent();
assertEquals(1, deptTodos.size());

// 提交部门经理的审批
FlowRecord deptTodo = deptTodos.get(0);
flowService.submitFlow(deptTodo.getId(), dept, leave, Opinion.reject("不同意"));

userTodos = flowRecordRepository.findTodoByOperatorId(user.getUserId(), pageRequest).getContent();
assertEquals(1, userTodos.size());

// 提交流程
userTodo = userTodos.get(0);
flowService.submitFlow(userTodo.getId(), user, leave, Opinion.reject("不同意"));

userTodos = flowRecordRepository.findTodoByOperatorId(user.getUserId(), pageRequest).getContent();
assertEquals(1, userTodos.size());

userTodo = userTodos.get(0);

System.out.println(userTodo.getNodeCode());

assertEquals("start", userTodo.getNodeCode());
}

/**
* 部门拒绝再提交测试
*/
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>springboot-parent</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.3.68</version>
<version>3.3.69</version>
</parent>

<artifactId>springboot-starter-security</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-parent</artifactId>
<version>3.3.68</version>
<version>3.3.69</version>
</parent>
<artifactId>springboot-starter</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion springboot-starter/src/main/resources/banner.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
------------------------------------------------------
CodingApi SpringBoot-Starter 3.3.68
CodingApi SpringBoot-Starter 3.3.69
springboot version (${spring-boot.version})
------------------------------------------------------