java - 多状态审核业务如何抽象进行开发?是否有一般的处理模型?
大家讲道理
大家讲道理 2017-04-17 18:00:45
0
3
440

现有一个审核业务,需要逐层流转审批;当前的做法是用一张表存储需要审核的业务数据,用一个字断枚举当前的审核状态,现在枚举状态达到40个,逻辑处理变得复杂并且难以扩展;这种纵向累加式做法是不可取的,请问有经验的前辈该如何处理此问题?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(3)
大家讲道理

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template