| | |
| | | import com.vci.corba.common.data.UserEntityInfo; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.data.LinkObject; |
| | | import com.vci.corba.workflow.WorkflowServicePrx; |
| | | import com.vci.corba.workflow.data.*; |
| | | import com.vci.corba.wf.WFServicePrx; |
| | | import com.vci.corba.wf.data.*; |
| | | import com.vci.corba.workflow.data.FlowApproveHistoryInfo; |
| | | import com.vci.dto.ProcessTemplateVO; |
| | | import com.vci.model.ProcessInstance; |
| | | import com.vci.model.ProcessTask; |
| | |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | | import com.vci.starter.web.pagemodel.PageHelper; |
| | | import com.vci.starter.web.pagemodel.SessionInfo; |
| | | import com.vci.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.starter.web.util.VciDateUtil; |
| | |
| | | /** |
| | | * 平台的流程服务 |
| | | */ |
| | | private WorkflowServicePrx workService = null; |
| | | private WFServicePrx wfService = null; |
| | | |
| | | /** |
| | | * 平台调用客户端 |
| | |
| | | */ |
| | | private void getCategory() throws VciBaseException { |
| | | try { |
| | | ProcessCategoryInfo[] pcia = getWorkService().getProcessCategories("root"); |
| | | ProcessCategoryInfo[] pcia = getWFService().getProcessCategories("root"); |
| | | if(pcia!=null&&pcia.length>0){ |
| | | for(ProcessCategoryInfo pci : pcia){ |
| | | categoryMap.put(pci.name.toLowerCase(), pci.id); |
| | |
| | | throw new VciBaseException(msgCodePrefix + "typeNotExist", new String[]{type}); |
| | | } |
| | | try { |
| | | allFlowInType = getWorkService().getProcessDefinitions(typeOid); |
| | | allFlowInType = getWFService().getProcessDefinitions(typeOid); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | |
| | | List<String> templateList = VciBaseUtil.str2List(filterTemplate); |
| | | if(!CollectionUtils.isEmpty(templateList)){ |
| | | templateList.forEach(name->{ |
| | | try { |
| | | /*try {*/ |
| | | String nameUnRev = name; |
| | | String revision = ""; |
| | | if(name.contains("-")){ |
| | | nameUnRev = name.substring(0,name.lastIndexOf("-")); |
| | | revision = name.substring(name.lastIndexOf("-")+1); |
| | | } |
| | | ProcessDefinitionInfo[] definition = getWorkService().getProcessDefinitionByProcessDefinitionName(nameUnRev, ""); |
| | | ProcessDefinitionInfo[] definition = null;//getWFService()().getProcessDefinitionByProcessDefinitionName(nameUnRev, ""); |
| | | if(definition!=null){ |
| | | if(StringUtils.isBlank(revision)) { |
| | | Collections.addAll(infoList, definition); |
| | |
| | | infoList.addAll(Arrays.stream(definition).filter(s -> finalRevision.equalsIgnoreCase(String.valueOf(s.version))).collect(Collectors.toList())); |
| | | } |
| | | } |
| | | } catch (PLException e) { |
| | | /*} catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | }*/ |
| | | }); |
| | | } |
| | | allFlowInType = infoList.toArray(new ProcessDefinitionInfo[0]); |
| | |
| | | WebUtil.alertNotNull(deployId,"流程部署主键"); |
| | | ProcessDefinitionInfo pdi = null; |
| | | try { |
| | | pdi = getWorkService().getProcessDefinitionByDeployId(deployId.trim()); |
| | | pdi = getWFService().getProcessDefinitionByDeployId(deployId.trim()); |
| | | } catch (PLException e) { |
| | | throw new VciBaseException(msgCodePrefix + "deployIdNotExist", new String[]{deployId}); |
| | | } |
| | |
| | | public String getFirstNodeName(String deployId) throws VciBaseException { |
| | | WebUtil.alertNotNull(deployId,"部署主键"); |
| | | try { |
| | | ProcessTaskInfo firstProcessTask = getWorkService().getFirstProcessTask(deployId); |
| | | ProcessTaskInfo firstProcessTask = getWFService().getFirstProcessTask(deployId); |
| | | if(firstProcessTask!=null){ |
| | | return firstProcessTask.taskName; |
| | | } |
| | |
| | | public String[] getAllProcessNodeNameByDeploy(String deploymentId) throws VciBaseException{ |
| | | String[] allTaskNames = null; |
| | | try { |
| | | allTaskNames = getWorkService().getAllTaskNames(deploymentId); |
| | | allTaskNames = getWFService().getAllTaskNames(deploymentId); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | |
| | | @Override |
| | | public String getJbpmDeploymentId(String processOid) throws VciBaseException{ |
| | | WebUtil.alertNotNull(processOid,"流程模板主键"); |
| | | return getWorkService().getDeploymentID(processOid); |
| | | return null;//getWFService()().getDeploymentID(processOid); |
| | | } |
| | | |
| | | /** |
| | |
| | | public String getJbpmDeploymentIdByExecutionId(String executionId) throws VciBaseException{ |
| | | WebUtil.alertNotNull(executionId,"流程执行主键"); |
| | | try { |
| | | return getWorkService().getDeploymentIdByExecutionId(executionId); |
| | | return getWFService().getDeploymentIdByExecutionId(executionId); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | |
| | | ProcessNodeVO pn = new ProcessNodeVO(); |
| | | pn.setName(taskName); |
| | | try { |
| | | String[] nodePresideUsers = getWorkService().getCurCandidates(deploymentId, taskName, "", ""); |
| | | String[] nodePresideUsers = getWFService().getCurCandidates(deploymentId, taskName, "", ""); |
| | | if(nodePresideUsers!=null&& nodePresideUsers.length>0){ |
| | | for(String preUsers : nodePresideUsers){ |
| | | //平台存储的方式是用户;角色;部门;自定义.... |
| | |
| | | return null; |
| | | } |
| | | //不能使用workitem去查询,因为可能任务还没到 |
| | | String users = getWorkService().getNextTaskAssigner(executionid, taskName); |
| | | String users = getWFService().getNextTaskAssigner(executionid, taskName); |
| | | List<ProcessUserVO> allProUser = new ArrayList<ProcessUserVO>(); |
| | | if(StringUtils.isNotEmpty(users)){ |
| | | String userIds = users.replace("user:", "");//现在只支持设置用户 |
| | |
| | | @Override |
| | | public String getVariablesInProcess(String executionId,String key) throws VciBaseException{ |
| | | WebUtil.alertNotNull(executionId,"流程执行主键",key,"参数Key"); |
| | | UserEntityInfo ueo = new UserEntityInfo(); |
| | | SessionInfo si = WebUtil.getCurrentUserSessionInfo(); |
| | | ueo.modules = "流程"; |
| | | ueo.userName = si.getUserId(); |
| | | // UserEntityInfo ueo = new UserEntityInfo(); |
| | | // SessionInfo si = WebUtil.getCurrentUserSessionInfo(); |
| | | // ueo.modules = "流程"; |
| | | // ueo.userName = si.getUserId(); |
| | | while(StringUtils.countMatches(executionId,".")>1){ |
| | | //说明是子任务,用父任务获取一下变量 |
| | | executionId = executionId.substring(0,executionId.lastIndexOf(".")); |
| | | } |
| | | try { |
| | | return getWorkService().getProcessVariable(executionId, key, ueo); |
| | | return getWFService().getProcessVariable(executionId, key); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | |
| | | conditionMap.put("f_btwname", workitemBtmType); |
| | | }else if(StringUtils.isNotBlank(processOid)){ |
| | | //实际上传递的是executionid |
| | | conditionMap.put("f_oid", "\\IN(select oid from platformbtm_" + workIntanceBtmType + " where executionid = '" + processOid.trim() + "')"); |
| | | conditionMap.put("f_oid", "\\IN(select oid from pbt_" + workIntanceBtmType + " where executionid = '" + processOid.trim() + "')"); |
| | | conditionMap.put("f_btwname", workIntanceBtmType); |
| | | } |
| | | return getData(taskDataLink,conditionMap,referColumns); |
| | |
| | | conditionMap.put("f_oid", taskOid.trim()); |
| | | conditionMap.put("f_btwname", getWorkitemBtmType()); |
| | | }else if(StringUtils.isNotBlank(executionid)){ |
| | | conditionMap.put("f_oid", "\\IN(select oid from platformbtm_" + getWorkIntanceBtmType() + " where executionid = '" + executionid.trim() + "')"); |
| | | conditionMap.put("f_oid", "\\IN(select oid from pbt_" + getWorkIntanceBtmType() + " where executionid = '" + executionid.trim() + "')"); |
| | | conditionMap.put("f_btwname", getWorkIntanceBtmType()); |
| | | } |
| | | return loService.queryCLO(taskDataLink, conditionMap); |
| | |
| | | public DataGrid getDataByProcess(String executionId,String referColumns) throws VciBaseException{ |
| | | WebUtil.alertNotNull(executionId,"流程执行ID"); |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("f_oid","\\IN(select oid from platformbtm_" +getWorkIntanceBtmType() + " where executionid='" + executionId.trim() + "')"); |
| | | conditionMap.put("f_oid","\\IN(select oid from pbt_" +getWorkIntanceBtmType() + " where executionid='" + executionId.trim() + "')"); |
| | | conditionMap.put("f_btwname", getWorkIntanceBtmType()); |
| | | return getData(processDataLink,conditionMap,referColumns); |
| | | } |
| | |
| | | WebUtil.alertNotNull(executionId,"流程执行主键"); |
| | | List<ProcessHistoryVO> hisList = new ArrayList<ProcessHistoryVO>(); |
| | | FlowApproveHistoryInfo[] historyActivitys = null; |
| | | try { |
| | | historyActivitys = getWorkService().getHistoryActivityByProInsIdbyPLM(executionId); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | |
| | | //需要去除未处理的重复项 |
| | | for (int i = 0; i < historyActivitys.length; i++) { |
| | | FlowApproveHistoryInfo historyActivity = historyActivitys[i]; |
| | |
| | | //如果endTime为空表示是待办的,但是服务端的接口中有个问题是,会把会签或者子流程中已经处理的和未处理的混合在一起 |
| | | //直接从待办任务里去查询 |
| | | } |
| | | |
| | | /*try { |
| | | historyActivitys = getWFService()().getHistoryActivityByProInsIdbyPLM(executionId); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | }*/ |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("businesstype", "5");//本项目没有实际的意义 |
| | | conditionMap.put("lcstatus", "Executing"); |
| | |
| | | throws VciBaseException{ |
| | | WebUtil.alertNotNull(executionId,"流程执行主键",taskName,"流程任务名称"); |
| | | try { |
| | | byte[] processChart = getWorkService().getExecutionImageByExecutionId(executionId, taskName); |
| | | byte[] processChart = null;//getWFService()().getExecutionImageByExecutionId(executionId, taskName); |
| | | return processChart; |
| | | } catch (Throwable e) { |
| | | String msg = "有可能这个任务关联的流程已经结束或者被终止,不能再查看其流程图了"; |
| | |
| | | throws VciBaseException{ |
| | | WebUtil.alertNotNull(executionId,"流程实例主键"); |
| | | try { |
| | | byte[] processChart = getWorkService().getFlowImageByDeployID(executionId); |
| | | byte[] processChart = getWFService().getFlowImageByDeployID(executionId); |
| | | return processChart; |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | |
| | | @Override |
| | | public String[] getAllOutComes(String taskOid) throws VciBaseException{ |
| | | try { |
| | | return getWorkService().getAllOutComes(taskOid); |
| | | return getWFService().getAllOutComes(taskOid); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | |
| | | WebUtil.alertNotNull(executionid,"流程执行主键",taskName,"任务名称"); |
| | | String deployId = getJbpmDeploymentIdByExecutionId(executionid); |
| | | try { |
| | | return getWorkService().getNextTaskNameByJbpmId(deployId, taskName, outCome); |
| | | return getWFService().getNextTaskNameByJbpmId(deployId, taskName, outCome); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public WorkflowServicePrx getWorkService() throws VciBaseException{ |
| | | if(workService == null){ |
| | | this.workService = platformClientUtil.getWorkflowService(); |
| | | public WFServicePrx getWFService() throws VciBaseException{ |
| | | if(wfService == null){ |
| | | this.wfService = platformClientUtil.getWFService(); |
| | | } |
| | | return workService; |
| | | return wfService; |
| | | } |
| | | |
| | | @Override |
| | |
| | | taskAss.endTime = VciDateUtil.getTime(endDate); |
| | | taskAss.isTrue = isNowEnable?true:false; |
| | | taskAss.fromUser =WebUtil.getCurrentUserSessionInfo().getUserId(); |
| | | try { |
| | | getWorkService().saveOrUpdateTasksAssigned(taskAss, WebUtil.getUserEntityInfo("流程")); |
| | | /*try { |
| | | getWFService().saveOrUpdateTasksAssigned(taskAss, WebUtil.getUserEntityInfo("流程")); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | }*/ |
| | | } |
| | | |
| | | |
| | |
| | | //平台不支持停用启用代理信息..可以查询出来再重新添加。 |
| | | try { |
| | | UserEntityInfo uei = WebUtil.getUserEntityInfo( "流程"); |
| | | getWorkService().deleteTasksAssignedByUserName(new String[]{uei.userName}, uei); |
| | | getWFService().deleteTasksAssignedByUserName(new String[]{uei.userName}); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | |
| | | public TasksAssignedInfo getProxy() throws VciBaseException{ |
| | | TasksAssignedInfo assign = null; |
| | | try { |
| | | assign = getWorkService().getTasksAssignedByUserName("", WebUtil.getUserEntityInfo( "流程")); |
| | | assign = getWFService().getTasksAssignedByUserName(""); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | |
| | | UserEntityInfo userEntityInfo = WebUtil.getUserEntityInfo("流程"); |
| | | String resetStatus = null; |
| | | try{ |
| | | resetStatus = getWorkService().getProcessVariable(executionId, WFVariablesKeyConstant.RESET_STATUS, userEntityInfo); |
| | | resetStatus = getWFService().getProcessVariable(executionId, WFVariablesKeyConstant.RESET_STATUS); |
| | | }catch (Throwable e){ |
| | | logger.error("获取流程的变量出错",e); |
| | | } |
| | | getWorkService().endProcessInstanceByplatform(executionId,userEntityInfo); |
| | | //getWFService().endProcessInstanceByplatform(executionId,userEntityInfo); |
| | | //平台没有自动将业务数据恢复到之前的状态 |
| | | if(StringUtils.isNotBlank(resetStatus)){ |
| | | resetLcStatusForBusinessData(dataGrid.getData(),resetStatus); |
| | |
| | | @Override |
| | | public List<ProcessInstanceVO> listExecutingProcessByBussinessOid(String bussinessOid, String btmName) throws VciBaseException { |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("oid",QueryOptionConstant.IN + "(select f_oid from platformlt_" + getTaskDataLink() + " where f_btwname='" + getWorkIntanceBtmType() + "' " + |
| | | conditionMap.put("oid",QueryOptionConstant.IN + "(select f_oid from plt_" + getTaskDataLink() + " where f_btwname='" + getWorkIntanceBtmType() + "' " + |
| | | " and t_btwname='" + btmName + "' and t_oid = '" + bussinessOid + "' )"); |
| | | conditionMap.put("lcstatus","Executing"); |
| | | List<ProcessInstance> processInstances = boService.queryObject(ProcessInstance.class,conditionMap); |
| | |
| | | @Override |
| | | public byte[] getProcessXmlContent(String jbpmDeploymentId) throws VciBaseException { |
| | | WebUtil.alertNotNull("流程执行主键信息",jbpmDeploymentId); |
| | | try { |
| | | return getWorkService().getProcessResource(jbpmDeploymentId,".xml"); |
| | | } catch (PLException e) { |
| | | /*try {*/ |
| | | return null;//getWFService().getProcessResource(jbpmDeploymentId,".xml"); |
| | | /*} catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | }*/ |
| | | } |
| | | |
| | | /** |