工作流实例

爬虫组件分析

  • 目录
    • 概述
      • 需求:
    • 设计思路
    • 实现思路分析
      • 1.code
  • 参考资料和推荐阅读

Survive by day and develop by night.
talk for import biz , show your perfect code,full busy,skip hardness,make a better result,wait for change,challenge Survive.
happy for hardess to solve denpendies.

目录

在这里插入图片描述

概述

请假审核

需求:

设计思路

工作流实例_第1张图片

实现思路分析

1.code

  @Test
    public void queryTask(){
        //获取任务服务对象
        TaskService taskService = processEngine.getTaskService();
        RepositoryService repositoryService = processEngine.getRepositoryService();



        //根据流程实例 ID 获取当前活动任务
        Task  task = taskService.createTaskQuery().processInstanceId(pi.getId()).active().singleResult();
        String taskId = task.getId();
        System.out.println("任务ID"+taskId);


        //启动流程
        //完成请假申请任务
        Map<String, Object> variables = new HashMap<String, Object>();
        variables.put("appUser", "1");
        taskService.complete(taskId, variables);





        //根据接受人获取该用户的任务
      /*  List tasks = taskService.createTaskQuery()
                .taskAssignee("001508")
                .list();
        for (Task task : tasks) {
            System.out.println("ID:"+task.getId()+",姓名:"+task.getName()+",接收人:"+task.getAssignee()+",开始时间:"+task.getCreateTime());
        }
*/
        RuntimeService runtimeService=processEngine.getRuntimeService();
//获取下一步节点的任务
        ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(task.getProcessDefinitionId());
        List<ActivityImpl> activitiList = def.getActivities(); // rs是指RepositoryService的实例
        String excId = task.getExecutionId();


        ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(excId).singleResult();
        String activitiId = execution.getActivityId();

        Task  task2 = taskService.createTaskQuery().processInstanceId(pi.getId()).active().singleResult();
        Map<String, Object> variables2 = new HashMap<String, Object>();
        variables2.put("appUser", "1");
        taskService.complete(task2.getId(), variables2);




//        for(ActivityImpl activityImpl:activitiList){
//            String id = activityImpl.getId();
//            if(activitiId.equals(id)){
//                System.out.println("当前任务:"+activityImpl.getId() ); //输出某个节点的某种属性
//
//
//                List outTransitions = activityImpl.getOutgoingTransitions();//获取从某个节点出来的所有线路
//                for(PvmTransition tr:outTransitions){
//                    PvmActivity ac = tr.getDestination(); //获取线路的终点节点
//                    System.out.println("下一步任务任务:"+ac.getProperty("name"));
//
//                }
//                break;
//            }
//        }



    }



参考资料和推荐阅读

  1. 暂无

欢迎阅读,各位老铁,如果对你有帮助,点个赞加个关注呗!~

你可能感兴趣的:(【工作流】,java,开发语言)