Multi-mode order number generation method and device, computer equipment and storage medium

Through the multi-mode single number generation method, order numbers in different modes are generated according to the single number generation rules and mode configuration, which solves the problem of single number generation mode in the existing technology, and realizes efficient and flexible single number generation, satisfying the Requirements for a variety of business scenarios.

CN119444042APending Publication Date: 2025-02-14SHENZHEN LANYOU TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310960062.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-01
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In the prior art, the single number generation mode is single, and the number cannot be missed and cannot meet the needs of multiple business scenarios.

Method used

A multi-mode order number generation method is proposed. By obtaining the order number generation rules and the order number mode configuration, the order number in different modes is judged and generated, including unique, continuous and order number that allows missing numbers, unique, and continuous and the order number that does not allow missing numbers, and the order number that is unique, strongly continuous and does not allow missing numbers.

Benefits of technology

It realizes efficient generation of unique and continuous order numbers. By adjusting the use resources of Redis service, the performance limit of order production can be controlled and the business needs of order numbers generated in different scenarios can be flexibly met.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119444042A_ABST
    Figure CN119444042A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of data processing, and relates to a multi-mode order number generation method and device, computer equipment and a storage medium, and the method comprises the steps: obtaining an order number generation rule, and obtaining order number mode configuration according to the order number generation rule; judging whether the order number mode configuration is a first mode or not, and if yes, generating a unique and continuous order number which is allowed to be missed; judging whether the order number mode configuration is a second mode or not, and if yes, generating a unique and continuous order number which is not allowed to be missed; and judging whether the order number mode configuration is a third mode or not, and if so, generating a unique and strongly continuous order number which is not allowed to be missed. Unique and continuous order numbers can be efficiently generated; by adjusting the use resources of the Redis service, the upper limit of the performance of order production can be controlled, that is, the better the deployment mode of the Redis and the used hardware resources are, the better the performance of order number generation is; by using a configuration mode, different order number generation modes can be controlled, and the service requirements of order number generation in different scenes are flexibly met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a multi-mode order number generation method, device, computer equipment and storage medium. Background Art

[0002] As the core module of the information system, order number generation usually has high requirements for call frequency and data consistency. This module determines whether the creation of business can be carried out in an orderly manner according to certain rules. In the more traditional mode, when creating a new order number, the largest order number that has been created is queried from the database, and then the order number is incremented automatically based on the database transaction. In this scenario, the performance is greatly affected, and even duplicate order numbers may be generated under high concurrency conditions; or cache middleware is used for support, but the mode of generating order numbers is relatively simple and cannot meet the needs of more business scenarios.

[0003] There are currently two commonly used methods for generating order numbers: one is to query the maximum order ID of the order table each time an order is created, and then use data transactions or synchronous calls to control the order number sequence and uniqueness; the other is to use the atomic operation of the cache middleware to perform an auto-increment operation on the order number flow level to ensure the uniqueness and auto-increment of the order number. The method of using the database to generate order numbers has the disadvantages of poor performance, low concurrency, and the possibility of generating duplicate order numbers; the method of using the cache middleware has the disadvantages of a single mode for generating order numbers, which cannot guarantee that no numbers will be missed and cannot meet a variety of business scenarios. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to propose a multi-mode order number generation method, device, computer equipment and storage medium to solve the problem that the order number generation mode in the prior art is single, cannot guarantee that no number is missed, and cannot meet various business scenarios.

[0005] In order to solve the above technical problems, the present invention provides a multi-mode order number generation method, which adopts the following technical solution, including:

[0006] S1. Obtain order number generation rules, and obtain order number mode configuration according to the order number generation rules;

[0007] S2, determining whether the order number mode configuration is the first mode, if yes, generating a unique, continuous order number that allows missing numbers, otherwise proceeding to step S3;

[0008] S3, determining whether the order number mode configuration is the second mode, if yes, generating a unique, continuous order number that does not allow missing numbers, otherwise proceeding to step S4;

[0009] S4. Determine whether the order number mode configuration is the third mode. If yes, generate a unique order number that is strongly continuous and does not allow missing numbers.

[0010] Preferably, before the step S1 of obtaining the order number generation rule and obtaining the order number mode configuration according to the order number generation rule, the method further includes:

[0011] Setting the order number generation rule;

[0012] According to the order number generation rules, a order number pattern configuration table structure is constructed.

[0013] Preferably, the step of determining whether the order number mode configuration is the first mode and if so, generating a unique, continuous order number that allows missing numbers specifically includes:

[0014] Configuring the tracking number mode configuration into a database, querying its mode according to the tracking number mode configuration prefix, and determining whether the tracking number mode configuration is the first mode;

[0015] If it is determined that the order number mode is configured as the first mode, a prefix is ​​configured according to the first mode and the order number mode to generate an order number.

[0016] Preferably, the step of determining whether the order number mode configuration is the second mode and if so, generating a unique, continuous order number that does not allow missing numbers specifically includes:

[0017] Configuring the tracking number mode configuration into a database, querying its mode according to the tracking number mode configuration prefix, and determining whether the tracking number mode configuration is the second mode;

[0018] If it is determined that the order number mode is configured as the second mode, a prefix is ​​configured according to the second mode and the order number mode to generate an order number.

[0019] Preferably, the step of determining whether the order number mode configuration is the third mode, and if so, generating a unique, strongly continuous order number that does not allow missing numbers, specifically includes:

[0020] Configuring the tracking number mode configuration into a database, querying its mode according to the tracking number mode configuration prefix, and determining whether the tracking number mode configuration is the third mode;

[0021] If it is determined that the order number mode is configured as the third mode, a order number is generated according to the third mode and the prefix configured for the order number mode.

[0022] Preferably, after the step of determining whether the order number mode configuration is the third mode in S4, and if so, generating a unique, strongly continuous order number that does not allow missing numbers, the method further includes:

[0023] The order number is stored in the blockchain.

[0024] In order to solve the above technical problems, the present invention also provides a multi-mode order number generating device, which adopts the following technical solution, including:

[0025] An acquisition module is used to acquire a tracking number generation rule, and acquire a tracking number mode configuration according to the tracking number generation rule;

[0026] A first generating module, used for determining whether the order number mode configuration is the first mode, and if so, generating a unique, continuous order number that allows missing numbers;

[0027] A second generating module, used to determine whether the order number mode configuration is the second mode, and if so, to generate a unique, continuous order number that does not allow missing numbers;

[0028] The third generating module is used to determine whether the order number mode configuration is the third mode, and if so, to generate a unique, strongly continuous order number that does not allow missing numbers.

[0029] Preferably, the device further comprises: a configuration module, wherein the configuration module comprises:

[0030] A setting module, used to set the order number generation rules;

[0031] A construction module is used to construct a single number pattern configuration table structure according to the single number generation rule.

[0032] In order to solve the above technical problems, the present invention also provides a computer device, which adopts the technical solution described below, including a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the above-mentioned multi-mode order number generation method when executing the computer-readable instructions.

[0033] In order to solve the above technical problems, the present invention also provides a computer-readable storage medium, which adopts the technical solution described below, and stores computer-readable instructions on the computer-readable storage medium. When the computer-readable instructions are executed by the processor, the steps of the above-mentioned multi-mode order number generation method are implemented.

[0034] Compared with the prior art, the present invention has the following beneficial effects: it can efficiently generate unique and continuous order numbers; by adjusting the usage resources of the Redis service, the performance upper limit of order production can be controlled, that is, the better the deployment mode of Redis and the hardware resources used, the better the performance of order number generation, and the order numbers generated per second can be between 100 and 100,000; by using a configurable method, different modes of order number generation can be controlled to flexibly meet the business needs of order number generation in different scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the scheme in the present invention, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0036] Figure 1 is an exemplary system architecture diagram in which the present invention can be applied;

[0037] Figure 2 is a flow chart of an embodiment of a multi-mode order number generation method of the present invention;

[0038] Figure 3 It is a schematic diagram of the Redis list queue structure used in the multi-mode order number generation method of the present invention;

[0039] Figure 4 It is a schematic diagram of the logical structure of the Java synchronization queue used in the multi-mode order number generation method of the present invention;

[0040] Figure 5 It is a structural schematic diagram of an embodiment of a multi-mode order number generating device of the present invention;

[0041] Figure 6 It is a schematic structural diagram of an embodiment of a computer device of the present invention. DETAILED DESCRIPTION

