Business rule processing method and device, computer equipment and storage medium
By formalizing business logic into propositional structures and using JSON-formatted propositional metadata to drive front-end rendering, complete decoupling between the front-end and back-end is achieved, solving the problem of low development efficiency under the B/S architecture and improving the maintainability and flexibility of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-10
- Publication Date
- 2026-03-27
AI Technical Summary
In financial and other business systems based on B/S architecture, low development efficiency, high system coupling, and poor maintainability lead to frequent synchronization and modification of business rules between the front-end and back-end to adapt to changes in data items.
By formally describing business logic as propositional logic, generating propositional metadata, and using JSON format to drive front-end rendering, decoupling between the front-end and back-end is achieved. Only the back-end needs to update the propositional metadata and parsing logic, and the front-end will automatically adapt.
It improves the system's scalability and maintainability, reduces the cost of repetitive development, and enhances the flexibility and accuracy of business rule expression.
Smart Images

Figure CN121743389A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and in particular to a business rule processing method and device, computer equipment and a storage medium. BACKGROUND
[0002] In a financial business system based on a B / S (Browser / Server) architecture, a large number of data items are involved, such as a customer's holding amount, cumulative income amount, cumulative yield, holding income amount, holding yield, holding cost, etc. In a financial business background system based on a B / S architecture, when describing business rules, it is often necessary to limit the business scene through these data items, such as selecting customers according to certain rules, setting up a reward strategy for marketing activities, and identifying transaction risks, etc. When designing and implementing such a B / S system, the front end needs to draw related controls for user input, the front and back ends need to agree on the exchange method of rule data, the back end needs to implement the analysis of rule data and apply it to business logic, and each business scene needs to be agreed by the front and back ends on these matters, which is highly repetitive. When the data items involved in the business rules change, the front and back ends need to be synchronized to adapt and modify, which results in low development efficiency, high system coupling, and poor maintainability. SUMMARY
[0003] Therefore, it is necessary to provide a business rule processing method, device, computer equipment and storage medium that can solve the problems of low development efficiency, high system coupling and poor maintainability of a financial business system based on a B / S architecture.
[0004] In a first aspect, a business rule processing method is provided, which includes: determining a business logic based on a first terminal, and formally describing the business logic to obtain a proposition in propositional logic, the proposition including simple propositions and compound propositions; determining proposition metadata of the proposition, and sending the proposition metadata to a second terminal, the proposition metadata being used to describe structure and constraint information required by the second terminal when rendering form controls; receiving proposition data generated by the second terminal based on the proposition metadata, wherein the proposition data is generated by converting a business rule configured by a form control rendered by the second terminal based on the proposition metadata; when executing a business process, determining an analysis function corresponding to the proposition data, and analyzing the proposition data based on the analysis function to obtain a judgment result indicating whether the business logic is valid.
[0005] Optionally, based on the first terminal, determining the business logic, and performing formal description on the business logic to obtain a proposition in propositional logic includes: obtaining a business processing request, and based on the business processing request, determining the business logic required to be processed by the system; in response to the business logic being a single sub-business condition, performing formal description on the business logic to obtain a single proposition in propositional logic, the single proposition being described by using a four-tuple; in response to the business logic including a plurality of sub-business conditions and the plurality of sub-business conditions being connected by a logical conjunction word, performing formal description on the business logic to obtain a compound proposition in propositional logic, the compound proposition being described by using a two-tuple.
[0006] Optionally, determining the proposition metadata of the proposition includes: obtaining a plurality of predicate types corresponding to the proposition, and generating a predicate type set; based on a target predicate type in the predicate type set, determining a plurality of operators, and based on the plurality of operators, generating an operator set; based on the target predicate type and the operator set, generating a mapping relationship; based on the mapping relationship, determining corresponding operand input specifications; integrating the predicate type set, the mapping relationship, and the operand input specifications to generate the proposition metadata.
[0007] Optionally, the proposition data generated by the second terminal based on the proposition metadata includes: parsing the proposition metadata to determine a predicate type, an operator, and an operand input specification; according to the predicate type, the operator, and the operand input specification, constructing a corresponding rule configuration form in a user interface by rendering the form control; based on the interactive operation of a user with the rule configuration form, determining a target predicate type, a target operator, an input operand, and a configured quantifier rule; according to the target predicate type, the target operator, the input operand, and the configured quantifier rule, constructing the proposition data.
[0008] Optionally, determining the parsing function corresponding to the proposition data includes: based on the proposition data, determining the predicate type corresponding to the proposition data; based on the predicate type corresponding to the proposition data and the mapping relationship between the predicate type and the parsing function, determining the parsing function corresponding to the predicate type.
[0009] Optionally, based on the parsing function, the proposition data is parsed to obtain a judgment result indicating whether the business logic is valid. Based on the proposition data, a target operator, an operand, and a quantifier rule are determined, and real-time business data is obtained; Based on the parsing function, the target operator, the operand, the quantifier rule, and the real-time business data are parsed to obtain a binary result; Based on the binary result, it is determined whether the business logic defined by the proposition data is valid with respect to the real-time business data.
[0010] Optionally, the method further comprises: The first terminal converts the proposition metadata into first JSON format data through a first serialization operation, and sends the first JSON format data to the second terminal; The second terminal converts the proposition data object into second JSON format data through a second serialization operation, and sends the second JSON format data to the first terminal; The first serialization operation and the second serialization operation both comply with the same JSON serialization standard to convert a structured object into a corresponding JSON format string.
[0011] In a second aspect, a business rule processing apparatus is provided, and the apparatus comprises: A proposition generation module configured to determine a business logic based on a first terminal, and to perform a formal description of the business logic to obtain a proposition in a propositional logic, the proposition comprising a simple proposition and a compound proposition; A proposition metadata generation module configured to determine proposition metadata of the proposition, and to send the proposition metadata to a second terminal, the proposition metadata being used to describe structure and constraint information required by the second terminal when rendering a form control; A data receiving module configured to receive proposition data generated by the second terminal based on the proposition metadata, wherein the proposition data is generated by converting a business rule configured by a form control rendered by the second terminal based on the proposition metadata; An analysis module configured to determine a parsing function corresponding to the proposition data when a business process is executed, and to parse the proposition data based on the parsing function to obtain a judgment result indicating whether the business logic is valid.
[0012] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the following steps when executing the computer program: determine a business logic based on a first terminal, and perform a formal description on the business logic to obtain a proposition in a propositional logic, the proposition including a simple proposition and a compound proposition; determine proposition metadata of the proposition, and send the proposition metadata to a second terminal, the proposition metadata being used to describe structure and constraint information required by the second terminal when rendering a form control; receive proposition data generated by the second terminal based on the proposition metadata, wherein the proposition data is generated by a business rule configured by a form control rendered by the second terminal according to the proposition metadata; when executing a business process, determine an analysis function corresponding to the proposition data, and analyze the proposition data based on the analysis function to obtain a judgment result indicating whether the business logic is valid.
[0013] In a fourth aspect, a computer-readable storage medium is provided, and the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the following steps are implemented: determine a business logic based on a first terminal, and perform a formal description on the business logic to obtain a proposition in a propositional logic, the proposition including a simple proposition and a compound proposition; determine proposition metadata of the proposition, and send the proposition metadata to a second terminal, the proposition metadata being used to describe structure and constraint information required by the second terminal when rendering a form control; receive proposition data generated by the second terminal based on the proposition metadata, wherein the proposition data is generated by a business rule configured by a form control rendered by the second terminal according to the proposition metadata; when executing a business process, determine an analysis function corresponding to the proposition data, and analyze the proposition data based on the analysis function to obtain a judgment result indicating whether the business logic is valid.
[0014] In a fifth aspect, a computer program product is provided, and the computer program product includes a computer program. When the computer program is executed by a processor, the following steps are implemented: determine a business logic based on a first terminal, and perform a formal description on the business logic to obtain a proposition in a propositional logic, the proposition including a simple proposition and a compound proposition; determine proposition metadata of the proposition, and send the proposition metadata to a second terminal, the proposition metadata being used to describe structure and constraint information required by the second terminal when rendering a form control; receive proposition data generated by the second terminal based on the proposition metadata, wherein the proposition data is generated by a business rule configured by a form control rendered by the second terminal according to the proposition metadata; In execution of the business process, a resolution function corresponding to the proposition data is determined, and the proposition data is resolved based on the resolution function to obtain a judgment result indicating whether the business logic is valid.
[0015] The business rule processing method, device, computer device and storage medium, the method comprises: determining a business logic based on a first terminal, and performing formal description on the business logic to obtain a proposition in propositional logic, the proposition comprising a simple proposition and a compound proposition; determining proposition metadata of the proposition, and sending the proposition metadata to a second terminal, the proposition metadata being used to describe structure and constraint information required by the second terminal when rendering a form control; receiving proposition data generated by the second terminal based on the proposition metadata, wherein the proposition data is converted from a business rule configured by a form control rendered by the second terminal according to the proposition metadata; in execution of the business process, a resolution function corresponding to the proposition data is determined, and the proposition data is resolved based on the resolution function to obtain a judgment result indicating whether the business logic is valid. The present application formalizes the business logic into a proposition structure based on predicate logic, and drives front-end dynamic rendering by using JSON-formatted proposition metadata, thereby realizing complete decoupling of front-end and back-end in business rule processing. When data items or judgment logic involved in the business rule change, only the back-end needs to update the proposition metadata and resolution logic, and the front-end can automatically adapt without any modification, thereby improving the scalability and maintainability of the system. Meanwhile, the present application introduces a four-tuple structure of predicate type, operator, operand and quantifier, and can accurately describe complex business rules with limited conditions, thereby solving the problem of insufficient modeling capability of related schemes for internal structure of a simple proposition, enhancing the flexibility and accuracy of business rule expression, and effectively reducing the repeated development cost in multiple scenarios. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present application, the drawings required in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0017] Figure 1 An application environment diagram of the business rule processing method in an embodiment; Figure 2 A whole flowchart of the business rule processing method in an embodiment; Figure 3 Another whole flowchart of the business rule processing method in an embodiment; Figure 4A conceptual model diagram provided in an embodiment; Figure 5 A rendering diagram of a form and a control provided in an embodiment; Figure 6 A proposition analysis flow diagram provided in an embodiment; Figure 7 A whole structure diagram of a business rule processing apparatus provided in an embodiment; Figure 8 An internal structure diagram of a computer device provided in an embodiment. DETAILED DESCRIPTION
[0018] For the purpose, technical scheme and advantages of the present application to be clearer, the technical scheme in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0019] It should be understood that, in the description of the present application, unless the context clearly requires otherwise, the terms "comprise", "comprising", and the like in the whole specification should be interpreted as including the meaning of "including but not limited to", rather than the exclusive or exhaustive meaning. That is, the meaning of "including but not limited to".
[0020] It should also be understood that the terms "first", "second", and the like are only for the purpose of description, and should not be understood as indicating or implying relative importance. In addition, in the description of the present application, unless otherwise stated, the meaning of "multiple" is two or more.
[0021] It should be noted that the terms "S1", "S2", and the like are only for the purpose of describing the steps, and do not specifically refer to the order or position, nor limit the present application. They are only for the convenience of describing the method of the present application, and should not be understood as indicating the order of the steps. In addition, the technical solutions of each embodiment can be combined with each other, but it must be based on the realization of the person skilled in the art. When the combination of technical solutions contradicts each other or cannot be realized, it should be considered that the combination of technical solutions does not exist, nor within the scope of protection required by the present application.
[0022] The business rule processing method provided by the present application can be applied to, for example, Figure 1In the application environment shown, terminal 102 communicates with a data processing platform set on server 104 via a network. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. Server 104 can be implemented as a standalone server or a server cluster consisting of multiple servers.
[0023] In one embodiment, such as Figure 2 and Figure 3 As shown, a business rule processing method is provided, which is applied to... Figure 1 Taking the terminal in the example, the explanation includes the following steps: S1: Based on the first terminal, determine the business logic and formally describe the business logic to obtain the propositions in the propositional logic, which include single propositions and compound propositions.
[0024] It's important to clarify that business logic semantically represents business data meeting certain conditions. It's the part of the software that handles core business rules and processes. It defines how data is created, stored, and modified, and encapsulates the specific rules, algorithms, and decision-making processes necessary to solve business problems. It's typically manifested as backend functions, services, and database operations. It's the engine that transforms static business rules into dynamic calculations and decisions. To facilitate processing by computer programs, it's described as a proposition in propositional logic. Propositions are divided into single propositions and compound propositions. A single proposition is a statement of a single business logic statement, while a compound proposition consists of multiple single propositions and logical connectives, used to describe the comprehensive consideration of multiple business logics. The first terminal refers to the backend program, which is the software system running on the server. The backend is responsible for handling core business logic, data storage, and system integration. It receives frontend requests, performs authentication, database operations, complex calculations, and business process handling, and returns the results to the frontend. The backend does not directly interact with users but provides data and service support to frontend applications, mobile apps, or other systems, ensuring the correct execution of business rules and data security. Formal description is the process of abstracting and defining business concepts, rules, or system behaviors using a specification language or data model with precise syntax and clear semantics. It transforms ambiguous natural language or implicit knowledge into a structured, machine-readable format, providing a foundation for automated processing and unambiguous interpretation. It is a key step in achieving human-machine collaboration and system intelligence. The code for the propositional metadata is shown below: { "code": "sendMessage", "name": "Whether SMS messages can be sent", "type": "texture", "predicates": [ { "code": "eq", "name": "equals", "rangeValues": false, "multiValues": true, "manualValues": false, "dynamicValues": false, "expectedValues": [...] / / 2 items }, { "code": "neq", "name": "Not equal to", "rangeValues": false, "multiValues": true, "manualValues": false, "dynamicValues": false, "expectedValues": [...] / / 2 items } ], "group": "customer", "subGroup": "otcCustomer" } The code for the propositional metadata format is shown below: / / Proposition Meta { "code": "", / / Indicator code "name": "", / / Indicator name "type": "", / / Metric type: texture, integral, decimal, date, percentage "predicates": [ / / predicates { "code": "", / / Predicate code "name": "", / / Predicate name "rangeValues": false, / / Whether it is a range "multiValues": false, / / Whether to select multiple values "manualValues": false, / / Whether to manually input "dynamicValues": false, / / Whether to dynamically retrieve values "expectedValues": [ / / Valid values] { "name": "", / / Valid value name "value": "" / / Valid value ID } ], "expectedRangeValues": [ / / Valid values (range)] { "name": "", / / Valid value name "minValue": "", / / Starting value "maxValue": "" / / End value } ] } ], "parameters": [ / / Parameters { "code": "", / / Parameter code "name": "", / / Parameter name "type": "", / / Parameter type: texture, integral, decimal, date, percentage "predicates": [ / / predicates { "code": "", / / Operation code "name": "", / / Operator name "rangeValues": false, / / Whether it is a range "multiValues": false, / / Whether to select multiple values "manualValues": false, / / Whether to manually input "dynamicValues": false, / / Whether to dynamically retrieve values "expectedValues": [ / / Valid values] { "name": "", / / Valid value name "value": "" / / Valid value ID } ], "expectedRangeValues": [ / / Valid values (range)] { "name": "", / / Valid value name "minValue": "", / / Starting value "maxValue": "" / / End value } ] } ] } ] } S2: Determine the proposition metadata of the proposition and send the proposition metadata to the second terminal. The proposition metadata is used to describe the structure and constraint information required by the second terminal when rendering form controls.
[0025] It should be noted that the proposition metadata is a structured data package generated by the backend, which defines all the business rule components supported by the system and their constraints, including available predicate types, corresponding operators, operand input specifications and quantifier rules, which are used as a blueprint for dynamically rendering the rule configuration form on the front end, decoupling business rule description from implementation, and driving the collaboration between the front and back ends; The second terminal refers to the front-end program, which is a software running on user devices (such as browsers and mobile phones) and is responsible for presenting the user interface and processing interaction logic. It receives user input through graphical controls, converts operations into data requests and sends them to the backend, and receives and displays the results returned by the backend; The structure and constraint information required to render the form control includes: a list of all available predicate types, a set of operators corresponding to each predicate type, an operand input specification (such as data type, input method, value range, multiple selection or interval) corresponding to each operator, and a set of available quantifier rules. These metadata collectively define the type, options and behavior logic of the front-end control, ensuring that the interface rendering is consistent with the backend business capabilities; Form controls are basic interactive elements in the user interface that receive user input or selection. Types include input boxes, drop-down selection boxes, single / multiple selection boxes, and date selectors. They collect data through graphical means and are the basic components for building rule configuration forms and implementing user interaction with the application. Their type and behavior are dynamically driven by backend metadata. Rendering form controls refers to the process of generating corresponding user interface elements based on backend-provided metadata (such as type, options, constraints) by the front-end program. For example, "date type" metadata is converted into a date selector control. This process decouples the interface from the business logic, allowing the form to automatically adapt to changes in metadata without modifying the front-end code.
[0026] S3: Receive proposition data generated by the second terminal based on the proposition metadata, wherein the proposition data is converted from the business rules configured by the form controls rendered by the second terminal based on the proposition metadata.
[0027] It should be noted that the configured business rules are specific business conditions and logic combinations defined by users through front-end form controls, such as "VIP customers and holding amount greater than 100,000". They are formed by selecting predicate types, operators, input operands and setting quantifiers, and are finally converted into structured proposition data as the basis for backend analysis and execution, used to instantiate user business intent. The code of the proposition data is as follows: { "id": "fbae175920317241", "type": "compound", "connective": "and", "subPropositions": [ { "id": "fbae175920318857", "type": "single", "code": "confirmDate", "predicate": { "code": "ge", "values": [ "2025-09-01" ] }, "parameters": [ { "id": "fbae1759203333636", "code": "FundName", "predicate": { "code": "eq", "values": [ "000001" ] } }, { "id": "fbae1759203382334", "code": "tradeAmount", "predicate": { "code": "ge", "values": [ "100" ] } } ] }, { "id": "fbae1759203320257", "type": "single", "code": "lastTradeDate", "predicate": { "code": "ge", "values": [ "2025-10-01" }, "parameters": [] } } S4: In the execution of the business process, a parsing function corresponding to the proposition data is determined, and the proposition data is parsed based on the parsing function to obtain a judgment result indicating whether the business logic is valid.
[0028] It should be noted that the business process is a series of logically related tasks or activity sequences for completing a specific business goal, for example, in a financial scenario, the "customer qualification screening" process may include: receiving a request, parsing rules, querying data, performing a judgment, returning a result, etc. Steps define the workflow and decision path from start to finish, which is an ordered embodiment of business logic at the operation level; the parsing function is an execution unit used by the backend to process a specific predicate type, which receives operators, operands, quantifier rules, and real-time business data as parameters, and returns a "true / false" result by querying the database or logical operation to determine whether the business condition is valid. Each parsing function encapsulates the execution logic for a class of business rules.
[0029] In the above embodiments, by formalizing the business logic as a proposition structure based on predicate logic and using JSON-formatted proposition metadata to drive front-end dynamic rendering, the front-end and back-end are completely decoupled in business rule processing. When the data items or judgment logic involved in the business rules change, only the back-end needs to update the proposition metadata and parsing logic, and the front-end can automatically adapt without any modification, improving the scalability and maintainability of the system. At the same time, this method introduces a four-tuple structure of predicate type, operator, operand, and quantifier to accurately describe complex business rules with limiting conditions, solving the problem of insufficient internal structure modeling capability of single propositions in related solutions, enhancing the flexibility and accuracy of business rule expression, and effectively reducing the cost of repeated development in multiple scenarios.
[0030] In some specific embodiments, as shown in Figure 4 based on the first terminal, determining a business logic and formally describing the business logic to obtain a proposition in the proposition logic includes: obtaining a business processing request, determining the business logic required by the system based on the business processing request, wherein the business processing request is an instruction initiated by the front-end or external system to the back-end, requiring a specific business operation to be performed, which usually includes operation type, parameters and context information, such as requesting to execute customer screening rules; In response to the business logic being a single sub-business condition, the business logic is described in a formalized manner to obtain a single proposition in propositional logic, the single proposition is described by using a quadruple, the single sub-business condition is a smallest business judgment unit that cannot be divided, and corresponds to an atomic proposition in the propositional logic, for example, "the holding amount is greater than 10000 yuan", which is composed of a determined predicate type, an operator and an operand, is a basic component element of a composite business rule, and is defined as a single proposition without a logical connective in the formalized description, the quadruple is a data structure for describing the single proposition, and includes four elements: a predicate type (T) indicating a business attribute, an operator (V) defining a judgment relationship, an operand (N) providing a comparison benchmark, and a quantifier (Q) limiting a data range, through the data structure, any atomic business condition can be converted into a standardized unit that can be processed by a machine; In response to the business logic including a plurality of sub-business conditions and the plurality of sub-business conditions being connected by a logical connective, the business logic is described in a formalized manner to obtain a composite proposition in the propositional logic, the composite proposition is described by using a binary tuple, wherein in the composite proposition, the sub-business condition can be a single sub-business condition (single proposition) or another composite proposition, the binary tuple is a data structure for describing the composite proposition, and includes two elements: a logical connective (such as "and" or "or") and a sub-proposition list, such as a binary tuple composed of a logical connective (C) and a sub-proposition list ([P1, P2,..., Pn]), which defines the logical relationship between the sub-propositions defined by the logical connective, and the sub-proposition list includes one or more single propositions or composite propositions, through the structure, recursive nesting of the business rule can be realized, and complex logical conditions can be completely expressed.
[0031] In some embodiments, determining the proposition metadata of the proposition includes: Obtaining a plurality of predicate types corresponding to the proposition to generate a predicate type set; Based on a target predicate type in the predicate type set, determining a plurality of operators, and based on the plurality of operators, generating an operator set; Based on the target predicate type and the operator set, generating a mapping relationship; Based on the mapping relationship, determining a corresponding operand input specification; Integrating the predicate type set, the mapping relationship and the operand input specification to generate the proposition metadata.
[0032] In some embodiments, the method further includes: The first terminal converts the proposition metadata into first JSON format data through a first serialization operation, and sends the first JSON format data to the second terminal; The second terminal converts the proposition data object into second JSON format data through a second serialization operation and sends to the first terminal; The first serialization operation and the second serialization operation both comply with the same JSON serialization standard to convert the structured object into the corresponding JSON format string.
[0033] Specifically, the internal structure of a single proposition is described using predicate logic, and the predicate is composed of a predicate symbol, a variable, and a quantifier. The predicate symbol represents a certain judgment. In order to facilitate the combination with business logic, three variables, predicate type T, operator V, and operand N, are used for description. The operand N corresponds to the quantifiable or numerical part in the predicate symbol, and can be flexibly adjusted to derive different predicate symbols. The operator V and the operand N are combined to form a complete predicate symbol. The predicate type T can be regarded as a grouping of the predicate symbol. The variable is the object of the predicate symbol, and corresponds to the business data applied in the business logic, which is different from the mathematical division of the quantifier into universal quantifier and existential quantifier. In order to describe complex business scenarios, the concept of quantifier is generalized in the present application. The quantifier Q corresponds to a group of rules, which are used to limit the range of business data. Each rule is also a predicate in form, but no longer contains a quantifier. Taking the business logic “the net value amount of fund 000001 held by customer 2025-10-01 is greater than 100 yuan” as an example: ; ; ; ; ; After establishing the relationship between the business logic and the proposition logic and the predicate logic using the above method, the proposition converted from the business logic is represented using the JSON format (i.e., the first serialization operation described above), which is the description method of the business logic.
[0034] Further, the description of the business logic is implemented in two stages. In the first stage, the backend program outputs proposition metadata in JSON format, describing all possible propositions in the business system. The front-end program draws the corresponding form controls in the browser according to the proposition metadata output by the backend program, for the user to configure specific business rules. The information provided by the backend program includes: (1) all possible proposition types; (2) for a given proposition type, all possible operators; (3) for a given proposition type and operator, all possible operands or their ranges, including data type, whether it is an interval, single value or multiple value, manual input or selection from the alternatives, whether dynamic loading of alternatives is required, alternative list, etc.; (4) for a given predicate type, all possible quantifiers. In the second stage, the user configures specific business rules through the front-end controls and submits the form. The front-end program converts the form data into proposition data in JSON format and sends it to the backend program. The data conversion operation is the second serialization operation described above.
[0035] In some embodiments, the proposition data generated by the second terminal based on the proposition metadata includes: parsing the proposition metadata to determine the predicate type, the operator, and the operand input specification; constructing a corresponding rule configuration form in the user interface by rendering the form controls according to the predicate type, the operator, and the operand input specification, wherein the rule configuration form is a user interface dynamically generated by the front-end according to the proposition metadata, used for the user to combine and define specific business rules through selection, input, etc., and contains a series of form controls for converting the user's operations into structured proposition data; determining the target predicate type, the target operator, the input operand, and the configured quantifier rule based on the user's interactive operations on the rule configuration form, wherein the user's interactive operations include selecting the predicate type and the operator from the drop-down list, filling in or selecting the operand value in the input box, clicking the button to add / delete the quantifier rule or the sub-proposition, and selecting the logical conjunction word (and / or), based on which the structured configuration of the business rule is realized; constructing the proposition data according to the target predicate type, the target operator, the input operand, and the configured quantifier rule, wherein the proposition data is structured data generated by the front-end after the user defines the business rule through the rule configuration form, in JSON format, accurately describing the logical structure of the single proposition (four-tuple) or the compound proposition (two-tuple), which is a machine-readable carrier of the business rule, directly for the backend to parse and execute.
[0036] Specifically, as Figure 5As shown, the proposition metadata is rendered into form controls by the front-end program, which occurs after the back-end program generates the proposition metadata and sends it to the front-end program. The front-end program needs to render the proposition metadata into form controls for user input of specific business logic. To cope with the actual situation of variable business logic and avoid simultaneous modification of the front-end and back-end in response to business changes, the rendering of form controls is performed in a business-independent manner and is completely controlled by the proposition metadata. User input is in units of propositions, which are divided into single propositions and compound propositions. Single propositions are rendered as a card, and compound propositions are rendered as multiple cards arranged vertically. Each card corresponds to a sub-proposition in the compound proposition. The side of the sub-proposition list should also indicate the logical conjunction word ("and" or "or") of the compound proposition. Sub-propositions can be single propositions or compound propositions, so the cards of sub-propositions also have two forms: single proposition and compound proposition, which are recursively nested according to the aforementioned layout. Within the card of each proposition, there are two areas: the upper area and the lower area. The upper area has three form controls arranged side by side as input controls for predicate type, operator, and operand. In the initial state, the operator and operand controls are grayed out (not operable). After selecting the proposition type, the operator control is ungrayed. After selecting the operator, the operand control is ungrayed. The proposition type and operator input controls are in the form of a drop-down list. The operand input control type is affected by related information in the proposition metadata, including: (1) Data type: For example, date operands use a date selector, and text operands (in manual input cases) use a text box. (2) Whether it is multi-valued: If it is multi-valued, a special multi-valued text box or drop-down list control variant will be used. (3) Whether it is manual input: For example, text data type operands use a text box in manual input cases, and a drop-down list in non-manual input cases. The drop-down list may contain alternatives in the proposition metadata or be dynamically obtained by the front-end through an interface (for example, in cases of large data volume or high real-time requirements). (4) Whether it is an interval: If it is an interval, a pair of input controls will be displayed for entering the minimum and maximum values of the interval.
[0037] The lower area of the card is the quantifier list. Quantifiers can be regarded as predicates that do not contain quantifiers. They contain predicate type, operator, and operand, similar to the display format in the upper part of the card. Three form controls are used for input. The card also contains buttons to add and delete quantifiers.
[0038] Further, after the user inputs specific business logic through the front-end program rendered form control, the front end needs to convert the form into JSON format proposition data and submit it to the back end, each piece of business logic is converted into a proposition, which can be a simple proposition or a compound proposition, the compound proposition is composed of a list of sub-propositions and a logical conjunction word, the list of sub-propositions can contain simple propositions or compound propositions, and each simple proposition is described by the four tuple (T, V, N, Q) in the above steps.
[0039] In some embodiments, determining the parsing function corresponding to the proposition data comprises: Based on the proposition data, determining the predicate type corresponding to the proposition data; Based on the predicate type corresponding to the proposition data and the mapping relationship between the predicate type and the parsing function, determining the parsing function corresponding to the predicate type, the mapping relationship is pre-set and stored in the database, and can be directly called. The parsing function is a processing unit used by the back end to execute proposition judgment, which receives the operator, operand, quantifier rule and real-time business data in the proposition data as input, and finally returns a Boolean value (true / false) to determine whether the corresponding business rule is established through logical processing such as query and calculation.
[0040] In some embodiments, based on the parsing function, parsing the proposition data to obtain a judgment result indicating whether the business logic is established comprises: Based on the proposition data, determining the target operator, operand and quantifier rule, and obtaining real-time business data; Based on the parsing function, the target operator, the operand, the quantifier rule and the real-time business data are parsed to obtain a binary result, wherein the binary result is a Boolean type judgment conclusion output after the execution of the parsing function, only containing "true" or "false" two states, which indicates whether the current business data completely satisfies the business rule defined by the proposition data, and is a direct basis for driving business process decision (such as passing the audit, triggering risk control); Based on the binary result, determining whether the business logic defined by the proposition data is established with respect to the real-time business data.
[0041] Specifically, as Figure 6As shown, after the backend receives the proposition data submitted by the front end, when performing the related business process, it is determined whether the business logic is established by parsing the proposition data and applying the business data. The parsing of the proposition data is a recursive process. The parsing process of a single proposition requires the backend to identify and encode the four-tuple (T, V, N, Q) of the single proposition predicate. The parsing process of a compound proposition is to parse each sub-proposition first and then aggregate the results according to the conjunction word. The backend locates the component for parsing specific proposition data through the predicate type T in the predicate four-tuple, which is usually a program function, and then calls the function with V, N, Q and business data as inputs. The function returns "yes" or "no" as output, indicating that the business logic is established or not, respectively. Taking the business logic "customer 2025.10.1 holds the net value of fund 000001 greater than 100 yuan" in the above steps as an example, the backend first locates the function F for judging the customer's single fund holding net value through T="single fund holding net value", and then calls F with V="greater than", N="100 yuan", Q=[(T'= "fund code", V'= "yes", N'= "000001"), (T'= "net value date", V'= "yes", N'= "2025.10.1")] and customer identifier I as input parameters. The function will use these parameters to splice 1SQL for querying the customer's historical holding table. Its pseudo code can be represented as: ; ; ; ; ; Among them, the value "A1B2" in ① corresponds to the customer identifier I, the comparison symbol >= in ② corresponds to the operator V="greater than", the value 100 corresponds to the operand N="100 yuan", and clauses ③ and ④ correspond to the two rules of the quantifier part, respectively. If the returned value of the executed SQL (a standard programming language for managing and operating a relational database) is greater than 1, the business logic is established, and the function F returns "yes". Otherwise, the function F returns "no". The internal logic of the component for parsing a specific single proposition is not necessarily to splice and execute SQL. The backend develops and customizes it according to the actual needs of the business. To illustrate the parsing process of a compound proposition, assume that the compound proposition is , where is a sub-proposition, is a logical conjunction word, and the parsing first parses each sub-proposition to obtain the result , and then aggregates the parsing results of each sub-proposition: if C="AND", then the value of is "yes" only when all the values are "yes", and the parsing structure of the compound proposition P is "yes". If C="OR", then the value of When the values of the single propositions P1, P2, P3, and P4 are all "no", the analytic structure of the compound proposition P is "no".
[0042] In the business rule processing method, the method comprises: determining a business logic based on a first terminal, and performing formal description on the business logic to obtain a proposition in a propositional logic, the proposition comprising a single proposition and a compound proposition; determining proposition metadata of the proposition, and sending the proposition metadata to a second terminal, the proposition metadata being used to describe structure and constraint information required by the second terminal when rendering a form control; receiving proposition data generated by the second terminal based on the proposition metadata, wherein the proposition data is generated by converting a business rule configured by a form control rendered by the second terminal according to the proposition metadata; when a business process is executed, determining an analytic function corresponding to the proposition data, and based on the analytic function, analyzing the proposition data to obtain a judgment result indicating whether the business logic is true or not. The application formalizes the business logic into a proposition structure based on predicate logic, and drives front-end dynamic rendering by using JSON format proposition metadata, thereby realizing complete decoupling of front-end and back-end in business rule processing. When data items or judgment logic involved in the business rule change, only the back-end needs to update the proposition metadata and analytic logic, and the front-end does not need any modification and can automatically adapt, thereby improving the scalability and maintainability of the system. Meanwhile, the method introduces a four-tuple structure of predicate type, operator, operand, and quantifier, can accurately describe complex business rules with limiting conditions, solves the problem of insufficient modeling capability of related schemes for internal structure of single propositions, enhances the flexibility and accuracy of business rule expression, and effectively reduces the repeated development cost in multiple scenarios. When a business system with business logic description scene is built in B / S architecture, the front-end and back-end can realize a complete link of control rendering, user input, front-end and back-end transmission, and back-end analytic application in a highly abstract manner. When data items change, the front-end does not need to be adapted, and only the back-end needs to modify the analytic and application logic, thereby improving the scalability and robustness of the system.
[0043] It should be understood that, although Figures 2-6 the steps in the flowchart of FIG. 1 are shown in a sequential order, such that each step must be completed or otherwise occurred before a subsequent step can be performed, it is not always necessary that the steps be performed in this order. Rather, the steps of the method can be performed in any order or simultaneously, unless this has been explicitly stated otherwise. Moreover, Figures 2-6 at least some of the steps in the flowchart of FIG. 1 can include multiple sub-steps or multiple stages, which can be performed at different times, and need not be performed in any particular order.
[0044] In one embodiment, as shown in Figure 7 A business rule processing apparatus is provided, comprising a proposition generation module, a proposition metadata generation module, a data receiving module and an analysis module, wherein: The proposition generation module is configured to determine a business logic based on a first terminal, and to formalize the business logic to obtain a proposition in a proposition logic, the proposition comprising a simple proposition and a compound proposition; The proposition metadata generation module is configured to determine proposition metadata of the proposition, and to send the proposition metadata to a second terminal, the proposition metadata being used to describe structure and constraint information required by the second terminal when rendering a form control; The data receiving module is configured to receive proposition data generated by the second terminal based on the proposition metadata, wherein the proposition data is converted from a business rule configured by a form control rendered by the second terminal based on the proposition metadata; The analysis module is configured to determine an analysis function corresponding to the proposition data when executing a business process, and to analyze the proposition data based on the analysis function to obtain a judgment result indicating whether the business logic is true or not.
[0045] As a preferred embodiment, in the embodiment of the present application, the proposition generation module is specifically configured to: Obtain a business processing request, and determine a business logic required by the system based on the business processing request; In response to the business logic being a single sub-business condition, formalize the business logic to obtain a simple proposition in a proposition logic, the simple proposition being described by a four-tuple; In response to the business logic comprising a plurality of sub-business conditions connected by a logical conjunction word, formalize the business logic to obtain a compound proposition in a proposition logic, the compound proposition being described by a two-tuple.
[0046] As a preferred embodiment, in the embodiment of the present application, the proposition metadata generation module is specifically configured to: Obtain a plurality of predicate types corresponding to the proposition, and generate a predicate type set; Determine a plurality of operators based on a target predicate type in the predicate type set, and generate an operator set based on the plurality of operators; Generate a mapping relationship based on the target predicate type and the operator set; Determine a corresponding operand input specification based on the mapping relationship; Integrating the predicate type set, the mapping relationship and the operand input specification to generate the proposition metadata.
[0047] As a preferred embodiment, in the embodiment of the present application, the data receiving module is specifically used for: analyzing the proposition metadata to determine a predicate type, an operator and an operand input specification; rendering the form control according to the predicate type, the operator and the operand input specification to build a corresponding rule configuration form in a user interface; determining a target predicate type, a target operator, an input operand and a configured quantifier rule based on the interactive operation of a user with the rule configuration form; building the proposition data according to the target predicate type, the target operator, the input operand and the configured quantifier rule.
[0048] As a preferred embodiment, in the embodiment of the present application, the analyzing module is specifically used for: determining a predicate type corresponding to the proposition data based on the proposition data; determining an analyzing function corresponding to the predicate type based on the predicate type corresponding to the proposition data and a mapping relationship between the predicate type and the analyzing function.
[0049] As a preferred embodiment, in the embodiment of the present application, the analyzing module is specifically used for: determining a target operator, an operand and a quantifier rule based on the proposition data, and obtaining real-time business data; analyzing the target operator, the operand, the quantifier rule and the real-time business data based on the analyzing function to obtain a binary result; determining whether a business logic defined by the proposition data is established with respect to the real-time business data based on the binary result.
[0050] As a preferred embodiment, in the embodiment of the present application, the device comprises a data format conversion module, which is specifically used for: the first terminal converts the proposition metadata into first JSON format data through a first serialization operation and sends the first JSON format data to the second terminal; the second terminal converts the proposition data object into second JSON format data through a second serialization operation and sends the second JSON format data to the first terminal; The first serialization operation and the second serialization operation both comply with the same JSON serialization standard to convert a structured object into a corresponding JSON format string.
[0051] The specific limitation of the business rule processing apparatus can refer to the limitation of the business rule processing method in the foregoing, which will not be repeated here. Each module in the business rule processing apparatus can be realized by software, hardware, and a combination thereof, in whole or in part. Each module can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operation corresponding to each module.
[0052] In an embodiment, a computer device, which can be a terminal, can have an internal structure as shown in Figure 8 The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is configured to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement a business rule processing method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball, or touchpad arranged on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0053] Those skilled in the art can understand that Figure 8 The structure shown in the foregoing merely is a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the diagram, or combine certain components, or have a different arrangement of components.
[0054] In an embodiment, a computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor implements the following steps when executing the computer program: S1: determining a business logic based on a first terminal, and formulating the business logic to obtain a proposition in propositional logic, the proposition including a simple proposition and a compound proposition; S2: determining proposition metadata of the proposition, and sending the proposition metadata to a second terminal, the proposition metadata being used to describe structure and constraint information required by the second terminal when rendering a form control; S3: receiving proposition data generated by the second terminal according to the proposition metadata, wherein the proposition data is generated by the business rule configured by the form control rendered by the second terminal according to the proposition metadata; S4: determining an analysis function corresponding to the proposition data when executing the business process, and analyzing the proposition data based on the analysis function to obtain a judgment result indicating whether the business logic is valid.
[0055] In one embodiment, a computer readable storage medium is provided, and a computer program is stored on the computer readable storage medium. The computer program is executed by a processor to implement the following steps: S1: determining a business logic based on a first terminal, and formulating the business logic to obtain a proposition in a proposition logic, wherein the proposition includes a simple proposition and a compound proposition; S2: determining proposition metadata of the proposition, and sending the proposition metadata to a second terminal, wherein the proposition metadata is used to describe structure and constraint information required by the second terminal when rendering a form control; S3: receiving proposition data generated by the second terminal according to the proposition metadata, wherein the proposition data is generated by the business rule configured by the form control rendered by the second terminal according to the proposition metadata; S4: determining an analysis function corresponding to the proposition data when executing the business process, and analyzing the proposition data based on the analysis function to obtain a judgment result indicating whether the business logic is valid.
[0056] In one embodiment, a computer program product is provided, and the computer program product includes a computer program. The computer program is executed by a processor to implement the following steps: S1: determining a business logic based on a first terminal, and formulating the business logic to obtain a proposition in a proposition logic, wherein the proposition includes a simple proposition and a compound proposition; S2: determining proposition metadata of the proposition, and sending the proposition metadata to a second terminal, wherein the proposition metadata is used to describe structure and constraint information required by the second terminal when rendering a form control; S3: receiving proposition data generated by the second terminal according to the proposition metadata, wherein the proposition data is generated by the business rule configured by the form control rendered by the second terminal according to the proposition metadata; S4: determining an analysis function corresponding to the proposition data when executing the business process, and analyzing the proposition data based on the analysis function to obtain a judgment result indicating whether the business logic is valid.
[0057] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiment methods can be included. Any reference to memory, storage, database or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0058] The technical features of the above embodiments can be combined in any way. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, but as long as the combinations of the technical features do not exist, they should be considered as the scope of the present application.
[0059] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, some modifications and improvements can be made, which are all within the protection scope of the present application.
Claims
1. A business rule processing method, characterized in that, The method includes: Based on the first terminal, the business logic is determined, and the business logic is formally described to obtain the propositions in the propositional logic, which include single propositions and compound propositions; Determine the proposition metadata of the proposition and send the proposition metadata to the second terminal. The proposition metadata is used to describe the structure and constraint information required by the second terminal when rendering form controls. Receive proposition data generated by the second terminal based on the proposition metadata, wherein the proposition data is generated by the business rules configured by the form control rendered by the second terminal based on the proposition metadata; When executing a business process, the parsing function corresponding to the propositional data is determined, and the propositional data is parsed based on the parsing function to obtain a judgment result indicating whether the business logic is valid.
2. The business rule processing method according to claim 1, characterized in that, Based on the first terminal, the business logic is determined, and the business logic is formally described to obtain the propositions in the propositional logic, including: Obtain a business processing request, and based on the business processing request, determine the business logic that the system needs to process; In response to the business logic being a single sub-business condition, the business logic is formally described to obtain a single proposition in the propositional logic, which is described using a quadruple; In response to the fact that the business logic includes multiple sub-business conditions and the multiple sub-business conditions are connected by logical connectives, the business logic is formally described to obtain a compound proposition in propositional logic, and the compound proposition is described using a pair of tuples.
3. The business rule processing method according to claim 1, characterized in that, The propositional metadata of the proposition includes: Obtain multiple predicate types corresponding to the proposition and generate a set of predicate types; Based on the target predicate type in the predicate type set, multiple operators are determined, and an operator set is generated based on the multiple operators; Based on the target predicate type and the set of operators, a mapping relationship is generated; Based on the mapping relationship, the corresponding operand input specifications are determined; The predicate type set, the mapping relationship, and the operand input specification are integrated and processed to generate the proposition metadata.
4. The business rule processing method according to claim 3, characterized in that, The proposition data generated by the second terminal based on the proposition metadata includes: The propositional metadata is parsed to determine the predicate type, operator, and operand input specifications; Based on the predicate type, the operator, and the operand input specification, the form control is rendered to construct the corresponding rule configuration form in the user interface; Based on the user's interaction with the rule configuration form, determine the target predicate type, target operator, input operands, and configured quantifier rules; The propositional data is constructed based on the target predicate type, target operator, input operands, and configured quantifier rules.
5. The business rule processing method according to claim 1, characterized in that, Determining the analytical function corresponding to the propositional data includes: Based on the propositional data, determine the predicate type corresponding to the propositional data; Based on the predicate type corresponding to the propositional data and the mapping relationship between the predicate type and the parsing function, the parsing function corresponding to the predicate type is determined.
6. The business rule processing method according to claim 1, characterized in that, Based on the parsing function, the propositional data is parsed to obtain a judgment result indicating whether the business logic is true, including: Based on the propositional data, the target operator, operands, and quantifier rules are determined, and real-time business data is obtained; Based on the parsing function, the target operator, the operand, the quantifier rule, and the real-time business data are parsed to obtain a binary result; Based on the binary result, it is determined whether the business logic defined by the propositional data is valid relative to the real-time business data.
7. The business rule processing method according to claim 1, characterized in that, The method further includes: The first terminal converts the proposition metadata into first JSON format data through a first serialization operation and sends it to the second terminal; The second terminal converts the proposition data object into second JSON format data through a second serialization operation and sends it to the first terminal; Both the first and second serialization operations follow the same JSON serialization standard to convert structured objects into corresponding JSON format strings.
8. A business rule processing device, characterized in that, The device includes: The proposition generation module is used to determine the business logic based on the first terminal, and to formally describe the business logic to obtain the propositions in the proposition logic, including single propositions and compound propositions. The proposition metadata generation module is used to determine the proposition metadata of the proposition and send the proposition metadata to the second terminal. The proposition metadata is used to describe the structure and constraint information required by the second terminal when rendering form controls. The data receiving module is used to receive proposition data generated by the second terminal based on the proposition metadata, wherein the proposition data is generated by the business rules configured by the form control rendered by the second terminal based on the proposition metadata; The parsing module is used to determine the parsing function corresponding to the propositional data when executing the business process, and based on the parsing function, parse the propositional data to obtain a judgment result indicating whether the business logic is true.
9. A computer device, 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, it implements the method of any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.