java110
2022-03-29 2b9db501b2b6d3724c9b120cc0e361d7c7d585e7
service-common/src/main/java/com/java110/common/bmo/workflow/impl/QueryWorkFlowFirstStaffBMOImpl.java
@@ -10,6 +10,7 @@
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;
@@ -23,7 +24,6 @@
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;
@@ -43,7 +43,6 @@
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;
@@ -98,7 +97,7 @@
        List<Map> workflows = workflowServiceDaoImpl.getWorkflowInfo(BeanConvertUtil.beanCovertMap(workflowDto));
        if (workflows == null || workflows.size() < 1) {
            return null;
            return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "未查询到流程");
        }
        WorkflowDto tmpWorkflowDto = BeanConvertUtil.covertBean(workflows.get(0), WorkflowDto.class);
@@ -129,16 +128,16 @@
        }
        Map staffInfo = workflowStepStaffs.get(0);
        String staffId = staffInfo.get("staffId") + "";
        OrgDto orgDto = new OrgDto();
        orgDto.setStaffId(staffInfo.get("staffId") + "");
        if (staffId.startsWith("${")) {
            return ResultVo.createResponseEntity(orgDto);
        }
        orgDto.setStaffId(staffId);
        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") + "");
@@ -164,9 +163,6 @@
            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())
@@ -359,7 +355,9 @@
            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);
@@ -410,7 +408,7 @@
        for (Element userTask : userTasks) {
            Attribute assignee = userTask.attribute("assignee");
            if (assignee == null) {
                userTask.addAttribute("activiti:assignee", "${nextUserId}");
                userTask.addAttribute("camunda:assignee", "${nextUserId}");
            }
        }
@@ -427,7 +425,7 @@
        String processIdValue = processId.getValue();
        String newXml = rootElement.asXML();
        newXml = newXml.replaceAll(processIdValue, "java110_" + workflowModelDto.getFlowId());
        newXml = newXml.replaceAll("camunda:assignee", "activiti:assignee");
        workflowModelDto.setJson_xml(newXml);
    }