A card number generation method, device, equipment and storage medium

Through intra-segment compression bitmap technology, it solves the problem that card numbers must be generated in advance in financial technology, realizes real-time generation of card numbers, avoids excessive occupation of storage space, and improves database performance.

CN113342819BActive Publication Date: 2024-09-20WEBANK (CHINA)
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202110718474.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-28
Publication Date
2024-09-20
Estimated Expiration
2041-06-28

AI Technical Summary

Technical Problem

In the financial technology field, card numbers must be generated in advance, resulting in excessive storage space usage and reduced database performance.

Method used

Using intra-segment compression bitmap technology, by obtaining the card selection request and obtaining the intra-segment compression bitmap of the available card segments in the card segment allocation table associated with the card product number, the serial number of the available card number is quickly obtained, and the card number is generated in real time to avoid Generate all card numbers in advance.

Benefits of technology

It realizes real-time generation of card numbers, reduces storage space usage, and improves database performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113342819B
    Figure CN113342819B
Patent Text Reader

Abstract

The present application provides a card number generation method, a card number generation device, a card number generation equipment and a computer-readable storage medium, wherein the method comprises: obtaining a card selection request; wherein the card selection request carries a card product number; obtaining an intra-segment compression bitmap corresponding to an available card segment in a card segment allocation table associated with the card product number; wherein the intra-segment compression bitmap comprises an ordered string constructed of character identifiers and numbers, wherein the character identifier is used to indicate whether a card number corresponding to a sequence number at a position where the character identifier is located is in an allocated state, and the number is used to indicate the number of card numbers in a continuous state; obtaining a sequence number of available card numbers in an available card segment based on a first identifier in the intra-segment compression bitmap and a first number associated with the first identifier; wherein the first identifier is used to indicate that a card number corresponding to a sequence number at a position where the first identifier is located is in an unallocated state, and the character identifier comprises the first identifier; and generating a card number based on the card product number, the available card segment and the sequence number.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of data processing technology of financial technology (Fintech), and relate to but are not limited to a card number generation method, a card number generation device, a card number generation equipment and a computer-readable storage medium. Background Art

[0002] With the development of computer technology, more and more technologies are being applied in the financial field. Traditional finance is gradually transforming into financial technology (Fintech). However, due to the security and real-time requirements of the financial industry, Fintech also places higher demands on technology.

[0003] In the field of financial technology, the relevant technology generates the card number in full and stores it in the local database. When the user opens the card, it is automatically assigned based on the card number stored in the local database. It can be seen that the card number in the relevant technology must be generated in advance, and there is an urgent need to provide a method for generating card numbers in real time. Summary of the invention

[0004] The embodiments of the present application provide a card number generation method, a card number generation device, a card number generation equipment and a computer-readable storage medium to solve the problem that card numbers must be generated in advance in the related art, and provide a method for generating card numbers in real time, thereby avoiding excessive occupation of storage space by generating all card numbers in advance and improving the performance of the database.

[0005] The technical solution of the embodiment of the present application is implemented as follows:

[0006] The present application embodiment provides a card number generation method, including:

[0007] Obtain a card selection request; wherein the card selection request carries a card product number;

[0008] Obtaining an intra-segment compressed bitmap corresponding to an available card segment in a card segment allocation table associated with the card product number; wherein the intra-segment compressed bitmap includes an ordered string constructed of character identifiers and numbers, the character identifier is used to indicate whether the card number corresponding to the sequence number at the position of the character identifier is in an allocated state, and the number is used to indicate the number of card numbers in a continuous state;

[0009] Based on the first identifier in the compressed bitmap within the segment and the first number associated with the first identifier, obtaining the serial number of the available card number in the available card segment; wherein the first identifier is used to indicate that the card number corresponding to the serial number at the position where the first identifier is located is in an unassigned state, and the character identifier includes the first identifier;

[0010] A card number is generated based on the card product number, the available cards segment, and the serial number.

[0011] A card number generating device, comprising:

[0012] An acquisition module, used for acquiring a card selection request; wherein the card selection request carries a card product number;

[0013] The acquisition module is used to acquire an intra-segment compressed bitmap corresponding to an available card segment in a card segment allocation table associated with the card product number; wherein the intra-segment compressed bitmap includes an ordered string constructed of character identifiers and numbers, the character identifier is used to indicate whether the card number corresponding to the sequence number at the position of the character identifier is in an allocated state, and the number is used to indicate the number of card numbers in a continuous state;

[0014] The acquisition module is used to acquire the serial number of the available card number in the available card segment based on the first identifier in the intra-segment compressed bitmap and the first number associated with the first identifier; wherein the first identifier is used to indicate that the card number corresponding to the serial number at the position where the first identifier is located is in an unassigned state, and the character identifier includes the first identifier;

[0015] A processing module is used to generate a card number based on the card product number, the available card segment and the serial number.

[0016] The present application provides a device, including:

[0017] The memory is used to store executable instructions; the processor is used to implement the above method when executing the executable instructions stored in the memory.

[0018] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to execute and implement the above method.

[0019] The embodiments of the present application have the following beneficial effects:

