Calculation type management method based on rule engine and terminal

By splitting the calculation rules into target fields and unit calculation logic and encapsulating them into field logic components, the poor flexibility and maintenance problems caused by the integration of computing logic in the prior art are solved, and flexible computing rules management and efficient system maintenance are achieved.

CN119512540AInactive Publication Date: 2025-02-25FUJIAN EASTWEST LIFEWIT TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510088819.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2025-02-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, the integration of computing logic makes it difficult to adapt to scenarios where business changes are frequent and changeable, and maintenance and optimization are difficult, and reusability is lacking.

Method used

The calculation management method based on the rules engine is adopted to split the complete calculation rules into atomic-level target fields and unit calculation logic, encapsulate them into field logic components, and store and manage the component identification to achieve flexible calculation rules configuration.

Benefits of technology

It realizes flexible management of calculation rules, reduces the complexity of rule scripts, allows some calculation logic to be adjusted without changing the entire calculation process, and improves the flexibility and maintainability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512540A_ABST
    Figure CN119512540A_ABST
Patent Text Reader

Abstract

The invention discloses a rule engine-based computational management method and terminal, and the method comprises the steps: receiving a field logic component generation request, and obtaining a target field and computational logic according to the field logic component generation request; packaging calculation logic and a target field into a field logic component according to a calculation requirement of the target field; generating a component identifier of the field logic component, and storing the component identifier and the field logic component into a database; receiving a calculation rule, and according to the calculation rule, compiling a rule script by the field logic component through the component identifier; and storing the rule script in a rule script library. According to the method, the appropriate component identifier can be directly selected according to the function of the field logic component to generate the script, the script does not need to be written for the whole calculation process, when some parts need to be adjusted, only the field logic component at the corresponding position needs to be adjusted, and the execution logic in the whole script does not need to be adjusted; and more flexible calculation rule management is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer software, and in particular to a calculation management method and terminal based on a rule engine. Background Art

[0002] In existing business systems or financial management systems, the calculation of statistical data is an important part of data presentation. For the original data content, in order to better explore the relationship between data, provide data support for future decision-making or reduce the workload of financial personnel, corresponding calculation components are configured for direct call by relevant personnel; but these components are too basic, such as the statistical data calculation functions that come with various types of software. If personalized data content is needed, personnel still need to write them separately; and some calculation logics are too integrated. For example, the company's salary calculation plan or profit calculation plan is usually automatically calculated in the software as a whole. If some parts of it need to be changed, the specific software implementation also needs to rewrite the related steps, which cannot adapt to changing business changes.

[0003] In the process of implementing the calculation plan, the internal calculation logic is usually implemented in an integrated manner, that is, a series of calculation steps are put into a complete calculation plan in a fixed order. This method has a high degree of coupling between the steps, and with the development of the company's scale and technology, the calculation logic will also become more complicated. The integrated calculation plan is complex to adjust when the calculation rules change, and it is difficult to adapt to scenarios with frequent and changing business changes. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a calculation management method and terminal based on a rule engine to achieve flexible configuration of calculation rules.

[0005] In order to solve the above technical problems, a technical solution adopted by the present invention is: A computational management method based on a rule engine, comprising the steps of: Receive a request generated by a field logic component, and obtain a target field and a calculation logic according to the request generated by the field logic component; Encapsulating the calculation logic and the target field into a field logic component according to the calculation requirements of the target field; Generate a component identifier of the field logic component, and store the component identifier and the field logic component in a database; Receiving a calculation rule, and writing a rule script according to the calculation rule, a field logic component and a component identifier; The rule script is stored in a rule script library.

[0006] In order to solve the above technical problems, another technical solution adopted by the present invention is: A computing management terminal based on a rule engine comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: Receive a request generated by a field logic component, and obtain a target field and a calculation logic according to the request generated by the field logic component; Encapsulating the calculation logic and the target field into a field logic component according to the calculation requirements of the target field; Generate a component identifier of the field logic component, and store the component identifier and the field logic component in a database; Receiving a calculation rule, and writing a rule script according to the calculation rule, a field logic component and a component identifier; The rule script is stored in a rule script library.

