Data processing method and device

By generating temporary flow data in the order call inventory system and merging data of the same item identification for database updates, the problem of interface throughput reduction caused by database row lock resource competition is solved, and the efficiency of database updates is improved.

CN119961270APending Publication Date: 2025-05-09BEIJING JINGDONG YUANSHENG TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311470443.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-07
Publication Date
2025-05-09

AI Technical Summary

Technical Problem

In the high concurrency scenario of order call inventory systems, the competition for row lock resource of the database leads to a decrease in interface throughput, affecting the order-taking performance of the inventory system.

Method used

By generating temporary flow data and writing it to the temporary flow table, combining the temporary flow data identified by the same item and then updating the database, effectively controlling the occupation and release of database row lock resources.

Benefits of technology

Improves the efficiency of database updates, reduces the mutual waiting of multiple rows of resources and the number of database calls, and avoids the backlog of asynchronous tasks caused by row lock competition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119961270A_ABST
    Figure CN119961270A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method and device, and relates to the technical field of computers. A specific embodiment of the method comprises the steps of receiving an order processing request, wherein the order processing request comprises order details; the order details comprise one or more article identifiers; determining temporary flow data of each article identifier according to the order details, and writing the temporary flow data into a temporary flow table; obtaining each piece of temporary flow data with the same article identifier from the temporary flow table, and generating an inventory change request according to each piece of temporary flow data; and updating the inventory of the same article identifier in a database according to the inventory change request. According to the embodiment, occupation and release of database row lock resources can be effectively controlled, and the database updating efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for data processing. Background Art

[0002] In high-concurrency scenarios where orders call the inventory system, competition for database row lock resources will lead to reduced interface throughput and affect the order-taking performance of the inventory system.

[0003] In the related art, synchronous inventory processing is converted to asynchronous processing, and the flow rate of asynchronous tasks is controlled to avoid reducing the interface throughput. However, the flow rate of asynchronous tasks is difficult to determine, and asynchronous task processing still requires occupying multiple rows of database resources, reducing the efficiency of database update. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a data processing method and device, which can generate temporary transaction data according to the order details in the order processing request and write it into a temporary transaction table. By merging the temporary transaction data with the same item identifier in the temporary transaction table and then updating the database, the occupation and release of database row lock resources can be effectively controlled, thereby improving the efficiency of database updating.

[0005] To achieve the above object, according to one aspect of an embodiment of the present invention, a data processing method is provided, comprising:

[0006] receiving an order processing request, wherein the order processing request includes order details; the order details include one or more item identifiers;

[0007] Determine temporary flow data of each item identifier according to the order details, and write the temporary flow data into a temporary flow table;

[0008] Acquire various temporary flow data with the same item ID from the temporary flow table, and generate an inventory change request according to the various temporary flow data;

[0009] The inventory quantity of the same item ID in the database is updated according to the inventory change request.

[0010] Optionally, the order details include an order type, and before determining the temporary flow data of each item identifier according to the order details, the method further includes:

[0011] The order type is determined to be a type indicating an inventory increase.

[0012] Optionally, the order details include the order type and the quantity of each item identifier; before determining the temporary flow data of each item identifier according to the order details, the method further includes:

[0013] The order type is a type indicating inventory deduction, and it is determined that the inventory quantity of each item identifier in the inventory cache is greater than or equal to the quantity of the item identifier in the order details.

[0014] Optionally, the order details include an order identifier, an order type, and a quantity of each item identifier; determining temporary flow data of each item identifier according to the order details includes:

[0015] Determine the inventory change amount of the item ID according to the order type and the quantity of the item ID;

[0016] Temporary flow data of the item ID is generated according to the order ID, the order type and the inventory change amount of the item ID.

[0017] Optionally, the temporary flow data includes the inventory change amount of the item identification; generating an inventory change request according to each temporary flow data includes:

[0018] Adding up the inventory change amounts of the same item ID in each of the temporary flow data to obtain the total inventory change amount of the same item ID;

[0019] The inventory change request is generated according to the total inventory change amount of the same item identification.

[0020] Optionally, after updating the inventory quantity of the same item ID in the database according to the inventory change request, the method further includes:

[0021] Permanent transaction data corresponding to each temporary transaction data is generated according to the inventory quantity before and after the update of the same item identification in the database and the various temporary transaction data.

[0022] Optionally, before updating the inventory quantity of the same item ID in the database according to the inventory change request, the method further includes:

[0023] Determining that the number of inventory change requests for the same item identifier within a preset time period does not exceed a flow-limiting threshold;

[0024] In response to the number of inventory change requests for the same item identifier within a preset time exceeding the current limiting threshold, the database rejects the inventory change request.

[0025] According to another aspect of an embodiment of the present invention, there is provided a data processing device, including:

[0026] A receiving module receives an order processing request, wherein the order processing request includes order details; the order details include one or more item identifiers;

[0027] A determination module, which determines temporary flow data of each item identifier according to the order details, and writes the temporary flow data into a temporary flow table;

[0028] A generating module, which obtains each temporary flow data with the same item ID from the temporary flow table, and generates an inventory change request according to each temporary flow data;

[0029] An updating module updates the inventory quantity of the same item ID in the database according to the inventory change request.

[0030] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including:

[0031] one or more processors;

[0032] a storage device for storing one or more programs,

[0033] When the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method provided by the present invention.

[0034] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the data processing method provided by the present invention is implemented.

[0035] One embodiment of the above invention has the following advantages or beneficial effects: the data processing method of the embodiment of the present invention, after receiving an order processing request, determines the temporary flow data of each item ID according to the order details in the order processing request, writes the temporary flow data into a temporary flow table, obtains and merges the temporary flow data of the same item ID from the temporary flow table, generates an inventory change request, and updates the inventory of the same item ID in the database according to the inventory change request. The method records the call to update the inventory in the order dimension as the temporary flow data of the item ID dimension, controls the occupation and release of the database row lock resources by analyzing and merging the temporary flow data with the same item ID, overcomes the asynchronous task backlog caused by the database row lock resource competition in the prior art, reduces the mutual waiting of multiple rows of resources, reduces the number and frequency of calls to the database, and improves the efficiency of database updates; the inventory deduction operation is verified through the inventory cache to prevent the overselling problem caused by negative inventory.

[0036] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0038] Figure 1 is a schematic diagram of the main flow of a data processing method according to an embodiment of the present invention;

[0039] Figure 2 is a schematic diagram of the main flow of another data processing method according to an embodiment of the present invention;

[0040] Figure 3 is a schematic diagram of the main flow of another data processing method according to an embodiment of the present invention;

[0041] Figure 4 is a flow chart of a data processing method according to an embodiment of the present invention;

[0042] Figure 5 is a schematic diagram of main modules of a data processing device according to an embodiment of the present invention;

[0043] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0044] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0045] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0046] Figure 1 is a schematic diagram of the main flow of a data processing method according to an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:

[0047] Step S101: receiving an order processing request, the order processing request including order details; the order details including one or more item identifiers;

[0048] Step S102: determine the temporary flow data of each item ID according to the order details, and write the temporary flow data into the temporary flow table;

[0049] Step S103: acquiring each temporary flow data with the same item ID from the temporary flow table, and generating an inventory change request according to each temporary flow data;

[0050] Step S104: updating the inventory quantity of the same item ID in the database according to the inventory change request.

[0051] In an embodiment of the present invention, an order processing request includes order details, and the order details may include one or more item identifiers, that is, the order details indicate the items to be updated in the inventory, and the order details may also include an order type and a quantity corresponding to each item identifier, and the order type indicates the business type of the order, and the order type may be a type indicating an increase in inventory, such as the order type may be a warehousing for a purchase order, or an order type may be a type indicating a deduction in inventory, such as the order type may be a pre-occupancy for a sales order. After receiving the order processing request, the temporary flow data of each item identifier may be directly determined according to the order details and written into the temporary flow table.

