A workflow driven method and system

By pre-saving template nodes in the database and converting them into running nodes, the problem of historical work order operation failures and complex status maintenance caused by process definition changes in the existing technology is solved. This decouples process definition from running status and improves workflow version compatibility and running efficiency.

CN123180697APending Publication Date: 2026-11-27SHANGHAI EDICI INFRASTRUCTURE SUPPORTING CONSTRUCTION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611475342.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-21
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing workflow-driven approaches are prone to causing historical work order failures when process definitions change, making version compatibility difficult to achieve. Furthermore, the maintenance of parallel branch states is complex, and there are delays in node transitions, which affects the efficiency of business processes.

Method used

The architecture separates template nodes and running nodes. Multiple template nodes are pre-stored in the database, converted into running nodes and stored in an array. Recursive functions are used to manage node execution and status updates, thereby achieving structural decoupling between process definition and running status.

Benefits of technology

It resolved historical work order operation failures caused by process definition changes, reduced the complexity of status maintenance, eliminated node flow delays, and improved version compatibility and overall operational efficiency of business processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123180697A_ABST
    Figure CN123180697A_ABST
Patent Text Reader

Abstract

The application discloses a workflow driving method and system, comprising the following steps: S1, receiving a work order instance uploaded by a user, obtaining a corresponding template node based on the work order instance, and converting the template node into a corresponding running node; S2, saving the running node in an array, and executing the running node; after the current running node is executed, removing the current running node from the array, obtaining a next template node, and repeating the step S2 after converting the next template node into a corresponding running node, and emptying the array and exiting after an end stage in the running node is executed. The application converts the template node into the running node, and executes the running node in the array, thereby effectively improving the version compatibility of the workflow and the overall running efficiency of the business process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of business processing, and more particularly to a workflow-driven method and system. Background Technology

[0002] Workflow engines are core infrastructure supporting the automated operation of enterprise business processes, and are widely used in various enterprise scenarios such as approval workflows, business processing, and event handling. Currently, mainstream workflow engine products generally adopt an architecture design that tightly couples process definition with runtime execution. Taking widely used open-source BPM (Business Process Management) engines such as Activiti, Camunda, and Flowable as examples, the runtime execution objects and task instances directly reference the node attributes in the process definition. The activation status of the process is maintained through multiple tables in a relational database, and the hierarchical affiliation of parallel branches is represented by foreign key relationships between table records. During the workflow process, after a user completes an operation at a single node, the system only marks the current task as completed. The advancement of subsequent nodes requires additional signals or message events triggered in addition to the current request. This type of engine has been widely used in conventional standardized business scenarios and can support the automated operation of fixed processes.

[0003] When business requirements necessitate updating process definitions, existing historical work order instances still reference the old version's definition node attributes. During execution, mismatched fields or semantic changes can easily lead to errors, preventing historical work orders from flowing smoothly. Even without errors, historical work orders cannot apply new process optimizations, resulting in long-term, difficult-to-clean technical debt. When handling processes with parallel branches, the multi-table join-based state maintenance method requires revisiting the design branch count in the process definition during branch merging. Dynamically changing branch paths can easily cause merging logic errors, and the complexity of state querying and maintenance increases significantly with the number of branches. After a user completes an approval operation, subsequent conditional checks and external calls cannot be executed continuously within the current operation context, resulting in delays ranging from seconds to minutes, impacting overall business processing efficiency. Existing workflow-driven methods have significant shortcomings in version compatibility, state maintenance efficiency, and workflow continuity, making it difficult to meet the high-efficiency process operation requirements of complex business scenarios. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention discloses a workflow-driven method that pre-stores multiple template nodes in a database; The workflow-driven method includes: Step S1: Receive the work order instance uploaded by the user, obtain the corresponding template node based on the work order instance, and convert the template node into the corresponding running node; Step S2: Store the running node in an array and execute the running node; After the current running node has finished executing, the current running node is removed from the array, the next template node is obtained, the next template node is converted into the corresponding running node, and step S2 is repeated until the end node in the running node has finished executing, then the array is cleared and the process exits.

