fix:修正本地应用节点净室策略问题
This commit is contained in:
1
.idea/MarsCodeWorkspaceAppSettings.xml
generated
1
.idea/MarsCodeWorkspaceAppSettings.xml
generated
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="com.codeverse.userSettings.MarscodeWorkspaceAppSettingsState">
|
<component name="com.codeverse.userSettings.MarscodeWorkspaceAppSettingsState">
|
||||||
|
<option name="chatAppRouterInfo" value="builder/6974288dd7edda860fa0ccdb" />
|
||||||
<option name="progress" value="1.0" />
|
<option name="progress" value="1.0" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -33,9 +33,17 @@ public class UserTaskDirectoryPreparationListener implements ExecutionListener {
|
|||||||
String nodeId = execution.getCurrentActivityId();
|
String nodeId = execution.getCurrentActivityId();
|
||||||
String processDefinitionId = execution.getProcessDefinitionId();
|
String processDefinitionId = execution.getProcessDefinitionId();
|
||||||
|
|
||||||
|
// 【新增逻辑】处理本地应用注册节点的 ID 映射
|
||||||
|
// 如果监听器运行在 Register 节点(例如 "Task_1_register"),我们需要还原为原始 ID ("Task_1")
|
||||||
|
String originalNodeId = FlowNodeIdUtils.parseOriginalNodeId(nodeId);
|
||||||
|
if (!nodeId.equals(originalNodeId)) {
|
||||||
|
log.info("检测到辅助节点,ID 还原: {} -> {}", nodeId, originalNodeId);
|
||||||
|
nodeId = originalNodeId;
|
||||||
|
}
|
||||||
|
|
||||||
//创建本地文件夹,用于后续节点计算直接从本地读取,不需要再从minio中获取数据
|
//创建本地文件夹,用于后续节点计算直接从本地读取,不需要再从minio中获取数据
|
||||||
JSONObject params =processNodeParamService.getParam(processDefinitionId,nodeId,runId);
|
JSONObject params = processNodeParamService.getParam(processDefinitionId, nodeId, runId);
|
||||||
log.info("userTaskDirectoryPreparationListener, 启动流程 runId:{},nodeId:{},实例id: {},参数 params:{}", runId,nodeId,execution.getProcessInstanceId(),params);
|
log.info("userTaskDirectoryPreparationListener, 启动流程 runId:{},nodeId:{},实例id: {},参数 params:{}", runId, nodeId, execution.getProcessInstanceId(), params);
|
||||||
Long currentNodeOutputDirId = params.getLong("outputDirId");
|
Long currentNodeOutputDirId = params.getLong("outputDirId");
|
||||||
if(ObjectUtils.isEmpty(currentNodeOutputDirId)){
|
if(ObjectUtils.isEmpty(currentNodeOutputDirId)){
|
||||||
throw new RuntimeException("当前节点未配置输出文件夹");
|
throw new RuntimeException("当前节点未配置输出文件夹");
|
||||||
@@ -49,4 +57,4 @@ public class UserTaskDirectoryPreparationListener implements ExecutionListener {
|
|||||||
String objectKey = fileBaseInfoResp.getData().getObjectKey();
|
String objectKey = fileBaseInfoResp.getData().getObjectKey();
|
||||||
FlowNodeIdUtils.prepareLocalDir(objectKey);
|
FlowNodeIdUtils.prepareLocalDir(objectKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -553,6 +553,11 @@ public class Dto2BpmnConverter {
|
|||||||
disableAsyncRetry(registerTask);
|
disableAsyncRetry(registerTask);
|
||||||
registerTask.setImplementation("${localAppRegisterDelegate}");
|
registerTask.setImplementation("${localAppRegisterDelegate}");
|
||||||
registerTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
|
registerTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
|
||||||
|
|
||||||
|
// 【新增逻辑】为 Register 节点添加目录准备监听器
|
||||||
|
// 这样在进入组合节点的第一步时,就会执行文件夹清空/准备
|
||||||
|
addDirectoryPreparationListener(registerTask);
|
||||||
|
|
||||||
process.addFlowElement(registerTask);
|
process.addFlowElement(registerTask);
|
||||||
|
|
||||||
// 2. Wait Node (ReceiveTask)
|
// 2. Wait Node (ReceiveTask)
|
||||||
@@ -601,6 +606,23 @@ public class Dto2BpmnConverter {
|
|||||||
process.addFlowElement(userTask);
|
process.addFlowElement(userTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 为节点添加目录准备监听器
|
||||||
|
* @param flowElement 需要添加监听器的节点
|
||||||
|
*/
|
||||||
|
private void addDirectoryPreparationListener(FlowElement flowElement) {
|
||||||
|
FlowableListener dirPrepareListener = new FlowableListener();
|
||||||
|
dirPrepareListener.setEvent("start");
|
||||||
|
dirPrepareListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
|
||||||
|
dirPrepareListener.setImplementation("${userTaskDirectoryPreparationListener}");
|
||||||
|
|
||||||
|
if (flowElement instanceof UserTask) {
|
||||||
|
((UserTask) flowElement).getExecutionListeners().add(dirPrepareListener);
|
||||||
|
} else if (flowElement instanceof ServiceTask) {
|
||||||
|
((ServiceTask) flowElement).getExecutionListeners().add(dirPrepareListener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 抽取通用的 UserTask 扩展属性设置
|
// 抽取通用的 UserTask 扩展属性设置
|
||||||
private void addUserTaskExtensions(UserTask userTask, FlowElementDTO nodeDto) throws JsonProcessingException {
|
private void addUserTaskExtensions(UserTask userTask, FlowElementDTO nodeDto) throws JsonProcessingException {
|
||||||
|
|
||||||
@@ -620,12 +642,11 @@ public class Dto2BpmnConverter {
|
|||||||
// 设置用户任务的属性,使其可以被任何人处理
|
// 设置用户任务的属性,使其可以被任何人处理
|
||||||
// 不设置 assignee 或 candidateUsers,这样任何人都可以处理任务
|
// 不设置 assignee 或 candidateUsers,这样任何人都可以处理任务
|
||||||
|
|
||||||
// 可选:绑定 TaskListener,在任务完成时触发逻辑
|
// 【修改逻辑】仅当不是本地应用节点时,才在 UserTask 上添加目录准备监听器
|
||||||
FlowableListener dirPrepareListener = new FlowableListener();
|
// 因为本地应用节点已经前移到 Register 节点处理了
|
||||||
dirPrepareListener.setEvent("start");
|
if (!FlowNodeIdUtils.isLocalAppNode(nodeDto)) {
|
||||||
dirPrepareListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
|
addDirectoryPreparationListener(userTask);
|
||||||
dirPrepareListener.setImplementation("${userTaskDirectoryPreparationListener}");
|
}
|
||||||
userTask.getExecutionListeners().add(dirPrepareListener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createServiceTask(Process process, FlowElementDTO nodeDto, Map<String, String> asyncTaskMap) throws JsonProcessingException {
|
private void createServiceTask(Process process, FlowElementDTO nodeDto, Map<String, String> asyncTaskMap) throws JsonProcessingException {
|
||||||
|
|||||||
Reference in New Issue
Block a user