update - 审批任务查询, 新增返回抄送节点的抄送人信息

This commit is contained in:
wangli 2024-03-25 15:42:46 +08:00
parent 7f20397a6b
commit 4d8341f522
3 changed files with 26 additions and 1 deletions

View File

@ -130,6 +130,15 @@ public class BpmnHistoricTaskInstanceVO {
@ApiModelProperty(value = "审批人的快照信息", notes = "完整的审批人信息,assignee 仅是唯一标识")
private BpmnTaskDelegateAssigner assigneeSnapshot;
/**
* 抄送人
* <p>
* 抄送节点特有,由于该模型最初的设计是一个人对应一个任务, 就算是相同的审批节点也是这个规则.
* 但是抄送非常特殊, 一个抄送节点, 默认就要对应多人
*/
@ApiModelProperty(value = "抄送人", notes = "抄送节点特有")
private List<BpmnTaskDelegateAssigner> forecastAssignees;
/**
* 节点本身的类型
*/

View File

@ -13,6 +13,7 @@ import org.flowable.bpmn.model.Process;
import org.flowable.bpmn.model.ServiceTask;
import org.flowable.common.engine.api.delegate.event.FlowableEventDispatcher;
import org.flowable.common.engine.impl.interceptor.CommandExecutor;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.JavaDelegate;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
@ -30,6 +31,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT;
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getCarbonCopyConfigs;
/**
@ -73,6 +75,11 @@ public class EngineCarbonCopyEventListener implements JavaDelegate {
historicTaskInstanceConverter, serviceVersion)));
});
RuntimeService runtimeService =
springProcessEngineConfiguration.getProcessEngineConfiguration().getRuntimeService();
runtimeService.setVariable(processInstanceId,
INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + currentActivityId, carbonUsers);
// 发送抄送事件
invokeCarbonCopy(carbonUsers, BpmnMetaParserHelper.getNoticeConfig(mainProcess), execution);

View File

@ -96,6 +96,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_TASK_RELAT
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_ASSIGNEE;
import static cn.axzo.workflow.common.constant.BpmnConstants.OLD_INTERNAL_TASK_RELATION_ASSIGNEE_INFO_SNAPSHOT;
import static cn.axzo.workflow.common.constant.BpmnConstants.WORKFLOW_ENGINE_VERSION;
import static cn.axzo.workflow.common.enums.BpmnFlowNodeType.NODE_CARBON_COPY;
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.APPROVED;
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.PROCESSING;
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.REJECTED;
@ -389,7 +390,15 @@ public class BpmnProcessTaskServiceImpl implements BpmnProcessTaskService {
if (Objects.nonNull(assigner) && !Objects.equals(assigner.buildAssigneeId(), NO_ASSIGNEE)) {
vo.setAssigneeSnapshot(assigner);
}
BpmnMetaParserHelper.getNodeType(bpmnModel.getFlowElement(vo.getTaskDefinitionKey())).ifPresent(vo::setNodeType);
BpmnMetaParserHelper.getNodeType(bpmnModel.getFlowElement(vo.getTaskDefinitionKey())).ifPresent(nodeType -> {
vo.setNodeType(nodeType);
if (Objects.equals(NODE_CARBON_COPY, nodeType)) {
HistoricVariableInstance carbonUsers =
variableInstanceMap.getOrDefault(INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + vo.getTaskDefinitionKey(), null);
vo.setForecastAssignees(Objects.isNull(carbonUsers) ? Collections.emptyList() :
(List<BpmnTaskDelegateAssigner>) carbonUsers.getValue());
}
});
}
return vos;
}