Method, system and storage medium for constructing a calculator for amount calculation
By splitting the amount calculation module into independent calculators and adopting a dynamic loading architecture, the problems of poor scalability and difficult maintenance of the amount calculation architecture in the existing technology are solved, and more efficient calculator construction and maintenance are achieved.
Patent Information
- Application Number
- CN202411003749.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2044-07-25
AI Technical Summary
The amount calculation architecture in the existing technology has poor scalability, high maintenance costs, and is difficult to read and debug, resulting in increased code complexity and difficulty in maintenance.
The amount calculation module is split into independent calculators, each of which is responsible for a specific amount calculation type. A dynamic loading architecture is used to store the calculation rules in the database, and the corresponding rules are dynamically loaded according to business conditions. Functional dimension and operation dimension branches are constructed to achieve modularity and independence.
It improves the scalability, maintainability and debuggability of amount calculation, reduces code complexity, and facilitates rule modification and updating.
Smart Images

Figure CN118967289B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the financial field, and in particular to a construction method, system and storage medium of a calculator for calculating amount of money. Background Art
[0002] In view of the problems existing in the amount calculation in the existing technology, the interest calculation of the repayment scenario in Table 1 is explained. According to the different dimensions such as the platform, business form, function code, and operation code, the amount calculation strategy of different repayment scenarios is also different. When calculating interest, it is necessary to consider the information of dimensions such as platform code, business form code, function code, and operation code to determine the specific interest calculation strategy. Among them:
[0003] 1. Platform code, used to identify the platform type, such as self-operated accounting platform, joint loan platform, etc.
[0004] 2. Business type, used to identify the repayment scenario type, such as normal repayment, repayment after repayment, etc.
[0005] 3. Function code, used to identify a certain calculation function, such as interest calculation, penalty interest calculation, etc.
[0006] 4. Operation code, which is used to identify the method classification of a function. For example, if the function is interest calculation, the corresponding operation codes include interest calculation to current period, interest calculation to current day, etc.
[0007] Table 1 Repayment scenarios
[0008]
[0009] In traditional architecture, such as Figure 4 As shown, when the caller calculates interest, the accounting system needs to judge various conditions to determine the calculator strategy. The branches are deeply nested and the judgment is complex. Specifically:
[0010] 1. When calculating interest, the caller first obtains dimension information (platform code, business form, function code, and operation code), and then determines the specific calculation strategy by descending levels of platform code, business form, function code, and operation code.
[0011] When the platform code is a self-operated platform, the business form needs to be determined; when the business form is normal repayment, the function code needs to be determined; when the function code is interest calculation, the operation code needs to be determined; when the operation code is the interest calculation of normal repayments on the self-operated platform to the current period, the calculation strategy of the interest calculation of normal repayments on the self-operated platform to the current period is called; when the operation code is the interest calculation of normal repayments on the self-operated platform to the current day, the calculation strategy of the interest calculation of normal repayments on the self-operated platform to the current day is called.
[0012] When the business form is repayment after compensation, the function code is judged; when the function code is interest calculation, the operation code needs to be judged; when the operation code is that the interest on the repayment after compensation on the self-operated platform is calculated to the current period, the calculation strategy of calculating the interest on the repayment after compensation on the self-operated platform to the current period is called; when the operation code is that the interest on the repayment after compensation on the self-operated platform is calculated to the current day, the calculation strategy of calculating the interest on the repayment after compensation on the self-operated platform to the current day is called.
[0013] Similar judgment is required for platforms whose code is a joint loan platform.
[0014] 2. If you want to replace the calculation strategy, you need to adjust the complex branch structure. The calculation strategy refers to the branch path that ultimately finds the operation code based on the dimension information. The branch structure is the path from initiating the request to routing to the operation code. For example, through the platform code (self-operated platform) to the business form (normal repayment), to the function code (interest calculation), to the operation code to find the method of calculating interest to the current period, this path is the branch structure. When the calculation strategy of the "interest calculation to the current period" method is changed, it is actually to find the original method of calculating interest to the current period along the branch structure, and then replace it with the new method of calculating interest to the current period.
[0015] 3. If there is a need for expansion in a certain dimension, the branch structure needs to be adjusted; for example, the platform code currently exists as "self-operated platform" and "joint loan platform", then it may continue to expand to "loan assistance platform", "consumer loan" platform, etc.; other dimensions can also be expanded in a similar way.
[0016] 4. Because different branch structures are written together, if there is a modification in one dimension, other branch structures need to be tested to avoid errors;
[0017] 5. Because the code is difficult to read and debug, more branches and processes are usually added to circumvent it.
[0018] This style of embedding calculation rules into the code in a hard-coded manner leads to the following problems:
[0019] 1. Poor scalability: As the business grows, the scalability of the traditional architecture may become insufficient. For example, adding more branches or nested branches makes expansion extremely difficult.
[0020] 2. High maintenance cost: Due to the complex code structure, the maintenance cost of traditional architecture is high. For example, if a bug in the code needs to be fixed, it takes a lot of time and effort to investigate and repair it.
[0021] 3. Difficult to read and debug: Due to the complex code structure, traditional architectures are difficult to debug and knowledge transfer is difficult. For example, if a system failure occurs, it takes a lot of time and effort to locate and resolve it. Summary of the Invention
[0022] The embodiments of the present invention provide a method, system and storage medium for constructing a calculator for amount calculation, which can solve the technical problems in the prior art of amount calculation such as poor scalability, high maintenance cost and difficulty in reading and debugging.
[0023] To achieve the above objectives, in a first aspect, an embodiment of the present invention provides a method for constructing a calculator for calculating an amount, comprising:
[0024] Before creating a calculator that implements amount calculation, obtain the corresponding function code based on the amount calculation information of the functional dimension of the amount calculation type within the corresponding dimension system, load the amount calculation rule corresponding to the function code, and construct the calculator's functional dimension branch based on the amount calculation rule corresponding to the function code. The function code represents the dimension to be achieved when performing amount calculation on the calculator.
[0025] Obtaining an operation code corresponding to an operation dimension within the dimension system corresponding to the amount calculation type, and constructing an operation dimension branch of a calculator based on the operation code corresponding to the operation dimension, wherein the dimension level of the operation dimension is lower than the dimension level of the function dimension;
[0026] Construct a calculator, the calculator including the functional dimension branch and the operational dimension branch, the construction code of the functional dimension branch and the construction code of the operational dimension branch are in an unrelated parallel relationship, the calculator is used to calculate the amount belonging to the amount calculation type and return the calculation result, and the construction code of the calculator corresponding to the amount calculation type is independent of the construction code of the calculator corresponding to any other amount calculation type.
[0027] In a second aspect, an embodiment of the present invention provides a system for constructing a calculator for calculating an amount of money, comprising:
[0028] A functional dimension branch construction unit is configured to, before creating a calculator that implements amount calculation, obtain, based on the functional dimension of the amount calculation type within the corresponding dimension system, a corresponding function code determined based on amount calculation information of the functional dimension, load an amount calculation rule corresponding to the function code, and construct a functional dimension branch of the calculator based on the amount calculation rule corresponding to the function code, wherein the function code represents the dimension to be achieved when performing amount calculation using the calculator;
[0029] an operation dimension branch construction unit, configured to obtain an operation code corresponding to the operation dimension within the dimension system corresponding to the amount calculation type, and construct an operation dimension branch of the calculator based on the operation code corresponding to the operation dimension, wherein the dimension level of the operation dimension is lower than the dimension level of the function dimension;
[0030] A calculator construction unit is used to construct a calculator, the calculator including the functional dimension branch and the operational dimension branch, the construction code of the functional dimension branch and the construction code of the operational dimension branch are in an unrelated parallel relationship, the calculator is used to calculate the amount belonging to the amount calculation type and return the calculation result, and the construction code of the calculator corresponding to the amount calculation type is independent of the construction code of the calculator corresponding to any other amount calculation type.
[0031] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores one or more programs. When the one or more programs are executed by a computer device, the computer device executes the aforementioned method for constructing a calculator for calculating amounts.
[0032] In a fourth aspect, an embodiment of the present invention provides a computer device, including:
[0033] A processor; and a memory arranged to store computer-executable instructions, which, when executed, cause the processor to perform the aforementioned method for constructing a calculator for amount calculation.
[0034] The above technical solution has the following beneficial effects: The method for constructing a calculator for amount calculation provided by the embodiment of the present invention is mainly used in the financial field, directly constructs a corresponding calculator for the calculator model, and splits the amount calculation module in the financial field into independent and different calculators, each of which is responsible for the amount calculation of the corresponding amount calculation type. It can cope with complex customized calculation strategies, overcome the technical problems existing in the existing technology, and improve the scalability, maintainability and debuggability of the calculation. Using a dynamic loading architecture, the amount calculation rules can be stored in the database, and the corresponding amount calculation rules can be dynamically loaded according to different business conditions (i.e., function codes, operation codes). BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0036] Figure 1 is a flow chart of a method for constructing a calculator for amount calculation according to an embodiment of the present invention;
[0037] Figure 2 This is a structural diagram of a system for constructing a calculator for amount calculation according to an embodiment of the present invention;
[0038] Figure 3 is a flow chart of a method for constructing another calculator for amount calculation according to an embodiment of the present invention;
[0039] Figure 4 This is the amount calculation method for the repayment scenario in the existing technology. DETAILED DESCRIPTION
[0040] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0041] like Figure 1 As shown, in combination with an embodiment of the present invention, a method for constructing a calculator for amount calculation is provided, comprising:
[0042] S101: Before creating a calculator that implements amount calculation, obtain the amount calculation information corresponding to the functional dimension according to the functional dimension of the amount calculation type in the corresponding dimension system, determine the corresponding function code, load the amount calculation rule corresponding to the function code, and construct the functional dimension branch of the calculator based on the amount calculation rule corresponding to the function code, wherein the function code represents the dimension to be achieved when performing amount calculation through the calculator.
[0043] S102: Obtaining an operation code corresponding to the operation dimension within the dimension system corresponding to the amount calculation type, and constructing an operation dimension branch of the calculator based on the operation code corresponding to the operation dimension, wherein the dimension level of the operation dimension is lower than the dimension level of the function dimension;
[0044] S103: Construct a calculator. The calculator includes the functional dimension branch and the operational dimension branch. The construction code for the functional dimension branch and the construction code for the operational dimension branch are independent and parallel. The calculator is used to calculate the amount belonging to the amount calculation type and return the calculation result. The calculation result returned is typically the amount, but may also include other amount information, such as calculation time and amount unit, as set according to user needs. The construction code for the calculator corresponding to this amount calculation type is independent of the construction code for calculators corresponding to any other amount calculation types.
[0045] The method for constructing a calculator for amount calculation provided in an embodiment of the present invention is primarily used in the financial field. It directly constructs a corresponding calculator for a calculator model, splitting the amount calculation module in the financial field into independent and distinct calculators, each responsible for calculating amounts of a corresponding amount calculation type. For example, for a repayment scenario, the interest amount calculation can be split into specific types of amounts: a calculator for normal repayment interest, a calculator for repayment interest after compensation, and a calculator for penalty interest, etc. This can improve the modularity of the construction code and reduce its complexity.
[0046] The method for constructing a calculator for amount calculation provided by the embodiment of the present invention can cope with complex customized calculation strategies, overcome the technical problems existing in the prior art, and improve the scalability, maintainability and debuggability of the calculation.
[0047] Using a dynamic loading architecture, amount calculation rules can be stored in the database and dynamically loaded based on different business conditions (i.e., function codes and operation codes). For example, the interest calculation rules for normal repayments on a self-operated platform can be stored in the database and dynamically loaded when the corresponding calculator is built. This improves code maintainability and facilitates rule modification, updating, and replacement.
[0048] Preferably, in S101, the step of obtaining amount calculation information according to the functional dimension of the amount calculation type in the corresponding dimension system to determine a corresponding function code, loading an amount calculation rule corresponding to the function code, and constructing a function dimension branch of the calculator based on the amount calculation rule corresponding to the function code includes:
[0049] The facade loader is called through the calculator execution entry, and the amount calculation information corresponding to the functional dimension in the dimension system corresponding to the amount calculation type is obtained. The corresponding function code in the functional dimension is determined according to the amount calculation information corresponding to the functional dimension, and the function code is passed to the facade loader; the function code is the business condition for loading the amount calculation rule, and a specific calculator panel is created according to the function code. For example, a function code of 0 represents an interest calculator panel, which is responsible for creating an interest calculator factory related to the platform code; a function code of 1 represents a penalty interest calculator panel, which is responsible for creating a penalty interest calculator panel related to the platform code.
[0050] The calculator panel instance corresponding to the function code is loaded through the facade loader; the facade loader is responsible for loading a specific calculator panel according to the function code, such as loading an interest calculator panel or a penalty interest calculator panel.
[0051] The amount calculation rule corresponding to the function code is loaded via the facade loader. Based on the amount calculation rule corresponding to the function code, a calculator panel interface is set on the calculator panel instance. The calculator panel interface defines the behavior, and the calculator panel is constructed to obtain a calculator panel. The calculator panel is a set of operations, or a portal for unified processing, and is a specific instance of an interface implementation. The calculator panel is a branch of the calculator's functional dimension, wherein the calculator panel interface is used to implement calculation functions that match the amount calculation information of the functional dimension. Constructing the calculator panel obtains the calculator's facade, and its calculator panel interface serves as an operation set to achieve unified data input and output.
[0052] The following explains the amount calculation rules: the amount to be calculated is interest, the amount calculation is interest calculation, and interest calculation is a business behavior. Using the method for constructing a calculator for amount calculation according to the embodiments of the present invention, when constructing the corresponding calculator, there is no need to worry about the type of interest or the specific content of the amount calculation rules regarding interest calculation. Because amount calculations in the financial field also include penalty interest calculations, principal calculations, and coupon calculations, etc., you only need to retain the settings and ultimately set the specific content of the amount calculation rules according to user needs. The amount calculation rule can be implemented using a code snippet, a SQL script, an HTTP call, or an index value (the index can be used to locate the specific execution code logic). After the amount calculation rule is retrieved from the database, it is executed, and the execution behavior is defined by the business. For example, if the amount calculation rule is a SQL statement, the execution returns that the retrieved record or data table has changed; if the amount calculation rule is an HTTP call, the execution returns a response result.
[0053] Preferably, setting a calculator panel interface on the calculator panel instance includes:
[0054] The calculation behavior abstraction in the calculator that matches the amount calculation information of the functional dimension is constructed through the calculator panel interface definition. The specific behavior of the amount calculation can be implemented according to the calculation behavior abstraction of the calculator panel interface, thereby realizing different calculator panels, such as the interest calculator panel.
[0055] Preferably, the dimension system corresponding to the amount calculation type includes dimension levels higher than the functional dimension and dimension levels lower than the functional dimension, and the relationship between dimension levels from high to low is that the previous dimension level includes the next dimension level; for example, the dimension levels (also called business conditions) in the dimension system are as follows from high to low:
[0056] 1. Platform code, corresponding to the platform dimension, used to identify the platform type, such as self-operated accounting platform, joint loan platform, etc.
[0057] 2. Business form code, corresponding to the business form dimension, used to identify the repayment scenario type, such as normal repayment, repayment after repayment, etc.
[0058] 3. Function code, corresponding to the functional dimension, is used to identify a certain calculation function, such as interest calculation, penalty interest calculation, etc.
[0059] 4. Operation code, corresponding to the operation dimension, is used to identify the method classification of the function. For example, if the function is interest calculation, the corresponding operation codes include interest calculation to current period, interest calculation to current day, etc.
[0060] The method for constructing the calculator for amount calculation also includes:
[0061] Determine the dimension system to which the amount calculation type belongs through the calculator execution entry, and determine the dimension level other than the functional dimension within the dimension system;
[0062] For each dimension level except the functional dimension, obtaining, through the calculator execution entry, amount calculation information corresponding to the dimension level according to the amount calculation type, determining a corresponding dimension code within the dimension level according to the amount calculation information corresponding to the dimension level, calling a matching factory loader through the calculator execution entry, and sending the dimension code to the factory loader matching the dimension level;
[0063] The calculator factory instance corresponding to the dimension code is loaded by the factory loader matching the dimension level; the calculator factory is extended at the corresponding dimension level by the factory loader matching the dimension level, and different calculator factories are responsible for building different calculators.
[0064] The amount calculation rule corresponding to the dimension code is loaded through a matching factory loader, and a calculator factory interface is set on the calculator factory instance according to the amount calculation rule corresponding to the dimension code to construct a calculator factory branch of the corresponding dimension level of the calculator, wherein the calculator factory interface is used to implement a calculation function that matches the amount calculation information of the dimension level.
[0065] After building the calculator panel to obtain the calculator facade, the calculator search scope is gradually narrowed by building calculator factory branches at the corresponding dimension levels of the calculator, such as the platform dimension, business form dimension, operation dimension, and the respective calculator factory branches of the dimensions listed, until the final calculator that meets all dimension levels (business conditions) is found.
[0066] Preferably, the method for constructing a calculator for amount calculation further includes:
[0067] For each dimension level except the functional dimension, the calculator factory interface is used to describe the abstract behavior of the calculator factory that matches the amount calculation information of the dimension level. The abstract behavior is used to constrain the specific calculation of the amount at the corresponding dimension level. The calculator factory model is used to describe the abstract data structure of the calculator factory according to the abstract behavior of the calculator factory. The abstract data structure is used to implement the specific calculation of the amount at the corresponding dimension level. The abstract data structure is used to implement the calculator factory branch of the dimension level.
[0068] For example, when the dimension level other than the functional dimension is the platform dimension, the factory loader matching the platform dimension is called through the calculator execution entry, amount calculation information corresponding to the platform dimension is obtained according to the amount calculation type, the platform code corresponding to the platform dimension is determined according to the amount calculation information corresponding to the platform dimension, and the platform code is sent to the factory loader matching the platform dimension;
[0069] The calculator factory instance corresponding to the platform code is loaded through the factory loader that matches the platform dimension, such as the interest calculator factory instance of the self-operated platform, the interest calculator factory of the joint loan platform, etc.; the calculator factory is expanded on the platform code dimension through the factory loader that matches the platform dimension, and different calculator factories are responsible for building different calculators.
[0070] The amount calculation rule corresponding to the platform code is loaded through the factory loader that matches the platform dimension. According to the amount calculation rule corresponding to the platform code, the corresponding calculator factory interface is set on the calculator factory instance corresponding to the platform code to construct the platform dimension branch of the calculator.
[0071] The calculator factory interface is responsible for describing the abstract behavior of the corresponding calculator factory interface. Different calculator factory instances can be implemented based on this calculator factory interface, such as the interest calculator factory for the self-operated platform. The corresponding calculator factory is responsible for generating different platform codes based on the platform code; for example, to create different factories for interest calculation, the corresponding factory loader creates a factory for the interest calculation of the self-operated platform based on the platform code. When the platform code = 1, it creates a factory for the interest calculation of the self-operated platform. When the platform code = 2, it creates a factory for the interest calculation of the joint loan platform. How the factory creates a specific calculator based on the operation code is left to the corresponding "loader" and the corresponding "construction sub-unit" to complete.
[0072] The abstract data structure of the calculator factory is modified according to the abstract behavior description of the calculator factory through the corresponding calculator factory model, and the abstract data structure is used to implement the calculator factory branch at the platform dimension level.
[0073] Preferably, obtaining an operation code corresponding to the operation dimension in the dimension system corresponding to the amount calculation type, and constructing an operation dimension branch of the calculator based on the operation code corresponding to the operation dimension, includes:
[0074] When the dimension level other than the functional dimension is an operation dimension, a calculator operation loader is called through the calculator execution entry, amount calculation information corresponding to the operation dimension is obtained according to the amount calculation type, an operation code corresponding to the operation dimension is determined according to the amount calculation information corresponding to the operation dimension, and the operation code is sent to the calculator operation loader, which is a factory loader matching the operation dimension;
[0075] The calculator operation instance corresponding to the operation code is loaded through the calculator operation loader. The calculator operation instance belongs to the calculator factory instance corresponding to the operation dimension code, such as a calculator that calculates interest to the current period and a calculator that calculates interest to the current day. The calculator instance is the opportunity to expand the calculator on the operation code dimension.
[0076] The amount calculation rule corresponding to the operation code is loaded through the calculator operation loader, and a calculator operation interface is set on the calculator operation instance according to the amount calculation rule corresponding to the operation code to construct an operation dimension branch of the calculator, wherein the operation dimension branch belongs to the calculator factory branch of the operation dimension, and the calculator operation interface is used to implement a calculation function that matches the amount calculation information of the operation dimension.
[0077] After building the calculator panel to obtain the calculator facade, the calculator factory branch of the calculator operation dimension is constructed to gradually narrow the search scope of the calculator until the final calculator that meets all dimension levels (business conditions) is found.
[0078] Preferably, the method for constructing the calculator for amount calculation further includes:
[0079] For the operation dimension, the calculator interface describes the abstract behavior of amount calculation. This abstract behavior is used to constrain the specific calculation of the amount in the operation dimension. The calculator model describes the abstract data structure of amount calculation based on this abstract behavior. This abstract data structure is used to implement the final calculation of the amount. This allows different calculator operation instances to be implemented based on the calculator operation interface, such as an interest calculator instance.
[0080] In summary, the calculator panel abstraction defines the behavior and structural abstraction within the function code dimension (business conditions); the calculator factory abstraction defines the behavior and structural abstraction within the platform code dimension (business conditions); and the calculator operation abstraction defines the behavior and structural abstraction within the operation code dimension (property conditions). These abstractions are parallel, like a layered structure, with each layer focusing on a different perspective.
[0081] The "Facade Loader" is responsible for creating a specific instance (calculator panel) that implements the "calculator panel interface" based on the "function code"; the "calculator panel interface" is a general and consistent behavior described by the interface regardless of the function code.
[0082] The specific implementation of the "calculator panel" may vary depending on the function code. Therefore, the "facade loader" focuses on the function code and constructs different calculator panel instances for different function codes. For example, when the function code is 1, the "panel loader" constructs the "interest calculator panel," and when the function code is 2, the "facade loader" constructs the "penalty interest calculator panel." Interfaces and models are abstract structures, stable structures that do not vary depending on the function code, platform code, or operation code. This is a mechanism, an abstraction.
[0083] If you want to further determine whether the interest calculation is for the self-operated platform or the joint loan platform, please submit it to the platform code "Factory Loader" to complete it. If you want to further determine whether the interest calculation for the self-operated platform is for the current day or the current period, please submit it to the "Calculator Operation Loader" to complete it.
[0084] In short, through each loader, the search scope of the calculator is gradually narrowed down until the final calculator that meets all dimension levels (business conditions) is found.
[0085] like Figure 3 As shown, the sequential execution steps of the method for constructing a calculator for amount calculation according to an embodiment of the present invention are as follows:
[0086] Step 1: Based on the amount calculation type, the calculator executes an entry call to obtain a corresponding loader, such as a facade loader or a factory loader (factory loader, calculator operation loader) that matches the dimension level.
[0087] Step 2: Pass the calculator business conditions (platform code, business form, function code, operation code) to the corresponding loader. The business conditions are the basis for building a specific calculator and retrieving the specific strategy (instance) in the database.
[0088] Specifically, according to the functional dimension in the dimension system corresponding to the amount calculation type, the amount calculation information corresponding to the functional dimension is obtained, and the function code corresponding to the functional dimension is determined according to the amount calculation information corresponding to the functional dimension, and the function code is passed to the storefront loader; the dimension system to which it belongs is determined according to the amount calculation type through the calculator execution entry, and the dimension level other than the functional dimension is determined within the dimension system; for each of the dimension levels other than the functional dimension, the amount calculation information corresponding to the dimension level is obtained according to the amount calculation type through this calculator execution entry, and the dimension code corresponding to the dimension level is determined according to the amount calculation information corresponding to the dimension level, the matching factory loader is called through the calculator execution entry, and the dimension code is sent to the factory loader matching the dimension level.
[0089] Step 3: Use the facade loader to load a calculator panel instance for a specific function based on the function code to implement calculator panel extensions, such as an interest calculator panel. Use the calculator panel interface definition to construct a calculation behavior abstraction within the calculator that matches the amount calculation information in the function dimension. This completes the branching of the function dimension.
[0090] Step 4: Use the factory loader to load the corresponding platform code function calculator factory instance, such as the interest calculator factory for the self-operated platform or the interest calculator factory for the joint loan platform. The calculator factory interface is responsible for describing the abstract behavior of the corresponding calculator factory interface, and different calculator factory instances can be implemented based on this calculator factory interface. The corresponding calculator factory model describes the abstract data structure of the calculator factory based on its abstract behavior. This abstract data structure is used to implement the calculator factory branch at the platform dimension level. This completes the construction of the platform dimension branch.
[0091] Step 5: Use the calculator operation loader to load the corresponding calculator operation instance for the operation code to implement calculator operation extensions, such as extending interest calculation to the current period calculator or the current day calculator. For this operation dimension, the calculator interface describes the abstract behavior of amount calculation, and the calculator model describes the abstract data structure of amount calculation based on this abstract behavior. This completes the branching of the operation dimension.
[0092] When using the calculator for calculation, in addition to loading the calculator panel, the calculator factory corresponding to the platform code, and the calculator operation instance, it also includes:
[0093] Step 6: Each loader returns the loaded calculator panel, the calculator factory corresponding to the platform code, and the calculator operation instance to the calculator execution process.
[0094] Step 7: The calculator (calculator execution process) performs specific calculations based on the specific data and returns the calculation results.
[0095] like Figure 2 As shown, in combination with an embodiment of the present invention, a system for constructing a calculator for amount calculation is provided, comprising:
[0096] The function dimension branch construction unit 21 is configured to, before creating a calculator that implements amount calculation, obtain, based on the amount calculation type within the corresponding dimension system, a function code corresponding to the function dimension and amount calculation information of the function dimension, load an amount calculation rule corresponding to the function code, and construct a function dimension branch of the calculator based on the amount calculation rule corresponding to the function code, wherein the function code represents the dimension to be achieved when performing amount calculation on the calculator;
[0097] An operation dimension branch construction unit 22 is configured to obtain an operation code corresponding to the operation dimension within the dimension system corresponding to the amount calculation type, and to construct an operation dimension branch of the calculator based on the operation code corresponding to the operation dimension, wherein the dimension level of the operation dimension is lower than the dimension level of the function dimension;
[0098] The calculator construction unit 23 is configured to construct a calculator. The calculator includes the functional dimension branch and the operational dimension branch. The construction code for the functional dimension branch and the construction code for the operational dimension branch are independent and parallel. The calculator is configured to calculate amounts belonging to the amount calculation type and return a calculation result. The returned calculation result is typically an amount, but may also include other amount information, such as calculation time and amount unit, as configured by the user. The construction code for the calculator corresponding to this amount calculation type is independent of the construction code for calculators corresponding to any other amount calculation types.
[0099] The method for constructing a calculator for amount calculation provided in an embodiment of the present invention is primarily used in the financial field. It directly constructs a corresponding calculator for a calculator model, splitting the amount calculation module in the financial field into independent and distinct calculators, each responsible for calculating amounts of a corresponding amount calculation type. For example, for a repayment scenario, the interest amount calculation can be split into specific types of amounts: a calculator for normal repayment interest, a calculator for repayment interest after compensation, and a calculator for penalty interest, etc. This can improve the modularity of the construction code and reduce its complexity.
[0100] The method for constructing a calculator for amount calculation provided by the embodiment of the present invention can cope with complex customized calculation strategies, overcome the technical problems existing in the prior art, and improve the scalability, maintainability and debuggability of the calculation.
[0101] Using a dynamic loading architecture, amount calculation rules can be stored in the database and dynamically loaded based on different business conditions (i.e., function codes and operation codes). For example, the interest calculation rules for normal repayments on a self-operated platform can be stored in the database and dynamically loaded when the corresponding calculator is built. This improves code maintainability and facilitates rule modification, updating, and replacement.
[0102] Preferably, the functional dimension branch construction unit 21 includes:
[0103] The calculator execution entry is used to call the facade loader through this calculator execution entry, obtain the amount calculation information corresponding to the functional dimension in the dimension system corresponding to the amount calculation type, determine the corresponding function code in the functional dimension according to the amount calculation information corresponding to the functional dimension, and pass the function code to the facade loader; the function code is the business condition for loading the amount calculation rule, and according to the function code, create a specific calculator panel. For example, the function code of 0 represents the interest calculator panel, which is responsible for creating the interest calculator factory related to the platform code; the function code of 1 represents the penalty interest calculator panel, which is responsible for creating the penalty interest calculator panel related to the platform code.
[0104] The facade loader is used to load the calculator panel instance corresponding to the function code and load the amount calculation rules corresponding to the function code through this facade loader; the facade loader is responsible for loading specific calculator panels according to the function code, such as loading the interest calculator panel or the penalty interest calculator panel, etc.
[0105] The first construction subunit is configured to configure a calculator panel interface on the calculator panel instance based on the amount calculation rule corresponding to the function code. The calculator panel interface defines a behavior, and the constructed calculator panel is a set of operations or a portal for unified processing, and is a specific instance that implements the interface. The calculator panel is a branch of the calculator's functional dimension, and the calculator panel interface is used to implement a calculation function that matches the amount calculation information of the functional dimension.
[0106] Build a calculator panel to get the facade of the calculator, and use its calculator panel interface as an operation set to achieve unified input and output of data.
[0107] The following explains the amount calculation rules: the amount to be calculated is interest, the amount calculation is interest calculation, and interest calculation is a business behavior. Using the method for constructing a calculator for amount calculation according to the embodiments of the present invention, when constructing the corresponding calculator, there is no need to worry about the type of interest or the specific content of the amount calculation rules regarding interest calculation. Because amount calculations in the financial field also include penalty interest calculations, principal calculations, and coupon calculations, etc., you only need to retain the settings and ultimately set the specific content of the amount calculation rules according to user needs. The amount calculation rule can be implemented using a code snippet, a SQL script, an HTTP call, or an index value (the index can be used to locate the specific execution code logic). After the amount calculation rule is retrieved from the database, it is executed, and the execution behavior is defined by the business. For example, if the amount calculation rule is a SQL statement, the execution returns that the retrieved record or data table has changed; if the amount calculation rule is an HTTP call, the execution returns a response result.
[0108] The first construction subunit is specifically used for:
[0109] The calculation behavior abstraction in the calculator that matches the amount calculation information of the functional dimension is constructed through the calculator panel interface definition. The specific behavior of the amount calculation can be implemented according to the calculation behavior abstraction of the calculator panel interface, thereby realizing different calculator panels, such as the interest calculator panel.
[0110] Preferably, the dimension system corresponding to the amount calculation type includes dimension levels higher than the functional dimension and dimension levels lower than the functional dimension, and the relationship between dimension levels from high to low is that the previous dimension level includes the next dimension level; for example, the dimension levels (also called business conditions) in the dimension system are as follows from high to low:
[0111] 1. Platform code, corresponding to the platform dimension, used to identify the platform type, such as self-operated accounting platform, joint loan platform, etc.
[0112] 2. Business form code, corresponding to the business form dimension, used to identify the repayment scenario type, such as normal repayment, repayment after repayment, etc.
[0113] 3. Function code, corresponding to the functional dimension, is used to identify a certain calculation function, such as interest calculation, penalty interest calculation, etc.
[0114] 4. Operation code, corresponding to the operation dimension, is used to identify the method classification of the function. For example, if the function is interest calculation, the corresponding operation codes include interest calculation to current period, interest calculation to current day, etc.
[0115] The construction system of the calculator for amount calculation also includes other branch construction units for:
[0116] an associated dimension level determination subunit, configured to determine the dimension system to which the amount calculation type belongs based on the amount calculation type through a calculator execution entry, and to determine the dimension level other than the functional dimension within the dimension system;
[0117] a calculator execution entry, configured to, for each dimension level except the functional dimension, obtain, through the calculator execution entry, amount calculation information corresponding to the dimension level according to the amount calculation type, determine a corresponding dimension code within the dimension level according to the amount calculation information corresponding to the dimension level, call a matching factory loader through the calculator execution entry, and send the dimension code to the factory loader matching the dimension level;
[0118] A factory loader, which matches the dimension level, is used to load the calculator factory instance corresponding to the dimension code and the amount calculation rule corresponding to the dimension code through this factory loader; the factory loader that matches the dimension level is used to extend the calculator factory at the corresponding dimension level, and different calculator factories are responsible for building different calculators.
[0119] Other construction sub-units are used to load the amount calculation rules corresponding to the dimension code through a matching factory loader, set a calculator factory interface on the calculator factory instance according to the amount calculation rules corresponding to the dimension code, and construct a calculator factory branch of the corresponding dimension level of the calculator, wherein the calculator factory interface is used to implement a calculation function that matches the amount calculation information of the dimension level.
[0120] After building the calculator panel to obtain the calculator facade, the calculator search scope is gradually narrowed by building calculator factory branches at the corresponding dimension levels of the calculator, such as the platform dimension, business form dimension, operation dimension, and the respective calculator factory branches of the dimensions listed, until the final calculator that meets all dimension levels (business conditions) is found.
[0121] Preferably, other building blocks are specifically used for:
[0122] For each dimension level except the functional dimension, the calculator factory interface is used to describe the abstract behavior of the calculator factory that matches the amount calculation information of the dimension level. The abstract behavior is used to constrain the specific calculation of the amount at the corresponding dimension level. The calculator factory model is used to describe the abstract data structure of the calculator factory according to the abstract behavior of the calculator factory. The abstract data structure is used to implement the specific calculation of the amount at the corresponding dimension level. The abstract data structure is used to implement the calculator factory branch of the dimension level.
[0123] For example, when the dimension level other than the functional dimension is the platform dimension, the factory loader matching the platform dimension is called through the calculator execution entry, amount calculation information corresponding to the platform dimension is obtained according to the amount calculation type, the platform code corresponding to the platform dimension is determined according to the amount calculation information corresponding to the platform dimension, and the platform code is sent to the factory loader matching the platform dimension;
[0124] The calculator factory instance corresponding to the platform code is loaded through the factory loader that matches the platform dimension, such as the interest calculator factory instance of the self-operated platform, the interest calculator factory of the joint loan platform, etc.; the calculator factory is expanded on the platform code dimension through the factory loader that matches the platform dimension, and different calculator factories are responsible for building different calculators.
[0125] The amount calculation rule corresponding to the platform code is loaded through the factory loader that matches the platform dimension. According to the amount calculation rule corresponding to the platform code, the corresponding calculator factory interface is set on the calculator factory instance corresponding to the platform code to construct the platform dimension branch of the calculator.
[0126] The calculator factory interface is responsible for describing the abstract behavior of the corresponding calculator factory interface. Different calculator factory instances can be implemented based on this calculator factory interface, such as the interest calculator factory for the self-operated platform. The corresponding calculator factory is responsible for generating different platform codes based on the platform code; for example, to create different factories for interest calculation, the corresponding factory loader creates a factory for the interest calculation of the self-operated platform based on the platform code. When the platform code = 1, it creates a factory for the interest calculation of the self-operated platform. When the platform code = 2, it creates a factory for the interest calculation of the joint loan platform. How the factory creates a specific calculator based on the operation code is left to the corresponding "loader" and the corresponding "construction sub-unit" to complete.
[0127] The abstract data structure of the calculator factory is modified according to the abstract behavior description of the calculator factory through the corresponding calculator factory model, and the abstract data structure is used to implement the calculator factory branch at the platform dimension level.
[0128] Preferably, the operation dimension branch construction unit 22 belongs to other branch construction units, and the operation dimension branch construction unit 22 includes:
[0129] a calculator execution entry, configured to, when the dimension level other than the function dimension is an operation dimension, call a calculator operation loader through the calculator execution entry, obtain amount calculation information corresponding to the operation dimension according to the amount calculation type, determine an operation code corresponding to the operation dimension according to the amount calculation information corresponding to the operation dimension, and send the operation code to the calculator operation loader, which is a factory loader matching the operation dimension;
[0130] The calculator operation loader is used to load a calculator operation instance corresponding to the operation code. The calculator operation instance belongs to the calculator factory instance corresponding to the operation dimension code; and load the amount calculation rule corresponding to the operation code. For example, a calculator that calculates interest to the current period or a calculator that calculates interest to the current day. The calculator instance is the opportunity to expand the calculator based on the operation code dimension.
[0131] A second construction subunit is configured to set a calculator operation interface on the calculator operation instance according to the amount calculation rule corresponding to the operation code, thereby constructing an operation dimension branch of the calculator, wherein the operation dimension branch belongs to the calculator factory branch of the operation dimension, and the calculator operation interface is configured to implement a calculation function that matches the amount calculation information of the operation dimension;
[0132] The calculator operation loader belongs to the factory loader that matches the dimension level, and the second building subunit belongs to other building subunits.
[0133] After building the calculator panel to obtain the calculator facade, the calculator factory branch of the calculator operation dimension is constructed to gradually narrow the calculator search scope until the final calculator that meets all dimension levels (business conditions) is found.
[0134] Preferably, the second construction subunit is specifically used for:
[0135] For the operation dimension, the calculator interface describes the abstract behavior of amount calculation. This abstract behavior is used to constrain the specific calculation of the amount in the operation dimension. The calculator model describes the abstract data structure of amount calculation based on this abstract behavior. This abstract data structure is used to implement the final calculation of the amount. This allows different calculator operation instances to be implemented based on the calculator operation interface, such as an interest calculator instance.
[0136] In summary, the calculator panel abstraction defines the behavior and structural abstraction within the function code dimension (business conditions); the calculator factory abstraction defines the behavior and structural abstraction within the platform code dimension (business conditions); and the calculator operation abstraction defines the behavior and structural abstraction within the operation code dimension (business conditions). These abstractions are parallel, like a layered structure, with each layer focusing on a different perspective.
[0137] The "Facade Loader" is responsible for creating a specific instance (calculator panel) that implements the "calculator panel interface" based on the "function code"; the "calculator panel interface" is a general and consistent behavior described by the interface regardless of the function code.
[0138] The specific implementation of the "calculator panel" may vary depending on the function code. Therefore, the "facade loader" focuses on the function code and constructs different calculator panel instances for different function codes. For example, when the function code is 1, the "panel loader" constructs the "interest calculator panel," and when the function code is 2, the "facade loader" constructs the "penalty interest calculator panel." Interfaces and models are abstract structures, stable structures that do not vary depending on the function code, platform code, or operation code. This is a mechanism, an abstraction.
[0139] If you want to further determine whether the interest calculation is for the self-operated platform or the joint loan platform, please submit it to the platform code "Factory Loader" to complete it. If you want to further determine whether the interest calculation for the self-operated platform is for the current day or the current period, please submit it to the "Calculator Operation Loader" to complete it.
[0140] In short, through each loader, the search scope of the calculator is gradually narrowed down until the final calculator that meets all dimension levels (business conditions) is found.
[0141] In combination with an embodiment of the present invention, a computer-readable storage medium is provided, which stores one or more programs. When the one or more programs are executed by a computer device, the computer device executes any one of the aforementioned methods for constructing a calculator for calculating amounts.
[0142] In conjunction with an embodiment of the present invention, a computer device is provided, characterized by comprising:
[0143] A processor; and a memory arranged to store computer-executable instructions, which, when executed, cause the processor to execute any one of the aforementioned methods for constructing a calculator for amount calculation.
[0144] The beneficial effects achieved by the embodiments of the present invention are as follows:
[0145] 1. Improved code scalability: Code scalability is achieved based on dimensions such as function codes and operation codes, making it easier to add and modify new functions and better adapt to changing business needs.
[0146] 2. Reduced code maintenance costs: The mechanism area and the policy area are separated. The mechanism area abstracts the construction. By maximizing reuse and isolating specific policies, the impact of code modifications is reduced, the maintainability of the code is improved, and the maintenance cost of the code is reduced, making it easier for developers to fix errors and add new features.
[0147] 3. Improved code debuggability and reusability: The modular design with different calculators as separate modules can improve the debuggability of the code and facilitate the location and repair of code problems. Since the code is modular, it can be easily reused in different businesses, saving development time and costs.
[0148] In summary, we can directly build calculators for the calculator model, splitting the financial amount calculation module into independent calculators, each responsible for calculating the amount of a specific amount. For example, for repayment scenarios, we can split the interest amount calculation into specific amount types: a calculator for normal repayment interest, a calculator for repayment interest after reimbursement, and a calculator for penalty interest. This increases the modularity of the code and reduces its complexity.
[0149] It can cope with complex customized computing strategies, overcome the technical problems of existing technologies, and improve the scalability, maintainability and debuggability of computing.
[0150] Using a dynamic loading architecture, amount calculation rules can be stored in the database and dynamically loaded based on different business conditions (i.e., function codes and operation codes). For example, the interest calculation rules for normal repayments on a self-operated platform can be stored in the database and dynamically loaded when the corresponding calculator is built. This improves code maintainability and facilitates rule modification, updating, and replacement.
[0151] It should be understood that the specific order or hierarchy of steps in the disclosed processes is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process can be rearranged without departing from the scope of the present disclosure. The accompanying method claims present elements of the various steps in an exemplary order and are not intended to be limited to the specific order or hierarchy described.
[0152] In the foregoing detailed description, various features are grouped together in a single embodiment to simplify the disclosure. This method of disclosure should not be interpreted as reflecting an intention that embodiments of the claimed subject matter require more features than are expressly recited in each claim. On the contrary, as reflected in the appended claims, the invention comprises less than all the features of any individual disclosed embodiment. The appended claims are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate preferred embodiment of the invention.
[0153] The above description of the disclosed embodiments is intended to enable any person skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other embodiments without departing from the spirit and scope of the present disclosure. Therefore, the present disclosure is not limited to the embodiments presented herein but is intended to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0154] The foregoing description includes examples of one or more embodiments. Of course, it is not possible to describe all possible combinations of components or methods for the purposes of describing the above embodiments, but one of ordinary skill in the art will recognize that the various embodiments may be further combined and arranged. Therefore, the embodiments described herein are intended to encompass all such changes, modifications and variations that fall within the scope of the appended claims. Furthermore, to the extent the term "comprising" is used in the specification or claims, the term is intended to be encompassed in a manner similar to the term "including," as explained in terms of "including," used as a transitional word in the claims. Furthermore, any use of the term "or" in the specification of the claims is intended to mean a "non-exclusive or."
[0155] Those skilled in the art will also appreciate that the various illustrative logical blocks, units, and steps listed in the embodiments of the present invention can be implemented by electronic hardware, computer software, or a combination of the two. To clearly demonstrate the interchangeability of hardware and software, the various illustrative components, units, and steps described above have generally described their functions. Whether such functions are implemented by hardware or software depends on the specific application and the design requirements of the entire system. Those skilled in the art may use various methods to implement the described functions for each specific application, but such implementation should not be understood as exceeding the scope of protection of the embodiments of the present invention.
[0156] The various illustrative logic blocks or units described in the embodiments of the present invention can be implemented or operated by a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof. The general-purpose processor can be a microprocessor, and optionally, the general-purpose processor can also be any conventional processor, controller, microcontroller or state machine. The processor can also be implemented by a combination of computing devices, such as a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a digital signal processor core, or any other similar configuration.
[0157] The steps of the methods or algorithms described in the embodiments of the present invention may be directly embedded in hardware, a software module executed by a processor, or a combination of the two. The software module may be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. For example, the storage medium may be connected to the processor so that the processor can read information from the storage medium and write information to the storage medium. Alternatively, the storage medium may also be integrated into the processor. The processor and storage medium may be provided in an ASIC, which may be provided in a user terminal. Alternatively, the processor and storage medium may also be provided in different components in the user terminal.
[0158] In one or more exemplary designs, the above-mentioned functions described in the embodiments of the present invention can be implemented in hardware, software, firmware, or any combination of the three. If implemented in software, these functions can be stored on a computer-readable medium or transmitted in the form of one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media that facilitate the transfer of computer programs from one location to another. Storage media can be any available medium that can be accessed by a general or special computer. For example, such computer-readable media can include but are not limited to RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store program code in the form of instructions or data structures and other forms that can be read by a general or special computer, or a general or special processor. In addition, any connection can be appropriately defined as a computer-readable medium. For example, if the software is transmitted from a website, server or other remote resource via a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless methods such as infrared, wireless, and microwave, it is also included in the definition of computer-readable media. The disks and discs mentioned above include compact disks, laser disks, optical disks, DVDs, floppy disks, and Blu-ray discs. Disks typically reproduce data magnetically, while discs typically reproduce data optically with lasers. Combinations of the above may also be included in computer-readable media.
[0159] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for constructing a calculator for amount calculation, characterized in that: include: Before creating a calculator that implements amount calculation, obtain the corresponding function code based on the amount calculation information of the functional dimension of the amount calculation type within the corresponding dimension system, load the amount calculation rule corresponding to the function code, and construct the calculator's functional dimension branch based on the amount calculation rule corresponding to the function code. The function code represents the dimension to be achieved when performing amount calculation on the calculator. Obtaining an operation code corresponding to an operation dimension within the dimension system corresponding to the amount calculation type, and constructing an operation dimension branch of a calculator based on the operation code corresponding to the operation dimension, wherein the dimension level of the operation dimension is lower than the dimension level of the function dimension; Construct a calculator, the calculator including the functional dimension branch and the operational dimension branch, the construction code of the functional dimension branch and the construction code of the operational dimension branch are in an unrelated parallel relationship, the calculator is used to calculate the amount belonging to the amount calculation type and return the calculation result, and the construction code of the calculator corresponding to the amount calculation type is independent of the construction code of the calculator corresponding to any other amount calculation type.
2. The method for constructing a calculator for amount calculation according to claim 1, characterized in that: The method includes: obtaining amount calculation information according to the functional dimension of the functional dimension in the corresponding dimension system based on the amount calculation type, determining a corresponding function code, loading an amount calculation rule corresponding to the function code, and constructing a functional dimension branch of the calculator based on the amount calculation rule corresponding to the function code, including: The calculator executes a portal to call the facade loader, obtains amount calculation information corresponding to the functional dimension in the dimension system corresponding to the amount calculation type, determines a function code corresponding to the functional dimension based on the amount calculation information, and passes the function code to the facade loader; Loading the calculator panel instance corresponding to the function code through the facade loader; The amount calculation rule corresponding to the function code is loaded through the facade loader, and a calculator panel interface is set on the calculator panel instance according to the amount calculation rule corresponding to the function code to construct a calculator panel. The calculator panel is a functional dimension branch of the calculator, wherein the calculator panel interface is used to implement a calculation function that matches the amount calculation information of the functional dimension.
3. The method for constructing a calculator for amount calculation according to claim 2, characterized in that: The step of setting a calculator panel interface on the calculator panel instance includes: A calculation behavior abstraction matching the amount calculation information of the functional dimension is constructed in the calculator through the calculator panel interface definition, and the specific behavior of the amount calculation can be realized according to the calculation behavior abstraction of the calculator panel interface.
4. The method for constructing a calculator for amount calculation according to claim 1, characterized in that: In the dimension system corresponding to the amount calculation type, there are dimension levels higher than the functional dimension and dimension levels lower than the functional dimension, and the relationship between the dimension levels from high to low is that the previous dimension level includes the next dimension level; The method for constructing the calculator for calculating amount further includes: Determine, through a calculator execution entry, a dimension system to which the amount calculation type belongs, and determine, within the dimension system, a dimension level other than the functional dimension; For each dimension level except the functional dimension, obtaining, through the calculator execution entry, amount calculation information corresponding to the dimension level according to the amount calculation type, determining a dimension code corresponding to the dimension level according to the amount calculation information corresponding to the dimension level, calling, through the calculator execution entry, a factory loader matching the dimension level, and sending the dimension code to the factory loader matching the dimension level; Loading a calculator factory instance corresponding to the dimension code by the factory loader matching the dimension hierarchy; The amount calculation rule corresponding to the dimension code is loaded through a matching factory loader, and a calculator factory interface is set on the calculator factory instance according to the amount calculation rule corresponding to the dimension code to construct a calculator factory branch of the corresponding dimension level of the calculator, wherein the calculator factory interface is used to implement a calculation function that matches the amount calculation information of the dimension level.
5. The method for constructing a calculator for amount calculation according to claim 4, characterized in that: Also includes: For each dimension level except the functional dimension, the calculator factory interface is used to describe the abstract behavior of the calculator factory that matches the amount calculation information of the dimension level. The abstract behavior is used to constrain the specific calculation of the amount in the dimension. The calculator factory model is used to describe the abstract data structure of the calculator factory according to the abstract behavior of the calculator factory. The abstract data structure is used to implement the calculator factory branch of the dimension level.
6. The method for constructing a calculator for amount calculation according to claim 4, characterized in that: The step of obtaining an operation code corresponding to the operation dimension within the dimension system corresponding to the amount calculation type, and constructing an operation dimension branch of a calculator based on the operation code corresponding to the operation dimension, includes: When the dimension level other than the functional dimension is an operation dimension, a calculator operation loader is called through the calculator execution entry, amount calculation information corresponding to the operation dimension is obtained according to the amount calculation type, an operation code corresponding to the operation dimension is determined according to the amount calculation information corresponding to the operation dimension, and the operation code is sent to the calculator operation loader, which is a factory loader matching the operation dimension; loading, by the calculator operation loader, a calculator operation instance corresponding to the operation code, the calculator operation instance belonging to the calculator operation instance corresponding to the operation code; The amount calculation rule corresponding to the operation code is loaded through the calculator operation loader, and a calculator operation interface is set on the calculator operation instance according to the amount calculation rule corresponding to the operation code to construct an operation dimension branch of the calculator, wherein the operation dimension branch belongs to the calculator factory branch of the operation dimension, and the calculator operation interface is used to implement a calculation function that matches the amount calculation information of the operation dimension.
7. The method for constructing a calculator for amount calculation according to claim 6, characterized in that: Also includes: For the operation dimension, the abstract behavior of amount calculation is described through the calculator interface, and the abstract data structure of amount calculation is described according to the abstract behavior of amount calculation through the calculator model. The abstract behavior is used to constrain the specific calculation of the amount in the operation dimension.
8. A system for constructing a calculator for calculating amounts, characterized in that: include: A functional dimension branch construction unit is configured to, before creating a calculator that implements amount calculation, obtain, based on the functional dimension of the amount calculation type within the corresponding dimension system, a corresponding function code determined based on amount calculation information of the functional dimension, load an amount calculation rule corresponding to the function code, and construct a functional dimension branch of the calculator based on the amount calculation rule corresponding to the function code, wherein the function code represents the dimension to be achieved when performing amount calculation using the calculator; an operation dimension branch construction unit, configured to obtain an operation code corresponding to the operation dimension within the dimension system corresponding to the amount calculation type, and construct an operation dimension branch of the calculator based on the operation code corresponding to the operation dimension, wherein the dimension level of the operation dimension is lower than the dimension level of the function dimension; A calculator construction unit is used to construct a calculator, the calculator including the functional dimension branch and the operational dimension branch, the construction code of the functional dimension branch and the construction code of the operational dimension branch are in an unrelated parallel relationship, the calculator is used to calculate the amount belonging to the amount calculation type and return the calculation result, and the construction code of the calculator corresponding to the amount calculation type is independent of the construction code of the calculator corresponding to any other amount calculation type.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores one or more programs, which, when executed by a computer device, enable the computer device to execute the method for constructing a calculator for amount calculation according to any one of claims 1 to 7.
10. A computer device, characterized in that: include: processor; and a memory arranged to store computer-executable instructions, wherein when the instructions are executed, the processor executes the method for constructing a calculator for amount calculation according to any one of claims 1 to 7.
Citation Information
Patent Citations
Visual processing method, device and apparatus for fund calculation engine, and medium
CN113673997A
Method and device for determining user subsidy
CN115409537A