A method and apparatus for developing and implementing a business logic flow

By breaking down and combining business logic processes, and utilizing the attribute tags and dependencies of logical nodes, the problem of exponentially increasing code logic was solved, enabling the reuse of logical nodes and improving development efficiency.

CN115407990BActive Publication Date: 2026-06-16BEIJING JINGDONG ZHENSHI INFORMATION TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING JINGDONG ZHENSHI INFORMATION TECH CO LTD
Filing Date
2022-08-09
Publication Date
2026-06-16

AI Technical Summary

Technical Problem

As business grows, new features will modify existing functions, and the amount of code logic will increase exponentially. Even adding interfaces will significantly increase repetitive code, and existing technologies are unable to effectively decouple and reduce code logic.

Method used

By breaking down the business logic process of the target business, multiple sets of logical nodes are obtained. Attribute labels are determined based on the input and output parameters of the nodes. Logical nodes are then combined to meet business requirements, thereby decoupling the logical process and reducing duplicate code.

🎯Benefits of technology

It enables the reuse and flexible combination of logical nodes, reduces code modifications, improves development efficiency, avoids the increase of duplicate code, and simplifies the understanding of code logic and execution order.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115407990B_ABST
    Figure CN115407990B_ABST
Patent Text Reader

Abstract

The application discloses a kind of service logic flow development and service logic flow implementation method and device, it is related to computer technical field.The specific embodiment of service logic flow development method includes: splitting to service logic flow, obtains logic node set;According to the attribute label of logic node in the logic node set Logic node's in-parameter, output parameter, determine the attribute label of logic node;According to business requirement, logic node is combined, and service logic is obtained.The embodiment can decouple service logic flow at code level, avoid large-scale increase of repeated code when developing new requirements.The specific embodiment of service logic flow implementation method includes: obtaining service logic according to the above-mentioned service logic flow development method;The logic node in the service logic is sorted;Sequentially execute logic node, obtain response result.The embodiment can automatically determine the execution order of logic node, improve development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for developing and implementing business logic processes. Background Technology

[0002] As business grows, new services are often added on top of existing ones, making multiple services closely intertwined and difficult to separate. At the programming level, this manifests as code that performs different functions being coupled together, with business logic intertwined.

[0003] In the process of realizing this invention, the inventors discovered at least the following problems in the prior art:

[0004] As business grows, new features will modify existing functions, and the amount of code logic will increase exponentially; even adding interfaces will significantly increase the amount of duplicate code. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a method and apparatus for developing and implementing business logic processes, which can decouple the logic process at the code level, avoid modifying the original functions during business development, reduce the code logic brought by new business, avoid adding duplicate code, and improve development efficiency.

[0006] To achieve the above objectives, according to one aspect of the present invention, a method for developing business logic processes is provided, comprising:

[0007] The business logic process of the target business is broken down to obtain a set of logical nodes that include multiple logical nodes;

[0008] Based on the input and output parameters of each logical node in the set of logical nodes, the attribute labels of the logical nodes are determined; the attribute labels include: the node label and logical method of the logical node, and the node labels of the logical nodes it depends on;

[0009] Based on the first business requirement of the target business, some or all of the logical nodes in the set of logical nodes are combined to obtain business logic that satisfies the first business requirement.

[0010] Optionally, based on the first business requirement of the target business, some or all of the logical nodes in the logical node set are combined, including:

[0011] Map some or all of the logical nodes in the set of logical nodes onto the page, and combine the logical nodes on the page according to the first business requirement of the target business.

[0012] Optionally, after obtaining a set of logical nodes including multiple logical nodes, the method further includes:

[0013] In response to the second business requirement of the target business, a new logical node is added to the logical node set, and the attribute label of the new logical node is determined; according to the second business requirement, some or all of the logical nodes in the updated logical node set are combined to obtain the business logic that satisfies the second business requirement.

[0014] Optionally, after obtaining the business logic that meets the business requirements, the method further includes:

[0015] Encapsulate business logic that meets business needs into data interfaces, or encapsulate business logic that meets business needs into SaaS product services.

[0016] According to a second aspect of the present invention, a method for implementing a business logic process is provided, comprising:

[0017] In response to receiving a target business requirement, the target business logic of the target business requirement is obtained; the target business logic of the target business requirement is obtained by the method described in any one of claims 1-4; the attribute tags of each logical node in the target business logic include: the node tag and logical method of the logical node, and the node tag of the logical node it depends on;

[0018] Based on the node label of each logical node in the target business logic and the node labels of the logical nodes it depends on, sort the logical nodes in the target business logic.

[0019] Based on the sorting results and the logical methods of each logical node in the target business logic, each logical node in the target business logic is executed sequentially to obtain a response result corresponding to the target business requirement.

[0020] Optionally, the logical nodes in the target business logic are sorted according to the node label of each logical node and the node labels of the logical nodes they depend on, including:

[0021] For the first logical node in the target business logic that only depends on external input parameters, the weight of the first logical node is reset to its initial value; for each other logical node in the target business logic other than the first logical node, the sum of the weights of all logical nodes that the other logical node depends on is determined according to the weight of each logical node that the other logical node depends on, and the weight of the other logical node is reset to a value greater than the sum of the weights.

[0022] Arrange the logical nodes in the target business logic in ascending order of weight.

[0023] Optionally, sorting the logical nodes in the target business logic according to the node label of each logical node and the node labels of the logical nodes it depends on further includes:

[0024] Initialize a weight mapping with empty content; starting from the first logical node in the target business logic, traverse each logical node in the target business logic to determine the weight of the corresponding logical node, write the determined weight and the corresponding node label into the weight mapping, and then determine whether the number of records in the weight mapping is equal to the number of logical nodes in the target business logic; if the number of traversals is greater than the number of logical nodes in the target business logic and is not equal, issue an exception alarm.

[0025] Optionally, based on the sorting result and the logical method of each logical node in the target business logic, each logical node in the target business logic is executed sequentially, including:

[0026] Initialize the result mapping, which includes the node label and output parameter results of each logical node in the target business logic;

[0027] For the first logical node in the target business logic that only depends on external input parameters, determine the output parameter result of the first logical node based on the external input parameters and the logical method of the first logical node, and update the result mapping;

[0028] For each logical node in the target business logic other than the first logical node, obtain the output parameter data of each logical node that the other logical node depends on from the result mapping. Based on the obtained output parameter data and the logical methods of the other logical nodes, determine the output parameter data of the other logical nodes and update the result mapping.