[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present invention; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention; the terms "including" and "having" and any variations thereof in the specification and claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present invention or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0043] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0044] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings.

[0045] like Figure 1 As shown, the system architecture 100 may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0046] The user can use the first terminal device 101, the second terminal device 102 or the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0047] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, moving picture experts compression standard audio layer), MP4 (Moving Picture Experts Group Audio Layer IV, moving picture experts compression standard audio layer) players, laptop computers and desktop computers, etc.

[0048] The server 105 may be a server that provides various services, for example, a background server that provides support for pages displayed on the first terminal device 101 , the second terminal device 102 , and the third terminal device 103 .

[0049] It should be noted that the multi-mode order number generation method provided in the embodiment of the present invention is generally executed by a server / terminal device, and accordingly, the multi-mode order number generation device is generally arranged in the server / terminal device.

[0050] It should be understood that Figure 1 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.

[0051] Embodiment 1

[0052] Continue to refer Figure 2 , shows a flow chart of an embodiment of a multi-mode order number generation method of the present invention. The multi-mode order number generation method comprises the following steps:

[0053] Step S1, obtain the order number generation rule, and obtain the order number mode configuration according to the order number generation rule.

[0054] In this embodiment, the electronic device (eg, Figure 1 The server / terminal device shown in the figure can receive the multi-mode number generation request through a wired connection or a wireless connection. It should be noted that the above wireless connection method may include but is not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAXX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.

[0055] In this embodiment, step S1 may further include the following steps:

[0056] S11. Obtain the order number application business scenario.

[0057] The business scenario of order number application refers to the occasion where the order number to be generated is applied. For example, the business scenario of order number application can be financial order, automobile sales order, etc.

[0058] S12. Obtain order number generation rules according to the order number application business scenario.

[0059] For example, some financial orders require continuous order numbers, which is for the convenience of reconciliation. For example, some car sales orders may require discontinuous order numbers, because this does not affect sales. For orders that require continuous or discontinuous order numbers, different order number generation rules can be set according to actual needs.

[0060] For example, for the order number continuity method, taking financial orders as an example, three methods can be set: the order number is unique, continuous and numbers can be missed, the order number is unique and numbers cannot be missed, and the order number is unique, strongly continuous and numbers cannot be missed.

[0061] S13. According to the order number generation rule, obtain the order number mode configuration in the order number application business scenario.

[0062] According to different order number generation rules, different order number mode configurations are generated for different order number application business scenarios.

[0063] For example, under the rule that the order number is unique, continuous and can be omitted, you can set the order number 1, 2, 3, 4, 7, 8, 9, 10..., and you can see that 5 and 6 are omitted. Under the rule that the order number is unique and cannot be omitted, you can set the order number 2, 1, 3, 4, 5, 6, 7, 8, 9, 10..., which are different from each other but continuously increasing in sequence, and may appear out of order. Under the rule that the order number is unique, strongly continuous and cannot be omitted, you can set the order number 1, 2, 3, 4, 5, 6, 7, 8, 9, 10..., which are continuously increasing in sequence.

[0064] Configure the business scenario and order number mode in the database. When you need to generate order numbers, read the database configuration to decide which generation mode to use.

[0065] In specific implementation, for example, the order number generation mode can be determined by reading a database table such as order_num_gen_rule configuration according to the order number prefix that needs to be produced.

[0066] In some optional implementations of this embodiment, before step S1, the following steps are further included:

[0067] S01. Set the order number generation rules.

[0068] According to actual needs, set the order number generation rules, and store the order number generation rules in the database. The order number generation rules are determined by the order number application business scenario.

[0069] S02. Construct a table structure for configuring the order number pattern according to order number generation rules.

[0070] Three modes are abstracted according to business scenarios, and the prefix of the order number is fixed. For example, if the sales order number is = > XiaoShouDingDan = > xsdd, the pinyin abbreviation is obtained as the prefix of the order, and a row of data <..., "xsdd", 1, ... > (ellipsis represents other non-key fields), that is, the sales order number uses mode 1 to generate the order number. If it is <..., "xsdd", 1, ... >, mode 3 is used to generate the order number. The generation prefixes and modes for different business scenarios are determined during the function design, and the generation mode can also be adjusted and modified according to actual needs.

[0071] For example, the structure name of the order number mode configuration table can be: order_num_gen_rule, PK = PrimaryKey, indicating the primary key of the database table. id indicates the number. Uniq = Unique Index is a unique index, because there is only one generation mode for a number prefix.

[0072] PK id Primary Key Uniq prefix Prefix model_level Mode level (1, 2, 3) creator Creator ID create_time Creation time modifier Modifier ID update_time Modification time update_control_id Concurrency Control Field

[0073] After constructing the order number mode configuration table structure, the order number generation rules and the order number mode configuration table structure are configured in the database. The database includes but is not limited to Oracle database, ACCESS database, SQL database, DB2 database, Sybase, MySQL, MariaDB, VF, SqlServer, SQLite, etc.

[0074] By setting the order number generation rules and building the order number mode configuration table structure according to the order number generation rules, you can configure the generation of order numbers under different modes and use aspects to implement specific order number generation for multiple scenarios under different modes.

[0075] It should be noted that the aspect refers to the Spring development framework, which adds some additional processing without invading the project's business code and affecting the current main process. That is, you only need to add an annotation tag to use the corresponding pattern to generate the order number without adding too much repetitive code.

[0076] Step S2, determine whether the order number mode configuration is the first mode, if yes, generate a unique, continuous order number that allows missing numbers, otherwise go to step S3.

[0077] The first mode refers to a mode in which the single numbers are unique, continuous, and can be missed.

[0078] In this embodiment, step S2 may further include the following steps:

[0079] S21. Configure the order number mode configuration into the database, query its mode according to the order number mode configuration prefix, and determine whether the order number mode configuration is the first mode.

[0080] S22: If it is determined that the order number mode is configured as the first mode, a prefix is ​​configured according to the first mode and the order number mode to generate an order number.

[0081] Figure 3 Schematic diagram of the Redis list queue structure used in the multi-mode order number generation method of the present invention. Figure 3As shown, the message queue literally means a queue for storing messages. The simplest message queue model of Redis includes three roles: producer, consumer, and result. Producer: Sends messages to the message queue. In the flash sale task, it is responsible for determining the flash sale time and inventory, verifying whether the consumer's permission is one person one order, and sending the coupon id and user id to the message queue. Consumer: Gets and processes messages from the message queue, and completes the order after receiving the order message. Redis provides three different ways to implement message queues: list structure, which simulates message queues based on the List structure; PubSub, a basic point-to-point message model; Stream: a relatively complete message queue model.

[0082] The first mode is a unique, continuous order number generation mode that allows missing numbers. For example, by changing the order prefix in the business scenario, such as the sales order prefix on June 26, 2023 is "XSDD20230626", and the serial number is 3 digits long, the atomic operation of the Redisincr function is used to obtain a value of 1, and if it is less than 3 digits, it is filled with 0 to "001", then the first serial number generated is XSDD20230626001, the second serial number generated is XSDD20230626002, and the 1000th serial number exceeds 3 digits, which is XSDD202306261000. If one of the orders is not used, some order numbers in the actual business order will not be used, that is, missing numbers are allowed. The serial number bit length refers to the length of the serial number position. For example, if the serial number is XSDD-20230717-0001 and 0001, then its bit length is 4. If it is 00001, then its bit length is 5.

[0083] Step S3, determine whether the order number mode configuration is the second mode, if yes, generate a unique, continuous order number that does not allow missing numbers, otherwise go to step S4.

[0084] In this embodiment, step S3 may further include the following steps:

[0085] S31. Configure the order number mode configuration into the database, query its mode according to the order number mode configuration prefix, and determine whether the order number mode configuration is the second mode.

[0086] S32: If it is determined that the order number mode is configured as the second mode, a prefix is ​​configured according to the second mode and the order number mode to generate an order number.

[0087] The second mode is a unique, continuous order number generation mode that does not allow missing numbers. Based on the first mode, the Redis list entry and exit operations are required. Every time an order number is generated, data is inserted into queue 1 at the same time. The queue is marked as completed. If the order is finally saved successfully, it is removed from queue 1; if the order times out and is not processed, it is transferred from queue 1 to queue 2; the newly generated order will first take the unused order number from queue 2. If not, the order number is obtained in the first mode. Similarly, the order number must be temporarily stored in queue 1.

[0088] This embodiment uses two Redis queues, Queue 1 and Queue 2. Redis is a storage middleware. Queues can enter and exit queues, such as entering the first car of the subway and exiting the last car. It is used to temporarily store generated order numbers and overdue unused order numbers. Under the conditions of mode 2, no number omission is allowed, that is, if each order number is not used in time after it is generated, it needs to be recycled and reactivated. Therefore, Queue 1 is used to save newly generated order numbers, and once used, it is directly taken out of the queue; if it is overdue and not used, it is transferred from Queue 1 to Queue 2. In this mode, Queue 2 is given priority to obtain, forming a closed loop until all generated order numbers can be used without omission.

[0089] Step S4, determine whether the order number mode configuration is the third mode, and if so, generate a unique, strongly continuous order number that does not allow missing numbers.

[0090] The third mode is a single number generation mode that is unique, strongly continuous, and does not allow missing numbers.

[0091] In this embodiment, step S4 may further include the steps of:

[0092] S41. Configure the order number mode configuration into the database, query its mode according to the order number mode configuration prefix, and determine whether the order number mode configuration is the third mode.

[0093] S42: If it is determined that the order number mode is configured as the third mode, a prefix is ​​configured according to the third mode and the order number mode to generate an order number.

[0094] Figure 4 Schematic diagram of the logical structure of the Java synchronization queue used in the multi-mode order number generation method of the present invention. Figure 4As shown in the figure, thread A's insert-write operation on a synchronous queue (SynchronousQueue) must be executed after another thread B's remove-remove / read out the element. A synchronous queue does not have internal capacity (that is, capacity = 0), because element element-a only exists at the moment when thread B tries to remove-read it (element a); similarly, developers cannot use thread A to actively insert and write elements to a synchronous queue unless there is a thread B preparing to read (remove) elements in the synchronous queue at this time. The capacity of a synchronous queue is 0, so developers cannot traverse / iterate the synchronous queue. The head element of a synchronous queue is the element that the first thread in the queue is writing; but if there is no thread responsible for writing elements, then thread B, which is waiting to read elements from the synchronous queue, can only read null elements through the poll() method. A synchronous queue is equivalent to an empty Collection collection object, and null elements are not allowed to be stored.

[0095] The third mode requires the use of a Java synchronization queue. Each time an order number is generated through the first mode, it is placed in the Java synchronization queue. If other tasks need to consume the order number, they need to obtain it from the Java synchronization queue. If it is obtained, the generation of the next order number is triggered. If it is not obtained, it is necessary to wait for the Java synchronization queue to replenish the order number so that it can be generated in the order of order creation time. This scenario has strict requirements on the use of order numbers, and order numbers need to be managed and written off. The performance depends on the duration of each business operation.

[0096] Read the corresponding configuration in the business scenario, use the aspect programming idea, and proxy the function accordingly: use the atomicity of the incr function of the cache middleware Redis to increase the order number in order; use the Redis list stack to store the order number to avoid missing numbers; use the Java synchronization queue to control the strong continuity of the order number. Finally, it can dynamically meet different business scenarios. Finally, according to different business scenarios, different modes can be used to generate order numbers. The modes are divided into level one: unique continuous number that can be missed, level two: unique continuous number that cannot be missed, level three: unique strong continuous number that cannot be missed, the levels increase in sequence, the mode can only be downgraded, and the upgrade is not compatible with historical order numbers.

[0097] It should be noted that the meaning of proxying the function is to add an operation based on the original code, such as querying the order number generation mode saved in the database according to the order number prefix, and then generating the order number process, without affecting the main process. The atomicity of the incr function of the cache middleware Redis means that Redis is a memory storage middleware that is used to deal directly with the computer's memory, because the access speed of the memory is much faster than the hard disk, and it can ensure that each call is performed in sequence. The incr function is to perform self-increment operations on a number in sequence, which provides excellent conditions for the generation of the order serial number. The atomicity means that when many orders are generated at the same time, the uniqueness of the order number can be guaranteed, and there will be no problem of duplicate numbers under high concurrency conditions.

[0098] The implementation of this embodiment has the following beneficial effects: unique and continuous order numbers can be efficiently generated; by adjusting the resources used by the Redis service, the performance upper limit of order production can be controlled, that is, the better the Redis deployment mode and the hardware resources used, the better the performance of order number generation, and the number of orders generated per second can be between 100 and 100,000; by using a configurable approach, different modes of order number generation can be controlled to flexibly meet the business needs of order number generation in different scenarios.

[0099] The present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0100] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0101] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0102] Embodiment 2