[0052] In an embodiment of the present invention, before determining the temporary flow data of each item identifier according to the order details, it also includes: determining that the order type is a type indicating an increase in inventory. That is, after receiving an order processing request, it is necessary to perform an inventory check according to the order processing request to determine the result of the inventory pre-occupancy corresponding to the order processing request. If the order type is a type indicating an increase in inventory, negative inventory will not occur, and there is no need to perform inventory pre-occupancy or the result of inventory pre-occupancy indicates that the inventory pre-occupancy is successful, and the temporary flow data of each item identifier can be directly determined according to the order details.

[0053] In an embodiment of the present invention, the order details include the order type and the quantity of each item identifier; before determining the temporary flow data of each item identifier according to the order details, it also includes: if the order type is a type indicating inventory deduction, it is determined that the inventory quantity of each item identifier in the inventory cache is greater than or equal to the quantity of the item identifier in the order details. That is, if the order type is a type indicating inventory deduction, it is necessary to determine the result of inventory pre-occupancy of the order processing request, obtain the inventory quantity of each item identifier in the order details from the inventory cache, and determine whether the inventory quantity of each item identifier in the inventory cache is greater than or equal to the quantity of each item identifier in the order details. If so, it is determined that the inventory pre-occupancy result corresponding to the order processing request is a result indicating successful pre-occupancy, otherwise, it is determined that the inventory pre-occupancy result corresponding to the order processing request is a result indicating failed pre-occupancy, that is, if there is at least one item identifier in the inventory cache whose inventory quantity is less than the quantity of the item identifier in the order details, the inventory pre-occupancy fails, and the result of insufficient inventory is returned. High-performance processing of inventory pre-occupancy is achieved through the inventory cache to prevent the problem of overselling of inventory.

[0054] In an embodiment of the present invention, inventory cache can be implemented by Redis+Lua script. Redis cache can provide high-performance reading and writing, and Lua script can realize the atomicity of inventory deduction, that is, when the inventory quantity of at least one item identifier in the inventory cache is less than the quantity of the item identifier in the order details, the inventory pre-occupancy fails, that is, if all item identifiers are pre-occupied successfully, the order pre-occupancy is successful, otherwise, the order pre-occupancy fails and returns a result of insufficient inventory.

[0055] That is to say, after receiving the order processing request, it is determined whether the order type is a type indicating inventory deduction. If it is a type indicating inventory deduction, it is determined whether the various item identifiers in the order details exist in the inventory cache. If at least one item identifier in the inventory cache does not exist, the inventory quantity of the item identifier is queried from the database and synchronized to the inventory cache; if the various item identifiers exist in the inventory cache, it is determined whether the inventory quantity of each item identifier in the inventory cache is greater than or equal to the quantity of the item identifier in the order details. If it is greater than or equal to, the inventory pre-occupancy is successful, and the inventory quantity of each item identifier in the inventory cache is deducted according to the quantity of each item identifier in the order details. If it is less than, negative inventory will appear in the deduction, which means that the inventory pre-occupancy has failed. At this time, the inventory cache needs to be rolled back and the result of insufficient inventory is returned; if the order type is not a type indicating inventory deduction, such as a type indicating inventory increase, the database can be updated and then the inventory cache can be written back to increase the inventory.

[0056] In the embodiment of the present invention, the order details include the order ID, the order type and the quantity of each item ID; Figure 2 As shown, the temporary flow data of each item ID is determined according to the order details, including:

[0057] Step S201: determining the inventory change amount of the item ID according to the order type and the quantity of the item ID;

[0058] Step S202: Generate temporary flow data of the item ID according to the order ID, order type and inventory change amount of the item ID.

