新增自动认领角色测试
This commit is contained in:
parent
995f11084e
commit
a864b76b95
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2023-2025 Licensed under the AGPL License
|
||||
*/
|
||||
package test.mysql;
|
||||
|
||||
import com.aizuda.bpm.engine.entity.FlwHisInstance;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* 测试自动认领角色审批
|
||||
*/
|
||||
@Slf4j
|
||||
public class TestAutoClaimRole extends MysqlTest {
|
||||
|
||||
@BeforeEach
|
||||
public void before() {
|
||||
processId = this.deployByResource("test/testAutoClaimRole.json", testCreator);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
flowLongEngine.startInstanceById(processId, testCreator).ifPresent(instance -> {
|
||||
|
||||
// 先认领角色(假设 test02 为项目经理)
|
||||
this.executeActiveTasks(instance.getId(), t -> this.flowLongEngine.taskService().claimRole(t.getId(), test2Creator));
|
||||
|
||||
// 执行任务
|
||||
executeActiveTasks(instance.getId(), test2Creator);
|
||||
|
||||
FlwHisInstance hisInstance = flowLongEngine.queryService().getHistInstance(instance.getId());
|
||||
Assertions.assertEquals(1, hisInstance.getInstanceState());
|
||||
});
|
||||
}
|
||||
}
|
@ -5,9 +5,11 @@ import com.aizuda.bpm.engine.core.FlowCreator;
|
||||
import com.aizuda.bpm.engine.core.enums.NodeSetType;
|
||||
import com.aizuda.bpm.engine.entity.FlwTaskActor;
|
||||
import com.aizuda.bpm.engine.impl.GeneralTaskActorProvider;
|
||||
import com.aizuda.bpm.engine.model.NodeAssignee;
|
||||
import com.aizuda.bpm.engine.model.NodeModel;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -18,14 +20,22 @@ public class TestTaskActorProvider extends GeneralTaskActorProvider {
|
||||
@Override
|
||||
public List<FlwTaskActor> getTaskActors(NodeModel nodeModel, Execution execution) {
|
||||
if (NodeSetType.role.eq(nodeModel.getSetType())) {
|
||||
NodeAssignee nodeAssignee = nodeModel.getNodeAssigneeList().get(0);
|
||||
|
||||
// 测试用例 TestAutoSkip 测试角色自动分配处理人员
|
||||
if ("100100".equals(nodeModel.getNodeAssigneeList().get(0).getId())) {
|
||||
if ("100100".equals(nodeAssignee.getId())) {
|
||||
return Arrays.asList(
|
||||
FlwTaskActor.ofFlowCreator(FlowCreator.of("test001", "测试001")),
|
||||
FlwTaskActor.ofFlowCreator(FlowCreator.of("test002", "测试002"))
|
||||
);
|
||||
}
|
||||
|
||||
// 测试用例 TestAutoClaimRole 测试自动认领角色审批
|
||||
if ("100200".equals(nodeAssignee.getId())) {
|
||||
return Collections.singletonList(
|
||||
FlwTaskActor.ofRole(nodeAssignee.getTenantId(), nodeAssignee.getId(), nodeAssignee.getName())
|
||||
);
|
||||
}
|
||||
}
|
||||
return super.getTaskActors(nodeModel, execution);
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
{
|
||||
"key": "testAutoClaimRole",
|
||||
"name": "测试自动认领角色审批",
|
||||
"nodeConfig": {
|
||||
"nodeName": "发起人",
|
||||
"nodeKey": "flk1725161262899",
|
||||
"type": 0,
|
||||
"childNode": {
|
||||
"nodeName": "审核人",
|
||||
"nodeKey": "flk1724860316169",
|
||||
"callProcess": null,
|
||||
"type": 1,
|
||||
"setType": 3,
|
||||
"nodeAssigneeList": [
|
||||
{
|
||||
"id": "100200",
|
||||
"name": "项目经理"
|
||||
}
|
||||
],
|
||||
"examineLevel": 1,
|
||||
"directorLevel": 1,
|
||||
"selectMode": 1,
|
||||
"termAuto": false,
|
||||
"term": 0,
|
||||
"termMode": 1,
|
||||
"examineMode": 2,
|
||||
"directorMode": 0,
|
||||
"typeOfApprove": 1,
|
||||
"remind": false,
|
||||
"approveSelf": 1
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user