[0007] The beneficial effects of the present invention are: splitting the complete calculation rules into atomic-level target fields and unit calculation logic, the target fields represent the fields that may be used in the calculation process, the unit calculation logic and the calculation process that may be involved in the calculation process; according to the calculation requirements that the target fields may correspond to, the target fields and the unit calculation logic are combined and encapsulated into field logic components, that is, the operations in the unit calculation logic are executed on the corresponding target fields, and the field logic components and the corresponding component identifiers are stored in the database. When generating the script corresponding to the calculation rules, the appropriate component identifier can be directly selected according to the function of the field logic component to generate the script without writing the script for the entire calculation process. When some parts need to be adjusted, only the field logic components at the corresponding positions need to be adjusted without adjusting the execution logic in the entire script, thereby achieving more flexible calculation rule management. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] Figure 1 is a flowchart of the steps of the method according to an embodiment of the present invention; Figure 2 This is an implementation architecture diagram of a rule engine-based computational management method according to an embodiment of the present invention; Figure 3 A schematic diagram of a target field association information storage method according to an embodiment of the present invention; Figure 4 Another step flow chart of a rule engine-based computational management method according to an embodiment of the present invention; Figure 5 is a schematic diagram of the structure of a terminal according to an embodiment of the present invention; Description of labels: 1. A computing management terminal based on a rule engine; 2. A processor; 3. A memory. DETAILED DESCRIPTION

[0009] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in conjunction with the implementation modes and the accompanying drawings.

[0010] Please refer to Figure 1 , a computational management method based on a rule engine, comprising the steps of: Get the target field and unit calculation logic; Encapsulating the calculation logic and the target field into a field logic component according to the calculation requirements of the target field; Generate a component identifier of the field logic component, and store the component identifier and the field logic component in a database; A calculation rule is received, and a rule script is written according to the calculation rule, the field logic component and the component identifier.

[0011] From the above description, it can be seen that the beneficial effects of the present invention are: splitting the complete calculation rules into atomic-level target fields and unit calculation logic, the target field represents the fields that may be used in the calculation process, the unit calculation logic and the calculation process that may be involved in the calculation process; according to the calculation requirements that the target field may correspond to, the target field and the unit calculation logic are combined and encapsulated into a field logic component, that is, the operations in the unit calculation logic are executed on the corresponding target field, and the field logic component and the corresponding component identifier are stored in the database. When generating the script corresponding to the calculation rule, the appropriate component identifier can be directly selected according to the function of the field logic component to generate the script without writing a script for the entire calculation process. When some parts need to be adjusted, only the field logic component at the corresponding position needs to be adjusted without adjusting the execution logic in the entire script, thereby realizing more flexible calculation rule management.

[0012] Further, encapsulating the calculation logic and the target field into a field logic component according to the calculation requirements of the target field includes: At least one of the calculation logics and one of the target fields are encapsulated as a field logic component according to the calculation requirements of the target field.

[0013] From the above description, it can be seen that each field logic component is associated with only one target field. That is, when the target field is needed, all field logic components associated with the target field can be obtained by searching the corresponding target field, which is convenient for finding the required field logic components during script writing.

[0014] Further, the generating the component identification of the field logic component includes: The field identifier of the target field associated with the field logic component is obtained, and the component identifier of the field logic component is generated according to the field identifier.

[0015] From the above description, it can be seen that when generating a component identifier, it is generated in combination with the field identifier of the target field. Then, the information of the target field included therein can be intuitively obtained through the component identifier, which facilitates the correspondence between the field logic component and the target field therein.

[0016] Furthermore, storing the component identifier and the field logic component in a database includes: storing the name of the target field associated with the field logic component and the component identifier in the field configuration information; The field logic components and the component identifications are stored in a component database.

[0017] From the above description, it can be seen that the name and component identifier of the target field are stored in the field configuration information, which is convenient for viewing during the script writing process; the field logic component itself and the component identifier are associated and stored in the component database, which is convenient for the subsequent rule engine to parse the field logic component and directly search the component database for component execution.

