An order consumption calculation method and device

By filtering the order consumption calculation method, only the existing orders with incremental, refund behavior or settlement rule changes are calculated, which solves the problem of large amount of calculation and long time consumption in the existing technology and realizes efficient order consumption calculation.

CN114493715BActive Publication Date: 2026-01-13BEIJING GAOTU YUNJI EDUCATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210116555.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-07
Publication Date
2026-01-13
Estimated Expiration
2042-02-07

AI Technical Summary

Technical Problem

In existing technologies, the order consumption calculation process is computationally intensive and time-consuming, leading to a decline in system performance and an inability to provide timely delivery consumption data.

Method used

By filtering order data that meets the calculation consumption conditions, and using the settlement rule record table and order data, only incremental, refund behavior, or existing orders with changed settlement rules are calculated, thus reducing the amount of calculation and time consumption.

Benefits of technology

It effectively reduces the computational load and time consumption of order consumption calculations, improves system performance, and ensures timely provision of consumption data to support business decisions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114493715B_ABST
    Figure CN114493715B_ABST
Patent Text Reader

Abstract

The application provides an order consumption calculation method and device applied to the field of advertisement putting, wherein the order consumption calculation method comprises the following steps: obtaining order data of all orders in a database; determining orders meeting a calculation consumption condition from all orders according to a settlement rule record table and the order data; and calculating order consumption corresponding to the orders meeting the calculation consumption condition according to the settlement rule record table and order data corresponding to the orders meeting the calculation consumption condition. In the above scheme, the orders meeting the calculation consumption condition can be filtered out from all orders according to the settlement rule record table and the order data, so that the order consumption of only the orders meeting the calculation consumption condition is calculated, and the order consumption of all orders does not need to be calculated, thereby the calculation amount and time consumption of the order consumption process can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of advertising placement, and more specifically, to a method and apparatus for calculating order consumption. Background Technology

[0002] In business advertising scenarios, the cost of each order needs to be calculated, which for advertisers is equivalent to order consumption. To facilitate monitoring of advertising costs, a system needs to provide a campaign dashboard to calculate and display order consumption. Furthermore, the calculated order consumption should be aggregated and analyzed for other purposes.

[0003] In existing technologies, the order attribution module writes all order data to the database every hour, and the offline order consumption calculation service batch retrieves and iterates through all orders, calculating the consumption amount for each order in a loop. However, in the above solution, since all orders need to be retrieved every hour and all orders need to be calculated, which is on the order of hundreds of millions, the process of calculating order consumption is computationally intensive and time-consuming. Summary of the Invention

[0004] The purpose of this application is to provide an order consumption calculation method and apparatus to solve the technical problem that the process of calculating order consumption involves a large amount of calculation and is time-consuming.

[0005] To achieve the above objectives, the technical solutions provided by the embodiments of this application are as follows:

[0006] In a first aspect, embodiments of this application provide a method for calculating order consumption, comprising: acquiring order data of all orders in a database; determining, based on a settlement rule record table and the order data, the orders among all orders that meet the consumption calculation conditions; and calculating the order consumption corresponding to the orders that meet the consumption calculation conditions based on the settlement rule record table and the order data corresponding to the orders that meet the consumption calculation conditions. In the above scheme, orders that meet the consumption calculation conditions can be filtered out from all orders first based on the settlement rule record table and the order data. Therefore, only the order consumption of these orders that meet the consumption calculation conditions can be calculated, eliminating the need to calculate the order consumption of all orders. This reduces the computational load and time consumption of the order consumption process.

[0007] In an optional embodiment of this application, the order data includes the order generation time; determining the orders that meet the consumption calculation conditions among all orders based on the settlement rule record table and the order data includes: searching for incremental orders among all orders based on the order generation time; wherein, the incremental orders are the orders that meet the consumption calculation conditions. In the above scheme, incremental orders among all orders can be filtered out first according to the settlement rule record table and the order generation time, so that the order consumption of these incremental orders can be calculated according to the calculation rule record table, without having to calculate the order consumption of all orders. Therefore, the computational load and time consumption of the order consumption process can be reduced.

[0008] In an optional embodiment of this application, the step of finding incremental orders among all orders based on the order generation time includes: finding orders among all orders whose order generation time is less than a preset time difference from the current time. In the above scheme, incremental orders can be filtered out from all orders first based on the settlement rule record table and the order generation time. Then, the order consumption of these incremental orders can be calculated according to the calculation rule record table, eliminating the need to calculate the order consumption of all orders. Therefore, the computational load and time consumption of the order consumption process can be reduced.

[0009] In an optional embodiment of this application, the order data includes the order generation time and the order status; determining the orders that meet the consumption calculation conditions among all orders based on the settlement rule record table and the order data includes: searching for existing orders that have undergone refunds among all orders based on the order generation time and the order status; wherein, the existing orders that have undergone refunds are the orders that meet the consumption calculation conditions; calculating the order consumption corresponding to the orders that meet the consumption calculation conditions based on the settlement rule record table and the order data corresponding to the orders that meet the consumption calculation conditions includes: calculating that the order consumption corresponding to the existing orders that have undergone refunds is zero. In the above scheme, existing orders that have undergone refunds among all orders can be filtered out first based on the settlement rule record table, the order generation time, and the order status, so that the order consumption of this part of existing orders can be calculated based on the calculation rule record table, without having to calculate the order consumption of all orders. Therefore, the calculation workload and time consumption of the order consumption process can be reduced.

