| | |
| | | import com.iailab.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO; |
| | | import com.iailab.module.bpm.framework.flowable.core.util.BpmnModelUtils; |
| | | import org.flowable.bpmn.model.BpmnModel; |
| | | import org.flowable.bpmn.model.UserTask; |
| | | import org.flowable.common.engine.impl.db.SuspensionState; |
| | | import org.flowable.engine.repository.Deployment; |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | |
| | | import org.mapstruct.MappingTarget; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | Map<String, BpmProcessDefinitionInfoDO> processDefinitionInfoMap, |
| | | Map<Long, BpmFormDO> formMap, |
| | | Map<String, BpmCategoryDO> categoryMap) { |
| | | return CollectionUtils.convertList(list, definition -> { |
| | | List<BpmProcessDefinitionRespVO> result = CollectionUtils.convertList(list, definition -> { |
| | | Deployment deployment = MapUtil.get(deploymentMap, definition.getDeploymentId(), Deployment.class); |
| | | BpmProcessDefinitionInfoDO processDefinitionInfo = MapUtil.get(processDefinitionInfoMap, definition.getId(), BpmProcessDefinitionInfoDO.class); |
| | | BpmFormDO form = null; |
| | |
| | | form = MapUtil.get(formMap, processDefinitionInfo.getFormId(), BpmFormDO.class); |
| | | } |
| | | BpmCategoryDO category = MapUtil.get(categoryMap, definition.getCategory(), BpmCategoryDO.class); |
| | | return buildProcessDefinition(definition, deployment, processDefinitionInfo, form, category, null, null); |
| | | return buildProcessDefinition(definition, deployment, processDefinitionInfo, form, category, null); |
| | | }); |
| | | // 排序 |
| | | result.sort(Comparator.comparing(BpmProcessDefinitionRespVO::getSort)); |
| | | return result; |
| | | } |
| | | |
| | | default BpmProcessDefinitionRespVO buildProcessDefinition(ProcessDefinition definition, |
| | |
| | | BpmProcessDefinitionInfoDO processDefinitionInfo, |
| | | BpmFormDO form, |
| | | BpmCategoryDO category, |
| | | BpmnModel bpmnModel, |
| | | List<UserTask> startUserSelectUserTaskList) { |
| | | BpmnModel bpmnModel) { |
| | | BpmProcessDefinitionRespVO respVO = BeanUtils.toBean(definition, BpmProcessDefinitionRespVO.class); |
| | | respVO.setSuspensionState(definition.isSuspended() ? SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode()); |
| | | // Deployment |
| | |
| | | // BpmnModel |
| | | if (bpmnModel != null) { |
| | | respVO.setBpmnXml(BpmnModelUtils.getBpmnXml(bpmnModel)); |
| | | respVO.setStartUserSelectTasks(BeanUtils.toBean(startUserSelectUserTaskList, BpmProcessDefinitionRespVO.UserTask.class)); |
| | | } |
| | | return respVO; |
| | | } |