[0029] After determining the output parameters of all logical nodes in the target business logic, the result mapping is encapsulated to obtain the response result corresponding to the target business requirement.

[0030] According to a third aspect of the present invention, an apparatus for developing business logic processes is provided, comprising:

[0031] The business logic process decomposition module is used to decompose the business logic process of the target business and obtain a set of logical nodes including multiple logical nodes.

[0032] The logical node attribute label determination module is used to determine the attribute label of the logical node based on the input and output parameters of each logical node in the logical node set; the attribute label includes: the node label and logical method of the logical node, and the node label of the logical node it depends on;

[0033] The logical node combination module is used to combine some or all of the logical nodes in the logical node set according to the first business requirement of the target business to obtain business logic that satisfies the first business requirement.

[0034] Optionally, based on the first business requirement of the target business, some or all of the logical nodes in the logical node set are combined, including:

[0035] Map some or all of the logical nodes in the set of logical nodes onto the page, and combine the logical nodes on the page according to the first business requirement of the target business.

[0036] Optionally, the apparatus for developing the business logic process further includes:

[0037] The logical node addition module is used to add new logical nodes to the logical node set in response to the second business requirement of the target business, and to determine the attribute tags of the new logical nodes; and to combine some or all of the logical nodes in the updated logical node set according to the second business requirement to obtain business logic that satisfies the second business requirement.

[0038] Optionally, the logical node combination module is further configured to: encapsulate business logic that meets business requirements into a data interface, or encapsulate business logic that meets business requirements into a SaaS product service.

[0039] According to a fourth aspect of the present invention, an apparatus for implementing a business logic process is provided, comprising:

[0040] The business logic acquisition module is used to acquire the target business logic of the target business requirement in response to receiving the target business requirement; the target business logic of the target business requirement is obtained by the method in the first aspect of the present invention; the attribute tags of each logic node in the target business logic include: the node tag and logic method of the logic node, and the node tag of the logic node it depends on;

[0041] The logical node sorting module is used to sort each logical node in the target business logic according to the node label of each logical node and the node labels of the logical nodes it depends on.

[0042] The logic node execution module is used to sequentially execute each logic node in the target business logic according to the sorting result and the logic method of each logic node in the target business logic, so as to obtain the response result corresponding to the target business requirement.

[0043] Optionally, the logical nodes in the target business logic are sorted according to the node label of each logical node and the node labels of the logical nodes they depend on, including:

[0044] For the first logical node in the target business logic that only depends on external input parameters, the weight of the first logical node is reset to its initial value; for each other logical node in the target business logic other than the first logical node, the sum of the weights of all logical nodes that the other logical node depends on is determined according to the weight of each logical node that the other logical node depends on, and the weight of the other logical node is reset to a value greater than the sum of the weights.

[0045] Arrange the logical nodes in the target business logic in ascending order of weight.

[0046] Optionally, sorting the logical nodes in the target business logic according to the node label of each logical node and the node labels of the logical nodes it depends on further includes:

[0047] Initialize a weight mapping with empty content; starting from the first logical node in the target business logic, traverse each logical node in the target business logic to determine the weight of the corresponding logical node, write the determined weight and the corresponding node label into the weight mapping, and then determine whether the number of records in the weight mapping is equal to the number of logical nodes in the target business logic; if the number of traversals is greater than the number of logical nodes in the target business logic, issue an exception alarm.

[0048] Optionally, based on the sorting result and the logical method of each logical node in the target business logic, each logical node in the target business logic is executed sequentially, including:

[0049] Initialize the result mapping, which includes the node label and output parameter results of each logical node in the target business logic;

[0050] For the first logical node in the target business logic that only depends on external input parameters, determine the output parameter result of the first logical node based on the external input parameters and the logical method of the first logical node, and update the result mapping;

[0051] For each logical node in the target business logic other than the first logical node, obtain the output parameter data of each logical node that the other logical node depends on from the result mapping. Based on the obtained output parameter data and the logical methods of the other logical nodes, determine the output parameter data of the other logical nodes and update the result mapping.

[0052] After determining the output parameters of all logical nodes in the target business logic, the result mapping is encapsulated to obtain the response result corresponding to the target business requirement.

[0053] According to a fifth aspect of the present invention, an electronic device is provided, comprising:

[0054] One or more processors;

[0055] Storage device for storing one or more programs.

[0056] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the above embodiments.

[0057] According to a sixth aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the methods described in any of the above embodiments.

[0058] One embodiment of the above invention has the following advantages or beneficial effects: By decomposing the business logic process, the resulting logical nodes can satisfy the "single responsibility principle" in software design, reducing factors that cause changes to logical nodes, thereby avoiding modifications to logical nodes and affecting existing functions when adding new business logic; at the same time, logical nodes are reusable and are not limited to implementing a single business logic process. Combining logical nodes according to different business needs can yield business logic that meets different needs. New logical nodes can be added and combined with existing logical nodes to implement new business logic, thereby avoiding a large-scale increase in duplicate code; by setting node labels in logical nodes based on their input and output parameters, the dependencies between logical nodes can be clearly identified, reducing unnecessary code logic and avoiding a significant increase in code logic; and by automatically sorting logical nodes according to their labels, developers only need to focus on the inputs and outputs required by the logical nodes during development, without having to reorganize the code execution order, thus improving development efficiency.

[0059] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description

[0060] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:

[0061] Figure 1 This is a schematic diagram of the main flow of the method for developing business logic processes according to an embodiment of the present invention;

[0062] Figure 2 It is a schematic diagram of the business logic flow of the target business designed based on existing technology;

[0063] Figure 3 This is a schematic diagram of the main process of business logic process decomposition according to a reference embodiment of the present invention;

[0064] Figure 4 This is a schematic diagram comparing the business logic flow before and after optimization according to another possible embodiment of the present invention;

[0065] Figure 5 This is a schematic diagram of the main flow of the method for implementing business logic flow according to an embodiment of the present invention;

[0066] Figure 6 This is a schematic diagram of the main process of sorting logical nodes according to another possible embodiment of the present invention;

[0067] Figure 7 This is a schematic diagram of the main modules of an apparatus for developing business logic processes according to an embodiment of the present invention;

[0068] Figure 8 This is a schematic diagram of the main modules of an apparatus for implementing business logic flow according to an embodiment of the present invention;

[0069] Figure 9 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;

[0070] Figure 10 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation

[0071] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0072] Typically, when initially developing business logic processes, developers need to consider using technical means to reduce the coupling between business logic components. These techniques include using microservices at the service level, design patterns at the design level, and method decomposition at the code level. These techniques can meet some of the decoupling needs for interfaces or functional modules. However, as business iterates, new business logic will affect existing functionality and require corresponding modifications in various places related to the new business logic, resulting in a significant increase in code complexity. Even if interfaces are added to avoid affecting existing functionality, this will lead to a substantial increase in duplicated code.

[0073] In view of this, according to one aspect of the present invention, a method for developing business logic processes is provided.

[0074] Figure 1 This is a schematic diagram of the main flow of a method for developing business logic processes according to an embodiment of the present invention. Figure 1 As shown, the method for developing business logic processes according to an embodiment of the present invention mainly includes the following steps S101 to S103.

[0075] Step S101: Decompose the business logic process of the target business to obtain a set of logical nodes including multiple logical nodes.

[0076] In this embodiment of the invention, the target service refers to a service that undertakes multiple responsibilities, and the logic behind these responsibilities is coupled together, with the completion of one responsibility requiring the support of other responsibilities. The target service can be various services provided to users, the various functional modules that constitute a service, or multiple methods that reference each other.

[0077] The business logic flow of the target business refers to the process of logically implementing the target business. Breaking down this process yields multiple logical nodes. A logical node includes a logical method, which could be a data retrieval operation, a conditional statement, or a call to an external method. At the code level, any block of code can be broken down into a logical node, meaning any line of code can serve as a logical node; for example, defining a constant or a simple arithmetic operation.

[0078] Since the logical methods contained in the logical nodes are precise to the code level and do not limit the operations performed by the logical nodes, the embodiments of the present invention can decompose complex business logic into multiple uncoupled logical methods, forming multiple corresponding logical nodes, which is conducive to decoupling the business logic process of the target business; by concentrating the code logic in the corresponding logical nodes, it is possible to avoid repeated development in other places involving related business logic, simplify the code logic, and facilitate the update and iteration of the target business and rapid development.

[0079] Figure 2 It is a schematic diagram of the business logic flow of the target business designed based on existing technology. Specifically, Figure 2 It is a service provided to users, namely, guidance on the profit and loss information of merchants under different pricing strategies. For example... Figure 2 As shown, the service's business logic flow includes four functional modules: profit calculation, cost estimation, revenue estimation, and a basic data module. Cost estimation and revenue estimation require acquiring basic data, while profit calculation relies on the results of cost and revenue estimation. The calculation process uses basic cost data, pricing data, and the proportion of origin for different routes, etc. Costs and revenues have different calculation rules depending on the logistics product. Furthermore, different calculation schemes need to be developed to address issues such as missing route data, missing cost items in the basic cost data, and non-existent route pricing, ultimately forming a service interface.

[0080] It can be seen Figure 2 The business logic flow shown has already undergone some conventional decoupling processes, including: dividing the entire service into multiple modules through microservice decomposition; and further decomposing cost or revenue calculation operations or basic data retrieval operations within each module using different design patterns. However, Figure 2 The business logic process shown still exhibits logical coupling.

[0081] Implemented using the method of the embodiments of the present invention Figure 2 When providing services, you can use the business of providing merchants with profit and loss information guidance services to users as the target business, or you can use cost calculation or revenue calculation as the target business, or you can use the sub-processes under the functional module as the target business, for example, using cost acquisition in cost calculation as the target business.

[0082] When breaking down the business logic process of a target business, it's necessary to consider the responsibilities of each logical node. Taking cost acquisition as an example, if the business logic process involves acquiring basic cost data (housing rental, transportation, and delivery) based on basic route data, this process can be broken down into multiple logical nodes. The responsibilities of each logical node include: acquiring housing rental data based on the basic route data, acquiring transportation data based on the basic route data, acquiring delivery data based on the basic route data, and assembling the acquired data to calculate costs. No restrictions are placed on the logical nodes here. The optimal decomposition process should, in conjunction with the current target business, adhere to the "single responsibility principle" as much as possible, ensuring that each logical node performs only one responsibility and minimizing factors that could change the logical nodes. This reduces the coupling between logical nodes and improves the efficiency of business updates and iterations.

[0083] Step S102: Determine the attribute labels of the logical nodes based on the input and output parameters of each logical node in the logical node set; the attribute labels include: the node label and logical method of the logical node, as well as the node labels of the logical nodes it depends on.

[0084] In addition to logical methods, logical nodes also include node labels (their own node label and the node labels of the logical nodes they depend on). Each logical node has a unique node label that identifies it, and based on these labels, the corresponding logical node and its attribute labels can be determined. Each logical node has its own inputs and outputs, i.e., input parameters and output parameters. Logical nodes receive initial parameters, which can be external parameters from outside the target business logic or data generated by the previous logical node. Simultaneously, logical nodes also transmit data needed by other logical nodes. By treating the logical nodes transmitting data as dependent nodes of the logical nodes receiving data, we can determine the dependent logical nodes of each logical node through its input and output parameters. Based on the node labels, the dependencies between logical nodes can be clearly determined, as well as the source and destination of data within logical nodes, reducing the coupling between logical nodes to data transmission relationships, thus facilitating the understanding of the target business logic flow.

[0085] Figure 3 This is a schematic diagram of the main flow of business logic process decomposition according to a possible embodiment of the present invention. For example... Figure 3As shown, the business logic flow of the target business includes three steps: business logic step a, business logic step b, and business logic step c. Business logic step a transmits its result to business logic step b, and business logic step b transmits its result to business logic step c. A possible breakdown of the target business's business logic flow is to divide it into three logical nodes 301-303. Logical node 301 includes: logical method a and node label A; logical node 302 includes: logical method b, node label B, and node label A of logical node 301, which logical node 302 depends on; logical node 303 includes: logical method c, node label C, and node label B of logical node 302, which logical node 303 depends on. Based on the node labels, the logical nodes that each logical node depends on can be clearly identified. During development, you only need to focus on the input and output parameters of the logical nodes, find out what data the logical nodes need, and what data the logical nodes will generate. This allows developers to focus more on the logical methods that each logical node needs to execute, without having to pay too much attention to the coupling relationship between logical nodes, thereby improving development efficiency and making it easier to modify or extend the business.

[0086] Step S103: Combine some or all of the logical nodes in the logical node set according to the first business requirement of the target business to obtain the business logic that satisfies the first business requirement.

