An order data real-time processing method for a cake electronic coupon selling system

By constructing a state closed loop and using a point set convexity judgment algorithm in the cake e-coupon sales system, the problems of order status synchronization delay and untimely inventory verification in high-concurrency transactions were solved, realizing timely update of order status and real-time synchronization of inventory data, improving user experience and the accuracy of inventory availability judgment.

CN121458411BActive Publication Date: 2026-05-05BEIJING LIFE MODEL NETWORK TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511581212.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-31
Publication Date
2026-05-05
Estimated Expiration
2045-10-31

AI Technical Summary

Technical Problem

In the cake e-coupon sales system, under high-concurrency transaction scenarios, there is a response timeout when calling the third-party coupon code generation service after successful payment, which leads to delays in order status synchronization and untimely inventory verification, affecting user experience and inventory availability assessment.

Method used

The ear-cutting method is used to construct a state closed loop. The coupon code allocation status is perceived in real time through the first and second monitoring points. Combined with the point set convexity judgment algorithm, the dynamic inventory compensation amount is generated to ensure timely update of order status and real-time synchronization of inventory.

Benefits of technology

It enables real-time synchronization of order status and accurate updates of inventory, avoiding long-term order stagnation and inventory data deviation, and improving user experience and the accuracy of inventory availability assessment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121458411B_ABST
    Figure CN121458411B_ABST
Patent Text Reader

Abstract

This invention provides a real-time order data processing method for a cake e-coupon sales system, belonging to the field of data processing technology. The method includes: based on a first and a second state monitoring point, sequentially connecting the state monitoring points using an ear-cutting method; constructing a state loop for the order processing state by successively removing outer ear vertices from the state monitoring point sequence; verifying the geometric characteristics of the state loop using a point set convexity judgment algorithm based on the convexity verification result; generating a dynamic inventory compensation amount based on the dynamic inventory compensation amount; updating the inventory quantity in the product inventory repository in real time based on the dynamic inventory compensation amount; and sending order completion information to relevant channel systems via a message queue. This invention effectively improves the timeliness of coupon code allocation and order status synchronization, the accuracy of fault detection, and the consistency of inventory data, while also optimizing the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a method for real-time processing of order data for a cake e-coupon sales system. Background Technology

[0002] In cake e-voucher sales systems, to adapt to daily transaction needs, an asynchronous processing flow is typically used to complete the entire process from user order placement to voucher code issuance. After the system confirms successful payment, it sequentially performs operations such as inventory locking, calling a third-party service to generate a voucher code and binding it to the order, and updating the order status to "completed." This process is prone to specific technical bottlenecks in high-concurrency transaction scenarios such as the pre-Chinese New Year gift box e-voucher promotion. The core technical problem is that there is a perceived delay in synchronizing the call to the third-party voucher code generation service and the final inventory verification status after successful payment. For example, during the peak period of the pre-Chinese New Year cake gift box e-voucher promotion, after a certain order is successfully paid, the call to the third-party voucher code generation service may time out due to peak service response. There is a lack of real-time perception and accurate location of the failure in this step, causing the order to be stuck in the "payment successful but pending processing" state, unable to issue a voucher code to the user or complete the final inventory verification.

[0003] This issue has two direct consequences: first, users may initiate inquiries due to not receiving coupon codes in time, and some users may try to place duplicate orders, reducing the service experience; second, unredeemed inventory cannot be released in real time, affecting the assessment of inventory availability for subsequent orders. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a real-time order data processing method for a cake e-coupon sales system, which effectively improves the timeliness of coupon code allocation and order status synchronization, the accuracy of fault detection and the consistency of inventory data, while optimizing the user experience.

[0005] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:

[0006] A first aspect is a method for real-time processing of order data in a cake e-coupon sales system, the method comprising:

[0007] Step 1: Receive electronic coupon purchase requests initiated by users through multi-channel interfaces;

[0008] Step 2: Based on the electronic coupon purchase request, verify the availability of product inventory and the user's purchase authority, generate initial order data, and store it in the order data repository;

[0009] Step 3: Process payment transactions based on initial order data, complete payment authorization through the payment gateway interface, update the order status to paid, and generate a payment completion event;

[0010] Step 4: Based on the payment completion event, generate two data processing paths. The first path generates a unique electronic coupon code and associates the electronic coupon code with the order data. The second path updates the order status to "coupon code has been assigned".

[0011] Step 5: Establish an order processing status area based on two data processing paths. Set a first status monitoring point within the area to correspond to the successful coupon code allocation status, and set a second status monitoring point outside the area to correspond to the abnormal coupon code allocation status.

[0012] Step 6: Based on the first and second state monitoring points, the ear-cutting method is used to sequentially connect the state monitoring points, and a state closed loop of the order processing state is constructed by successively removing the outer ear vertices in the state monitoring point sequence.

[0013] Step 7: Based on the state closed loop, the geometric characteristics of the state closed loop are verified using the point set convexity judgment algorithm. The dynamic inventory compensation amount is generated according to the convexity verification result. The inventory quantity in the commodity inventory storage is updated in real time according to the dynamic inventory compensation amount, and the order completion information is sent to the relevant channel system according to the message queue.

[0014] In a second aspect, a computing device includes:

[0015] One or more processors;

