update - REQ-2324-恢复待办MQ消息增加消息配置信息
This commit is contained in:
parent
d0dfc222f4
commit
6afb6458bb
@ -74,8 +74,8 @@ public class MessagePushEventBuilder {
|
||||
return newEvent;
|
||||
}
|
||||
|
||||
public static MessagePushEvent createPendingRollbackEvent(String processInstanceId, String tenantId, String taskId) {
|
||||
return new MessagePushEventImpl(PENDING_ROLLBACK, null, null, processInstanceId, tenantId, taskId);
|
||||
public static MessagePushEvent createPendingRollbackEvent(String processInstanceId, String tenantId, String taskId, BpmnNoticeConf noticeConf) {
|
||||
return new MessagePushEventImpl(PENDING_ROLLBACK, null, noticeConf, processInstanceId, tenantId, taskId);
|
||||
}
|
||||
|
||||
public static MessagePushEventImpl createCarbonCopyEvent(List<BpmnTaskDelegateAssigner> assigners,
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package cn.axzo.workflow.server.controller.listener.error;
|
||||
|
||||
import cn.axzo.workflow.common.model.request.bpmn.BpmnNoticeConf;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAuditDTO;
|
||||
import cn.axzo.workflow.core.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper;
|
||||
import cn.axzo.workflow.core.engine.event.MessagePushEvent;
|
||||
import cn.axzo.workflow.core.engine.event.MessagePushEventBuilder;
|
||||
import cn.axzo.workflow.core.engine.job.AsyncApproveTaskJobHandler;
|
||||
@ -9,18 +11,21 @@ import cn.axzo.workflow.core.listener.BpmnAsyncJobEventListener;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.flowable.bpmn.model.Process;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEvent;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEventDispatcher;
|
||||
import org.flowable.common.engine.impl.event.FlowableEntityExceptionEventImpl;
|
||||
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.flowable.engine.impl.util.CommandContextUtil;
|
||||
import org.flowable.engine.impl.util.ProcessDefinitionUtil;
|
||||
import org.flowable.job.api.JobInfo;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import static cn.axzo.workflow.core.common.code.BpmnTaskRespCode.TASK_COMPLETE_FAIL_ASSIGN_NOT_SELF;
|
||||
import static cn.axzo.workflow.core.common.code.BpmnTaskRespCode.TASK_COMPLETE_FAIL_NOT_EXISTS;
|
||||
@ -59,9 +64,12 @@ public class ApproveErrorReporterEventListener implements BpmnAsyncJobEventListe
|
||||
BpmnTaskAuditDTO dto = JSONUtil.toBean(jobInfo.getCustomValues(), BpmnTaskAuditDTO.class);
|
||||
WorkflowEngineException exception = (WorkflowEngineException) (throwable);
|
||||
if (!IGNORE_ERROR_CODES.contains(exception.getCode())) {
|
||||
Process process = ProcessDefinitionUtil.getProcess(((FlowableEntityExceptionEventImpl) flowableEvent).getProcessDefinitionId());
|
||||
//获取消息配置
|
||||
Optional<BpmnNoticeConf> noticeConfig = BpmnMetaParserHelper.getNoticeConfig(process);
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
|
||||
FlowableEventDispatcher eventDispatcher = processEngineConfiguration.getEventDispatcher();
|
||||
MessagePushEvent event = MessagePushEventBuilder.createPendingRollbackEvent(jobEvent.getProcessInstanceId(), jobInfo.getTenantId(), dto.getTaskId());
|
||||
MessagePushEvent event = MessagePushEventBuilder.createPendingRollbackEvent(jobEvent.getProcessInstanceId(), jobInfo.getTenantId(), dto.getTaskId(), noticeConfig.orElse(new BpmnNoticeConf()));
|
||||
log.info("发送恢复待办的流程事件消息: taskDto:{},event:{}", JSONUtil.toJsonStr(dto), JSONUtil.toJsonStr(event));
|
||||
eventDispatcher.dispatchEvent(event, processEngineConfiguration.getEngineCfgKey());
|
||||
}
|
||||
|
||||
@ -128,14 +128,14 @@ public class RocketMqMessagePushEventListener extends AbstractBpmnEventListener<
|
||||
return;
|
||||
}
|
||||
log.info("RocketMqMessagePushEventListener#onNotice...msgTemplateId: {}, receivePerson: {}",
|
||||
event.getNoticeConfig().getNotice().getNoticeMessageId(), JSONUtil.toJsonStr(event.getAssigners()));
|
||||
event.getNoticeConfig().getNotice().getNoticeMessageId(), JSONUtil.toJsonStr(event.getAssigners()));
|
||||
if (Objects.nonNull(event.getNoticeConfig().getNotice())) {
|
||||
MessagePushDTO dto = build(event.getNoticeConfig().getNotice().getNoticeMessageId(),
|
||||
PROCESS_PUSH_NOTICE, event, collectionVariable(event));
|
||||
sendMessageQueue(dto, PROCESS_PUSH_NOTICE);
|
||||
}
|
||||
log.info("RocketMqMessagePushEventListener#onNotice...end, msgTemplateId: {}, receivePerson: {}",
|
||||
event.getNoticeConfig().getNotice().getNoticeMessageId(), JSONUtil.toJsonStr(event.getAssigners()));
|
||||
event.getNoticeConfig().getNotice().getNoticeMessageId(), JSONUtil.toJsonStr(event.getAssigners()));
|
||||
}
|
||||
|
||||
|
||||
@ -148,8 +148,8 @@ public class RocketMqMessagePushEventListener extends AbstractBpmnEventListener<
|
||||
return;
|
||||
}
|
||||
log.info("RocketMqMessagePushEventListener#onPendingPush...msgTemplateId: {}, receivePerson: {}",
|
||||
event.getNoticeConfig().getPending().getPendingMessageId(),
|
||||
JSONUtil.toJsonStr(event.getAssigners()));
|
||||
event.getNoticeConfig().getPending().getPendingMessageId(),
|
||||
JSONUtil.toJsonStr(event.getAssigners()));
|
||||
if (Objects.nonNull(event.getNoticeConfig().getPending())) {
|
||||
MessagePushDTO dto = build(event.getNoticeConfig().getPending().getPendingMessageId(),
|
||||
PROCESS_PUSH_PENDING, event, collectionVariable(event));
|
||||
@ -182,8 +182,8 @@ public class RocketMqMessagePushEventListener extends AbstractBpmnEventListener<
|
||||
sendMessageQueue(dto, PROCESS_PUSH_PENDING);
|
||||
}
|
||||
log.info("RocketMqMessagePushEventListener#onPendingPush...end, msgTemplateId: {}, receivePerson: {}",
|
||||
event.getNoticeConfig().getPending().getPendingMessageId(),
|
||||
JSONUtil.toJsonStr(event.getAssigners()));
|
||||
event.getNoticeConfig().getPending().getPendingMessageId(),
|
||||
JSONUtil.toJsonStr(event.getAssigners()));
|
||||
}
|
||||
|
||||
private boolean isHistoryOperationUser(BpmnProcessInstanceVO instance, BpmnTaskDelegateAssigner bpmnTaskDelegateAssigner) {
|
||||
@ -210,25 +210,29 @@ public class RocketMqMessagePushEventListener extends AbstractBpmnEventListener<
|
||||
return;
|
||||
}
|
||||
log.info("RocketMqMessagePushEventListener#onPendingComplete...msgTemplateId: {}, receivePerson: {}",
|
||||
event.getNoticeConfig().getPending().getPendingMessageId(),
|
||||
JSONUtil.toJsonStr(event.getAssigners()));
|
||||
event.getNoticeConfig().getPending().getPendingMessageId(),
|
||||
JSONUtil.toJsonStr(event.getAssigners()));
|
||||
if (Objects.nonNull(event.getNoticeConfig().getPending())) {
|
||||
MessagePushDTO dto = build(event.getNoticeConfig().getPending().getPendingMessageId(),
|
||||
PROCESS_PUSH_PENDING_COMPLETE, event, collectionVariable(event));
|
||||
sendMessageQueue(dto, PROCESS_PUSH_PENDING_COMPLETE);
|
||||
}
|
||||
log.info("RocketMqMessagePushEventListener#onPendingComplete...end, msgTemplateId: {}, receivePerson: " +
|
||||
"{}", event.getNoticeConfig().getPending().getPendingMessageId(),
|
||||
JSONUtil.toJsonStr(event.getAssigners()));
|
||||
"{}", event.getNoticeConfig().getPending().getPendingMessageId(),
|
||||
JSONUtil.toJsonStr(event.getAssigners()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPendingRollback(MessagePushEvent event) {
|
||||
log.info("RocketMqMessagePushEventListener#onPendingRollback...start' event: {}", JSONUtil.toJsonStr(event));
|
||||
if (Objects.nonNull(event.getTaskId())) {
|
||||
MessagePushDTO dto = build(null, PROCESS_PUSH_PENDING_ROLLBACK, event, collectionVariable(event));
|
||||
sendMessageQueue(dto, PROCESS_PUSH_PENDING_ROLLBACK);
|
||||
if (Objects.isNull(event.getNoticeConfig())
|
||||
|| Objects.isNull(event.getNoticeConfig().getPending())
|
||||
|| !StringUtils.hasText(event.getNoticeConfig().getPending().getPendingMessageId())) {
|
||||
log.info("RocketMqMessagePushEventListener#onPendingRollback...ignore,pending message is null' event: {}", JSONUtil.toJsonStr(event));
|
||||
return;
|
||||
}
|
||||
log.info("RocketMqMessagePushEventListener#onPendingRollback...start' event: {}", JSONUtil.toJsonStr(event));
|
||||
MessagePushDTO dto = build(event.getNoticeConfig().getPending().getPendingMessageId(), PROCESS_PUSH_PENDING_ROLLBACK, event, collectionVariable(event));
|
||||
sendMessageQueue(dto, PROCESS_PUSH_PENDING_ROLLBACK);
|
||||
log.info("RocketMqMessagePushEventListener#onPendingRollback...end' event: {}", JSONUtil.toJsonStr(event));
|
||||
}
|
||||
|
||||
@ -240,16 +244,16 @@ public class RocketMqMessagePushEventListener extends AbstractBpmnEventListener<
|
||||
return;
|
||||
}
|
||||
log.info("RocketMqMessagePushEventListener#onCarbonCopy... cc' templateId: {}, receivePerson: {}",
|
||||
event.getNoticeConfig().getCarbonCopy().getCarbonCopyMessageId(),
|
||||
JSONUtil.toJsonStr(event.getAssigners()));
|
||||
event.getNoticeConfig().getCarbonCopy().getCarbonCopyMessageId(),
|
||||
JSONUtil.toJsonStr(event.getAssigners()));
|
||||
if (Objects.nonNull(event.getNoticeConfig().getCarbonCopy())) {
|
||||
MessagePushDTO dto = build(event.getNoticeConfig().getCarbonCopy().getCarbonCopyMessageId(),
|
||||
PROCESS_CARBON_COPY, event, collectionVariable(event));
|
||||
sendMessageQueue(dto, PROCESS_CARBON_COPY);
|
||||
}
|
||||
log.info("RocketMqMessagePushEventListener#onCarbonCopy...end, cc' templateId: {}, receivePerson: {}",
|
||||
event.getNoticeConfig().getCarbonCopy().getCarbonCopyMessageId(),
|
||||
JSONUtil.toJsonStr(event.getAssigners()));
|
||||
event.getNoticeConfig().getCarbonCopy().getCarbonCopyMessageId(),
|
||||
JSONUtil.toJsonStr(event.getAssigners()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -265,14 +269,14 @@ public class RocketMqMessagePushEventListener extends AbstractBpmnEventListener<
|
||||
return;
|
||||
}
|
||||
log.info("RocketMqMessagePushEventListener#onCarbonCopyComplete... cc' templateId: {}",
|
||||
event.getNoticeConfig().getCarbonCopy().getCarbonCopyMessageId());
|
||||
event.getNoticeConfig().getCarbonCopy().getCarbonCopyMessageId());
|
||||
if (Objects.nonNull(event.getNoticeConfig().getCarbonCopy())) {
|
||||
MessagePushDTO dto = build(event.getNoticeConfig().getCarbonCopy().getCarbonCopyMessageId(),
|
||||
PROCESS_CARBON_COPY_COMPLETE, event, collectionVariable(event));
|
||||
sendMessageQueue(dto, PROCESS_CARBON_COPY_COMPLETE);
|
||||
}
|
||||
log.info("RocketMqMessagePushEventListener#onCarbonCopyComplete...end, cc' templateId: {}",
|
||||
event.getNoticeConfig().getCarbonCopy().getCarbonCopyMessageId());
|
||||
event.getNoticeConfig().getCarbonCopy().getCarbonCopyMessageId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -284,14 +288,14 @@ public class RocketMqMessagePushEventListener extends AbstractBpmnEventListener<
|
||||
return;
|
||||
}
|
||||
log.info("RocketMqMessagePushEventListener#onSms...msgTemplateId: {}, receivePerson: {}",
|
||||
event.getNoticeConfig().getSms().getSmsId(), JSONUtil.toJsonStr(event.getAssigners()));
|
||||
event.getNoticeConfig().getSms().getSmsId(), JSONUtil.toJsonStr(event.getAssigners()));
|
||||
if (Objects.nonNull(event.getNoticeConfig().getCarbonCopy())) {
|
||||
MessagePushDTO dto = build(event.getNoticeConfig().getSms().getSmsId(),
|
||||
PROCESS_PUSH_SMS, event, collectionVariable(event));
|
||||
sendMessageQueue(dto, PROCESS_PUSH_SMS);
|
||||
}
|
||||
log.info("RocketMqMessagePushEventListener#onSms...end, msgTemplateId: {}, receivePerson: {}",
|
||||
event.getNoticeConfig().getSms().getSmsId(), JSONUtil.toJsonStr(event.getAssigners()));
|
||||
event.getNoticeConfig().getSms().getSmsId(), JSONUtil.toJsonStr(event.getAssigners()));
|
||||
}
|
||||
|
||||
private Map<String, Object> collectionVariable(MessagePushEvent event) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user