update - 调整"业务指定审批人"的 operationDesc 生成的位置

This commit is contained in:
wangli 2024-01-08 15:14:08 +08:00
parent 27fd38fc06
commit 739028266a
2 changed files with 10 additions and 3 deletions

View File

@ -39,7 +39,6 @@ import java.util.Objects;
import java.util.Optional;
import static cn.axzo.workflow.common.constant.BpmnConstants.BPM_ALLOW_SKIP_USER_TASK;
import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_OPERATION_DESC;
import static cn.axzo.workflow.common.constant.BpmnConstants.DUMMY_ASSIGNEE;
import static cn.axzo.workflow.common.constant.BpmnConstants.DUMMY_ASSIGNEE_TYPE;
import static cn.axzo.workflow.common.constant.BpmnConstants.FLOW_SERVER_VERSION_121;
@ -117,8 +116,6 @@ public class EngineExecutionStartListener implements ExecutionListener {
execution.setVariable(INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + currentActivityId, Lists.newArrayList(dummyApprover));
taskService.addComment(userTask.getId(), execution.getProcessInstanceId(),
COMMENT_TYPE_OPERATION_DESC, "业务指定审批人");
// 触发事件
ProcessEngineConfigurationImpl processEngineConfiguration =
CommandContextUtil.getProcessEngineConfiguration();

View File

@ -5,6 +5,7 @@ import cn.axzo.workflow.core.listener.BpmnTaskEventListener;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.task.service.delegate.DelegateTask;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
@ -12,6 +13,8 @@ import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Objects;
import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_OPERATION_DESC;
import static cn.axzo.workflow.common.constant.BpmnConstants.DUMMY_ASSIGNEE_ID;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_TASK_RELATION_ASSIGNEE_INFO;
@ -33,6 +36,7 @@ public class SnapshotBpmnTaskTaskEventListener implements BpmnTaskEventListener,
}
private final RuntimeService runtimeService;
private final TaskService taskService;
@Override
public void onAssigned(DelegateTask delegateTask) {
@ -47,6 +51,12 @@ public class SnapshotBpmnTaskTaskEventListener implements BpmnTaskEventListener,
// 保存每个 taskId 的审批人
delegateTask.setVariable(INTERNAL_TASK_RELATION_ASSIGNEE_INFO + delegateTask.getId(), i);
});
// 业务指定审批人时, 添加 operationDesc
if (Objects.equals(DUMMY_ASSIGNEE_ID, delegateTask.getAssignee())) {
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(),
COMMENT_TYPE_OPERATION_DESC, "业务指定审批人");
}
if (log.isDebugEnabled()) {
log.debug("SnapshotBpmnTaskTaskEventListener#onAssigned...end: {}", delegateTask.getTaskDefinitionKey());
}