[0087] After obtaining the set of logical nodes, for the primary business requirement of the target business, select the logical nodes needed to implement the primary business requirement. These logical nodes may be some or all of the logical nodes in the set. Together, these logical nodes constitute the business logic that satisfies the primary business requirement. For example, for... Figure 2 Cost acquisition can be divided into two business requirements: cost data acquisition and cost data encapsulation. For cost data acquisition, based on the logical node set described in the aforementioned embodiments of the present invention, three logical nodes are selected to implement cost data acquisition: a logical node for acquiring housing rental data based on basic route data, a logical node for acquiring transit data based on basic route data, and a logical node for acquiring delivery data based on basic route data. Combining these logical nodes yields the business logic that satisfies the first business requirement (i.e., cost data acquisition).

[0088] This invention, by combining logical nodes, clarifies the steps involved in each business requirement, simplifies the business logic flow, and further improves the flexibility of implementing business logic. Furthermore, the resulting logical nodes are reusable; a single logical node can appear in various combinations for different business requirements. This significantly reduces code duplication and avoids repetitive development of the same code for some identical business needs, thereby further improving development efficiency.

[0089] According to a possible embodiment of the present invention, when combining logical nodes, some or all of the logical nodes in the set of logical nodes can be mapped onto the page, and the logical nodes on the page can be combined according to the first business requirement of the target business.

[0090] Develop a page for combining logical nodes. These nodes can be displayed on the page using text, code, or graphics. To combine nodes, users can enter their node numbers or select the corresponding button. After confirming, the result is sent to the backend for combination, which then returns the combined result and displays it on the page. Alternatively, logical nodes can be dragged and dropped into the combination area on the page for a more intuitive way of sending the combination result to the backend, which then returns the combined result and displays it on the page. By mapping logical nodes to the page, the relationships between them become clearer, simplifying the combination process.

[0091] According to another possible embodiment of the present invention, after obtaining a set of logical nodes including multiple logical nodes, in response to the second business requirement of the target business, a new logical node can be added to the set of logical nodes, and the attribute label of the new logical node can be determined; according to the second business requirement, some or all of the logical nodes in the updated set of logical nodes can be combined to obtain business logic that satisfies the second business requirement.

[0092] The second business requirement differs from the first. It requires additional logical methods to be added to the business logic corresponding to the first requirement. In practice, new logical nodes can be identified based on the second business requirement and added to the logical node set. The logical node set is dynamic and can be expanded to accommodate new logical nodes. Logical nodes can also be deleted or hidden when they are deemed obsolete during business updates. All logical nodes in the set are reusable and can be used to implement different business requirements. Reusing logical nodes significantly reduces code duplication. When modifying code, only the corresponding logical nodes need to be modified, avoiding modifications in multiple places involving related logical methods due to logical complexity, thus improving development efficiency. Dynamically changing the logical node set increases the flexibility of business logic flow development.

[0093] Figure 4 This is a schematic diagram comparing the business logic flow before and after optimization according to another applicable embodiment of the present invention. For example... Figure 4 As shown, before the business logic process optimization, the business logic process for the first business requirement included steps 1-3, and the business logic process for the second business requirement included steps 1-4. It can be seen that, in order not to affect the business logic process of the first business requirement, a second business requirement, similar to the first, was redeveloped. This added a large amount of repetitive code, and if steps 1-3 were modified, the business logic processes for both the first and second business requirements would need to be modified separately, further increasing the scope of code modifications and resulting in low development efficiency.

[0094] After optimization, the business logic flow is broken down into logical nodes 1-4 and stored in the calculation layer to form a logical node set. For business logic flows with different business needs, different logical combinations will be called in the model layer. Because logical nodes are reusable, they can be combined to meet different business needs, eliminating the need to repeatedly develop the same logic code and improving development efficiency. When modifying the business logic flow, only the relevant logical nodes need to be modified, avoiding modifications in multiple places within the business logic flow, which reduces the amount of logic code that needs to be modified and improves development efficiency. When new business logic flows need to be added based on new business requirements, it is not necessary to redevelop a business logic flow containing a large amount of repetitive code to avoid affecting the original functionality; the new logical nodes can be directly added to the logical node set. Figure 4 The computational layer in the system combines logical nodes to implement business logic that meets new business requirements. This simplifies the business logic process, avoids extensive code duplication, and improves development efficiency.

[0095] According to another possible embodiment of the present invention, after obtaining the business logic that meets the business requirements, the business logic that meets the business requirements can be further encapsulated into a data interface, or the business logic that meets the business requirements can be encapsulated into a SaaS product service.

[0096] like Figure 4 As shown, the first business requirement can be encapsulated as an interface with one input and one output; inputting appropriate parameters will return the corresponding output result. Alternatively, it can be provided to customers as a SaaS (Software-as-a-Service) product service.

[0097] Encapsulating business logic that meets business needs into data interfaces facilitates invocation by other target businesses. This decouples multiple target businesses at the interface level, allowing them to focus solely on the data they require without needing to understand how other target businesses are implemented. Providing these services to customers as SaaS products simplifies their operations, eliminating their need to know how the service is delivered.

[0098] According to a second aspect of the present invention, a method for implementing a business logic process is provided.

[0099] Figure 5 This is a schematic diagram of the main flow of a method for developing business logic processes according to an embodiment of the present invention. Figure 5 As shown, the method for developing business logic processes according to an embodiment of the present invention mainly includes the following steps S501 to S503.

[0100] Step S501: In response to receiving the target business requirement, obtain the target business logic of the target business requirement; the target business logic of the target requirement is obtained by using the method described in the first aspect of the present invention; the attribute tags of each logical node in the target business logic include: the node tag and logical method of the logical node, and the node tag of the logical node on which it depends.

[0101] According to a possible embodiment of the present invention, based on the received target business requirements, the target business logic of the target business requirements is obtained using the method described in the first aspect of the present invention. As described in the first aspect of the present invention, the attribute tags of the logic nodes in the target business logic include node tags and logic methods. The specific implementation content of obtaining the target business logic and the specific implementation content of the logic nodes have been described in detail in the above-described method for developing business logic processes, and therefore will not be repeated here.

[0102] Step S502: Sort each logical node in the target business logic according to the node label of each logical node and the node labels of the logical nodes it depends on.

[0103] The node labels of logical nodes reflect the dependencies between them. These dependencies indicate that some logical nodes require the results of other logical nodes as input before they can be executed, thus determining the execution order. In practical applications, the order of each logical node can be directly written in the code. However, this requires modifying the fixed order in the code every time a logical node changes. Alternatively, an algorithm can automatically sort the logical nodes, eliminating the need to modify the sorting code even if logical nodes are added or modified.