[0018] Furthermore, it also includes field types, wherein the field types include calculation input parameter fields, calculation result fields, and configuration information fields; The receiving calculation rules and writing the rule script according to the calculation rules and the field logic components with the component identifiers include: Receive a calculation rule, and obtain a first target field having the same meaning as the undetermined field in the calculation rule; Obtain a first field identifier and a first field type of the first target field, and obtain a first component identifier associated with the first field identifier; Acquire a first field logic component according to the first component identifier; The first field logic components are arranged in the order of calculation input parameter fields, configuration information fields and calculation result fields to obtain a rule script.

[0019] From the above description, it can be seen that the target field is further classified into different field types. The field types include calculation input parameter fields, calculation result fields, and configuration information fields. Because the same target field may match different logical components when used as different field types, for example, if the length of a rectangle needs to be calculated based on its perimeter and width, the length is used as the calculation result field, and only the output format needs to be verified, such as whether it is a positive integer; if the perimeter of a rectangle is calculated based on its length and width, the length is used as the calculation input parameter field, and whether it is non-empty and whether it is a positive integer needs to be verified. The corresponding steps of the two are different, and the matched logical components are different. The characteristics of the same field participating in different calculation processes in different calculation scenarios are summarized by matching the logical components together with the target field and the field type. In the subsequent process of writing rule scripts, the corresponding components can be matched directly according to the characteristics of the target field in the scenario in a way to determine the field type for direct use; Furthermore, the receiving of the calculation rule and writing the rule script according to the calculation rule and the field logic component with the component identifier include: Parsing the rule script by a rule engine to obtain a component identifier in the rule script; Obtaining the execution order of the components according to the arrangement order of the component identifiers; Acquire a field logic component from the database according to the component identifier; The field logic components are executed according to the execution order to obtain calculation results and output them.

[0020] From the above description, it can be seen that the execution order between steps in the rule script is represented by component identifiers, and component identifiers are used as mappings of field logic components, which can reduce the complexity of the rule script; the obtained field logic components are executed according to the execution order in the script to obtain the calculation results and output them, and the configured script is decoded and executed through the rule engine.

[0021] Please refer to Figure 5 , a computing management terminal based on a rule engine, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: Get the target field and unit calculation logic; Encapsulating the calculation logic and the target field into a field logic component according to the calculation requirements of the target field; Generate a component identifier of the field logic component, and store the component identifier and the field logic component in a database; A calculation rule is received, and a rule script is written according to the calculation rule, the field logic component and the component identifier.

[0022] The beneficial effects of the present invention are: splitting the complete calculation rules into atomic-level target fields and unit calculation logic, the target fields represent the fields that may be used in the calculation process, the unit calculation logic and the calculation process that may be involved in the calculation process; according to the calculation requirements that the target fields may correspond to, the target fields and the unit calculation logic are combined and encapsulated into field logic components, that is, the operations in the unit calculation logic are executed on the corresponding target fields, and the field logic components and the corresponding component identifiers are stored in the database. When generating the script corresponding to the calculation rules, the appropriate component identifier can be directly selected according to the function of the field logic component to generate the script without writing the script for the entire calculation process. When some parts need to be adjusted, only the field logic components at the corresponding positions need to be adjusted without adjusting the execution logic in the entire script, thereby achieving more flexible calculation rule management.

[0023] Further, encapsulating the calculation logic and the target field into a field logic component according to the calculation requirements of the target field includes: At least one of the calculation logics and one of the target fields are encapsulated as a field logic component according to the calculation requirements of the target field.

[0024] From the above description, it can be seen that each field logic component is associated with only one target field. That is, when the target field is needed, all field logic components associated with the target field can be obtained by searching the corresponding target field, which is convenient for finding the required field logic components during script writing.

[0025] Further, the generating the component identification of the field logic component includes: The field identifier of the target field associated with the field logic component is obtained, and the component identifier of the field logic component is generated according to the field identifier.

[0026] From the above description, it can be seen that when generating a component identifier, it is generated in combination with the field identifier of the target field. Then, the information of the target field included therein can be intuitively obtained through the component identifier, which facilitates the correspondence between the field logic component and the target field therein.

