当前位置: 首页 > wzjs >正文

集约化网站建设整合网络营销

集约化网站建设,整合网络营销,如何在网站做直播间,查询一个网站是用什么系统做的Activiti6.0中审批不通过时回退到上一个节点/指定节点 在当前做的这个审批流中,需要增加一个审批不通过时回退节点的功能,因为当前系统需求还没有特别明确这部分,所以我就先写了以下两种回退情况: 1.回退到上一个节点 /*** 撤回…

Activiti6.0中审批不通过时回退到上一个节点/指定节点

在当前做的这个审批流中,需要增加一个审批不通过时回退节点的功能,因为当前系统需求还没有特别明确这部分,所以我就先写了以下两种回退情况:

1.回退到上一个节点

 /*** 撤回到上一个节点* @param processInstanceId* @param nowUserId*/@Override@Transactionalpublic void revoke(String processInstanceId, String nowUserId) {//获取待执行的任务节点Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();if(task == null){// throw new Exception("sorry,the process is not started or has finished, cannot be withdrawn");System.out.println("sorry,the process is not started or has finished, cannot be withdrawn");}//通过processInstanceId查询历史节点List<HistoricTaskInstance> htiList = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstanceId).orderByTaskCreateTime().asc().list();String myTaskId = null;HistoricTaskInstance myTask = null;//找到当前运行的节点HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();ProcInstance procInstance = procInstanceMapper.selectById(processInstance.getBusinessKey()).get(0);SysUser startUser = sysUserService.selectUserById(procInstance.getUserId());List<SysUser> currUsers = findCurrUsers(task, startUser);System.out.println("----------- =-= -------currUser-----------------------"+currUsers.get(0).getUserId());System.out.println("------ =-= ------nowUserId--------------------------"+nowUserId);for (HistoricTaskInstance hti : htiList) {//判断一下当前的用户是否为当前任务的审批负责人 , 感觉后面通过权限赋予也可以不加这个判断//if (currUsers.get(0).getUserId().equals(nowUserId)&& hti.getId().equals(task.getId())) {if ( currUsers.get(0).getUserId().toString().equals(nowUserId)&&hti.getId().equals(task.getId())) {myTaskId = hti.getId();  //当前任务idmyTask = hti;break;}}if (null == myTaskId) {//throw new Exception("该任务非当前用户提交,无法撤回");System.out.println("该任务非当前用户提交,无法撤回~~!!");}String processDefinitionId = myTask.getProcessDefinitionId();//获取流程模型BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);String myActivityId = null;//查询已经完成的流程节点,查询到上一条已完成的节点,则跳出循环List<HistoricActivityInstance> haiList = historyService.createHistoricActivityInstanceQuery().executionId(myTask.getExecutionId()).finished().orderByHistoricActivityInstanceStartTime().desc().list();System.out.println("---------------the latest finished---------------"+haiList.get(0));myActivityId = haiList.get(0).getActivityId();
//        for (HistoricActivityInstance hai : haiList) {
//            if (myTaskId.equals(hai.getTaskId())) {
//                myActivityId = hai.getActivityId();
//                break;
//            }
//        }//最近一个已完成节点的 FlowNodeFlowNode myFlowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(myActivityId);//原本的活动方向Execution execution = runtimeService.createExecutionQuery().executionId(task.getExecutionId()).singleResult();String activityId = execution.getActivityId();FlowNode flowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(activityId);//记录原活动方向List<SequenceFlow> oriSequenceFlows = new ArrayList<SequenceFlow>();oriSequenceFlows.addAll(flowNode.getOutgoingFlows());//清理活动方向flowNode.getOutgoingFlows().clear();//建立新方向List<SequenceFlow> newSequenceFlowList = new ArrayList<SequenceFlow>();SequenceFlow newSequenceFlow = new SequenceFlow();newSequenceFlow.setId("newSequenceFlowId"+" WITHDRAW: "+nowtime());//新方向的源头---当前节点newSequenceFlow.setSourceFlowElement(flowNode);//新方向的目标---上一个已完成节点newSequenceFlow.setTargetFlowElement(myFlowNode);newSequenceFlowList.add(newSequenceFlow);flowNode.setOutgoingFlows(newSequenceFlowList);Authentication.setAuthenticatedUserId(nowUserId);taskService.addComment(task.getId(), task.getProcessInstanceId(), "撤回");//完成任务taskService.complete(task.getId());//恢复原方向flowNode.setOutgoingFlows(oriSequenceFlows);System.out.println("------------------withdraw successfully!!----------------------------");logger.info("退回成功!");}

2.回退到当前审批用户指定的节点
先查询一下当前流程实例的历史Activity表:

 /*** 展示历史Activity表* @param proInstanceId* @return*/@Override@Transactionalpublic List hisActInst(String proInstanceId){HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(proInstanceId).singleResult();String processInstanceId = instance.getId();//获取待执行的任务节点Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();if(task == null){// throw new Exception("sorry,the process is not started or has finished, cannot be withdrawn");System.out.println("sorry,the process is not started or has finished, cannot be withdrawn");}//通过processInstanceId查询历史节点List<HistoricTaskInstance> htiList = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstanceId).orderByTaskCreateTime().asc().list();String myTaskId = null;HistoricTaskInstance myTask = null;//找到当前运行的节点HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();ProcInstance procInstance = procInstanceMapper.selectById(processInstance.getBusinessKey()).get(0);SysUser startUser = sysUserService.selectUserById(procInstance.getUserId());List<SysUser> currUsers = findCurrUsers(task, startUser);for (HistoricTaskInstance hti : htiList) {//判断一下当前的用户是否为当前任务的审批负责人 , 感觉后面通过权限赋予也可以不加这个判断//if (currUsers.get(0).getUserId().equals(nowUserId)&& hti.getId().equals(task.getId())) {if ( hti.getId().equals(task.getId())) {myTaskId = hti.getId();  //当前任务idmyTask = hti;break;}}if (null == myTaskId) {//throw new Exception("该任务非当前用户提交,无法撤回");System.out.println("该任务非当前用户提交,无法撤回~~!!");}List<HistoricActivityInstance> haiList = historyService.createHistoricActivityInstanceQuery().executionId(myTask.getExecutionId()).finished().orderByHistoricActivityInstanceStartTime().desc().list();return haiList;}

在根据获取到的目标回退节点的ActivityId进行回退操作:

/*** 回退到指定节点处* @param processInstanceId* @param nowUserId* @param tarActivityId* @return*/@Override@Transactionalpublic void rollBackToSpec(String processInstanceId, String nowUserId, String tarActivityId) {//获取待执行的任务节点Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();if(task == null){// throw new Exception("sorry,the process is not started or has finished, cannot be withdrawn");System.out.println("sorry,the process is not started or has finished, cannot be withdrawn");}//通过processInstanceId查询历史节点List<HistoricTaskInstance> htiList = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstanceId).orderByTaskCreateTime().asc().list();String myTaskId = null;HistoricTaskInstance myTask = null;//找到当前运行的节点HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();ProcInstance procInstance = procInstanceMapper.selectById(processInstance.getBusinessKey()).get(0);SysUser startUser = sysUserService.selectUserById(procInstance.getUserId());List<SysUser> currUsers = findCurrUsers(task, startUser);System.out.println("----------- =-= -------currUser-----------------------"+currUsers.get(0).getUserId());System.out.println("------ =-= ------nowUserId--------------------------"+nowUserId);for (HistoricTaskInstance hti : htiList) {//判断一下当前的用户是否为当前任务的审批负责人 , 感觉后面通过权限赋予也可以不加这个判断//if (currUsers.get(0).getUserId().equals(nowUserId)&& hti.getId().equals(task.getId())) {if ( currUsers.get(0).getUserId().toString().equals(nowUserId)&&hti.getId().equals(task.getId())) {myTaskId = hti.getId();  //当前任务idmyTask = hti;break;}}if (null == myTaskId) {//throw new Exception("该任务非当前用户提交,无法撤回");System.out.println("该任务非当前用户提交,无法撤回~~!!");}String processDefinitionId = myTask.getProcessDefinitionId();//获取流程模型BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
//        String myActivityId = null;//查询已经完成的流程节点,查询到上一条已完成的节点,则跳出循环
//        List<HistoricActivityInstance> haiList = historyService.createHistoricActivityInstanceQuery()
//                .executionId(myTask.getExecutionId())
//                .finished()
//                .orderByHistoricActivityInstanceStartTime()
//                .desc()
//                .list();
//        System.out.println("---------------the latest finished---------------"+haiList.get(0));
//        myActivityId = haiList.get(0).getActivityId();//想要回退到的节点位置System.out.println(tarActivityId);FlowNode myFlowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(tarActivityId);//原本的活动方向Execution execution = runtimeService.createExecutionQuery().executionId(task.getExecutionId()).singleResult();String activityId = execution.getActivityId();FlowNode flowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(activityId);//记录原活动方向List<SequenceFlow> oriSequenceFlows = new ArrayList<SequenceFlow>();oriSequenceFlows.addAll(flowNode.getOutgoingFlows());//清理活动方向flowNode.getOutgoingFlows().clear();//建立新方向List<SequenceFlow> newSequenceFlowList = new ArrayList<SequenceFlow>();SequenceFlow newSequenceFlow = new SequenceFlow();newSequenceFlow.setId("newSequenceFlowId"+" ROLLBACK: "+nowtime());//新方向的源头---当前节点newSequenceFlow.setSourceFlowElement(flowNode);System.out.println("--------------new flow-----------------"+flowNode);//新方向的目标---要回退的节点System.out.println("--------------target flow-----------------"+myFlowNode);newSequenceFlow.setTargetFlowElement(myFlowNode);newSequenceFlowList.add(newSequenceFlow);flowNode.setOutgoingFlows(newSequenceFlowList);Authentication.setAuthenticatedUserId(nowUserId);taskService.addComment(task.getId(), task.getProcessInstanceId(), "回退");//完成任务System.out.println("========================完成任务====================");taskService.complete(task.getId());//恢复原方向flowNode.setOutgoingFlows(oriSequenceFlows);System.out.println("------------------RollBack successfully!!----------------------------");logger.info("退回成功!");//将退回完成后的当前节点的task返回
//        HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().activityId(tarActivityId).singleResult();
//
//        return historicActivityInstance.getTaskId();}
http://www.dtcms.com/wzjs/133986.html

相关文章:

  • 政府网站建设调查问卷百度移动seo首选帝搜软件
  • 360 网站优化关键词提取工具app
  • 微信公众号小说代理和网站结合怎么做海外市场推广策略
  • 免费网站建设步骤大数据比较好的培训机构
  • 博物馆网站制作谷歌收录查询工具
  • 响应式网站建设的应用场景网站数据
  • 开发一个大型网站需要多少钱好用搜索引擎排名
  • 有什么网站是帮别人做设计的排名优化工具下载
  • 给自己做的网站换首页自媒体平台注册
  • 网站商城是用什么框架做的好f123网站
  • 小程序开发平台哪里做得好seo网站优化软件价格
  • 呼和浩特企业网站排名优化广州市口碑全网推广报价
  • dw做网站实例抖音seo培训
  • 企业名称怎么取名电脑优化用什么软件好
  • 鹤壁专业做网站多少钱奉节县关键词seo排名优化
  • jtbc网站开发教程腾讯朋友圈广告投放价格
  • 网站建设相关资料文件四川网站制作
  • 电商平台建设做网站被逆冬seo课程欺骗了
  • 台州那家网站做的好深圳网站制作
  • 企业官网用什么cms系统关键词优化一年多少钱
  • 有关网站建设的参考文献搜索优化指的是什么
  • 网站建设人才便民信息微信平台推广
  • 做本地网站需要什么资质推广文案怎么写
  • 有没有免费的商城小程序哈尔滨网络优化公司有哪些
  • 天猫网站设计分析做网站哪个平台好
  • 易企秀h5制作教程推推蛙贴吧优化
  • 2007年怎么做网站南京seo整站优化技术
  • 做淘宝优惠券网站要多少钱深圳网站优化平台
  • 百度新闻网站模板百度搜索推广技巧
  • 湘潭网站建设导航网站怎么推广