CN-122022707-A - Dynamic return method and device for business process, medium and terminal
Abstract
The application discloses a dynamic return method and device, medium and terminal of a business process, which relate to the technical field of workflow approval and mainly aim to solve the problems that the existing method cannot meet the dynamic business return requirement due to the adoption of a static and predefined return mechanism and the maintenance cost and the fault risk are increased due to the complexity of a process model. According to the embodiment of the application, the dynamic proxy technology is utilized to create the proxy task object of the model element corresponding to the current task node, and the flow direction method is enhanced, so that when the flow engine inquires the next flow after the current task is completed, the proxy task object does not return to the path defined by the original flow chart, but returns a new path pointing to the return history task model element, the service return requirement of dynamic change is met, and the flow model is simplified because a complex flow chart is not required to be drawn, so that the maintenance cost and the fault risk are reduced.
Inventors
- LIN ZHIHUI
Assignees
- 龙盈智达(北京)科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20251208
Claims (10)
- 1. A method for dynamically returning a business process, comprising: acquiring a Business Process Model (BPMN) of a process instance to which a current task node belongs, and positioning a current task model element corresponding to the current task node and a return history task model element corresponding to a return history task node from the business process model; Based on a dynamic proxy technology, the current task model element is encapsulated to create a corresponding proxy task object, and a flow direction method of the proxy task object is enhanced, so that a next-stage flow query result of the proxy task object is a path pointing to the return history task model element; Invoking a task completion interface of a flow engine to process a task to be processed of the current task node, and transmitting the proxy task object into the flow engine in the processing process, so that the flow engine returns the flow instance to the node where the return history task model element is located based on the path; And generating a corresponding task to be handled at the node, and distributing the task to a processor of the node so as to enable the processor to carry out task processing again.
- 2. The method of claim 1, wherein after the node generates the corresponding task to be handled and assigns to the handler of the node to cause the handler to resume task processing, the method further comprises: According to the instance identification, a stack object corresponding to the flow instance is obtained from a flow variable table; sequentially removing node records from the stack top of the stack object until the node identification of the node record positioned at the stack top is consistent with the node identification of the return history task node; And generating a flow returning operation record, and storing the flow returning operation record into a history operation record table corresponding to the flow instance.
- 3. The method according to claim 1, wherein before the obtaining the business process model of the process instance to which the current task node belongs, the method further comprises: responding to a return operation triggered at the current task node, and acquiring an instance identifier of a flow instance to which the current task node belongs; Based on the instance identifier, a stack object corresponding to the flow instance is obtained, wherein the stack object stores a node sequence through which the flow instance flows; traversing the node sequence, screening all node records with the type of user task, and arranging all node records in ascending order according to the occurrence time of operation to generate a returnable node list; and displaying the returnable node list to a processor of the current task node, and receiving a selected node of the processor in the returnable node list as a returnable historical task node.
- 4. The method according to claim 1, wherein before the obtaining the business process model of the process instance to which the current task node belongs, the method further comprises: acquiring a node identifier of the return history task node; and based on the node identification, carrying out query operation in the returnable node list, and determining the returnable historical task node as a legal returnable historical task node when the node identification is queried.
- 5. The method according to claim 1, wherein the method further comprises: When the task of the current task node is processed, acquiring a stack object corresponding to the flow instance from a flow variable table according to an instance identifier; Encapsulating the task completion operation of the current task node into a current task node record object, and pushing the current task node record object into the stack object to obtain a stack object updated by the current task node; And replacing the stack object corresponding to the flow instance stored in the flow variable table with the stack object updated by the current task node.
- 6. The method according to claim 5, wherein before the stack object corresponding to the flow instance is obtained from the flow variable table according to the instance identifier when the task of the current task node is processed, the method further comprises: when a flow instance is started, synchronously creating an initial stack object; Encapsulating a flow starting operation into a starting record object, and pushing the starting record object into the initial stack object to obtain a stack object corresponding to a starting flow; and storing the stack object corresponding to the starting flow into a flow variable table.
- 7. The method according to claim 5, wherein before the stack object corresponding to the flow instance is obtained from the flow variable table according to the instance identifier when the task of the current task node is processed, the method further comprises: when a flow instance is started, a history operation record table is synchronously created and is used for storing all operation logs of the flow instance.
- 8. A dynamic retraction device for a business process, comprising: The business process model element positioning module is used for acquiring a business process model of a process instance to which a current task node belongs, and positioning a current task model element corresponding to the current task node and a return history task model element corresponding to a return history task node from the business process model; The path creation module is used for packaging the current task model element based on a dynamic proxy technology to create a corresponding proxy task object, and enhancing the flow direction method of the proxy task object so that the next-stage flow query result of the proxy task object is a path pointing to the return history task model element; The process returning module is used for calling a task completion interface of a process engine to process a task to be processed of the current task node, and transmitting the proxy task object into the process engine in the processing process, so that the process engine returns the process instance to the node where the returning history task model element is located based on the path; And the task to be handled generating module is used for generating a corresponding task to be handled at the node and distributing the task to a processor of the node so as to enable the processor to process the task again.
- 9. A storage medium having stored therein at least one executable instruction for causing a processor to perform operations corresponding to the dynamic fallback method of a business process according to any of claims 1 to 7.
- 10. A terminal comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus; The memory is configured to store at least one executable instruction, where the executable instruction causes the processor to perform operations corresponding to the method for dynamic fallback of a business process according to any of claims 1 to 7.
Description
Dynamic return method and device for business process, medium and terminal Technical Field The present application relates to the field of workflow approval technologies, and in particular, to a method and apparatus for dynamically returning a business process, a medium, and a terminal. Background In a business process, when a processor finds that information of a current backlog is wrong or needs to be supplemented, a task is usually required to be returned to a specific node before the task is returned to the process for correction. This rollback operation requires that the flow engine be able to support a reverse jump from the current node to the historical approval node. Currently, one common prior art solution to implementing such a rollback function is to define all possible rollback paths in advance in the flow diagram according to various rollback scenarios when designing a Business Process Model (BPMN) flow diagram with an actiti flow engine, so that when a processor triggers a rollback, the predefined paths are rolled back to specified history nodes according to set conditions. However, due to the above method, a developer needs to completely predict all possible return scenes and paths at the beginning of the flow design and solidify them in the flow chart, which leads to that when there is a new return demand, the flow chart needs to be redrawn, and the dynamically changing business demand cannot be satisfied, and on the other hand, the flow chart model is extremely complicated, so that the maintenance cost and the fault risk are increased. Disclosure of Invention In view of this, the present application provides a method, a device, a medium, and a terminal for dynamic return of a business process, which mainly aims to solve the problems that the existing method cannot meet the dynamic service return requirement due to the adoption of a static and predefined return mechanism, and the maintenance cost and the fault risk are increased due to the complexity of a process model. According to one aspect of the present application, there is provided a method for dynamic fallback of a business process, including: Acquiring a business process model of a process instance to which a current task node belongs, and positioning a current task model element corresponding to the current task node and a return history task model element corresponding to a return history task node from the business process model; Based on a dynamic proxy technology, the current task model element is encapsulated to create a corresponding proxy task object, and a flow direction method of the proxy task object is enhanced, so that a next-stage flow query result of the proxy task object is a path pointing to the return history task model element; Invoking a task completion interface of a flow engine to process a task to be processed of the current task node, and transmitting the proxy task object into the flow engine in the processing process, so that the flow engine returns the flow instance to the node where the return history task model element is located based on the path; And generating a corresponding task to be handled at the node, and distributing the task to a processor of the node so as to enable the processor to carry out task processing again. Preferably, after the node generates the corresponding task to be handled and distributes the task to the processor of the node, so that the processor performs task processing again, the method further includes: According to the instance identification, a stack object corresponding to the flow instance is obtained from a flow variable table; sequentially removing node records from the stack top of the stack object until the node identification of the node record positioned at the stack top is consistent with the node identification of the return history task node; And generating a flow returning operation record, and storing the flow returning operation record into a history operation record table corresponding to the flow instance. Preferably, before the obtaining the business process model of the process instance to which the current task node belongs, the method further includes: responding to a return operation triggered at the current task node, and acquiring an instance identifier of a flow instance to which the current task node belongs; Based on the instance identifier, a stack object corresponding to the flow instance is obtained, wherein the stack object stores a node sequence through which the flow instance flows; traversing the node sequence, screening all node records with the type of user task, and arranging all node records in ascending order according to the occurrence time of operation to generate a returnable node list; and displaying the returnable node list to a processor of the current task node, and receiving a selected node of the processor in the returnable node list as a returnable historical task node. Preferably, before the obtaining the business process