[0016] A storage device for storing one or more programs that, when executed by one or more processors, cause the one or more processors to implement the method.

[0017] Thirdly, a computer-readable storage medium storing a program that, when executed by a processor, implements the method.

[0018] The above-described solution of the present invention has at least the following beneficial effects:

[0019] By constructing a state closed loop using the first monitoring point for successful states within the state area and the second monitoring point for abnormal states outside the area, combined with the ear-cutting method, the entire process status of successful or abnormal coupon code allocation can be perceived in real time. This solves the problems of state synchronization delay and ambiguous fault location in traditional systems, and avoids orders from being stuck in the "paid but pending" state for a long time. Based on the point set convexity judgment algorithm, the geometric characteristics of the state closed loop are verified and dynamic inventory compensation is generated, which can accurately trigger real-time inventory updates. This solves the problem of inventory data deviation caused by untimely inventory write-off or release, and improves the accuracy of subsequent order inventory availability judgment. Attached Figure Description

[0020] Figure 1 This is a flowchart illustrating a real-time order data processing method for a cake e-coupon sales system, provided by an embodiment of the present invention.

[0021] Figure 2 This is a flowchart illustrating the process of processing payment transactions based on initial order data, completing payment authorization through a payment gateway interface, updating the order status to "paid," and generating a payment completion event, as provided in an embodiment of the present invention. Detailed Implementation

[0022] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0023] like Figure 1 As shown in the figure, an embodiment of the present invention proposes a real-time order data processing method for a cake e-coupon sales system, the method comprising the following steps:

[0024] Step 1: Receive electronic coupon purchase requests initiated by users through multi-channel interfaces;

[0025] Step 2: Based on the electronic coupon purchase request, verify the availability of product inventory and the user's purchase authority, generate initial order data, and store it in the order data repository;

[0026] Step 3: Process payment transactions based on initial order data, complete payment authorization through the payment gateway interface, update the order status to paid, and generate a payment completion event;

[0027] Step 4: Based on the payment completion event, generate two data processing paths. The first path generates a unique electronic coupon code and associates the electronic coupon code with the order data. The second path updates the order status to "coupon code has been assigned".

[0028] Step 5: Establish an order processing status area based on two data processing paths. Set a first status monitoring point within the area to correspond to the successful coupon code allocation status, and set a second status monitoring point outside the area to correspond to the abnormal coupon code allocation status.

[0029] Step 6: Based on the first and second state monitoring points, the ear-cutting method is used to sequentially connect the state monitoring points, and a state closed loop of the order processing state is constructed by successively removing the outer ear vertices in the state monitoring point sequence.

[0030] Step 7: Based on the state closed loop, the geometric characteristics of the state closed loop are verified using the point set convexity judgment algorithm. The dynamic inventory compensation amount is generated according to the convexity verification result. The inventory quantity in the commodity inventory storage is updated in real time according to the dynamic inventory compensation amount, and the order completion information is sent to the relevant channel system according to the message queue.

[0031] In this embodiment of the invention, a state closed loop is constructed by combining a first monitoring point for successful status within the state area and a second monitoring point for abnormal status outside the state area with the ear-cutting method. This allows for real-time perception of the entire process status of successful or abnormal coupon code allocation, solving the problems of state synchronization delay and ambiguous fault location in traditional systems, and preventing orders from remaining in the "paid but pending" state for extended periods. Based on the point set convexity judgment algorithm, the geometric characteristics of the state closed loop are verified and a dynamic inventory compensation amount is generated, which can accurately trigger real-time inventory updates. This solves the problem of inventory data deviation caused by untimely inventory write-off or release, and improves the accuracy of subsequent order inventory availability judgment.

[0032] In a preferred embodiment of the present invention, step 1, receiving an electronic coupon purchase request initiated by a user through a multi-channel interface, may include:

[0033] Step 101: Receive user-initiated electronic coupon purchase requests through request receiving nodes deployed in the multi-channel access layer. The multi-channel interfaces include e-commerce platform interfaces, mini-program interfaces, official APP interfaces, and partner channel API interfaces. The receiving nodes are configured with high concurrency processing capabilities to sequentially receive and temporarily store a large number of requests that flood in at the same time, ensuring that each request can be completely captured and marked with a unique request identifier. The request identifier is composed of a request arrival timestamp and a random number. The request data includes core information such as product identifier, purchase quantity, user identifier, channel identifier, and payment method.

[0034] In this embodiment, the multi-channel request receiving node ensures that purchase requests from various channels can be fully received and distinguished in high-concurrency scenarios through queuing buffers and unique identifiers, thus avoiding request loss or confusion.

[0035] In a preferred embodiment of the present invention, step 2, based on the electronic coupon purchase request, verifies the availability of product inventory and the user's purchase authority, generates initial order data, and stores it in the order data repository, may include:

[0036] Step 201: Parse the product identifier in the e-coupon purchase request and obtain the available inventory quantity of the corresponding product from the product inventory repository. Compare the available inventory quantity with the purchase quantity to obtain the inventory verification result. Specifically, this includes: calling the request parsing program to extract information from the e-coupon purchase request, parsing the product identifier from the request data. This product identifier is a unique e-coupon product code in the system, consisting of a combination of numbers and letters. Access the product inventory repository through the product identifier. The product inventory repository stores the total inventory quantity of the corresponding product and the inventory quantity that has been locked but not yet completed final redemption. Read the total inventory quantity of the product from the repository and then read the locked inventory quantity. Subtract the locked inventory quantity from the total inventory quantity to obtain the current available inventory quantity. Compare the available inventory quantity with the purchase quantity in the e-coupon purchase request. If the available inventory quantity is greater than or equal to the purchase quantity, the inventory verification result is available; if the available inventory quantity is less than the purchase quantity, the inventory verification result is unavailable.