[0010] In an optional embodiment of this application, the step of finding existing orders that have been refunded among all orders based on the order generation time and the order status includes: finding all orders where the difference between the order generation time and the current time is greater than a preset time difference, and the order status indicates a refund. In the above scheme, existing orders that have been refunded among all orders can be filtered out first according to the settlement rule record table, the order generation time, and the order status. Then, the order consumption of this part of existing orders can be calculated according to the calculation rule record table, without having to calculate the order consumption of all orders. Therefore, the calculation workload and time consumption of the order consumption process can be reduced.

[0011] In an optional embodiment of this application, the order data includes the order generation time and a settlement rule identifier, wherein the settlement rule identifier corresponds to at least one settlement rule and the effective time of each settlement rule, and the settlement rule record table includes multiple settlement rule identifiers, the correspondence between each settlement rule identifier and at least one settlement rule, and the effective time of each settlement rule; determining the orders that meet the calculation consumption conditions among all orders based on the settlement rule record table and the order data includes: searching for a settlement rule change identifier based on the settlement rule record table; wherein the settlement rule change identifier is a settlement rule identifier whose corresponding settlement rule has changed within a preset time period; based on The system uses the order generation time, settlement rule identifier, and settlement rule change identifier to find all existing orders whose settlement rules have changed. These existing orders with changed settlement rules are those that meet the calculation consumption conditions. The step of calculating the order consumption corresponding to the orders meeting the calculation consumption conditions, based on the settlement rule record table and the order data corresponding to the orders meeting the calculation consumption conditions, includes: finding the changed settlement rule corresponding to the order from the settlement rule record table based on the order generation time and settlement rule identifier; and calculating the order consumption corresponding to the existing orders with changed settlement rules based on the changed settlement rule. In this solution, existing orders with changed calculation rules can be filtered out from all orders based on the settlement rule record table, order generation time, and settlement rule identifier. Therefore, the order consumption of these existing orders can be calculated based on the calculation rule record table, eliminating the need to calculate the order consumption of all orders. This reduces the computational load and time consumption of the order consumption process.

[0012] In an optional embodiment of this application, the step of searching for existing orders whose settlement rules have changed among all orders based on the order generation time, the settlement rule identifier, and the settlement rule change identifier includes: searching for orders among all orders whose difference between the order generation time and the current time is greater than a preset time difference, and whose settlement rule identifier matches the settlement rule change identifier. In the above scheme, existing orders whose calculation rules have changed among all orders can be filtered out first based on the settlement rule record table, the order generation time, and the settlement rule identifier. Then, the order consumption of these existing orders can be calculated based on the calculation rule record table, eliminating the need to calculate the order consumption of all orders. Therefore, the computational load and time consumption of the order consumption process can be reduced.

[0013] Secondly, embodiments of this application provide an order consumption calculation device, comprising: an acquisition module for acquiring order data of all orders in a database; a determination module for determining, based on a settlement rule record table and the order data, orders that meet the consumption calculation conditions from all orders; and a calculation module for calculating the order consumption corresponding to the orders that meet the consumption calculation conditions, based on the settlement rule record table and the order data corresponding to the orders that meet the consumption calculation conditions. In the above solution, orders that meet the consumption calculation conditions from all orders can be filtered out first based on the settlement rule record table and the order data. Therefore, only the order consumption of these orders that meet the consumption calculation conditions needs to be calculated, eliminating the need to calculate the order consumption of all orders. This reduces the computational load and time consumption in the order consumption process.

[0014] In an optional embodiment of this application, the order data includes the order generation time; the determining module is specifically used to: find incremental orders among all orders based on the order generation time; wherein, the incremental orders are orders that meet the calculation consumption conditions. In the above scheme, incremental orders among all orders can be filtered out first according to the settlement rule record table and the order generation time, so that the order consumption of these incremental orders can be calculated according to the calculation rule record table, without having to calculate the order consumption of all orders. Therefore, the computational load and time consumption of the order consumption process can be reduced.

[0015] In an optional embodiment of this application, the determining module is specifically used to: find all orders for which the difference between the order generation time and the current time is less than a preset time difference. In the above scheme, incremental orders can be filtered out from all orders based on the settlement rule record table and the order generation time. Then, the order consumption of these incremental orders can be calculated according to the calculation rule record table, eliminating the need to calculate the order consumption of all orders. Therefore, the computational load and time consumption of the order consumption process can be reduced.

[0016] In an optional embodiment of this application, the order data includes the order generation time and the order status; the determining module is specifically used to: find all existing orders that have undergone refunds based on the order generation time and the order status; wherein, the existing orders that have undergone refunds are orders that meet the calculation consumption conditions; the calculation module is specifically used to: calculate that the order consumption corresponding to the existing orders that have undergone refunds is zero. In the above scheme, existing orders that have undergone refunds can be filtered out from all orders based on the settlement rule record table, the order generation time, and the order status. Therefore, the order consumption of these existing orders can be calculated based on the calculation rule record table, without needing to calculate the order consumption of all orders. This reduces the computational load and time consumption of the order consumption process.

