update - Activity 事件新增返回 variables
This commit is contained in:
parent
a487a4f3a0
commit
f1e3062433
@ -5,6 +5,7 @@ import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 流程活动 MQ payload 模型
|
||||
@ -28,4 +29,6 @@ public class ProcessActivityDTO implements Serializable {
|
||||
|
||||
private String triggerId;
|
||||
|
||||
private Map<String, Object> variables;
|
||||
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ public class BpmnProcessModelServiceImpl implements BpmnProcessModelService {
|
||||
}
|
||||
} else {
|
||||
baseQuerySql.append(sqlConnectors(baseQuerySql))
|
||||
.append(" TENANT_ID_ == '' ");
|
||||
.append(" TENANT_ID_ = '' ");
|
||||
}
|
||||
|
||||
baseQuerySql.append(sqlConnectors(baseQuerySql))
|
||||
|
||||
@ -8,13 +8,16 @@ import cn.axzo.workflow.core.listener.BpmnActivityEventListener;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEngineEvent;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.delegate.event.FlowableActivityCancelledEvent;
|
||||
import org.flowable.engine.delegate.event.FlowableActivityEvent;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.axzo.workflow.common.enums.ProcessActivityEventEnum.PROCESS_ACTIVITY_CANCELLED;
|
||||
import static cn.axzo.workflow.common.enums.ProcessActivityEventEnum.PROCESS_ACTIVITY_COMPLETED;
|
||||
@ -31,7 +34,8 @@ import static cn.axzo.workflow.common.enums.ProcessActivityEventEnum.PROCESS_ACT
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RocketMqBpmActivityEventListener implements BpmnActivityEventListener, Ordered {
|
||||
|
||||
@Resource
|
||||
private RuntimeService runtimeService;
|
||||
@Resource
|
||||
private EventProducer<?> eventProducer;
|
||||
@Value("${sendMq:true}")
|
||||
@ -53,6 +57,11 @@ public class RocketMqBpmActivityEventListener implements BpmnActivityEventListen
|
||||
dto.setActivityId(flowableEvent.getActivityId());
|
||||
dto.setActivityName(flowableEvent.getActivityName());
|
||||
}
|
||||
ProcessInstance processInstance =
|
||||
runtimeService.createProcessInstanceQuery().processInstanceId(event.getProcessInstanceId()).includeProcessVariables().singleResult();
|
||||
if (Objects.nonNull(processInstance)) {
|
||||
dto.setVariables(processInstance.getProcessVariables());
|
||||
}
|
||||
log.info("RocketMqBpmActivityEventListener#onStarted MQ.Data: {}", JSON.toJSONString(dto));
|
||||
sendMessageQueue(dto, PROCESS_ACTIVITY_STARTED);
|
||||
}
|
||||
@ -73,6 +82,11 @@ public class RocketMqBpmActivityEventListener implements BpmnActivityEventListen
|
||||
dto.setActivityId(flowableEvent.getActivityId());
|
||||
dto.setActivityName(flowableEvent.getActivityName());
|
||||
}
|
||||
ProcessInstance processInstance =
|
||||
runtimeService.createProcessInstanceQuery().processInstanceId(event.getProcessInstanceId()).includeProcessVariables().singleResult();
|
||||
if (Objects.nonNull(processInstance)) {
|
||||
dto.setVariables(processInstance.getProcessVariables());
|
||||
}
|
||||
log.info("RocketMqBpmActivityEventListener#onCompleted MQ.Data: {}", JSON.toJSONString(dto));
|
||||
sendMessageQueue(dto, PROCESS_ACTIVITY_COMPLETED);
|
||||
}
|
||||
@ -93,7 +107,11 @@ public class RocketMqBpmActivityEventListener implements BpmnActivityEventListen
|
||||
dto.setActivityId(flowableEvent.getActivityId());
|
||||
dto.setActivityName(flowableEvent.getActivityName());
|
||||
}
|
||||
|
||||
ProcessInstance processInstance =
|
||||
runtimeService.createProcessInstanceQuery().processInstanceId(event.getProcessInstanceId()).includeProcessVariables().singleResult();
|
||||
if (Objects.nonNull(processInstance)) {
|
||||
dto.setVariables(processInstance.getProcessVariables());
|
||||
}
|
||||
log.info("RocketMqBpmActivityEventListener#onCancelled MQ.Data: {}", JSON.toJSONString(dto));
|
||||
sendMessageQueue(dto, PROCESS_ACTIVITY_CANCELLED);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user