update 优化发布事件增加租户ID

This commit is contained in:
AprilWind 2024-12-27 09:08:10 +08:00
parent b63231fe8c
commit 00177c28f5
4 changed files with 25 additions and 3 deletions

View File

@ -16,6 +16,11 @@ public class ProcessDeleteEvent implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 租户ID
*/
private String tenantId;
/**
* 流程定义编码
*/

View File

@ -16,6 +16,11 @@ public class ProcessEvent implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 租户ID
*/
private String tenantId;
/**
* 流程定义编码
*/

View File

@ -16,6 +16,11 @@ public class ProcessTaskEvent implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 租户ID
*/
private String tenantId;
/**
* 流程定义编码
*/

View File

@ -5,6 +5,7 @@ import org.dromara.common.core.domain.event.ProcessDeleteEvent;
import org.dromara.common.core.domain.event.ProcessEvent;
import org.dromara.common.core.domain.event.ProcessTaskEvent;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.common.satoken.utils.LoginHelper;
import org.springframework.stereotype.Component;
/**
@ -26,8 +27,10 @@ public class FlowProcessEventHandler {
* @param submit 当为true时为申请人节点办理
*/
public void processHandler(String flowCode, String businessId, String status, boolean submit) {
log.info("发布流程事件,流程状态: {}, 流程编码: {}, 业务ID: {}", status, flowCode, businessId);
String tenantId = LoginHelper.getTenantId();
log.info("发布流程事件租户ID: {}, 流程状态: {}, 流程编码: {}, 业务ID: {}, 是否申请人节点办理: {}", tenantId, status, flowCode, businessId, submit);
ProcessEvent processEvent = new ProcessEvent();
processEvent.setTenantId(tenantId);
processEvent.setFlowCode(flowCode);
processEvent.setBusinessId(businessId);
processEvent.setStatus(status);
@ -44,8 +47,10 @@ public class FlowProcessEventHandler {
* @param businessId 业务id
*/
public void processTaskHandler(String flowCode, String nodeCode, Long taskId, String businessId) {
log.info("发布流程任务事件, 流程编码: {}, 业务ID: {}", flowCode, businessId);
String tenantId = LoginHelper.getTenantId();
log.info("发布流程任务事件, 租户ID: {}, 流程编码: {}, 节点编码: {}, 任务ID: {}, 业务ID: {}", tenantId, flowCode, nodeCode, taskId, businessId);
ProcessTaskEvent processTaskEvent = new ProcessTaskEvent();
processTaskEvent.setTenantId(tenantId);
processTaskEvent.setFlowCode(flowCode);
processTaskEvent.setNodeCode(nodeCode);
processTaskEvent.setTaskId(taskId);
@ -60,8 +65,10 @@ public class FlowProcessEventHandler {
* @param businessId 业务ID
*/
public void processDeleteHandler(String flowCode, String businessId) {
log.info("发布删除流程事件, 流程编码: {}, 业务ID: {}", flowCode, businessId);
String tenantId = LoginHelper.getTenantId();
log.info("发布删除流程事件, 租户ID: {}, 流程编码: {}, 业务ID: {}", tenantId, flowCode, businessId);
ProcessDeleteEvent processDeleteEvent = new ProcessDeleteEvent();
processDeleteEvent.setTenantId(tenantId);
processDeleteEvent.setFlowCode(flowCode);
processDeleteEvent.setBusinessId(businessId);
SpringUtils.context().publishEvent(processDeleteEvent);