[0017] In an optional embodiment of this application, the determining module is specifically used to: find all orders where the difference between the order generation time and the current time is greater than a preset time difference, and the order status indicates a refund. In the above scheme, existing orders that have undergone refunds can be filtered out from all orders based on the settlement rule record table, order generation time, and order status. Then, the order consumption of these existing orders can be calculated according to the calculation rule record table, eliminating the need to calculate the order consumption of all orders. Therefore, the computational load and time consumption of the order consumption process can be reduced.

[0018] In an optional embodiment of this application, the order data includes the order generation time and a settlement rule identifier, wherein the settlement rule identifier corresponds to at least one settlement rule and the effective time of each settlement rule, and the settlement rule record table includes multiple settlement rule identifiers, the correspondence between each settlement rule identifier and at least one settlement rule, and the effective time of each settlement rule; the determining module is specifically used to: search for a settlement rule change identifier according to the settlement rule record table; wherein the settlement rule change identifier is a settlement rule identifier whose corresponding settlement rule has changed within a preset time period; search for existing orders among all orders whose settlement rules have changed according to the order generation time, the settlement rule identifier, and the settlement rule change identifier; wherein the existing orders whose settlement rules have changed are orders that meet the calculation consumption conditions; the calculation module is specifically used to: search for the changed settlement rule corresponding to the order from the settlement rule record table according to the order generation time and the settlement rule identifier; calculate the order consumption corresponding to the existing orders whose settlement rules have changed according to the changed settlement rule. In the above scheme, existing orders whose calculation rules have changed can be filtered out first based on the settlement rule record table, order generation time, and settlement rule identifier. Then, the order consumption of these existing orders can be calculated based on the calculation rule record table, without having to calculate the order consumption of all orders. Therefore, the amount of calculation and time spent in the order consumption process can be reduced.

[0019] In an optional embodiment of this application, the determining module is specifically used to: find all orders where the difference between the order generation time and the current time is greater than a preset time difference, and the settlement rule identifier matches the settlement rule change identifier. In the above scheme, existing orders whose calculation rules have changed can be filtered out first based on the settlement rule record table, order generation time, and settlement rule identifier. Then, the order consumption of these existing orders can be calculated based on the calculation rule record table, eliminating the need to calculate the order consumption of all orders. Therefore, the computational load and time consumption of the order consumption process can be reduced.

[0020] Thirdly, embodiments of this application provide an electronic device, including: a processor, a memory, and a bus; the processor and the memory communicate with each other through the bus; the memory stores program instructions that can be executed by the processor, and the processor can execute the order consumption calculation method as described in the first aspect by calling the program instructions.

[0021] Fourthly, embodiments of this application provide a non-transitory computer-readable storage medium storing computer instructions that cause the computer to execute the order consumption calculation method as described in the first aspect.

[0022] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, embodiments of this application are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0023] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 A flowchart illustrating an order data writing method provided in this application embodiment;

[0025] Figure 2 A flowchart illustrating an order consumption calculation method provided in this application embodiment;

[0026] Figure 3 A flowchart illustrating another order consumption calculation method provided in this application embodiment;

[0027] Figure 4 A flowchart illustrating another order consumption calculation method provided in this application embodiment;

[0028] Figure 5 A flowchart illustrating another order consumption calculation method provided in this application embodiment;

[0029] Figure 6 A structural block diagram of an order consumption calculation device provided in an embodiment of this application;

[0030] Figure 7 This is a structural block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0031] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0032] First, we will introduce the process by which electronic devices write order data from upstream business systems into a database.

[0033] Please refer to Figure 1 , Figure 1 A flowchart of an order data writing method provided in this application embodiment, the order data writing method may include the following steps:

[0034] Step S101: Obtain the raw data of all orders from the upstream business system.

[0035] Step S102: Determine the source channel, order status, and settlement rules for each order based on the original data to obtain order data.

[0036] Step S103: Write the order data into the database.

[0037] Specifically, the upstream business system refers to the system that manages advertising placement data. This system can collect raw data corresponding to all orders related to advertising placement. The raw data for each order may include various data, such as the order's source channel, order status, order type, and settlement rules. This application embodiment does not impose specific limitations on these data; those skilled in the art can make appropriate adjustments based on actual circumstances.

[0038] In the above data, the source channels of orders can include WeChat official accounts, web pages, etc.; the order status can include paid status, reserved status, refunded status, etc.; the order type can include individual orders, group orders, etc.

[0039] Advertisers can settle accounts with advertisers using methods such as Cost Per Action (CPA), Cost Per Try (CPT), or Cost Per Sale (CPS). Taking CPA as an example, the settlement rules for each order are pre-agreed upon by the advertiser and advertiser, including the settlement amount for each order and the effective date of each settlement rule. For instance, the settlement rule could be: for each order generated, the advertiser pays the advertiser ten yuan; or, the settlement rule could be: from January to March, the advertiser pays the advertiser ten yuan for each order generated, and from April to June, the advertiser pays the advertiser twenty yuan for each order generated. It is understood that the above settlement rules are merely examples provided in this application's embodiments, and those skilled in the art can adjust the settlement rules based on actual circumstances; furthermore, the settlement rules can also be changed during the advertising campaign.

