feat(REQ-2924) - 业务节点增加完成时的操作描述
This commit is contained in:
parent
7d6561cb9f
commit
27a640048a
@ -7,14 +7,16 @@ import org.flowable.common.engine.impl.interceptor.CommandContext;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.flowable.engine.impl.util.CommandContextUtil;
|
||||
import org.flowable.engine.runtime.Execution;
|
||||
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_OPERATION_DESC;
|
||||
import static cn.axzo.workflow.core.common.code.BpmnTaskRespCode.ACTIVITY_TRIGGER_NOT_EXISTS;
|
||||
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.addComment;
|
||||
|
||||
/**
|
||||
* 自定义(同步)流转业务姐弟那的命令器实现
|
||||
@ -40,11 +42,14 @@ public class CustomActivityTriggerCmd extends AbstractCommand<Void> implements S
|
||||
public Void execute(CommandContext commandContext) {
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration =
|
||||
CommandContextUtil.getProcessEngineConfiguration(commandContext);
|
||||
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
|
||||
Execution execution = runtimeService.createExecutionQuery().executionId(dto.getTriggerId()).singleResult();
|
||||
if (Objects.isNull(execution)) {
|
||||
|
||||
TaskEntity task = (TaskEntity) processEngineConfiguration.getTaskService()
|
||||
.createTaskQuery().executionId(dto.getTriggerId()).singleResult();
|
||||
if (Objects.isNull(task)) {
|
||||
throw new WorkflowEngineException(ACTIVITY_TRIGGER_NOT_EXISTS, dto.getTriggerId());
|
||||
}
|
||||
addComment(commandContext, task, COMMENT_TYPE_OPERATION_DESC, "已处理");
|
||||
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
|
||||
runtimeService.trigger(dto.getTriggerId());
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1255,10 +1255,22 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
.filter(i -> Objects.equals(i.getTaskDefinitionKey(), e.getActivityId())).findAny();
|
||||
|
||||
if (processingTask.isPresent()) {
|
||||
// 多实例的情况,需要合并节点
|
||||
processingTask.ifPresent(i -> {
|
||||
List<BpmnTaskDelegateAssigner> assigners = new ArrayList<>();
|
||||
List<BpmnTaskDelegateAssigner> assigners = new ArrayList<>(ListUtils.emptyIfNull(i.getForecastAssignees()));
|
||||
assigners.add(i.getAssigneeSnapshot());
|
||||
assigners.add(BpmnTaskDelegateAssigner.toObjectCompatible(CollectionUtils.isEmpty(ListUtils.emptyIfNull(e.getAssigneeFull())) ? null : e.getAssigneeFull().get(0)));
|
||||
switch (i.getNodeMode()) {
|
||||
case AND:
|
||||
i.setOperationDesc(assigners.size() + "人会签,需要全部同意");
|
||||
break;
|
||||
case OR:
|
||||
i.setOperationDesc(assigners.size() + "人或签,仅一人同意即可");
|
||||
break;
|
||||
default:
|
||||
// 不修改操作描述
|
||||
break;
|
||||
}
|
||||
i.setAssigneeSnapshot(null);
|
||||
i.setForecastAssignees(assigners);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user