Commit 9c452ee612d5e276c3e76d33b03a716297599a23
1 parent
167baed9
工作流 Flowable 流程模型 接口
Showing
17 changed files
with
449 additions
and
9 deletions
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelCommonService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.definition; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelPageItemRespVO; | ||
| 5 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelPageReqVO; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 流程模型通用接口 | ||
| 9 | + * Activiti 和 flowable 通用的流程模型接口 | ||
| 10 | + * | ||
| 11 | + * @author yunlongn | ||
| 12 | + * @author jason | ||
| 13 | + */ | ||
| 14 | +public interface BpmModelCommonService { | ||
| 15 | + /** | ||
| 16 | + * 获得流程模型分页 | ||
| 17 | + * | ||
| 18 | + * @param pageVO 分页查询 | ||
| 19 | + * @return 流程模型分页 | ||
| 20 | + */ | ||
| 21 | + PageResult<BpmModelPageItemRespVO> getModelPage(BpmModelPageReqVO pageVO); | ||
| 22 | +} |
yudao-module-bpm/yudao-module-bpm-impl-activiti/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelService.java
| @@ -11,15 +11,7 @@ import javax.validation.Valid; | @@ -11,15 +11,7 @@ import javax.validation.Valid; | ||
| 11 | * | 11 | * |
| 12 | * @author yunlongn | 12 | * @author yunlongn |
| 13 | */ | 13 | */ |
| 14 | -public interface BpmModelService { | ||
| 15 | - | ||
| 16 | - /** | ||
| 17 | - * 获得流程模型分页 | ||
| 18 | - * | ||
| 19 | - * @param pageVO 分页查询 | ||
| 20 | - * @return 流程模型分页 | ||
| 21 | - */ | ||
| 22 | - PageResult<BpmModelPageItemRespVO> getModelPage(BpmModelPageReqVO pageVO); | 14 | +public interface BpmModelService extends BpmModelCommonService { |
| 23 | 15 | ||
| 24 | /** | 16 | /** |
| 25 | * 获得流程模块 | 17 | * 获得流程模块 |
yudao-module-bpm/yudao-module-bpm-impl-flowable/pom.xml
| @@ -16,6 +16,11 @@ | @@ -16,6 +16,11 @@ | ||
| 16 | </description> | 16 | </description> |
| 17 | 17 | ||
| 18 | <dependencies> | 18 | <dependencies> |
| 19 | + <dependency> | ||
| 20 | + <groupId>cn.iocoder.boot</groupId> | ||
| 21 | + <artifactId>yudao-module-bpm-base</artifactId> | ||
| 22 | + <version>${revision}</version> | ||
| 23 | + </dependency> | ||
| 19 | <!-- 工作流相关 --> | 24 | <!-- 工作流相关 --> |
| 20 | <dependency> | 25 | <dependency> |
| 21 | <groupId>org.flowable</groupId> | 26 | <groupId>org.flowable</groupId> |
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/api/package-info.java
0 → 100644
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/api/task/FlowableProcessInstanceApiImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.api.task; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; | ||
| 4 | +import org.springframework.stereotype.Service; | ||
| 5 | +import org.springframework.validation.annotation.Validated; | ||
| 6 | + | ||
| 7 | +import javax.annotation.Resource; | ||
| 8 | +import javax.validation.Valid; | ||
| 9 | +/** | ||
| 10 | + * Flowable 流程实例 Api 实现类 | ||
| 11 | + * | ||
| 12 | + * @author 芋道源码 | ||
| 13 | + * @author jason | ||
| 14 | + */ | ||
| 15 | +@Service | ||
| 16 | +@Validated | ||
| 17 | +public class FlowableProcessInstanceApiImpl implements BpmProcessInstanceApi { | ||
| 18 | + | ||
| 19 | + @Override | ||
| 20 | + public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqDTO reqDTO) { | ||
| 21 | + //TODO | ||
| 22 | + return null; | ||
| 23 | + } | ||
| 24 | +} |
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/FlowableModelController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.controller.admin.definition; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelPageItemRespVO; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.service.definition.FlowableModelService; | ||
| 8 | +import io.swagger.annotations.Api; | ||
| 9 | +import io.swagger.annotations.ApiOperation; | ||
| 10 | +import org.springframework.validation.annotation.Validated; | ||
| 11 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 13 | +import org.springframework.web.bind.annotation.RestController; | ||
| 14 | + | ||
| 15 | +import javax.annotation.Resource; | ||
| 16 | + | ||
| 17 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 18 | + | ||
| 19 | +@Api(tags = "管理后台 - 流程模型") | ||
| 20 | +@RestController | ||
| 21 | +@RequestMapping("/bpm/model") | ||
| 22 | +@Validated | ||
| 23 | +public class FlowableModelController { | ||
| 24 | + | ||
| 25 | + @Resource | ||
| 26 | + private FlowableModelService modelService; | ||
| 27 | + | ||
| 28 | + @GetMapping("/page") | ||
| 29 | + @ApiOperation(value = "获得模型分页") | ||
| 30 | + public CommonResult<PageResult<BpmModelPageItemRespVO>> getModelPage(BpmModelPageReqVO pageVO) { | ||
| 31 | + return success(modelService.getModelPage(pageVO)); | ||
| 32 | + } | ||
| 33 | +} |
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/controller/app/package-info.java
0 → 100644
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/controller/package-info.java
0 → 100644
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/ModelConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.convert.definition; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 4 | +import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | ||
| 5 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelBaseVO; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelPageItemRespVO; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelRespVO; | ||
| 8 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; | ||
| 9 | +import cn.iocoder.yudao.module.bpm.service.definition.dto.ModelMetaInfoRespDTO; | ||
| 10 | +import org.flowable.common.engine.impl.db.SuspensionState; | ||
| 11 | +import org.flowable.engine.repository.Deployment; | ||
| 12 | +import org.flowable.engine.repository.Model; | ||
| 13 | +import org.flowable.engine.repository.ProcessDefinition; | ||
| 14 | +import org.mapstruct.Mapper; | ||
| 15 | +import org.mapstruct.MappingTarget; | ||
| 16 | +import org.mapstruct.factory.Mappers; | ||
| 17 | + | ||
| 18 | +import java.util.List; | ||
| 19 | +import java.util.Map; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * 流程模型 Convert | ||
| 23 | + * | ||
| 24 | + * @author yunlongn | ||
| 25 | + */ | ||
| 26 | +@Mapper | ||
| 27 | +public interface ModelConvert { | ||
| 28 | + | ||
| 29 | + ModelConvert INSTANCE = Mappers.getMapper(ModelConvert.class); | ||
| 30 | + | ||
| 31 | + default List<BpmModelPageItemRespVO> convertList(List<Model> list, Map<Long, BpmFormDO> formMap, | ||
| 32 | + Map<String, Deployment> deploymentMap, | ||
| 33 | + Map<String, ProcessDefinition> processDefinitionMap) { | ||
| 34 | + return CollectionUtils.convertList(list, model -> { | ||
| 35 | + ModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), ModelMetaInfoRespDTO.class); | ||
| 36 | + BpmFormDO form = metaInfo != null ? formMap.get(metaInfo.getFormId()) : null; | ||
| 37 | + Deployment deployment = model.getDeploymentId() != null ? deploymentMap.get(model.getDeploymentId()) : null; | ||
| 38 | + ProcessDefinition processDefinition = model.getDeploymentId() != null ? processDefinitionMap.get(model.getDeploymentId()) : null; | ||
| 39 | + return convert(model, form, deployment, processDefinition); | ||
| 40 | + }); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + default BpmModelPageItemRespVO convert(Model model, BpmFormDO form, Deployment deployment, ProcessDefinition processDefinition) { | ||
| 44 | + BpmModelPageItemRespVO modelRespVO = new BpmModelPageItemRespVO(); | ||
| 45 | + modelRespVO.setId(model.getId()); | ||
| 46 | + modelRespVO.setCreateTime(model.getCreateTime()); | ||
| 47 | + // 通用 copy | ||
| 48 | + copyTo(model, modelRespVO); | ||
| 49 | + // Form | ||
| 50 | + if (form != null) { | ||
| 51 | + modelRespVO.setFormId(form.getId()); | ||
| 52 | + modelRespVO.setFormName(form.getName()); | ||
| 53 | + } | ||
| 54 | + // ProcessDefinition | ||
| 55 | + modelRespVO.setProcessDefinition(this.convert(processDefinition)); | ||
| 56 | + if (modelRespVO.getProcessDefinition() != null) { | ||
| 57 | + modelRespVO.getProcessDefinition().setSuspensionState(processDefinition.isSuspended() ? | ||
| 58 | + SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode()); | ||
| 59 | + modelRespVO.getProcessDefinition().setDeploymentTime(deployment.getDeploymentTime()); | ||
| 60 | + } | ||
| 61 | + return modelRespVO; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + default BpmModelRespVO convert(Model model) { | ||
| 65 | + BpmModelRespVO modelRespVO = new BpmModelRespVO(); | ||
| 66 | + modelRespVO.setId(model.getId()); | ||
| 67 | + modelRespVO.setCreateTime(model.getCreateTime()); | ||
| 68 | + // 通用 copy | ||
| 69 | + copyTo(model, modelRespVO); | ||
| 70 | + return modelRespVO; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + default void copyTo(Model model, BpmModelBaseVO to) { | ||
| 74 | + to.setName(model.getName()); | ||
| 75 | + to.setKey(model.getKey()); | ||
| 76 | + to.setCategory(model.getCategory()); | ||
| 77 | + // metaInfo | ||
| 78 | + ModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), ModelMetaInfoRespDTO.class); | ||
| 79 | + copyTo(metaInfo, to); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + void copyTo(ModelMetaInfoRespDTO from, @MappingTarget BpmModelBaseVO to); | ||
| 83 | + | ||
| 84 | + BpmModelPageItemRespVO.ProcessDefinition convert(ProcessDefinition bean); | ||
| 85 | +} |
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/convert/package-info.java
0 → 100644
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md
0 → 100644
| 1 | +<http://www.iocoder.cn/Spring-Boot/MapStruct/?yudao> |
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/package-info.java
0 → 100644
| 1 | +/** | ||
| 2 | + * bpm 包下,业务流程管理(Business Process Management),我们放工作流的功能,基于 activiti 7 版本实现。 | ||
| 3 | + * 例如说:流程定义、表单配置、审核中心(我的申请、我的待办、我的已办)等等 | ||
| 4 | + * | ||
| 5 | + * bpm 解释:https://baike.baidu.com/item/BPM/1933 | ||
| 6 | + * | ||
| 7 | + * 1. Controller URL:以 /bpm/ 开头,避免和其它 Module 冲突 | ||
| 8 | + * 2. DataObject 表名:以 bpm_ 开头,方便在数据库中区分 | ||
| 9 | + * | ||
| 10 | + * 注意,由于 Bpm 模块下,容易和其它模块重名,所以类名都加载 Pay 的前缀~ | ||
| 11 | + */ | ||
| 12 | +package cn.iocoder.yudao.module.bpm; |
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/FlowableModelService.java
0 → 100644
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/FlowableModelServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.definition; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.util.StrUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 6 | +import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | ||
| 7 | +import cn.iocoder.yudao.framework.common.util.object.PageUtils; | ||
| 8 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelPageItemRespVO; | ||
| 9 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelPageReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.bpm.convert.definition.ModelConvert; | ||
| 11 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; | ||
| 12 | +import cn.iocoder.yudao.module.bpm.service.definition.dto.ModelMetaInfoRespDTO; | ||
| 13 | +import lombok.extern.slf4j.Slf4j; | ||
| 14 | +import org.flowable.engine.RepositoryService; | ||
| 15 | +import org.flowable.engine.repository.Deployment; | ||
| 16 | +import org.flowable.engine.repository.Model; | ||
| 17 | +import org.flowable.engine.repository.ModelQuery; | ||
| 18 | +import org.flowable.engine.repository.ProcessDefinition; | ||
| 19 | +import org.springframework.stereotype.Service; | ||
| 20 | +import org.springframework.validation.annotation.Validated; | ||
| 21 | + | ||
| 22 | +import javax.annotation.Resource; | ||
| 23 | +import java.util.HashSet; | ||
| 24 | +import java.util.List; | ||
| 25 | +import java.util.Map; | ||
| 26 | +import java.util.Set; | ||
| 27 | + | ||
| 28 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | ||
| 29 | +/** | ||
| 30 | + * Flowable流程模型实现 | ||
| 31 | + * 主要进行 Flowable {@link Model} 的维护 | ||
| 32 | + * | ||
| 33 | + * @author yunlongn | ||
| 34 | + * @author 芋道源码 | ||
| 35 | + */ | ||
| 36 | +@Service | ||
| 37 | +@Validated | ||
| 38 | +@Slf4j | ||
| 39 | +public class FlowableModelServiceImpl implements FlowableModelService { | ||
| 40 | + | ||
| 41 | + @Resource | ||
| 42 | + private RepositoryService repositoryService; | ||
| 43 | + @Resource | ||
| 44 | + private BpmFormService bpmFormService; | ||
| 45 | + @Resource | ||
| 46 | + private FlowableProcessDefinitionService processDefinitionService; | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + public PageResult<BpmModelPageItemRespVO> getModelPage(BpmModelPageReqVO pageVO) { | ||
| 50 | + ModelQuery modelQuery = repositoryService.createModelQuery(); | ||
| 51 | + if (StrUtil.isNotBlank(pageVO.getKey())) { | ||
| 52 | + modelQuery.modelKey(pageVO.getKey()); | ||
| 53 | + } | ||
| 54 | + if (StrUtil.isNotBlank(pageVO.getName())) { | ||
| 55 | + modelQuery.modelNameLike("%" + pageVO.getName() + "%"); // 模糊匹配 | ||
| 56 | + } | ||
| 57 | + if (StrUtil.isNotBlank(pageVO.getCategory())) { | ||
| 58 | + modelQuery.modelCategory(pageVO.getCategory()); | ||
| 59 | + } | ||
| 60 | + // 执行查询 | ||
| 61 | + List<Model> models = modelQuery.orderByCreateTime().desc() | ||
| 62 | + .listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); | ||
| 63 | + | ||
| 64 | + // 获得 Form Map | ||
| 65 | + Set<Long> formIds = CollectionUtils.convertSet(models, model -> { | ||
| 66 | + ModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), ModelMetaInfoRespDTO.class); | ||
| 67 | + return metaInfo != null ? metaInfo.getFormId() : null; | ||
| 68 | + }); | ||
| 69 | + Map<Long, BpmFormDO> formMap = bpmFormService.getFormMap(formIds); | ||
| 70 | + | ||
| 71 | + // 获得 Deployment Map | ||
| 72 | + Set<String> deploymentIds = new HashSet<>(); | ||
| 73 | + models.forEach(model -> CollectionUtils.addIfNotNull(deploymentIds, model.getDeploymentId())); | ||
| 74 | + Map<String, Deployment> deploymentMap = processDefinitionService.getDeploymentMap(deploymentIds); | ||
| 75 | + // 获得 ProcessDefinition Map | ||
| 76 | + List<ProcessDefinition> processDefinitions = processDefinitionService.getProcessDefinitionListByDeploymentIds(deploymentIds); | ||
| 77 | + Map<String, ProcessDefinition> processDefinitionMap = convertMap(processDefinitions, ProcessDefinition::getDeploymentId); | ||
| 78 | + | ||
| 79 | + // 拼接结果 | ||
| 80 | + long modelCount = modelQuery.count(); | ||
| 81 | + return new PageResult<>(ModelConvert.INSTANCE.convertList(models, formMap, deploymentMap, processDefinitionMap), modelCount); | ||
| 82 | + } | ||
| 83 | +} |
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/FlowableProcessDefinitionService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.definition; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 4 | +import org.flowable.engine.repository.Deployment; | ||
| 5 | +import org.flowable.engine.repository.ProcessDefinition; | ||
| 6 | + | ||
| 7 | +import java.util.List; | ||
| 8 | +import java.util.Map; | ||
| 9 | +import java.util.Set; | ||
| 10 | +/** | ||
| 11 | + * Flowable流程定义接口 | ||
| 12 | + * | ||
| 13 | + * @author yunlong.li | ||
| 14 | + * @author ZJQ | ||
| 15 | + * @author 芋道源码 | ||
| 16 | + */ | ||
| 17 | +public interface FlowableProcessDefinitionService { | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 获得 deploymentIds 对应的 ProcessDefinition 数组 | ||
| 21 | + * | ||
| 22 | + * @param deploymentIds 部署编号的数组 | ||
| 23 | + * @return 流程定义的数组 | ||
| 24 | + */ | ||
| 25 | + List<ProcessDefinition> getProcessDefinitionListByDeploymentIds(Set<String> deploymentIds); | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 获得 ids 对应的 Deployment Map | ||
| 29 | + * | ||
| 30 | + * @param ids 部署编号的数组 | ||
| 31 | + * @return 流程部署 Map | ||
| 32 | + */ | ||
| 33 | + default Map<String, Deployment> getDeploymentMap(Set<String> ids) { | ||
| 34 | + return CollectionUtils.convertMap(getDeployments(ids), Deployment::getId); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 获得 ids 对应的 Deployment 数组 | ||
| 39 | + * | ||
| 40 | + * @param ids 部署编号的数组 | ||
| 41 | + * @return 流程部署的数组 | ||
| 42 | + */ | ||
| 43 | + List<Deployment> getDeployments(Set<String> ids); | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 获得 id 对应的 Deployment | ||
| 47 | + * | ||
| 48 | + * @param id 部署编号 | ||
| 49 | + * @return 流程部署 | ||
| 50 | + */ | ||
| 51 | + Deployment getDeployment(String id); | ||
| 52 | +} |
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/FlowableProcessDefinitionServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.definition; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.hutool.core.util.StrUtil; | ||
| 5 | +import lombok.extern.slf4j.Slf4j; | ||
| 6 | +import org.flowable.engine.RepositoryService; | ||
| 7 | +import org.flowable.engine.repository.Deployment; | ||
| 8 | +import org.flowable.engine.repository.ProcessDefinition; | ||
| 9 | +import org.springframework.stereotype.Service; | ||
| 10 | +import org.springframework.validation.annotation.Validated; | ||
| 11 | + | ||
| 12 | +import javax.annotation.Resource; | ||
| 13 | +import java.util.ArrayList; | ||
| 14 | +import java.util.List; | ||
| 15 | +import java.util.Set; | ||
| 16 | + | ||
| 17 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.addIfNotNull; | ||
| 18 | +import static java.util.Collections.emptyList; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * 流程定义实现 | ||
| 22 | + * 主要进行 Flowable {@link ProcessDefinition} 和 {@link Deployment} 的维护 | ||
| 23 | + * | ||
| 24 | + * @author yunlongn | ||
| 25 | + * @author ZJQ | ||
| 26 | + * @author 芋道源码 | ||
| 27 | + */ | ||
| 28 | +@Service | ||
| 29 | +@Validated | ||
| 30 | +@Slf4j | ||
| 31 | +public class FlowableProcessDefinitionServiceImpl implements FlowableProcessDefinitionService { | ||
| 32 | + @Resource | ||
| 33 | + private RepositoryService repositoryService; | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public List<ProcessDefinition> getProcessDefinitionListByDeploymentIds(Set<String> deploymentIds) { | ||
| 37 | + if (CollUtil.isEmpty(deploymentIds)) { | ||
| 38 | + return emptyList(); | ||
| 39 | + } | ||
| 40 | + return repositoryService.createProcessDefinitionQuery().deploymentIds(deploymentIds).list(); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @Override | ||
| 44 | + public List<Deployment> getDeployments(Set<String> ids) { | ||
| 45 | + if (CollUtil.isEmpty(ids)) { | ||
| 46 | + return emptyList(); | ||
| 47 | + } | ||
| 48 | + List<Deployment> list = new ArrayList<>(ids.size()); | ||
| 49 | + for (String id : ids) { | ||
| 50 | + addIfNotNull(list, getDeployment(id)); | ||
| 51 | + } | ||
| 52 | + return list; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @Override | ||
| 56 | + public Deployment getDeployment(String id) { | ||
| 57 | + if (StrUtil.isEmpty(id)) { | ||
| 58 | + return null; | ||
| 59 | + } | ||
| 60 | + return repositoryService.createDeploymentQuery().deploymentId(id).singleResult(); | ||
| 61 | + } | ||
| 62 | +} |
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/dto/ModelMetaInfoRespDTO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.definition.dto; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * BPM 流程 MetaInfo Response DTO | ||
| 8 | + * 主要用于 {@link org.flowable.engine.repository.Model#setMetaInfo(String)} 的存储 | ||
| 9 | + * | ||
| 10 | + * @author 芋道源码 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +public class ModelMetaInfoRespDTO { | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * 流程描述 | ||
| 17 | + */ | ||
| 18 | + private String description; | ||
| 19 | + /** | ||
| 20 | + * 表单类型 | ||
| 21 | + */ | ||
| 22 | + private Integer formType; | ||
| 23 | + /** | ||
| 24 | + * 表单编号 | ||
| 25 | + * 在表单类型为 {@link BpmModelFormTypeEnum#NORMAL} 时 | ||
| 26 | + */ | ||
| 27 | + private Long formId; | ||
| 28 | + /** | ||
| 29 | + * 自定义表单的提交路径,使用 Vue 的路由地址 | ||
| 30 | + * 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时 | ||
| 31 | + */ | ||
| 32 | + private String formCustomCreatePath; | ||
| 33 | + /** | ||
| 34 | + * 自定义表单的查看路径,使用 Vue 的路由地址 | ||
| 35 | + * 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时 | ||
| 36 | + */ | ||
| 37 | + private String formCustomViewPath; | ||
| 38 | + | ||
| 39 | +} |