[0040] It should be noted that all orders in the upstream business system can refer to all orders generated since the advertising was launched. In this case, the upstream business system can collect and store the data of each order. Alternatively, it can refer to all orders within a certain period of time. In this case, the upstream business system can collect and store the data of each order, and delete the data of some orders after the storage time of some order data exceeds a preset period (such as one year, one month, etc.).

[0041] Electronic devices can acquire the aforementioned raw data in various ways, such as directly receiving raw data sent by upstream business systems or reading raw data uploaded by upstream business systems from the cloud. Then, the electronic device can determine the order data based on the raw data, according to the requirements of subsequent steps.

[0042] In one embodiment of this application, the electronic device can determine the source channel, order status, and settlement rules of each order based on the original data, and write the order data into a database. It is understood that this application does not specifically limit the type of database, such as the Kudu database, and those skilled in the art can make appropriate adjustments according to the actual situation.

[0043] Furthermore, after step S102 above, the order data writing method provided in this application embodiment may further include the following steps:

[0044] Add a corresponding settlement rule identifier to each order based on its source channel.

[0045] Specifically, since the settlement rules for orders from the same source channel should be the same, a settlement rule identifier corresponding to the source channel of the order can be added to the order data. This settlement rule identifier corresponds to the settlement rule of the source channel.

[0046] As one implementation method, a settlement rule identifier corresponds to only one settlement rule. For example, the settlement rule identifier corresponds to the settlement rule that "for each order generated, the advertiser needs to pay the placement party ten yuan".

[0047] As another implementation method, one settlement rule identifier corresponds to multiple settlement rules. For example, the settlement rule identifier corresponds to the settlement rule that "from January to March, for each order generated, the advertiser needs to pay the placement party ten yuan" and the calculation rule that "from April to June, for each order generated, the advertiser needs to pay the placement party twenty yuan". Alternatively, if the settlement rules change during the advertising process, the settlement rule identifier can correspond to both the settlement rule before the change and the settlement rule after the change.

[0048] Based on the above correspondence between settlement rule identifiers and settlement rules, a settlement rule record table can be generated. This table records the settlement rule identifiers corresponding to all source channels and all settlement rules corresponding to each settlement rule identifier. If the settlement rule identifier of an order is known, the rule for calculating the order consumption can be determined by querying the settlement rule record table.

[0049] Next, we will introduce the process by which electronic devices calculate order consumption based on order data in the database.

[0050] Please refer to Figure 2 , Figure 2 A flowchart of an order consumption calculation method provided in this application embodiment, the order consumption calculation method may include the following steps:

[0051] Step S201: Retrieve order data for all orders in the database.

[0052] Step S202: Based on the settlement rule record table and order data, determine the orders that meet the consumption calculation conditions among all orders.

[0053] Step S203: Calculate the order consumption corresponding to the orders that meet the consumption calculation conditions based on the settlement rule record table and the order data corresponding to the orders that meet the consumption calculation conditions.

[0054] Specifically, the electronic device can obtain order data of all orders in the database at a preset time (e.g., 6 pm or 10 am every day), or the electronic device can obtain order data of all orders in the database at preset time intervals (e.g., every hour or every twelve hours). This application embodiment does not make specific limitations on this.

[0055] Similar to the above embodiments, all orders in the database can refer to all orders generated since the advertisement was launched. In this case, the database can obtain and store the data of each order in the upstream business system. Alternatively, it can refer to all orders within a certain period of time. In this case, the database can obtain and store the data of each order in the upstream business system, and after the storage time of some order data exceeds a preset period (such as one year, one month, etc.), the data of that part of the orders will be cleared or transferred to other locations.

[0056] Then, the electronic device can determine the orders that meet the consumption calculation conditions from all orders based on the settlement rule record table and order data, and calculate the order consumption corresponding to the orders that meet the consumption calculation conditions based on the settlement rule record table and the order data corresponding to the orders that meet the consumption calculation conditions. The settlement rule record table can be stored in advance in the electronic device or a database, and includes multiple settlement rule identifiers, the correspondence between each settlement rule identifier and at least one settlement rule, and the effective time of each settlement rule.

[0057] In this application embodiment, the orders obtained by the electronic device can be divided into three types: the first type is incremental orders, which are new orders added after the last calculation; the second type is existing orders that need to be recalculated, which existed before the last calculation but need to be recalculated for some reason; the third type is existing new orders that do not need to be recalculated, which existed before the last calculation and do not need to be recalculated for order consumption.

[0058] In one implementation, the orders that meet the consumption calculation conditions in step S202 may include orders of the first type and orders of the second type. That is, in this embodiment, the consumption of orders that meet the consumption calculation conditions can be calculated only, without having to calculate the consumption of all orders. Therefore, the amount of calculation and time spent in the order consumption process can be reduced.

[0059] The following sections will provide a detailed explanation of how to determine the first and second types of orders, as well as the process for calculating order consumption.

[0060] For the first type of incremental order, please refer to Figure 3 , Figure 3 A flowchart of another order consumption calculation method provided in this application embodiment, which may include the following steps:

[0061] Step S301: Retrieve order data for all orders in the database.

[0062] Step S302: Find the incremental orders among all orders based on the order generation time.

[0063] Step S303: Calculate the order consumption corresponding to the incremental order based on the settlement rule record table and order data.

