jeecg + activiti 流程设计器_anysun7的博客-程序员秘密_jeecg流程设计

技术标签: 工作流  可视化  activiti  流程设计器  jeecg  

jeecg 3.4.3 + activiti 5.18.0


activiti 流程设计器 示例 源码

https://download.csdn.net/download/anysun7/10354206


项目pom文件添加activiti依赖:

<dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-engine</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-spring</artifactId>

            <version>${activiti.version}</version>

            <exclusions>

                <exclusion>

                    <artifactId>commons-dbcp</artifactId>

                    <groupId>commons-dbcp</groupId>

                </exclusion>

            </exclusions>

        </dependency>

 

        <dependency>

            <groupId>commons-dbcp</groupId>

            <artifactId>commons-dbcp</artifactId>

            <version>1.4</version>

        </dependency>

 

        <dependency>

            <groupId>org.mybatis</groupId>

            <artifactId>mybatis</artifactId>

            <version>3.2.5</version>

        </dependency>

 

        <!--<dependency>

            <groupId>javax.activation</groupId>

            <artifactId>activation</artifactId>

            <version>1.1</version>

        </dependency>-->

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-bpmn-model</artifactId>

            <version>${activiti.version}</version>

        </dependency>

        <dependency>

           <groupId>org.activiti</groupId>

           <artifactId>activiti-bpmn-converter</artifactId>

           <version>${activiti.version}</version>

       </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-bpmn-layout</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-common-rest</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-crystalball</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-diagram-rest</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-explorer</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-image-generator</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-json-converter</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-modeler</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-simple-workflow</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.vaadin.addons</groupId>

            <artifactId>dcharts-widget</artifactId>

            <version>0.10.0</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-process-validation</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>xmlgraphics-commons</artifactId>

            <version>1.2</version>

        </dependency>

 

        <dependency>

            <groupId>com.vaadin</groupId>

            <artifactId>vaadin</artifactId>

            <version>6.8.8</version>

        </dependency>

 

        <dependency>

            <groupId>org.imgscalr</groupId>

            <artifactId>imgscalr-lib</artifactId>

            <version>4.2</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.geronimo.specs</groupId>

            <artifactId>geronimo-servlet_3.0_spec</artifactId>

            <version>1.0</version>

            <scope>provided</scope>

        </dependency>

 

        <!--<dependency>

            <groupId>javax</groupId>

            <artifactId>javaee-api</artifactId>

            <version>7.0</version>

        </dependency>-->

 

        <dependency>

            <groupId>joda-time</groupId>

            <artifactId>joda-time</artifactId>

            <version>2.1</version>

        </dependency>

 

        <!--Batik的包主要是用来解析html中的svg的内容-->

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-transcoder</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-dom</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-bridge</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-css</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-anim</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-codec</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-ext</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-gvt</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-script</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-js</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-parser</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-svg-dom</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-svggen</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-util</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-xml</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-js</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>xml-apis</groupId>

            <artifactId>xml-apis-ext</artifactId>

            <version>1.3.04</version>

        </dependency>

 

        <dependency>

            <groupId>xml-apis</groupId>

            <artifactId>xml-apis</artifactId>

            <version>1.3.04</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>xmlgraphics-commons</artifactId>

            <version>1.2</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-awt-util</artifactId>

            <version>1.7</version>

        </dependency>

 

配置spring-activiti.xml文件

src/main/resources目录下新建spring-activiti.xml文件,向其中加入以下内容

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">

        <property name="dataSource" ref="dataSource" />

        <property name="transactionManager" ref="transactionManager" />

        <property name="databaseSchemaUpdate" value="true" />

        <property name="jobExecutorActivate" value="false" />

    </bean>

    <bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper"/>

    <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">

        <property name="processEngineConfiguration" ref="processEngineConfiguration" />

    </bean>

    <bean id="repositoryService" factory-bean="processEngine"

          factory-method="getRepositoryService" />

    <bean id="runtimeService" factory-bean="processEngine"

          factory-method="getRuntimeService" />

    <bean id="taskService" factory-bean="processEngine"

          factory-method="getTaskService" />

    <bean id="historyService" factory-bean="processEngine"

          factory-method="getHistoryService" />

    <bean id="managementService" factory-bean="processEngine"

          factory-method="getManagementService" />

    <bean id="identityService" factory-bean="processEngine"

          factory-method="getIdentityService" />

    <bean id="transactionManager"

          class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

        <property name="dataSource" ref="dataSource" />

    </bean>