[0103] Further references Figure 5 , as a response to the above Figure 2 The present invention provides an embodiment of a multi-mode order number generating device, and the device embodiment is Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0104] like Figure 5 As shown, the multi-mode order number generating device 50 of this embodiment includes: an acquisition module 51, a first generating module 52, a second generating module 53 and a third generating module 54. Among them:

[0105] The acquisition module 51 is used to acquire the order number generation rule, and acquire the order number mode configuration according to the order number generation rule;

[0106] The first generating module 52 is used to determine whether the order number mode configuration is the first mode, and if so, to generate a unique, continuous order number that allows missing numbers;

[0107] The second generating module 53 is used to determine whether the order number mode configuration is the second mode, and if so, to generate a unique, continuous order number that does not allow missing numbers;

[0108] The third generating module 54 is used to determine whether the order number mode configuration is the third mode, and if so, to generate a unique, strongly continuous order number that does not allow missing numbers.

[0109] The implementation of this embodiment has the following beneficial effects: unique and continuous order numbers can be efficiently generated; by adjusting the resources used by the Redis service, the performance upper limit of order production can be controlled, that is, the better the Redis deployment mode and the hardware resources used, the better the performance of order number generation, and the number of orders generated per second can be between 100 and 100,000; by using a configurable approach, different modes of order number generation can be controlled to flexibly meet the business needs of order number generation in different scenarios.