[0064] Specifically, the order data acquired by electronic devices can include the order generation time. Since incremental orders are new orders added after the last calculation, they can be filtered based on the order generation time.

[0065] In one implementation, step S302 may include the following steps:

[0066] Find all orders where the difference between the order creation time and the current time is less than a preset time difference.

[0067] For example, if an electronic device calculates order consumption every hour, the preset time difference can be one hour. If the difference between the order generation time and the current time is less than one hour, the order can be considered a new order added after the last calculation. For example, if the order generation time is 2:20 PM and the current time is 3:00 PM, then the order is an incremental order.

[0068] In another implementation, step S302 above may include the following steps:

[0069] Find all orders whose creation time is after a preset time.

[0070] For example, if an electronic device calculates order consumption once a day at 6 PM, then the preset time can be 6 PM. If the order is generated after the preset time, it can be considered an order added after the last calculation. For example, if the order is generated at 6 AM and the preset time is 6 PM, then the order is an incremental order.

[0071] For incremental orders, the electronic device can directly calculate the order consumption corresponding to the incremental order based on the settlement rule record table and order data. Specifically, the electronic device can query the settlement rule corresponding to the order from the settlement rule record table based on the settlement rule identifier and order generation time of the incremental order, and calculate the order consumption based on the queried settlement rule.

[0072] Therefore, incremental orders can be filtered out from all orders based on the settlement rule record table and the order generation time. Then, the order consumption of these incremental orders can be calculated based on the calculation rule record table, without having to calculate the order consumption of all orders. This reduces the amount of calculation and time spent in the order consumption process.

[0073] The second type of existing orders that need to be recalculated can be further divided into two types: the first type is existing orders that have been refunded; the second type is existing orders whose settlement rules have changed.

[0074] For existing orders that have been refunded (the first type), please refer to... Figure 4 , Figure 4 A flowchart of another order consumption calculation method provided in this application embodiment, which may include the following steps:

[0075] Step S401: Retrieve order data for all orders in the database.

[0076] Step S402: Based on the order generation time and order status, find all existing orders that have been refunded.

[0077] Step S403: Calculate the order consumption corresponding to the existing orders that have been refunded, which is zero.

[0078] Specifically, the order data acquired by electronic devices may include the order generation time and the order status.

[0079] First, the electronic device can filter out existing orders from all orders based on the order generation time. Corresponding to the incremental orders in the above embodiment, existing orders are those that existed before the last calculation. The filtering method is similar to that of incremental orders, and will not be repeated here.

[0080] Then, the electronic device can filter out the existing orders that have been refunded from all existing orders based on the order status. In other words, step S402 above may include the following steps:

[0081] Find all orders where the difference between the order creation time and the current time is greater than a preset time difference, and the order status indicates a refund.

[0082] It is understood that, corresponding to the method of filtering out incremental orders, the method of filtering out existing orders can also be to query orders whose generation time is after a preset time. This application embodiment does not make specific limitations on this.

[0083] Furthermore, the electronic device can either first filter out existing orders from all orders, and then filter out existing orders that have been refunded from all existing orders; or it can first filter out orders that have been refunded from all orders, and then filter out existing orders from all orders that have been refunded. This application embodiment does not impose any specific limitations on this.

[0084] For existing orders that have been refunded, the order consumption for that order can be directly calculated as zero.

[0085] It should be noted that, in this embodiment of the application, the Impala engine or other query engines can be used to filter out the existing orders that have been refunded from all orders.

[0086] Therefore, based on the settlement rule record table, order generation time, and order status, all existing orders that have been refunded can be filtered out first. Then, the order consumption of these existing orders can be calculated according to the calculation rule record table, without having to calculate the order consumption of all orders. This reduces the amount of calculation and time spent in the order consumption process.

[0087] For existing orders where the second type of settlement rule has changed, please refer to... Figure 5 , Figure 5A flowchart of another order consumption calculation method provided in this application embodiment, which may include the following steps:

[0088] Step S501: Retrieve order data for all orders in the database.

[0089] Step S502: According to the settlement rule record table, find the settlement rule change identifier.

[0090] Step S503: Based on the order generation time, settlement rule identifier, and settlement rule change identifier, find all existing orders whose settlement rules have changed.

[0091] Step S504: Based on the order generation time and settlement rule identifier, find the changed settlement rule corresponding to the order from the settlement rule record table.

[0092] Step S505: Calculate the order consumption corresponding to the existing orders whose settlement rules have changed, based on the changed settlement rules.

[0093] Specifically, the order data acquired by the electronic device may include the order generation time and a settlement rule identifier. Each settlement rule identifier corresponds to at least one settlement rule and the effective date of each settlement rule. For each settlement rule identifier in the settlement rule record table, it can be determined whether the settlement rule corresponding to that identifier has changed since the last calculation. If the settlement rule corresponding to that identifier has changed since the last calculation, then that settlement rule identifier is a settlement rule change identifier.

[0094] Then, the electronic device can filter out existing orders from all orders based on the order generation time, and then filter out existing orders whose settlement rules have changed based on the filtered settlement rule change identifier and the settlement rule identifier of all existing orders.