[0020] By obtaining a card selection request; wherein the card selection request carries a card product number; obtaining an intra-segment compressed bitmap corresponding to an available card segment in a card segment allocation table associated with the card product number; that is, for a high-performance processing scenario such as card selection, an intra-segment compressed bitmap is used to expand the total number of card numbers, the intra-segment compressed bitmap includes an ordered string constructed by a character identifier and a number, the character identifier is used to indicate whether the card number corresponding to the serial number at the position where the character identifier is located is in an allocated state, and the number is used to indicate the number of card numbers in a continuous state; and then based on a first identifier in the intra-segment compressed bitmap and a first number associated with the first identifier, the serial number of the available card number in the available card segment is quickly obtained; the first identifier is used to indicate that the card number corresponding to the serial number at the position where the first identifier is located is in an unallocated state, and the character identifier includes the first identifier; based on the card product number, the available card segment and the serial number, the card number is generated in real time; in this way, the problem that the card number must be generated in advance in the related art is solved, a method for generating card numbers in real time is provided, and excessive occupation of storage space by generating all card numbers in advance is avoided, thereby improving the performance of the database. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 This is an optional architecture diagram of a server provided in an embodiment of the present application;

[0022] Figure 2 This is an optional flowchart of the card number generation method provided in the embodiment of the present application;

[0023] Figure 3 is a schematic diagram of an implementation of a bitmap compression algorithm provided in an embodiment of the present application;

[0024] Figure 4 This is an optional flowchart of the card number generation method provided in the embodiment of the present application;

[0025] Figure 5 This is an optional flowchart of the card number generation method provided in the embodiment of the present application;

[0026] Figure 6 This is an optional flowchart of the card number generation method provided in the embodiment of the present application;

[0027] Figure 7 This is an optional flowchart of the card number generation method provided in the embodiment of the present application;

[0028] Figure 8 It is a schematic diagram of the scenario flow of updating the compressed bitmap in the rear segment provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0030] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict. Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meaning as those commonly understood by those skilled in the art of the technical field of the embodiments of the present application. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0031] The following describes an exemplary application of the card number generating device provided in the embodiment of the present application. The card number generating device provided in the embodiment of the present application can be implemented as a laptop, a tablet computer, a desktop computer, a mobile device (for example, a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device), an intelligent robot, and any other terminal with a screen display function, and can also be implemented as a server. The following describes an exemplary application when the card number generating device is implemented as a server.

[0032] See also Figure 1 , Figure 1 is a schematic diagram of the structure of the server 100 provided in an embodiment of the present application, Figure 1 The server 100 shown includes: at least one processor 110, at least one network interface 120, a user interface 130 and a memory 150. The various components in the server 100 are coupled together via a bus system 140. It is understood that the bus system 140 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 140 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 140 is not described in detail. Figure 1 Various buses are labeled as bus system 140 .

[0033] The processor 110 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0034] The user interface 130 includes one or more output devices 131 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 130 also includes one or more input devices 132, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0035] The memory 150 may be removable, non-removable or a combination thereof. Exemplarily, hardware devices include solid-state memory, hard disk drive, optical disk drive, etc. The memory 150 may optionally include one or more storage devices physically away from the processor 110. The memory 150 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 150 described in the embodiments of the present application is intended to include any suitable type of memory. In some embodiments, the memory 150 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as exemplarily described below.

[0036] Operating system 151, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0037] A network communication module 152, for reaching other computing devices via one or more (wired or wireless) network interfaces 120, exemplary network interfaces 120 include: Bluetooth, Wireless Fidelity (Wi-Fi), and Universal Serial Bus (USB);

[0038] The input processing module 153 is used to detect one or more user inputs or interactions from one of the one or more input devices 132 and translate the detected inputs or interactions.

[0039] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 1A card number generating device 154 stored in the memory 150 is shown. The card number generating device 154 may be a card number generating device in the server 100. It may be software in the form of a program or a plug-in, and includes the following software modules: an acquisition module 1541 and a processing module 1542. These modules are logical, and thus may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.

[0040] In other embodiments, the device provided in the embodiments of the present application can be implemented in hardware. As an example, the device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the card number generation method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application specific integrated circuits (Application Specific Integrated Circuit, ASIC), DSP, programmable logic device (Programmable Logic Device, PLD), complex programmable logic device (Complex Programmable Logic Device, CPLD), field programmable gate array (Field-Programmable Gate Array, FPGA) or other electronic components.

[0041] The card number generation method provided in the embodiment of the present application will be described below in conjunction with the exemplary application and implementation of the server 100 provided in the embodiment of the present application. Figure 2 , Figure 2 This is an optional flow chart of the card number generation method provided in the embodiment of the present application, which will be combined with Figure 2 The steps shown are explained,

[0042] Step S201, obtaining a card selection request.

[0043] The card selection request carries the card product number.

[0044] In the embodiment of the present application, when the user inputs a card selection request, the server obtains the card selection request, which carries a card product number. The card product number is used to indicate the type of card product requested for card activation.

[0045] In a feasible scenario, after receiving an external card selection request, i.e., a card opening request, the server finds all the card segments assigned to the product according to the card product number carried in the card selection request. In the embodiment of the present application, 10,000 are used as a segment for the splitting of the card segments, and one segment is a record. From the perspective of business analysis, the number of allocated card numbers for a product will not be less than 10,000. At the same time, for large products (tens of millions / hundreds of millions), the card numbers are split according to 10,000, which can greatly split the card segments and increase concurrency. There will be no large number of preemption failures due to the hot spot problem of the card segment record. The stress test performance of the hot spot update of a single record is reflected in the number of transactions processed per second (TPS) of 200, which meets the transaction TPS requirements of different products.

[0046] Step S202: obtaining an intra-segment compression bitmap corresponding to an available card segment in a card segment allocation table associated with the card product number.

