Search in sources :

Example 1 with PageQuery

use of com.ruoyi.common.core.domain.PageQuery in project RuoYi-Flowable-Plus by KonBAI-Q.

the class WfDefinitionServiceImpl method publishList.

@Override
public TableDataInfo<WfDefinitionVo> publishList(String processKey, PageQuery pageQuery) {
    Page<WfDefinitionVo> page = new Page<>();
    // 创建查询条件
    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().processDefinitionKey(processKey).orderByProcessDefinitionVersion().asc();
    long pageTotal = processDefinitionQuery.count();
    if (pageTotal <= 0) {
        return TableDataInfo.build();
    }
    // 根据查询条件,查询所有版本
    int offset = pageQuery.getPageSize() * (pageQuery.getPageNum() - 1);
    List<ProcessDefinition> processDefinitionList = processDefinitionQuery.listPage(offset, pageQuery.getPageSize());
    List<WfDefinitionVo> definitionVoList = processDefinitionList.stream().map(item -> {
        WfDefinitionVo vo = new WfDefinitionVo();
        vo.setDefinitionId(item.getId());
        vo.setProcessKey(item.getKey());
        vo.setProcessName(item.getName());
        vo.setVersion(item.getVersion());
        vo.setCategory(item.getCategory());
        vo.setDeploymentId(item.getDeploymentId());
        vo.setSuspended(item.isSuspended());
        // BeanUtil.copyProperties(item, vo);
        return vo;
    }).collect(Collectors.toList());
    page.setRecords(definitionVoList);
    page.setTotal(pageTotal);
    return TableDataInfo.build(page);
}
Also used : java.util(java.util) TableDataInfo(com.ruoyi.common.core.page.TableDataInfo) ProcessDefinition(org.flowable.engine.repository.ProcessDefinition) ServiceException(com.ruoyi.common.exception.ServiceException) WfFormVo(com.ruoyi.workflow.domain.vo.WfFormVo) RequiredArgsConstructor(lombok.RequiredArgsConstructor) DeploymentBuilder(org.flowable.engine.repository.DeploymentBuilder) IWfDeployFormService(com.ruoyi.workflow.service.IWfDeployFormService) ProcessInstance(org.flowable.engine.runtime.ProcessInstance) PageQuery(com.ruoyi.common.core.domain.PageQuery) IWfDefinitionService(com.ruoyi.workflow.service.IWfDefinitionService) ProcessConstants(com.ruoyi.flowable.common.constant.ProcessConstants) Service(org.springframework.stereotype.Service) BpmnModel(org.flowable.bpmn.model.BpmnModel) FlowServiceFactory(com.ruoyi.flowable.factory.FlowServiceFactory) DefaultProcessDiagramGenerator(org.flowable.image.impl.DefaultProcessDiagramGenerator) ProcessDefinitionQuery(org.flowable.engine.repository.ProcessDefinitionQuery) WfDefinitionVo(com.ruoyi.workflow.domain.vo.WfDefinitionVo) FlowComment(com.ruoyi.flowable.common.enums.FlowComment) IOException(java.io.IOException) Deployment(org.flowable.engine.repository.Deployment) Task(org.flowable.task.api.Task) LoginHelper(com.ruoyi.common.helper.LoginHelper) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) IOUtils(org.apache.commons.io.IOUtils) StrUtil(cn.hutool.core.util.StrUtil) Slf4j(lombok.extern.slf4j.Slf4j) Transactional(org.springframework.transaction.annotation.Transactional) InputStream(java.io.InputStream) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) ProcessDefinitionQuery(org.flowable.engine.repository.ProcessDefinitionQuery) ProcessDefinition(org.flowable.engine.repository.ProcessDefinition) WfDefinitionVo(com.ruoyi.workflow.domain.vo.WfDefinitionVo)

Aggregations

StrUtil (cn.hutool.core.util.StrUtil)1 Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)1 PageQuery (com.ruoyi.common.core.domain.PageQuery)1 TableDataInfo (com.ruoyi.common.core.page.TableDataInfo)1 ServiceException (com.ruoyi.common.exception.ServiceException)1 LoginHelper (com.ruoyi.common.helper.LoginHelper)1 ProcessConstants (com.ruoyi.flowable.common.constant.ProcessConstants)1 FlowComment (com.ruoyi.flowable.common.enums.FlowComment)1 FlowServiceFactory (com.ruoyi.flowable.factory.FlowServiceFactory)1 WfDefinitionVo (com.ruoyi.workflow.domain.vo.WfDefinitionVo)1 WfFormVo (com.ruoyi.workflow.domain.vo.WfFormVo)1 IWfDefinitionService (com.ruoyi.workflow.service.IWfDefinitionService)1 IWfDeployFormService (com.ruoyi.workflow.service.IWfDeployFormService)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 StandardCharsets (java.nio.charset.StandardCharsets)1 java.util (java.util)1 Collectors (java.util.stream.Collectors)1 RequiredArgsConstructor (lombok.RequiredArgsConstructor)1 Slf4j (lombok.extern.slf4j.Slf4j)1