Data processing method and device, nonvolatile storage medium and electronic equipment
By processing order status requests in a pre-determined state process module queue in high concurrency scenarios, the order status is ensured to be lost without loss of requests and untimely updates caused by large data volume when the database processes order status, and achieve high Timeliness and accuracy of status updates under concurrent conditions.
Patent Information
- Application Number
- CN202411123608.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-12-13
AI Technical Summary
In high concurrency scenarios, the existing technology has not effectively solved the problem that the database processes order status due to large data volumes, resulting in loss of requests and untimely updates.
By receiving multiple pending requests and processing them in sequence according to a predetermined state processing module queue, we ensure that each request is processed by multiple state processing modules in sequence, and finally update the database to ensure that the order status is lost-free.
The order status is not discarded under high concurrency conditions, ensuring the timeliness and accuracy of status updates, and solving the problems of loss of requests and untimely updates caused by large data volume.
Smart Images

Figure CN119127889A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data processing method, device, non-volatile storage medium and electronic device. Background Art
[0002] When issuing coupon code-type equity orders on the equity platform, a large number of equity orders need to be issued to different request systems at the same time. At this time, it is necessary to ensure the correct flow of the status of each equity order in a high-concurrency scenario, and to ensure high performance and fast response time. In a high-concurrency scenario, the request pressure on the server is relatively large. The related technology uses database locks or distributed locks to directly transfer status, that is, only one thread can hold the lock resource, and other threads need to wait for the lock to be released before they can continue to execute. In this case, when a large number of requests access the database or distributed lock at the same time, it will cause lock competition, that is, multiple concurrent requests compete for the same lock resource at the same time, which will cause performance degradation and prolonged system response time, and some requests will be blocked or discarded, resulting in untimely status updates and users unable to obtain the latest status in time.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present invention provide a data processing method, device, non-volatile storage medium and electronic device to at least solve the technical problems in the prior art of request loss and untimely status update due to large data volume during the database processing order status.
[0005] According to one aspect of an embodiment of the present invention, there is provided a data processing method, comprising: receiving a plurality of pending requests respectively representing requests to update corresponding order statuses in a database, wherein the statuses of orders corresponding to the plurality of pending requests have changed; according to a predetermined status processing module queue, sequentially using a plurality of status processing modules in the status processing module queue to process the plurality of pending requests respectively to obtain processed order statuses, wherein the plurality of status processing modules respectively process requests corresponding to orders with different status changes; and updating the database according to the processed order statuses.
[0006] Optionally, according to a predetermined status processing module queue, multiple status processing modules in the status processing module queue are used in turn to process multiple pending requests respectively to obtain the processed order status, including: determining the order of multiple status processing modules in the status processing module queue; according to the order of multiple status processing modules, inputting multiple pending requests into the first status processing module, and the first status processing module processes the first request corresponding to the order with the first status change to obtain the order status after the order corresponding to the first request is processed; according to the order of multiple status processing modules, inputting unprocessed requests among the multiple pending requests into the next status processing module, until multiple status processing modules process the multiple pending requests to obtain the processed order status.
[0007] Optionally, updating the database according to the processed order status includes: updating the database according to the processed order status obtained by the multiple status processing modules in sequence according to the order of the multiple status processing modules.
[0008] Optionally, in the order of multiple status processing modules, the database is updated in sequence according to the processed order status obtained by the multiple status processing modules, including: in the order of multiple status processing modules, the database is updated according to the order status after processing of the order corresponding to the first request output by the first status processing module, and in the order of multiple status processing modules, the database is updated according to the processed order status output by the next status processing module, until the database is updated according to the processed order status output by the last status processing module, and it is determined that the database update is completed.
[0009] Optionally, the status processing module queue is generated in the following manner: obtain a predetermined order status change process, the order status change process includes multiple ordered order states; determine adjacent order states among the multiple order states according to the order status change process; generate status processing modules corresponding to the adjacent order states to obtain multiple status processing modules; sort the multiple status processing modules according to the order status change process to obtain a status processing module queue.
[0010] Optionally, a state processing module corresponding to adjacent order states is generated, including: determining an earlier order state and a later order state among adjacent order states; obtaining processing steps for processing an order in the earlier order state into an order in the later order state; and integrating the processing steps to obtain a state processing module corresponding to the adjacent order state.
[0011] According to another aspect of an embodiment of the present invention, a data processing device is also provided, including: a first receiving module, used to receive multiple pending requests that respectively represent requests to update corresponding order statuses in a database; a processing module, used to process the multiple pending requests to obtain processed order statuses; a first determination module, used to process the multiple pending requests to obtain processed order statuses.
[0012] According to another aspect of an embodiment of the present invention, a non-volatile storage medium is provided. The non-volatile storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing any one of the above-mentioned data processing methods.
[0013] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including: a processor and a memory, the memory being used to store a program, wherein when the program is executed by the processor, the processor implements any one of the above-mentioned data processing methods.
[0014] According to another aspect of the embodiments of the present invention, a computer program product is provided, including computer instructions and a processor executing any one of the above data processing methods.
[0015] In an embodiment of the present invention, multiple pending requests are received, each representing a request to update the corresponding order status in the database; according to a predetermined status processing module queue, multiple status processing modules in the status processing module queue are used in turn to process the multiple pending requests respectively to obtain the processed order status; according to the processed order status, the database is updated, and all order status information can be sent to the corresponding status processing module in the status processing module queue for processing, thereby achieving the purpose of lossless transfer of order status and realizing the technical effect that the order status is not discarded under high concurrency, thereby solving the technical problem of request loss and untimely status update due to large data volume in the process of database processing order status in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0017] Figure 1 is a flow chart of a data processing method provided according to an embodiment of the present invention;
[0018] Figure 2 is a schematic diagram of a state processing flow provided according to an optional embodiment of the present invention;
[0019] Figure 3is a structural block diagram of a data processing device provided according to an embodiment of the present invention;
[0020] Figure 4 is a schematic diagram of an electronic device provided according to an embodiment of the present invention. DETAILED DESCRIPTION
[0021] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0023] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:
[0024] The Kafka platform is a high-performance, scalable and reliable platform that is mainly used to build real-time data stream processing applications. It can process large amounts of data streams and provides reliable messaging and persistent storage. The Kafka platform also provides a series of tools to simplify the development and management of data stream processing.
[0025] The Kafka cluster is a distributed messaging system composed of multiple Kafka platforms, which together form a highly available, high-performance message queue cluster. The Kafka cluster can process large-scale message data streams.
[0026] According to an embodiment of the present invention, a method embodiment of data processing is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0027] Figure 1 is a flow chart of a data method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0028] Step S102, receiving a plurality of pending requests respectively representing requests to update corresponding order statuses in a database.
[0029] In this step, the coupon code type rights and interests order refers to the order containing specific discounts or discounts issued by the rights and interests platform to the user. The user can use these discount codes to enjoy the corresponding discounts or discounts when placing an order. When the rights and interests platform issues a large number of coupon code type rights and interests orders, the user may use these discounts or discounts. At this time, the status of these coupon code type orders will change. In order to enable the user to correctly know the status of the discount or discount, it is necessary to update the coupon code type order status in the database. Therefore, there will be multiple disordered order status information in the database. These order statuses include but are not limited to the waiting state, the used state, the expired state, the canceled state, the refunding state, and the refunded state. Among them, the waiting state means that the user has successfully paid but has not used the coupon code, and the order is in the waiting state. The used state means that the user has successfully used the coupon code, and the order status has changed to used. The expired state means that the validity period of the coupon code has expired, and the order status has changed to expired. The canceled state means: the user cancels the order or the system automatically cancels the order, and the order status changes to canceled. The refunding state means that the user applies for a refund, and the order status changes to refunding. The refunded status means that the refund application has been processed and the order status has changed to refunded. When the order status information changes, the order status information in the database needs to be updated. At this time, the upstream business system that interacts with the user will send a request to change the order status in the database to the data processing system based on the user's operation, that is, multiple pending requests, and there will be multiple order statuses waiting to be updated in the database. The data processing system will receive multiple pending requests and process them.
[0030] Step S104, according to the predetermined status processing module queue, multiple status processing modules in the status processing module queue are used in sequence to process multiple requests to be processed respectively to obtain the processed order status, wherein the multiple status processing modules process the requests corresponding to the orders with different status changes respectively;
[0031] In this step, the state processing module queue is composed of multiple state processing modules in a certain order, and the multiple state processing modules process multiple pending requests, wherein the state processing modules include but are not limited to a state processing module for updating from a to-be-used state to a used state, a state processing module for updating from a used state to a canceled state, a state processing module for updating from a used state to a refunding state, a state processing module for updating from a refunding state to a refunded state, and a processing module for updating from a refunded state to a to-be-used state. Multiple pending requests include but are not limited to a request to update from a to-be-used state to a used state, a request to update from a used state to a canceled state, a request to update from a used state to a refunding state, a request to update from a refunding state to a refunded state, and an update from a refunded state to a to-be-used state. The pending requests will pass through these state processing modules in sequence, and the multiple state processing modules will update and process the requests corresponding to the orders with the corresponding state changes, and finally obtain the processed order status.
[0032] In an optional embodiment, according to a predetermined state processing module queue, multiple state processing modules in the state processing module queue are used in turn to process multiple pending requests respectively to obtain the processed order status, including: determining the order of multiple state processing modules in the state processing module queue; according to the order of the multiple state processing modules, inputting the multiple pending requests into the first state processing module, and the first state processing module processes the first request corresponding to the order having the first change in status to obtain the order status after the order corresponding to the first request is processed; according to the order of the multiple state processing modules, inputting the unprocessed requests among the multiple pending requests into the next state processing module, until the multiple state processing modules process the multiple pending requests to obtain the processed order status.
[0033] Optionally, when processing multiple pending requests based on the status processing module queue, first, the order of multiple status processing modules in the status processing module queue can be determined. For example, the first status processing module is determined to be: a status processing module that updates from a to-be-used status to a used status, the second status processing module is a status processing module that updates from a used status to a refunding status, the third status processing module is a status processing module that updates from a refunding status to a refunded status, and the fourth status processing module is a processing module that updates from a refunded status to a to-be-used status. During the processing, the first status processing module can update the order status of the first request corresponding to the order with the first change in status, and obtain the order status of the order corresponding to the first request after processing. For example, if the first status processing module is a status processing module that updates from a to-be-used status to a used status, the first status processing module will identify the first request corresponding to the order with the first change in status from to-be-used to used among multiple requests to be processed, and based on the first request, record the order with the first change in status as a used status. Other order statuses that have not been processed by the first status processing module will enter the second status processing module, and the second status processing module will process the second request corresponding to the order with the second change in status (from used to refunded), and obtain the order status of the order corresponding to the second request after processing. At this time, other order statuses that have not been processed by the first status processing module and the second status processing module will enter the next status processing module until each to-be-processed request is processed by the corresponding status processing module in the status processing module queue, and all processed order statuses are obtained.
[0034] In an optional embodiment, a state processing module queue is generated in the following manner: obtaining a predetermined order state change process, the order state change process including a plurality of ordered order states; determining adjacent order states among the plurality of order states according to the order state change process; generating state processing modules corresponding to the adjacent order states to obtain a plurality of state processing modules; and sorting the plurality of state processing modules according to the order state change process to obtain a state processing module queue.
[0035] Optionally, when generating the status processing queue, the business process can be analyzed, that is, the change process of the order status can be analyzed. This process should include all possible states of the order and the relationship between these states. The state processing module queue generated according to the business process can effectively manage the change process of the order status, ensure that the change of the order status is orderly and controllable, and also facilitate the subsequent monitoring and optimization of the order status change process.
[0036] After determining the order status change process, the adjacent order statuses can be determined according to the change process. For example, the order status may include "to be used", "used", "expired", "canceled", "refunding", "refund", etc., then "to be used" and "used", "to be used" and "expired", "refunding" and "refund" are adjacent order statuses. For each pair of adjacent order statuses, a corresponding status processing module can be generated. Among them, the status processing module can be a section of code for processing the operations that need to be performed when the order status changes from one state to another. Finally, according to the order status change process, the generated multiple status processing modules can be sorted in the order of the order status to form a status processing module queue. In this way, when the order status changes, the corresponding status processing modules can be executed one by one according to the order in the queue to ensure that the order status change process is carried out according to the predetermined process.
[0037] In an optional embodiment, a state processing module corresponding to adjacent order states is generated, including: determining an earlier order state and a later order state among adjacent order states; obtaining processing steps for processing an order in the earlier order state into an order in the later order state; and integrating the processing steps to obtain a state processing module corresponding to the adjacent order states.
[0038] Optionally, the order status includes but is not limited to the state to be used, the state to be used, the state to be expired, the state to be cancelled, the state to be refunded, and the state to be refunded. The previous order status of the order status is determined, for example, the previous order status is not in the state to be used, and the order status is determined, for example, the subsequent order status is not in the state to be used, and the processing steps of processing the order in the state to be used as the state to be used are obtained, and all the order status processing steps are integrated to form a module that can process adjacent order statuses. After determining the previous order status and the subsequent order status in the adjacent order status, it is also necessary to obtain the process of how to process the order in the previous order status as the order in the subsequent order status, which may involve different processing steps, such as processing, reviewing, confirming, etc. of the order. These processing steps need to be determined according to the specific business logic and the conversion rules of the order status. Finally, these processing steps are integrated together to form a complete state processing module for processing orders corresponding to adjacent order statuses. In this way, the conversion of order status can be effectively managed and the processing flow of the order can be ensured to proceed smoothly.
[0039] Step S106, updating the database according to the processed order status.
[0040] In this step, the order status information processed by the status processing module queue is stored in the database in sequence to update the information in the database.
[0041] In an optional embodiment, updating the database according to the processed order status includes: updating the database according to the processed order status obtained by the multiple status processing modules in sequence according to the order of the multiple status processing modules.
[0042] Optionally, when updating the database according to the processed order status, in order to ensure that the order status in the database is the latest status, it is necessary to update the database in the order of multiple status processing modules, using the processed order status obtained by multiple status processing modules in sequence. For example, in some cases, if the order status changes frequently, there are repeated update requests for the status of the same order in multiple pending requests, that is, there are requests to change the order from pending to used, then from used to refunded, and then from refunded to refunded, and the above three requests are still waiting for processing. At this time, the request to change the order from pending to used will pass through a certain status processing module, and the processed order status will be used; then the remaining requests will pass through the other two status processing modules in sequence, and the processed order status will be refunded and refunded respectively. If the database is updated without updating in the order of processing, it is possible that the status of the order in the database is modified to refunded and then modified to used, resulting in inaccurate order status in the database.
[0043] Therefore, when updating the database, the processed order status obtained by multiple status processing modules can be stored in the database in the order in which multiple pending requests are processed by each status processing module, so as to update the database.
[0044] In an optional embodiment, the database is updated in sequence according to the processed order status obtained by the multiple status processing modules in sequence, including: according to the sequence of the multiple status processing modules, the database is updated according to the order status after processing of the order corresponding to the first request output by the first status processing module; according to the sequence of the multiple status processing modules, the database is updated according to the processed order status output by the next status processing module, until the database is updated according to the processed order status output by the last status processing module, and it is determined that the database update is completed.
[0045] Optionally, the data processing system updates and records the order status in the database in sequence according to the order of multiple status processing modules. First, the order of the multiple status processing modules can be determined to determine the first status processing module; secondly, the order information in the database can be updated according to the processed order status output by the first status processing module, specifically by executing database operations (such as insert, update or delete); next, according to the order processing modules, the processed order status output by the next status processing module is updated in the database until all status processing modules are processed.
[0046] Through this embodiment, the data processing system can ensure that the order status is correctly recorded and updated at each processing stage, thereby achieving traceability and reliability of order management. At the same time, by updating the database at each stage, the system can avoid data inconsistency problems during the processing process.
[0047] Through the above-mentioned receiving, multiple pending requests respectively represent requests to update the corresponding order status in the database, wherein the status of the orders corresponding to the multiple pending requests changes; according to the predetermined status processing module queue, multiple status processing modules in the status processing module queue are used in turn to process the multiple pending requests respectively to obtain the processed order status, wherein the multiple status processing modules respectively process the requests corresponding to the orders with different status changes; according to the processed order status, the database is updated to ensure that all order status information can be processed by the corresponding status processing modules in the status processing module queue, thereby achieving the purpose of lossless transfer of order status and realizing the technical effect that the order status is not discarded under high concurrency, thereby solving the technical problems of request loss and untimely status update due to large data volume in the process of database processing order status in the prior art.
[0048] Based on the above embodiments and optional embodiments, the present invention proposes an optional implementation mode, such as Figure 2 As shown,
[0049] Step S1, obtaining a predetermined order status change process, the order status change process includes multiple ordered order states; according to the order status change process, determining adjacent order states among the multiple order states; generating state sets corresponding to the adjacent order states to obtain multiple state sets, and sorting the multiple state sets according to the order status change process to obtain a state set queue.
[0050] Optionally, the order status includes but is not limited to the waiting state, used state, expired state, canceled state, refunding state, and refunded state. The order status process includes but is not limited to updating from the waiting state to the used state, requesting to update from the used state to the canceled state, requesting to update from the used state to the refunding state, requesting to update from the refunding state to the refunded state, and updating from the refunded state to the waiting state. According to the order change process, a state set (i.e., state processing module) corresponding to the adjacent order states is generated, and the state sets are sorted according to the order status change process to obtain a state set queue (i.e., state processing module queue). Figure 2 State set A, state set B, and state set C form a state set sequence according to the change process of the order status. The state set includes but is not limited to state set A, state set B, and state set C.
[0051] The generation of a state set corresponding to adjacent order states includes: determining the previous order state and the subsequent order state in the adjacent order states; obtaining the processing steps for processing the order in the previous order state into the order in the subsequent order state; integrating the processing steps to obtain the state set corresponding to the adjacent order states. Determine the previous order state of the order state, for example, the previous order state is the waiting state, determine the order state, the subsequent order state is the used state, obtain the processing steps for processing the order in the waiting state into the used state, and integrate all the order state processing steps to form a state set that can process adjacent order states.
[0052] Step S2, receiving a plurality of pending requests respectively representing requests to update the corresponding order status in the database, wherein the status of the orders corresponding to the plurality of pending requests changes.
[0053] Optionally, there are multiple order status information in the order status database. When the order status information changes, the order status information needs to be updated in real time. At this time, the state set queue composed of state set A, state set B, and state set C will receive multiple pending requests through the kafka cluster. The multiple pending requests represent the request to update the corresponding order status in the database. The kafka cluster will send the unordered multiple pending requests in the database to the state set queue. The kafka platform is a high-performance, scalable and reliable platform, mainly used to build real-time data stream processing applications. It can process large amounts of data streams and provides reliable messaging and persistent storage. The kafka platform also provides a series of tools to simplify the development and management of data stream processing. The kafka cluster is a distributed messaging system composed of multiple Kafka platforms. Together, they form a highly available, high-performance message queue cluster. The kafka cluster can handle large-scale message data streams.
[0054] Step S3, according to a predetermined state set queue, using multiple state sets in the state set queue in sequence to process multiple pending requests respectively to obtain the processed order status, wherein the multiple state sets process requests corresponding to orders with different state changes respectively;
[0055] Optionally, the pending requests are in an unordered state, and multiple pending requests in an unordered state are input into a state set queue through a kafka cluster. The state set queue includes but is not limited to state set A, state set B, and state set C. State set A, state set B, and state set C respectively process the corresponding pending requests. For example, state set A is a state set updated from a to-be-used state to a used state, state set B is a state set updated from a used state to a refunding state, and state set C is a state set updated from a refunding state to a refunded state. State set A processes pending requests updated from a to-be-used state to a used state, state set B processes pending requests updated from a used state to a refunding state, and state set C processes pending requests updated from a refunding state to a refunded state.
[0056] Step S4, according to the order of multiple status sets, input the multiple pending requests into the first status set, and the first status set processes the first request corresponding to the order with the first status change to obtain the order status after the first request is processed; according to the order of multiple sets, input the unprocessed requests among the multiple pending requests into the next status set until the multiple status sets process the multiple pending requests to obtain the processed order status.
[0057] Optionally, the pending requests are in an unordered state, and multiple pending requests in an unordered state are input into a state set queue. The first state set, i.e., state set A, processes requests corresponding to orders that have undergone a first change. For example, state set A is a state set updated from a to-be-used state to a used state, and requests corresponding to orders that have undergone a first change are updated from a to-be-used state to a used state. The remaining requests that have not been processed by state set A are input into state set B, and state set B processes requests corresponding to orders that have undergone a second change. For example, state set B is a state set updated from a used state to a refunding state, and orders that have undergone a second change The corresponding request is updated from the used state to the refunding state. State set B processes the request corresponding to the order that has the second change, and inputs the remaining requests that have not been processed by state set A and state set B into state set C. State set C processes the request corresponding to the order that has the third change. For example, state set C is the state set that updates from the refunding state to the refunded state. The request corresponding to the order that has the third change is updated from the refunding state to the refunded state. State set C processes the request corresponding to the order that has the third change until all pending requests are processed by the corresponding state set to obtain the processed order status.
[0058] Step S5, in the order of the multiple status sets, the database is updated according to the processed order status obtained from the multiple status sets.
[0059] State set A processes the first request corresponding to the order whose state has undergone the first change, and obtains the order state after the order corresponding to the first request has been processed. For example, the first request corresponding to the order whose state has undergone the first change is to update the order from the pending state to the used state. At this time, the order state information processed by state set A is stored in the database, and the database DB is updated. The unprocessed order state enters state set B, and state set B updates the second request corresponding to the order whose state has undergone the second change, and obtains the order state after the order corresponding to the second request has been processed. For example, the second request corresponding to the order whose state has undergone the second change The request is to update the order from the used status to the refunding status. The order status information processed by the status set B is stored in the database DB, and the database DB is updated. Similarly, the order status information processed by the status set C is stored in the database DB, and the database DB is updated. Requests that have not been processed by the status set A, status set B, and status set C enter the next status set until each pending request is processed by the corresponding status set in the status set queue. All order status information processed by each status set is stored in the database DB in the order of being processed by each status set, so as to realize real-time update of the database DB.
[0060] The above optional implementation achieves at least the following effects: the order status is transferred losslessly and is not discarded under high concurrency conditions, thus solving the technical problem in the prior art of request loss and untimely status update due to large data volume during the process of database processing order status.
[0061] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0062] In this embodiment, a data processing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the terms "module" and "device" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0063] According to an embodiment of the present invention, there is also provided an apparatus embodiment for implementing the data processing method. Figure 3 A structural block diagram of a data processing device according to an embodiment of the present invention is shown in FIG. Figure 3 As shown, the above data processing device includes a first receiving module 31, a processing module 32, and a first determining module 33. The device is described below.
[0064] The first receiving module 31 is used to receive a plurality of pending requests respectively representing requests to update the corresponding order status in the database, wherein the status of the orders corresponding to the plurality of pending requests changes.
[0065] The processing module 32 is connected to the first receiving module 31, and is used to process multiple requests to be processed respectively using multiple state processing modules in the state processing module queue in accordance with a predetermined state processing module queue to obtain a processed order status, wherein the multiple state processing modules respectively process requests corresponding to orders with different state changes.
[0066] The first determining module 33 is connected to the processing module 32 and is used to update the database according to the processed order status.
[0067] In a data processing device provided by an embodiment of the present invention, a plurality of pending requests are received, each representing a request to update a corresponding order status in a database, wherein the status of the orders corresponding to the plurality of pending requests changes; according to a predetermined status processing module queue, a plurality of status processing modules in the status processing module queue are used in turn to process the plurality of pending requests respectively to obtain a processed order status, wherein the plurality of status processing modules respectively process requests corresponding to orders with different status changes; according to the processed order status, the database is updated to ensure that all order status information can be processed by the corresponding status processing modules in the status processing module queue, thereby achieving the purpose of lossless transfer of order status and realizing the technical effect that the order status is not discarded under high concurrency, thereby solving the technical problem of request loss and untimely status update due to large data volume in the process of processing order status in the database in the prior art.
[0068] It should be noted that the above modules can be implemented by software or hardware. For example, for the latter, it can be implemented in the following ways: the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0069] It should be noted that the first receiving module 31, the processing module 32, and the first determining module 33 correspond to steps S102 to S106 in the embodiment, and the examples and application scenarios implemented by the modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above embodiment. It should be noted that the modules as part of the device can be run in a computer terminal.
[0070] It should be noted that the optional or preferred implementation of this embodiment can refer to the relevant description in the embodiment, which will not be repeated here.
[0071] The above-mentioned data processing device may also include a processor and a memory. The first receiving module 31, the processing module 32, the first determining module 33, etc. are all stored in the memory as program modules, and the processor executes the above-mentioned program modules stored in the memory to realize corresponding functions.
[0072] The processor includes a kernel, which retrieves the corresponding program module from the memory. There can be one or more kernels. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one storage chip.
[0073] An embodiment of the present invention provides a non-volatile storage medium on which a program is stored. When the program is executed by a processor, a data processing method is implemented.
[0074] like Figure 4 As shown, an embodiment of the present invention provides an electronic device, the electronic device 10 includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented: the memory is used to store a computer program, wherein when the computer program is executed by the processor, the processor implements the above-mentioned data processing method. The device in this article may be a server, a PC, etc.
[0075] The invention also provides a computer program product which, when executed on a data processing device, is suitable for executing a program initializing the following method steps: the computer instructions are used by a processor to execute the above-mentioned data processing method.
[0076] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0077] The present invention is described with reference to flowcharts of methods, apparatuses, and computer program products according to embodiments of the present invention. It should be understood that each process in the flowchart and a combination of processes in the flowchart can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart. Figure 1 A device that specifies functions in a process or multiple processes.
[0078] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A function specified in a process or multiple processes.
[0079] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 The steps of a specified function in a process or multiple processes.
[0080] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0081] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0082] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0083] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0084] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0085] The above are only embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.
Claims
1. A data processing method, It is characterized in that include: Receiving a plurality of pending requests respectively representing requests to update corresponding order statuses in a database, wherein the statuses of the orders corresponding to the plurality of pending requests have changed; According to a predetermined state processing module queue, a plurality of state processing modules in the state processing module queue are sequentially used to process the plurality of pending requests respectively to obtain the processed order status, wherein the plurality of state processing modules respectively process the requests corresponding to the orders with different state changes; The database is updated according to the processed order status.
2. The method according to claim 1, It is characterized in that The method of sequentially using a plurality of state processing modules in the state processing module queue according to a predetermined state processing module queue to process the plurality of requests to be processed respectively to obtain the processed order status includes: Determining the order of the plurality of state processing modules in the state processing module queue; According to the order of the multiple status processing modules, the multiple requests to be processed are input into a first status processing module, and the first status processing module processes a first request corresponding to an order having a first status change, to obtain an order status after the order corresponding to the first request is processed; According to the order of the multiple status processing modules, the unprocessed requests among the multiple pending requests are input into the next status processing module until the multiple status processing modules all process the multiple pending requests to obtain the processed order status.
3. The method according to claim 2, It is characterized in that The updating of the database according to the processed order status includes: According to the order of the multiple status processing modules, the database is updated in sequence according to the processed order status obtained by the multiple status processing modules.
4. The method according to claim 3, It is characterized in that The updating of the database according to the order status processed by the multiple status processing modules in sequence includes: According to the order of the multiple status processing modules, the database is updated according to the order status after the order processing corresponding to the first request output by the first status processing module; According to the order of the multiple status processing modules, the database is updated according to the processed order status output by the next status processing module, until the database is updated according to the processed order status output by the last status processing module, and it is determined that the database update is completed.
5. The method according to any one of claims 1 to 4, It is characterized in that The state processing module queue is generated in the following manner: Acquire a predetermined order status change process, wherein the order status change process includes a plurality of ordered order states; Determining adjacent order states among the multiple order states according to the order state change process; Generate state processing modules corresponding to the adjacent order states to obtain the multiple state processing modules; According to the order status change process, the multiple status processing modules are sorted to obtain the status processing module queue.
6. The method according to claim 5, It is characterized in that The generating a status processing module corresponding to the adjacent order status includes: Determine an earlier order status and a later order status among the adjacent order statuses; Obtaining a processing step of processing an order in the prior order status into an order in the subsequent order status; The processing steps are integrated to obtain the state processing module corresponding to the adjacent order state.
7. A data processing device, It is characterized in that include: A first receiving module is used to receive a plurality of pending requests representing a request to update a corresponding order status in a database, wherein the status of the order corresponding to the plurality of pending requests changes; A processing module, according to a predetermined state processing module queue, sequentially uses a plurality of state processing modules in the state processing module queue to process the plurality of pending requests respectively to obtain processed order states, wherein the plurality of state processing modules respectively process requests corresponding to orders with different state changes; The first determining module updates the database according to the processed order status.
8. A non-volatile storage medium, It is characterized in that The non-volatile storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the data processing method described in any one of claims 1 to 6.
9. An electronic device comprising a processor and a memory, It is characterized in that The memory is used to store a computer program, wherein when the computer program is executed by the processor, the processor implements the data processing method according to any one of claims 1 to 6.
10. A computer program product comprising computer instructions, It is characterized in that The computer instructions are executed by a processor to execute the data processing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Order processing method and related device
CN117114814A
Real-time processing of event-based streaming with nosql databases
US20200175018A1