[0047] The intra-segment compressed bitmap includes an ordered string constructed of character identifiers and numbers, the character identifier is used to indicate whether the card number corresponding to the sequence number at the position of the character identifier is in an assigned state, and the number is used to indicate the number of card numbers in a continuous state. The character identifier includes a first identifier and a second identifier, the first identifier is used to indicate that the card number corresponding to the sequence number at the position of the first identifier is in an unassigned state, and the second identifier is used to indicate that the card number corresponding to the sequence number at the position of the second identifier is in an assigned state.

[0048] Here, a first identifier such as a character identifier N is used to represent that the card number is unallocated and can be used, and a second identifier such as a character identifier Y represents that the card number is allocated and has been occupied; numbers are used to represent the value of a continuous state, and a continuous state includes a continuous allocated state or a continuous unallocated state. For example, if the card numbers from 0 to 9 are all unoccupied, N10 is used to represent them.

[0049] In the embodiment of the present application, when the card product number is obtained, a card segment allocation table associated with the card product number can be further obtained, and the card segment allocation table records at least available card segments and the intra-segment compression bitmap corresponding to the available card segments. The intra-segment compression bitmap corresponding to the available card segments is used to query the serial number of the unused card number.

[0050] The card number consists of the following parts: the card issuing bank identification number (Bank Identification Number, BIN) + card segment + serial number + 1 check digit. If the card number is generated in advance, a large number of card numbers will be generated, wasting storage resources. In order to increase the total number of card numbers and realize the rapid positioning of a certain bit in the bitmap, this application adopts a bitmap compression algorithm.

[0051] When a new record in a segment is initialized, the number of available card numbers is a preset number, such as 10,000, which can be expressed as N10000. When a card activation transaction is obtained, the query starts from a certain position in the compressed bitmap, such as the leftmost position, to find the first N value, and then find the next N / Y value from the position of the N value. If the tail of the compressed bitmap is queried, the total length of the bitmap is used as the end position. The value between the N value and the next N / Y value represents a continuous unused card number segment.

[0052] Step S203: acquiring the serial number of the available card number in the available card segment based on the first identifier in the intra-segment compression bitmap and the first number associated with the first identifier.

[0053] In the embodiment of the present application, the serial number part in the card number has a sequence. Since it is sequential, the serial number of the sequence is obtained, and the corresponding card number can be constructed according to the serial number. In the embodiment of the present application, when step S203 obtains the serial number of the available card number in the available card segment based on the intra-segment compression bitmap, the serial number of the available card number in the available card segment can be obtained based on the intra-segment compression bitmap and a random number corresponding to an available card segment.

[0054] For example, see Figure 3 As shown in the figure, assuming that the random number between 1 and 10000 is 3862, when the card number with serial number 3862 is occupied, the intra-segment compression bitmap corresponding to the available card segment can be updated to N3861Y1N6238, that is, the card numbers of the previous consecutive card segments 1-3861 are not occupied, the card number with serial number 3862 is occupied, and the card numbers with serial numbers 3862-10000 are not occupied. When another request comes, start searching from the leftmost side, the first The value after N is 3861. A number between 1 and 3861, such as 732, is randomly selected to split the compressed bitmap within the segment. The updated compressed bitmap within the segment is as follows: N731Y1N3129Y1N6138, and so on. Whenever a new card number is occupied, this strategy can be used to update the compressed bitmap within the segment, and update the available card numbers and the number of used card numbers. When all the card numbers are used up, the used status is updated so that the card selection operation will no longer be performed on this segment.

[0055] The card number generation method provided in the present application adopts a compressed bitmap. Since the compressed bitmap uses the character identifier N / Y to store the card number status and uses numbers to store the corresponding quantity, when performing a query, the unused card number can be found by searching for the first N characters from front to back with a specific query index. In terms of time complexity, searching for an unused card number in a card segment is Y9999N1, and the performance is O(1). In terms of storage, the worst-case compression will produce the following data form N1Y1...N1Y1. This kind of interval available card number data form has a card storage byte count of 20,000 for 10,000 consecutive card segments. For this scenario, the present application selects the first consecutive unused card segment from front to back for each query and makes a random value, so that the compression performance can be better guaranteed. After multiple tests, the card storage byte count of 10,000 consecutive card segments is about 1,000 bytes. Whether it is 20,000 bytes or 1,000 bytes, it is within the TEXT type storage space range of the distributed database. It can be seen that the present application optimizes the card number generation and card selection scheme.

[0056] Step S204, generating a card number based on the card product number, the available card segment and the serial number.

[0057] In the embodiment of the present application, when the card product number, the available card segment and the serial number are obtained, the card product number, the available card segment and the serial number can be spliced ​​in a card splicing manner to generate a card number.

[0058] The card number generation method provided by the present application comprises the following steps: obtaining a card selection request, wherein the card selection request carries a card product number; obtaining an intra-segment compressed bitmap corresponding to an available card segment in a card segment allocation table associated with the card product number; that is, for a high-performance processing scenario such as card selection, using an intra-segment compressed bitmap to expand the total number of card numbers, the intra-segment compressed bitmap comprising an ordered string constructed of character identifiers and numbers, the character identifier being used to indicate whether a card number corresponding to a sequence number at a position where the character identifier is located is in an allocated state, and the number being used to indicate the number of card numbers in a continuous state; and then based on a first identifier in the intra-segment compressed bitmap and a first number associated with the first identifier, quickly obtaining the sequence number of available card numbers in the available card segment; the first identifier being used to indicate that a card number corresponding to a sequence number at a position where the first identifier is located is in an unallocated state, and the character identifier comprising the first identifier; and generating a card number in real time based on the card product number, the available card segment and the sequence number; thus, the problem that the card number must be generated in advance in the related art is solved, a method for generating card numbers in real time is provided, and excessive occupation of storage space by generating all card numbers in advance is avoided, thereby improving the performance of the database.