[0005] Preferably, the template node includes an information template, an approval template, and an event template; The running node includes running information, approval information, and event information; Step S1 includes: Step S11: Receive the work order instance and obtain the corresponding template node based on the unique identifier in the work order instance; Step S12: Copy the content in the information template as the running information, process the approval template to obtain the list of processors as the approval information, and process the event template to obtain the sub-process information as the event information.

[0006] Preferably, the running node includes an automatic execution class node, a user node, and the termination node; Step S2 includes: storing the running node in the array. When executing the automatic execution class node, the automatic execution class node is executed according to the corresponding processing method, and the next template node is obtained after the execution is completed. When executing the user node, a corresponding approval notification is sent to the current processor, and the next template node is obtained after the user provides feedback; and When executing the end node, the work order instance is set to completed, then the array is cleared and the process exits.

[0007] Preferably, the automatically executed nodes include start nodes, exclusive gateway nodes, event nodes, and parallel gateway nodes; When executing the start node, the creator of the work order instance is set as the handler, and then a recursive function is used to automatically obtain the next template node; When executing the exclusive gateway node, the work order parameters of the work order instance are obtained, and the next template node is determined by processing the work order parameters; When executing the event node, a corresponding HTTP request is sent to an external server, the structured fields returned by the server are received, the structured fields are processed to obtain the corresponding key-value pairs, and then written into memory and a preset hash structure respectively. Subsequently, the recursive function is used to automatically obtain the next template node. When executing the parallel gateway node, multiple preset target nodes are activated and executed simultaneously until all target nodes have been executed. Then, the recursive function is used to automatically obtain the next template node.

[0008] Preferably, when it is only necessary to read the running node in the array, the array is deserialized using a preset read function before reading.

[0009] Preferably, the work order instance includes a business source identifier; When the running node fails to execute, the business source of the work order instance is determined according to the business source identifier, and the corresponding fault tolerance strategy is invoked according to the business source to handle the failed running node.

[0010] Preferably, the sources of the business include fault-prone business and non-fault-prone business; When the execution of the running node of the fault-type service fails, the corresponding error log is recorded, and then the next template node is obtained to continue execution; If the execution of the non-faulty service fails on the running node, the current running node is rolled back and the process is awaited to be re-executed.

[0011] This invention discloses a workflow-driven system, which employs the aforementioned workflow-driven method; The workflow-driven system includes: A database is used to pre-store multiple template nodes; The conversion unit connects to the database and is used to receive work order instances uploaded by users, obtain corresponding template nodes based on the work order instances, and convert the template nodes into corresponding running nodes. An execution unit, connected to the conversion unit, is used to store the running nodes in an array and execute the running nodes; The recursive unit, which is connected to the conversion unit and the execution unit respectively, is used to remove the current running node from the array after the current running node has finished executing, obtain the next template node, and send the next template node to the conversion unit. After the execution unit finishes executing the end node in the running node, the recursive unit clears the array.

[0012] The following beneficial effects can be obtained by using the present invention: By separating and saving template nodes and running nodes, template nodes are converted into corresponding running nodes when processing work order instances. This solves the problems in the existing workflow-driven approach, such as process definition changes easily leading to historical work order operation failures, complex parallel branch state maintenance logic, and additional delays in node transitions. It achieves structural decoupling between process definition and running state, reduces the maintenance complexity of running state, eliminates waiting delays in node transitions, and effectively improves the version compatibility of workflows and the overall operating efficiency of business processes. Attached Figure Description

[0013] Figure 1 This is a flowchart illustrating the workflow-driven method in this invention. Figure 2 This is a schematic diagram of the process of converting a template node into a running node in this invention. Detailed Implementation

[0014] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0015] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other.

[0016] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, but this is not intended to limit the scope of the invention.

