| | |
| | | import com.java110.common.dao.IWorkflowStepStaffServiceDao; |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import com.java110.dto.oaWorkflow.OaWorkflowDto; |
| | | import com.java110.dto.oaWorkflowForm.OaWorkflowFormDto; |
| | | import com.java110.dto.oaWorkflowXml.OaWorkflowXmlDto; |
| | |
| | | import com.java110.po.oaWorkflow.OaWorkflowPo; |
| | | import com.java110.po.oaWorkflowXml.OaWorkflowXmlPo; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.Base64Convert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | |
| | | import org.dom4j.DocumentHelper; |
| | | import org.dom4j.Element; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | } |
| | | |
| | | Map staffInfo = workflowStepStaffs.get(0); |
| | | |
| | | String staffId = staffInfo.get("staffId") + ""; |
| | | OrgDto orgDto = new OrgDto(); |
| | | orgDto.setStaffId(staffInfo.get("staffId") + ""); |
| | | orgDto.setStaffId(staffId); |
| | | if (staffId.startsWith("${")) { |
| | | return ResultVo.createResponseEntity(orgDto); |
| | | } |
| | | |
| | | List<OrgDto> orgDtos = orgInnerServiceSMOImpl.queryOrgs(orgDto); |
| | | |
| | | if (orgDtos == null || orgDtos.size() < 1) { |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "未查询到员工组织信息"); |
| | | } |
| | | |
| | | orgDto = orgDtos.get(0); |
| | | orgDto.setStaffName(staffInfo.get("staffName") + ""); |
| | | |
| | |
| | | Model modelData = repositoryService.getModel(workflowModelDto.getModelId()); |
| | | byte[] bpmnBytes = null; |
| | | bpmnBytes = repositoryService.getModelEditorSource(workflowModelDto.getModelId()); |
| | | String encoded = Base64Convert.byteToBase64(bpmnBytes); |
| | | byte[] decoded = Base64Convert.base64ToByte(encoded); |
| | | String xml = new String(decoded); |
| | | String processName = modelData.getName() + ".bpmn20.xml"; |
| | | ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes); |
| | | Deployment deployment = repositoryService.createDeployment().name(oaWorkflowDtos.get(0).getFlowName()) |
| | |
| | | model.setName(oaWorkflowDtos.get(0).getFlowName()); |
| | | model.setKey("java110_" + oaWorkflowDtos.get(0).getFlowId()); |
| | | repositoryService.saveModel(model); |
| | | repositoryService.addModelEditorSource(model.getId(), workflowModelDto.getJson_xml().getBytes("utf-8")); |
| | | String jsonXml = workflowModelDto.getJson_xml(); |
| | | jsonXml = jsonXml.replaceAll("camunda:assignee", "activiti:assignee"); |
| | | repositoryService.addModelEditorSource(model.getId(), jsonXml.getBytes("utf-8")); |
| | | |
| | | InputStream svgStream = new ByteArrayInputStream(workflowModelDto.getSvg_xml().getBytes("utf-8")); |
| | | TranscoderInput input = new TranscoderInput(svgStream); |
| | |
| | | for (Element userTask : userTasks) { |
| | | Attribute assignee = userTask.attribute("assignee"); |
| | | if (assignee == null) { |
| | | userTask.addAttribute("activiti:assignee", "${nextUserId}"); |
| | | userTask.addAttribute("camunda:assignee", "${nextUserId}"); |
| | | } |
| | | } |
| | | |
| | | Attribute activiti = rootElement.attribute("activiti"); |
| | | if (activiti == null) { |
| | | rootElement.addAttribute("xmlns:activiti", "http://activiti.org/bpmn"); |
| | | } |
| | | |
| | | Attribute processId = process.attribute("id"); |
| | |
| | | String processIdValue = processId.getValue(); |
| | | String newXml = rootElement.asXML(); |
| | | newXml = newXml.replaceAll(processIdValue, "java110_" + workflowModelDto.getFlowId()); |
| | | |
| | | |
| | | workflowModelDto.setJson_xml(newXml); |
| | | } |
| | | |
| | |
| | | |
| | | Element rootElement = doc.getRootElement(); |
| | | Element process = rootElement.element("process"); |
| | | List<Element> userTasks = process.elements("userTask1"); |
| | | List<Element> userTasks = process.elements("userTask"); |
| | | for (Element userTask : userTasks) { |
| | | Attribute assignee = userTask.attribute("assignee"); |
| | | if (assignee == null) { |
| | | userTask.addAttribute("camunda:assignee", "${createUserId}"); |
| | | userTask.addAttribute("activiti:assignee", "${createUserId}"); |
| | | } |
| | | } |
| | | Attribute activiti = rootElement.attribute("activiti"); |
| | | if (activiti == null) { |
| | | rootElement.addAttribute("xmlns:activiti", "http://activiti.org/bpmn"); |
| | | } |
| | | |
| | | Attribute processId = process.attribute("id"); |
| | | if (processId == null) { |