[0059] See also Figure 4 , Figure 4 This is an optional flow chart of the card number generation method provided in the embodiment of the present application, which will be combined with Figure 4 The steps shown are explained,

[0060] Step S301, obtaining a card selection request.

[0061] The card selection request carries the card product number.

[0062] Step S302: Create a query index based on the card product number and the card segment identification information.

[0063] The card segment identification information is used to indicate whether the card numbers in the segment have been allocated.

[0064] In the embodiment of the present application, the card segment allocation table also includes card segment identification information, which is used to indicate whether the card numbers in the segment have been allocated.

[0065] After receiving the external card selection request, the card product number carried in the card selection request is used to query the unused card number segments assigned to the card product. In order to increase randomness, the database random is used for querying. The structured query language (SQL) of the query is as follows:

[0066] SELECT*FROM TM_CARD_SEG WHERE RUN_OUT='N'AND PRODUCT_CD='100070'ORDER BY RAND()LIMIT 1;

[0067] Step S303: query the distributed database using the query index to obtain available card segments.

[0068] In the embodiment of the present application, the above-mentioned SQL language is used for query, and a card segment record can be randomly obtained. At the same time, a joint index of the card segment identification information (RUN_OUT) and the card product number (PRODUCT_CD) is created in the TM_CARD_SEG table, and the database index can be used to quickly locate the available card segments under the card product.

[0069] In other embodiments of the present application, when step S303 performs a query in a distributed database using a query index to obtain an available card segment, the following steps may also be performed: a locking operation is performed on the available card segment; wherein the locked available card segment is in a locked state. Here, the pessimistic lock of the distributed database may be used to lock the available card segment record to prevent data inconsistency caused by concurrency, thereby ensuring the correctness of the compressed bitmap update sequence in the available card segment in a high-concurrency scenario.

[0070] Step S304, obtaining the intra-segment compression bitmap corresponding to the available card segment in the card segment allocation table associated with the card product number.

[0071] In an embodiment of the present application, the intra-segment compressed bitmap includes an ordered string constructed of character identifiers and numbers, the character identifier is used to indicate whether the card number corresponding to the serial number at the position of the character identifier is in an allocated state, and the number is used to indicate the number of card numbers in a continuous state, and the continuous state includes a continuous allocated state or a continuous unallocated state.

[0072] Step S305: acquiring the serial number of the available card number in the available card segment based on the first identifier in the intra-segment compression bitmap and the first number associated with the first identifier.

[0073] In the embodiment of the present application, the intra-segment compressed bitmap includes an ordered string. In the process of obtaining the serial number of the available card number in the available card segment based on the intra-segment compressed bitmap, the serial number of the available card number in any available card segment can be obtained based on N and the first number associated with N in the intra-segment compressed bitmap; or the serial number of the available card number in the available card segment can be obtained in an ordered traversal manner and in a traversal order. It should be noted that the method of obtaining the serial number of the available card number in the available card segment in an ordered traversal manner and in a traversal order can avoid the generation of the following intermittent available card number data form N1Y1...N1Y1 as much as possible, compared with the method of obtaining the serial number of the available card number in the available card segment in an unordered manner.

[0074] In other embodiments of the present application, step S305 obtains the serial number of the available card number in the available card segment based on the first identifier in the compressed bitmap within the segment and the first number associated with the first identifier, which can be obtained by Figure 5 The steps shown achieve:

[0075] Step S3051, determine the first first identifier according to the traversal order from front to back corresponding to the ordered string.

[0076] The first identifier is used to indicate that the card number corresponding to the serial number at the position of the first identifier is in an unassigned state, and the character identifier includes the first identifier.

[0077] Step S3052: Determine a first random number based on the first number associated with the first first identifier.

[0078] Wherein, the first random number is greater than or equal to 1 and less than or equal to the first number;

[0079] Here, a random selection is made from 1 to the first number, and the first random number is used to improve the randomness of the card number selection.

[0080] Step S3053, determine the number of sequence numbers before the bitmap corresponding to the first random number in the intra-segment compression bitmap, and calculate the sum of the number of sequence numbers plus 1 to obtain the sequence number.

[0081] For example, see Figure 8As shown, taking the intra-segment compression bitmap Y3 ... N60 ... Y1 ... N1 as an example, in order to limit the subsequent description, the front and back parts of the intra-segment compression bitmap Y3 ... N60 ... Y1 ... N1 are described in more detail in Figure 8 Here, according to the traversal order from front to back corresponding to the ordered string, the first N in the segment compression bitmap Y3N3Y5N2...N5N1 is determined to find the unused card number, and the value after N is determined at the same time. Then, the value after N is used as the maximum value for Random to find a random number between 1 and 3, such as Figure 8 As shown, random generates a random number between 1 and 3. Figure 8 The random number in is 1. Further, it is determined that the number of serial numbers before the bitmap corresponding to 1 in the compression bitmap within the segment is 3, and the sum of 3 plus 1 is calculated, and the serial number is 4.

