| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.io.IoUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | |
| | | import org.dromara.workflow.domain.bo.ProcessInstanceBo; |
| | | import org.dromara.workflow.domain.bo.ProcessInvalidBo; |
| | | import org.dromara.workflow.domain.bo.TaskUrgingBo; |
| | | import org.dromara.workflow.domain.vo.ActHistoryInfoVo; |
| | | import org.dromara.workflow.domain.vo.GraphicInfoVo; |
| | | import org.dromara.workflow.domain.vo.ProcessInstanceVo; |
| | | import org.dromara.workflow.domain.vo.TaskVo; |
| | | import org.dromara.workflow.domain.vo.*; |
| | | import org.dromara.workflow.flowable.CustomDefaultProcessDiagramGenerator; |
| | | import org.dromara.workflow.flowable.cmd.DeleteExecutionCmd; |
| | | import org.dromara.workflow.flowable.cmd.ExecutionChildByExecutionIdCmd; |
| | |
| | | import org.dromara.workflow.flowable.strategy.FlowProcessEventHandler; |
| | | import org.dromara.workflow.service.IActHiProcinstService; |
| | | import org.dromara.workflow.service.IActProcessInstanceService; |
| | | import org.dromara.workflow.service.IWfNodeConfigService; |
| | | import org.dromara.workflow.service.IWfTaskBackNodeService; |
| | | import org.dromara.workflow.utils.QueryUtils; |
| | | import org.dromara.workflow.utils.WorkflowUtils; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.awt.*; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static org.dromara.workflow.common.constant.FlowConstant.PROCESS_DEFINITION_ID; |
| | | |
| | | /** |
| | | * 流程实例 服务层实现 |
| | |
| | | private final ManagementService managementService; |
| | | private final FlowEventStrategy flowEventStrategy; |
| | | private final IWfTaskBackNodeService iWfTaskBackNodeService; |
| | | private final IWfNodeConfigService iWfNodeConfigService; |
| | | |
| | | @Value("${flowable.activity-font-name}") |
| | | private String activityFontName; |
| | |
| | | } |
| | | if (CollUtil.isNotEmpty(list)) { |
| | | List<String> processDefinitionIds = StreamUtils.toList(list, ProcessInstanceVo::getProcessDefinitionId); |
| | | WorkflowUtils.setWfFormDefinitionVo(list, processDefinitionIds, PROCESS_DEFINITION_ID); |
| | | List<WfNodeConfigVo> wfNodeConfigVoList = iWfNodeConfigService.selectByDefIds(processDefinitionIds); |
| | | for (ProcessInstanceVo processInstanceVo : list) { |
| | | if (CollUtil.isNotEmpty(wfNodeConfigVoList)) { |
| | | wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(processInstanceVo.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(processInstanceVo::setWfNodeConfigVo); |
| | | } |
| | | } |
| | | } |
| | | long count = query.count(); |
| | | return new TableDataInfo<>(list, count); |
| | | TableDataInfo<ProcessInstanceVo> build = TableDataInfo.build(); |
| | | build.setRows(list); |
| | | build.setTotal(count); |
| | | return build; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | if (CollUtil.isNotEmpty(list)) { |
| | | List<String> processDefinitionIds = StreamUtils.toList(list, ProcessInstanceVo::getProcessDefinitionId); |
| | | WorkflowUtils.setWfFormDefinitionVo(list, processDefinitionIds, PROCESS_DEFINITION_ID); |
| | | List<WfNodeConfigVo> wfNodeConfigVoList = iWfNodeConfigService.selectByDefIds(processDefinitionIds); |
| | | for (ProcessInstanceVo processInstanceVo : list) { |
| | | if (CollUtil.isNotEmpty(wfNodeConfigVoList)) { |
| | | wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(processInstanceVo.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(processInstanceVo::setWfNodeConfigVo); |
| | | } |
| | | } |
| | | } |
| | | long count = query.count(); |
| | | return new TableDataInfo<>(list, count); |
| | | TableDataInfo<ProcessInstanceVo> build = TableDataInfo.build(); |
| | | build.setRows(list); |
| | | build.setTotal(count); |
| | | return build; |
| | | } |
| | | |
| | | /** |
| | |
| | | BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId); |
| | | CustomDefaultProcessDiagramGenerator diagramGenerator = new CustomDefaultProcessDiagramGenerator(); |
| | | InputStream inputStream = diagramGenerator.generateDiagram(bpmnModel, "png", highLightedNodeList, highLightedFlows, activityFontName, labelFontName, annotationFontName, null, 1.0, true); |
| | | return Base64.encode(IOUtils.toByteArray(inputStream)); |
| | | return Base64.encode(IoUtil.readBytes(inputStream)); |
| | | } |
| | | |
| | | /** |
| | |
| | | map.put("taskList", taskList); |
| | | List<ActHistoryInfoVo> historyTaskList = getHistoryTaskList(processInstanceId); |
| | | map.put("historyList", historyTaskList); |
| | | InputStream inputStream; |
| | | try { |
| | | inputStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), processDefinition.getResourceName()); |
| | | xml.append(IOUtils.toString(inputStream, String.valueOf(StandardCharsets.UTF_8))); |
| | | map.put("xml", xml.toString()); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | InputStream inputStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), processDefinition.getResourceName()); |
| | | xml.append(IoUtil.read(inputStream, StandardCharsets.UTF_8)); |
| | | map.put("xml", xml.toString()); |
| | | return map; |
| | | } |
| | | |
| | |
| | | } |
| | | if (CollUtil.isNotEmpty(list)) { |
| | | List<String> processDefinitionIds = StreamUtils.toList(list, ProcessInstanceVo::getProcessDefinitionId); |
| | | WorkflowUtils.setWfFormDefinitionVo(list, processDefinitionIds, PROCESS_DEFINITION_ID); |
| | | List<WfNodeConfigVo> wfNodeConfigVoList = iWfNodeConfigService.selectByDefIds(processDefinitionIds); |
| | | for (ProcessInstanceVo processInstanceVo : list) { |
| | | if (CollUtil.isNotEmpty(wfNodeConfigVoList)) { |
| | | wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(processInstanceVo.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(processInstanceVo::setWfNodeConfigVo); |
| | | } |
| | | } |
| | | } |
| | | long count = query.count(); |
| | | return new TableDataInfo<>(list, count); |
| | | TableDataInfo<ProcessInstanceVo> build = TableDataInfo.build(); |
| | | build.setRows(list); |
| | | build.setTotal(count); |
| | | return build; |
| | | } |
| | | |
| | | /** |