springboot2.5.2与 flowable6.6.0整合流程引擎应用分析

1.pom

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.2</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <flowable.version>6.6.0</flowable.version>
    </properties>

         <!--flowable工作流依赖-->
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-spring-boot-starter</artifactId>
            <version>${flowable.version}</version>
        </dependency>
         <!-- https://mvnrepository.com/artifact/org.flowable/flowable-json-converter -->
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-json-converter</artifactId>
            <version>${flowable.version}</version>
        </dependency>
        <!-- app 依赖 包含 rest,logic,conf -->
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-ui-modeler-rest</artifactId>
            <version>${flowable.version}</version>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-ui-modeler-logic</artifactId>
            <version>${flowable.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-slf4j-impl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-ui-modeler-conf</artifactId>
            <version>${flowable.version}</version>
        </dependency>

2.FlowableConfig配置类

package org.fh.config;

import org.flowable.spring.SpringProcessEngineConfiguration;
import org.flowable.spring.boot.EngineConfigurationConfigurer;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;

/**
 * 说明:Flowable配置
 * 作者:FH Admin
 * from:fhadmin.cn
 */
@Controller
@Configuration
public class FlowableConfig implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> {

    @Override
    public void configure(SpringProcessEngineConfiguration engineConfiguration) {
        engineConfiguration.setActivityFontName("宋体");
        engineConfiguration.setLabelFontName("宋体");
        engineConfiguration.setAnnotationFontName("宋体");
    }

}
3.重写 SecurityUtils 重构流程编辑器获取用户信息

package org.flowable.ui.common.security;

import org.fh.util.Jurisdiction;
import org.flowable.common.engine.api.FlowableIllegalStateException;
import org.flowable.idm.api.User;
import org.flowable.ui.common.model.RemoteUser;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;

import java.util.ArrayList;
import java.util.List;

/**
 * 说明:重构流程编辑器获取用户信息
 * 作者:FH Admin
 * from:fhadmin.cn
 */
public class SecurityUtils {

    private static User assumeUser;

    private static SecurityScopeProvider securityScopeProvider = new FlowableSecurityScopeProvider();

    private SecurityUtils() {
    }

    /**
     * Get the login of the current user.
     */
    public static String getCurrentUserId() {
        User user = getCurrentUserObject();
        if (user != null) {
            return user.getId();
        }
        return null;
    }

    /**
     * @return the {@link User} object associated with the current logged in user.
     */
    public static User getCurrentUserObject() {
        if (assumeUser != null) {
            return assumeUser;
        }

        RemoteUser user = new RemoteUser();
        user.setId(Jurisdiction.getUsername());
        user.setDisplayName(Jurisdiction.getName());
        user.setFirstName(Jurisdiction.getName());
        user.setLastName(Jurisdiction.getName());
        user.setEmail("admin@flowable.com");
        user.setPassword("123456");
        List<String> pris = new ArrayList<>();
        pris.add(DefaultPrivileges.ACCESS_MODELER);
        pris.add(DefaultPrivileges.ACCESS_IDM);
        pris.add(DefaultPrivileges.ACCESS_ADMIN);
        pris.add(DefaultPrivileges.ACCESS_TASK);
        pris.add(DefaultPrivileges.ACCESS_REST_API);
        user.setPrivileges(pris);
        return user;
    }

    public static void setSecurityScopeProvider(SecurityScopeProvider securityScopeProvider) {
        SecurityUtils.securityScopeProvider = securityScopeProvider;
    }

    public static SecurityScope getCurrentSecurityScope() {
        SecurityContext securityContext = SecurityContextHolder.getContext();
        if (securityContext != null && securityContext.getAuthentication() != null) {
            return getSecurityScope(securityContext.getAuthentication());
        }
        return null;
    }

    public static SecurityScope getSecurityScope(Authentication authentication) {
        return securityScopeProvider.getSecurityScope(authentication);
    }

    public static SecurityScope getAuthenticatedSecurityScope() {
        SecurityScope currentSecurityScope = getCurrentSecurityScope();
        if (currentSecurityScope != null) {
            return currentSecurityScope;
        }
        throw new FlowableIllegalStateException("User is not authenticated");
    }

    public static void assumeUser(User user) {
        assumeUser = user;
    }

    public static void clearAssumeUser() {
        assumeUser = null;
    }
}

工作流模块----------------www.fhadmin.cn---------------

1.模型管理:web在线流程设计器、导入导出xml、复制流程、部署流程

2.流程管理:导入导出流程资源文件、查看流程图、根据流程实例反射出流程模型、激活挂起

3.运行中流程:查看流程信息、当前任务节点、当前流程图、作废暂停流程、指派待办人、自由跳转

4.历史的流程:查看流程信息、流程用时、流程状态、查看任务发起人信息

5.待办任务:查看本人个人任务以及本角色下的任务、办理、驳回、作废、指派一下代理人

6.已办任务:查看自己办理过的任务以及流程信息、流程图、流程状态(作废 驳回 正常完成)

办理任务时候可以选择用户进行抄送,就是给被抄送人发送站内信通知当前审批意见以及备注信息

注:当办理完当前任务时,下一任务待办人会即时通讯收到新任务消息提醒,当作废和完结任务时,任务发起人会收到站内信消息通知

到此这篇关于springboot2.5.2与 flowable6.6.0整合流程引擎应用分析的文章就介绍到这了,更多相关springboot整合 flowable内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!

(0)

相关推荐

  • SpringBoot2整合Drools规则引擎及案例详解

    一.Drools引擎简介 1.基础简介 Drools是一个基于java的规则引擎,开源的,可以将复杂多变的规则从硬编码中解放出来,以规则脚本的形式存放在文件中,使得规则的变更不需要修正代码重启机器就可以立即在线上环境生效.具有易于访问企业策略.易于调整以及易于管理的特点,作为开源业务规则引擎,符合业内标准,速度快.效率高. 2.规则语法 (1).演示drl文件格式 package droolRule ; import org.slf4j.Logger import org.slf4j.Logge

  • 详解Elastic Search搜索引擎在SpringBoot中的实践

    实验环境 ES版本:5.3.0 spring bt版本:1.5.9 首先当然需要安装好elastic search环境,最好再安装上可视化插件 elasticsearch-head来便于我们直观地查看数据. 当然这部分可以参考本人的帖子: <centos7上elastic search安装填坑记> 我的ES安装在http://113.209.119.170:9200/这个地址(该地址需要配到springboot项目中去) Spring工程创建 这部分没有特殊要交代的,但有几个注意点一定要当心

  • 详解SpringBoot+Thymeleaf 基于HTML5的现代模板引擎

    序言: Thymeleaf 是Java服务端的模板引擎,与传统的JSP不同,前者可以使用浏览器直接打开,因为可以忽略掉拓展属性,相当于打开原生页面,给前端人员也带来一定的便利.如果你已经厌倦了JSP+JSTL的组合,Thymeleaf或许是个不错的选择!本工程传送门:SpringBoot-Web-Thymeleaf 开始使用 1.引入依赖 SpringBoot默认提供了Thymeleaf的Starter,只需简单引入依赖即可. <dependency> <groupId>org.s

  • springboot2.5.2与 flowable6.6.0整合流程引擎应用分析

    1.pom <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.5.2</version> <relativePath /> <!-- lookup parent from repository --> </pare

  • SpringBoot2.0 整合 SpringSecurity 框架实现用户权限安全管理方法

    一.Security简介 1.基础概念 Spring Security是一个能够为基于Spring的企业应用系统提供声明式的安全访问控制解决方案的安全框架.它提供了一组可以在Spring应用上下文中配置的Bean,充分利用了Spring的IOC,DI,AOP(面向切面编程)功能,为应用系统提供声明式的安全访问控制功能,减少了为安全控制编写大量重复代码的工作. 2.核心API解读 1).SecurityContextHolder 最基本的对象,保存着当前会话用户认证,权限,鉴权等核心数据.Secu

  • SpringBoot2.0 整合 Dubbo框架实现RPC服务远程调用方法

    一.Dubbo框架简介 1.框架依赖 图例说明: 1)图中小方块 Protocol, Cluster, Proxy, Service, Container, Registry, Monitor 代表层或模块,蓝色的表示与业务有交互,绿色的表示只对 Dubbo 内部交互. 2)图中背景方块 Consumer, Provider, Registry, Monitor 代表部署逻辑拓扑节点. 3)图中蓝色虚线为初始化时调用,红色虚线为运行时异步调用,红色实线为运行时同步调用. 4)图中只包含 RPC

  • SpringBoot2.0整合WebSocket代码实例

    这篇文章主要介绍了SpringBoot2.0整合WebSocket代码实例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 之前公司的某个系统为了实现推送技术,所用的技术都是Ajax轮询,这种方式浏览器需要不断的向服务器发出请求,显然这样会浪费很多的带宽等资源,所以研究了下WebSocket,本文将详细介绍下. 一.什么是WebSocket? WebSocket是HTML5开始提供的一种在单个TCP连接上进行全双工通讯的协议,能更好的节省服务器资

  • SpringBoot2.0整合tk.mybatis异常解决

    pom配置如下(标准简易版): <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.4.RELEASE</version> </parent> <properties> <java.version>1.8&

  • springboot2.0整合logback日志的详细代码

    一. 近期自己的项目想要一个记录日志的功能,而springboot本身就内置了日志功能,然而想要输入想要的日志,并且输出到磁盘,然后按天归档,或者日志的切分什么的,自带的日志仅仅具有简单的功能,百度了一番,总结如下,适合大多数的应用场景 二. springboot的pom文件都会引一个parent <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-star

  • SpringBoot2.0整合SpringCloud Finchley @hystrixcommand注解找不到解决方案

    hystrix参数使用方法 通过注解@HystrixCommand的commandProperties去配置, 如下就是hystrix命令超时时间命令执行超时时间,为1000ms和执行是不启用超时 @RestController public class MovieController { @Autowired private RestTemplate restTemplate; @GetMapping("/movie/{id}") @HystrixCommand(commandPro

  • springboot2.x只需两步快速整合log4j2的方法

    前言 本文详细介绍如何使用spring-boot2.x快速整合log4j2日志框架. spring-boot2.x使用logback作为默认日志处理库,因此我们除了要引用log4j2之外,还要去除logback的依赖 1.依赖库 maven方式: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-log4j2</artifac

  • IIS6.0+Tomcat7.0整合总结(推荐)

    (一)   为什么要把IIS.Tomcat整合到一起? 假如你遇到这种情况,你开发了一个javaweb项目要部署到服务器上,但是这个服务器上已经部署了asp.asp.net或者PHP项目都在IIS环境下运行着,这时你的tomcat就不能再用80这个端口了,这时你就必须考虑整合iis与tomcat一起工作.网上收集了很多关于tomcat与iis整合的文章,多数写的含糊不清,疏忽每一个细节都很难整合成功,经过分析实践,我决定花费一点时间把这个总结分享出来,希望对用的到的朋友能有所帮助. (二)  

  • SpringBoot 2.0 整合sharding-jdbc中间件实现数据分库分表

    一.水平分割 1.水平分库 1).概念:  以字段为依据,按照一定策略,将一个库中的数据拆分到多个库中. 2).结果  每个库的结构都一样:数据都不一样:  所有库的并集是全量数据: 2.水平分表 1).概念  以字段为依据,按照一定策略,将一个表中的数据拆分到多个表中. 2).结果  每个表的结构都一样:数据都不一样:  所有表的并集是全量数据: 二.Shard-jdbc 中间件 1.架构图 2.特点 1).Sharding-JDBC直接封装JDBC API,旧代码迁移成本几乎为零. 2).适

随机推荐