[0037] Step 202: When the inventory verification result is available, obtain the corresponding purchase permission rules from the channel permission configuration library using the channel identifier and user identifier in the e-coupon purchase request. Specifically, this includes: extracting the channel identifier and user identifier from the e-coupon purchase request. The channel identifier is a unique code for accessing the channel to distinguish different sales channels, and the user identifier is a unique identity identifier for the user in the system, which can be a registered account or a third-party account mapping ID. The channel permission configuration library is queried together using the channel identifier and user identifier. The channel permission configuration library stores the purchase permission rules corresponding to each channel and user. The rule content includes the range of allowed product types, the maximum quantity of a single purchase, user level restrictions, etc. After querying, the complete purchase permission rules corresponding to the channel and user are obtained.

[0038] Step 203: Match the verification conditions in the purchase permission rules with the user identifier and channel identifier in the e-coupon purchase request to obtain the user's purchase permission verification result. When the user's purchase permission verification result indicates eligibility to purchase, combine the order number, product identifier, user identifier, channel identifier, order timestamp, and initial order status to generate initial order data and write it to the order data repository. Specifically, this includes: matching each verification condition in the purchase permission rules with the user identifier and channel identifier in the e-coupon purchase request item by item; first verifying whether the user level corresponding to the user identifier meets the minimum level requirement set in the rules, and then verifying whether the channel corresponding to the channel identifier is within the rules' permitted range. Within the sales channel list, the final verification request checks whether the purchase quantity is within the maximum single purchase quantity range set by the rules. When all verification conditions are met, the user's purchase permission verification result is that they are qualified to purchase. At this time, the system automatically generates a unique order number, which is composed of the first letter of the channel identifier, the last four digits of the user identifier, the timestamp, and a random number. The order number, product identifier, user identifier, channel identifier, current system timestamp, and initial order status are combined to form the initial order data. The initial order status is set to pending payment. The initial order data is written to the order data repository through database transaction operations to ensure that all fields are written successfully at the same time and to avoid data incompleteness caused by failure to write some fields.

[0039] This embodiment uses an inventory verification process combined with the difference between total inventory and locked inventory to accurately determine whether the inventory of goods meets the purchase demand, thus avoiding overselling from the source.

[0040] like Figure 2 As shown, in another preferred embodiment of the present invention, step 3, processing payment transactions based on initial order data, completing payment authorization through the payment gateway interface, updating the order status to paid, and generating a payment completion event, may include:

[0041] Step 301: Parse the payment information in the initial order data to obtain the payment amount and payment method; construct a standard format payment request based on the payment amount and payment method to obtain transaction data recognizable by the payment gateway. Specifically, this includes: calling the order data parsing program to read the initial order data in the order data repository; extracting payment information, including the payment amount and payment method, from the initial order data; calculating the payment amount by multiplying the unit price of the corresponding product by the purchase quantity using the product identifier from the product information database; and specifying the payment method, including WeChat Pay, Alipay, and UnionPay, each with a specific code recognizable by the payment gateway. The payment amount is converted to a standard currency format and the payment method is converted to its corresponding code according to the payment gateway's interface specifications. Merchant ID, order number, and signature information are also added. The signature information is generated by encrypting the payment amount, order number, and timestamp using the merchant key. These information are then combined to construct transaction data directly recognizable by the payment gateway.

[0042] Step 302: Initiate a processing request to the payment gateway interface using the transaction data to obtain a payment response result containing an authorization code. Based on the authorization status in the payment response result, determine the payment success. Specifically, this includes: sending the transaction data to the payment gateway interface through an encrypted transmission channel, using a secure encryption protocol to ensure data transmission security; verifying and processing the received transaction data, including the matching of signature information and merchant number, and the standardization of the transaction data format; returning a payment response result containing an authorization code (a combination of numbers and letters of a specific length); parsing the payment response result to extract the authorization status field; if the authorization status field shows success and contains a valid authorization code, the payment is considered successful; if the authorization status field shows failure or no valid authorization code is returned, the payment is considered unsuccessful.

[0043] Step 303: Based on the successful payment determination, update the status field in the order data repository to obtain the order record with the status of "paid" and generate a payment completion event. Specifically, this includes: after the payment is determined to be successful, calling the order status update program to access the order data repository, updating the status field of the corresponding order from "pending payment" to "paid", and writing the payment timestamp and authorization code information at the same time. The payment timestamp is accurate to the second to record the specific time of payment completion. At the same time, the system generates a payment completion event, the content of which includes the order number, payment time, payment amount and authorization code. The payment completion event is published through the internal event transmission mechanism to provide a trigger signal for the subsequent coupon code generation and inventory processing to ensure the continuous operation of the process.