[0059] In an embodiment of the present invention, after receiving an order processing request and accepting an order, temporary flow data corresponding to each item identifier can be determined according to the order details, and the temporary flow data can be written into a temporary flow table, that is, the order details are converted into inventory operation events and written into the temporary flow table. Each temporary flow data in the temporary flow table includes an order identifier, an order type, an item identifier, and an inventory change amount of the item identifier. The temporary flow data also includes the physical change amount of the item identifier, that is, the actual storage quantity of the item identifier in the warehouse. The inventory change amount is the amount of inventory change, indicating an increase or decrease in inventory. The inventory change amount is determined based on the order type and the number of item identifiers. If the order type is a type indicating an inventory deduction, and the number of item identifiers is N (N is a natural number greater than or equal to 1), the inventory change amount of the item identifier is determined to be minus N inventory quantities, that is, -N. If the order type is a type indicating an increase in inventory, and the data of the item identifier is N, the inventory change amount of the item identifier is determined to be an increase of N inventory quantities, such as +N. For example, a temporary transaction data in the temporary transaction table is: the order number is sales order 1, the business type is pre-occupation, the product code is SKU1, and the inventory change amount is -1.

[0060] In the embodiment of the present invention, the temporary flow table includes multiple temporary flow data, each temporary flow data has a corresponding item ID, and the same item ID can correspond to multiple temporary flow data. The multiple temporary flow data can be determined according to different order details, such as multiple sales orders and multiple purchase orders can all make inventory changes for the same item ID. For example, SKU1 corresponds to 3 temporary flow data, including the pre-occupancy of sales order 1, the inventory change amount is -1; the cancellation of sales order 2, the inventory change amount is +3, and the warehousing of purchase order 1, the inventory change amount is +1.

[0061] In an embodiment of the present invention, after receiving an order processing request, the inventory system processes the request, including modifying the inventory quantity and persistently recording the flow of inventory operations. By writing temporary flow data determined by the order details into a temporary flow table and updating the database according to the temporary flow table, the order and inventory system are decoupled. After the inventory data is updated, the temporary flow data is converted into permanent flow data. The temporary flow table can convert the inventory update operation that requires queuing and blocking processing into a non-blocking operation of inserting temporary flow data into the temporary flow table, thereby improving the efficiency of data processing.

[0062] In the embodiment of the present invention, the temporary flow data includes the inventory change amount of the item identification; Figure 3 As shown, an inventory change request is generated based on various temporary flow data, including:

[0063] Step S301: adding up the inventory change amounts of the same item ID in each temporary flow data to obtain the total inventory change amount of the same item ID;

[0064] Step S302: Generate an inventory change request according to the total inventory change quantity of the same item ID.

[0065] In an embodiment of the present invention, each temporary flow data with the same item ID can be obtained from the temporary flow table, and an inventory change request can be generated according to each temporary flow data, and the inventory change request can be sent to the database to enable the database to update the inventory quantity of the same item ID. Each temporary flow data in each temporary flow data includes the inventory change quantity of the same item ID, and the inventory change quantity of the same item ID in each temporary flow data is added up to obtain the total inventory change quantity of the same item ID in each temporary flow data, and then the inventory change request is generated according to the same item ID and the total inventory change quantity of the same item ID, that is, the inventory change request includes the same item ID and its inventory change quantity, so that the database can update the inventory quantity of the same item ID.

[0066] In the embodiment of the present invention, by merging various temporary flow data with the same item ID, it is realized that multiple inventory change requests are merged into one inventory change request and sent to the database, and multiple database interactions are merged into one interaction, so that the database updates the inventory, and each item ID executes a database update, thereby improving the update efficiency of the database. By executing and processing a row of resources each time, it is avoided that too many row resources need to be locked for one database update, and it will not cause waiting or deadlock when there is competition for row lock resources. By merging multiple requests and calling, the number and frequency of database calls are also reduced, and long resource waiting for requests in high concurrency scenarios is avoided.

