Giter Site home page Giter Site logo

activiti-workflow's Introduction

流程引擎

项目还在逐步完善中,感兴趣的伙伴欢迎来纠错。

项目介绍

activiti 6.0.0 提供接口的基础上进行封装和扩展,支持通用审批流。项目可直接投入使用。

提供的功能有:

  • 流程发起
  • 流程实例查询
  • 流程审批
  • 流程驳回
  • 流程撤回
  • 流程终止
  • 列表查询支持分页

自定义BPMN标签:参考博客activiti自定义标签

流程驳回:参考博客activiti流程驳回

驳回过程

自定义完成的方法,完成时不执行流程事件,使用于流程驳回,撤销操作,参考CustomTaskCompleteCmd类。

扩展支持节点抄送,通过重写UserTaskActivityBehavior的handleAssignments将抄送用户存入数据库。具体修改代码位于com.gogoing.workflow.bpmn

protected void handleAssignments(TaskEntityManager taskEntityManager, String assignee, String owner, List<String> candidateUsers,
                                   List<String> candidateGroups,List<String> candidateNotifyUsers, TaskEntity task, ExpressionManager expressionManager, DelegateExecution execution) {

    //省略部门代码
    //保存抄送用户
    if (candidateNotifyUsers != null && !candidateNotifyUsers.isEmpty()) {
      for (String notify : candidateNotifyUsers) {
        Expression userIdExpr = expressionManager.createExpression(notify);
        Object value = userIdExpr.getValue(execution);
        if (value instanceof String) {
          List<String> userIds = extractCandidates((String) value);
          for (String userId : userIds) {
            Context.getCommandContext().getIdentityLinkEntityManager().addUserIdentityLink(task, userId, NOTIFY);
          }
        } else if (value instanceof Collection) {
          Iterator userIdSet = ((Collection) value).iterator();
          while (userIdSet.hasNext()) {
            Context.getCommandContext().getIdentityLinkEntityManager().addUserIdentityLink(task, (String)userIdSet.next(), NOTIFY);
          }
          throw new ActivitiException("Expression did not resolve to a string or collection of strings");
        }
      }
    }

  }

查询待审批任务同时返回的抄送的任务,参考ProcessTaskService#queryUnFinishTask

封装列表查询工具类PageUtil,可直接使用。

通过swagger进行接口管理,项目启动后,通过访问:http://ip:8888/swagger-ui.html

配置文件说明

#用到了liquibse来初始化数据库
spring.liquibase.enabled = false 
#true数据库没有表时会自动建表
spring.activiti.database-schema-update = true
#是否校验流程文件,默认校验resources下的processes文件夹里的流程文件
spring.activiti.check-process-definitions = false
#自定义流程文件位置
spring.activiti.process-definition-location-prefix = /processes/
#打印流程引擎数据库日志
logging.level.org.activiti.engine.impl.persistence.entity = trace
#是否开发定时任务
spring.activiti.async-executor-activate = true

activiti-workflow's People

Contributors

heartlhj avatar dependabot[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.