[0044] This embodiment ensures accurate and efficient payment processes through standardized payment request construction and payment response determination, reducing payment failures caused by format mismatches or status misjudgments. By updating order status in a timely manner and generating payment completion events, it achieves smooth connection between the payment process and subsequent processes, reducing status synchronization delays and improving the stability and efficiency of overall transaction processing in high-concurrency scenarios.

[0045] In a preferred embodiment of the present invention, step 4, generating two data processing paths based on the payment completion event, the first path generates a unique electronic coupon code and associates the electronic coupon code with the order data, and the second path updates the order status to "coupon code assigned," may include:

[0046] Step 401: Based on the order number in the payment completion event, obtain the corresponding order details from the order data repository; generate unique electronic coupon code data according to the product identifier and channel identifier in the order details. Specifically, this includes: accessing the order data repository through the 20-digit order number carried in the payment completion event. The first 10 digits of the order number are the date code and the last 10 digits are the serial number. First, locate the date partition in the index table of the order data repository by the first 10 digits of the order number, and then find the specific data row by the last 10 digits of the serial number. Read the complete order details, including the 18-digit product identifier, the 10-digit channel identifier, the purchase quantity, the user identifier, etc.; generate unique electronic coupon code data based on the order details. Take the first 8 digits of the 18-digit product identifier, take the last 6 digits of the 10-digit channel identifier, obtain the current 13-digit millisecond-level timestamp, and generate a 6-digit random number (range 000000 to 999999). Concatenate these four parts in sequence to form a 33-digit electronic coupon code data, ensuring that each electronic coupon code is unique in the system. This electronic coupon code will be used for subsequent user redemption.

[0047] Step 402: Establish a mapping relationship between the electronic coupon code data and the order number to obtain the coupon code binding record, and update the coupon code status in the coupon code database to obtain the allocated coupon code information. Specifically, this includes: establishing a one-to-one mapping relationship between the generated 33-digit electronic coupon code data and the 20-digit order number to form a coupon code binding record. The record contains four parts: electronic coupon code, order number, product identifier, and channel identifier. This record is written into the coupon code binding data table, which uses the electronic coupon code as a unique primary key to ensure no duplicates. Then, the coupon code database is accessed to find the initial record corresponding to the electronic coupon code. The status field in the initial record is "pending allocation". The status field is modified to "allocated" to complete the coupon code status update and obtain the allocated coupon code information.

[0048] Step 403: Trigger the order status update process based on the allocated coupon code information and modify the status field in the order data repository to obtain an order record with the status "Coupon Code Assigned". Specifically, this includes: triggering the order status update process via the internal event bus based on the allocated coupon code information; the event bus sends a trigger signal containing the electronic coupon code and order number to the order status handler. After receiving the signal, the order status handler accesses the order data repository to find the record with the corresponding order number, changes the status field in the record from "Paid" to "Coupon Code Assigned", and simultaneously supplements the electronic coupon code information and status update time. The status update time is the current system time accurate to the second to ensure that the order status and coupon code status are completely synchronized, ultimately obtaining an order record with the status "Coupon Code Assigned".

[0049] This embodiment ensures that each order corresponds to a unique coupon code by clearly defining the composition rules and generation method of the electronic coupon code, thus avoiding confusion in coupon code distribution. At the same time, it synchronously updates the coupon code and order status, solving the problem of status perception delay in the process.

[0050] In a preferred embodiment of the present invention, step 5, establishing an order processing status area based on two data processing paths, setting a first status monitoring point within the area corresponding to a successful coupon code allocation status, and setting a second status monitoring point outside the area corresponding to an abnormal coupon code allocation status, may include:

[0051] Step 501: Integrate the electronic coupon code allocation results from the first data processing path and the order status update results from the second data processing path to obtain a complete order processing status dataset. Specifically, this includes: integrating the electronic coupon code allocation results from the first data processing path and the order status update results from the second data processing path; the electronic coupon code allocation results include coupon code generation flags (success or failure) and coupon code status (allocated or pending allocation); the order status update results include status update flags (success or failure) and update time (current time minus the trigger update time); group by order number, and summarize the two parts of the results for the same order to form a complete status dataset for each order, containing coupon code processing status and order processing status.

[0052] Step 502: Construct an order processing status region based on the complete order processing status dataset to obtain a monitoring range definition that includes successful and abnormal states. Specifically, this includes: first, defining the judgment conditions for the core range. When the coupon code generation flag of an order is successful, the coupon code status is allocated, the update flag is successful, and the update time is less than 5 seconds, the processing status of the order is included in the core range and defined as a successful state. States outside the core range are classified as abnormal states, including situations such as the coupon code generation flag being failed, the coupon code status being pending allocation, the update time being greater than 10 seconds, and the update flag being failed. Through such conditional division, a monitoring range definition that includes successful and abnormal states is obtained.

