Skip to content

Commit

Permalink
fix: 修复自选处理人的时, 在发起审批线程没有重新渲染逻辑节点parentNode的bug, 因为processModelCache默…
Browse files Browse the repository at this point in the history
…认的redeploy是false, 测试用例在ccToCondition里, issue https://gitee.com/aizuda/flowlong/issues/IANGF9
  • Loading branch information
hesq committed Aug 29, 2024
1 parent d3d9dde commit d64573a
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,18 @@ public interface ProcessModelCache {
* @return JSON BPM 模型
*/
default ProcessModel model() {
return this.model(false);
}

/**
* JSON BPM 模型
*
* @param redeploy 重新部署 true 是 false 否
* @return JSON BPM 模型
*/
default ProcessModel model(boolean redeploy) {
String modelContent = this.getModelContent();
Assert.isEmpty(modelContent, "The process modelContent is Empty.");
return FlowLongContext.parseProcessModel(modelContent, this.modelCacheKey(), false);
return FlowLongContext.parseProcessModel(modelContent, this.modelCacheKey(), redeploy);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public Optional<FlwInstance> startProcessInstance(FlwProcess process, FlowCreato
if (log.isDebugEnabled()) {
log.debug("start process instanceId={}", flwInstance.getId());
}
return new Execution(this, process.model(), flowCreator, flwInstance, args);
return new Execution(this, process.model(true), flowCreator, flwInstance, args);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public Optional<FlwInstance> executeStartModel(FlowLongContext flowLongContext,
Assert.isTrue(ModelHelper.checkDuplicateNodeKeys(nodeModel), "There are duplicate node keys present");
// 回调执行创建实例
Execution execution = function.apply(nodeModel);
// 重新渲染逻辑节点
nodeModel = execution.getProcessModel().getNodeConfig();
// 创建首个审批任务
flowLongContext.createTask(execution, nodeModel);
// 当前执行实例
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
*/
package test.mysql;

import com.aizuda.bpm.engine.FlowDataTransfer;
import com.aizuda.bpm.engine.model.DynamicAssignee;
import com.aizuda.bpm.engine.model.NodeAssignee;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
Expand All @@ -24,13 +29,27 @@ public void before() {
@Test
public void test() {

String ccNodeKey = "k002"; // 抄送
List<NodeAssignee> assigneeList = Arrays.asList(
// 动态抄送给:用户01、用户02、用户03
NodeAssignee.ofFlowCreator(testCreator),
NodeAssignee.ofFlowCreator(test2Creator)
);

// 传输动态节点处理人
Map<String, Object> dataMap = new HashMap<String, Object>() {{
put(ccNodeKey, DynamicAssignee.assigneeUserList(assigneeList));
}};

FlowDataTransfer.dynamicAssignee(dataMap);

// 启动指定流程定义ID启动流程实例
Map<String, Object> args = new HashMap<>();
args.put("day", 8);
args.put("day", 5);
flowLongEngine.startInstanceById(processId, testCreator, args).ifPresent(instance -> {

// 领导审批,自动抄送,流程结束
this.executeActiveTasks(instance.getId(), test3Creator);
this.executeActiveTasks(instance.getId(), test2Creator);

});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,35 +67,40 @@
"conditionMode": 1,
"conditionList": [],
"childNode": {
"nodeName": "直接主管审批",
"nodeName": "短期不用审核但要抄送",
"nodeKey": "k007",
"type": 1,
"setType": 2,
"nodeAssigneeList": [],
"examineLevel": 1,
"directorLevel": 1,
"selectMode": 1,
"termAuto": false,
"term": 0,
"termMode": 1,
"examineMode": 1,
"directorMode": 0
"type": 2,
"userSelectFlag": true,
"nodeAssigneeList": [
{
"id": "test004",
"name": "李四"
}
]
}
}
],
"childNode": {
"nodeName": "抄送人",
"nodeName": "最后的审批",
"nodeKey": "k008",
"type": 2,
"userSelectFlag": true,
"type": 1,
"setType": 1,
"nodeAssigneeList": [
{
"id": "test002",
"name": "何秀英"
}
]
],
"examineLevel": 1,
"directorLevel": 1,
"selectMode": 1,
"termAuto": false,
"term": 0,
"termMode": 1,
"examineMode": 1,
"directorMode": 0
}
}
}
}
}
}

0 comments on commit d64573a

Please sign in to comment.