mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-26 13:48:20 +00:00
update 优化 工作流创建事件 将状态交给业务方处理
This commit is contained in:
@@ -54,6 +54,11 @@ public class ProcessCreateTaskEvent extends RemoteApplicationEvent {
|
||||
*/
|
||||
private String businessId;
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
public ProcessCreateTaskEvent() {
|
||||
super(new Object(), SpringUtils.getApplicationName(), DEFAULT_DESTINATION_FACTORY.getDestination(null));
|
||||
}
|
||||
|
@@ -68,6 +68,7 @@ public class FlowProcessEventHandler {
|
||||
processCreateTaskEvent.setNodeCode(instance.getNodeCode());
|
||||
processCreateTaskEvent.setNodeName(instance.getNodeName());
|
||||
processCreateTaskEvent.setTaskId(taskId);
|
||||
processCreateTaskEvent.setStatus(instance.getFlowStatus());
|
||||
SpringUtils.context().publishEvent(processCreateTaskEvent);
|
||||
}
|
||||
|
||||
|
@@ -52,7 +52,7 @@ public class WorkflowGlobalListener implements GlobalListener {
|
||||
Instance instance = listenerVariable.getInstance();
|
||||
Definition definition = listenerVariable.getDefinition();
|
||||
Task task = listenerVariable.getTask();
|
||||
if (task != null && BusinessStatusEnum.WAITING.getStatus().equals(instance.getFlowStatus())) {
|
||||
if (task != null) {
|
||||
// 判断流程状态(发布审批中事件)
|
||||
flowProcessEventHandler.processCreateTaskHandler(definition.getFlowCode(), instance, task.getId());
|
||||
}
|
||||
|
@@ -180,9 +180,11 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
||||
public void processCreateTaskHandler(ProcessCreateTaskEvent processCreateTaskEvent) {
|
||||
TenantHelper.dynamic(processCreateTaskEvent.getTenantId(), () -> {
|
||||
log.info("当前任务创建了{}", processCreateTaskEvent.toString());
|
||||
if (BusinessStatusEnum.WAITING.getStatus().equals(processCreateTaskEvent.getStatus())) {
|
||||
TestLeave testLeave = baseMapper.selectById(Long.valueOf(processCreateTaskEvent.getBusinessId()));
|
||||
testLeave.setStatus(BusinessStatusEnum.WAITING.getStatus());
|
||||
baseMapper.updateById(testLeave);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user