Commit e47d5afcfa0849ac2cc3b28dcbd809d003e927e1
1 parent
dc7a4343
完善工作流 model 的接口
Showing
11 changed files
with
122 additions
and
39 deletions
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/BpmModelController.java
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelBaseVO.java
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelCreateReqVO.java
| ... | ... | @@ -8,7 +8,7 @@ import lombok.ToString; |
| 8 | 8 | |
| 9 | 9 | import javax.validation.constraints.NotEmpty; |
| 10 | 10 | |
| 11 | -@ApiModel("流程定义的创建 Request VO") | |
| 11 | +@ApiModel("流程模型的创建 Request VO") | |
| 12 | 12 | @Data |
| 13 | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | 14 | @ToString(callSuper = true) |
| ... | ... | @@ -18,6 +18,4 @@ public class BpmModelCreateReqVO extends BpmModelBaseVO { |
| 18 | 18 | @NotEmpty(message = "BPMN XML 不能为空") |
| 19 | 19 | private String bpmnXml; |
| 20 | 20 | |
| 21 | -// @ApiModelProperty(value = "版本号") | |
| 22 | -// private Integer revision; | |
| 23 | 21 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelRespVO.java
| ... | ... | @@ -8,7 +8,7 @@ import lombok.ToString; |
| 8 | 8 | |
| 9 | 9 | import java.util.Date; |
| 10 | 10 | |
| 11 | -@ApiModel("流程定义 Response VO") | |
| 11 | +@ApiModel("流程模型 Response VO") | |
| 12 | 12 | @Data |
| 13 | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | 14 | @ToString(callSuper = true) |
| ... | ... | @@ -17,13 +17,27 @@ public class BpmModelRespVO extends BpmModelBaseVO { |
| 17 | 17 | @ApiModelProperty(value = "编号", required = true, example = "1024") |
| 18 | 18 | private String id; |
| 19 | 19 | |
| 20 | - @ApiModelProperty(value = "版本", required = true, example = "1") | |
| 21 | - private Integer revision; | |
| 22 | - | |
| 23 | 20 | @ApiModelProperty(value = "表单名字", example = "请假表单") |
| 24 | 21 | private String formName; |
| 25 | 22 | |
| 26 | 23 | @ApiModelProperty(value = "创建时间", required = true) |
| 27 | 24 | private Date createTime; |
| 28 | 25 | |
| 26 | + /** | |
| 27 | + * 最新部署的流程定义 | |
| 28 | + */ | |
| 29 | + private ProcessDefinition processDefinition; | |
| 30 | + | |
| 31 | + @ApiModel("流程定义") | |
| 32 | + @Data | |
| 33 | + public static class ProcessDefinition { | |
| 34 | + | |
| 35 | + @ApiModelProperty(value = "编号", required = true, example = "1024") | |
| 36 | + private String id; | |
| 37 | + | |
| 38 | + @ApiModelProperty(value = "版本", required = true, example = "1") | |
| 39 | + private Integer version; | |
| 40 | + | |
| 41 | + } | |
| 42 | + | |
| 29 | 43 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/ModelPageReqVO.java
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/workflow/ProcessDefinitionController.java
| ... | ... | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow; |
| 3 | 3 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp; |
| 4 | 4 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition.ProcessDefinitionPageReqVo; |
| 5 | 5 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition.ProcessDefinitionRespVO; |
| 6 | -import cn.iocoder.yudao.adminserver.modules.bpm.service.workflow.BpmProcessDefinitionService; | |
| 6 | +import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmDefinitionService; | |
| 7 | 7 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 8 | 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 9 | 9 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; |
| ... | ... | @@ -30,7 +30,7 @@ public class ProcessDefinitionController { |
| 30 | 30 | @Resource |
| 31 | 31 | private ProcessRuntime processRuntime; |
| 32 | 32 | @Resource |
| 33 | - private BpmProcessDefinitionService bpmProcessDefinitionService; | |
| 33 | + private BpmDefinitionService bpmProcessDefinitionService; | |
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | @GetMapping(value = "/getStartForm") | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/model/ModelConvert.java
| ... | ... | @@ -6,8 +6,8 @@ import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO; |
| 6 | 6 | import cn.iocoder.yudao.adminserver.modules.bpm.service.model.dto.BpmModelMetaInfoRespDTO; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 8 | 8 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 9 | -import org.activiti.engine.impl.persistence.entity.ModelEntity; | |
| 10 | 9 | import org.activiti.engine.repository.Model; |
| 10 | +import org.activiti.engine.repository.ProcessDefinition; | |
| 11 | 11 | import org.mapstruct.Mapper; |
| 12 | 12 | import org.mapstruct.factory.Mappers; |
| 13 | 13 | |
| ... | ... | @@ -25,15 +25,17 @@ public interface ModelConvert { |
| 25 | 25 | |
| 26 | 26 | ModelConvert INSTANCE = Mappers.getMapper(ModelConvert.class); |
| 27 | 27 | |
| 28 | - default List<BpmModelRespVO> convertList(List<Model> list, Map<Long, BpmFormDO> formMap) { | |
| 28 | + default List<BpmModelRespVO> convertList(List<Model> list, Map<Long, BpmFormDO> formMap, | |
| 29 | + Map<String, ProcessDefinition> processDefinitionMap) { | |
| 29 | 30 | return CollectionUtils.convertList(list, model -> { |
| 30 | 31 | BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class); |
| 31 | 32 | BpmFormDO form = metaInfo != null ? formMap.get(metaInfo.getFormId()) : null; |
| 32 | - return convert(model, form); | |
| 33 | + ProcessDefinition processDefinition = model.getDeploymentId() != null ? processDefinitionMap.get(model.getDeploymentId()) : null; | |
| 34 | + return convert(model, form, processDefinition); | |
| 33 | 35 | }); |
| 34 | 36 | } |
| 35 | 37 | |
| 36 | - default BpmModelRespVO convert(Model model, BpmFormDO form) { | |
| 38 | + default BpmModelRespVO convert(Model model, BpmFormDO form, ProcessDefinition processDefinition) { | |
| 37 | 39 | BpmModelRespVO modelRespVO = new BpmModelRespVO(); |
| 38 | 40 | modelRespVO.setId(model.getId()); |
| 39 | 41 | modelRespVO.setName(model.getName()); |
| ... | ... | @@ -48,10 +50,7 @@ public interface ModelConvert { |
| 48 | 50 | modelRespVO.setFormId(form.getId()); |
| 49 | 51 | modelRespVO.setFormName(form.getName()); |
| 50 | 52 | } |
| 51 | - if (model instanceof ModelEntity) { | |
| 52 | - ModelEntity modelEntity = (ModelEntity) model; | |
| 53 | - modelRespVO.setRevision(modelEntity.getRevision()); | |
| 54 | - } | |
| 53 | + modelRespVO.setProcessDefinition(this.convert(processDefinition)); | |
| 55 | 54 | return modelRespVO; |
| 56 | 55 | } |
| 57 | 56 | |
| ... | ... | @@ -69,4 +68,6 @@ public interface ModelConvert { |
| 69 | 68 | return metaInfo; |
| 70 | 69 | } |
| 71 | 70 | |
| 71 | + BpmModelRespVO.ProcessDefinition convert(ProcessDefinition bean); | |
| 72 | + | |
| 72 | 73 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/workflow/BpmProcessDefinitionService.java renamed to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmDefinitionService.java
| 1 | -package cn.iocoder.yudao.adminserver.modules.bpm.service.workflow; | |
| 1 | +package cn.iocoder.yudao.adminserver.modules.bpm.service.definition; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp; |
| 4 | 4 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition.ProcessDefinitionPageReqVo; |
| 5 | 5 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition.ProcessDefinitionRespVO; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | +import org.activiti.engine.repository.ProcessDefinition; | |
| 8 | + | |
| 9 | +import java.util.List; | |
| 10 | +import java.util.Set; | |
| 7 | 11 | |
| 8 | 12 | /** |
| 9 | 13 | * 流程定义接口 |
| 14 | + * | |
| 10 | 15 | * @author yunlong.li |
| 11 | 16 | */ |
| 12 | -public interface BpmProcessDefinitionService { | |
| 17 | +public interface BpmDefinitionService { | |
| 18 | + | |
| 13 | 19 | /** |
| 14 | 20 | * 流程定义分页 |
| 15 | 21 | * @param processDefinitionPageReqVo 分页入参 |
| ... | ... | @@ -23,4 +29,13 @@ public interface BpmProcessDefinitionService { |
| 23 | 29 | * @return 分页model |
| 24 | 30 | */ |
| 25 | 31 | FileResp export(String processDefinitionId); |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 获得 deploymentId 对应的 ProcessDefinition 数组 | |
| 35 | + * | |
| 36 | + * @param deploymentId 部署编号 | |
| 37 | + * @return 流程定义的数组 | |
| 38 | + */ | |
| 39 | + List<ProcessDefinition> getProcessDefinitionListByDeploymentIds(Set<String> deploymentId); | |
| 40 | + | |
| 26 | 41 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/BpmModelService.java
| 1 | 1 | package cn.iocoder.yudao.adminserver.modules.bpm.service.model; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelCreateReqVO; | |
| 3 | 4 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelRespVO; |
| 4 | -import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp; | |
| 5 | 5 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.ModelPageReqVO; |
| 6 | -import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelCreateReqVO; | |
| 6 | +import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp; | |
| 7 | 7 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 8 | 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 9 | -import org.activiti.engine.repository.Model; | |
| 10 | 9 | |
| 11 | 10 | /** |
| 12 | - * 流程定义接口 | |
| 11 | + * 流程模型接口 | |
| 13 | 12 | * |
| 14 | 13 | * @author yunlongn |
| 15 | 14 | */ |
| 16 | 15 | public interface BpmModelService { |
| 17 | 16 | |
| 18 | 17 | /** |
| 19 | - * 获得流程定义分页 | |
| 18 | + * 获得流程模型分页 | |
| 20 | 19 | * |
| 21 | 20 | * @param pageVO 分页查询 |
| 22 | - * @return 流程定义分页 | |
| 21 | + * @return 流程模型分页 | |
| 23 | 22 | */ |
| 24 | 23 | PageResult<BpmModelRespVO> getModelPage(ModelPageReqVO pageVO); |
| 25 | 24 | |
| 26 | 25 | // TODO @Li:不用返回 CommonResult |
| 27 | 26 | // TODO @Li:createBpmModal。 |
| 28 | 27 | /** |
| 29 | - * 创建流程定义 | |
| 28 | + * 创建流程模型 | |
| 30 | 29 | * |
| 31 | 30 | * @param modelVO 创建信息 |
| 32 | - * @return 创建的流程定义的编号 | |
| 31 | + * @return 创建的流程模型的编号 | |
| 33 | 32 | */ |
| 34 | 33 | String createModel(BpmModelCreateReqVO modelVO); |
| 35 | 34 | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/workflow/impl/BpmModelServiceImpl.java renamed to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/impl/BpmModelServiceImpl.java
| 1 | -package cn.iocoder.yudao.adminserver.modules.bpm.service.workflow.impl; | |
| 1 | +package cn.iocoder.yudao.adminserver.modules.bpm.service.model.impl; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.util.StrUtil; |
| 4 | 4 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelCreateReqVO; |
| ... | ... | @@ -8,6 +8,7 @@ import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp; |
| 8 | 8 | import cn.iocoder.yudao.adminserver.modules.bpm.convert.model.ModelConvert; |
| 9 | 9 | import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO; |
| 10 | 10 | import cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants; |
| 11 | +import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmDefinitionService; | |
| 11 | 12 | import cn.iocoder.yudao.adminserver.modules.bpm.service.form.BpmFormService; |
| 12 | 13 | import cn.iocoder.yudao.adminserver.modules.bpm.service.model.BpmModelService; |
| 13 | 14 | import cn.iocoder.yudao.adminserver.modules.bpm.service.model.dto.BpmModelMetaInfoRespDTO; |
| ... | ... | @@ -23,6 +24,7 @@ import org.activiti.engine.RepositoryService; |
| 23 | 24 | import org.activiti.engine.repository.Deployment; |
| 24 | 25 | import org.activiti.engine.repository.Model; |
| 25 | 26 | import org.activiti.engine.repository.ModelQuery; |
| 27 | +import org.activiti.engine.repository.ProcessDefinition; | |
| 26 | 28 | import org.apache.commons.lang3.exception.ExceptionUtils; |
| 27 | 29 | import org.springframework.stereotype.Service; |
| 28 | 30 | import org.springframework.transaction.annotation.Transactional; |
| ... | ... | @@ -35,16 +37,15 @@ import javax.xml.stream.XMLStreamReader; |
| 35 | 37 | import java.io.ByteArrayInputStream; |
| 36 | 38 | import java.io.InputStreamReader; |
| 37 | 39 | import java.nio.charset.StandardCharsets; |
| 38 | -import java.util.List; | |
| 39 | -import java.util.Map; | |
| 40 | -import java.util.Optional; | |
| 41 | -import java.util.Set; | |
| 40 | +import java.util.*; | |
| 42 | 41 | |
| 43 | 42 | import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.BPM_MODEL_KEY_EXISTS; |
| 44 | 43 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 44 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * 流程定义实现 |
| 48 | + * 主要进行 Activiti {@link Model} 的维护 | |
| 48 | 49 | * |
| 49 | 50 | * @author yunlongn |
| 50 | 51 | */ |
| ... | ... | @@ -53,10 +54,14 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU |
| 53 | 54 | @Slf4j |
| 54 | 55 | public class BpmModelServiceImpl implements BpmModelService { |
| 55 | 56 | |
| 57 | + private static final String BPMN_FILE_SUFFIX = ".bpmn"; | |
| 58 | + | |
| 56 | 59 | @Resource |
| 57 | 60 | private RepositoryService repositoryService; |
| 58 | 61 | @Resource |
| 59 | 62 | private BpmFormService bpmFormService; |
| 63 | + @Resource | |
| 64 | + private BpmDefinitionService bpmDefinitionService; | |
| 60 | 65 | |
| 61 | 66 | @Override |
| 62 | 67 | public PageResult<BpmModelRespVO> getModelPage(ModelPageReqVO pageVO) { |
| ... | ... | @@ -67,7 +72,6 @@ public class BpmModelServiceImpl implements BpmModelService { |
| 67 | 72 | // 执行查询 |
| 68 | 73 | List<Model> models = modelQuery.orderByCreateTime().desc() |
| 69 | 74 | .listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); |
| 70 | - long modelCount = modelQuery.count(); | |
| 71 | 75 | |
| 72 | 76 | // 获得 Form Map |
| 73 | 77 | Set<Long> formIds = CollectionUtils.convertSet(models, model -> { |
| ... | ... | @@ -75,8 +79,16 @@ public class BpmModelServiceImpl implements BpmModelService { |
| 75 | 79 | return metaInfo != null ? metaInfo.getFormId() : null; |
| 76 | 80 | }); |
| 77 | 81 | Map<Long, BpmFormDO> formMap = bpmFormService.getFormMap(formIds); |
| 82 | + | |
| 83 | + // 获得 ProcessDefinition Map | |
| 84 | + Set<String> deploymentIds = new HashSet<>(); | |
| 85 | + models.forEach(model -> CollectionUtils.addIfNotNull(deploymentIds, model.getId())); | |
| 86 | + List<ProcessDefinition> processDefinitions = bpmDefinitionService.getProcessDefinitionListByDeploymentIds(deploymentIds); | |
| 87 | + Map<String, ProcessDefinition> processDefinitionMap = convertMap(processDefinitions, ProcessDefinition::getDeploymentId); | |
| 88 | + | |
| 78 | 89 | // 拼接结果 |
| 79 | - return new PageResult<>(ModelConvert.INSTANCE.convertList(models, formMap), modelCount); | |
| 90 | + long modelCount = modelQuery.count(); | |
| 91 | + return new PageResult<>(ModelConvert.INSTANCE.convertList(models, formMap, processDefinitionMap), modelCount); | |
| 80 | 92 | } |
| 81 | 93 | |
| 82 | 94 | @Override |
| ... | ... | @@ -98,6 +110,38 @@ public class BpmModelServiceImpl implements BpmModelService { |
| 98 | 110 | return model.getId(); |
| 99 | 111 | } |
| 100 | 112 | |
| 113 | +// @Override | |
| 114 | +// @Transactional(rollbackFor = Exception.class) // 因为进行多个 activiti 操作,所以开启事务 | |
| 115 | +// public String createModel(BpmModelCreateReqVO createReqVO) { | |
| 116 | +// Deployment deploy = repositoryService.createDeployment() | |
| 117 | +// .key(createReqVO.getKey()).name(createReqVO.getName()).category(createReqVO.getCategory()) | |
| 118 | +// .addString(createReqVO.getName() + BPMN_FILE_SUFFIX, createReqVO.getBpmnXml()) | |
| 119 | +// .deploy(); | |
| 120 | +// // 设置 ProcessDefinition 的 category 分类 | |
| 121 | +// ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deploy.getId()).singleResult(); | |
| 122 | +// repositoryService.setProcessDefinitionCategory(definition.getId(), createReqVO.getCategory()); | |
| 123 | +// return definition.getId(); | |
| 124 | +// } | |
| 125 | + | |
| 126 | +// @Override | |
| 127 | +// @Transactional(rollbackFor = Exception.class) // 因为进行多个 activiti 操作,所以开启事务 | |
| 128 | +// public String createModel(BpmModelCreateReqVO createReqVO) { | |
| 129 | +// // 校验流程标识已经存在 | |
| 130 | +// Model keyModel = this.getModelByKey(createReqVO.getKey()); | |
| 131 | +// if (keyModel != null) { | |
| 132 | +// throw exception(BPM_MODEL_KEY_EXISTS); | |
| 133 | +// } | |
| 134 | +// | |
| 135 | +// // 创建流程定义 | |
| 136 | +// Model model = repositoryService.newModel(); | |
| 137 | +// ModelConvert.INSTANCE.copy(model, createReqVO); | |
| 138 | +// // 保存流程定义 | |
| 139 | +// repositoryService.saveModel(model); | |
| 140 | +// // 添加 BPMN XML | |
| 141 | +// repositoryService.addModelEditorSource(model.getId(), StrUtil.utf8Bytes(createReqVO.getBpmnXml())); | |
| 142 | +// return model.getId(); | |
| 143 | +// } | |
| 144 | + | |
| 101 | 145 | @Override |
| 102 | 146 | public CommonResult<String> updateModel(BpmModelCreateReqVO modelVO) { |
| 103 | 147 | // try { | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/workflow/impl/BpmProcessDefinitionServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.adminserver.modules.bpm.service.workflow.impl; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 3 | 4 | import cn.hutool.core.util.StrUtil; |
| 4 | 5 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp; |
| 5 | 6 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition.ProcessDefinitionPageReqVo; |
| 6 | 7 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition.ProcessDefinitionRespVO; |
| 7 | 8 | import cn.iocoder.yudao.adminserver.modules.bpm.convert.workflow.ProcessDefinitionConvert; |
| 8 | -import cn.iocoder.yudao.adminserver.modules.bpm.service.workflow.BpmProcessDefinitionService; | |
| 9 | +import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmDefinitionService; | |
| 9 | 10 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 10 | 11 | import lombok.RequiredArgsConstructor; |
| 11 | 12 | import lombok.extern.slf4j.Slf4j; |
| ... | ... | @@ -17,7 +18,9 @@ import org.activiti.engine.repository.ProcessDefinition; |
| 17 | 18 | import org.activiti.engine.repository.ProcessDefinitionQuery; |
| 18 | 19 | import org.springframework.stereotype.Service; |
| 19 | 20 | |
| 21 | +import java.util.Collections; | |
| 20 | 22 | import java.util.List; |
| 23 | +import java.util.Set; | |
| 21 | 24 | import java.util.stream.Collectors; |
| 22 | 25 | |
| 23 | 26 | /** |
| ... | ... | @@ -27,7 +30,7 @@ import java.util.stream.Collectors; |
| 27 | 30 | @Slf4j |
| 28 | 31 | @Service |
| 29 | 32 | @RequiredArgsConstructor |
| 30 | -public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionService { | |
| 33 | +public class BpmProcessDefinitionServiceImpl implements BpmDefinitionService { | |
| 31 | 34 | |
| 32 | 35 | private final RepositoryService repositoryService; |
| 33 | 36 | |
| ... | ... | @@ -57,4 +60,13 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ |
| 57 | 60 | fileResp.setFileByte(bpmnBytes); |
| 58 | 61 | return fileResp; |
| 59 | 62 | } |
| 63 | + | |
| 64 | + @Override | |
| 65 | + public List<ProcessDefinition> getProcessDefinitionListByDeploymentIds(Set<String> deploymentIds) { | |
| 66 | + if (CollUtil.isEmpty(deploymentIds)) { | |
| 67 | + return Collections.emptyList(); | |
| 68 | + } | |
| 69 | + return repositoryService.createProcessDefinitionQuery().deploymentIds(deploymentIds).list(); | |
| 70 | + } | |
| 71 | + | |
| 60 | 72 | } | ... | ... |