From 1bb10d007efc68e59864519d00f5edc6b242f895 Mon Sep 17 00:00:00 2001 From: zhujiqian <924931408@qq.com> Date: Tue, 7 Sep 2021 23:40:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=81=E7=A8=8B=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=AE=9E=E4=BD=93=E6=BF=80=E6=B4=BB=E6=88=96=E6=8C=82?= =?UTF-8?q?=E8=B5=B7=E5=90=8E=E7=AB=AF=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../process/ProcessDefinitionDO.java | 29 +++++++++++++++++++ .../service/process/ProcessService.java | 13 ++++++++- .../process/impl/ProcessServiceImpl.java | 24 +++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/process/ProcessDefinitionDO.java 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; + } + /** * 根据上传文件类型对应实现不同方式的流程部署