An account concurrency generation method, device, computer device and storage medium
By arranging the account into a sequence number with classification code, concurrent value and concurrent value locking, the problems of low concurrency and low efficiency of card number generation in the prior art are solved, and the effect of high concurrent account generation and continuous optimization of performance is achieved.
Patent Information
- Application Number
- CN202110331752.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-29
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2041-03-29
AI Technical Summary
In the prior art, the card number generation method has problems of low concurrency, low efficiency, and step-by-step degradation.
By arranging the account into sequence numbers composed of classification codes, concurrent values and concurrent values, the concurrent values and concurrent values lock sequence numbers are used to achieve the concurrent first and then sequence strategy to generate a complete account.
It supports the generation of high-concurrent accounts, achieves flexible and configurable, and continuously without degradation of performance, improves account generation efficiency, and is conducive to the development of banks and other businesses.
Smart Images

Figure CN113077332B_ABST
Abstract
Description
Technical Field
[0001] This document relates to the field of automatic programming, and particularly to a method, device, computer device and storage medium for generating concurrent accounts. Background Art
[0002] With the booming development of the Internet, the cooperation between banks and Internet enterprises has deepened, and more and more customers open bank accounts through various websites and APPs. In the process of opening an account for a customer, an important step is to generate a card number (the card number is usually 16 or 19 digits long and consists of a Bank Identification Number (BIN), a city code, a card serial number, and a card check digit). Banks need to support the instantaneous high-concurrency customer card opening requirements in the Internet scenario.
[0003] Traditional methods for generating card numbers include generating using a sequence generator or randomly generating. For the method of generating using a sequence generator, the card serial number is generated starting from all zeros, and the serial number is incremented by 1 for each newly generated card number. In this process, the same branch needs to lock the sequence resource to prevent card number duplication. This method of locking the sequence resource to generate card numbers has problems of low transaction concurrency and slow speed. For the method of randomly generating card numbers, although the efficiency of generating card numbers is relatively high in the initial stage, as the business develops and the issuance volume of bank card numbers gradually increases, the probability that the card numbers generated by random numbers will duplicate the existing card numbers in the bank will become larger and larger. During the process of opening an account once, it may be necessary to continuously generate random numbers multiple times before a usable card number can be generated for the customer, and the card opening efficiency of the entire system will gradually degrade. Summary of the Invention
[0004] This document is used to solve the problems of low concurrency, low efficiency, and gradual degradation existing in the prior art for generating card numbers.
[0005] To solve the above technical problems, a first aspect of this document provides a method for generating concurrent accounts. The account consists of a classification code, a concurrent value, and a sequence number. The method for generating concurrent accounts includes:
[0006] Obtain the classification code and the concurrent value according to the account generation request;
[0007] Store the account generation request in the request queue of the concurrent value;
[0008] Respond to the account generation requests in the request queue of the concurrent value in sequence. Each time a response is made, increment the sequence number locked by the concurrent value by 1, use the processed value as the sequence number corresponding to the account generation request, and update the sequence number locked by the concurrent value with the processed value;
[0009] Generate a complete account according to the classification code, the concurrent value, and the sequence number corresponding to the account generation request.
[0010] In a further embodiment of the present invention, generating a request according to concurrent accounts, and obtaining a classification code and a concurrent value, including:
[0011] Generating a request according to an account, and obtaining a classification code;
[0012] According to the classification code, determining the length of the concurrent value and the generation method of the concurrent value;
[0013] According to the length of the concurrent value, generating a concurrent value according to the generation method of the concurrent value.
[0014] In a further embodiment of the present invention, the generation method of the concurrent value includes one of the following generation methods: time concurrent generation method, random number concurrent generation method, and millisecond number reverse order generation method.
[0015] In a further embodiment of the present invention, the account concurrent generation method further includes:
[0016] Judging the number of account generation requests in the request queue of the concurrent value;
[0017] If the number is greater than a predetermined value, adjusting the generation method of the concurrent value according to a predetermined plan.
[0018] In a further embodiment of the present invention, the length of the concurrent value is determined according to the historical account generation request volume.
[0019] In a further embodiment of the present invention, generating a complete account according to the classification code, the concurrent value, and the sequence number corresponding to the account generation request, including:
[0020] Sequentially concatenating the classification code, the concurrent value, and the sequence number corresponding to the account generation request according to the order of the classification code, the concurrent value, and the sequence number corresponding to the account generation request to obtain a complete account.
[0021] In a further embodiment of the present invention, generating a complete account according to the classification code, the concurrent value, and the sequence number corresponding to the account generation request, including:
[0022] Generating a check digit according to the classification code, the concurrent value, and the sequence number corresponding to the account generation request;
[0023] Sequentially concatenating the classification code, the concurrent value, the sequence number corresponding to the account generation request, and the check digit according to the order of the classification code, the concurrent value, the sequence number corresponding to the account generation request, and the check digit to obtain a complete account.
[0024] In a further embodiment of the present invention, before generating a request according to an account and obtaining a classification code and a concurrent value, it further includes:
[0025] Determining the account generation method;
[0026] If the account generation method is to determine the serial number based on the concurrency value, then perform the step of obtaining the classification code and the concurrency value according to the account generation request.
[0027] In a further embodiment of the present invention, the account concurrent generation method further includes:
[0028] If the account generation method is to directly determine the serial number, then obtain the classification code according to the account generation request;
[0029] Store the account generation request into the unique request queue;
[0030] Respond to the account generation requests in the unique request queue in sequence, increment the serial number generated most recently by 1, and use the processed value as the serial number corresponding to the account generation request;
[0031] Generate a complete account according to the classification code and the serial number corresponding to the account generation request.
[0032] In a further embodiment of the present invention, before incrementing the serial number locked by the concurrency value by 1, it further includes:
[0033] Determine whether there is a serial number locked by the concurrency value;
[0034] If there is, then perform the operation of incrementing the serial number locked by the concurrency value by 1;
[0035] If not, update the serial number locked by the concurrency value according to the complete account generated last time in the serial mode.
[0036] In a further embodiment of the present invention, the classification code includes: an account generation party identifier and a region code.
[0037] In a further embodiment of the present invention, after incrementing the serial number locked by the concurrency value by 1, it further includes:
[0038] Determine whether the processed value is the upper limit value;
[0039] If the judgment result is yes, obtain a new region code and update the current region code with the new region code.
[0040] In a second aspect of the present invention, there is provided an account concurrent generation device. The account is composed of a classification code, a concurrency value, and a serial number. The account concurrent generation device includes:
[0041] A concurrency management module, configured to obtain a classification code and a concurrency value according to an account generation request;
[0042] A storage module, configured to store the account generation request into the request queue of the concurrency value;
[0043] A sequence number generation module, which is used to sequentially respond to the account generation requests in the request queue of the concurrency value, increment the sequence number locked by the concurrency value by 1 each time it responds, use the processed value as the sequence number corresponding to the account generation request, and update the sequence number locked by the concurrency value with the processed value;
[0044] An account generation module, which is used to generate a complete account according to the classification code, concurrency value, and the sequence number corresponding to the account generation request.
[0045] A third aspect of this article provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the account concurrent generation method described in any of the foregoing embodiments.
[0046] A fourth aspect of this article provides a computer-readable storage medium. The computer-readable storage medium stores an executable computer program. When the computer program is executed by a processor, it implements the account concurrent generation method described in any of the foregoing embodiments.
[0047] The account concurrent generation method, device, computer device, and storage medium provided in this article are applicable to the generation of accounts such as bank card numbers and membership card numbers. By arranging the account to be composed of a classification code, a concurrency value, and a sequence number locked by the concurrency value, when an account generation request is received, the classification code, concurrency value, and sequence number locked by the concurrency value are obtained, and the method of using the concurrency value and the sequence number locked by the concurrency value achieves a strategy of first concurrency and then sequence, which can support the generation of high-concurrency accounts, achieve the effects of flexible configuration and continuous performance non-degradation, improve the account generation efficiency, and is beneficial to the development of businesses such as banks.
[0048] To make the above and other purposes, features, and advantages of this article more obvious and understandable, the following specifically enumerates preferred embodiments and, in conjunction with the accompanying drawings, makes the following detailed description. Description of the Drawings
[0049] To more clearly illustrate the technical solutions in the embodiments of this article or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of this article. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0050] Figure 1 Shows the first flowchart of the account concurrent generation method in the embodiments of this article;
[0051] Figure 2 Shows the schematic diagram of the account arrangement format in the embodiments of this article;
[0052] Figure 3Shows the flowchart of the concurrent value determination process of the embodiments herein;
[0053] Figure 4 Shows the second flowchart of the account concurrent generation method of the embodiments herein;
[0054] Figure 5 Shows the flowchart of the complete account generation process of the embodiments herein;
[0055] Figure 6 Shows the third flowchart of the account concurrent generation method of the embodiments herein;
[0056] Figure 7 Shows the fourth flowchart of the account concurrent generation method of the embodiments herein;
[0057] Figure 8 Shows the structural diagram of the account concurrent generation device of the embodiments herein;
[0058] Figure 9 Shows the structural diagram of the account concurrent generation system of the embodiments herein;
[0059] Figure 10 Shows the structural diagram of the computer device of the embodiments herein.
[0060] Description of the reference signs in the drawings:
[0061] 700, Account generation management device;
[0062] 800, Account concurrent generation device;
[0063] 810, Concurrency management module;
[0064] 820, Storage module;
[0065] 830, Sequence number generation module;
[0066] 840, Account generation module;
[0067] 900, Traditional account generation device;
[0068] 1002, Computer device;
[0069] 1004, Processor;
[0070] 1006, Memory;
[0071] 1008, Driving mechanism;
[0072] 1010, Input / output module;
[0073] 1012, Input device;
[0074] 1014, Output device;
[0075] 1016. Presentation device;
[0076] 1018. Graphical user interface;
[0077] 1020. Network interface;
[0078] 1022. Communication link;
[0079] 1024. Communication bus. Detailed implementation
[0080] Next, the technical solutions in the embodiments of this article will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of this article. Obviously, the described embodiments are only a part of the embodiments of this article, rather than all the embodiments. Based on the embodiments in this article, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this article.
[0081] In the prior art, in the account concurrent generation method, for example, in the bank card number generation method, there are mainly two methods: locking resources to generate card numbers and randomly generating card numbers. Both of these methods are ways to directly determine the sequence number. Among them, the method of locking resources to generate card numbers has the problems of low concurrency and slow card number generation speed, and the method of randomly generating card numbers has the problems of low card number generation efficiency and duplication.
[0082] To solve the above problems existing in the prior art, in an embodiment of this article, an account concurrent generation method is provided. The account concurrent generation method provided in this article is applied to a computer cluster and can be completed by multi-threaded concurrent execution of multiple computers. The accounts generated in this article are composed of a classification code, a concurrent value, and a sequence number (as Figure 2 shown). Specifically, as Figure 1 shown, the account concurrent generation method includes:
[0083] Step 110: Obtain the classification code and the concurrent value according to the account generation request;
[0084] Step 120: Store the account generation request in the request queue of the concurrent value;
[0085] Step 130: Respond to the account generation requests in the request queue of the concurrent value in sequence. Each time a response is made, increment the sequence number locked by the concurrent value by 1, use the processed value as the sequence number corresponding to the account generation request, and update the sequence number locked by the concurrent value with the processed value;
[0086] Step 140: Generate a complete account according to the classification code, the concurrent value, and the sequence number corresponding to the account generation request.
[0087] Specifically, the accounts described in this article include, but are not limited to, bank card numbers, membership card numbers of various chain stores and other institutions, etc.
[0088] In step 110, the account generation request can be regarded as a transaction, which can be initiated by a staff member (such as a teller) or by the user through operating a self-service terminal. This article does not limit the initiation method of the account generation request.
[0089] As Figure 2 shown, the classification code includes an account generation party identifier and a region code. Among them, the account generation party identifier is used to distinguish different account generation parties. Taking the bank card number as an example, the account generation party identifier is called the card BIN (Bank Identification Number), which is assigned by the International Organization for Standardization to the bank card organizations engaged in payment transfer and exchange, and includes 6 digits. For example, it is for Bank of China, China Construction Bank, Agricultural Bank of China, Industrial and Commercial Bank of China, etc. The region code is used to distinguish account generation parties in different regions. For example, it can be divided by administrative regions such as provinces, cities, and counties, or custom regions can be defined. This article does not limit this. In specific implementation, in order to ensure continuous generation of accounts, multiple region codes are pre-configured for the same region. When the sequence number locked by the current region code in a region reaches the upper limit value, the next region code in this region is obtained, and the sequence number locked by the next region code is initialized to all 0s.
[0090] The value of the concurrency value is related to the length of the concurrency value. For example, when the length of the concurrency value n = 1, the value range of the concurrency value is 0 - 9; when the length of the concurrency value n = 2, the value range of the concurrency value is 00 - 99. The concurrency value can represent the concurrency degree, and the specific value of the concurrency degree can be determined according to the length of the concurrency value. Specifically, the concurrency degree is 10 n , where n is the length of the concurrency value. If each card generation takes 20 ms, the system throughput can reach 50x10 n TPS. The generation methods of the concurrency value include the following several types: time concurrent generation method, random number concurrent generation method, and millisecond number reverse generation method. Among them, the time concurrent generation method means determining the concurrency value according to time. The random number concurrent generation method means randomly generating a random number that conforms to the length of the concurrency value. For example, when the length of the concurrency value is 3, the random number concurrent method is to randomly generate a three-digit number from 000 - 999. The millisecond number reverse generation method means taking the reverse of the last n digits of the transaction time in milliseconds. For the millisecond number reverse generation method, the generated concurrency degree can also reach 10 n .
[0091] In step 120, each concurrency value corresponds to a request queue of the concurrency value, and the number of request queues of the concurrency value is equal to 10 n , where n is the length of the concurrency value.
[0092] In step 130, the account generation request may enter the concurrent value request queue in chronological order, and when responding, the sequence number corresponding to the concurrent value is generated in sequence by the sequence number generator in accordance with the first-in-first-out principle of the account generation request. For example, for a concurrent value 123, the currently locked sequence number is 123456. According to the chronological order, the arrangement order of the account generation requests in the concurrent value request queue is {account generation request 1, account generation request 2, account generation request 3, account generation request 4}. First, the account generation request 1 is responded to, and the currently locked sequence number of the concurrent value 123 is 123456 plus 1, and the sequence number 123457 corresponding to the account generation request 1 is obtained. The currently locked sequence number of the concurrent value 123 is updated with 123457, that is, after responding to the account generation request 1, 123456 is replaced with the calculated 123457, so that the currently locked sequence number is 123457, and the above process is repeated to continue to respond to the account generation request 2, the account generation request 3, and the account generation request 4 in sequence.
[0093] Through step 120 and step 130, it is possible to avoid the situation where the account generation requests are initiated in batches but the accounts are not generated in time.
[0094] In step 140, the complete account number can be obtained by concatenating the classification code, the concurrency value and the sequence number corresponding to the account generation request in the order of the classification code, the concurrency value and the sequence number corresponding to the account generation request, that is, the complete account number is the classification code + concurrency value + concurrency value locking sequence number. In specific implementation, the complete account number can also be generated in other sorting methods.
[0095] Take bank card number generation as an example, such as card BIN 622700, city code 001. According to the traditional bank card number generation method: according to the sequence number locked by 622700+001, the sequence number + 1 is generated to generate the card number. The sequence number records locked by transaction 1 and transaction 2 are the same, and the card number must be generated serially.
[0096] According to the bank card number generation method in this article (taking the concurrent value length of 3 and the concurrent value selection method as a 3-digit random number as an example), the random number 123 is generated in transaction 1: the sub-sequence number is locked according to 622700+001+123, and the card number is generated after the sub-sequence number is added by 1; the random number generated in transaction 2 is 124: the sub-sequence number is locked according to 622700+001+124, and the card number is generated after the sub-sequence number is added by 1. The sub-sequence number records locked in transaction 1 and transaction 2 are different, and the card number can be generated concurrently.
[0097] In this embodiment, the account number is arranged to consist of a classification code, a concurrency value, and a sequence number locked by the concurrency value. When receiving an account generation request, the classification code, the concurrency value, and the sequence number locked by the concurrency value are obtained. By using the concurrency value and the sequence number locked by the concurrency value, the strategy of concurrency first and then sequence is achieved, which can support the generation of high-concurrency account numbers, achieving the effects of flexible configuration and continuous performance non-degradation, improving the account generation efficiency, and being beneficial to the development of businesses such as banks.
[0098] In one embodiment of this article, as Figure 3 shown, the above step 110 obtains the classification code and the concurrency value according to the concurrent account generation request, including:
[0099] Step 310, obtaining the classification code according to the account generation request;
[0100] Step 320, determining the length of the concurrency value and the generation method of the concurrency value according to the classification code;
[0101] Step 330, generating a concurrency value according to the length of the concurrency value in the generation method of the concurrency value.
[0102] Specifically, the account generation request contains the information of the requestor, and different requestors correspond to different classification codes. Specifically, the requestor information can be represented by the requestor identifier and / or the region. Through step 310, the classification code corresponding to the account generation request can be determined.
[0103] The length of the concurrency value can be determined according to the historical account generation request volume. The higher the historical account generation request volume, the higher the corresponding length of the concurrency value. Different classification codes correspond to different lengths of the concurrency value and generation methods of the concurrency value. As shown in Table 1, for example, classification code A corresponds to a concurrency value length of 3, and the generation method of the concurrency value is the random number concurrent generation method. Classification code B corresponds to a concurrency value length of 4, and the generation method of the concurrency value is the millisecond number reverse order generation method. The corresponding relationship between the classification code and the concurrency value and the generation method of the concurrency value can be determined according to the requirements of the requestor for the number of generated account numbers, and this article does not limit this.
[0104] Table 1
[0105] Classification code Concurrent value length Concurrent value generation method A 3 Random number concurrency B 4 Millisecond number in reverse order …… …… ……
[0106] In step 330, a concurrency value including the length of the concurrency value is generated according to the length of the concurrency value in the generation method of the concurrency value.
[0107] This embodiment can set different classification codes, lengths of the concurrency value, and generation methods of the concurrency value for different requestors, can achieve flexible configuration of the length and generation method of the concurrency value, and is applicable to the account generation in large and complex scenarios.
[0108] In one embodiment of this article, in order to improve the account generation efficiency and avoid conflicts, asFigure 4 As shown, in addition to the above steps 110 to 140, the account concurrent generation method further includes:
[0109] Step 150, determine the number of account generation requests in the request queue of the concurrent value. If the number is greater than a predetermined value, adjust the generation method of the concurrent value according to a predetermined plan. If the number is less than or equal to the predetermined value, there is no need to adjust the generation method of the concurrent value.
[0110] In this step, the predetermined value can be set according to requirements, and the specific value thereof is not limited herein. The predetermined plan can be determined in advance by the staff according to actual needs. For example, when the number is greater than the predetermined value, the generation method of reversing the millisecond number can be adjusted to the random number concurrent generation method, and the predetermined plan is not specifically limited herein.
[0111] In specific implementation, it can also be determined whether the throughput is greater than a predetermined value. If it is greater than the predetermined value, the generation method of the concurrent value is adjusted according to a predetermined plan.
[0112] This embodiment can reduce system performance waste, improve account generation efficiency, and reduce the conflict situation of concurrent values. In one embodiment of this article, as Figure 5 shown, the above step 140 generates a complete account according to the classification code, the concurrent value, and the sequence number corresponding to the account generation request, including:
[0113] Step 510, generate a check digit according to the classification code, the concurrent value, and the sequence number corresponding to the account generation request;
[0114] Step 520, splice the classification code, the concurrent value, and the sequence number corresponding to the account generation request in the order of the classification code, the concurrent value, the sequence number corresponding to the account generation request, and the check digit to obtain a complete account.
[0115] This embodiment can verify the validity of the account by designing a check digit.
[0116] In one embodiment of this article, it can be compatible with the method of using the concurrent value to determine the sequence number described in this article and the method of directly determining the sequence number in the prior art. Specifically, as Figure 6 shown, the account concurrent generation method includes:
[0117] Step 610, determine the account generation method. If the account generation method is the method of using the concurrent value to determine the sequence number, execute step 611; if the account generation method is the method of directly determining the sequence number, execute step 621;
[0118] Step 611, obtain the classification code and the concurrent value according to the account generation request;
[0119] Step 612, store the account generation request in the request queue of the concurrent value;
[0120] Step 613: Respond to the account generation requests in the request queue of the concurrent value in sequence. Each time a response is made, increment the sequence number locked for the concurrent value by 1, use the processed value as the sequence number corresponding to the account generation request, and update the sequence number locked for the concurrent value with the processed value.
[0121] Step 614: Generate a complete account based on the classification code, the concurrent value, and the sequence number corresponding to the account generation request.
[0122] Step 621: Obtain the classification code according to the account generation request.
[0123] Step 622: Store the account generation request in the unique request queue.
[0124] Step 623: Respond to the account generation requests in the unique request queue in sequence, increment the sequence number generated most recently by 1, and use the processed value as the sequence number corresponding to the account generation request.
[0125] Step 624: Generate a complete account based on the classification code and the sequence number corresponding to the account generation request.
[0126] In step 610, the account generation method can be automatically adjusted by the system or manually adjusted by the operator according to the magnitude of the account request frequency. The specific adjustment method is not limited in this article.
[0127] This embodiment can be compatible with the existing account generation method and the high-concurrency account generation method using the concurrent value to determine the sequence number in this article, improve the diversity of the account generation method, determine the account generation method according to the account request frequency, can save resources, and improve the account generation efficiency.
[0128] In an embodiment of this article, in order to avoid the situation of generating duplicate accounts after converting from the existing serial account generation method to the high-concurrency account generation method. Specifically, as Figure 7 shown, the account concurrent generation method includes:
[0129] Step 710: Determine the account generation method. If the account generation method is the method of using the concurrent value to determine the sequence number, then execute step 711; if the account generation method is the method of directly determining the sequence number, then execute step 721.
[0130] Step 711: Obtain the classification code and the concurrent value according to the account generation request; among them, the classification code includes: the account generation party identifier and the area code.
[0131] Step 712: Store the account generation request in the request queue of the concurrent value.
[0132] Step 713: Determine whether there is a sequence number locked for the concurrent value.
[0133] If it exists, directly execute step 714. If it does not exist, update the sequence number locked by the concurrency value according to the last generated complete account corresponding to the classification code, and then execute step 714;
[0134] Step 714: Respond to the account generation requests in the request queue of the concurrency value in sequence. Each time a response is made, increment the sequence number locked by the concurrency value by 1, use the processed value as the sequence number corresponding to the account generation request, and update the sequence number locked by the concurrency value with the processed value;
[0135] Step 715: Generate a complete account according to the classification code, concurrency value, and the sequence number corresponding to the account generation request;
[0136] Step 721: Obtain the classification code according to the account generation request;
[0137] Step 722: Store the account generation request into the unique request queue;
[0138] Step 723: Respond to the account generation requests in the unique request queue in sequence, increment the sequence number of the most recently generated one by 1, and use the processed value as the sequence number corresponding to the account generation request;
[0139] Step 724: Generate a complete account according to the classification code and the sequence number corresponding to the account generation request.
[0140] In specific implementation, to ensure continuous generation of accounts, after steps 714 and 723 increment the sequence number by 1, it further includes: determining whether the incremented sequence number is the upper limit value; if the determination result is yes, obtain a new area code and update the current area code with the new area code. To facilitate the search for the generated sequence number, the sequence number can be stored in a sequence number generator table. For example, store the sequence numbers generated in the concurrent mode in this article in TBCRBIX0, and store the sequence numbers generated in the traditional manner in TBCRBIN0.
[0141] Specifically, in step 713, when it is determined that there is no sequence number for concurrent value locking, first set all the sequence numbers for concurrent value locking to 0, that is, cur S = all 0, where cur represents the current, S represents the sequence number for concurrent value locking, and the length of S is L. Then read the last generated complete account corresponding to the classification code. If the current sequence number m (the length of m is greater than the length of S) of the last generated complete account is less than the historical maximum sequence number, it means that the historical sequence numbers have not been used up. Then assign the value obtained by adding 1 to the sequence number of the last generated complete account (i.e., m + 1) to the sequence number S for concurrent value locking. When assigning, since the length of m + 1 is greater than S, assign the last L bits of m + 1 to S. If the current sequence number of the last generated complete account is greater than or equal to the historical maximum sequence number, it means that the historical sequence numbers have been used up. Then assign the historical maximum sequence number to the sequence number for concurrent value locking, obtain a new area code, and update the current area code with the new area code.
[0142] This embodiment can enable a seamless switch from the existing account generation method to the high-concurrency account generation method in this article, minimizing the business impact and enhancing the bank's Internet service capabilities. Based on the same inventive concept, this article also provides an account concurrent generation device as described in the following embodiments. Since the principle of the account concurrent generation device for solving problems is similar to that of the account concurrent generation method, the implementation of the account concurrent generation device can refer to the account concurrent generation method, and the repeated parts will not be elaborated. The account concurrent generation device provided in this embodiment includes multiple functional modules, and each functional module can be implemented by a dedicated or general-purpose chip, or can also be implemented through a software program, which is not limited in this article.
[0143] Specifically, as Figure 8 shown, the account concurrent generation device 800 includes:
[0144] A concurrency management module 810, configured to obtain a classification code and a concurrent value according to an account generation request;
[0145] A storage module 820, configured to store the account generation request in a request queue of the concurrent value;
[0146] A sequence number generation module 830, configured to sequentially respond to the account generation requests in the request queue of the concurrent value, increment the sequence number for concurrent value locking by 1 each time a response is made, use the processed value as the sequence number corresponding to the account generation request, and update the sequence number for concurrent value locking with the processed value;
[0147] An account generation module 840, configured to generate a complete account according to the classification code, the concurrent value, and the sequence number corresponding to the account generation request.
[0148] In a further embodiment of this article, as Figure 9As shown in the figure, it includes: an account generation management device 700, an account concurrent generation device 800, and an account traditional generation device 900.
[0149] The account generation management device 700 is used to determine the account generation method; if the account generation method is the concurrent method of determining the sequence number using the concurrent value, the account concurrent generation device 800 is started. If the account generation method is the method of directly determining the sequence number, the account traditional generation device 900 is started.
[0150] Specifically, the process of the account concurrent generation device 800 generating an account includes:
[0151] (1) According to the account generation request, obtain the classification code and the concurrent value.
[0152] (2) Store the account generation request in the request queue of the concurrent value.
[0153] (3) Determine whether there is a sequence number locked by the concurrent value.
[0154] If there is, perform an increment operation on the sequence number locked by the concurrent value. After each increment of the sequence number by 1, update the sequence number locked by the concurrent value and determine whether the incremented sequence number is the upper limit value. If it is the upper limit value, obtain a new area code and update the current area code with the new area code.
[0155] If not, determine the sequence number locked by the concurrent value according to the last complete account generated by the account traditional generation device 900, perform an increment operation on the sequence number locked by the concurrent value to obtain the sequence number corresponding to the account generation request. After each increment of the sequence number by 1, update the sequence number locked by the concurrent value and determine whether the incremented sequence number is the upper limit value. If it is the upper limit value, obtain a new area code and update the current area code with the new area code.
[0156] (4) Generate a complete account according to the classification code, the concurrent value, and the sequence number corresponding to the account generation request.
[0157] The process of the account traditional generation device 900 generating an account includes:
[0158] (1) According to the account generation request, obtain the classification code.
[0159] (2) Store the account generation request in the unique request queue.
[0160] (3) Increment the sequence number of the most recent generation in the order of the account generation requests in the unique request queue, and use the incremented sequence number as the sequence number corresponding to each account generation request. Determine whether the incremented sequence number is the upper limit value. If it is the upper limit value, obtain a new area code and update the current area code with the new area code.
[0161] (4) Generate a sequence number corresponding to the request according to the classification code and the account number, and generate a complete account number. The account number concurrent generation system provided in this article is applicable to the generation of account numbers such as bank card numbers and membership card numbers. By arranging the account number to be composed of a classification code, a concurrent value, and a sequence number locked by the concurrent value, when receiving an account number generation request, obtain the classification code, the concurrent value, and the sequence number locked by the concurrent value, and use the concurrent value and the way of locking the sequence number by the concurrent value to achieve the strategy of first concurrent and then sequential, which can support the generation of high-concurrency account numbers, achieve the effects of flexible configurability and continuous non-degradation of performance, improve the efficiency of account number generation, and is beneficial to the development of businesses such as banks.
[0162] In one embodiment of this article, a computer device is also provided, such as Figure 10 shown, the computer device 1002 may include one or more processors 1004, such as one or more central processing units (CPUs), and each processing unit may implement one or more hardware threads. The computer device 1002 may also include any memory 1006, which is used to store any kind of information such as code, settings, data, etc. Specifically, a computer program that can run on the processor 1004 is stored in the memory 1006, and when the processor 1004 executes the computer program, it implements the account number concurrent generation method described in any of the foregoing embodiments. Non-limitingly, for example, the memory 1006 may include any one or more combinations of the following: any type of RAM, any type of ROM, flash memory devices, hard disks, optical discs, etc. More generally, any memory can use any technology to store information. Further, any memory can provide volatile or non-volatile retention of information. Further, any memory can represent a fixed or removable component of the computer device 1002. In one case, when the processor 1004 executes the associated instructions stored in any memory or combination of memories, the computer device 1002 can perform any operation of the associated instructions. The computer device 1002 also includes one or more drive mechanisms 1008 for interacting with any memory, such as a hard disk drive mechanism, an optical disc drive mechanism, etc.
[0163] The computer device 1002 may further include an input / output module 1010 (I / O) for receiving various inputs (via the input device 1012) and for providing various outputs (via the output device 1014). A specific output mechanism may include a presentation device 1016 and an associated graphical user interface 1018 (GUI). In other embodiments, the input / output module 1010 (I / O), the input device 1012, and the output device 1014 may not be included, and it may only be a computer device in the network. The computer device 1002 may further include one or more network interfaces 1020 for exchanging data with other devices via one or more communication links 1022. One or more communication buses 1024 couple the components described above together.
[0164] The communication link 1022 may be implemented in any manner, for example, via a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication link 1022 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc. governed by any protocol or combination of protocols.
[0165] Embodiments herein also provide a computer-readable storage medium having a computer program stored thereon, and when the computer program is run by a processor, it executes the steps of the account generation method described in any of the above embodiments.
[0166] Embodiments herein also provide a computer-readable instruction, and when the processor executes the instruction, the program therein causes the processor to execute the account generation method described in any of the above embodiments.
[0167] It should be understood that in various embodiments herein, the magnitudes of the sequence numbers of the above processes do not mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments herein.
[0168] It should also be understood that in the embodiments herein, the term "and / or" is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " herein generally represents an "or" relationship between the associated objects before and after.
[0169] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of the examples have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this article.
[0170] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0171] In several embodiments provided in this article, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed couplings or direct couplings or communication connections to each other can be indirect couplings or communication connections through some interfaces, devices, or units, and can also be electrical, mechanical, or other forms of connection.
[0172] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place, or can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiments in this article.
[0173] In addition, the functional units in the various embodiments of this article can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
[0174] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution herein, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments herein. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs.
[0175] Specific embodiments are used in this article to elaborate on the principles and implementation manners of this article. The description of the above embodiments is only used to help understand the method and its core idea herein; at the same time, for those of ordinary skill in the art, according to the idea herein, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to this article.
Claims
1. A method for concurrent generation of accounts, characterized in that, An account consists of a classification code, a concurrency value, and a sequence number. The method for generating accounts concurrently includes: Obtaining the classification code and the concurrency value according to an account generation request; Storing the account generation request in the request queue of the concurrency value; Sequentially responding to the account generation requests in the request queue of the concurrency value, incrementing by 1 the sequence number locked for the concurrency value each time a response is made, using the processed value as the sequence number corresponding to the account generation request, and updating the sequence number locked for the concurrency value with the processed value; Generating a complete account according to the classification code, the concurrency value, and the sequence number corresponding to the account generation request; Obtaining the classification code and the concurrency value according to a concurrent account generation request, including: Obtaining the classification code according to the account generation request; Determining the length of the concurrency value and the generation method of the concurrency value according to the classification code; Generating the concurrency value according to the length of the concurrency value in the generation method of the concurrency value.
2. The account concurrent generation method according to claim 1, wherein The generation method of the concurrency value includes one of the following generation methods: time concurrent generation method, random number concurrent generation method, and millisecond number reverse generation method.
3. The account concurrent generation method according to claim 1, characterized in that, It also includes: Judging the number of account generation requests in the request queue of the concurrency value; If the number is greater than a predetermined value, adjusting the generation method of the concurrency value according to a predetermined plan.
4. The account concurrent generation method according to claim 1, wherein The length of the concurrency value is determined according to the historical account generation request volume.
5. The account concurrent generation method according to claim 1, wherein Before obtaining the classification code and the concurrency value according to the account generation request, it also includes: Determining the account generation method; If the account generation method is the method of determining the sequence number using the concurrency value, then execute the step of obtaining the classification code and the concurrency value according to the account generation request.
6. The account concurrent generation method according to claim 5, characterized in that, It also includes: If the account generation method is the method of directly determining the sequence number, then obtain the classification code according to the account generation request; Storing the account generation request in a unique request queue; Sequentially responding to the account generation requests in the unique request queue, incrementing by 1 the most recently generated sequence number, and using the processed value as the sequence number corresponding to the account generation request; Generating a complete account according to the classification code and the sequence number corresponding to the account generation request.
7. The account concurrent generation method according to claim 6, wherein Before incrementing by 1 the sequence number locked for the concurrency value, it also includes: Judging whether there is a sequence number locked for the concurrency value; If it exists, then execute the step of incrementing by 1 the sequence number locked for the concurrency value; If it does not exist, then determine the sequence number locked for the concurrency value according to the complete account generated last time by the method of directly determining the sequence number.
8. The account concurrent generation method according to claim 1, characterized in that, The classification code includes: an account generation party identifier and a region code.
9. The account concurrent generation method according to claim 8, wherein After incrementing by 1 the sequence number locked for the concurrency value, it also includes: Judging whether the processed value is an upper limit value; If the judgment result is yes, obtain a new region code and update the current region code with the new region code.
10. The account concurrent generation method according to claim 1, wherein Generating a complete account according to the classification code, the concurrency value, and the sequence number corresponding to the account generation request, including: Concatenating the classification code, the concurrency value, and the sequence number corresponding to the account generation request in the order of the classification code, the concurrency value, and the sequence number corresponding to the account generation request to obtain a complete account.
11. The account concurrent generation method according to claim 1, characterized in that, Generating a complete account according to the classification code, the concurrency value, and the sequence number corresponding to the account generation request, including: Generating a check digit according to the classification code, the concurrency value, and the sequence number corresponding to the account generation request; Concatenate the classification code, concurrency value, and the sequence number corresponding to the account generation request in the order of generating the sequence number and check digit according to the classification code, concurrency value, and account generation request to obtain the complete account.
12. An account concurrency generation device, characterized in that, The account consists of a classification code, a concurrency value, and a sequence number. The account concurrent generation device includes: A concurrency degree management module for obtaining the classification code and concurrency value according to the account generation request; A storage module for storing the account generation request in the request queue of the concurrency value; A sequence number generation module for sequentially responding to the account generation requests in the request queue of the concurrency value, incrementing the sequence number locked by the concurrency value by 1 each time a response is made, using the processed value as the sequence number corresponding to the account generation request, and updating the sequence number locked by the concurrency value with the processed value; An account generation module for generating a complete account according to the classification code, concurrency value, and the sequence number corresponding to the account generation request; Among them, obtaining the classification code and concurrency value according to the concurrent account generation request includes: Obtaining the classification code according to the account generation request; Determining the length of the concurrency value and the generation method of the concurrency value according to the classification code; Generating the concurrency value according to the length of the concurrency value and the generation method of the concurrency value.
13. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the account concurrent generation method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, it implements the account concurrent generation method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Account generation method and device
CN109493025A
System and method for managing concurrent events
US20130212603A1