Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to upgrade and transform OA system by Springboot+Flowable

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail how to upgrade and transform the OA system in Springboot+Flowable. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

The company's internal OA system is going to be upgraded recently, so I was seconded due to lack of manpower, but to tell you the truth, I haven't done this function yet. When I first came into contact with the development of workflow, I was a little curious about what kind of process it was.

The project mainly uses Springboot + Flowable to reconstruct the original workflow. Flowable is a lightweight workflow engine written in Java language, which is relatively simple and efficient to start with. Learn this framework together.

Official address: https://www.flowable.org/docs/userguide/index.html, sharing is only a simple application, in-depth research still needs to see the official documentation.

Flowable core relies on org.flowable flowable-spring-boot-starter 6.3.0 org.springframework.boot spring-boot-starter-jdbc org.springframework.boot spring-boot-starter-web org.mybatis.spring.boot mybatis-spring-boot-starter 1.3.2 mysql mysql-connector-java runtime process design

The core of workflow development is the design of task flow. Flowable officially recommends that the XML of BPMN2.0, the industry standard, be used to describe the workflow that needs to be defined.

We need to create a processes path in the resource directory to store the relevant XML process configuration files. The Flowable framework loads the workflow files in this directory by default, parses the XML, and persists the parsed process configuration information to the database.

Flowable depends on the database, but it does not require us to create tables manually, but automatically creates a series of tables to MySQL when the program starts for the first time.

Spring: datasource: url: jdbc:mysql://47.93.6.5:3306/order?serverTimezone=UTC username: root password: 123455

Seeing that a total of 60 tables have been generated successfully, and the number is still relatively large, it is recommended to use a special database to exist these workflow tables.

Take Chestnut: if a leave process needs to be reviewed and approved by the manager, the leave will not take effect until he rejects the end of the process.

Next, we use XML to translate the above leave flow chart, the whole is very simple as long as it is careful enough, let's see what each label means.

In fact, the various line logic of the flowchart is depicted with different XML tags.

Represents a complete workflow

Description of workflow

Starting position in workflow (start)

End position in workflow (end)

Represents a task audit node (team leader, manager, etc.)

Logical judgment node, which is equivalent to the diamond box in the flowchart

The line that links each node, the sourceRef attribute represents the start node of the line, and the targetRef attribute represents the node that the line points to.

Does this big pile of XML above look super troublesome? I wish there were automatic generation tools. I found that IDEA comes with its own design tools, but it is too difficult to use.

As a programmer for Baidu programming, the ability to find answers on the Internet is still OK. Since I find it troublesome to write XML, I must have thought of it. I may have a ready-made tool to visit the official website https://www.flowable.org/downloads.html, but I really found it.

Github download address: https://github.com/flowable/flowable-engine/releases/download/flowable-6.4.0/flowable-6.4.0.zip, download speed that is quite touching, and this tool needs to be installed by yourself.

Also found an online editing tool: http://www.learun.cn:8090/home_online.htm, all kinds of twists and turns, after the design process, directly copy the automatically generated code.

Process approval

After the process design, all that is left is the approval of the workflow and the generation of the flow chart.

First, start a process of asking for leave, with the employee's ID staffId as the unique identity. The variable leaveTask,Flowable will be received in the XML file. The database will be persisted internally, and a process Id processId will be returned, which can be used to query the overall situation of the workflow. The task Id task is the employee's specific leave task.

Note: a leave process processId can contain multiple leave tasks taskId.

/ * @ author xiaofu * @ description launch process * @ date 17:36 on 2020-8-26 * / @ RequestMapping (value = "startLeaveProcess") @ ResponseBody public String startLeaveProcess (String staffId) {HashMap map = new HashMap (); map.put ("leaveTask", staffId); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey ("Leave", map); StringBuilder sb = new StringBuilder () Sb.append ("create leave process processId:" + processInstance.getId ()); List tasks = taskService.createTaskQuery (). TaskAssignee (staffId). OrderByTaskCreateTime (). Desc (). List (); for (Task task: tasks) {sb.append ("task taskId:" + task.getId ());} return sb.toString ();}

Take a look at the current flowchart with the processId returned when you start the process

Http://localhost:4000/leave/createProcessDiagramPic?processId=37513

Next, reject the request for leave, input the corresponding taskId, and then perform the rejection, and then see the effect of the entire workflow.

Http://localhost:4000/leave/rejectTask?taskId=10086 / * * @ param taskId * @ author xinzhifu * @ description rejected * @ date 14:30 on 2020-8-27 * / @ ResponseBody @ RequestMapping (value = "rejectTask") public String rejectTask (String taskId) {HashMap map = new HashMap (); map.put ("checkResult", "rejected"); taskService.complete (taskId, map) Return "Application for Review and rejection ~";}

I saw that the whole leave process was successfully blocked by the manager's review.

Http://localhost:4000/leave/createProcessDiagramPic?processId=37513

Summary

Development workflow is generally used in OA systems and other traditional projects, I also try to do this kind of function for the first time, the harvest is still quite a lot, and the technology stack is pressed into a knowledge point.

About Springboot+Flowable how to upgrade and transform the OA system to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report