[0110] Embodiment 3

[0111] To solve the above technical problems, the embodiment of the present invention also provides a computer device. Figure 6 , Figure 6 This is a basic structural block diagram of the computer device in this embodiment.

[0112] The above-mentioned computer device 6 includes a memory 61, a processor 62, and a network interface 63 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 6 having components of a memory 61, a processor 62, and a network interface 63, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application specific integrated circuit (ASIC), a programmable gate array (FPGA), a digital processor (DSP), an embedded device, etc.

[0113] The computer device may be a desktop computer, a notebook computer, a PDA, a cloud server, etc. The computer device may interact with the user through a keyboard, a mouse, a remote control, a touch pad, or a voice control device.

[0114] The memory 61 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 61 may be an internal storage unit of the computer device 6, such as a hard disk or memory of the computer device 6. In other embodiments, the memory 61 may also be an external storage device of the computer device 6, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. equipped on the computer device 6. Of course, the memory 61 may also include both the internal storage unit of the computer device 6 and its external storage device. In this embodiment, the memory 61 is generally used to store the operating system and various application software installed on the computer device 6, such as computer-readable instructions of the multi-mode single number generation method, etc. In addition, the memory 61 can also be used to temporarily store various types of data that have been output or are to be output.

[0115] The processor 62 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 62 is generally used to control the overall operation of the computer device 6. In this embodiment, the processor 62 is used to run the computer-readable instructions stored in the memory 61 or process data, such as running the computer-readable instructions of the multi-mode order number generation method.