</beans>

 

web.xml文件,修改context-param添加了classpath:spring-activiti.xml

 

复制设计器文件

下载activiti-webapp-explorer2的源代码,

1. activiti-explorer工程中的diagram-viewereditor-appmodeler.html复制到工程的src/main/webapp目录下

 

2. activiti-explorer工程中WEB-INF/classes文件下的stencilset.jsonui.propertiesui.properties.alfresco复制到工程的src/main/resources目录下

 

3.modules/目录中找到org\activiti\rest\diagramorg\activiti\rest\editor这两个包,将他们整个复制到工程的src/main/java目录下

 

4.修改spring-mvc.xml文件,在其中加入以下内容,使spring在扫描controller类的时候,也扫描这些包里面的类

 

5.向工程的web.xml文件中添加以下内容,让spring也管理起来带/service/的链接

<!-- activiti -->

    <servlet-mapping>

        <servlet-name>springMvc</servlet-name>

        <url-pattern>/service/*</url-pattern>

    </servlet-mapping>

 

6.打开editor-app/app-cfg.js, 将其中的activiti-explorer”修改为“jeecg”。当然,具体项目中这里可能会经常变化,我们可以写一个js函数来自动获取工程的名字,这样以后将设计器集成到其他工程的时候,就不需要修改这里的内容了

 

7.工程的src\main\java\org\activiti\rest\editor目录下新建一个java文件,命名为ModuleController

package org.activiti.rest.editor;

 

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

 

import org.activiti.editor.constants.ModelDataJsonConstants;

import org.activiti.engine.RepositoryService;

import org.activiti.engine.repository.Model;

import org.apache.commons.lang3.StringUtils;

import org.jeecgframework.core.common.controller.BaseController;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;

 

import com.fasterxml.jackson.databind.ObjectMapper;

import com.fasterxml.jackson.databind.node.ObjectNode;

 

@Controller

@RequestMapping("/model")

public class ModuleController extends BaseController{

private Logger logger = LoggerFactory.getLogger(ModuleController.class);

@Autowired

private RepositoryService repositoryService;

@RequestMapping(params = "create")

  public void create(HttpServletRequest request, HttpServletResponse response) {

    try {

          String name = "test";

          String key = "test";

          String description = "testModel";

 

          ObjectMapper objectMapper = new ObjectMapper();

      ObjectNode editorNode = objectMapper.createObjectNode();

      editorNode.put("id", "canvas");

      editorNode.put("resourceId", "canvas");

      ObjectNode stencilSetNode = objectMapper.createObjectNode();

      stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");

      editorNode.put("stencilset", stencilSetNode);

      Model modelData = repositoryService.newModel();

 

      ObjectNode modelObjectNode = objectMapper.createObjectNode();

      modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, name);

      modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, 1);

      description = StringUtils.defaultString(description);

      modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, description);

      modelData.setMetaInfo(modelObjectNode.toString());

      modelData.setName(name);

      modelData.setKey(StringUtils.defaultString(key));

 

      repositoryService.saveModel(modelData);

      repositoryService.addModelEditorSource(modelData.getId(), editorNode.toString().getBytes("utf-8"));

 

      response.sendRedirect(request.getContextPath() + "/modeler.html?modelId=" + modelData.getId());

    } catch (Exception e) {

      logger.error("创建模型失败:", e);

    }

  }

}

 

8. 访问:http://localhost:8080/jeecg/model.do?create

 

 

注:

新版(3.7.2jeecgresponse的处理,添加了org.jeecgframework.core.aop.Wrapper,导致json数据返回解析出错。整合时,需处理。

Jeecg修改pom内容

Maven版本改为 5.18.0

添加:

<dependency> 

<groupId>com.fasterxml.jackson.core</groupId> 

<artifactId>jackson-databind</artifactId> 

<version>2.2.3</version> 

</dependency>

Springmvc添加 (rest请求数据 /jeecg/service/model/5001/json

<mvc:annotation-driven />


中途bug:

TypeError: Cannot read property 'split' of undefined

    at Object.ORYX.Core.StencilSet.stencilSet (oryx.debug.js:8647)
    at oryx.debug.js:8625
    at prototype-1.5.1.js:446
    at Array._each (prototype-1.5.1.js:672)
    at Array.each (prototype-1.5.1.js:445)
    at Object.ORYX.Core.StencilSet.stencilSets (oryx.debug.js:8624)
    at classDef.getStencilSets (oryx.debug.js:11715)
    at classDef._createCanvas (oryx.debug.js:11201)
    at classDef.construct (oryx.debug.js:10930)
    at new classDef (oryx.debug.js:1747)

解决思路:遇到该错误,主要原因是后台返回json数据时,格式存在问题,请查看response中最终返回到页面之前的数据。查看是否是框架对数据做了处理,寻找相应解决方法。






另转:

activiti-modeler 工作流设计器代码分析

https://blog.csdn.net/fgstudent/article/details/50668086

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/anysun7/article/details/79970420

智能推荐

mmdetection2.6_Windows10版本配置、训练及推理[email protected]会飞的毛毛虫的博客-程序员秘密_mmdetection版本

直接进入正题一.Mmdetection2.6的windows环境安装与测试二.Mmdetection的训练与测试Mmdetection的2.1,2.2,2.3的配置windows都不行,2.6可以很方便的配置。前提:CUDA需求10.1(首先要装CUDA),vs2017整个都要装以及anaconda的环境变量一.Mmdetection2.6的windows环境安装与测试① 安装pytorch及虚拟环境conda create -n mmd26 python=3.7conda activate

jax_ws_带有JAX-RS和PrimeFaces的RESTful图表_cunfen8879的博客-程序员秘密

jax_ws 通常,利用图表提供数据的可视表示很有用。 PrimeFaces提供制图解决方案,使您可以轻松地将数据的可视表示形式添加到Web和移动应用程序中。 如果我们将PrimeFaces图表组件的使用与RESTful Web服务数据结合在一起,我们可以创建自定义图表,以适合台式机和移动设备。 在本文中,我将更新Java EE 7动手练习MoviePlex应用程序,以提供一个仪表板,我们可以...

码率控制_山西茄子的博客-程序员秘密_vbvbuffsize maxrate

x264的码率控制--vbv-bufsize Set size of the VBV buffer (kbit) [0]默认:0说明:设置VBV可用的最大缓冲区,单位是kbits。VBV(Video Buffering Verifier,视频缓存检验器),它作用是处理各帧编码后大小不一和恒定输出码率的矛盾。可以将VBV想象成为一个水池,水池的入口连接着encoder的输出,出口为恒定

网站更换完服务器多久生效,域名DNS切换后多久生效?_知知呼呼的博客-程序员秘密

域名切换DNS服务器时,修改了DNS怎么还不生效呢?一、更换DNS正确步骤 如果是在西部数码注册域名后需要解析,直接进入域名管理就可以。如果域名不在西部数码注册,需要注册账号后购买DNS解析服务,把需要添加的域名加入进来。这样保证需要解析的域名解析记录在dns系统更新,不管域名注册在什么地方,都需要在域名管理的控制面板中把该域名的DNS记录修成西部数码的dns解析服务器地址。二、更换DNS需要留意...

Linux内核获取系统时间_人在旅途~的博客-程序员秘密_linux内核获取系统时间

在Linux内核中,常常使用do_gettimeofday()函数来得到精确的系统运行时间,尤其在嵌入式中非常常见。很多程序运行,不需要获取到年月日等信息,但是需要获取高精度的系统时间,可以使用这个函数。函数功能和C标准库中gettimeofday()用法相同。下面代码拿去使用吧。#include &lt;linux/time.h&gt;unsigned int system...

脉冲星 10 月脉动 | Pulsar 2.5.0 功能预览,Pulsar Meetup 上海站报名中_StreamNative的博客-程序员秘密

????️阅读本文需要 8 分钟&gt; PIP-45 Pluggable metadata interface该方案提供一个统一的可插拔的接口,抽象出 Pulsar 的元数据实现。重构...

随便推点

java eden space_JVM GC调优一则–增大Eden Space提高性能_润姐姐Samantha的博客-程序员秘密

缘起线上有Tomcat升级到7.0.52版,然后有应用的JVM FullGC变频繁,在高峰期socket连接数,Cpu使用率都暴增。思路思路是Tomcat本身的代码应该是没有问题的,有问题的可能是应用代码升级,或者环境改变了,总之Tomcat的优先级排在最后。先把应用的heap dump下来分析下:jmap -dump:format=b,file=path pid用IBM的Heap Analyse...

php训练,GitHub - ChenYikunReal/php-training: “世界上最好的编程语言”PHP入门训练,IDE使用PhpStrom..._sylph mini的博客-程序员秘密

PHP入门训练PHP开发相关软件下载下载官网注意:适用于PHP初学者的学习线路和建议PHP初学者的学习线路:1. 熟悉HTML/CSS/JS等网页基本元素,完成阶段可自行制作简单的网页,对元素属性相对熟悉。2. 理解动态语言的概念和运做机制,熟悉基本的PHP语法。3. 学习如何将PHP与HTML结合起来,完成简单的动态页面。4. 接触学习MySQL,开始设计数据库。5. 不断巩固PHP语法,熟悉大...

springboot2.x中redis配置 @Cacheable注解增加默认过期时间30分钟_会迟到但不会缺席的博客-程序员秘密[email protected]默认过期时间

配置文件# REDIS (RedisProperties)# Redis数据库索引(默认为0)spring.redis.database=16# Redis服务器地址spring.redis.host=127.0.0.1# Redis服务器连接端口spring.redis.port=6379# Redis服务器连接密码(默认为空)spring.redis.password=...

uniapp 自定义基座调试(Android)_一个博客的博客-程序员秘密

1、Android Studio -》src-》main-》assets-》data-》dcloud_control.xml添加 debug=“true” syncDebug=“true”

Contributor等你解锁! | PPSIG报名开始啦~_飞桨PaddlePaddle的博客-程序员秘密

点击左上方蓝字关注我们开源的开放性使得诸多的开发者可以加入其中,自2016年开源以来,飞桨一直致力于建设开源开放的开发者社区,也正是有了众多contributor们的加入,飞桨社区得以不断...

洛谷P1296 奶牛的耳语_水蛙菌的博客-程序员秘密

题目链接题目描述在你的养牛场,所有的奶牛都养在一排呈直线的牛栏中。一共有 nn 头奶牛,其中第 ii 头牛在直线上所处的位置可以用一个整数坐标 pi (0 ≤ pi ≤ 108) 来表示。在无聊的日子里,奶牛们常常在自己的牛栏里与其它奶牛交流一些八卦新闻。每头奶牛发出的声音响度是一样的,而由于声波的能量衰减,某头奶牛发出的声音只能被与它距离不超过 d(0 ≤ d ≤ 104 ) 的奶牛所听到,这样这对奶牛就称为可以相互交流的。现在给出所有奶牛的位置和声音所能传播的最远距离 d ,请你编个程序来计算你的养

推荐文章

热门文章

相关标签