[0104] According to a possible embodiment of the present invention, the logical nodes in the target business logic are sorted according to the node label of each logical node in the target business logic and the node labels of the logical nodes they depend on, including: for the first logical node in the target business logic that only depends on external input parameters, the weight of the first logical node is reset to an initial value; for each other logical node in the target business logic other than the first logical node, the sum of the weights of all logical nodes that the other logical nodes depend on is determined according to the weight of each logical node that the other logical nodes depend on, and the weights of the other logical nodes are reset to a value greater than the sum of the weights; and the logical nodes in the target business logic are arranged in ascending order of weight.

[0105] For logical nodes that only contain external input parameters and not parameters transmitted by other logical nodes, their weights are set to a uniform initial value to facilitate the weight calculation of other logical nodes. Besides these logical nodes, other logical nodes need to calculate the sum of the weights of their dependent logical nodes, and the weights of other logical nodes are set to a value greater than this sum. Based on dependencies, the weights of logical nodes can be automatically calculated, freeing developers from frequently rearranging the order of logical nodes and allowing them to focus more on the division of logical nodes and the operations they contain, thus improving development efficiency.

[0106] Figure 6 This is a schematic diagram of the main process for sorting logical nodes according to another applicable embodiment of the present invention. Figure 6As shown, the dependencies of logical nodes are as follows: logical node D depends on logical nodes E, F, G, and H; logical node E depends on logical node G; logical node F depends on external input parameter X; logical node G depends on logical nodes F and H; and logical node H depends on logical node F. In the logical weight (W) calculation process 601, logical node F, as a logical node that only depends on external input parameter X, has its weight W(F) set to 1. The initial weight of a logical node that only depends on external input parameter X can be set to any value. To facilitate the subsequent weight calculation of other logical nodes, it can be set to a value greater than or equal to zero. Except for logical node F, all other logical nodes can calculate their own weight by adding a value m to the logical weights of the logical nodes they depend on. The value m is a value independent of the logical node and its dependencies; it can be a positive rational number, i.e., a positive integer or a positive decimal. The value m ensures that the weight of a logical node is greater than the sum of the weights of its dependent logical nodes, avoiding situations where logical nodes have equal weights and facilitating the sorting of logical nodes. By automatically calculating the weights of logical nodes, developers can save time and improve development efficiency.

[0107] According to another possible embodiment of the present invention, the numerical value m can be set as an incrementing variable, and the numerical value m is incremented according to the calculated number of weights of the logical nodes. For example, the dependency of the logical nodes is as follows: Figure 6 As shown, the initial value of the value m is set to 1. First, logical node F is calculated. Since the value m is not used in the calculation process, no increment operation is required for m. Then, based on the dependencies between logical nodes, the weights of logical nodes H, G, E, and D are calculated sequentially. After each calculation of the weight of a logical node using the value m, m is incremented by 2. That is, after calculating the weights of logical nodes H, G, E, and D, the value m equals 3, 5, 7, and 9, respectively. The purpose of using the value m is to ensure that the weight of a logical node is greater than the sum of the weights of its dependent logical nodes. This is only an example, and no restrictions are placed on the initial value of m or the increment of m each time.

[0108] In another embodiment, the number of iterations traversing the logical node is used as the value of m, such as... Figure 6As shown in step 602, the logical weight calculation process starts from 0. In each iteration, the value m increments by 1. In iteration 0, the weight of logical node F is calculated, and m equals 0; in iteration 1, the weight of logical node H is calculated, and m equals 1; in iteration 2, the weight of logical node G is calculated, and m equals 2; in iteration 3, the weight of logical node E is calculated, and m equals 3; in iteration 4, the weight of logical node H is calculated, and m equals 4. The purpose is to ensure that the weight of a logical node is greater than the sum of the weights of its dependent logical nodes. Increasing m sequentially avoids situations where the weights of logical nodes are equal, thus improving the efficiency of automatic sorting.

[0109] According to another possible embodiment of the present invention, only the value m in the weight calculation of logical nodes that depend on one logical node can be retained, while the value m in the weight calculation formulas of other logical nodes can be removed. For example, in the logical weight (W) calculation process 603, the value m is only added when calculating the weights of logical nodes E and H. This is to ensure that the weights of logical nodes E and H are greater than the weights of their dependent logical nodes. When calculating the weights of other logical nodes that depend on multiple logical nodes (logical node D, logical node G), it is not necessary to add the value m, and it can still be ensured that their weights are greater than the weights of their dependent logical nodes. This facilitates the sorting of logical nodes according to their weights.

[0110] According to a possible embodiment of the present invention, sorting each logical node in the target business logic based on the node label of each logical node and the node labels of the logical nodes it depends on, further includes: initializing a weight mapping with empty content; traversing each logical node in the target business logic starting from the first logical node in the target business logic to determine the weight of the corresponding logical node, writing the determined weight and the corresponding node label into the weight mapping, and then determining whether the number of records in the weight mapping is equal to the number of logical nodes in the target business logic; and issuing an abnormal alarm if the number of traversals is greater than the number of logical nodes in the target business logic.

[0111] Weight mapping is used to store the node labels and weights of logical nodes, facilitating the calculation of the weights of other logical nodes. According to a possible embodiment of the present invention, when traversing logical nodes, logical nodes that depend only on external input parameters are first identified, such as... Figure 6 In the context of logical nodes, calculate the weight of logical node F and save its node label and corresponding weight; then, based on the logical nodes whose weights have been calculated, find logical nodes whose weights can be calculated, such as... Figure 6After obtaining the weight of logical node F, the algorithm calculates and saves the weight of logical node H that depends only on logical node F. This process is repeated. After obtaining each weight, the algorithm checks whether the number of records in the weight mapping is equal to the number of logical nodes in the target business logic. If they are equal, the traversal ends.

[0112] Furthermore, when updating and iterating existing business processes, in addition to reusing existing logical nodes, the weight mapping obtained based on the existing logical nodes and their dependencies can also be reused. For example, the dependency situation of logical nodes divided according to the new business logic process can be used to... Figure 6 The dependencies between logical nodes are similar, except that logical node I is added, and logical node I depends on logical node D. Therefore, if we want to calculate the weight of the logical nodes divided by the new business logic process, we can reuse [the existing logic]. Figure 6 The weight mapping in the code is then used, and the weight mapping result of logical node I is added on top of that. By reusing the weight mapping, the sorting speed of logical nodes in similar business processes can be improved.

