One 、 Traditional workflow completion method
Before there was no dedicated workflow engine , We used to implement process control , The usual practice is to use the value of the status field to track the changes in the process . So users without roles , The value of the status field determines whether the record is displayed or not . For example, the employee leave application process ：
Employee application --- division manager --- The general manager --- Personnel filing
For records that have permission to view , The current user decides whether the approval is qualified according to his / her role . If qualified, set the status field to a value , To represent qualified ; Of course, if it is unqualified, you need to set a value to represent the unqualified situation .
This is the most primitive way . Although the process control is achieved through the status field , But when our process changes , The code written in this way should also be adjusted . So is there a professional way to achieve workflow management ？ And it can be done After business process changes , Our program doesn't have to change , If you can achieve this effect , Then the adaptability of our business system has been greatly improved .
Two 、Activiti technological process
Why? Activiti When the business requirements change , The source code doesn't need to be updated , Updated is the business flow chart , What is the principle ？
How can we do this when the business process changes , Our business system code can not change ？ Now let's analyze the principle .
The detailed analysis process is shown in the figure below ：
Activiti Internal core mechanism and implementation schematic diagram
principle ： Information transformation between nodes and tables , That's the point . Read out the node information and store it in the table , In the future when dealing with , Reading records from a table , Delete the record after processing , It means that the process is finished , And then the next node .