[0082] In other embodiments of the present application, after determining the first random number based on the first number associated with the first first identifier in step S3052, the compressed bitmap within the segment may be updated. Figure 6 The steps shown achieve:

[0083] Step 1, based on the first random number, a part of the bitmaps in the compressed bitmap in the segment is subjected to fission processing to obtain a bitmap after fission.

[0084] In the embodiment of the present application, the selected first random number is different, and the updated intra-segment compression bitmap is different.

[0085] Here, the intra-segment compressed bitmap includes an ordered string corresponding to a partial bitmap and an ordered string corresponding to a remaining bitmap.

[0086] Among them, the partial bitmap includes a bitmap corresponding to the first identifier and the first digit; the fissioned bitmap includes at least a bitmap corresponding to the first identifier and the second digit, and a bitmap corresponding to the second identifier and the third digit; the second identifier is used to indicate that the card number corresponding to the serial number at the position of the second identifier is in an allocated state, and the character identifier includes the second identifier; the second digit is smaller than the first digit.

[0087] In the embodiment of the present application, Step 1 performs fission processing on a portion of the bitmap in the intra-segment compressed bitmap based on the first random number to obtain a bitmap after fission, which can be achieved by the following steps:

[0088] First, a first position occupied by a first random number in the partial bitmap NX1 is determined.

[0089] Among them, N is the first identifier, and X1 is the first number associated with the first identifier.

[0090] Secondly, the first position in the partial bitmap NX1 is fissioned into a newly added second identifier Y, and the obtained bitmap after fission is Y1NX1-1, NX1-1Y1 or NX2Y1NX3.

[0091] Among them, X2 and X3 are natural numbers, and the sum of X2, X3 and 1 is X1.

[0092] Here, still Figure 8 Take the intra-segment compression bitmap Y3N3Y5N2...N5N1 in the example, and determine that the partial bitmap NX1 is N3. At this time, there are three cases of fission:

[0093] The first one, such as Figure 8 If the random number is 1, it means that the first bit needs to be occupied and changed to Y, then N3 becomes Y1N2, and then the nearest N / Y value is found forward and backward respectively, such as Figure 8 As shown, the next N / Y is Y5, and the bitmap after fission is Y1N2. The last N / Y value in Y1N2 is N, which is different from Y and cannot be merged. The previous N / Y value is Y3, which is the same as the previous one in the bitmap Y1N2 after fission. Figure 1 If they are the same, they can be merged, and Y3 and Y1 are merged to become Y4, thus generating a new bitmap Y4N2Y5N2...N5N1.

[0094] The second type, the random number is 2, which means that the second bit needs to be occupied and changed to Y, then N3 becomes N1Y1N1, and then the nearest N / Y value is found forward and backward respectively. The next N / Y is Y5, and the bitmap after fission is N1Y1N1, where the last N / Y value is N, which is different from Y and cannot be merged. The previous N / Y value is N1, which is different from the previous image of the bitmap N1Y1N1 after fission and cannot be merged, so a new bitmap Y3N1Y1N1Y5N2...N5N1 is generated.

[0095] The third type, the random number is 3, which means that the last bit needs to be occupied and changed to Y, then N3 becomes N2Y1, and then the nearest N / Y value is found forward and backward respectively. The next N / Y is Y5, and the bitmap after fission is N2Y1. The last N / Y value in N2Y1 is Y, so it can be merged, and the previous N / Y value is Y3, which is different from the first image of the bitmap N2Y1 after fission, and cannot be merged, so a new bitmap Y3N2Y6N2...N5N1 is generated.

[0096] Step 2, merging the remaining bitmaps in the intra-segment compression bitmap and the adjacent bitmaps with the second identifier in the fissioned bitmap to obtain an updated intra-segment compression bitmap.

[0097] Among them, the remaining bitmap and the partial bitmap constitute the intra-segment compressed bitmap.

[0098] Step S306, generating a card number based on the card product number, the available card segment and the serial number.

[0099] In other embodiments of the present application, step S306 generates a card number based on the card product number, the available card segment and the serial number, which can be implemented by the following steps: splicing the card product number, the available card segment and the serial number according to the card number splicing method to generate a card number and a check digit of the card number; wherein the check digit is used to indicate whether the card number meets the card number generation conditions. Exemplarily, the check digit is used to indicate whether the card number meets the correct card number generation conditions.

[0100] In the embodiment of the present application, when the server obtains a random card selection request, it finds the corresponding unused card segment according to the card product number carried in the card selection request, selects an available segment in the card segment, parses the compressed bitmap in the segment, finds the card number sequence number in the N state, updates the sequence diagram to occupied, updates the number of available card numbers and the number of used card numbers, and summarizes the total number of the previous N and Y states, so as to determine the sequence number where the card number is located, and generates a check digit after splicing according to the sequence number and the known card BIN and card segment information, and actually generates the card number into the card number table, and returns the card number to the caller, so as to realize real-time and efficient generation of card numbers.

[0101] It should be noted that, for the description of the same steps and the same contents in this embodiment as those in other embodiments, reference can be made to the description in other embodiments and will not be repeated here.

[0102] In a feasible scenario, see Figure 7 , Figure 7 This is an optional flow chart of the card number generation method provided in the embodiment of the present application, which will be combined with Figure 7 The steps shown detail the process of card number generation.

[0103] Step S401, obtaining a card selection request.

[0104] The card selection request carries the card product number.

[0105] Step S402: query the available card segments in the card segment allocation table according to the card product number.