[0067] In an embodiment of the present invention, after the inventory quantity of the same item ID in the database is updated according to the inventory change request, it also includes: generating permanent flow data corresponding to each temporary flow data according to the inventory quantity of the same item ID before and after the update and each temporary flow data in the database. That is, the temporary flow data is converted into permanent flow data, and the change amount of the same item ID is determined according to the quantity before and after the update of the same item ID, and the permanent flow data includes the order ID, the order type, the item ID, the inventory quantity before and after the update of the item ID, and the change amount. After the inventory quantity of the same item ID in the database is updated according to the inventory change request, the inventory quantity of the same item ID in the inventory cache is updated.

[0068] In the embodiment of the present invention, before updating the inventory quantity of the same item ID in the database according to the inventory change request, the method further includes:

[0069] Determine that the number of inventory change requests for the same item ID within a preset time does not exceed a flow-limiting threshold;

[0070] In response to the number of inventory change requests for the same item identifier within a preset time exceeding a current limiting threshold, the database rejects the inventory change request.

[0071] In an embodiment of the present invention, after an inventory change request corresponding to the same item identifier is generated, the inventory change request is sent to a database to call the database, lock the row resource of the same item identifier in the database, and update the inventory of the same item identifier. After the update is completed, the database row lock resource is released. Each item identifier corresponds to a row in the database. When the inventory of the item identifier is updated, the row resource where the item identifier is located is locked. After the update is completed, the row resource is released. When the number of inventory change requests for the same item identifier within a preset time does not exceed the current limiting threshold, the database can receive the inventory change request. If it exceeds the current limiting threshold, the inventory change request is rejected. By controlling the concurrent number of inventory change requests for a certain item identifier within a preset time, the request frequency of calling the database row resource is reduced. The concurrent number of inventory change requests can be controlled by a fixed window algorithm, a token bucket algorithm, or a leaky bucket algorithm. Among them, the fixed window algorithm is designed through aspect programming. Before and after the inventory change request calls the database, the quantity is counted according to the dimension of item identification. When the flow limit threshold is reached within the preset time, the database rejects the inventory change request. The rejected inventory change request can be retried later.

[0072] Figure 4The present invention is a flowchart of a data processing method according to an embodiment of the present invention, the method comprising: receiving an order processing request, the order processing request comprising order details, the order details comprising an order identifier, an order type, an item identifier and the quantity of each item identifier; determining whether the order type is a type indicating inventory deduction, if so, updating the inventory quantity of the item identifier in the inventory cache, and generating temporary flow data corresponding to each item identifier according to each item identifier in the order details and writing it into a temporary flow table; if not, generating temporary flow data corresponding to each item identifier according to each item identifier in the order details and writing it into a temporary flow table; analyzing and merging processor orders to capture each temporary flow data with the same item identifier from the temporary flow table, and performing the The inventory change quantities of the same item ID in each temporary flow data are merged to obtain the total inventory change quantity, an inventory change request is generated according to the total inventory change quantity of the same item ID, and the inventory change request is sent to the inventory database; at the same time, the flow controller controls the number of inventory change requests for the same item ID, and when the number exceeds the flow limit threshold, the database rejects the inventory change request; the inventory database is updated according to the total inventory change quantity of the same item ID in the inventory change request; when the inventory database is updated, the flow is assembled according to the updated inventory quantity and temporary flow data, the temporary flow data is converted into permanent flow data, and the updated inventory quantity of the same item ID is written back to the inventory cache.