[0113] According to another possible embodiment of the present invention, when traversing logical nodes, the logical nodes in the logical node set are randomly traversed. It is determined whether the weight of the logical node can be calculated based on the weight mapping and external input parameters. If the weight can be calculated, the logical node and its corresponding weight are saved; otherwise, the next logical node is traversed. If the weight of the current logical node has been calculated or cannot be calculated, the logical node is skipped. After obtaining each weight, it is determined whether the number of records in the weight mapping is equal to the number of logical nodes in the target business logic. If they are equal, the traversal ends; if they are not equal, the logical nodes in the logical node set are traversed again. For example, as shown... Figure 6 As shown, the set of logical nodes with logical nodes D, E, F, G, and H is sorted. Based on the initial order of the logical nodes, the traversal starts from logical node D. In the first round of traversal, logical nodes D and E cannot calculate their own weights because they lack the weights of their dependent logical nodes. Logical node F, however, depends on external input parameters, so its weight can be calculated. After calculating the weight of logical node F, logical node F and its weight are saved to the weight mapping. At this point, the weight mapping has 1 record, which is not equal to the number of logical nodes, so the logical node set is traversed again. The second round of traversal again starts from logical node D until the weight of logical node H is calculated. The result is obtained, and logical node H and its weight are saved to the weight mapping. At this point, the weight mapping has 2 records, which is not equal to the number of logical nodes, so the logical node set is traversed again. This process continues until, after five rounds of traversal, the weight mapping has 5 records, which is equal to the number of logical nodes, indicating that the sorting of the logical nodes is complete.

[0114] When the number of iterations exceeds the number of logical nodes in the target business logic, it indicates a circular dependency anomaly, meaning that logical nodes depend on each other. In this case, the weight of the corresponding logical nodes cannot be calculated, and an anomaly alert needs to be issued to remind the developer or module configurer to modify the module relationships. By comparing the number of iterations with the number of logical nodes in the target business logic, abnormal dependencies between logical nodes can be effectively identified, helping developers to correct errors in a timely manner.

[0115] Step S503: Based on the sorting result and the logical method of each logical node in the target business logic, execute each logical node in the target business logic in sequence to obtain the response result corresponding to the target business requirements.

[0116] According to a possible embodiment of the present invention, based on the sorting result and the logical method of each logical node in the target business logic, each logical node in the target business logic is executed sequentially, including: initializing a result mapping, the result mapping including the node label and output parameter result of each logical node in the target business logic; for the first logical node in the target business logic that only depends on external input parameters, determining the output parameter result of the first logical node based on the external input parameters and the logical method of the first logical node, and updating the result mapping; for each other logical node in the target business logic other than the first logical node, obtaining the output parameter data of each logical node that the other logical node depends on from the result mapping, determining the output parameter data of the other logical nodes based on the obtained output parameter data and the logical methods of the other logical nodes, and updating the result mapping; after determining the output parameter results of all logical nodes in the target business logic, encapsulating the result mapping to obtain the response result corresponding to the target business requirement.

[0117] According to another possible embodiment of the present invention, if the sorting result and the method of each logical node in the target business logic are based on the saved sorting result, new logical nodes and methods are added, then the saved result mapping can be reused. Based on the reused result mapping, the logical method of the new logical node is executed, and the node label of the new logical node and its output parameter result are saved to the reused result mapping.

[0118] By encapsulating result mapping, the corresponding results of the target business can be simplified, making it easier for other target businesses to call the response results of the target business, reducing the coupling between target businesses and other target businesses, and reducing the corresponding code logic; and if the original business logic process is extended, the result mapping of the original business logic process can be reused, avoiding repeated execution of logic nodes, which helps to improve execution efficiency.

[0119] According to a third aspect of the present invention, an apparatus for developing business logic processes is provided.

[0120] Figure 7 This is a schematic diagram of the main modules of an apparatus for developing business logic processes according to an embodiment of the present invention, such as... Figure 7 As shown, the device 700 for developing the business logic process mainly includes:

[0121] The business logic process decomposition module 701 is used to decompose the business logic process of the target business to obtain a set of logical nodes including multiple logical nodes.

[0122] The logical node attribute label determination module 702 is used to determine the attribute label of a logical node based on the input and output parameters of each logical node in the logical node set. The attribute label includes: the node label and logical method of the logical node, as well as the node label of the logical nodes it depends on.

[0123] The logical node combination module 703 is used to combine some or all of the logical nodes in the logical node set according to the first business requirement of the target business to obtain the business logic that meets the first business requirement.

[0124] According to a possible embodiment of the present invention, combining some or all of the logical nodes in the logical node set according to the first business requirement of the target business includes: mapping some or all of the logical nodes in the logical node set onto the page, and combining the logical nodes on the page according to the first business requirement of the target business.

[0125] According to another possible embodiment of the present invention, the business logic process development apparatus 700 further includes: a logic node adding module, configured to add a new logic node to the logic node set in response to a second business requirement of the target business, determine the attribute label of the new logic node; and combine some or all of the logic nodes in the updated logic node set according to the second business requirement to obtain business logic that satisfies the second business requirement.

[0126] According to another possible embodiment of the present invention, the logical node combination module 703 is further configured to: encapsulate business logic that meets business requirements into a data interface, or encapsulate business logic that meets business requirements into a SaaS product service.

[0127] It should be noted that the specific implementation details of the device for developing business logic processes described in the embodiments of the present invention have been described in detail in the above-described method for developing business logic processes, so the details will not be repeated here.

[0128] According to a fourth aspect of the present invention, an apparatus for implementing a business logic process is provided.

[0129] Figure 8This is a schematic diagram of the main modules of an apparatus for implementing business logic flow according to an embodiment of the present invention, such as... Figure 8 As shown, the device 800 for implementing the business logic process mainly includes:

[0130] The business logic acquisition module 801 is used to acquire the target business logic of the target business requirement in response to receiving the target business requirement. The target business logic of the target business requirement is obtained by using the above-mentioned business logic process development method. The attribute tags of each logical node in the target business logic include: the node tag and logical method of the logical node, as well as the node tags of the logical nodes it depends on.

[0131] The logical node sorting module 802 is used to sort the logical nodes in the target business logic according to the node label of each logical node and the node labels of the logical nodes it depends on.

[0132] The logic node execution module 803 is used to sequentially execute each logic node in the target business logic according to the sorting result and the logic method of each logic node in the target business logic, so as to obtain the response result corresponding to the target business requirements.