[0106] For example, see Figure 8 As shown, the card BIN corresponding to the card product number is 623633, and the card segments corresponding to the card product number include 90000000, 90000001, and 90000002. At this time, the available card segments in the card segment allocation table are queried according to the card product number, which are two available card segments 90000000 and 90000002. It is assumed that the available card segment finally selected is 90000002.

[0107] Step S403: Use pessimistic locking to lock the selected available card segment.

[0108] Here, a database pessimistic lock is used to lock the record of card segment 90000002 to prevent data inconsistency caused by concurrency, which can ensure the correctness of the compressed bitmap update sequence in this segment in a high-concurrency scenario.

[0109] Step S404: obtaining a card segment compression bitmap of the available card segments.

[0110] Here, the card segment compression bitmap of card segment 90000002 is obtained as Y3…N60…Y1…N1.

[0111] Step S405: Process the card segment compressed bitmap according to the bitmap random acquisition algorithm to find the serial number of the available card number in the available card segment.

[0112] Furthermore, the intra-segment compression bitmap Y3…N60…Y1…N1 of the card segment 90000002 is parsed to obtain the serial number corresponding to the unused card number and update it to used. The algorithm for searching and updating the intra-segment compression bitmap is as follows:

[0113] Among them, N means unused, and Y means used. Since the intra-segment compressed bitmap is an ordered string, by traversing the characters in the ordered string and searching from front to back, the unused card number can be found by finding the first N. At the same time, the value after N is determined, and then the value after N is used as the maximum value for Random to find the value after 1-N ( Figure 8 The value is equal to a random number between 3), and the split is performed according to this value, such as Figure 8 As shown, random generates a random number between 1 and 3. Figure 8 If the random number is 1, it means that the first bit needs to be occupied and changed to Y, then N3 becomes Y1N2, and then the nearest N / Y value is found forward and backward respectively, such as Figure 8 As shown, the next N / Y is Y5, and the bitmap after fission is Y1N2, where the last N / Y value is N, which is different from Y and cannot be merged, and the previous N / Y value is Y3, which is the same as the previous one in the bitmap Y1N2 after fission. Figure 1 If they are the same, they can be merged, and Y3 and Y1 are merged to become Y4, thus generating a new bitmap, and at the same time calculating the position of the serial number in the entire bitmap. By merging the original serial numbers before N3, it can be deduced that there are 3 serial numbers before N3, and the random value is 1, so it can be concluded that the serial number in the bitmap of this card segment is 4.

[0114] Step S406, generating a card number based on the card product number, the available card segment and the serial number.

[0115] Here, according to the card BIN and card segment in the card segment table, the last check digit is generated, such as 3, which represents the card number generated under the correct card number generation conditions. The card number at this position can be obtained as 6236339000000200043, such as Figure 8 shown.

[0116] Step S407: insert the generated card number into the card number table.

[0117] Furthermore, after the card number is generated, the card number is added to the card number table. The card number table is named according to the card BIN and the card segment. According to the storage requirements of the distributed database (Data Base, DB), the number of card numbers stored in each card table does not exceed 10 million, so each card table stores 10 million card numbers. According to the above card number, it can be obtained that the card number table to which it belongs is TM_CARD_B623633_P90000, and the card number is stored in the card number table. Since the card number is the primary key in each card number table, the unique constraint of the database can be used to ensure that the card number will not be regenerated. Therefore, when the insertion fails, it can be found that the card number has been used and the card needs to be reselected.

[0118] Step S408, fill the updated intra-segment compression bitmap into the allocation table and increase the number of used card numbers.

[0119] Here, the updated intra-segment compression bitmap is filled into the allocation table, and the number of used card numbers of the card segment is increased by 1.

[0120] From the above content, it can be seen that the card number generation method provided by the present application eliminates the problem that the card segment is actually unavailable but the cache is available due to the inconsistency of the cache database caused by the use of the cache structure. At the same time, for the overall storage, the card segment and the card segment compression bitmap are used for card selection, and the new card segment does not need to be initialized first, which greatly reduces the storage capacity overhead. The card number is stored only after the card is actually opened, which also ensures that the storage grows with the business growth.

[0121] The following is an exemplary structure of the card number generating device 154 provided in the embodiment of the present application implemented as a software module. In some embodiments, for example Figure 1 As shown, the software module stored in the card number generating device 154 of the memory 150 may be the card number generating device in the server 100, including:

[0122] The acquisition module 1541 is used to acquire a card selection request, wherein the card selection request carries a card product number;

[0123] The acquisition module 1541 is used to acquire the intra-segment compression bitmap corresponding to the available card segment in the card segment allocation table associated with the card product number; wherein the intra-segment compression bitmap includes an ordered string constructed by character identifiers and numbers, the character identifier is used to indicate whether the card number corresponding to the sequence number at the position of the character identifier is in an allocated state, and the number is used to indicate the number of card numbers in a continuous state;

[0124] The acquisition module 1541 is used to acquire the serial number of the available card number in the available card segment based on the first identifier in the intra-segment compression bitmap and the first number associated with the first identifier; wherein the first identifier is used to indicate that the card number corresponding to the serial number at the position where the first identifier is located is in an unassigned state, and the character identifier includes the first identifier;

[0125] The processing module 1542 is used to generate a card number based on the card product number, the available card segment and the serial number.

[0126] In some embodiments of the present application, the processing module 1542 is used to create a query index based on the card product number and the card segment identification information; wherein the card segment identification information is used to indicate whether the card numbers in the segment have been allocated;