[0017] This invention discloses a workflow-driven method that pre-stores multiple template nodes in a database; like Figure 1 As shown, the workflow-driven method includes: Step S1: Receive the work order instance uploaded by the user, obtain the corresponding template node based on the work order instance, and convert the template node into the corresponding running node; Step S2: Store the running nodes in an array and execute the running nodes; After the current running node has finished executing, remove the current running node from the array, obtain the next template node, convert the next template node into the corresponding running node, and repeat step S2 until the end node in the running node has finished executing, then clear the array and exit.

[0018] This invention adopts a dual-node architecture that separates template nodes and running nodes, thereby achieving structural decoupling between process definition and runtime state.

[0019] Specifically, each work order instance includes at least one stage that needs to be processed, and each stage corresponds to a node. Multiple template nodes are pre-stored in the process definition database, each corresponding to a different node. Each template node is a read-only blueprint and is only updated during version updates.

[0020] The running node is stored in the State field of the work order instance, which is a runtime snapshot of the template node after instantiation. The State field of the work order instance is an array in JSON format.

[0021] Furthermore, the state field is stored in the following format: State = Serialize(A) = [a1, a2, ..., ak]_JSON In a single-active-node scenario (|A| = 1), after completing the current running node, obtain the next template node, convert it into a running node, replace the array content with the next running node, and keep the array length at 1.

[0022] In a multi-activated node scenario (|A| > 1), the array is updated through set union / difference operations. After a running node finishes execution, the difference operation is used to remove the completed running node from the array. After all running nodes have finished execution, the union operation is used to add the merged running node to the array.

[0023] In one embodiment, an example of a JSON array containing two active running nodes is as follows: [{"id":"node_123", "label":"Department Manager Approval", "clazz":"userTask", "stateUserNode":{"processor":["user_a","user_b"],"addSignProcessor":[],"status":1}}, {"id":"node_456" , "label":"Department Financial Audit" , "clazz":"userTask" , "stateUserNode":{"processor":["user_c"] , "status":1}}] By replacing the execution token model of multiple table associations in the existing technology with a single JSON field, the splitting and merging of parallel branches is achieved through set operations (union, difference) of array elements. The logic is concise and no foreign key association queries are required. The query and maintenance complexity is reduced from O(n*logn) to O(1).

[0024] After the end node has finished executing, the array is cleared, and the work order instance is marked as completed, ready for the user to check.

[0025] In a preferred embodiment of the present invention, the template node includes an information template, an approval template, and an event template; The running node includes running information, approval information, and event information; like Figure 2 As shown, step S1 includes: Step S11: Receive a work order instance and obtain the corresponding template node based on the unique identifier in the work order instance; Step S12: Copy the content in the information template as running information, process the approval template to obtain the list of processors as approval information, and process the event template to obtain the sub-process information as event information.

[0026] Specifically, the information template includes a unique node identifier, a node label, and a node type. The data structure definition of the template node is as follows: InfoStateNode={ID,Label,Clazz,UserNode,EventConfig} in, ID is a unique identifier for a node; Label is the node label; Clazz is a node type with a value set of {start, end, userTask, exclusiveGateway, parallelGateway, event}, which are the start node template, end node template, user node template, exclusive gateway node template, parallel gateway node template, and event node template, respectively. UserNode is the approval template, which contains a set of rules for the processor R={r1,r2,...,rn}, which correspond to dynamic rules such as roles, departments, and leaders, a list of CC recipients, countersignature / or signature identifiers, timeout thresholds, and email templates, respectively. EventConfig is an event template that includes an HTTP (Hypertext Transfer Protocol) request method, a URL (Uniform Resource Locator) template, a request body template, a token authentication method, and sub-process binding information.

