diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/process/ProcessDefinitionDO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/process/ProcessDefinitionDO.java new file mode 100644 index 000000000..7913d1ee6 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/process/ProcessDefinitionDO.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.process; + +/** + * 流程模型实体类 映射 activiti ProcessDefinition接口 + * + * @author ZJQ + * @date 2021/9/7 23:23 + */ +public class ProcessDefinitionDO { + + private String id; + + private String category; + + private String key; + + private String name; + + private String version; + + private String resourceName; + + private String deploymentId; + + private String diagramResourceName; + + private boolean suspended; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/process/ProcessService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/process/ProcessService.java index 4ef499658..bd829353d 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/process/ProcessService.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/process/ProcessService.java @@ -11,8 +11,19 @@ import org.springframework.web.multipart.MultipartFile; public interface ProcessService { /** - * 上传流程文件,进行流程部署 + * 上传流程文件,进行流程模型部署 * @param multipartFile 上传文件 */ void deployProcess(MultipartFile multipartFile); + + + /** + * 激活或者挂起流程模型实体 + * @param processDefinitionId 流程模型实体id + * @param type 类型 + * @return 状态 + */ + String setActivOrHang(String processDefinitionId,String type); + + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/process/impl/ProcessServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/process/impl/ProcessServiceImpl.java index baebe8700..2e3d04b1d 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/process/impl/ProcessServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/process/impl/ProcessServiceImpl.java @@ -54,6 +54,30 @@ public class ProcessServiceImpl implements ProcessService { } } + /** + * 激活或者挂起流程模型实体 + * @param processDefinitionId 流程模型实体id + * @param type 类型 + * @return 提示 + */ + @Override + public String setActivOrHang(String processDefinitionId, String type) { + String result = "无操作"; + switch (type){ + case "active": + repositoryService.activateProcessDefinitionById(processDefinitionId,true,null); + result = "已激活ID为【"+processDefinitionId+"】的流程模型实例"; + break; + case "suspend": + repositoryService.suspendProcessDefinitionById(processDefinitionId,true,null); + result = "已挂起ID为【"+processDefinitionId+"】的流程模型实例"; + break; + default: + break; + } + return result; + } + /** * 根据上传文件类型对应实现不同方式的流程部署