update 优化 支持通过配置文件关闭工作流

This commit is contained in:
疯狂的狮子Li
2024-08-06 16:16:55 +08:00
parent 3af292ef2e
commit d40eb399f9
9 changed files with 46 additions and 21 deletions

View File

@@ -26,6 +26,10 @@ spring:
# flowable配置
flowable:
# 开关 用于启动/停用工作流
enabled: true
process.enabled: ${flowable.enabled}
eventregistry.enabled: ${flowable.enabled}
# 关闭定时任务JOB
async-executor-activate: false
# 将databaseSchemaUpdate设置为true。当Flowable发现库与数据库表结构不一致时会自动将数据库表结构升级至新版本。

View File

@@ -18,6 +18,7 @@ import org.dromara.workflow.domain.vo.ModelVo;
import org.dromara.workflow.service.IActModelService;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.repository.Model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -36,8 +37,8 @@ import java.util.List;
@RequestMapping("/workflow/model")
public class ActModelController extends BaseController {
private final RepositoryService repositoryService;
@Autowired(required = false)
private RepositoryService repositoryService;
private final IActModelService actModelService;

View File

@@ -21,6 +21,7 @@ import org.dromara.workflow.service.IActTaskService;
import org.dromara.workflow.service.IWfTaskBackNodeService;
import org.dromara.workflow.utils.QueryUtils;
import org.flowable.engine.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -38,10 +39,9 @@ import java.util.Map;
@RequestMapping("/workflow/task")
public class ActTaskController extends BaseController {
@Autowired(required = false)
private TaskService taskService;
private final IActTaskService actTaskService;
private final TaskService taskService;
private final IWfTaskBackNodeService wfTaskBackNodeService;

View File

@@ -39,6 +39,7 @@ import org.flowable.engine.repository.Model;
import org.flowable.engine.repository.ModelQuery;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.validation.ValidationError;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -65,7 +66,8 @@ import java.util.zip.ZipOutputStream;
@Service
public class ActModelServiceImpl implements IActModelService {
private final RepositoryService repositoryService;
@Autowired(required = false)
private RepositoryService repositoryService;
private final IWfNodeConfigService wfNodeConfigService;
private final IWfDefinitionConfigService wfDefinitionConfigService;

View File

@@ -37,6 +37,7 @@ import org.flowable.engine.RepositoryService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.impl.bpmn.deployer.ResourceNameUtil;
import org.flowable.engine.repository.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@@ -61,8 +62,10 @@ import java.util.zip.ZipInputStream;
@Service
public class ActProcessDefinitionServiceImpl implements IActProcessDefinitionService {
private final RepositoryService repositoryService;
private final ProcessMigrationService processMigrationService;
@Autowired(required = false)
private RepositoryService repositoryService;
@Autowired(required = false)
private ProcessMigrationService processMigrationService;
private final IWfCategoryService wfCategoryService;
private final IWfDefinitionConfigService wfDefinitionConfigService;
private final WfDefinitionConfigMapper wfDefinitionConfigMapper;

View File

@@ -49,6 +49,7 @@ import org.flowable.engine.task.Comment;
import org.flowable.task.api.Task;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -70,12 +71,17 @@ import java.util.stream.Collectors;
@Service
public class ActProcessInstanceServiceImpl implements IActProcessInstanceService {
private final RepositoryService repositoryService;
private final RuntimeService runtimeService;
private final HistoryService historyService;
private final TaskService taskService;
@Autowired(required = false)
private RepositoryService repositoryService;
@Autowired(required = false)
private RuntimeService runtimeService;
@Autowired(required = false)
private HistoryService historyService;
@Autowired(required = false)
private TaskService taskService;
@Autowired(required = false)
private ManagementService managementService;
private final IActHiProcinstService actHiProcinstService;
private final ManagementService managementService;
private final IWfTaskBackNodeService wfTaskBackNodeService;
private final IWfNodeConfigService wfNodeConfigService;
private final FlowProcessEventHandler flowProcessEventHandler;

View File

@@ -53,6 +53,7 @@ import org.flowable.task.api.TaskQuery;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import org.flowable.variable.api.persistence.entity.VariableInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -72,11 +73,16 @@ import static org.dromara.workflow.common.constant.FlowConstant.*;
@Service
public class ActTaskServiceImpl implements IActTaskService {
private final RuntimeService runtimeService;
private final TaskService taskService;
private final HistoryService historyService;
private final IdentityService identityService;
private final ManagementService managementService;
@Autowired(required = false)
private RuntimeService runtimeService;
@Autowired(required = false)
private TaskService taskService;
@Autowired(required = false)
private HistoryService historyService;
@Autowired(required = false)
private IdentityService identityService;
@Autowired(required = false)
private ManagementService managementService;
private final ActTaskMapper actTaskMapper;
private final IWfTaskBackNodeService wfTaskBackNodeService;
private final ActHiTaskinstMapper actHiTaskinstMapper;

View File

@@ -15,6 +15,7 @@ import org.flowable.engine.RepositoryService;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.Model;
import org.flowable.engine.repository.ProcessDefinition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -32,8 +33,8 @@ import java.util.List;
public class WfCategoryServiceImpl implements IWfCategoryService {
private final WfCategoryMapper baseMapper;
private final RepositoryService repositoryService;
@Autowired(required = false)
private RepositoryService repositoryService;
/**
* 查询流程分类

View File

@@ -8,6 +8,7 @@ import org.dromara.workflow.service.IActProcessInstanceService;
import org.dromara.workflow.service.WorkflowService;
import org.dromara.workflow.utils.WorkflowUtils;
import org.flowable.engine.RuntimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -22,8 +23,9 @@ import java.util.Map;
@Service
public class WorkflowServiceImpl implements WorkflowService {
@Autowired(required = false)
private RuntimeService runtimeService;
private final IActProcessInstanceService actProcessInstanceService;
private final RuntimeService runtimeService;
private final IActHiProcinstService actHiProcinstService;
/**
* 运行中的实例 删除程实例,删除历史记录,删除业务与流程关联信息