public List<Map<String, String>> doStartFlow(String key, Long[] ids) throws Exception { // 声明返回的信息 List<Map<String, String>> returnValue = new ArrayList<Map<String, String>>(); Map<String, String> returnMap; // 循环Id数组 for (Long id : ids) { returnMap = new HashMap<String, String>(); Case4InfractBusiness cib = this.caseBusinessDao.load(id); // 声明变量 Map<String, Object> variables = new HashMap<String, Object>(); // 设置任务能够完成办理的条件控制值 车队长任务 variables.put("completeTaskCodition", "t020MotorcadeLeaderCheck_s"); // 发起流程 String procInstId = this.workflowService.startFlowByKey(key, this.returnParam(cib, variables)); // 完成第一步办理 Task task = this.taskService.createTaskQuery().processInstanceId(procInstId).singleResult(); this.workflowService.completeTask(task.getId()); // 同步附件到第一个任务 this.syscAttach(cib, procInstId, task.getId()); // 保存流程与营运违章信息的关系 WorkflowModuleRelation workflowModuleRelation = new WorkflowModuleRelation(); workflowModuleRelation.setMid(id); workflowModuleRelation.setPid(procInstId); workflowModuleRelation.setMtype(Case4InfractBusiness.class.getSimpleName()); this.workflowModuleRelationService.save(workflowModuleRelation); // 将状态更改为处理中 cib.setStatus(CaseBase.STATUS_HANDLING); this.caseBusinessDao.save(cib); // 记录发起的流程信息 returnMap.put("moduleId", String.valueOf(id)); returnMap.put("procInstId", procInstId); returnValue.add(returnMap); } return returnValue; }
public String doStartFlow(String driverIds, String key, String subject, String listDriver) { // 声明变量 Map<String, Object> variables = new HashMap<String, Object>(); variables.put("list_driver", listDriver); variables.put("subject", subject); String procInstId = this.workflowService.startFlowByKey(key, variables); // 流程模块关系domain WorkflowModuleRelation workflowModuleRelation; for (String id : driverIds.split(",")) { // 增加流程关系 workflowModuleRelation = new WorkflowModuleRelation(); workflowModuleRelation.setMid(Long.valueOf(id)); workflowModuleRelation.setPid(procInstId); workflowModuleRelation.setMtype(TempDriver.WORKFLOW_MTYPE); this.workflowModuleRelationService.save(workflowModuleRelation); } // 发起流程 return procInstId; }
public String doStartFlow(String key, Long[] ids, boolean flag_status) { // 声明变量 Map<String, Object> variables; TempDriver tempDriver; // 流程模块关系domain WorkflowModuleRelation workflowModuleRelation; // 声明返回的流程实例id 多个逗号隔开 String procInstIds = ""; // 循环Id数组 for (Long id : ids) { tempDriver = this.tempDriverDao.load(id); // 记录同步的详细关键信息 String desc = ""; if (flag_status) { desc += "将" + tempDriver.getName() + "的招聘信息状态从"; switch (tempDriver.getStatus()) { case TempDriver.STATUS_RESERVE: desc += "待聘"; break; case TempDriver.STATUS_CHECK: desc += "审批中"; break; case TempDriver.STATUS_PASS: desc += "聘用"; break; case TempDriver.STATUS_GIVEUP: desc += "未聘用"; break; } desc += "修改为审批中"; // 更新司机的状态为审批中 tempDriver.setStatus(TempDriver.STATUS_CHECK); this.tempDriverDao.save(tempDriver); } SystemContext sc = SystemContextHolder.get(); sc.setAttr(ExcutionLog.SYNC_INFO_FLAG, true); sc.setAttr(ExcutionLog.SYNC_INFO_VALUE, desc); variables = new HashMap<String, Object>(); // 入职审批流程加载全部信息 if ("CarManEntry".equals(key)) { this.returnParam(tempDriver, variables); } else { variables.put("tempDriver_id", tempDriver.getId()); variables.put("name", tempDriver.getName()); variables.put("certIdentity", tempDriver.getCertIdentity()); } // 发起流程 String procInstId = this.workflowService.startFlowByKey(key, variables); procInstIds += procInstId + ","; // 增加流程关系 workflowModuleRelation = new WorkflowModuleRelation(); workflowModuleRelation.setMid(id); workflowModuleRelation.setPid(procInstId); workflowModuleRelation.setMtype(TempDriver.WORKFLOW_MTYPE); this.workflowModuleRelationService.save(workflowModuleRelation); } return procInstIds; }