[0027] Furthermore, storing the component identifier and the field logic component in a database includes: storing the name of the target field associated with the field logic component and the component identifier in the field configuration information; The field logic components and the component identifications are stored in a component database.

[0028] From the above description, it can be seen that the name and component identifier of the target field are stored in the field configuration information, which is convenient for viewing during the script writing process; the field logic component itself and the component identifier are associated and stored in the component database, which is convenient for the subsequent rule engine to parse the field logic component and directly search the component database for component execution; the component identifier is saved in the field configuration information, and the complete logic component is stored separately in association with the component identifier. When writing the rule script, it can be written only through the component identifier, which reduces the complexity of the rule script, and the complete logic component can be obtained by searching the corresponding library, that is, the complete code is obtained.

[0029] Furthermore, the receiving of the calculation rule and writing the rule script according to the calculation rule and the field logic component with the component identifier include: Parsing the rule script by a rule engine to obtain a component identifier in the rule script; Obtaining the execution order of the components according to the arrangement order of the component identifiers; Acquire a field logic component from the database according to the component identifier; The field logic components are executed according to the execution order to obtain calculation results and output them.

[0030] From the above description, it can be seen that the execution order between steps in the rule script is represented by component identifiers, and component identifiers are used as mappings of field logic components, which can reduce the complexity of the rule script; the obtained field logic components are executed according to the execution order in the script to obtain the calculation results and output them, and the configured script is decoded and executed through the rule engine.

[0031] The existing calculation management method has poor flexibility: the overall calculation logic is relatively fixed and difficult to adapt to business changes and new needs. When it is necessary to fine-tune the profit calculation or add new calculation dimensions, the entire calculation logic may need to be modified on a large scale, which not only increases the workload but also may introduce new errors. Difficult to adapt to changes: Since the profit calculation needs often change and the profit calculation methods of different companies are also different, the profit calculation method is required to be flexible; however, the overall calculation logic is often difficult to respond to these changes quickly, resulting in the inability to obtain accurate profit data in a timely manner. Difficult to maintain and optimize: Since the overall calculation logic involves multiple links and multiple calculation steps, its maintenance and optimization work becomes complicated and cumbersome; once a problem occurs in a certain link, the entire calculation logic may need to be checked and corrected, which not only increases the maintenance cost, but also may affect the timeliness and accuracy of profit calculation. Lack of reusability: The lack of standardized and modular design makes it difficult to be decomposed into reusable components or modules. For software companies, if they need to sell the financial system to different companies, they also need to modify the calculation method separately, which is inefficient.

[0032] The above-mentioned calculation management method and terminal based on rule engine of the present invention can be applied to the scene that needs to manage and adjust the calculation method, such as the calculation of profit and performance. In profit measurement, some calculation rules are often changed as the business changes. The profit measurement method with integrated measurement logic is more complicated and difficult to adapt to such changeable business changes. The following is an explanation through specific implementation methods.

