| | |
| | | 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.WorkflowService; |
| | | import com.vci.corba.workflow.WorkflowServicePrx; |
| | | import com.vci.corba.workflow.data.*; |
| | | import com.vci.dto.ProcessTemplateVO; |
| | | import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; |
| | | import com.vci.frameworkcore.pagemodel.SmUserVO; |
| | | import com.vci.pagemodel.*; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | |
| | | import com.vci.starter.web.util.BeanUtil; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.starter.web.util.VciDateUtil; |
| | | import com.vci.constant.WFVariablesKeyConstant; |
| | | import com.vci.web.dao.WebProcessDaoI; |
| | | import com.vci.web.model.ProcessInstance; |
| | | import com.vci.web.model.ProcessTask; |
| | | import com.vci.web.model.WFProcessClassifyDO; |
| | | import com.vci.web.model.WFProcessTemplateDO; |
| | | import com.vci.web.pageModel.*; |
| | | import com.vci.web.service.WebBoServiceI; |
| | | import com.vci.model.ProcessInstance; |
| | | import com.vci.model.ProcessTask; |
| | | import com.vci.model.WFProcessClassifyDO; |
| | | import com.vci.model.WFProcessTemplateDO; |
| | | import com.vci.web.service.OsLifeCycleServiceI; |
| | | import com.vci.web.service.WebBoServiceI; |
| | | import com.vci.web.service.WebLoServiceI; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Repository; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.*; |
| | | import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST; |
| | | |
| | | |
| | | /** |
| | | * 流程的数据层 |
| | |
| | | * @throws VciBaseException |
| | | */ |
| | | private void getCategory() throws VciBaseException { |
| | | // try { |
| | | // ProcessCategoryInfo[] pcia = getWorkService().getProcessCategories("root"); |
| | | // if(pcia!=null&&pcia.length>0){ |
| | | // for(ProcessCategoryInfo pci : pcia){ |
| | | // categoryMap.put(pci.name.toLowerCase(), pci.id); |
| | | // } |
| | | // } |
| | | // } catch (VCIError e) { |
| | | // WebUtil.getVciBaseException(e); |
| | | // }//平台没有根据分类名称获取流程分类的接口 |
| | | try { |
| | | ProcessCategoryInfo[] pcia = getWorkService().getProcessCategories("root"); |
| | | if(pcia!=null&&pcia.length>0){ |
| | | for(ProcessCategoryInfo pci : pcia){ |
| | | categoryMap.put(pci.name.toLowerCase(), pci.id); |
| | | } |
| | | } |
| | | } catch (PLException e) { |
| | | WebUtil.getVciBaseException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * @throws |
| | | */ |
| | | @Override |
| | | public List<ProcessTemplateVO> getTemplatesByType(String type, String filterTemplate,boolean showAll) |
| | | public List<ProcessTemplateVO> getTemplatesByType(String type, String filterTemplate, boolean showAll) |
| | | throws VciBaseException { |
| | | WebUtil.alertNotNull(type,"模板分类"); |
| | | ProcessDefinitionInfo[] allFlowInType = null; |
| | | if(StringUtils.isBlank(filterTemplate)) { |
| | | //无指定模板情况下,获取模板分类下的所有模板 |
| | | type = type.toLowerCase(); |
| | | if (categoryMap.isEmpty() || !categoryMap.containsKey(type)) { |
| | | getCategory(); |
| | |
| | | } else { |
| | | throw new VciBaseException(msgCodePrefix + "typeNotExist", new String[]{type}); |
| | | } |
| | | // try { |
| | | // allFlowInType = getWorkService().getProcessDefinitions(typeOid); |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | }else{ |
| | | try { |
| | | allFlowInType = getWorkService().getProcessDefinitions(typeOid); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | }else{ |
| | | List<ProcessDefinitionInfo> infoList = new ArrayList<>(); |
| | | VciBaseUtil.str2List(filterTemplate).stream().forEach(name->{ |
| | | // 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, ""); |
| | | // if(definition!=null){ |
| | | // if(StringUtils.isBlank(revision)) { |
| | | // Collections.addAll(infoList, definition); |
| | | // }else{ |
| | | // //过滤版本 |
| | | // String finalRevision = revision; |
| | | // infoList.addAll(Arrays.stream(definition).filter(s -> finalRevision.equalsIgnoreCase(String.valueOf(s.version))).collect(Collectors.toList())); |
| | | // } |
| | | // } |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | }); |
| | | List<String> templateList = VciBaseUtil.str2List(filterTemplate); |
| | | if(!CollectionUtils.isEmpty(templateList)){ |
| | | templateList.forEach(name->{ |
| | | 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, ""); |
| | | if(definition!=null){ |
| | | if(StringUtils.isBlank(revision)) { |
| | | Collections.addAll(infoList, definition); |
| | | }else{ |
| | | //过滤版本 |
| | | String finalRevision = revision; |
| | | infoList.addAll(Arrays.stream(definition).filter(s -> finalRevision.equalsIgnoreCase(String.valueOf(s.version))).collect(Collectors.toList())); |
| | | } |
| | | } |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | }); |
| | | } |
| | | allFlowInType = infoList.toArray(new ProcessDefinitionInfo[0]); |
| | | } |
| | | return swapProcessTemplate(allFlowInType, type, showAll); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据部署主键,获取流程模板对象 |
| | | * @param deployId 部署主键 |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public ProcessTemplateVO getTemplateByDeployId(String deployId) throws VciBaseException { |
| | | WebUtil.alertNotNull(deployId,"流程部署主键"); |
| | | ProcessDefinitionInfo pdi = null; |
| | | // try { |
| | | // pdi = getWorkService().getProcessDefinitionByDeployId(deployId.trim()); |
| | | // } catch (VCIError e) { |
| | | // throw new VciBaseException(msgCodePrefix + "deployIdNotExist", new String[]{deployId}); |
| | | // } |
| | | try { |
| | | pdi = getWorkService().getProcessDefinitionByDeployId(deployId.trim()); |
| | | } catch (PLException e) { |
| | | throw new VciBaseException(msgCodePrefix + "deployIdNotExist", new String[]{deployId}); |
| | | } |
| | | List<ProcessTemplateVO> proTemplates = swapProcessTemplate(new ProcessDefinitionInfo[]{pdi},"",false); |
| | | if(proTemplates == null || proTemplates.size() == 0){ |
| | | throw new VciBaseException(msgCodePrefix + "deployIdNotExist", new String[]{deployId}); |
| | |
| | | pt.setName(pd.name); |
| | | pt.setStatus(pd.status); |
| | | pt.setTaskType(type); |
| | | // pt.setVersion(pd.version); |
| | | pt.setVersion((int) pd.version); |
| | | allTemplate.add(pt); |
| | | } |
| | | } |
| | |
| | | } |
| | | return allNode; |
| | | } |
| | | |
| | | /** |
| | | * 获取流程中的第一个节点的名称 |
| | | * @param deployId 部署主键 |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public String getFirstNodeName(String deployId) throws VciBaseException { |
| | | WebUtil.alertNotNull(deployId,"部署主键"); |
| | | // try { |
| | | // ProcessTaskInfo firstProcessTask = getWorkService().getFirstProcessTask(deployId); |
| | | // if(firstProcessTask!=null){ |
| | | // return firstProcessTask.taskName; |
| | | // } |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | try { |
| | | ProcessTaskInfo firstProcessTask = getWorkService().getFirstProcessTask(deployId); |
| | | if(firstProcessTask!=null){ |
| | | return firstProcessTask.taskName; |
| | | } |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 获取流程的所有节点名称 |
| | | * @param processOid |
| | |
| | | @Override |
| | | public String[] getAllProcessNodeNameByDeploy(String deploymentId) throws VciBaseException{ |
| | | String[] allTaskNames = null; |
| | | // try { |
| | | // allTaskNames = getWorkService().getAllTaskNames(deploymentId); |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | try { |
| | | allTaskNames = getWorkService().getAllTaskNames(deploymentId); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | return allTaskNames; |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public String getJbpmDeploymentId(String processOid) throws VciBaseException{ |
| | | // WebUtil.alertNotNull(processOid,"流程模板主键"); |
| | | // return getWorkService().getDeploymentID(processOid); |
| | | return null; |
| | | WebUtil.alertNotNull(processOid,"流程模板主键"); |
| | | return getWorkService().getDeploymentID(processOid); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取流程模板对应的引擎里的部署主键 |
| | | * @param executionId |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public String getJbpmDeploymentIdByExecutionId(String executionId) throws VciBaseException{ |
| | | WebUtil.alertNotNull(executionId,"流程执行主键"); |
| | | // try { |
| | | // return getWorkService().getDeploymentIdByExecutionId(executionId); |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | return null; |
| | | try { |
| | | return getWorkService().getDeploymentIdByExecutionId(executionId); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取模板中节点设置的负责人 |
| | | * @param deploymentId 引擎中的部署主键 |
| | | * @param taskName 任务节点名称 |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public ProcessNodeVO getNodePresideUsersByDeploy(String deploymentId, String taskName) throws VciBaseException{ |
| | | WebUtil.alertNotNull(taskName,"流程任务名称",deploymentId,"流程引擎中的部署主键"); |
| | | ProcessNodeVO pn = new ProcessNodeVO(); |
| | | // pn.setName(taskName); |
| | | // try { |
| | | // String[] nodePresideUsers = getWorkService().getCurCandidates(deploymentId, taskName, "", ""); |
| | | // if(nodePresideUsers!=null&& nodePresideUsers.length>0){ |
| | | // for(String preUsers : nodePresideUsers){ |
| | | // //平台存储的方式是用户;角色;部门;自定义.... |
| | | // if(StringUtils.isNotEmpty(preUsers)){ |
| | | // String[] preUsersSplit = preUsers.split("\\;"); |
| | | // if(preUsersSplit!=null && preUsersSplit.length>0){ |
| | | // if(StringUtils.isNotEmpty(preUsersSplit[0])){ |
| | | // pn.setUsers(preUsersSplit[0]); |
| | | // } |
| | | // if(preUsersSplit.length>1 && StringUtils.isNotEmpty(preUsersSplit[1])){ |
| | | // pn.setRoles(preUsersSplit[1]); |
| | | // } |
| | | // if(preUsersSplit.length>2 && StringUtils.isNotEmpty(preUsersSplit[2])){ |
| | | // pn.setDepts(preUsersSplit[2]); |
| | | // } |
| | | // if(preUsersSplit.length>3 && StringUtils.isNotEmpty(preUsersSplit[3])){ |
| | | // pn.setCustomClass(preUsersSplit[3]); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | pn.setName(taskName); |
| | | try { |
| | | String[] nodePresideUsers = getWorkService().getCurCandidates(deploymentId, taskName, "", ""); |
| | | if(nodePresideUsers!=null&& nodePresideUsers.length>0){ |
| | | for(String preUsers : nodePresideUsers){ |
| | | //平台存储的方式是用户;角色;部门;自定义.... |
| | | if(StringUtils.isNotEmpty(preUsers)){ |
| | | String[] preUsersSplit = preUsers.split("\\;"); |
| | | if(preUsersSplit!=null && preUsersSplit.length>0){ |
| | | if(StringUtils.isNotEmpty(preUsersSplit[0])){ |
| | | pn.setUsers(preUsersSplit[0]); |
| | | } |
| | | if(preUsersSplit.length>1 && StringUtils.isNotEmpty(preUsersSplit[1])){ |
| | | pn.setRoles(preUsersSplit[1]); |
| | | } |
| | | if(preUsersSplit.length>2 && StringUtils.isNotEmpty(preUsersSplit[2])){ |
| | | pn.setDepts(preUsersSplit[2]); |
| | | } |
| | | if(preUsersSplit.length>3 && StringUtils.isNotEmpty(preUsersSplit[3])){ |
| | | pn.setCustomClass(preUsersSplit[3]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | return pn; |
| | | } |
| | | |
| | |
| | | } |
| | | return getNodePresideUsersByDeploy(deploymentId,taskName); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取任务的处理人 |
| | | * @param executionid 执行主键 |
| | | * @param taskName 任务名称 |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public List<ProcessUserVO> getNodePresideUsersByTask(String executionid, String taskName) |
| | | throws VciBaseException{ |
| | | WebUtil.alertNotNull(executionid,"流程执行任务",taskName,"任务名称"); |
| | | // if("结束".equalsIgnoreCase(taskName)){ |
| | | // return null; |
| | | // } |
| | | if("结束".equalsIgnoreCase(taskName)){ |
| | | return null; |
| | | } |
| | | //不能使用workitem去查询,因为可能任务还没到 |
| | | // String users = getWorkService().getNextTaskAssigner(executionid, taskName); |
| | | String users = getWorkService().getNextTaskAssigner(executionid, taskName); |
| | | List<ProcessUserVO> allProUser = new ArrayList<ProcessUserVO>(); |
| | | // if(StringUtils.isNotEmpty(users)){ |
| | | // String userIds = users.replace("user:", "");//现在只支持设置用户 |
| | | // List<SmUserVO> allUser = userQueryService.listUserByUserIds(WebUtil.str2List(userIds)); |
| | | // if(allUser!=null && allUser.size()>0){ |
| | | // for(SmUserVO user : allUser){ |
| | | // ProcessUserVO pu = new ProcessUserVO(); |
| | | // BeanUtils.copyProperties(user, pu); |
| | | // pu.setType("user"); |
| | | // allProUser.add(pu); |
| | | // } |
| | | // } |
| | | // } |
| | | if(StringUtils.isNotEmpty(users)){ |
| | | String userIds = users.replace("user:", "");//现在只支持设置用户 |
| | | List<SmUserVO> allUser = userQueryService.listUserByUserIds(WebUtil.str2List(userIds)); |
| | | if(allUser!=null && allUser.size()>0){ |
| | | for(SmUserVO user : allUser){ |
| | | ProcessUserVO pu = new ProcessUserVO(); |
| | | BeanUtils.copyProperties(user, pu); |
| | | pu.setType("user"); |
| | | allProUser.add(pu); |
| | | } |
| | | } |
| | | } |
| | | return allProUser; |
| | | } |
| | | |
| | |
| | | BeanUtil.convert(process,processInstanceVO); |
| | | return processInstanceVO; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取流程中的变量,平台只支持字符串..... |
| | | * @param executionId |
| | | * @param key |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public String getVariablesInProcess(String executionId,String key) throws VciBaseException{ |
| | | WebUtil.alertNotNull(executionId,"流程执行主键",key,"参数Key"); |
| | | UserEntityInfo ueo = new UserEntityInfo(); |
| | | SessionInfo si = WebUtil.getCurrentUserSessionInfo(); |
| | | // ueo..ip = si.getIp(); |
| | | ueo.modules = "流程"; |
| | | ueo.userName = si.getUserId(); |
| | | // while(StringUtils.countMatches(executionId,".")>1){ |
| | | // //说明是子任务,用父任务获取一下变量 |
| | | // executionId = executionId.substring(0,executionId.lastIndexOf(".")); |
| | | // } |
| | | // try { |
| | | // return getWorkService().getProcessVariable(executionId, key, ueo); |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | return null; |
| | | while(StringUtils.countMatches(executionId,".")>1){ |
| | | //说明是子任务,用父任务获取一下变量 |
| | | executionId = executionId.substring(0,executionId.lastIndexOf(".")); |
| | | } |
| | | try { |
| | | return getWorkService().getProcessVariable(executionId, key, ueo); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | public List<ProcessHistoryVO> getHistory(String executionId) throws VciBaseException{ |
| | | WebUtil.alertNotNull(executionId,"流程执行主键"); |
| | | List<ProcessHistoryVO> hisList = new ArrayList<ProcessHistoryVO>(); |
| | | // FlowApproveHistoryInfo[] historyActivitys = null; |
| | | // try { |
| | | // historyActivitys = getWorkService().getHistoryActivityByProInsIdbyPLM(executionId); |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | // //需要去除未处理的重复项 |
| | | // for (int i = 0; i < historyActivitys.length; i++) { |
| | | // FlowApproveHistoryInfo historyActivity = historyActivitys[i]; |
| | | // ProcessHistoryVO his = new ProcessHistoryVO(); |
| | | // his.setTaskName(historyActivity.taskName); |
| | | // his.setOpinin(historyActivity.opinion);//这个是处理方式,就是同意还是不同意 |
| | | // his.setCreateTime(historyActivity.createTime); |
| | | // his.setEndTime(historyActivity.endTime); |
| | | // his.setNode(historyActivity.note); |
| | | // his.setAssignee(historyActivity.assignee); |
| | | // his.setExecutionId(historyActivity.executionId); |
| | | // String userIdString = historyActivity.assignee; |
| | | // if(StringUtils.contains(userIdString,":")) { |
| | | // userIdString = userIdString.substring(userIdString.indexOf(":") + 1); |
| | | // } |
| | | // String userShowInfoString = ""; |
| | | // SmUserVO user = userQueryService.getUserByUserId(userIdString); |
| | | // if(user != null){ |
| | | // userShowInfoString = user.getName() + "(" + user.getId() + ")"; |
| | | // }else{ |
| | | // userShowInfoString = historyActivity.assignee; |
| | | // } |
| | | // his.setAssigneeName(userShowInfoString); |
| | | // if(StringUtils.isNotBlank(historyActivity.endTime)) { |
| | | // hisList.add(his); |
| | | // } |
| | | // //如果endTime为空表示是待办的,但是服务端的接口中有个问题是,会把会签或者子流程中已经处理的和未处理的混合在一起 |
| | | // //直接从待办任务里去查询 |
| | | // } |
| | | 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]; |
| | | ProcessHistoryVO his = new ProcessHistoryVO(); |
| | | his.setTaskName(historyActivity.taskName); |
| | | his.setOpinin(historyActivity.opinion);//这个是处理方式,就是同意还是不同意 |
| | | his.setCreateTime(VciDateUtil.date2Str(VciDateUtil.long2Date(historyActivity.createTime), VciDateUtil.DateTimeFormat)); |
| | | his.setEndTime(VciDateUtil.date2Str(VciDateUtil.long2Date(historyActivity.endTime), VciDateUtil.DateTimeFormat)); |
| | | his.setNode(historyActivity.note); |
| | | his.setAssignee(historyActivity.assignee); |
| | | his.setExecutionId(historyActivity.executionId); |
| | | String userIdString = historyActivity.assignee; |
| | | if(StringUtils.contains(userIdString,":")) { |
| | | userIdString = userIdString.substring(userIdString.indexOf(":") + 1); |
| | | } |
| | | String userShowInfoString = ""; |
| | | SmUserVO user = userQueryService.getUserByUserId(userIdString); |
| | | if(user != null){ |
| | | userShowInfoString = user.getName() + "(" + user.getId() + ")"; |
| | | }else{ |
| | | userShowInfoString = historyActivity.assignee; |
| | | } |
| | | his.setAssigneeName(userShowInfoString); |
| | | if(StringUtils.isNotBlank(his.getEndTime())) { |
| | | hisList.add(his); |
| | | } |
| | | //如果endTime为空表示是待办的,但是服务端的接口中有个问题是,会把会签或者子流程中已经处理的和未处理的混合在一起 |
| | | //直接从待办任务里去查询 |
| | | } |
| | | |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("businesstype", "5");//本项目没有实际的意义 |
| | |
| | | public byte[] getProcessPicture(String executionId, String taskName) |
| | | throws VciBaseException{ |
| | | WebUtil.alertNotNull(executionId,"流程执行主键",taskName,"流程任务名称"); |
| | | // try { |
| | | // byte[] processChart = getWorkService().getExecutionImageByExecutionId(executionId, taskName); |
| | | // return processChart; |
| | | // } catch (Throwable e) { |
| | | // String msg = "有可能这个任务关联的流程已经结束或者被终止,不能再查看其流程图了"; |
| | | // logger.error(msg,e); |
| | | // throw new VciBaseException(msg); |
| | | // } |
| | | return null; |
| | | try { |
| | | byte[] processChart = getWorkService().getExecutionImageByExecutionId(executionId, taskName); |
| | | return processChart; |
| | | } catch (Throwable e) { |
| | | String msg = "有可能这个任务关联的流程已经结束或者被终止,不能再查看其流程图了"; |
| | | logger.error(msg,e); |
| | | throw new VciBaseException(msg); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public byte[] getProcessTemplatePicture(String executionId) |
| | | throws VciBaseException{ |
| | | // WebUtil.alertNotNull(executionId,"流程实例主键"); |
| | | // try { |
| | | // byte[] processChart = getWorkService().getFlowImageByDeployID(executionId); |
| | | // return processChart; |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public String[] getAllOutComes(String taskOid) throws VciBaseException{ |
| | | // try { |
| | | // return getWorkService().getAllOutComes(taskOid); |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public String getNextTaskName(String executionid, String taskName, String outCome) throws VciBaseException{ |
| | | // WebUtil.alertNotNull(executionid,"流程执行主键",taskName,"任务名称"); |
| | | // String deployId = getJbpmDeploymentIdByExecutionId(executionid); |
| | | // try { |
| | | // return getWorkService().getNextTaskNameByJbpmId(deployId, taskName, outCome); |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | return null; |
| | | WebUtil.alertNotNull(executionId,"流程实例主键"); |
| | | try { |
| | | byte[] processChart = getWorkService().getFlowImageByDeployID(executionId); |
| | | return processChart; |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取任务的路由 |
| | | * @param taskOid jbpm中的任务主键 |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public String[] getAllOutComes(String taskOid) throws VciBaseException{ |
| | | try { |
| | | return getWorkService().getAllOutComes(taskOid); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取下一步的任务 |
| | | * @param executionid 流程执行主键 |
| | | * @param taskName 当前任务的名称 |
| | | * @param outCome 路由名称 |
| | | * @return 因为有分支的情况,所以下一步任务会有多个 |
| | | */ |
| | | @Override |
| | | public String getNextTaskName(String executionid, String taskName, String outCome) throws VciBaseException{ |
| | | WebUtil.alertNotNull(executionid,"流程执行主键",taskName,"任务名称"); |
| | | String deployId = getJbpmDeploymentIdByExecutionId(executionid); |
| | | try { |
| | | return getWorkService().getNextTaskNameByJbpmId(deployId, taskName, outCome); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取平台的流程服务 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public WorkflowServicePrx getWorkService() throws VciBaseException{ |
| | | if(workService == null){ |
| | |
| | | taskAss.userName = ""; |
| | | } |
| | | taskAss.TasksName = userId; |
| | | // taskAss.startTime = VciDateUtil.date2Str(startDate, VciDateUtil.DateFormat); |
| | | taskAss.startTime = VciDateUtil.getTime(startDate); |
| | | if(endDate == null){ |
| | | endDate = VciDateUtil.getDateAddDay(startDate, 30);//默认最多代理一个月 |
| | | } |
| | | // taskAss.endTime = VciDateUtil.date2Str(endDate, VciDateUtil.DateFormat); |
| | | // taskAss.isTrue = isNowEnable?1:0; |
| | | taskAss.endTime = VciDateUtil.getTime(endDate); |
| | | taskAss.isTrue = isNowEnable?true:false; |
| | | taskAss.fromUser =WebUtil.getCurrentUserSessionInfo().getUserId(); |
| | | // try { |
| | | // getWorkService().saveOrUpdateTasksAssigned(taskAss, WebUtil.getUserEntityInfo("流程")); |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | try { |
| | | getWorkService().saveOrUpdateTasksAssigned(taskAss, WebUtil.getUserEntityInfo("流程")); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | public void endProxy() |
| | | throws VciBaseException { |
| | | //平台不支持停用启用代理信息..可以查询出来再重新添加。 |
| | | // try { |
| | | // UserEntityInfo uei = WebUtil.getUserEntityInfo( "流程"); |
| | | // getWorkService().deleteTasksAssignedByUserName(new String[]{uei.userName}, uei); |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | try { |
| | | UserEntityInfo uei = WebUtil.getUserEntityInfo( "流程"); |
| | | getWorkService().deleteTasksAssignedByUserName(new String[]{uei.userName}, uei); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public TasksAssignedInfo getProxy() throws VciBaseException{ |
| | | TasksAssignedInfo assign = null; |
| | | // try { |
| | | // TasksAssignedInfo taskAss = getWorkService().getTasksAssignedByUserName("", WebUtil.getUserEntityInfo( "流程")); |
| | | // if(taskAss!=null && StringUtils.isNotEmpty(taskAss.id)){ |
| | | // assign = new TasksAssigned(); |
| | | // assign.setId(taskAss.id); |
| | | // assign.setTasksName(taskAss.TasksName); |
| | | // assign.setStartTime(taskAss.startTime); |
| | | // assign.setEndTime(taskAss.endTime); |
| | | // assign.setFromUser(taskAss.fromUser); |
| | | // assign.setIsTrue(taskAss.isTrue); |
| | | // assign.setUserName(taskAss.userName); |
| | | // } |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | try { |
| | | assign = getWorkService().getTasksAssignedByUserName("", WebUtil.getUserEntityInfo( "流程")); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | return assign; |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public void endProcess(String executionId) throws VciBaseException { |
| | | // try { |
| | | try { |
| | | DataGrid dataGrid = getDataByProcess(executionId,null); |
| | | //先获取一下 |
| | | UserEntityInfo userEntityInfo = WebUtil.getUserEntityInfo("流程"); |
| | | String resetStatus = null; |
| | | // try{ |
| | | // resetStatus = getWorkService().getProcessVariable(executionId, WFVariablesKeyConstant.RESET_STATUS, userEntityInfo); |
| | | // }catch (Throwable e){ |
| | | // logger.error("获取流程的变量出错",e); |
| | | // } |
| | | // getWorkService().endProcessInstanceByplatform(executionId,userEntityInfo); |
| | | try{ |
| | | resetStatus = getWorkService().getProcessVariable(executionId, WFVariablesKeyConstant.RESET_STATUS, userEntityInfo); |
| | | }catch (Throwable e){ |
| | | logger.error("获取流程的变量出错",e); |
| | | } |
| | | getWorkService().endProcessInstanceByplatform(executionId,userEntityInfo); |
| | | //平台没有自动将业务数据恢复到之前的状态 |
| | | if(StringUtils.isNotBlank(resetStatus)){ |
| | | resetLcStatusForBusinessData(dataGrid.getData(),resetStatus); |
| | | } |
| | | // } catch (VCIError vciError) { |
| | | // throw WebUtil.getVciBaseException(vciError); |
| | | // } |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | | |
| | | private void resetLcStatusForBusinessData(List<Map> bussinesDataList,String resetStatus) throws VciBaseException{ |
| | |
| | | @Override |
| | | public byte[] getProcessXmlContent(String jbpmDeploymentId) throws VciBaseException { |
| | | WebUtil.alertNotNull("流程执行主键信息",jbpmDeploymentId); |
| | | // try { |
| | | // return getWorkService().getProcessResource(jbpmDeploymentId,".xml"); |
| | | // } catch (VCIError e) { |
| | | // throw WebUtil.getVciBaseException(e); |
| | | // } |
| | | return null; |
| | | try { |
| | | return getWorkService().getProcessResource(jbpmDeploymentId,".xml"); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | } |
| | | |
| | | /** |