[0116] The network interface 63 may include a wireless network interface or a wired network interface. The network interface 63 is generally used to establish a communication connection between the computer device 6 and other electronic devices.

[0117] The implementation of this embodiment has the following beneficial effects: unique and continuous order numbers can be efficiently generated; by adjusting the resources used by the Redis service, the performance upper limit of order production can be controlled, that is, the better the Redis deployment mode and the hardware resources used, the better the performance of order number generation, and the number of orders generated per second can be between 100 and 100,000; by using a configurable approach, different modes of order number generation can be controlled to flexibly meet the business needs of order number generation in different scenarios.

[0118] Embodiment 4

[0119] The present invention also provides another embodiment, namely, providing a computer-readable storage medium, which stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable at least one processor to perform the steps of the multi-mode order number generation method as described above.

[0120] The implementation of this embodiment has the following beneficial effects: unique and continuous order numbers can be efficiently generated; by adjusting the resources used by the Redis service, the performance upper limit of order production can be controlled, that is, the better the Redis deployment mode and the hardware resources used, the better the performance of order number generation, and the number of orders generated per second can be between 100 and 100,000; by using a configurable approach, different modes of order number generation can be controlled to flexibly meet the business needs of order number generation in different scenarios.

[0121] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the various embodiment methods of the present invention.