[0033] Please refer to Figure 1-4 , Embodiment 1 of the present invention is: A computational management method based on a rule engine, comprising the steps of: S1. Receive a request generated by a field logic component, and obtain a target field and calculation logic according to the request generated by the field logic component; In an optional implementation, the field type includes a calculation parameter field, a calculation result field, and a configuration information field; wherein the calculation parameter field is a parameter required in the calculation process and is a known item; the calculation result field is a final required calculation result and is an unknown item; the configuration information field is a parameter involved in the calculation process and can be obtained by searching a database table by the calculation parameter field and is a known item; For example, the calculation input fields include a target field with a field identifier of CF01 and a field name of length, a target field with a field identifier of CF02 and a field name of width, and a target field with a field identifier of CF03 and a field name of height; the configuration information field includes a target field with a field identifier of CF04 and a field name of size information configuration, which is the data obtained by querying the size information configuration table according to CF01, CF02 or CF03, and the result is not displayed, but only provided as a supporting field to the calculation result field to obtain data; the size information configuration includes the following size segmentation and size classification, and the corresponding size information can be obtained from the size information configuration table according to length, width and height. The calculation result fields include the target field with the field identifier CF05 and the field name of size segmentation and the target field with the field identifier CF06 and the field name of size classification; the size segmentation is to record the product categories corresponding to different size ranges. For example, if the product is an envelope, the size segment of length <10cm, width <10cm, height <1cm in the size information configuration table is a small envelope, and the size classification is a standard part; the size classification may also include general parts, oversized parts, etc., which will not be repeated here; further, it may also include the target field with the field identifier CF07 and the field name of the product name; The calculation logic is A checks whether it is not empty, B checks whether it must be a positive integer, C obtains the data in the data context according to the parameter (param) object of the input data (data) (which can be expressed as C.data (param object)), and D obtains the information in the database table according to the input parameter in the parameter (param) object of the input data (data) (which can be expressed as D.data (param object)). Then, different information in the database table can be obtained according to the different input parameter fields obtained; S2, encapsulating the calculation logic into a field logic component associated with the target field according to the calculation requirement of the target field, including: encapsulating at least one of the calculation logics into a field logic component associated with one of the target fields according to the calculation requirement of the target field; In an optional implementation, a total computing requirement is obtained, and a target field list is obtained according to the total computing requirement; a computing requirement of each target field in the target field list is obtained; after the computing requirement of each target field is completed, the total computing requirement can be met; If there is a calculation requirement for the target field but no corresponding calculation logic exists, return to step S1 to generate a corresponding field logic component according to the target field and the calculation requirement; Among them, the calculation logic can be encapsulated into the finest-grained component, and S2 can encapsulate at least one finest-grained component into a field logic component associated with a target field according to the calculation requirements of the target field. For different target fields, the encapsulated finest-grained components can be directly obtained to form field logic components, thereby improving the degree of code reuse; For example, the calculation requirement is to obtain the corresponding size segment according to the input length; this includes the target field length, size information configuration (because in the size information configuration table, the size segment and size classification can be directly queried, collectively referred to as size information configuration, size segment and size classification can also be stored in separate tables and can be queried separately, but there will be data redundancy) and size segment; further, the calculation requirements of field identifiers CF01, CF02 and CF03 are all to verify whether they are non-empty and whether they are positive integers, so the calculation logics A and B are encapsulated as being associated with field identifiers CF01, CF02 and CF03 respectively. The field logic component then(A, B) of the field identifier CF04 is then(A, B); the calculation requirement of the field identifier CF04 is to match the size information according to the long match, so the calculation logic D is encapsulated as the field logic component then(D) associated with the field identifier CF04 and the field name as the size information configuration; the calculation requirement of the field identifier CF05 is output display, and the output display process needs to obtain the data calculated by the rule engine from the data context, that is, the corresponding calculation logic is the calculation logic C, so the calculation logic C is encapsulated as the field logic component then(C) associated with the field identifier CF05 and the field name as the size segment; For another example, the calculation requirement is to obtain the corresponding size classification according to the input product name; which includes the target field product name, size information configuration and size classification; further, the calculation requirement of the field identifier CF07 is to verify whether it is not empty, so the calculation logic B is encapsulated as the field logic component then (A) associated with the field identifier CF07; the calculation requirement of the field identifier CF04 is to match the size classification according to the product name, so the calculation logic D is encapsulated as the field logic component then (D) associated with the field identifier CF04; the calculation requirement of the field CF06 is output display, so the calculation logic C is encapsulated as the field logic component then (C) associated with the field identifier CF06, S3. Generate a component identifier of the field logic component, including: Acquire the field identifier of the target field associated with the field logic component, and generate the component identifier of the field logic component according to the field identifier; For example, generate a component identifier CF01C1 corresponding to the field logic component then (A, B) corresponding to the field identifier CF01; generate a component identifier CF02C1 corresponding to the field logic component then (A, B) corresponding to the field identifier CF02; generate a component identifier CF03C1 corresponding to the field logic component then (A, B) corresponding to the field identifier CF03; generate a component identifier CF04C1 corresponding to the field logic component then (D) associated with the field identifier CF04; generate a component identifier CF05C1 corresponding to the field logic component then (C) associated with the field identifier CF05; generate a component identifier CF07C1 corresponding to the field logic component then (B) associated with the field identifier CF07; generate a component identifier CF06C1 corresponding to the field logic component then (C) associated with the field identifier CF06; S4, storing the component identifier and the field logic component in a database, including: S41, storing the field name of the target field associated with the field logic component and the component identifier in the field configuration information library; in an optional implementation, the field identifier and the component identifier of the target field associated with the field logic component may also be stored in the field configuration information library; the field name or the field identifier can uniquely identify the target field; S42, storing the field logic component and the component identifier in a component database; The field logic component here refers to the code of the implementation process corresponding to the field logic component, which is a combination of calculation logic. The code corresponding to the field logic component and the component identifier are stored in the component database, and the correspondence between the component identifier and the field identifier or field name is stored in the field configuration information library. In the process of writing the rule script, the corresponding component identifier can be conveniently matched according to the target field used for use, without filling in the complete original implementation code in the rule script; and the specific implementation code corresponding to the component identifier can be queried through the component database, which is convenient for the correspondence of code functions and the analysis of code identifiers by the rule engine; finally, the specific execution code can be obtained to obtain the final calculation result; S5. Receive a calculation rule, and write a rule script according to the calculation rule and the field logic component with a component identifier, including: S51, receiving a calculation rule, and acquiring a first target field having the same meaning as the undetermined field in the calculation rule; For example, if the calculation rule is to calculate the size segmentation based on the length, width and height, then the fields to be determined are length, width, height, size information configuration and size segmentation. Therefore, for the convenience of example, the field name of the first target field is the same as the field to be determined. In the actual application process, there is a situation where the input calculation rule is different from the field name stored in the target field. Automatic matching can be achieved by pre-storing the field name and the corresponding approximate words, or the corresponding relationship between the field to be determined and the first target field can be determined by manual review. S52: Acquire a first field identifier and a first field type of the first target field, and acquire a first component identifier associated with the first field identifier; For the calculation rule received above, the calculation input fields are length, width and height, and the corresponding field identifiers are CF01, CF02 and CF03; the configuration information field is the size information configuration, and the corresponding field identifier is CF04; the calculation result field is the size segment, and the corresponding field identifier is CF05; directly obtain the corresponding component identifiers CF01C1, CF02C1, CF03C1, CF04C1 and CF05C1 according to the field name or the field identifier; S53, arranging the first component identifier in the order of a calculation parameter field, a configuration information field, and a calculation result field to obtain a rule script; For example, get the rule script then(CF01C1,CF02C1,CF03C1,CF04C1,CF05C1); S55, storing the rule script in the rule script library, so that when the same calculation process is required later, the rules in the rule script library can be directly called for calculation without rewriting the rule script; For example, in addition to calculating the size segmentation based on the input length, width and height, it is also necessary to calculate the size classification, that is, in the rule script then(CF01C1,CF02C1,CF03C1,CF04C1,CF05C1), the display size classification of the size classification CF06 is added as the calculation result field that needs to be obtained in the end, then the component identifier CF06C1 corresponding to CF06 as the calculation result field is obtained and added to the position of the calculation result field of the existing rule script. It is only necessary to match the closest script from the rule script library, and there is no need to configure the rule script from scratch. The updated rule script then(CF01C1,CF02C1,CF03C1,CF0401,CF0501,CF0601) is obtained by adding and subtracting on the basis of the existing rule script; it can be seen that CF0501 and CF0601 will share a most fine-grained component C. There is no need to modify the code to adapt to the iteration of new requirements; S6. Parsing the rule script through a rule engine to obtain component identifiers in the rule script; For example, the rule script is then(CF01C1,CF02C1,CF03C1,CF0401,CF0501), and the parsing includes component identifiers CF01C1, CF02C1, CF03C1, CF0401, and CF0501; In an optional implementation, between S5 and S6, a data context is also constructed to store data generated during the rule engine scheduling process and field configuration information acquired by the field configuration information library; wherein the data generated by the rule engine scheduling includes data of the calculated input parameter field, result data of the calculated result field, configuration result data processed by the calculation process field component, and calculation exception data when a calculation exception occurs; S7, obtaining the execution order of the components according to the arrangement order of the component identifiers; S8. Acquire a field logic component from the database according to the component identifier; The field logic component corresponding to the component identifier CF01C1 is then (A, B) associated with the field identifier CF01; the field logic component corresponding to the component identifier CF02C1 is then (A, B) associated with the field identifier CF02; the field logic component corresponding to the component identifier CF03C1 is then (A, B) associated with the field identifier CF03; the field logic component corresponding to the component identifier CF04C1 is then (D) associated with the field identifier CF04; the field logic component corresponding to the component identifier CF05C1 is then (C) associated with the field identifier CF05; the preset number of digits in the component identifier can be preset to represent the field identifier, so that the field identifier can be matched directly from the component identifier; the field identifier corresponding to the component identifier can also be obtained through the field configuration information library; S9, executing the field logic components according to the execution order to obtain calculation results and outputting them; For example, the field logic components are executed in the order of the component identifiers obtained in the rule script, and the order is then(then(A,B), then(A,B), then(A,B), then(D), then(C)). According to the outer layer of then, then(A,B), then(A,B), then(D), then(C) are executed in sequence. When the first then(A,B) is executed, A and B are executed. The encapsulated code logic is obtained from the component database according to A and B to start the calculation. The value of CF01 can be obtained in the data context, and the value of CF01 is calculated, that is, the non-empty check must be a positive integer. The operations of other then(A,B) are similar. When then(D) is executed, the code corresponding to D is matched from the component database. data({"queryFieldCodeMap": {"long__ge": "CF01","width__ge": "CF02","height__ge": "CF03"}})), the data will be used as an input parameter to execute in the D component, that is, the size configuration information table is queried according to the data length CF01, width CF02, and height CF03 in the queryFieldCodeMap; when executing to then (C), the calculation result data is obtained from the data context according to the component database match and displayed; In an optional implementation, the rule engine executes the field logic component according to the execution order to obtain a calculation result, stores the calculation result in the data context, obtains the calculation result from the data context and outputs it; In an optional implementation, a calculation module is set up, which is responsible for obtaining the rule script text in the rule script library, obtaining the field configuration information, building the data context, calling the rule engine, passing in the rule script file and the data context, and obtaining the calculation result in the data context after the rule engine is executed.