[0127] The acquisition module 1541 is used to query the distributed database using the query index to obtain available card segments.

[0128] In some embodiments of the present application, the processing module 1542 is used to lock the available card segment; wherein the locked available card segment is in a locked state.

[0129] In some embodiments of the present application, the intra-segment compressed bitmap includes an ordered string constructed of character identifiers and numbers, the character identifier is used to indicate whether the card number corresponding to the serial number at the position of the character identifier is in an allocated state, and the number is used to indicate the number of card numbers in a continuous state, and the continuous state includes a continuous allocated state or a continuous unallocated state.

[0130] In some embodiments of the present application, the processing module 1542 is used to determine the first first identifier according to the traversal order from front to back corresponding to the ordered string; wherein the first identifier is used to indicate that the card number corresponding to the serial number at the position of the first identifier is in an unassigned state, and the character identifier includes the first identifier; based on the first number associated with the first first identifier, determine the first random number; determine the number of serial numbers before the bitmap corresponding to the first random number in the compressed bitmap within the segment, and calculate the sum of the number of serial numbers plus 1 to obtain the serial number.

[0131] In some embodiments of the present application, the processing module 1542 is used to perform fission processing on a part of the bitmap in the intra-segment compressed bitmap based on a first random number to obtain a bitmap after fission; wherein the part of the bitmap includes a bitmap corresponding to the first identifier and the first number; the bitmap after fission includes at least a bitmap corresponding to the first identifier and the second number, and a bitmap corresponding to the second identifier and the third number; the second identifier is used to indicate that the card number corresponding to the serial number at the position of the second identifier is in an assigned state, and the character identifier includes the second identifier; the remaining bitmap in the intra-segment compressed bitmap and the adjacent bitmap with the second identifier in the bitmap after fission are merged to obtain an updated intra-segment compressed bitmap; wherein the remaining bitmap and the part of the bitmap constitute the intra-segment compressed bitmap.

[0132] In some embodiments of the present application, processing module 1542 is used to determine the first position occupied by the first random number in the partial bitmap NX1; wherein N is the first identifier, and X1 is the first number associated with the first identifier; the first position in the partial bitmap NX1 is fissioned into a newly added second identifier Y, and the bitmap after fission is Y1NX1-1, NX1-1Y1 or NX2Y1NX3; wherein X2 and X3 are natural numbers, and the sum of X2, X3, and 1 is X1.

[0133] In some embodiments of the present application, the processing module 1542 is used to splice the card product number, the available card segment and the serial number according to the card number splicing method to generate the card number and the check digit of the card number; wherein the check digit is used to indicate whether the card number meets the card number generation conditions.

[0134] The card number generating device provided by the present application obtains a card selection request, wherein the card selection request carries a card product number; obtains an intra-segment compressed bitmap corresponding to an available card segment in a card segment allocation table associated with the card product number; that is, for a high-performance processing scenario such as card selection, an intra-segment compressed bitmap is used to expand the total number of card numbers, the intra-segment compressed bitmap includes an ordered string constructed by a character identifier and a number, the character identifier is used to indicate whether the card number corresponding to the sequence number at the position where the character identifier is located is in an allocated state, and the number is used to indicate the number of card numbers in a continuous state; and then based on a first identifier in the intra-segment compressed bitmap and a first number associated with the first identifier, the sequence number of the available card number in the available card segment is quickly obtained; the first identifier is used to indicate that the card number corresponding to the sequence number at the position where the first identifier is located is in an unallocated state, and the character identifier includes the first identifier; based on the card product number, the available card segment and the sequence number, the card number is generated in real time; in this way, the problem that the card number must be generated in advance in the related art is solved, a method for generating card numbers in real time is provided, and excessive occupation of storage space by generating all card numbers in advance is avoided, thereby improving the use performance of the database.

[0135] It should be noted that the description of the device of the embodiment of the present application is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment, so it is not repeated. For technical details not disclosed in the embodiment of the device, please refer to the description of the method embodiment of the present application for understanding.

[0136] The present application embodiment provides a storage medium storing executable instructions, wherein the executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the method provided by the present application embodiment, for example, Figure 2 and Figure 4 The method shown.

[0137] In some embodiments, the storage medium can be a computer-readable storage medium, for example, a ferroelectric random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disk, or a compact disk read-only memory (CD-ROM), etc.; it can also be various devices including one or any combination of the above memories.

[0138] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0139] As examples, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file storing other programs or data, such as in one or more scripts in a Hypertext Markup Language (Hypertext Markup Language) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions). As examples, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed at multiple sites and interconnected by a communication network.