[0133] According to a possible embodiment of the present invention, sorting the logical nodes in the target business logic based on the node label of each logical node and the node labels of the logical nodes it depends on includes:

[0134] For the first logical node in the target business logic that only depends on external input parameters, reset the weight of the first logical node to its initial value; for each other logical node in the target business logic other than the first logical node, determine the sum of the weights of all logical nodes that the other logical node depends on based on the weight of each logical node that the other logical node depends on, and reset the weight of the other logical node to a value greater than the sum of the weights.

[0135] Arrange the logical nodes in the target business logic in ascending order of weight.

[0136] According to another possible embodiment of the present invention, sorting the logical nodes in the target business logic based on the node label of each logical node and the node labels of the logical nodes it depends on further includes:

[0137] Initialize the weight mapping with empty content; start from the first logical node in the target business logic and traverse each logical node in the target business logic to determine the weight of the corresponding logical node. Write the determined weight and the corresponding node label into the weight mapping, and then determine whether the number of records in the weight mapping is equal to the number of logical nodes in the target business logic; if the number of traversals is greater than the number of logical nodes in the target business logic, generate an exception alarm.

[0138] According to another possible embodiment of the present invention, based on the sorting result and the logical method of each logical node in the target business logic, the logical nodes in the target business logic are executed sequentially, including:

[0139] Initialize the result mapping, which includes the node label and output parameter results of each logical node in the target business logic;

[0140] For the first logical node in the target business logic that only depends on external input parameters, determine the output parameter result of the first logical node based on the external input parameters and the logical method of the first logical node, and update the result mapping.

[0141] For each logical node in the target business logic other than the first logical node, obtain the output parameter data of each logical node that the other logical node depends on from the result mapping. Based on the obtained output parameter data and the logical methods of other logical nodes, determine the output parameter data of the other logical nodes and update the result mapping.

[0142] After determining the output parameters of all logical nodes in the target business logic, the result mapping is encapsulated to obtain the response result corresponding to the target business requirements.

[0143] It should be noted that the specific implementation details of the device for implementing the business logic process described in the embodiments of the present invention have been described in detail in the above-described method for implementing the business logic process, so the details will not be repeated here.

[0144] According to the technical solution of this invention, by decomposing the business logic process, the resulting logical nodes can satisfy the "single responsibility principle" in software design, reducing factors that cause changes to logical nodes, thereby avoiding modifications to logical nodes and affecting existing functions when adding new business logic. Simultaneously, logical nodes are reusable and not limited to implementing only one business logic process. Combining logical nodes according to different business needs can yield business logic that meets diverse requirements. New logical nodes can be added and combined with existing ones to implement new business logic, thus avoiding a large-scale increase in repetitive code. Setting node labels in logical nodes based on their input and output parameters clearly identifies the dependencies between logical nodes, reducing unnecessary code logic and preventing a significant increase in code complexity. Automatic sorting of logical nodes based on their labels allows developers to focus only on the inputs and outputs required by each logical node during development, eliminating the need to reorganize the code execution order and improving development efficiency.

[0145] According to a fifth aspect of the present invention, an electronic device for task allocation is provided, comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the present invention.

[0146] According to a sixth aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method provided in the first aspect of the present invention.

[0147] Figure 9 An exemplary system architecture 900 is shown, which can be used to develop or implement a business logic process according to embodiments of the present invention.

[0148] like Figure 9 As shown, system architecture 900 may include terminal devices 901, 902, and 903, network 904, and server 905. Network 904 is used as a medium to provide a communication link between terminal devices 901, 902, and 903 and server 905. Network 904 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.

[0149] Users can use terminal devices 901, 902, and 903 to interact with server 905 via network 904 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 901, 902, and 903, such as software development applications, software testing applications, search applications, instant messaging tools, email clients, social media platforms, etc. (for example only).

[0150] Terminal devices 901, 902, and 903 can be various electronic devices with displays that support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0151] Server 905 can be a server providing various services, such as a backend management server (for example only) supporting business logic process development requests for the target business sent by upstream terminal devices 901, 902, and 903. The backend management server can decompose the business logic process of the target business into a set of logical nodes containing multiple logical nodes; determine the attribute tags of each logical node based on its input and output parameters; the attribute tags include: the node label and logical method of the logical node, as well as the node labels of the logical nodes it depends on; combine some or all of the logical nodes in the logical node set according to the first business requirement of the target business to obtain the business logic that satisfies the first business requirement; and feed back the business logic process development progress and results (for example only) to the terminal devices.

[0152] It should be noted that the method for developing or implementing the business logic process provided in this embodiment of the invention is generally executed by server 905, and correspondingly, the apparatus for developing or implementing the business logic process is generally located in server 905. The method for developing or implementing the business logic process provided in this embodiment of the invention can also be executed by terminal devices 901, 902, and 903, and correspondingly, the apparatus for developing or implementing the business logic process can be located in terminal devices 901, 902, and 903.

[0153] It should be understood that Figure 9 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0154] The following is for reference. Figure 10 It shows a schematic diagram of the structure of a computer system 1000 suitable for implementing a terminal device of the present invention. Figure 10 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0155] like Figure 10As shown, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage section 808 into a random access memory (RAM) 1003. The RAM 1003 also stores various programs and data required for the operation of the system 1000. The CPU 1001, ROM 1002, and RAM 1003 are interconnected via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0156] The following components are connected to I / O interface 1005: an input section 1006 including a keyboard, mouse, etc.; an output section 1007 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to I / O interface 1005 as needed. A removable medium 1011, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 1010 as needed so that computer programs read from it can be installed into storage section 1008 as needed.

[0157] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1009, and / or installed from removable medium 1011. When the computer program is executed by central processing unit (CPU) 1001, it performs the functions defined in the system of the embodiments of this invention.

[0158] It should be noted that the computer-readable medium shown in the embodiments of the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the embodiments of the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the embodiments of the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0159] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer programs according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0160] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor. For example, a processor can be described as including a business logic acquisition module, a logical node sorting module, and a logical node execution module. The names of these modules do not necessarily limit the module itself; for example, the logical node sorting module can also be described as "a module that sorts logical nodes according to their dependencies."

[0161] In another aspect, embodiments of the present invention also provide a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the device, the device implements the following method: decomposing the business logic flow of a target service to obtain a set of logical nodes including multiple logical nodes; determining the attribute tags of the logical nodes based on the input and output parameters of each logical node in the set of logical nodes; the attribute tags include: the node tag and logical method of the logical node, and the node tags of the logical nodes it depends on; and combining some or all of the logical nodes in the set of logical nodes according to the first business requirement of the target service to obtain business logic that satisfies the first business requirement.

