A configurable rules engine method and system for member points coupons
Patent Information
- Application Number
- CN202611110222.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-24
- Publication Date
- 2026-10-23
AI Technical Summary
本发明提供了一种面向会员积分优惠券的可配置规则引擎方法及系统,用以解决解决现有技术中会员积分优惠券规则分散实现、配置缺乏版本管控、跨域协同能力弱、多体系易串扰的技术问题,提供一种面向会员积分优惠券的可配置规则引擎方法及系统,通过统一规则DSL、分层执行架构、全链路配置管理与多规则协同机制,提升规则复用性、迭代效率与运行可靠性
三类业务规则采用统一规则DSL与统一执行内核,消除分散实现带来的口径差异,条件逻辑可跨业务场景复用,降低开发与维护成本,提升规则统一性;
Smart Images

Figure CN122963536A_ABST
Abstract
Description
Technical Field
[0001] This invention is primarily in the fields of internet information services and software engineering technology, and particularly relates to a configurable rule engine method and system for member points and coupons. Background Technology
[0002] As the digital transformation of the retail industry deepens, membership tier systems, points incentive mechanisms, and coupon marketing have become core operational tools for retail enterprises to improve user retention and repeat purchase conversion. With the continuous expansion of business channels, the parallel operation of multiple membership account systems, and the accelerating iteration frequency of marketing activities, the number and complexity of membership and marketing rules continue to rise. Traditional hard-coded rule implementation methods, which scatter tier, points, and coupon rules across different business modules and develop them independently, result in deep coupling between rule logic and business code, making it difficult to adapt to high-frequency strategy adjustments and the need for reuse across business scenarios.
[0003] Under the existing implementation model, it is difficult to unify the standards for rule configuration and execution. Cross-domain rule linkage relies on additional business process splicing, which is prone to problems such as inconsistent calculation logic and deviations in triggering timing. Rule changes generally rely on developers modifying code and completing version releases, lacking standardized configuration version control and canary release verification mechanisms, resulting in high risks for online changes and long implementation cycles for operational strategies. At the same time, when multiple account systems run in parallel, the rule isolation logic is scattered, posing a risk of cross-system data interference. Furthermore, the rule execution chain lacks unified tracking capabilities, and troubleshooting requires cross-system log analysis, leading to high operational costs. Summary of the Invention
[0004] 1. The technical problem that the invention aims to solve: This invention provides a configurable rule engine method and system for member points coupons, which solves the technical problems of scattered implementation of member points coupon rules, lack of version control of configuration, weak cross-domain collaboration capability, and easy crosstalk between multiple systems in the prior art. It provides a configurable rule engine method and system for member points coupons, which improves rule reusability, iteration efficiency and operational reliability through a unified rule DSL, layered execution architecture, full-link configuration management and multi-rule collaboration mechanism.
[0005] 2. Technical Solution: To achieve the above objectives, the technical solution provided by the present invention is as follows: A configurable rules engine method for member points coupons includes the following steps: Step S1: Unified rule modeling, abstracting the three types of business rules of membership level, points and coupons into a rule domain-specific language (rule DSL) with a unified JSON structure. The rule DSL includes condition configuration section and action configuration section, and supports versioned storage and management of rule configuration. Step S2: Construct a unified set of facts based on business events. Pull multi-dimensional context fields from the Internet business system, including members, orders, stores, channels, and accounts, and after standardization and cleaning, form a unified input for rule execution. Step S3: Event routing and rule assembly. Based on the event type and the loyaltyScheme identifier, query the corresponding rule configuration, sort by priority, and assemble the condition rule, calculation rule, and execution rule in sequence to form an executable rule chain. Step S4: Combined condition judgment, based on the unified fact set, the must / should combinational logic is performed on the condition configuration segment, supporting multiple types of comparison operators and frequency, cumulative dynamic condition calculation; Step S5: Result Quantification Calculation. After the condition is met, the quantitative calculation of the points value, level validity period, and coupon available amount is performed according to the parameters of the action configuration segment. Step S6: Execute the landing and linkage tracking, and write the calculation results to the database in a transactional manner, trigger cross-business rule linkage, and generate a full-link execution log at the same time, supporting the association and traceability of configuration version and execution results.
[0006] Furthermore, in step S1, the unified rule modeling specifically includes: Decouple the conditional logic and execution logic of business rules. The conditional configuration section defines the nested conditional tree structure and operator parameters, while the action configuration section defines the calculation coefficients, execution actions, and linkage trigger parameters. All rule configurations are incorporated into the software configuration management system. When a rule is added or modified, an independent configuration version is generated, and the person who made the configuration change and the time of the change are recorded. Historical version rollback and canary release are supported.
[0007] Furthermore, in step S2, the construction of the unified fact set specifically includes: Based on the event type, retrieve corresponding business data from the member platform, order platform, and marketing platform, and extract key fields such as member identifier, store identifier, order amount, order date, member channel, account system identifier, and coupon identifier; Data cleaning and format conversion are performed according to a unified field specification to generate a structured fact set; the account system identifier is an isolated field, which supports parallel operation of multiple member account systems without crosstalk.
[0008] Furthermore, in step S3, event routing and rule assembly specifically include: The system receives business events through the EventRule entry layer and uses the event type and account system identifier as a composite index to query the list of rules that are in effect. The rules are sorted from highest to lowest priority value. For each rule, a condition rule component, a calculation rule component, and an execution rule component are instantiated in sequence to form a rule processing chain that is executed sequentially.
[0009] Furthermore, in step S4, the combination condition judgment specifically includes: Conditional rules are divided into rule groups. Within a group, the must logic is executed, meaning the group result is true when all sub-conditions are met. Between groups, the should logic is executed, meaning the overall condition passes when any group result is true. It supports multiple comparison operators such as equal to, greater than, less than, contain, exclude, and frequency accumulation. For conditions such as cumulative amount, cumulative quantity, and historical frequency, it can query historical business data in real time to complete dynamic calculation and verification.
[0010] Furthermore, in step S5, the result quantification calculation specifically includes: Integral calculation formula: S_point=round((A_order / A_base)×P_base×M), Where A_order is the order amount, A_base is the rule amount base, P_base is the base integral, and M is the multiplier coefficient; The validity period calculation supports both absolute time and rolling time modes, and automatically completes date boundary correction; the coupon amount calculation supports both fixed face value and proportional face value configurations.
[0011] Furthermore, in step S6, the execution of landing and linkage tracking specifically includes: The execution rule component completes the transactional database write operations for writing points records, updating membership levels, and issuing coupon instances; Level change events trigger upgrade coupon linkage logic through message queues. Multiple rules triggered by the same business event share the same fact set to ensure consistent calculation. The entire process generates tracking logs that include event identifiers, fact set snapshots, rule configuration version IDs, rule IDs, and execution results, supporting multi-dimensional troubleshooting based on events, rules, and configuration versions.
[0012] A configurable rule engine system for membership points coupons, comprising: The configuration management module is used to visually configure membership levels, points, and coupon rules, generate a unified JSON structure rule DSL, and provide configuration version management and canary release capabilities. The fact building module is used to receive business events from the Internet business side, pull multi-dimensional business data and perform standardized cleaning to generate a unified fact set. The rule assembly module is used to route and query effective rules based on event type and account system identifier, and assemble three types of rule instances: conditions, calculation, and execution, according to priority. The rule execution module is used to perform combined condition judgments, result quantification calculations, and data storage operations. The linkage tracking module is used to trigger asynchronous linkage across business rules, generate full-link execution logs, and provide the ability to trace the relationship between configuration version and execution results.
[0013] Furthermore, the configuration management module includes a visual configuration unit, a version management unit, and a canary release unit; The visual configuration unit adopts a three-stage interactive interface of information configuration, condition configuration, and behavior configuration, which reduces the configuration threshold for operators. The version management unit stores all historical versions of rule configurations, records change history, and supports one-click rollback. The gray-scale release unit supports releasing new configuration versions according to channel, store, or traffic ratio, reducing the online risks associated with rule changes.
[0014] Furthermore, the system adopts a layered software architecture, which is divided into a configuration layer, a rule assembly layer, a fact construction layer, a rule execution layer, a result storage layer, and an asynchronous linkage layer from top to bottom; Each layer interacts through standardized interfaces. When adding new rule types, only the branch logic of the corresponding layer needs to be extended, and the core condition judgment and execution capabilities can be reused. The system provides interfaces to the outside world in the form of cloud services to support multi-terminal business calls in Internet retail scenarios.
[0015] 3. Beneficial effects: Compared with the prior art, the technical solution provided by this invention has the following advantages: The three types of business rules adopt a unified rule DSL and a unified execution kernel to eliminate the differences in interpretation caused by decentralized implementation. The conditional logic can be reused across business scenarios, reducing development and maintenance costs and improving rule uniformity. Establish a complete software configuration management mechanism to support version storage, change tracking, rollback and canary release of rule configurations, significantly reduce the risk of online rule changes, improve the stability of Internet services, and enhance configuration control capabilities; Operational strategy changes can be completed and published through visual configuration without modifying core code, shortening the event launch cycle, quickly responding to market demands, and improving business iteration efficiency; The same business event can trigger multiple rules to link points, levels, and coupons, sharing a unified set of facts to ensure consistency, forming a closed loop for member growth, and enhancing cross-domain collaboration capabilities; By isolating account system fields at the rule query and fact set levels, the risk of crosstalk when multiple systems are running in parallel is effectively avoided, and the isolation of multiple systems is reliable. The end-to-end tracking log is associated with configuration version and execution results, allowing for quick problem location by event, rule ID, and configuration version, reducing operation and maintenance costs and improving troubleshooting efficiency.
[0016] It should be noted that the structures not described in this invention are not related to the design points and improvement directions of this invention, and are the same as or can be implemented using existing technologies, and will not be elaborated here. Attached Figure Description
[0017] Figure 1 This is a flowchart of the configurable rule engine method for member points coupons according to the present invention; Figure 2 This is a system architecture diagram of the configurable rule engine for member points coupons according to the present invention. Detailed Implementation
[0018] To facilitate understanding of the present invention, a more complete description of the invention will be given below with reference to the accompanying drawings, which illustrate several embodiments of the invention. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that the disclosure of the invention will be more thorough and complete. Example 1
[0019] This embodiment provides a configurable rule engine method for member points coupons, applied to an internet retail member middleware scenario. The specific execution flow is as follows: Step 1: Unified rule modeling Operations personnel can configure membership upgrade rules, order point reward rules, and upgrade coupon rules through a visual configuration interface. All rules are stored in a unified JSON format, a rule domain-specific language (DSL).
[0020] Each rule configuration includes six core parts: a unique rule identifier, version number, loyaltyScheme identifier, priority value, condition configuration section, and action configuration section. Taking an order-based points reward rule as an example: the unique rule identifier is RULE_INTEGRAL_001, the version number is V1.2, the account system it belongs to is the PVH system, and the priority value is 10; the condition configuration section sets the logical relationship within the group to "AND (must)," containing two sub-conditions: the first condition verifies that the order amount field value is greater than 1000, and the second condition verifies that the member channel field is equal to the offline store channel; the action configuration section sets the calculation type to proportional points calculation, and the configuration parameters include a base amount of 100, a base points of 10, and a multiplier of 2. The execution action is to increase member points, with no subsequent linkage events.
[0021] Each rule configuration generates an independent version number and is incorporated into the configuration management system. Changes are automatically recorded when changes are made, and historical version viewing and one-click rollback are supported. Before a new rule goes live, it can be verified by releasing it in a 10% volume of traffic through the canary release unit.
[0022] Step 2: Construction of the Unified Fact Set When a store order completion event is triggered, the fact building module receives the event message, retrieves the order amount, store ID, and order time from the order system, the member ID, current level, and account system from the membership system, and the channel identifier from the channel system, and generates Facts after completing the field standardization and cleaning.
[0023] The generated fact set contains seven core fields: member identifier, store identifier, order amount, order date, member channel, account system identifier, and coupon identifier. The member identifier is C00128, the store identifier is S056, the order amount is 1280, the order date is 2026-06-20, the member channel is offline store, the account system identifier is PVH, and the coupon identifier is empty.
[0024] Step 3: Event Routing and Rule Assembly The EventRule layer receives order completion events and uses eventType="order_complete" and the loyaltyScheme identifier "PVH" as a composite index to query all effective rules and sort them by priority. It then instantiates ConditionRule, CalculationRule, and ExecuteRule for each rule, forming an execution chain: points rule → level rule → upgrade coupon rule.
[0025] Step 4: Combined Condition Judgment The conditional rule components perform validations sequentially: 1. Points rules conditions: Order amount greater than 1000 and channel is offline store, fact set matching, condition hit; 2. Level Rules and Conditions: The cumulative spending amount meets the upgrade threshold. Historical order data is queried to calculate the cumulative value. If the upgrade conditions are met, the upgrade is successful. 3. Upgrade coupon rules and conditions: The membership level has been upgraded and it is the first upgrade.
[0026] Step 5: Quantification of Results The calculation rule component performs quantization calculations: 1. Integral calculation: Substituting into the formula S_point=round((1280 / 100)×10×2)=256, we get 256 points to be awarded. 2. Level Calculation: When a member upgrades from Silver Card to Gold Card, the level validity period is calculated on a rolling 12-month basis, with the effective date being the current day and the expiration date being the end of the same month of the following year; 3. Coupon Calculation: Two coupons of 30 RMB off for purchases over 200 RMB will be issued based on the configuration, valid for 30 days.
[0027] Step 6: Implementation and Linkage Tracking The execution rule component executes the following steps sequentially: writing points transaction records, updating member levels and validity periods, creating coupon instances and distributing them to member accounts; After the level update is completed, a level change message is sent to the message queue, triggering the execution of the upgrade coupon rules; Generates full-chain tracking logs, linking event IDs, fact set snapshots, rule version IDs, execution results, and execution time. Supports querying the complete execution chain by order number and member ID through the operations backend, enabling quick anomaly location. Example 2
[0028] This embodiment provides a configurable rule engine system for member points coupons, which adopts a cloud microservice architecture. The system consists of the following components: 1. Configuration Management Module It includes a visual configuration unit, a version management unit, and a canary release unit. The visual configuration unit provides a three-part interactive interface, allowing operations personnel to configure basic rule information, condition combinations, and execution actions separately without writing code. The version management unit stores all historical configuration versions of the rules, supporting difference comparison and rollback. The canary release unit supports gradually scaling up new configurations by channel, store, or traffic ratio, reducing online risks.
[0029] 2. Fact Building Module It integrates with business systems such as the membership platform, order platform, and marketing platform, providing a standardized interface for building fact sets. It automatically retrieves data from corresponding dimensions based on event type, performs field mapping, format cleaning, and data validation, generating a fact set with a unified structure to ensure consistency in all rule inputs. Built-in field validation logic for the account system ensures accurate transmission of system identifiers.
[0030] 3. Rule Assembly Module As the entry point orchestration layer of the rules engine, it has a built-in event routing table and rule query component. After receiving a business event, it queries the effective rules based on the event type and account system identifier, sorts them by priority, and then instantiates and assembles the rule components to form an executable rule processing pipeline.
[0031] 4. Rule Execution Module It includes a condition judgment unit, a result calculation unit, and an execution and database write unit. The condition judgment unit implements AND (must) / OR (should) combinational logic, has more than ten built-in general comparison operators, and supports dynamic cumulative condition calculations. The result calculation unit has built-in standardized calculation logic for points, levels, and coupons, and supports parameterized configuration. The execution and database write unit ensures the transactionality of data writing, avoiding data inconsistencies caused by partial execution.
[0032] 5. Linked Tracking Module It includes asynchronous linkage units and link tracing units. Asynchronous linkage units use message queues to trigger cross-rule actions, such as triggering coupons for level changes or issuing benefits for reaching certain points milestones. The link tracing unit collects execution data across the entire process, generates a unique tracking ID, associates it with configuration version information, and supports multi-dimensional queries and problem localization.
[0033] The system adopts a six-layer architecture: configuration layer, rule assembly layer, fact building layer, rule execution layer, result storage layer, and asynchronous linkage layer. Each layer has a single responsibility and interacts through standardized interfaces. When adding a new rule type, only the implementation of the corresponding layer needs to be extended, without modifying the core execution logic, thus possessing good scalability.
[0034] The above-described embodiments are merely illustrative of certain implementations of the present invention, and are described in a relatively specific and detailed manner. However, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements are all within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the appended claims.
Claims
1. A configurable rule engine method for member points coupons, characterized in that, Includes the following steps: Step S1: Unified rule modeling, abstracting the three types of business rules of membership level, points and coupons into a rule domain-specific language (rule DSL) with a unified JSON structure. The rule DSL includes condition configuration section and action configuration section, and supports versioned storage and management of rule configuration. Step S2: Construct a unified set of facts based on business events. Pull multi-dimensional context fields from the Internet business system, including members, orders, stores, channels, and accounts, and after standardization and cleaning, form a unified input for rule execution. Step S3: Event routing and rule assembly. Based on the event type and the loyaltyScheme identifier, query the corresponding rule configuration, sort by priority, and assemble the condition rule, calculation rule, and execution rule in sequence to form an executable rule chain. Step S4: Combined condition judgment, based on the unified fact set, the must / should combinational logic is performed on the condition configuration segment, supporting multiple types of comparison operators and frequency, cumulative dynamic condition calculation; Step S5: Result Quantification Calculation. After the condition is met, the quantitative calculation of the points value, level validity period, and coupon available amount is performed according to the parameters of the action configuration segment. Step S6: Execute the landing and linkage tracking, and write the calculation results to the database in a transactional manner, trigger cross-business rule linkage, and generate a full-link execution log at the same time, supporting the association and traceability of configuration version and execution results.
2. The configurable rule engine method for member points coupons according to claim 1, characterized in that, In step S1, the unified rule modeling specifically includes: Decouple the conditional logic and execution logic of business rules. The conditional configuration section defines the nested conditional tree structure and operator parameters, while the action configuration section defines the calculation coefficients, execution actions, and linkage trigger parameters. All rule configurations are incorporated into the software configuration management system. When a rule is added or modified, an independent configuration version is generated, and the person who made the configuration change and the time of the change are recorded. Historical version rollback and canary release are supported.
3. The configurable rule engine method for member points coupons according to claim 1, characterized in that, In step S2, the construction of the unified fact set specifically includes: Based on the event type, retrieve corresponding business data from the member platform, order platform, and marketing platform, and extract key fields such as member identifier, store identifier, order amount, order date, member channel, account system identifier, and coupon identifier; Data cleaning and format conversion are performed according to a unified field specification to generate a structured fact set; the account system identifier is an isolated field, which supports parallel operation of multiple member account systems without crosstalk.
4. The configurable rule engine method for member points coupons according to claim 1, characterized in that, In step S3, the event routing and rule assembly specifically include: The system receives business events through the EventRule entry layer and uses the event type and account system identifier as a composite index to query the list of rules that are in effect. The rules are sorted from highest to lowest priority value. For each rule, a condition rule component, a calculation rule component, and an execution rule component are instantiated in sequence to form a rule processing chain that is executed sequentially.
5. The configurable rule engine method for member points coupons according to claim 1, characterized in that, In step S4, the combination condition judgment specifically includes: Conditional rules are divided into rule groups. Within a group, the must logic is executed, meaning the group result is true when all sub-conditions are met. Between groups, the should logic is executed, meaning the overall condition passes when any group result is true. It supports multiple comparison operators such as equal to, greater than, less than, contain, exclude, and frequency accumulation. For conditions such as cumulative amount, cumulative quantity, and historical frequency, it can query historical business data in real time to complete dynamic calculation and verification.
6. The configurable rule engine method for member points coupons according to claim 1, characterized in that, In step S5, the result quantification calculation specifically includes: The formula for calculating points is: S_point=round((A_order / A_base)×P_base×M), where A_order is the order amount, A_base is the base amount for the rules, P_base is the base points, and M is the multiplier. The validity period calculation supports both absolute time and rolling time modes, and automatically completes date boundary correction; the coupon amount calculation supports both fixed face value and proportional face value configurations.
7. The configurable rule engine method for member points coupons according to claim 1, characterized in that, In step S6, the specific steps of landing and linkage tracking include: The execution rule component completes the transactional database write operations for writing points records, updating membership levels, and issuing coupon instances; Level change events trigger upgrade coupon linkage logic through message queues. Multiple rules triggered by the same business event share the same fact set to ensure consistent calculation. The entire process generates tracking logs that include event identifiers, fact set snapshots, rule configuration version IDs, rule IDs, and execution results, supporting multi-dimensional troubleshooting based on events, rules, and configuration versions.
8. A configurable rule engine system for member points coupons, characterized in that, include: The configuration management module is used to visually configure membership levels, points, and coupon rules, generate a unified JSON structure rule DSL, and provide configuration version management and canary release capabilities. The fact building module is used to receive business events from the Internet business side, pull multi-dimensional business data and perform standardized cleaning to generate a unified fact set. The rule assembly module is used to route and query effective rules based on event type and account system identifier, and assemble three types of rule instances: conditions, calculation, and execution, according to priority. The rule execution module is used to perform combined condition judgments, result quantification calculations, and data storage operations. The linkage tracking module is used to trigger asynchronous linkage across business rules, generate full-link execution logs, and provide the ability to trace the relationship between configuration version and execution results.
9. The configurable rule engine method and system for member points coupons according to claim 8, characterized in that: The configuration management module includes a visual configuration unit, a version management unit, and a canary release unit. The visual configuration unit adopts a three-stage interactive interface of information configuration, condition configuration, and behavior configuration, which reduces the configuration threshold for operators. The version management unit stores all historical versions of rule configurations, records change history, and supports one-click rollback. The gray-scale release unit supports releasing new configuration versions according to channel, store, or traffic ratio, reducing the online risks associated with rule changes.
10. The configurable rule engine method and system for member points coupons according to claim 8, characterized in that: The system adopts a layered software architecture, which is divided into a configuration layer, a rule assembly layer, a fact building layer, a rule execution layer, a result storage layer, and an asynchronous linkage layer from top to bottom. Each layer interacts through standardized interfaces. When adding new rule types, only the branch logic of the corresponding layer needs to be extended, and the core condition judgment and execution capabilities can be reused. The system provides interfaces to the outside world in the form of cloud services to support multi-terminal business calls in Internet retail scenarios.