If you don’t plan to use a mature workflow engine, I think you can think about it this way: separate the process nodes from the status, you can create a process table and define the key process stages as records, including the previous step of the process, status, next step. Use this table to identify the flow of this workflow. This will also have better scalability.
The questioner said that it is difficult to expand, does it mean that there are too many states, and the transition between states is network-like, causing the code to modify the state to be spread throughout the entire program, so the direct result is: no one can sort it out in the end The relationship between transitions between states, modifying the logic of a state, and the changes are spread throughout the entire program, resulting in great risks. So I think if the transition between states is very complex, it can be solved through a state machine, the transition relationship between states can be solved through configuration, and the transition relationship between states can be integrated into the state machine model. For details, you can refer to a state machine model I abstracted before: state machine
Use bpm to solve it
If you don’t plan to use a mature workflow engine, I think you can think about it this way: separate the process nodes from the status, you can create a process table and define the key process stages as records, including the previous step of the process, status, next step. Use this table to identify the flow of this workflow. This will also have better scalability.
The questioner said that it is difficult to expand, does it mean that there are too many states, and the transition between states is network-like, causing the code to modify the state to be spread throughout the entire program, so the direct result is: no one can sort it out in the end The relationship between transitions between states, modifying the logic of a state, and the changes are spread throughout the entire program, resulting in great risks.
So I think if the transition between states is very complex, it can be solved through a state machine, the transition relationship between states can be solved through configuration, and the transition relationship between states can be integrated into the state machine model.
For details, you can refer to a state machine model I abstracted before: state machine