[0095] It is understood that electronic devices can either first filter out existing orders from all orders, and then filter out existing orders with changed settlement rules from all existing orders; or they can first filter out orders with changed settlement rules from all orders, and then filter out existing orders from all existing orders. This application embodiment does not impose any specific limitations on this.

[0096] For existing orders whose settlement rules have changed, the electronic device can retrieve the changed settlement rules from the settlement rule record table based on the settlement rule identifier, and calculate the order consumption based on the retrieved settlement rules. Therefore, based on the order generation time, settlement rule identifier, and settlement rule change identifier, the system searches for all existing orders with changed settlement rules, including: searching for orders whose difference between the order generation time and the current time is greater than a preset time difference, and whose settlement rule identifier matches the settlement rule change identifier.

[0097] It should be noted that, in this embodiment of the application, the Impala engine or other query engines can be used to filter out existing orders whose settlement rules have changed from all orders.

[0098] In the above scheme, existing orders whose calculation rules have changed can be filtered out first based on the settlement rule record table, order generation time, and settlement rule identifier. Then, the order consumption of these existing orders can be calculated based on the calculation rule record table, without having to calculate the order consumption of all orders. Therefore, the amount of calculation and time spent in the order consumption process can be reduced.

[0099] Based on existing technologies, the total time spent calculating order consumption is mainly determined by two factors: first, the total number of orders that need to be traversed; and second, the processing time for calculating the consumption of a single order. In other words, the total time spent calculating order consumption in existing technologies can be expressed by the following formula:

[0100] S1 = N × T;

[0101] Where S1 is the total time spent calculating order consumption in the prior art, N is the total number of orders that need to be traversed, and T is the processing time for calculating the order consumption of a single order.

[0102] Under the existing technical solution, all orders need to be acquired every hour, amounting to hundreds of millions. As the total number of orders N increases, the time S spent calculating order consumption will become longer and longer, growing linearly. Within a foreseeable timeframe, the system will become increasingly slow and eventually unusable, failing to provide business personnel with timely information on campaign consumption and to guide business campaigns.

[0103] Based on the solution in this application embodiment, the total time consumed by the order consumption calculation method provided in this application embodiment can be expressed as the following formula:

[0104] S2 = N1 × T1 + N2 × T2 + N3 × T3;

[0105] Wherein, S2 is the total time consumed by the order consumption calculation method provided in this application embodiment, N1 is the total number of incremental orders, T1 is the processing time for calculating the order consumption of a single incremental order, N2 is the total number of existing orders that have been refunded, T2 is the processing time for calculating the order consumption of a single existing order that has been refunded, N3 is the total number of existing orders whose settlement rules have changed, and T3 is the processing time for calculating the order consumption of a single existing order whose settlement rules have changed.

[0106] Assuming the processing time for each order is approximately the same, T′, the above formula can be transformed into:

[0107] S2 = (N1 + N2 + N3) × T′;

[0108] In the scheme of this application embodiment, N1 is in the thousands, N2 is in the hundreds, and N3 is in the thousands, thus greatly shortening the total time consumption.

[0109] In summary, based on the settlement rule record table and order data, orders that meet the consumption calculation conditions can be filtered out first. This allows for the calculation of consumption only for these orders, eliminating the need to calculate consumption for all orders. Consequently, the computational load and time consumed in the order consumption process can be reduced.

[0110] Please refer to Figure 6 , Figure 6 The present application provides a structural block diagram of an order consumption calculation device 600, which may include: an acquisition module 601 for acquiring order data of all orders in a database; a determination module 602 for determining, based on a settlement rule record table and the order data, the orders among all orders that meet the consumption calculation conditions; and a calculation module 603 for calculating the order consumption corresponding to the orders that meet the consumption calculation conditions, based on the settlement rule record table and the order data corresponding to the orders that meet the consumption calculation conditions.

[0111] In this embodiment of the application, orders that meet the consumption calculation conditions can be filtered out from all orders based on the settlement rule record table and order data. Thus, the consumption of orders that meet the consumption calculation conditions can be calculated only, without having to calculate the consumption of all orders. Therefore, the amount of calculation and time spent in the order consumption process can be reduced.

[0112] Furthermore, the order data includes the order generation time; the determining module 602 is specifically used to: find incremental orders among all orders based on the order generation time; wherein, the incremental orders are orders that meet the calculation consumption conditions.

[0113] In this embodiment of the application, incremental orders can be filtered out from all orders based on the settlement rule record table and the order generation time. Then, the order consumption of these incremental orders can be calculated based on the calculation rule record table, without having to calculate the order consumption of all orders. Therefore, the amount of calculation and time spent in the order consumption process can be reduced.

[0114] Furthermore, the determining module 602 is specifically used to: find all orders in which the difference between the order generation time and the current time is less than a preset time difference.

[0115] In this embodiment of the application, incremental orders can be filtered out from all orders based on the settlement rule record table and the order generation time. Then, the order consumption of these incremental orders can be calculated based on the calculation rule record table, without having to calculate the order consumption of all orders. Therefore, the amount of calculation and time spent in the order consumption process can be reduced.

[0116] Furthermore, the order data includes the order generation time and the order status; the determining module 602 is specifically used to: find all existing orders that have undergone refunds based on the order generation time and the order status; wherein, the existing orders that have undergone refunds are orders that meet the calculation consumption conditions; the calculation module is specifically used to: calculate that the order consumption corresponding to the existing orders that have undergone refunds is zero.