[0162] Alternatively, the device can implement the following method: In response to receiving a target business requirement, obtain the target business logic of the target business requirement; the target business logic of the target business requirement is obtained using the above-mentioned business logic flow development method; the attribute tags of each logical node in the target business logic include: the node tag and logical method of the logical node, and the node tags of the logical nodes it depends on; sort each logical node in the target business logic according to the node tag of each logical node in the target business logic and the node tags of the logical nodes it depends on; according to the sorting result and the logical method of each logical node in the target business logic, execute each logical node in the target business logic in sequence to obtain a response result corresponding to the target business requirement.

[0163] According to the technical solution of this invention, by decomposing the business logic process, the resulting logical nodes can satisfy the "single responsibility principle" in software design, reducing factors that cause changes to logical nodes, thereby avoiding modifications to logical nodes and affecting existing functions when adding new business logic. Simultaneously, logical nodes are reusable and not limited to implementing only one business logic process. Combining logical nodes according to different business needs can yield business logic that meets diverse requirements. New logical nodes can be added and combined with existing ones to implement new business logic, thus avoiding a large-scale increase in repetitive code. Setting node labels in logical nodes based on their input and output parameters clearly identifies the dependencies between logical nodes, reducing unnecessary code logic and preventing a significant increase in code complexity. Automatic sorting of logical nodes based on their labels allows developers to focus only on the inputs and outputs required by each logical node during development, eliminating the need to reorganize the code execution order and improving development efficiency.

[0164] The specific embodiments described above do not constitute a limitation on the scope of protection of the embodiments of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the embodiments of the present invention should be included within the scope of protection of the embodiments of the present invention.

Claims

1. A method for implementing business logic processes, characterized in that, include: In response to receiving a target business requirement, the target business logic of the target business requirement is obtained; The attribute tags of each logical node in the target business logic include: the node tag and logical method of the logical node, as well as the node tags of the logical nodes it depends on. For the first logical node in the target business logic that only depends on external input parameters, reset the weight of the first logical node to its initial value; for each other logical node in the target business logic other than the first logical node, determine the sum of the weights of all logical nodes that the other logical node depends on based on the weight of each logical node that the other logical node depends on, and reset the weight of the other logical node to a value greater than the sum of the weights; arrange the logical nodes in the target business logic in ascending order of weight; Based on the sorting results and the logical methods of each logical node in the target business logic, each logical node in the target business logic is executed sequentially to obtain a response result corresponding to the target business requirement. The target business logic of the target business requirement is obtained using the following method: the business logic flow of the target business is broken down to obtain a set of logical nodes including multiple logical nodes; the attribute tags of the logical nodes are determined according to the input and output parameters of each logical node in the set of logical nodes; the attribute tags include: the node tag and logical method of the logical node, and the node tags of the logical nodes it depends on; according to the first business requirement of the target business, some or all of the logical nodes in the set of logical nodes are combined to obtain the business logic that satisfies the first business requirement.

2. The method according to claim 1, characterized in that, Based on the node label of each logical node in the target business logic and the node labels of the logical nodes it depends on, the logical nodes in the target business logic are sorted, which also includes: Initialize a weight mapping with empty content; starting from the first logical node in the target business logic, traverse each logical node in the target business logic to determine the weight of the corresponding logical node, write the determined weight and the corresponding node label into the weight mapping, and then determine whether the number of records in the weight mapping is equal to the number of logical nodes in the target business logic; if the number of traversals is greater than the number of logical nodes in the target business logic, issue an exception alarm.

3. The method according to claim 1, characterized in that, Based on the sorting results and the logical methods of each logical node in the target business logic, execute each logical node in the target business logic sequentially, including: Initialize the result mapping, which includes the node label and output parameter results of each logical node in the target business logic; For the first logical node in the target business logic that only depends on external input parameters, determine the output parameter result of the first logical node based on the external input parameters and the logical method of the first logical node, and update the result mapping; For each logical node in the target business logic other than the first logical node, obtain the output parameter data of each logical node that the other logical node depends on from the result mapping. Based on the obtained output parameter data and the logical methods of the other logical nodes, determine the output parameter data of the other logical nodes and update the result mapping. After determining the output parameters of all logical nodes in the target business logic, the result mapping is encapsulated to obtain the response result corresponding to the target business requirement.

4. The method according to claim 1, characterized in that, Based on the first business requirement of the target business, some or all of the logical nodes in the logical node set are combined, including: Map some or all of the logical nodes in the set of logical nodes onto the page, and combine the logical nodes on the page according to the first business requirement of the target business.

5. The method according to claim 1, characterized in that, After obtaining a set of logical nodes that includes multiple logical nodes, the method further includes: In response to the second business requirement of the target business, a new logical node is added to the logical node set, and the attribute label of the new logical node is determined; according to the second business requirement, some or all of the logical nodes in the updated logical node set are combined to obtain the business logic that satisfies the second business requirement.

6. The method according to claim 1 or 5, characterized in that, After obtaining the business logic that meets the business requirements, the method further includes: Encapsulate business logic that meets business needs into data interfaces, or encapsulate business logic that meets business needs into SaaS product services.

7. An apparatus for implementing business logic processes, characterized in that, include: The business logic acquisition module is used to acquire the target business logic of the target business requirement in response to receiving the target business requirement. The attribute tags of each logical node in the target business logic include: the node tag and logical method of the logical node, as well as the node tags of the logical nodes it depends on. The logical node sorting module is used to sort each logical node in the target business logic according to the node label of each logical node and the node labels of the logical nodes it depends on. The logic node execution module is used to sequentially execute each logic node in the target business logic according to the sorting result and the logic method of each logic node in the target business logic, so as to obtain the response result corresponding to the target business requirement. The target business logic of the target business requirement is obtained using the following method: the business logic flow of the target business is broken down to obtain a set of logical nodes including multiple logical nodes; the attribute tags of the logical nodes are determined according to the input and output parameters of each logical node in the set of logical nodes; the attribute tags include: the node tag and logical method of the logical node, and the node tags of the logical nodes it depends on; according to the first business requirement of the target business, some or all of the logical nodes in the set of logical nodes are combined to obtain the business logic that satisfies the first business requirement.

8. An electronic device, characterized in that, include: One or more processors; Storage device, used to store one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-6.

9. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-6.