feat(REQ-5865) - 解决 triggerAsync 后,业务节点文案消失的问题

This commit is contained in:
wangli 2025-12-04 17:25:03 +08:00
parent 65540e1685
commit 9a0945fac1
2 changed files with 12 additions and 2 deletions

View File

@ -283,6 +283,10 @@ public class CustomTaskHelper {
}
public static void addComment(CommandContext commandContext, TaskEntity task, String type, String message) {
addComment(commandContext, task, type, message, false);
}
public static void addComment(CommandContext commandContext, TaskEntity task, String type, String message, boolean withVariableLocal) {
if (!StringUtils.hasText(type) || !StringUtils.hasText(message)) {
return;
}
@ -307,7 +311,11 @@ public class CustomTaskHelper {
comment.setFullMessage(message);
processEngineConfiguration.getCommentEntityManager().insert(comment);
task.setTransientVariableLocal(type, message);
if (withVariableLocal) {
task.setVariableLocal(type, message);
} else {
task.setTransientVariableLocal(type, message);
}
}
public static Attachment addAttachment(CommandContext commandContext, Task task, AttachmentDTO attachmentDto) {

View File

@ -45,6 +45,7 @@ import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import static cn.axzo.workflow.common.constant.BpmnConstants.AND_SIGN_EXPRESSION;
@ -265,7 +266,7 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
if (Objects.nonNull(advice) && StringUtils.hasText(advice.toString())) {
update.setAdvice(advice.toString());
}
Object operationDesc = taskEntity.getTransientVariableLocal(COMMENT_TYPE_OPERATION_DESC);
Object operationDesc = Optional.ofNullable(taskEntity.getTransientVariableLocal(COMMENT_TYPE_OPERATION_DESC)).orElse(taskEntity.getVariableLocal(COMMENT_TYPE_OPERATION_DESC));
if (Objects.nonNull(operationDesc) && StringUtils.hasText(operationDesc.toString())) {
update.setOperationDesc(Objects.nonNull(assignee) ?
(StringUtils.hasText(assignee.getAssignerName()) ? assignee.getAssignerName() : "") + operationDesc
@ -275,6 +276,7 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
(StringUtils.hasText(assignee.getAssignerName()) ? assignee.getAssignerName() : "")
: "");
}
taskEntity.removeVariableLocal(COMMENT_TYPE_OPERATION_DESC);
String completionType = taskEntity.getVariable(TASK_COMPLETE_OPERATION_TYPE + taskEntity.getId(), String.class);