[0122] Obviously, the embodiments described above are only some embodiments of the present invention, rather than all embodiments. The preferred embodiments of the present invention are given in the accompanying drawings, but they do not limit the patent scope of the present invention. The present invention can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive. Although the present invention has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific embodiments, or to perform equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of the present invention, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present invention.

Claims

1. A multi-mode order number generation method, characterized in that: The steps include: S1. Obtain order number generation rules, and obtain order number mode configuration according to the order number generation rules; S2, determining whether the order number mode configuration is the first mode, if yes, generating a unique, continuous order number that allows missing numbers, otherwise proceeding to step S3; S3, determining whether the order number mode configuration is the second mode, if yes, generating a unique, continuous order number that does not allow missing numbers, otherwise proceeding to step S4; S4. Determine whether the order number mode configuration is the third mode. If yes, generate a unique order number that is strongly continuous and does not allow missing numbers.

2. The multi-mode order number generation method according to claim 1, characterized in that: Before the step S1 of obtaining the order number generation rule, obtaining the order number mode configuration according to the order number generation rule also includes: Setting the order number generation rule; According to the order number generation rules, a order number pattern configuration table structure is constructed.

3. The multi-mode order number generation method according to claim 1, characterized in that: The step of determining whether the order number mode configuration is the first mode, and if so, generating a unique, continuous order number that allows missing numbers specifically includes: Configuring the tracking number mode configuration into a database, querying its mode according to the tracking number mode configuration prefix, and determining whether the tracking number mode configuration is the first mode; If it is determined that the order number mode is configured as the first mode, a prefix is ​​configured according to the first mode and the order number mode to generate an order number.

4. The multi-mode order number generation method according to claim 1, characterized in that: The step of determining whether the order number mode configuration is the second mode, and if yes, generating a unique, continuous order number that does not allow missing numbers specifically includes: The single number mode configuration is configured into a database, and its mode is queried according to the single number mode configuration prefix to determine whether the single number mode configuration is the second mode. If it is determined that the order number mode is configured as the second mode, a prefix is ​​configured according to the second mode and the order number mode to generate an order number.

5. The multi-mode tracking number generation method according to claim 1, characterized in that: The step of determining whether the order number mode configuration is the third mode, and if yes, generating a unique, strongly continuous order number that does not allow missing numbers specifically includes: The single number mode configuration is configured into a database, and its mode is queried according to the single number mode configuration prefix to determine whether the single number mode configuration is the third mode. If it is determined that the order number mode is configured as the third mode, a order number is generated according to the third mode and the prefix configured for the order number mode.

6. The multi-mode tracking number generation method according to any one of claims 1 to 5, characterized in that: After the step of determining whether the order number mode configuration is the third mode in S4, and if so, generating a unique, strongly continuous order number that does not allow missing numbers, the following step further includes: The order number is stored in the blockchain.

7. A multi-mode order number generating device, characterized in that: include: An acquisition module is used to acquire a tracking number generation rule, and acquire a tracking number mode configuration according to the tracking number generation rule; A first generating module, used for determining whether the order number mode configuration is the first mode, and if so, generating a unique, continuous order number that allows missing numbers; A second generating module, used to determine whether the order number mode configuration is the second mode, and if so, to generate a unique, continuous order number that does not allow missing numbers; The third generating module is used to determine whether the order number mode configuration is the third mode, and if so, to generate a unique, strongly continuous order number that does not allow missing numbers.

8. The multi-mode order number generating device according to claim 7, characterized in that: The device further comprises: a configuration module, wherein the configuration module comprises: A setting module, used to set the order number generation rules; A construction module is used to construct a single number pattern configuration table structure according to the single number generation rule.

9. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the multi-mode order number generation method as described in any one of claims 1 to 6 when executing the computer-readable instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps of the multi-mode order number generation method according to any one of claims 1 to 6 are implemented.