[0073] The data processing method of the embodiment of the present invention determines the temporary flow data of each item ID according to the order details in the order processing request after receiving the order processing request, writes the temporary flow data into the temporary flow table, obtains and merges the temporary flow data of the same item ID from the temporary flow table, generates an inventory change request, and updates the inventory of the same item ID in the database according to the inventory change request. The method records the call to update the inventory in the order dimension as the temporary flow data in the item ID dimension, controls the occupation and release of the database row lock resources by analyzing and merging the temporary flow data with the same item ID, overcomes the asynchronous task backlog caused by the competition of the database row lock resources in the prior art, reduces the mutual waiting of multiple rows of resources, reduces the number and frequency of calls to the database, reduces the reduction of the update interface throughput, and improves the efficiency of database updates; the inventory deduction operation is verified through the inventory cache to prevent the overselling problem caused by negative inventory.

[0074] According to another aspect of the embodiment of the present invention, Figure 5 As shown, a data processing device 500 is provided, comprising:

[0075] A receiving module 501 receives an order processing request, wherein the order processing request includes order details; the order details include one or more item identifiers;

[0076] Determining module 502, determining temporary flow data of each item identifier according to the order details, and writing the temporary flow data into a temporary flow table;

[0077] The generating module 503 obtains each temporary flow data with the same item ID from the temporary flow table, and generates an inventory change request according to each temporary flow data;

[0078] The updating module 504 updates the inventory quantity of the same item ID in the database according to the inventory change request.

[0079] In the embodiment of the present invention, the order details include the order type, and the determination module 502 is further used to: before determining the temporary flow data of each item identifier according to the order details, determine that the order type is a type indicating an increase in inventory.

[0080] In an embodiment of the present invention, the order details include the order type and the quantity of each item identifier; the determination module 502 is also used to: before determining the temporary flow data of each item identifier according to the order details, the order type is a type indicating inventory deduction, and determine that the inventory quantity of each item identifier in the inventory cache is greater than or equal to the quantity of the item identifier in the order details.

[0081] In an embodiment of the present invention, the order details include an order identifier, an order type, and the quantity of each item identifier; the determination module 502 is further used to: determine temporary flow data of each item identifier according to the order details, determine the inventory change amount of the item identifier according to the order type and the quantity of the item identifier; generate temporary flow data of the item identifier according to the order identifier, the order type, and the inventory change amount of the item identifier.

[0082] In an embodiment of the present invention, the temporary flow data includes the inventory change amount of the item identification; the generation module 503 is further used to: add the inventory change amounts of the same item identification in each temporary flow data to obtain the total inventory change amount of the same item identification; and generate an inventory change request according to the total inventory change amount of the same item identification.

[0083] In an embodiment of the present invention, the update module 504 is also used to: after updating the inventory quantity of the same item identifier in the database according to the inventory change request, generate permanent transaction data corresponding to each temporary transaction data according to the inventory quantity of the same item identifier in the database before and after the update and each temporary transaction data.

[0084] In an embodiment of the present invention, the update module 504 is also used to: before updating the inventory quantity of the same item identifier in the database according to the inventory change request, determine that the number of inventory change requests for the same item identifier within a preset time does not exceed the current limiting threshold; in response to the number of inventory change requests for the same item identifier within the preset time exceeding the current limiting threshold, cause the database to reject the inventory change request.

[0085] Figure 6 An exemplary system architecture 600 is shown to which the data processing method or data processing apparatus according to the embodiment of the present invention can be applied.

[0086] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0087] Users can use terminal devices 601, 602, and 603 to interact with server 605 through network 604 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 601, 602, and 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).

[0088] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0089] The server 605 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 601, 602, and 603. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.

[0090] It should be noted that the data processing method provided in the embodiment of the present invention is generally executed by the server 605 , and accordingly, the data processing device is generally set in the server 605 .

[0091] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0092] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0093] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0094] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.

[0095] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.

[0096] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0097] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0098] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a receiving module, a determining module, a generating module and an updating module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the receiving module may also be described as a "module for receiving order processing requests".

[0099] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: receiving an order processing request, the order processing request includes order details; the order details include one or more item identifiers; determining temporary flow data for each item identifier according to the order details, and writing the temporary flow data into a temporary flow table; obtaining each temporary flow data with the same item identifier from the temporary flow table, and generating an inventory change request according to each temporary flow data; and updating the inventory quantity of the same item identifier in the database according to the inventory change request.