[0034] Please refer to Figure 5 , Embodiment 2 of the present invention is: A computing management terminal 1 based on a rule engine includes a processor 2, a memory 3, and a computer program stored in the memory 3 and executable on the processor 2. When the processor 2 executes the computer program, each step in the first embodiment is implemented.

[0035] In summary, the present invention provides a computational management method and terminal based on a rule engine, which improves the flexibility of rule script settings. Through componentization and the application of a rule engine, the profit measurement method of the present invention can flexibly respond to business changes and the emergence of new demands; when it is necessary to adjust the calculation rules or add new calculation dimensions, it is only necessary to modify or add the corresponding components and rule scripts, without the need to reconstruct the entire measurement logic on a large scale, thereby significantly improving the flexibility and maintainability of the system. It can respond to changes quickly. Since a rule engine is used to parse and execute rule scripts, it can respond quickly to changes in business needs; when business rules change, it is only necessary to update the rule script to achieve the corresponding adjustment of the calculation method, thereby ensuring the timeliness and accuracy of the data. At the same time, it can improve the reusability of the code. Through componentization and standardized design, the calculation logic is encapsulated by the finest granularity components, and each component can be reused by different calculation scenarios; this not only improves the reuse rate of the code, but also accelerates the development and deployment process of new calculation methods, reducing development costs and time costs. Aiming at the shortcomings of the profit estimation methods in the prior art, such as poor flexibility, difficulty in adapting to changes, difficulty in maintenance and optimization, and lack of reusability, a profit estimation method based on a flexible combination of rule engines is proposed. The present invention aims to build a componentized profit estimation system, realize flexible configuration and dynamic adjustment of calculation logic based on the rule engine, so as to meet the diversified needs in different business scenarios.