[0053] Step 503: Based on the defined monitoring range, set a first status monitoring point within the order processing status area to obtain monitoring configuration parameters for the successful coupon code allocation status; based on the defined monitoring range, set a second status monitoring point outside the order processing status area to obtain monitoring configuration parameters for the abnormal coupon code allocation status. Specifically, the configuration parameters for the first status monitoring point include: monitoring whether the coupon code status is allocated once per second; verifying whether the order status and coupon code status are consistent once per second (both must be allocated or both must be pending allocation); checking whether the binding relationship between the coupon code and the order exists once per second; and ensuring that the corresponding order can be found by querying the coupon code binding data table through the electronic coupon code. The system uses a single ID number and other parameters to monitor the successful processing status within the designated area in real time. A second monitoring point is set outside the designated order processing area based on the monitoring range definition. The configuration parameters for this second monitoring point include: a coupon code generation timeout threshold of 10 seconds (ranging from 5 to 15 seconds; failure to generate a coupon code within 10 seconds indicates an anomaly); a timeout threshold of 15 seconds for the order status remaining at "paid" (ranging from 8 to 20 seconds; failure to update a coupon code within 15 seconds indicates an anomaly); and a check every second to ensure the coupon code and order are not bound. If no results are found in the coupon code binding data table when querying the order number, an anomaly is determined. These parameters are used to monitor the abnormal processing status outside the designated area in real time.

[0054] This embodiment refines the judgment conditions for the monitoring scope and the configuration parameters of the monitoring points, monitors the success and abnormal status of coupon code allocation in real time, promptly detects timeout or failure issues in the processing process, and improves the accuracy of fault perception.

[0055] In a preferred embodiment of the present invention, step 6, based on the first state monitoring point and the second state monitoring point, uses the ear-cutting method to sequentially connect the state monitoring points, and constructs a state closed loop of the order processing state according to the successive removal of the outer ear vertex in the state monitoring point sequence, may include:

[0056] Step 601: Construct an ordered sequence of state monitoring points based on the spatial distribution data of the first and second state monitoring points; based on the ordered sequence of state monitoring points, identify the set of vertices in the sequence that satisfy the outer ear condition, specifically including: the spatial distribution data includes the processing time (time when monitoring is triggered) and state type (success or abnormal) of the monitoring points, sorted in order from earliest to latest processing time, if the processing time is the same, the monitoring points with the successful type are ranked first, forming an ordered sequence; based on the ordered sequence, identify the set of vertices that satisfy the outer ear condition, the outer ear condition is that the state type of the monitoring point is abnormal and the state type of the previous monitoring point is successful and the state type of the next monitoring point is successful. For example, the processing time of monitoring point A is 10 seconds and the state type is abnormal, the processing time of the previous monitoring point B is 8 seconds and the state type is successful, and the processing time of the next monitoring point C is 12 seconds and the state type is successful. Monitoring point A belongs to the outer ear vertex, and all monitoring points that meet the condition are summarized to form the outer ear vertex set.

[0057] Step 602: Analyze the spatial relationships of the vertices in the outer ear vertex set to obtain the removal order of the outer ear vertices. Remove the outer ear vertices sequentially according to the removal order to obtain the updated state monitoring point sequence. Specifically, the spatial relationships are divided according to the processing stage and the degree of abnormality. The processing stage is divided into the coupon code generation stage (processing time 0 to 5 seconds) and the state update stage (processing time 5 to 10 seconds). The degree of abnormality is divided according to the timeout duration (1 to 5 seconds is mild, 5 to 10 seconds is moderate, and more than 10 seconds is severe). The removal order prioritizes removing vertices with earlier processing stages and lower abnormality. For example, if the processing time of outer ear vertex D is 3 seconds (coupon code generation stage) and its abnormality is mild, and the processing time of outer ear vertex E is 7 seconds (state update stage) and its abnormality is moderate, then vertex D is removed first, followed by vertex E. The outer ear vertices are removed from the ordered sequence sequentially according to the removal order. After each vertex is removed, the vertices are reordered according to the processing time to ensure that the time order of the remaining vertices is not disordered, finally obtaining the updated state monitoring point sequence.

[0058] Step 603: Based on the updated sequence of state monitoring points, establish edge connections between adjacent state monitoring points and perform integrity verification to obtain a complete edge connection network. Based on this complete edge connection network, construct a closed-loop state for order processing status. Specifically, the adjacent relationships are determined according to the processing time sequence. The processing result of the previous monitoring point serves as the monitoring basis for the next monitoring point. For example, if the previous monitoring point F has a processing time of 5 seconds, a status type of success, and a processing result of "coupon code generated," this result serves as the monitoring basis for the next monitoring point G (processing time of 6 seconds, status type of success) (it is necessary to verify whether the order status is updated synchronously). This establishes an edge connection between the two points. After the connection is completed, perform integrity verification on the edge connection relationship, checking whether each monitoring point has one and only one preceding connection and one following connection. If a monitoring point H only has a preceding connection and no following connection, then supplement it with a connection to the next nearest monitoring point I, until all monitoring points have established valid connections, resulting in a complete edge connection network. The network connects the first monitoring point (processing time 0 seconds, status type initial) with the last monitoring point (processing time 20 seconds, status type completed) to form a closed loop of order processing status covering all normal processing statuses.

[0059] This embodiment constructs an ordered sequence of monitoring points according to rules and removes abnormal outer ear vertices to form a complete state closed loop, streamlines a clear processing flow, reduces order stagnation caused by process breaks, and ensures the continuity of order processing.

[0060] In a preferred embodiment of the present invention, step 7, based on the state closed loop, uses a point set convexity judgment algorithm to verify the geometric characteristics of the state closed loop, generates a dynamic inventory compensation amount based on the convexity verification result, updates the inventory quantity in the commodity inventory storage warehouse in real time based on the dynamic inventory compensation amount, and sends order completion information to relevant channel systems according to the message queue, may include:

[0061] Step 701: Extract the coordinates of all boundary points of the state closed loop using the boundary point set data; based on the spatial distribution relationship of the boundary point coordinates, analyze the connection relationship between the boundary points using a point set convexity judgment algorithm to obtain the convexity detection result of the state closed loop; judge the geometric characteristics of the state closed loop based on the convexity detection result to obtain the convexity verification conclusion of the state closed loop, specifically including: the boundary point coordinates consist of an abscissa and a ordinate, the abscissa being the processing time of the monitoring point in seconds, with a value range of 0 to 20 seconds; the ordinate being the state completion rate, with a value range of... The range is 0% to 100%; the status completion rate is calculated by dividing the number of successfully processed monitoring points by the total number of monitoring points, and then multiplying by 100%. For example, if the processing time for a certain boundary point is 5 seconds (within the range of 0 to 20 seconds), the total number of monitoring points is 10 (within the range of 5 to 50), and the number of successfully processed monitoring points is 5 (within the range of the total number of monitoring points), then the status completion rate is 5 divided by 10 and then multiplied by 100%, which equals 50%. The coordinates of this boundary point are 5 and 50, corresponding to the x-axis and y-axis, respectively.

[0062] The point set convexity judgment algorithm is used to analyze the connection relationship between boundary points. The specific calculation process is as follows: First, determine the ordered sequence of boundary points. Sort all boundary points in order from earliest to latest by their x-coordinate (processing time), forming an ordered sequence. For example, if the extracted boundary point coordinates are (0, 0), (5, 50), (10, 80), (15, 90), and (20, 100), after sorting by processing time from earliest to latest, the ordered sequence is point (0, 0), point (5, 50), point (... 10, 80), point (15, 90), point (20, 100); the second step is to construct the vector of three adjacent points. Take three adjacent boundary points in the ordered sequence, and set them as point P1(x1, y1), point P2(x2, y2), and point P3(x3, y3). First, calculate the vector P2P1 from P1 to P2, where the x-coordinate of the vector is x2 minus x1, and the y-coordinate is y2 minus y1; then calculate the vector P3P2 from P2 to P3, where the x-coordinate of the vector is x3 minus x2, and the y-coordinate is y2 minus y1. Label it as y3 minus y2; taking the first three points in the sequence (0,0), (5,50), (10,80) as examples, P1(0,0), P2(5,50), P3(10,80), the x-coordinate of vector P2P1 is 5 minus 0 equals 5, and the y-coordinate is 50 minus 0 equals 50; the x-coordinate of vector P3P2 is 10 minus 5 equals 5, and the y-coordinate is 80 minus 50 equals 30; the third step is to calculate the cross product of the vectors, the cross product of vectors P2P1 and P3P2 is... The result is equal to the x-coordinate of vector P2P1 multiplied by the y-coordinate of vector P3P2, and then subtracted from the x-coordinate of vector P3P2 multiplied by the y-coordinate of vector P2P1. Taking the above three points as an example, the cross product result is 5 multiplied by 30, and then subtracted from 5 multiplied by 50, that is, 150 minus 250, the result is equal to -100. The sign of the cross product result represents the direction of vector rotation. A negative value indicates counterclockwise rotation, a positive value indicates clockwise rotation, and zero indicates that the three points are collinear. The fourth step is to traverse all adjacent three points to determine the consistency of direction.

[0063] Following the above method, calculate the cross product for all adjacent three points in the ordered sequence (including the three points formed by the last point, the first point, and the second point, forming a closed loop judgment), and record the sign of each cross product result. For example, for (5, 50), (10, 80), and (15, 90), the x-coordinate of vector P2P1 is 10 minus 5, which equals 5, and the y-coordinate is 80 minus 50, which equals 30. The x-coordinate of vector P3P2 is 15 minus 10, which equals 5, and the y-coordinate is 90 minus 80, which equals 10. The cross product is 5 multiplied by 10 minus 5 multiplied by 30, which is 50 minus 150, resulting in -100. For (15, 90), (20, 100), and (0, 0), the x-coordinate of vector P2P1 is 20 minus 1... 5 equals 5, ordinate 100 minus 90 equals 10, vector P3P2 x-coordinate 0 minus 20 equals -20, ordinate 0 minus 100 equals -100, cross product is 5 multiplied by (-100), minus (-20) multiplied by 10, that is, -500 plus 200, the result is -300; calculate for (20, 100), (0, 0), (5, 50), vector P2P1 x-coordinate 0 minus 20 equals -20, ordinate 0 minus 100 equals -100, vector P3P2 x-coordinate 5 minus 0 equals 5, ordinate 50 minus 0 equals 50, cross product is (-20) multiplied by 50, minus 5 multiplied by (-100), that is, -1000 plus 500, the result is -500. The fifth step is to determine convexity based on the cross product results. If all cross product results have the same sign (all positive or all negative), or some results are zero (representing three points being collinear, still conforming to the characteristics of a convex polygon), then the convexity detection result is a convex polygon. If there are cases where the cross product results are positive and some are negative, then the convexity detection result is a non-convex polygon. In the above example, all cross product results are negative, so the detection result is a convex polygon. Based on the detection results, the geometric characteristics of the state loop are determined. The convexity verification conclusion corresponding to the convex polygon is that the processing flow of the state loop is smooth and there are no abnormal bottlenecks. The convexity verification conclusion corresponding to the non-convex polygon is that there are abnormal bottlenecks in the state loop and adjustments are needed.