[0117] In this embodiment, existing orders that have been refunded can be filtered out from all orders based on the settlement rule record table, order generation time, and order status. Then, the order consumption of these existing orders can be calculated based on the calculation rule record table, without having to calculate the order consumption of all orders. Therefore, the amount of calculation and time spent in the order consumption process can be reduced.

[0118] Furthermore, the determining module 602 is specifically used to: find all orders where the difference between the order generation time and the current time is greater than a preset time difference, and the order status indicates a refund.

[0119] In this embodiment, existing orders that have been refunded can be filtered out from all orders based on the settlement rule record table, order generation time, and order status. Then, the order consumption of these existing orders can be calculated based on the calculation rule record table, without having to calculate the order consumption of all orders. Therefore, the amount of calculation and time spent in the order consumption process can be reduced.

[0120] Furthermore, the order data includes the order generation time and settlement rule identifier, wherein the settlement rule identifier corresponds to at least one settlement rule and the effective time of each settlement rule, and the settlement rule record table includes multiple settlement rule identifiers, the correspondence between each settlement rule identifier and at least one settlement rule, and the effective time of each settlement rule; the determining module 602 is specifically used to: search for a settlement rule change identifier according to the settlement rule record table; wherein the settlement rule change identifier is a settlement rule identifier whose corresponding settlement rule has changed within a preset time period; search for existing orders among all orders whose settlement rules have changed according to the order generation time, the settlement rule identifier, and the settlement rule change identifier; wherein the existing orders whose settlement rules have changed are orders that meet the calculation consumption conditions; the calculation module is specifically used to: search for the changed settlement rule corresponding to the order from the settlement rule record table according to the order generation time and the settlement rule identifier; calculate the order consumption corresponding to the existing orders whose settlement rules have changed according to the changed settlement rule.

[0121] In this embodiment, existing orders whose calculation rules have changed can be filtered out first based on the settlement rule record table, order generation time, and settlement rule identifier. Then, the order consumption of these existing orders can be calculated based on the calculation rule record table, without having to calculate the order consumption of all orders. Therefore, the amount of calculation and time spent in the order consumption process can be reduced.

[0122] Furthermore, the determining module 602 is specifically used to: find all orders where the difference between the order generation time and the current time is greater than a preset time difference, and the settlement rule identifier matches the settlement rule change identifier.

[0123] In this embodiment, existing orders whose calculation rules have changed can be filtered out first based on the settlement rule record table, order generation time, and settlement rule identifier. Then, the order consumption of these existing orders can be calculated based on the calculation rule record table, without having to calculate the order consumption of all orders. Therefore, the amount of calculation and time spent in the order consumption process can be reduced.

[0124] Please refer to Figure 7 , Figure 7This application provides a structural block diagram of an electronic device 700, which includes at least one processor 701, at least one communication interface 702, at least one memory 703, and at least one communication bus 704. The communication bus 704 enables direct communication between these components, the communication interface 702 facilitates signaling or data communication with other node devices, and the memory 703 stores machine-readable instructions executable by the processor 701. When the electronic device 700 is running, the processor 701 communicates with the memory 703 via the communication bus 704, and when the machine-readable instructions are invoked by the processor 701, the aforementioned order consumption calculation method is executed.

[0125] For example, the processor 701 in this embodiment of the application can read a computer program from the memory 703 via the communication bus 704 and execute the computer program to implement the following method: Step S101: Obtain the raw data of all orders from the upstream business system. Step S102: Determine the source channel, order status, and settlement rules of each order based on the raw data to obtain order data. Step S103: Write the order data into the database. In some examples, the processor 701 can also update configuration items, that is, it can perform the following steps: Step S201: Obtain the order data of all orders in the database. Step S202: Determine the orders that meet the calculation consumption conditions among all orders based on the settlement rule record table and the order data. Step S203: Calculate the order consumption corresponding to the orders that meet the calculation consumption conditions based on the settlement rule record table and the order data corresponding to the orders that meet the calculation consumption conditions.

[0126] The processor 701 can be an integrated circuit chip with signal processing capabilities. The processor 701 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor.

[0127] The memory 703 may include, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.

[0128] Understandable. Figure 7 The structure shown is for illustrative purposes only; the electronic device 700 may also include components that are more advanced than those shown. Figure 7 The more or fewer components shown, or having the same Figure 7 The different configurations shown. Figure 7 The components shown can be implemented using hardware, software, or a combination thereof. In the embodiments of this application, electronic device 700 can be, but is not limited to, physical devices such as desktop computers, laptops, smartphones, smart wearable devices, and in-vehicle devices, or virtual devices such as virtual machines. Furthermore, electronic device 700 is not necessarily a single device; it can be a combination of multiple devices, such as a server cluster, etc.

[0129] This application also provides a computer program product, including a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by the computer, the computer can perform the steps of the order consumption calculation method in the above embodiments, such as: obtaining order data of all orders in the database; determining the orders that meet the consumption calculation conditions among all orders according to the settlement rule record table and the order data; and calculating the order consumption corresponding to the orders that meet the consumption calculation conditions according to the settlement rule record table and the order data corresponding to the orders that meet the consumption calculation conditions.