[0036] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A computational management method based on a rule engine, characterized in that: Includes steps: Receive a request generated by a field logic component, and obtain a target field and a calculation logic according to the request generated by the field logic component; Encapsulating the calculation logic and the target field into a field logic component according to the calculation requirements of the target field; Generate a component identifier of the field logic component, and store the component identifier and the field logic component in a database; Receiving a calculation rule, and writing a rule script according to the calculation rule, a field logic component and a component identifier; The rule script is stored in a rule script library.

2. A computational management method based on a rule engine according to claim 1, characterized in that: The step of encapsulating the calculation logic and the target field into a field logic component according to the calculation requirements of the target field includes: At least one of the calculation logics and one of the target fields are encapsulated as a field logic component according to the calculation requirements of the target field.

3. The computational management method based on rule engine according to claim 1, characterized in that: The generating of the component identification of the field logic component includes: The field identifier of the target field associated with the field logic component is obtained, and the component identifier of the field logic component is generated according to the field identifier.

4. A computational management method based on a rule engine according to claim 3, characterized in that: Also includes field types, the field types include calculation input parameter fields, calculation result fields and configuration information fields; The receiving calculation rules and writing the rule script according to the calculation rules and the field logic components with the component identifiers include: Receive a calculation rule, and obtain a first target field having the same meaning as the undetermined field in the calculation rule; Obtain a first field identifier and a first field type of the first target field, and obtain a first component identifier associated with the first field identifier; The first component identifier is arranged in the order of the calculation input parameter field, the configuration information field and the calculation result field to obtain a rule script.