[0064] Step 702: Based on the convexity verification conclusion and combined with the order processing efficiency index, generate a dynamic inventory compensation amount and adjust the available inventory quantity in the product inventory storage repository to obtain real-time updated inventory data. Specifically, the order processing efficiency index includes the average order processing time and the coupon code allocation success rate. The average order processing time is calculated by adding the processing times of all orders and then dividing by the total number of orders, with a value range of 3 to 20 seconds. The coupon code allocation success rate is calculated by dividing the number of orders with successfully allocated coupon codes by the total number of orders and then multiplying by 100%, with a value range of 60% to 100%. If the convexity verification conclusion indicates a smooth processing flow, the dynamic inventory compensation amount is the quantity of products corresponding to the currently allocated coupon codes. The calculation method is the number of orders with allocated coupon codes multiplied by the purchase quantity of each order. The number of orders with allocated coupon codes ranges from 1 to 50, and the purchase quantity of each order ranges from 1 to 10. Then, the product... The available inventory in the inventory repository is subtracted from this product. The available inventory ranges from 10 to 1000 units to obtain the real-time updated inventory data. For example, if the available inventory is 100 units (within the range of 10 to 1000), the number of orders with allocated coupon codes is 10 (within the range of 1 to 50), and the purchase quantity per order is 1 unit (within the range of 1 to 10), then the quantity of goods corresponding to the allocated coupon codes is 10 multiplied by 1, which equals 10. The updated available inventory is 100 minus 10, which equals 90. If the convexity verification result indicates the existence of an abnormal bottleneck, the dynamic inventory compensation is the inventory quantity occupied by the abnormal orders. The calculation method is to multiply the number of abnormal orders by the purchase quantity of each abnormal order. The number of abnormal orders ranges from 1 to 30 units, and the purchase quantity of each abnormal order ranges from 1 to 10 units. Then, the available inventory in the product inventory repository is added to this product to obtain the real-time updated inventory data. For example, if the available inventory is 90 units (ranging from 10 to 1000), the number of abnormal orders is 5 (ranging from 1 to 30), and each abnormal order purchases 1 unit (ranging from 1 to 10), then the inventory occupied by the abnormal orders is 5 multiplied by 1, which equals 5. The updated available inventory is 90 plus 5, which equals 95, ensuring that the inventory quantity matches the actual processing situation.

[0065] Step 703: Based on the real-time updated inventory data, generate an order completion notification containing order processing status and inventory change information; send the order completion notification to the relevant channel systems via a message queue to ensure timely delivery of order completion information. Specifically, the notification content includes the order number, order processing status (coupon code allocated or abnormal), and inventory change information (increase or decrease in available inventory and the specific reason for the change). The inventory change value ranges from -100 to 100, with negative numbers representing inventory decreases and positive numbers representing inventory increases. The message queue is categorized by channel identifier, with channel identifier values ​​ranging from 01 to 99, where 01 to 30... The order channels are categorized as follows: e-commerce platform (01 corresponds to e-commerce platform), mini-program (31-60) (02 corresponds to mini-program), and official app (61-99) (03 corresponds to official app). When the order channel identifier is 01, the notification will be sent to the e-commerce platform system; when the channel identifier is 02, it will be sent to the mini-program system; and when the channel identifier is 03, it will be sent to the official app system, ensuring that each channel system only receives order notifications related to itself. After receiving the notification, the channel system will synchronously update its stored order data (such as order status and electronic coupon information) and inventory information (such as the available inventory quantity displayed on the channel side), and will push the order processing results to the user via SMS or app to achieve timely delivery of order completion information.

[0066] In this embodiment, order completion notifications are sent according to the value range of the channel identifier, clarifying the channel type corresponding to different identifiers, ensuring that the notifications are accurately delivered to the target channel system, and that the channel can synchronize data and provide feedback to the user in a timely manner, which not only improves the user experience, but also standardizes the inventory update and information transmission process.

