Skip to content
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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</version>
</parent>

<name>springboot-starter-data-authorization</name>
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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</version>
</parent>

<name>springboot-starter-flow</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ private FlowNode matcherNextNode(FlowNode flowNode, boolean back) {
String preCode = FlowNode.CODE_START;
if (flowRecord.getPreId() != 0) {
FlowRecord preRecord = flowRecordRepository.getFlowRecordById(flowRecord.getPreId());
if (preRecord != null) {
// 退回节点时,需要过滤历史退回的记录数据
if (preRecord != null && !preRecord.isReject()) {
preCode = preRecord.getNodeCode();
while (preCode.equals(flowRecord.getNodeCode())) {
preRecord = flowRecordRepository.getFlowRecordById(preRecord.getPreId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Setter
@Getter
@NoArgsConstructor
Expand All @@ -25,4 +27,10 @@ public Leave(String title, int days) {
this.days = days;
}


public boolean get(String key){
log.info("get->{}",key);
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -456,4 +456,135 @@ void reject4(){
assertEquals(6, snapshots.size());
}



/**
* 指定撤回到发起节点,进行撤回测试
*/
@Test
void reject5(){
PageRequest pageRequest = PageRequest.of(0, 1000);

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

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

User manager = new User("赵云");
userRepository.save(manager);

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


FlowWork flowWork = FlowWorkBuilder.builder(user)
.title("请假流程")
.nodes()
.node("开始节点", "start", "default", ApprovalType.UN_SIGN, OperatorMatcher.anyOperatorMatcher())
.node("部门领导审批", "dept", "default", ApprovalType.UN_SIGN, OperatorMatcher.specifyOperatorMatcher(dept.getUserId()))
.node("分管领导审批", "manager", "default", ApprovalType.UN_SIGN, OperatorMatcher.specifyOperatorMatcher(manager.getUserId()))
.node("总经理审批", "boss", "default", ApprovalType.UN_SIGN, OperatorMatcher.specifyOperatorMatcher(boss.getUserId()))
.node("结束节点", "over", "default", ApprovalType.UN_SIGN, OperatorMatcher.anyOperatorMatcher())
.relations()
.relation("开始节点-部门领导审批", "start", "dept")
.relation("部门领导审批-分管领导审批", "dept", "manager")
.relation("分管领导审批-总经理审批", "manager", "boss")
.relation("总经理审批-结束节点", "boss", "over")
.relation("分管领导审批-发起人", "manager", "start",new OutTrigger("def run(content){return content.getBindData().get(\"isStart\")}"),1,true)
.relation("总经理审批-发起人", "boss", "start",new OutTrigger("def run(content){return content.getBindData().get(\"isStart\")}"),1,true)
.build();

flowWorkRepository.save(flowWork);

String workCode = flowWork.getCode();

Leave leave = new Leave("我要出去看看",6);
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);
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.pass("同意"));

// 查看分管经理的待办
List<FlowRecord> managerTodos = flowRecordRepository.findTodoByOperatorId(manager.getUserId(), pageRequest).getContent();
assertEquals(1, managerTodos.size());

// 分管领导的审批
FlowRecord managerTodo = managerTodos.get(0);
flowService.submitFlow(managerTodo.getId(), manager, leave, Opinion.pass("同意"));

// 查看老板的待办
List<FlowRecord> bossTodos = flowRecordRepository.findTodoByOperatorId(boss.getUserId(), pageRequest).getContent();
assertEquals(1, bossTodos.size());

// 提交老板的审批
FlowRecord bossTodo = bossTodos.get(0);
flowService.submitFlow(bossTodo.getId(), boss, leave, Opinion.reject("不同意,最多让你请假3天"));

// 查看所有流程
List<FlowRecord> records = flowRecordRepository.findAll(pageRequest).getContent();
assertEquals(5, records.size());

managerTodos = flowRecordRepository.findTodoByOperatorId(manager.getUserId(), pageRequest).getContent();
assertEquals(1, managerTodos.size());

managerTodo = managerTodos.get(0);
flowService.submitFlow(managerTodo.getId(), manager, leave, Opinion.reject("我也不同意"));

// 用户修改确认
userTodos = flowRecordRepository.findTodoByOperatorId(user.getUserId(), pageRequest).getContent();
assertEquals(1, userTodos.size());

// 用户调整为3天
leave.setDays(3);
// 提交流程
userTodo = userTodos.get(0);
flowService.submitFlow(userTodo.getId(), user, leave, Opinion.pass("同意"));

deptTodos = flowRecordRepository.findTodoByOperatorId(dept.getUserId(), pageRequest).getContent();
assertEquals(1, deptTodos.size());

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

managerTodos = flowRecordRepository.findTodoByOperatorId(manager.getUserId(), pageRequest).getContent();
assertEquals(1, managerTodos.size());

managerTodo = managerTodos.get(0);
flowService.submitFlow(managerTodo.getId(), manager, leave, Opinion.pass("同意"));

bossTodos = flowRecordRepository.findTodoByOperatorId(boss.getUserId(), pageRequest).getContent();
assertEquals(1, bossTodos.size());

bossTodo = bossTodos.get(0);
flowService.submitFlow(bossTodo.getId(), boss, leave, Opinion.pass("同意"));

records = flowRecordRepository.findAll(pageRequest).getContent();
assertEquals(9, records.size());

// 查看所有流程是否都已经结束
assertTrue(records.stream().allMatch(FlowRecord::isFinish));

List<BindDataSnapshot> snapshots = flowBindDataRepository.findAll();
assertEquals(10, snapshots.size());
}


}
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.4.32</version>
<version>3.4.33</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.4.32</version>
<version>3.4.33</version>
</parent>
<artifactId>springboot-starter</artifactId>

Expand Down