5. The computational management method based on rule engine according to claim 1, characterized in that: The receiving of the calculation rule and writing the rule script according to the calculation rule and the field logic component with the component identifier include: Parsing the rule script by a rule engine to obtain a component identifier in the rule script; Obtaining the execution order of the components according to the arrangement order of the component identifiers; Acquire a field logic component from the database according to the component identifier; The field logic components are executed according to the execution order to obtain calculation results and output them.

6. A computing management terminal based on a rule engine, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the following steps are implemented: Receive a request generated by a field logic component, and obtain a target field and a calculation logic according to the request generated by the field logic component; Encapsulating the calculation logic and the target field into a field logic component according to the calculation requirements of the target field; Generate a component identifier of the field logic component, and store the component identifier and the field logic component in a database; Receiving a calculation rule, and writing a rule script according to the calculation rule, a field logic component and a component identifier; The rule script is stored in a rule script library.

7. A rule engine-based computing management terminal according to claim 6, characterized in that: The step of encapsulating the calculation logic and the target field into a field logic component according to the calculation requirements of the target field includes: At least one of the calculation logics and one of the target fields are encapsulated as a field logic component according to the calculation requirements of the target field.

8. The rule engine-based computing management terminal according to claim 6, characterized in that: The generating of the component identification of the field logic component includes: The field identifier of the target field associated with the field logic component is obtained, and the component identifier of the field logic component is generated according to the field identifier.

9. A rule engine-based computing management terminal according to claim 8, characterized in that: Also includes field types, the field types include calculation input parameter fields, calculation result fields and configuration information fields; The receiving calculation rules and writing the rule script according to the calculation rules and the field logic components with the component identifiers include: Receive a calculation rule, and obtain a first target field having the same meaning as the undetermined field in the calculation rule; Obtain a first field identifier and a first field type of the first target field, and obtain a first component identifier associated with the first field identifier; The first component identifier is arranged in the order of the calculation input parameter field, the configuration information field and the calculation result field to obtain a rule script.

10. The rule engine-based computing management terminal according to claim 6, characterized in that: The receiving of the calculation rule and writing the rule script according to the calculation rule and the field logic component with the component identifier include: Parsing the rule script by a rule engine to obtain a component identifier in the rule script; Obtaining the execution order of the components according to the arrangement order of the component identifiers; Acquire a field logic component from the database according to the component identifier; The field logic components are executed according to the execution order to obtain calculation results and output them.

Citation Information

Patent Citations

  • Method and device for generating back-line system business logic code based on rule engine

    CN115794115A

  • Rule engine processing method and device, electronic equipment and storage medium

    CN117093619A

  • Business service generation method and device

    CN118626056A

  • Data screening method and device, equipment and medium

    CN119226323A

  • Data acquisition method, device, equipment and storage medium

    WO2020015067A1