[0067] Embodiments of the present invention also provide a computing device, including: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0068] Embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0069] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for real-time processing of order data in a cake e-coupon sales system, characterized in that, The method includes: Step 1: Receive electronic coupon purchase requests initiated by users through multi-channel interfaces; Step 2: Based on the electronic coupon purchase request, verify the availability of product inventory and the user's purchase authority, generate initial order data, and store it in the order data repository; Step 3: Process payment transactions based on initial order data, complete payment authorization through the payment gateway interface, update the order status to paid, and generate a payment completion event; Step 4: Based on the payment completion event, generate two data processing paths. The first path generates a unique electronic coupon code and associates the electronic coupon code with the order data. The second path updates the order status to "coupon code has been assigned". Step 5: Establish an order processing status area based on two data processing paths. Set a first status monitoring point within the area to correspond to the successful coupon code allocation status, and set a second status monitoring point outside the area to correspond to the abnormal coupon code allocation status. Step 6: Based on the first and second state monitoring points, the ear-cutting method is used to sequentially connect the state monitoring points. A state loop for the order processing state is constructed by successively removing the outer ear vertices from the state monitoring point sequence, including: Based on the spatial distribution data of the first and second state monitoring points, an ordered sequence of state monitoring points is constructed; based on the ordered sequence of state monitoring points, the set of vertices in the sequence that satisfy the external ear condition is identified. By successively removing each vertex from the outer ear vertex set, a simplified sequence of state monitoring points is obtained, and edge connections between the state monitoring points are established. Based on these edge connections, a state loop for the order processing state is constructed, including: Analyze the spatial relationships of the vertices in the outer ear vertex set to obtain the removal order of the outer ear vertices; remove the outer ear vertices in the removal order to obtain the updated state monitoring point sequence; Based on the updated sequence of state monitoring points, establish edge connections between adjacent state monitoring points and perform integrity verification to obtain a complete edge connection network; based on the complete edge connection network, construct a state closed loop for order processing status. Step 7: Based on the state loop closure, the geometric characteristics of the state loop are verified using a point set convexity judgment algorithm. Based on the convexity verification results, a dynamic inventory compensation amount is generated. The inventory quantity in the product inventory storage repository is updated in real time based on the dynamic inventory compensation amount, and order completion information is sent to relevant channel systems via message queues, including: By using the boundary point set data of the state closed loop, the coordinates of all boundary points of the state closed loop are extracted; based on the spatial distribution relationship of the boundary point coordinates, the connection relationship between the boundary points is analyzed using the point set convexity judgment algorithm to obtain the convexity detection result of the state closed loop; based on the convexity detection result, the geometric characteristics of the state closed loop are judged to obtain the convexity verification conclusion of the state closed loop. Based on the convexity verification results and combined with the order processing efficiency index, a dynamic inventory compensation amount is generated, and the available inventory quantity in the commodity inventory storage warehouse is adjusted to obtain real-time updated inventory data. Based on real-time updated inventory data, an order completion notification is generated, which includes order processing status and inventory change information. The order completion notification is then sent to relevant channel systems via a message queue to ensure timely delivery of order completion information.

2. The real-time order data processing method for a cake e-coupon sales system according to claim 1, characterized in that, Based on the electronic coupon purchase request, verify product inventory availability and user purchase permissions, generate initial order data and store it in the order data repository, including: Parse the product identifier in the e-coupon purchase request, obtain the available inventory quantity of the corresponding product from the product inventory repository; compare the available inventory quantity with the purchase quantity to obtain the inventory verification result; When the inventory verification result is available, the corresponding purchase permission rules are obtained from the channel permission configuration library through the channel identifier and user identifier in the electronic coupon purchase request; The verification conditions in the purchase permission rules are matched and verified with the user identifier and channel identifier in the e-coupon purchase request to obtain the user purchase permission verification result. When the user purchase permission verification result is that the user is qualified to purchase, the order number, product identifier, user identifier, channel identifier, order timestamp and initial order status are combined to generate initial order data and write it to the order data storage repository.

3. The real-time order data processing method for a cake e-coupon sales system according to claim 2, characterized in that, The payment transaction is processed based on the initial order data. Payment authorization is completed through the payment gateway interface, the order status is updated to paid, and a payment completion event is generated, including: Parse the payment information in the initial order data to obtain the payment amount and payment method; construct a standard format payment request based on the payment amount and payment method to obtain transaction data that the payment gateway can recognize; The system sends a processing request to the payment gateway interface based on the transaction data, and receives a payment response containing an authorization code. Based on the authorization status in the payment response, the system determines whether the payment was successful. Based on the successful payment determination, the status field in the order data repository is updated to obtain the order record with the status of "paid" and a payment completion event is generated.

4. The real-time order data processing method for a cake e-coupon sales system according to claim 3, characterized in that, Based on the payment completion event, two data processing paths are generated. The first path generates a unique electronic coupon code and associates it with the order data. The second path updates the order status to "coupon code assigned," including: Based on the order number in the payment completion event, obtain the corresponding order details from the order data repository; generate unique electronic coupon code data based on the product identifier and channel identifier in the order details; By establishing a mapping relationship between electronic coupon code data and order number, coupon code binding records are obtained, and the coupon code status in the coupon code database is updated to obtain the allocated coupon code information. The order status update process is triggered based on the allocated coupon code information, and the status field in the order data repository is modified to obtain an order record with the status of "coupon code allocated".

5. The real-time order data processing method for a cake e-coupon sales system according to claim 4, characterized in that, An order processing status area is established based on two data processing paths. Within this area, a first status monitoring point is set corresponding to a successful coupon code allocation status. Outside the area, a second status monitoring point is set corresponding to an abnormal coupon code allocation status, including: By integrating the electronic coupon code allocation results from the first data processing path and the order status update results from the second data processing path, a complete order processing status dataset is obtained. Based on the complete status dataset of order processing, an order processing status region is constructed to obtain a monitoring range definition that includes success status and abnormal status; Based on the defined monitoring range, a first monitoring point is set within the order processing status area to obtain monitoring configuration parameters for the successful coupon code allocation status; based on the defined monitoring range, a second monitoring point is set outside the order processing status area to obtain monitoring configuration parameters for the abnormal coupon code allocation status.

6. A computing device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the method as described in any one of claims 1 to 5.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program that, when executed by a processor, implements the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Network information processing system and information processing method

    CN101295395A

  • Electronic coupon issuing method and device

    CN111026758A