[重大更改] 移除多租户相关功能

This commit is contained in:
疯狂的狮子Li
2026-01-13 16:14:52 +08:00
parent 55098339d4
commit 145b903185
118 changed files with 676 additions and 4576 deletions

View File

@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.tenant.core.TenantEntity;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import java.io.Serial;
import java.util.ArrayList;
@@ -21,7 +21,7 @@ import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("flow_category")
public class FlowCategory extends TenantEntity {
public class FlowCategory extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;

View File

@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.tenant.core.TenantEntity;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import java.io.Serial;
@@ -18,7 +18,7 @@ import java.io.Serial;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("flow_instance_biz_ext")
public class FlowInstanceBizExt extends TenantEntity {
public class FlowInstanceBizExt extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;

View File

@@ -31,11 +31,6 @@ public class FlowDefinitionVo implements Serializable {
*/
private Date updateTime;
/**
* 租户ID
*/
private String tenantId;
/**
* 删除标记
*/

View File

@@ -35,11 +35,6 @@ public class FlowHisTaskVo implements Serializable {
*/
private Date updateTime;
/**
* 租户ID
*/
private String tenantId;
/**
* 删除标记
*/

View File

@@ -27,11 +27,6 @@ public class FlowInstanceVo {
*/
private Date updateTime;
/**
* 租户ID
*/
private String tenantId;
/**
* 删除标记
*/

View File

@@ -36,11 +36,6 @@ public class FlowTaskVo implements Serializable {
*/
private Date updateTime;
/**
* 租户ID
*/
private String tenantId;
/**
* 删除标记
*/

View File

@@ -1,11 +1,10 @@
package org.dromara.workflow.handler;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.event.ProcessTaskEvent;
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.tenant.helper.TenantHelper;
import org.dromara.warm.flow.core.entity.Instance;
import org.dromara.warm.flow.core.entity.Task;
import org.dromara.workflow.common.ConditionalOnEnable;
@@ -34,11 +33,9 @@ public class FlowProcessEventHandler {
* @param submit 当为true时为申请人节点办理
*/
public void processHandler(String flowCode, Instance instance, String status, Map<String, Object> params, boolean submit) {
String tenantId = TenantHelper.getTenantId();
log.info("【流程事件发布】租户ID: {}, 流程编码: {}, 业务ID: {}, 流程状态: {}, 节点类型: {}, 节点编码: {}, 节点名称: {}, 是否申请人节点: {}, 参数: {}",
tenantId, flowCode, instance.getBusinessId(), status, instance.getNodeType(), instance.getNodeCode(), instance.getNodeName(), submit, params);
log.info("【流程事件发布】流程编码: {}, 业务ID: {}, 流程状态: {}, 节点类型: {}, 节点编码: {}, 节点名称: {}, 是否申请人节点: {}, 参数: {}",
flowCode, instance.getBusinessId(), status, instance.getNodeType(), instance.getNodeCode(), instance.getNodeName(), submit, params);
ProcessEvent processEvent = new ProcessEvent();
processEvent.setTenantId(tenantId);
processEvent.setFlowCode(flowCode);
processEvent.setInstanceId(instance.getId());
processEvent.setBusinessId(instance.getBusinessId());
@@ -60,11 +57,9 @@ public class FlowProcessEventHandler {
* @param params 上一个任务的办理参数
*/
public void processTaskHandler(String flowCode, Instance instance, Task nextTask, Map<String, Object> params) {
String tenantId = TenantHelper.getTenantId();
log.info("【流程任务事件发布】租户ID: {}, 流程编码: {}, 业务ID: {}, 节点类型: {}, 节点编码: {}, 节点名称: {}, 任务ID: {}",
tenantId, flowCode, instance.getBusinessId(), nextTask.getNodeType(), nextTask.getNodeCode(), nextTask.getNodeName(), nextTask.getId());
log.info("【流程任务事件发布】流程编码: {}, 业务ID: {}, 节点类型: {}, 节点编码: {}, 节点名称: {}, 任务ID: {}",
flowCode, instance.getBusinessId(), nextTask.getNodeType(), nextTask.getNodeCode(), nextTask.getNodeName(), nextTask.getId());
ProcessTaskEvent processTaskEvent = new ProcessTaskEvent();
processTaskEvent.setTenantId(tenantId);
processTaskEvent.setFlowCode(flowCode);
processTaskEvent.setInstanceId(instance.getId());
processTaskEvent.setBusinessId(instance.getBusinessId());
@@ -84,10 +79,8 @@ public class FlowProcessEventHandler {
* @param businessId 业务ID
*/
public void processDeleteHandler(String flowCode, String businessId) {
String tenantId = TenantHelper.getTenantId();
log.info("【流程删除事件发布】租户ID: {}, 流程编码: {}, 业务ID: {}", tenantId, flowCode, businessId);
log.info("【流程删除事件发布】流程编码: {}, 业务ID: {}", flowCode, businessId);
ProcessDeleteEvent processDeleteEvent = new ProcessDeleteEvent();
processDeleteEvent.setTenantId(tenantId);
processDeleteEvent.setFlowCode(flowCode);
processDeleteEvent.setBusinessId(businessId);
SpringUtils.context().publishEvent(processDeleteEvent);

View File

@@ -69,10 +69,4 @@ public interface IFlwDefinitionService {
*/
boolean removeDef(List<Long> ids);
/**
* 新增租户流程定义
*
* @param tenantId 租户id
*/
void syncDef(String tenantId);
}

View File

@@ -23,14 +23,11 @@ import org.dromara.warm.flow.core.service.DefService;
import org.dromara.warm.flow.orm.entity.FlowDefinition;
import org.dromara.warm.flow.orm.entity.FlowHisTask;
import org.dromara.warm.flow.orm.entity.FlowNode;
import org.dromara.warm.flow.orm.entity.FlowSkip;
import org.dromara.warm.flow.orm.mapper.FlowDefinitionMapper;
import org.dromara.warm.flow.orm.mapper.FlowHisTaskMapper;
import org.dromara.warm.flow.orm.mapper.FlowNodeMapper;
import org.dromara.warm.flow.orm.mapper.FlowSkipMapper;
import org.dromara.workflow.common.ConditionalOnEnable;
import org.dromara.workflow.common.constant.FlowConstant;
import org.dromara.workflow.domain.FlowCategory;
import org.dromara.workflow.domain.vo.FlowDefinitionVo;
import org.dromara.workflow.mapper.FlwCategoryMapper;
import org.dromara.workflow.service.IFlwCommonService;
@@ -45,8 +42,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.dromara.common.core.constant.TenantConstants.DEFAULT_TENANT_ID;
/**
* 流程定义 服务层实现
*
@@ -200,71 +195,4 @@ public class FlwDefinitionServiceImpl implements IFlwDefinitionService {
return true;
}
/**
* 新增租户流程定义
*
* @param tenantId 租户id
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void syncDef(String tenantId) {
FlowCategory flowCategory = flwCategoryMapper.selectOne(new LambdaQueryWrapper<FlowCategory>()
.eq(FlowCategory::getTenantId, DEFAULT_TENANT_ID)
.eq(FlowCategory::getCategoryId, FlowConstant.FLOW_CATEGORY_ID));
flowCategory.setCategoryId(null);
flowCategory.setTenantId(tenantId);
flowCategory.setCreateDept(null);
flowCategory.setCreateBy(null);
flowCategory.setCreateTime(null);
flowCategory.setUpdateBy(null);
flowCategory.setUpdateTime(null);
flwCategoryMapper.insert(flowCategory);
List<FlowDefinition> flowDefinitions = flowDefinitionMapper.selectList(new LambdaQueryWrapper<FlowDefinition>().eq(FlowDefinition::getTenantId, DEFAULT_TENANT_ID));
if (CollUtil.isEmpty(flowDefinitions)) {
return;
}
List<Long> defIds = StreamUtils.toList(flowDefinitions, FlowDefinition::getId);
List<FlowNode> flowNodes = flowNodeMapper.selectList(new LambdaQueryWrapper<FlowNode>().in(FlowNode::getDefinitionId, defIds));
List<FlowSkip> flowSkips = flowSkipMapper.selectList(new LambdaQueryWrapper<FlowSkip>().in(FlowSkip::getDefinitionId, defIds));
for (FlowDefinition definition : flowDefinitions) {
FlowDefinition flowDefinition = BeanUtil.toBean(definition, FlowDefinition.class);
flowDefinition.setId(null);
flowDefinition.setTenantId(tenantId);
flowDefinition.setIsPublish(0);
flowDefinition.setCategory(Convert.toStr(flowCategory.getCategoryId()));
int insert = flowDefinitionMapper.insert(flowDefinition);
if (insert <= 0) {
log.info("同步流程定义【{}】失败!", definition.getFlowCode());
continue;
}
log.info("同步流程定义【{}】成功!", definition.getFlowCode());
Long definitionId = flowDefinition.getId();
if (CollUtil.isNotEmpty(flowNodes)) {
List<FlowNode> nodes = StreamUtils.filter(flowNodes, node -> node.getDefinitionId().equals(definition.getId()));
if (CollUtil.isNotEmpty(nodes)) {
List<FlowNode> flowNodeList = BeanUtil.copyToList(nodes, FlowNode.class);
flowNodeList.forEach(e -> {
e.setId(null);
e.setDefinitionId(definitionId);
e.setTenantId(tenantId);
e.setPermissionFlag(null);
});
flowNodeMapper.insertOrUpdate(flowNodeList);
}
}
if (CollUtil.isNotEmpty(flowSkips)) {
List<FlowSkip> skips = StreamUtils.filter(flowSkips, skip -> skip.getDefinitionId().equals(definition.getId()));
if (CollUtil.isNotEmpty(skips)) {
List<FlowSkip> flowSkipList = BeanUtil.copyToList(skips, FlowSkip.class);
flowSkipList.forEach(e -> {
e.setId(null);
e.setDefinitionId(definitionId);
e.setTenantId(tenantId);
});
flowSkipMapper.insertOrUpdate(flowSkipList);
}
}
}
}
}

View File

@@ -720,7 +720,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
@Transactional(rollbackFor = Exception.class)
public boolean taskOperation(TaskOperationBo bo, String taskOperation) {
FlowParams flowParams = FlowParams.build().message(bo.getMessage());
if (LoginHelper.isSuperAdmin() || LoginHelper.isTenantAdmin()) {
if (LoginHelper.isSuperAdmin()) {
flowParams.ignore(true);
}

View File

@@ -104,16 +104,6 @@ public class WorkflowServiceImpl implements WorkflowService {
return ObjectUtil.isNotNull(flowInstance) ? flowInstance.getId() : null;
}
/**
* 新增租户流程定义
*
* @param tenantId 租户id
*/
@Override
public void syncDef(String tenantId) {
flwDefinitionService.syncDef(tenantId);
}
/**
* 启动流程
*