[0130] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0131] Furthermore, the units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0132] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0133] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between these entities or operations.

[0134] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. An order consumption calculation method characterized by, The method comprises: acquiring order data of all orders in a database; determining, according to a settlement rule record table and the order data, orders that meet a calculation consumption condition among all orders; calculating, according to the settlement rule record table and order data corresponding to the orders that meet the calculation consumption condition, order consumption corresponding to the orders that meet the calculation consumption condition; wherein the order data comprises order generation time and a settlement rule identifier, wherein the settlement rule identifier corresponds to at least one settlement rule and the effective time of each settlement rule, and the settlement rule record table comprises a plurality of settlement rule identifiers, the correspondence between each settlement rule identifier and at least one settlement rule, and the effective time of each settlement rule; the determination, according to the settlement rule record table and the order data, of the orders that meet the calculation consumption condition among all orders comprises: finding, according to the settlement rule record table, a settlement rule change identifier; wherein the settlement rule change identifier is a settlement rule identifier corresponding to a settlement rule that has changed within a preset time period; finding, according to the order generation time, the settlement rule identifier, and the settlement rule change identifier, inventory orders in which the settlement rule has changed among all orders; wherein the inventory orders in which the settlement rule has changed are the orders that meet the calculation consumption condition; the calculation, according to the settlement rule record table and the order data corresponding to the orders that meet the calculation consumption condition, of the order consumption corresponding to the orders that meet the calculation consumption condition comprises: finding, according to the order generation time and the settlement rule identifier, the changed settlement rule corresponding to the orders from the settlement rule record table; calculating, according to the changed settlement rule, the order consumption corresponding to the inventory orders in which the settlement rule has changed.

2. The order consumption calculation method of claim 1, wherein, The order data comprises order generation time. The determination, according to the settlement rule record table and the order data, of the orders that meet the calculation consumption condition among all orders comprises: finding, according to the order generation time, incremental orders among all orders; wherein the incremental orders are the orders that meet the calculation consumption condition.

3. The order consumption calculation method of claim 2, wherein, The finding, according to the order generation time, of the incremental orders among all orders comprises: finding, among all orders, orders in which the difference between the order generation time and the current time is less than a preset time difference.

4. The order consumption calculation method of claim 1, wherein, The order data comprises order generation time and order status. The determination, according to the settlement rule record table and the order data, of the orders that meet the calculation consumption condition among all orders comprises: finding, according to the order generation time and the order status, inventory orders in which a refund behavior has occurred among all orders; wherein the inventory orders in which the refund behavior has occurred are the orders that meet the calculation consumption condition. The calculation, according to the settlement rule record table and the order data corresponding to the orders that meet the calculation consumption condition, of the order consumption corresponding to the orders that meet the calculation consumption condition comprises: calculating the order consumption corresponding to the inventory orders in which the refund behavior has occurred as zero.

5. The order consumption calculation method of claim 4, wherein, The finding, according to the order generation time and the order status, of the inventory orders in which the refund behavior has occurred among all orders comprises: Find all orders in which the order generation time and the current time difference is greater than the preset time difference, and the order state represents the order of refund.

6. The order consumption calculation method of claim 1, wherein, According to the order generation time, the settlement rule identifier and the settlement rule change identifier, find the inventory order in which the settlement rule changes. Find all orders in which the order generation time and the current time difference is greater than the preset time difference, and the settlement rule identifier and the settlement rule change identifier match.

7. An order consumption calculating device characterized by comprising: Including: An acquisition module for acquiring order data of all orders in a database; A determination module for determining orders that meet the calculation consumption condition according to the settlement rule record table and the order data; A calculation module for calculating the order consumption corresponding to the order that meets the calculation consumption condition according to the settlement rule record table and the order data corresponding to the order that meets the calculation consumption condition. Wherein, the order data includes order generation time and settlement rule identifier, wherein the settlement rule identifier corresponds to at least one settlement rule and the effective time of each settlement rule, and the settlement rule record table includes multiple settlement rule identifiers, the correspondence between each settlement rule identifier and at least one settlement rule, and the effective time of each settlement rule; The determination module is specifically used for: According to the settlement rule record table, find the settlement rule change identifier; wherein the settlement rule change identifier is the settlement rule identifier corresponding to the settlement rule changed in a preset time period; According to the order generation time, the settlement rule identifier and the settlement rule change identifier, find the inventory order in which the settlement rule changes; wherein the inventory order in which the settlement rule changes is the order that meets the calculation consumption condition; The calculation module is specifically used for: According to the order generation time and the settlement rule identifier, find the changed settlement rule corresponding to the order from the settlement rule record table; According to the changed settlement rule, calculate the order consumption corresponding to the inventory order in which the settlement rule changes.

8. An electronic device, comprising: Including: A processor, a memory and a bus; The processor and the memory complete mutual communication through the bus; The memory stores program instructions executable by the processor, and the processor calling the program instructions can execute the order consumption calculation method of any one of claims 1-6.

9. A non-transitory computer-readable storage medium, comprising: The non-transitory computer readable storage medium stores computer instructions, which when executed by a computer, cause the computer to execute the order consumption calculation method of any one of claims 1-6.

Citation Information

Patent Citations

  • Real-time reward settlement system based on Drools rule and method thereof

    CN112990863A