[0027] The runtime information includes the node's unique identifier, node label, and node type. The data structure definition for a running node is as follows: StateNode={ID,Label,Clazz,StateUserNode,EventNode,Status} in, ID is a unique identifier for a node; Label is the node label; Clazz is a node type with a value set of {start, end, userTask, exclusiveGateway, parallelGateway, event}, which are the start node, end node, user node, exclusive gateway node, parallel gateway node, and event node, respectively. StateUserNode contains approval information, including a list of parsed actual processor IDs and a list of additional processors. EventNode contains event information, including the HTTP response code, a set of key-value pairs for response parameters, the subprocess ID, and the subprocess URL. Status indicates the current node status.

[0028] Furthermore, the ToStateNode() function is used to convert the template node into a running node. This conversion process can be formally described as follows: StateNode = f_convert(InfoStateNode, IAM_resolve) = { ID', Label',Clazz', StateUserNode', EventNode', Status_init} Specifically, the content in the template node's information template is directly copied as the running information of the running node: ID'= ID, Label' = Label, Clazz' = Clazz.

[0029] The dynamic user rules in UserNode are parsed into a list of specific user IDs through the IAM (Identity and Access Management) service, and the parsing results are stored in StateUserNode.Processor.

[0030] The subprocess binding information in EventConfig is converted and stored in EventNode.

[0031] After a process definition change, existing work order instances still hold runtime node snapshots converted from the old version template nodes and are unaffected by the new definition. Newly created work order instances use the latest template nodes, achieving historical compatibility and version isolation. Compared to Activiti's version number isolation scheme, this invention achieves decoupling at the data structure level, rather than just isolating at the process definition level, fundamentally eliminating the runtime dependency of old work orders on old versions of the definition.

[0032] In a preferred embodiment of the present invention, the running node includes an automatic execution class node, a user node, and an end node; Step S2 includes: storing the running nodes in an array. When executing an auto-execution class node, execute the auto-execution class node according to the corresponding processing method, and obtain the next template node after execution is completed; When executing a user node, send the corresponding approval notification to the current handler, and obtain the next template node after receiving user feedback; and When the execution ends, the work order instance is set to completed, then the array is cleared and the process exits.

[0033] Specifically, both user nodes and end nodes are blocking nodes.

[0034] Define the node type set C_auto={start,exclusiveGateway,parallelGateway,event} as automatically executed nodes and C_block={userTask,end} as blocking nodes.

[0035] Use the following function to recursively call nodes to obtain the next template node: HandleNodeExec(n) = Execute(n) and HandleNodeExec(Next(n)), if Clazz(n) belongs to C_auto; HandleNodeExec(n) = Execute(n), if Clazz(n) belongs to C_block Next(n) is the template node determined after node n is executed, and the recursive call continues until a blocking type node is encountered.

[0036] In a preferred embodiment of the present invention, the automatically executing class node includes a start node, an exclusive gateway node, an event node, and a parallel gateway node; When executing the start node, the creator of the work order instance is set as the handler, and then a recursive function is used to automatically obtain the next template node; When executing the exclusive gateway node, the work order parameters of the work order instance are obtained, and the next template node is determined by processing the work order parameters; When executing an event node, a corresponding HTTP request is sent to an external server, the structured fields returned by the server are received, the structured fields are processed to obtain the corresponding key-value pairs, and then written into memory and a preset hash structure respectively. Subsequently, a recursive function is used to automatically obtain the next template node. When executing a parallel gateway node, multiple preset target nodes are activated and executed simultaneously. After all target nodes have been executed, a recursive function is used to automatically obtain the next template node.

[0037] Specifically, an automatic drive chain is used to automatically execute each automatic execution node.

[0038] The automated drive chain refers to a continuous execution process that begins with a user-submitted operation and triggers the flow, executing all automatically executed nodes until a blocking node is encountered. To balance data consistency and execution performance, this solution finely decomposes the transaction boundaries of the drive chain. Core state changes for each node in the drive chain, including node state updates, JSON state array modifications, and operation history writes, are committed within independent database transactions, ensuring the atomicity of single-node state changes and data consistency. Non-core operations that do not affect the core process state, such as sending approval notifications, triggering external business callbacks, and setting node timeout tasks, are executed asynchronously via lightweight coroutines after the transaction is committed. This avoids drive chain blocking caused by slow external interface responses and prevents core process state rollback due to asynchronous operation failures, thus improving the execution stability and efficiency of the drive chain.

[0039] The start node is the node that is executed first for all work order instances. After the start node is completed, the process moves to the next running node.

[0040] Exclusive gateway nodes are standard nodes in workflows used to implement conditional branching. During the process definition phase, designers configure multiple outgoing connections (i.e., outgoing edges) for exclusive gateway nodes. Each outgoing edge is associated with a conditional expression and a corresponding subsequent target node, used to express the flow direction under different business parameters. When the node driver chain reaches the exclusive gateway node, there is no need to query external storage. The required parameters are directly read from the memory parameter mapping of the current request context. The conditional expressions of each outgoing edge are evaluated one by one, and the only outgoing edge that meets the condition is selected to determine the next target node to be executed. This ensures that only one branch is entered for execution at any given time, which conforms to the single-branch semantics of the exclusive gateway.

[0041] To avoid the performance overhead of frequent access to external storage, a unified parameter mapping table, WorkOrderDataList, is maintained in memory for the current request when executing automated execution nodes. This mapping table is a string key-value pair structure, and parameters are loaded before each node is executed. The loaded parameters include three categories: first, form data submitted by the user during work order creation or approval; second, globally common parameters preset in the process definition; and third, response parameters returned by executed event nodes. These three types of parameters are merged and stored in the memory mapping. All nodes in the driver chain (including exclusive gateways and event nodes) directly read the required data from this memory mapping, eliminating the need to repeatedly query Redis (Remote DictionaryServer) cache or relational databases, significantly reducing the IO (Input / Output) overhead of the driver chain.

[0042] The conditional expression for an exclusive gateway is: D = D_form + D_global + D_event in, D represents the data in the parameter mapping table; D_form represents the form data; D_global represents globally shared data; D_event is the response parameter returned by the executed event node.

[0043] Event nodes are automatic nodes configured in the process definition for calling external services. They are typically used to initiate HTTP requests to call third-party interfaces, send notifications, start sub-processes, or synchronize business data. When an event node completes an HTTP call and receives a response from the external service, it first parses the structured JSON fields in the response body into a flattened set of key-value pairs. Then, it performs a double-write operation: firstly, it directly writes the parsed key-value pairs into the memory parameter mapping of the current request context, allowing subsequent exclusive gateways within the same driver chain to directly use these response parameters for conditional judgments without waiting for data persistence to complete; secondly, it writes the key-value pairs into a Redis hash structure for persistence. When the current driver chain ends and subsequent user operations trigger the next process segment, these parameters can be directly loaded from Redis without repeatedly calling the external interface.

[0044] In a preferred embodiment of the present invention, when it is only necessary to read the running nodes in the array, a preset reading function is used to deserialize the array before reading.

[0045] Specifically, the running nodes are stored as a JSON array in the state field of the work order instance, with the type json.RawMessage.

[0046] The GetCurrentNode() function is used to deserialize json.RawMessage into []StateNode. Deserialization is only performed when the node state needs to be read or modified, thus avoiding the overhead of frequent JSON parsing.

[0047] In a preferred embodiment of the present invention, the work order instance includes a business source identifier; When a running node fails to execute, the business source of the work order instance is determined based on the business source identifier, and the corresponding fault tolerance strategy is invoked based on the business source to handle the failed running node.

[0048] Specifically, the work order instance contains an Origin field, which serves as a business source identifier, including fault work orders (FAULT), configuration management database (CMDB), change management database (CHANGE), etc.

[0049] The business source identifier is a field that is automatically included when a work order is created and is used to mark the business scenario to which the work order belongs.

[0050] In a preferred embodiment of the present invention, the service sources include fault-related services and non-fault-related services; When a running node of a fault-prone service fails to execute, the corresponding error log is recorded, and then the next template node is obtained to continue execution. When a running node performing non-faulty services fails, the current running node is rolled back and the process is awaited to be restarted.

[0051] Specifically, define the fault tolerance strategy function OnError(Origin, Error): OnError(FAULT,Error)=Log(Error)andContinue(); OnError(not FAULT, Error) = Rollback() and Retry(); Specifically, the source of FAULT (Fault) corresponds to fault handling work orders with the core objective of quickly restoring business operations, such as server alarm work orders, core business anomaly repair work orders, network outage repair work orders, and online service fault dispatch work orders. Among the various nodes in the automated drive chain, the start node, exclusive gateway node, and parallel gateway node are all pure in-memory computing nodes within the program, operating only on in-memory data without external dependencies, and will not fail under normal operating conditions; user nodes are manually interactive nodes, triggered by user actions, and there is no issue of automatic program execution failure; anomalies in database operations such as node status updates are system-level errors, with consistency guaranteed by the database transaction mechanism itself. Only event nodes need to initiate cross-network HTTP external calls, relying on the availability of downstream services, and are the only nodes requiring differentiated fault tolerance strategies at the business level. For work orders originating from faults, when an HTTP call to an event node fails, the system only records the error information, the reason for failure, and the call parameters in the runtime log. It does not interrupt the execution of the current drive chain, and the process continues to flow directly to the next node. This avoids the failure of non-core events such as notifications and data synchronization from hindering the main fault repair process, thus maximizing the timeliness of fault handling.

[0052] Non-fault-related work orders correspond to business scenarios with high requirements for data consistency and process rigor, such as configuration management and change management. Examples include CMDB configuration change work orders, system deployment change work orders, account permission application work orders, financial reimbursement approval work orders, and core data modification approval work orders. These work orders do not prioritize extreme processing speed but require accurate execution of each step to avoid omissions or data inconsistencies. For work orders from this source, if the event node's HTTP call fails (e.g., configuration synchronization interface call failure, permission activation interface return error, financial data synchronization anomaly), the system will immediately terminate the current execution chain, roll back the database transaction of the current node, and restore the work order state to its state before the event node's execution. It will not be routed to subsequent nodes; execution will continue only after automatic system retry or manual intervention, ensuring the atomicity of all operations and data consistency, and preventing discrepancies between the actual business state and the process records.

[0053] Furthermore, the binary fault tolerance strategy, which handles both fault-based and non-fault-based sources, can be extended to support more fault tolerance strategies, such as fallback, without requiring modifications to the process definition.

[0054] Each scenario selects different fault tolerance strategies based on its business origin and reliability requirements, eliminating the need to maintain separate copies of process definitions for each scenario. Compared to the global exception handling mechanism of existing engines, this further refines the granularity of fault tolerance, improving the reusability of process definitions and operational efficiency.

[0055] This invention discloses a workflow-driven system that employs the aforementioned workflow-driven method; Workflow-driven systems include: A database is used to pre-store template nodes; The conversion unit connects to the database and is used to receive work order instances uploaded by users, obtain the corresponding template nodes based on the work order instances, and convert the template nodes into the corresponding running nodes. The execution unit, which connects to the conversion unit, is used to store the running nodes in an array and execute the running nodes. The recursive unit, which connects the conversion unit and the execution unit respectively, is used to remove the current running node from the array after the current running node has finished executing, obtain the next template node, and send the next template node to the conversion unit. After the execution unit finishes executing the end node in the running node, the recursive unit clears the array.

[0056] A preferred embodiment is now provided to help those skilled in the art understand the present invention: User-defined workflow: Start node → Department manager approval node → HTTP notification event node → End node, and create a work order instance. When a user submits a work order instance creation request, the system creates a work order master record within a database transaction, containing core information such as business source identifier, status field, and business form data. After the transaction is committed, the node driver engine is started. The driver engine first retrieves the start node from the read-only workflow definition, calls the node transformation method to instantiate the template node into a runtime node, copies the node ID, name, type, and other information template as runtime information, sets the work order creator as the initial handler of the node, and records the work order creation operation history. Since the start node is an automatically executed node, the driver chain does not need to wait for external triggering to continue execution automatically. After determining that the next node is the department manager approval user task node, the node transformation method is called again, copies the node's common attributes, and uses the identity and access management service to parse the "department manager" dynamic role rule configured in the template into a specific list of user IDs, storing them in the handler field of the runtime node. Since the user task node is a blocking node, the drive chain pauses execution, serializes the completed department manager approval running node into a JSON array, updates the status field of the work order, and asynchronously sends the approval notification to the corresponding department manager after the transaction is committed.

[0057] An exclusive gateway is set up after the department manager's approval node. The gateway is configured with two outgoing edge rules: if the amount is greater than 10,000, it enters the HTTP notification event node and ends; if the amount is less than or equal to 10,000, it directly enters the end node. When the department manager submits the approval operation, the system first verifies the operator's permissions, updates the status of the department manager's approval node to "completed" within the transaction, and then starts the node-driven engine to process subsequent nodes. The node-driven engine first initializes the memory parameter mapping, loading the work order form data, global process parameters, and return parameters of executed nodes into memory key-value pairs. In this scenario, the amount field in the form has a value of 15,000. The next node is the exclusive gateway node, which is an automatically executed node. The engine directly evaluates the outgoing edge conditions of the gateway based on the parameters in memory. After determining that the condition of an amount greater than 10,000 is met, it selects the corresponding branch's HTTP event node as the next target node, and the drive chain continues recursively. When an event node executes, it initiates an HTTP request to the configured external service address. After receiving the response, it parses the structured fields in the response into flattened key-value pairs and synchronously writes them to the memory parameter mapping and Redis cache structure of the current request for use by subsequent nodes. After the event node completes its execution, the drive chain continues to advance automatically until the next node is determined as the end node. The end node is a blocking node; the engine sets the overall status of the work order to "completed," the drive chain terminates, and after committing the transaction, it asynchronously executes non-core operations such as process completion notification, business callback triggering, and node timeout task cleanup. The entire process, from exclusive gateway condition judgment and event node invocation to process completion, is automatically completed within a single user approval request, imperceptibly to the user, with a latency in the millisecond range.

[0058] A parallel gateway node is set up after the exclusive gateway. The gateway's outgoing edges point to the financial review user task node and the legal review user task node, respectively. Once both branches are completed, they are merged into the general manager approval node. When the drive chain reaches the parallel gateway node, as an automatically executed node, the engine first obtains the target nodes corresponding to all outgoing edges of the parallel gateway. It then calls the node transformation method to instantiate the financial review and legal review template nodes into runtime nodes, and uses the identity service to parse the actual handler lists corresponding to the two nodes. After the transformation, the parallel gateway node is removed from the JSON status array. The runtime nodes of the two branches are serialized and updated to the work order status field. At this point, the status array contains two active runtime nodes, and the two branches are effective in parallel. After the transaction is committed, approval notifications are asynchronously sent to the financial reviewer and the legal reviewer, respectively. When the financial reviewer completes the approval operation first, the system updates the status of the financial review node to "completed" within the transaction and removes it from the JSON status array. At this point, only the incomplete legal review node remains in the array, and the drive chain pauses, waiting for the remaining branches to complete. After the legal reviewer completes the approval process, the system removes the legal review node from the status array. It detects that all branch nodes corresponding to the parallel gateway have been completed, triggers the branch merging logic, converts the subsequent general manager approval node into a running node and adds it to the status array. The drive chain continues to execute the general manager approval node. When the general manager finishes processing, it switches to the execution end node and then completes this work order instance.

[0059] The above description is merely a preferred embodiment of the present invention and does not limit the implementation and protection scope of the present invention. Those skilled in the art should realize that any equivalent substitutions and obvious changes made based on the description and illustrations of the present invention should be included within the protection scope of the present invention.

Claims

1. A workflow-driven method, characterized in that, Multiple template nodes are pre-stored in the database; The workflow-driven method includes: Step S1: Receive the work order instance uploaded by the user, obtain the template node of the corresponding stage based on the work order instance, and convert the template node into the corresponding running node; Step S2: Store the running node in an array and execute the running node; After the current running node has finished executing, the current running node is removed from the array, the next template node is obtained, the next template node is converted into the corresponding running node, and step S2 is repeated until the end node in the running node has finished executing, then the array is cleared and the process exits.

2. The workflow-driven method according to claim 1, characterized in that, The template node includes information templates, approval templates, and event templates; The running node includes running information, approval information, and event information; Step S1 includes: Step S11: Receive the work order instance and obtain the corresponding template node based on the unique identifier in the work order instance; Step S12: Copy the content in the information template as the running information, process the approval template to obtain the list of processors as the approval information, and process the event template to obtain the sub-process information as the event information.

3. The workflow-driven method according to claim 1, characterized in that, The running node includes an automatic execution type node, a user node, and the termination node; Step S2 includes: storing the running node in the array. When executing the automatic execution class node, the automatic execution class node is executed according to the corresponding processing method, and the next template node is obtained after the execution is completed. When executing the user node, a corresponding approval notification is sent to the current processor, and the next template node is obtained after the user provides feedback; and When executing the end node, the work order instance is set to completed, then the array is cleared and the process exits.

4. The workflow-driven method according to claim 3, characterized in that, The automatically executed nodes include start nodes, exclusive gateway nodes, event nodes, and parallel gateway nodes; When executing the start node, the creator of the work order instance is set as the handler, and then a recursive function is used to automatically obtain the next template node; When executing the exclusive gateway node, the work order parameters of the work order instance are obtained, and the next template node is determined by processing the work order parameters; When executing the event node, a corresponding HTTP request is sent to an external server, the structured fields returned by the server are received, the structured fields are processed to obtain the corresponding key-value pairs, and then written into memory and a preset hash structure respectively. Subsequently, the recursive function is used to automatically obtain the next template node. When executing the parallel gateway node, multiple preset target nodes are activated and executed simultaneously until all target nodes have been executed. Then, the recursive function is used to automatically obtain the next template node.

5. The workflow-driven method according to claim 1, characterized in that, When it is only necessary to read the running node in the array, the array is deserialized using a preset read function before the read is performed.

6. The workflow-driven method according to claim 1, characterized in that, The work order instance includes a business source identifier; When the running node fails to execute, the business source of the work order instance is determined according to the business source identifier, and the corresponding fault tolerance strategy is invoked according to the business source to handle the failed running node.

7. The workflow-driven method according to claim 6, characterized in that, The sources of business include fault-related business and non-fault-related business; When the execution of the running node of the fault-type service fails, the corresponding error log is recorded, and then the next template node is obtained to continue execution; If the execution of the non-faulty service fails on the running node, the current running node is rolled back and the process is awaited to be re-executed.

8. A workflow-driven system, characterized in that, The workflow-driven method described in any one of claims 1-7 is employed; The workflow-driven system includes: Database used to pre-store multiple template nodes The conversion unit connects to the database and is used to receive work order instances uploaded by users, obtain corresponding template nodes based on the work order instances, and convert the template nodes into corresponding running nodes. An execution unit, connected to the conversion unit, is used to store the running nodes in an array and execute the running nodes; The recursive unit, which is connected to the conversion unit and the execution unit respectively, is used to remove the current running node from the array after the current running node has finished executing, obtain the next template node, and send the next template node to the conversion unit. After the execution unit finishes executing the end node in the running node, the recursive unit clears the array.