update - 转交功能优化 OperationDesc 的处理逻辑

This commit is contained in:
wangli 2024-01-13 01:04:59 +08:00
parent bc4b828763
commit f432c76905
2 changed files with 6 additions and 13 deletions

View File

@ -7,7 +7,6 @@ import cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper;
import cn.axzo.workflow.core.service.ExtAxHiTaskInstService;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.flowable.common.engine.impl.identity.Authentication;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.engine.RuntimeService;
@ -16,15 +15,15 @@ import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.engine.impl.util.CommandContextUtil;
import org.flowable.task.api.Task;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import org.springframework.util.StringUtils;
import java.io.Serializable;
import java.util.List;
import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_ADVICE;
import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_OPERATION_DESC;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT;
import static cn.axzo.workflow.common.constant.BpmnConstants.TASK_COMPLETE_OPERATION_TYPE;
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.COUNTERSIGN;
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.addComment;
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.batchAddAttachment;
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.createVirtualTask;
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.deleteMultiTask;
@ -161,15 +160,9 @@ public class CustomCountersignUserTaskCmd implements Command<Void>, Serializable
}
}
message.append("").append(targetTaskAssigneeList.size()).append("人进行审批");
createVirtualTask(commandContext, extAxHiTaskInstService, task.getProcessInstanceId(), task.getName(),
task.getTaskDefinitionKey(), message.toString(),
originTaskAssignee, COUNTERSIGN.getStatus());
Authentication.setAuthenticatedUserId(originTaskAssignee.buildAssigneeId());
if (StringUtils.hasLength(advice)) {
taskService.addComment(originTaskId, task.getProcessInstanceId(), COMMENT_TYPE_ADVICE, advice);
}
Task virtualTask = createVirtualTask(commandContext, extAxHiTaskInstService, task.getProcessInstanceId(), task.getName(),
task.getTaskDefinitionKey(), advice, originTaskAssignee, COUNTERSIGN.getStatus());
addComment(commandContext, virtualTask, COMMENT_TYPE_OPERATION_DESC, message.toString());
batchAddAttachment(commandContext, task.getProcessInstanceId(), task.getId(), attachmentList, originTaskAssignee);
Authentication.setAuthenticatedUserId(null);
}
}

View File

@ -248,7 +248,7 @@ public class CustomTaskHelper {
.filter(i -> Objects.equals(i.getId(), task.getId())).findAny()
.ifPresent(i -> i.setAssignee(assigner.buildAssigneeId()));
// 添加"操作描述"
// 添加审批意见
addAdvice(commandContext, task, advice, assigner.buildAssigneeId());
CustomTaskHelper.createExtTaskInst(extAxHiTaskInstService, task.getProcessInstanceId(), task.getId(),