| | |
| | | */ |
| | | package com.vci.ubcs.flow.engine.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.node.ObjectNode; |
| | | import com.vci.ubcs.flow.core.dto.FlowTaskDTO; |
| | | import com.vci.ubcs.flow.core.entity.BladeFlow; |
| | | import com.vci.ubcs.flow.core.enums.FlowModeEnum; |
| | | import com.vci.ubcs.flow.core.utils.TaskUtil; |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.flowable.bpmn.converter.BpmnXMLConverter; |
| | | import org.flowable.bpmn.model.*; |
| | |
| | | import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl; |
| | | import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntityImpl; |
| | | import org.flowable.engine.repository.Deployment; |
| | | import org.flowable.engine.repository.DeploymentQuery; |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | | import org.flowable.engine.repository.ProcessDefinitionQuery; |
| | | import org.flowable.engine.runtime.ProcessInstance; |
| | |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.w3c.dom.*; |
| | | import org.xml.sax.InputSource; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.xml.parsers.DocumentBuilder; |
| | | import javax.xml.parsers.DocumentBuilderFactory; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.io.StringReader; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String,String>> getNodeByFlowableKey(String key){ |
| | | public List<FlowTaskDTO> getNodeByFlowableKey(String key){ |
| | | String processDefinitionId = repositoryService.createProcessDefinitionQuery().latestVersion().processDefinitionKey(key).singleResult().getId(); |
| | | BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId); |
| | | Process process = bpmnModel.getProcesses().get(0);//只有一个 |
| | | |
| | | List<Map<String,String>> ll = new ArrayList<>(); |
| | | List<FlowTaskDTO> ll = new ArrayList<>(); |
| | | if (CollectionUtils.isNotEmpty(process.getFlowElements())) { |
| | | for (FlowElement flowElement : process.getFlowElements()) { |
| | | if (flowElement instanceof UserTask) { |
| | | Map<String,String> mi = new HashMap<>(); |
| | | mi.put("taskId",flowElement.getId()); |
| | | mi.put("taskName",flowElement.getName()); |
| | | ll.add(mi); |
| | | FlowTaskDTO flowTaskUserC = new FlowTaskDTO(); |
| | | flowTaskUserC.setTaskId(flowElement.getId()); |
| | | flowTaskUserC.setTaskName(flowElement.getName()); |
| | | ll.add(flowTaskUserC); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return ll; |
| | | } |
| | | @Override |
| | | public FlowTaskDTO getNodeByFlowableKey(String key, String taskId){ |
| | | String processDefinitionId = repositoryService.createProcessDefinitionQuery().latestVersion().processDefinitionKey(key).singleResult().getId(); |
| | | BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId); |
| | | Process process = bpmnModel.getProcesses().get(0);//只有一个 |
| | | |
| | | FlowTaskDTO flowTaskUserC = new FlowTaskDTO(); |
| | | if (CollectionUtils.isNotEmpty(process.getFlowElements())) { |
| | | for (FlowElement flowElement : process.getFlowElements()) { |
| | | if (flowElement instanceof UserTask&&taskId.equals(flowElement.getId())) { |
| | | flowTaskUserC.setTaskId(flowElement.getId()); |
| | | flowTaskUserC.setTaskName(flowElement.getName()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return flowTaskUserC; |
| | | } |
| | | |
| | | /** |
| | | * 是否已完结 |