[0100] According to the technical solution of the embodiment of the present invention, the data processing method of the embodiment of the present invention, after receiving the order processing request, determines the temporary flow data of each item ID according to the order details in the order processing request, and writes the temporary flow data into the temporary flow table, obtains the temporary flow data of the same item ID from the temporary flow table and merges them, generates an inventory change request, and updates the inventory of the same item ID in the database according to the inventory change request. The method records the call to update the inventory in the order dimension as the temporary flow data of the item ID dimension, controls the occupation and release of the database row lock resources by analyzing and merging the temporary flow data with the same item ID, overcomes the asynchronous task backlog caused by the competition of the database row lock resources in the prior art, reduces the mutual waiting of multiple rows of resources, reduces the number and frequency of calls to the database, reduces the reduction of the update interface throughput, and improves the efficiency of database updates; the inventory deduction operation is verified through the inventory cache to prevent the overselling problem caused by negative inventory.

[0101] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for data processing, characterized in that: include: receiving an order processing request, wherein the order processing request includes order details; The order details include one or more item identifiers; Determine temporary flow data of each item identifier according to the order details, and write the temporary flow data into a temporary flow table; Acquire various temporary flow data with the same item ID from the temporary flow table, and generate an inventory change request according to the various temporary flow data; The inventory quantity of the same item ID in the database is updated according to the inventory change request.

2. The method according to claim 1, characterized in that The order details include the order type. Before determining the temporary flow data of each item identifier according to the order details, the following is further included: The order type is determined to be a type indicating an inventory increase.

3. The method according to claim 1, characterized in that: The order details include the order type and the quantity of each item identifier; before determining the temporary flow data of each item identifier according to the order details, the method further includes: The order type is a type indicating inventory deduction, and it is determined that the inventory quantity of each item identifier in the inventory cache is greater than or equal to the quantity of the item identifier in the order details.

4. The method according to claim 1, characterized in that: The order details include an order identifier, an order type, and the quantity of each item identifier; determining temporary flow data of each item identifier according to the order details includes: Determine the inventory change amount of the item ID according to the order type and the quantity of the item ID; Temporary flow data of the item ID is generated according to the order ID, the order type and the inventory change amount of the item ID.

5. The method according to claim 1, characterized in that The temporary flow data includes the inventory change amount of the item identification; generating an inventory change request according to each temporary flow data, including: Adding up the inventory change amounts of the same item ID in each of the temporary flow data to obtain the total inventory change amount of the same item ID; The inventory change request is generated according to the total inventory change amount of the same item identification.

6. The method according to claim 5, characterized in that After updating the inventory quantity of the same item ID in the database according to the inventory change request, the method further includes: Permanent transaction data corresponding to each temporary transaction data is generated according to the inventory quantity before and after the update of the same item identification in the database and the various temporary transaction data.

7. The method according to claim 1, characterized in that Before updating the inventory quantity of the same item ID in the database according to the inventory change request, the method further includes: Determining that the number of inventory change requests for the same item identifier within a preset time period does not exceed a flow-limiting threshold; In response to the number of inventory change requests for the same item identifier within a preset time exceeding the current limiting threshold, the database rejects the inventory change request.

8. A data processing device, characterized in that: include: A receiving module receives an order processing request, wherein the order processing request includes order details; The order details include one or more item identifiers; A determination module, which determines temporary flow data of each item identifier according to the order details, and writes the temporary flow data into a temporary flow table; A generating module, which obtains each temporary flow data with the same item ID from the temporary flow table, and generates an inventory change request according to each temporary flow data; An updating module updates the inventory quantity of the same item ID in the database according to the inventory change request.

9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Hospital supply chain order data optimization method based on big data analysis

    CN121810176A