[0140] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A card number generation method, characterized in that: include: Obtain a card selection request; wherein the card selection request carries a card product number; Obtaining an intra-segment compressed bitmap corresponding to an available card segment in a card segment allocation table associated with the card product number; wherein the intra-segment compressed bitmap includes an ordered string constructed of character identifiers and numbers, the character identifier is used to indicate whether the card number corresponding to the sequence number at the position of the character identifier is in an allocated state, and the number is used to indicate the number of card numbers in a continuous state; Based on the first identifier in the compressed bitmap within the segment and the first number associated with the first identifier, obtaining the serial number of the available card number in the available card segment; wherein the first identifier is used to indicate that the card number corresponding to the serial number at the position where the first identifier is located is in an unassigned state, and the character identifier includes the first identifier; generating a card number based on the card product number, the available card segment and the serial number; The acquiring the sequence number of the available card number in the available card segment based on the first identifier in the intra-segment compressed bitmap and the first number associated with the first identifier comprises: Determine the first first identifier according to the traversal order from front to back corresponding to the ordered string; Determine a first random number based on a first number associated with the first identifier; wherein the first random number is greater than or equal to 1 and less than or equal to the first number; Based on the first random number, a part of the bitmap in the intra-segment compressed bitmap is subjected to fission processing to obtain a bitmap after fission; wherein the part of the bitmap includes a bitmap corresponding to the first identifier and the first number; the bitmap after fission includes at least a bitmap corresponding to the first identifier and the second number, and a bitmap corresponding to the second identifier and the third number; the second identifier is used to indicate that the card number corresponding to the sequence number at the position of the second identifier is in an allocated state, and the character identifier includes the second identifier; Merging the remaining bitmap in the intra-segment compression bitmap and the adjacent bitmap with the second identifier in the bitmap after fission to obtain an updated intra-segment compression bitmap; wherein the remaining bitmap and the partial bitmap constitute the intra-segment compression bitmap; Determine the number of sequence numbers before the bitmap corresponding to the first random number in the intra-segment compression bitmap, and calculate the sum of the number of sequence numbers plus 1 to obtain the sequence number.

2. The method according to claim 1, characterized in that After obtaining the card selection request, the method further includes: Creating a query index based on the card product number and the card segment identification information; wherein the card segment identification information is used to indicate whether the card numbers in the segment have been allocated; The query index is used to query in the distributed database to obtain the available card segment.

3. The method according to claim 2, characterized in that When the query is performed in the distributed database using the query index to obtain the available card segment, the method further includes: The available card segment is locked; wherein the available card segment after locking is in a locked state.

4. The method according to claim 1, characterized in that: The fissioning of a part of the bitmaps in the intra-segment compressed bitmap based on the first random number to obtain a bitmap after fissioning includes: Determine a first position occupied by the first random number in the partial bitmap NX1, wherein N is the first identifier and X1 is a first number associated with the first identifier; The first position in the partial bitmap NX1 is fissioned into the newly added second identifier Y, and the fissioned bitmap is obtained as Y1 NX1-1, NX1-1Y1 or NX2Y1 NX3; wherein, X2 and X3 are natural numbers, and the sum of X2, X3 and 1 is X1.

5. The method according to any one of claims 1 to 4, characterized in that The generating a card number based on the card product number, the available card segment and the serial number comprises: The card product number, the available card segment and the serial number are concatenated in a card number concatenation manner to generate the card number and a check digit of the card number; wherein the check digit is used to indicate whether the card number meets the card number generation conditions.

6. A card number generating device, characterized in that: include: An acquisition module, used for acquiring a card selection request; wherein the card selection request carries a card product number; The acquisition module is used to acquire an intra-segment compressed bitmap corresponding to an available card segment in a card segment allocation table associated with the card product number; wherein the intra-segment compressed bitmap includes an ordered string constructed of character identifiers and numbers, the character identifier is used to indicate whether the card number corresponding to the sequence number at the position of the character identifier is in an allocated state, and the number is used to indicate the number of card numbers in a continuous state; The acquisition module is used to acquire the serial number of the available card number in the available card segment based on the first identifier in the intra-segment compressed bitmap and the first number associated with the first identifier; wherein the first identifier is used to indicate that the card number corresponding to the serial number at the position where the first identifier is located is in an unassigned state, and the character identifier includes the first identifier; A processing module, configured to generate a card number based on the card product number, the available card segment and the serial number; The processing module is used to determine the first first identifier according to the traversal order from front to back corresponding to the ordered string; wherein the first identifier is used to indicate that the card number corresponding to the serial number at the position of the first identifier is in an unassigned state, and the character identifier includes the first identifier; based on the first number associated with the first first identifier, determine the first random number; determine the number of serial numbers before the bitmap corresponding to the first random number in the compressed bitmap within the segment, and calculate the sum of the number of serial numbers plus 1 to obtain the serial number; A processing module is used to perform fission processing on a part of the bitmap in the intra-segment compressed bitmap based on a first random number to obtain a bitmap after fission; wherein the part of the bitmap includes a bitmap corresponding to a first identifier and a first number; the bitmap after fission includes at least a bitmap corresponding to the first identifier and a second number, and a bitmap corresponding to the second identifier and a third number; the second identifier is used to indicate that the card number corresponding to the serial number at the position of the second identifier is in an assigned state, and the character identifier includes the second identifier; the remaining bitmap in the intra-segment compressed bitmap and the adjacent bitmap with the second identifier in the bitmap after fission are merged to obtain an updated intra-segment compressed bitmap; wherein the remaining bitmap and the part of the bitmap constitute the intra-segment compressed bitmap.

7. A card number generating device, characterized in that: include: A memory for storing executable instructions; A processor, configured to implement the method according to any one of claims 1 to 5 when executing the executable instructions stored in the memory.

8. A computer-readable storage medium, characterized in that: Executable instructions are stored, which are used to cause a processor to execute and implement the method described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Generation method for card number and apparatus thereof

    CN105095263A

  • Entity card number generation method and terminal equipment

    CN107622102A

  • Card number generation method, device and server, and storage medium

    CN108829650A

  • Identifier processing method and device, storage medium and electronic device

    CN111353773A

  • Card number configuration method, device and apparatus and computer storage medium

    CN112612790A