WO2019047351A1 - Method, device, electronic apparatus and medium for generating physical card number - Google Patents
Method, device, electronic apparatus and medium for generating physical card number Download PDFInfo
- Publication number
- WO2019047351A1 WO2019047351A1 PCT/CN2017/108621 CN2017108621W WO2019047351A1 WO 2019047351 A1 WO2019047351 A1 WO 2019047351A1 CN 2017108621 W CN2017108621 W CN 2017108621W WO 2019047351 A1 WO2019047351 A1 WO 2019047351A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- value
- sequence
- sequence value
- server
- random code
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/70—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
- G06F21/71—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure computing or processing of information
- G06F21/73—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure computing or processing of information by creating or determining hardware identification, e.g. serial numbers
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F7/00—Methods or arrangements for processing data by operating upon the order or content of the data handled
- G06F7/58—Random or pseudo-random number generators
- G06F7/582—Pseudo-random number generators
Definitions
- the present application relates to a data processing technology, and in particular, to a method, an apparatus, an electronic device, and a medium for generating a physical card number.
- a corresponding type of physical card number is generated for a certain type of service, which is usually generated in a server of a business management system, based on functions provided by various bursting languages such as Java and Javascript. Random number. After each random number is generated, it is necessary to determine whether the random value is a physical card number already existing in the service management system. If the random value is not a physical card number already existing in the service management system, the random value may be recorded to use the random value as a new physical card number for making a new physical card.
- the embodiment of the present application provides a method, a device, an electronic device, and a medium for generating a physical card number, so as to solve the problem that the generation efficiency of the physical card number in the prior art is relatively low and the duplicate card number is prone to occur. question.
- a first aspect of the embodiments of the present application provides a method for generating a physical card number, including:
- a second aspect of the embodiments of the present application provides a physical card number generating apparatus, including:
- a creating module configured to create a sequence object in a database pre-established by the first server
- a first obtaining module configured to: when receiving a sequence value call request issued by the second server, acquire the created sequence object, and read a current sequence value of the sequence object;
- a generating module configured to generate a next sequence value of the sequence object according to a preset step size and the current sequence value, and update a current sequence value of the sequence object to the next sequence value;
- a second obtaining module configured to acquire a card number length value carried by the sequence value invoking request, and obtain a character length of the updated current sequence value
- a third obtaining module configured to determine, according to the difference between the card number length value and the character length of the current sequence value
- a fourth obtaining module configured to acquire the selection according to a selection probability preset by each of the values One or more of the values having the highest probability, and determining one of the values as the random code generated by the current engraving;
- a returning module configured to return the updated current sequence value to the second server, so that the second server outputs the updated current sequence value as a physical card number.
- a third aspect of the embodiments of the present application provides an electronic device, including a memory, a processor, and computer readable instructions stored on the memory and executable on the processor, the processor The computer program is executed to implement the steps of the physical card number generating method according to the first aspect described above.
- a fourth aspect of the embodiments of the present application provides a computer readable storage medium storing computer readable instructions, the computer readable instructions being executed by at least one processor The steps of the physical card number generating method as described in the first aspect above.
- the service system only needs to send a sequence value call request to the first server based on the second server, so that the current sequence value of the sequence object created by the first server and the random code generated by the first server can be performed.
- Splicing to output as a new physical card number. Since the current sequence value of the sequence object is updated after the actual generation, there is no repeated distribution of the same entity card number, thereby enabling the service system to directly obtain the current sequence value of the sequence object each time it is obtained.
- the result of the splicing with a random code is output as the physical card number, and it is not necessary to judge whether the physical card number already exists, thereby improving the generation efficiency of the physical card number.
- the random code of different character lengths can be dynamically obtained according to the difference between the card number length value and the current sequence value; and the first server is spliced by splicing the random code with the current sequence value
- the output physical card number can match the actual card number length value required by the service system, thereby satisfying the actual needs of different service systems; since the random code has different lengths and its value is random, it is compared with the current sequence value.
- the splicing further reduces the repetition probability of the physical card number.
- multiple service systems can share sequence objects in the database of the first server, so that a unique physical card number is generated across the service system and across servers, thereby avoiding the problem of duplicate physical card numbers between multiple distributed servers. .
- FIG. 1 is a system architecture diagram applicable to a method for generating a physical card number according to an embodiment of the present application
- FIG. 2 is a flowchart of an implementation of a method for generating a physical card number according to an embodiment of the present application
- FIG. 3 is a flowchart of a specific implementation of a method for generating a physical card number S201 according to an embodiment of the present application
- FIG. 4 is a flowchart of an implementation of a method for generating a physical card number according to another embodiment of the present application.
- FIG. 5 is a flowchart of an implementation of a method for generating a physical card number according to another embodiment of the present disclosure
- FIG. 6 is a flowchart of a specific implementation of a method for generating a physical card number S207 according to an embodiment of the present application
- FIG. 7 is a structural block diagram of a physical card number generating apparatus according to an embodiment of the present application.
- FIG. 8 is a schematic diagram of an electronic device according to an embodiment of the present application.
- FIG. 1 is a system architecture diagram of a method for generating a physical card number provided by an embodiment of the present application. For convenience of description, only parts related to the embodiment are shown.
- the system is composed of a first server 11 and a plurality of second servers 12.
- the first server 11 is configured to distribute the current sequence value after each update of the sequence object according to the sequence object created in advance, so that each sequence value corresponding to the sequence object can be spliced with a random code as a The physical card number used to make the physical card.
- the above sequence object exists in the database of the first server 11.
- the foregoing database is further configured to store the service data related to the second server 12, so that the first server 11 can manage the service data and distribute the business data of the same number of the physical card number for the second server 12. No additional setup of the database is required.
- the second server 12 is configured to, as a requesting client, send a sequence value call request to the first server 11 to enable the first server 11 to update the current sequence value of the sequence object according to the request.
- the second server 12 is also used to run a business system of one or more types of services, so that each response returned by the first server can be output as a physical card number required by the business system.
- FIG. 2 is a flowchart showing an implementation of a method for generating a physical card number according to an embodiment of the present application, which is described in detail as follows:
- S201 Create a sequence object in a database pre-established by the first server.
- the database pre-established by the first server includes but is not limited to Omcle, Sql
- the database established in the embodiment of the present application is preferably an Oracle database.
- a sequence object is a database object that is used to generate a series of unique values, which is a special one-line table.
- FIG. 3 shows a specific implementation process of the physical card number generation method S201 provided by the embodiment of the present application, which is described in detail as follows:
- S2011 Acquire an attribute parameter input by the user related to the sequence object, where the attribute parameter includes a minimum sequence value, a maximum sequence value, a step size, an initial value, and a loop option value.
- an instruction is created according to a sequence input by the user, such as create
- the sequence and the create any sequence statement, etc. create an Oracle sequence object.
- the sequence creation instruction carries the attribute parameters related to the sequence object that the user needs to create, including the minimum sequence value, the maximum sequence value, the step size, the initial value, and the loop option value.
- sequence creation instruction carrying the attribute parameter related to the sequence object that the user needs to create may be defined as follows:
- NOCYCLE is the loop option value of the sequence object, and CYCLE indicates that the sequence object can be looped, and N OCYCLE indicates that the sequence object cannot be looped.
- the step size indicates the difference between the next sequence value and the current sequence value in the sequence object.
- S2012 In a database pre-established by the first server, a sequence object is created based on the attribute parameter, and the initial value is output as a current sequence value of the sequence object.
- each attribute parameter in the sequence creation instruction is parsed to create a sequence object matching the attribute parameter in the database.
- the attribute parameter further includes a memory option value. If the memory option value is CACHE, the sequence object is stored in memory to improve the processing speed of the sequence value and improve the efficiency of each sequence value in the sequence object.
- each sequence value corresponding to the sequence object is finally output together with the random code as a physical card number required by the service system, so that the attribute parameter of the sequence object input by the user can be provided to the user.
- More custom space allows the user to customize the generation rules of a part of the physical card number according to the card-making requirements of the business system, thus improving the flexibility of the distribution of the physical card number to a certain extent.
- S202 When receiving the sequence value invoking request issued by the second server, acquiring the sequence object that has been created, and reading the current sequence value of the sequence object.
- each management system for managing business data associated with one type of service.
- a sequence value invocation request based on the sequence object that has been created in the Oracle database is generated, and the sequence value invocation request is sent to the above Oracle database.
- the Oracle database receives the sequence value call request issued by the second server, the operation instruction matching the sequence value call request is executed, that is, the sequence name carried by the request is called according to the sequence value, and the sequence object matching the sequence name is obtained. , and read the current sequence value of the sequence object. Due to different sequences The sequence name carried by the value invocation request corresponds to one type of service, so different types of services will call different sequence objects, so that duplicate card numbers will not appear under the same type of service.
- the current sequence value of the sequence object is obtained by the pseudo column currval mode.
- S203 Generate a next sequence value of the sequence object according to a preset step size and the current sequence value.
- the next sequence value of the sequence object is generated by the pseudo column next val, and the current sequence value of the sequence object is replaced. Is the next sequence value.
- S204 Acquire a card number length value carried by the sequence value invoking request and obtain a character length of the updated current sequence value.
- the sequence value call request is parsed to obtain the card number length value and the sequence name carried by the sequence value call request.
- the card number length value indicates the character length of a physical card number that the second server needs to obtain;
- the sequence name indicates the name of the sequence object to be called by the second server.
- Values of different numbers of bits are generated in advance on the first server. Wherein, each value having the same number of bits is stored in advance in a data table, and each value corresponds to a selection probability. The probability of selection of each value is used to represent the probability that the value can be selected as a random code for all values of the same number of bits. In the initial state, the selection probability of each value in the same data table is the same, both are 1/10, which is the number of digits.
- the probability of selection in the initial state is 1/100.
- S207 splicing the random code with the updated current sequence value, and returning the splicing result to the second server, so that the second server outputs the splicing result as a physical card number.
- the first server Before returning the physical card number, the first server places the generated random code before the current sequence value of the sequence object, and concatenates the random code and the current sequence value by a preset splicing algorithm, thereby outputting an actual card number. It can be seen that the length of the card number of the output physical card number is the same as the length of the card number carried by the sequence value call request.
- the embodiment of the present application is applicable to a case where the physical card number generated by the service system is different from the character length of the current sequence value of the sequence object, for example, if the service system needs to allocate an entity card number of 11 digits in length, If the current sequence value of the sequence object in the database is 9 bits, the difference between the card number length value carried by the sequence value calling request and the updated character length of the current sequence value is 2, so a random code of 2 digit values is generated, so that 2 The random code of the bit value and the current sequence value of the 9-digit number can be output as an 11-bit physical card number required by the business system after splicing to meet the actual needs of the service.
- the service system only needs to issue a sequence value call request to the first server according to the second server, so that the current sequence value of the sequence object created by the first server and the random number generated by the first server can be generated.
- the code is stitched to output as a new physical card number. Since the current sequence value of the sequence object is updated after the actual generation, there is no repeated distribution of the same entity card number, thereby enabling the service system to directly obtain the current sequence value of the sequence object each time it is obtained.
- the result of the splicing with a random code is output as the physical card number, and it is not necessary to judge whether the physical card number already exists, thereby improving the generation efficiency of the physical card number.
- the random code of different character lengths can be dynamically obtained according to the difference between the card number length value and the current sequence value; and the first server is spliced by splicing the random code with the current sequence value
- the output physical card number can match the actual card number length value required by the service system, thereby satisfying the actual needs of different service systems; since the random code has different lengths and its value is random, it is compared with the current sequence value.
- the splicing further reduces the repetition probability of the physical card number.
- multiple service systems can share sequence objects in the database of the first server, so that a unique physical card number is generated across the service system and across servers, thereby avoiding the problem of duplicate physical card numbers between multiple distributed servers. .
- the method further includes:
- S208 If the current sequence value of the sequence object is the same as the maximum sequence value, and the loop option value is not looping, stop generating the next sequence value of the sequence object.
- S209 Let the database issue a sequence value exhaustion prompt, and return a rejection response after receiving the sequence value call request issued by the second server.
- the maximum sequence value is the maximum value among the respective sequence values corresponding to the sequence object defined by the user. If the current sequence value read in step S202 is the same as the preset maximum sequence value, the loop option value of the sequence object is read to determine whether the loop option value is a loop or not.
- the database issues a sequence value exhaustion prompt to prompt the database administrator that each sequence value corresponding to the sequence object currently created has been assigned to the matching business system, ie, prompt There are no other sequence values available for allocation in the database manager's current sequence object. Therefore, based on the sequence value exhaustion prompt, the database administrator can confirm whether another sequence object that matches the business system needs to be recreated. If another sequence object needs to be recreated, the database administrator can re-enter the attribute parameters of the new sequence object. Before receiving the sequence creation instruction, if the sequence value call request sent by the service system is continuously received, the rejection response information is returned to the second server where the service system is located. [0084] Preferably, in the default state, the loop option value of the sequence object is not looped.
- the sequence value exhaustion prompt is issued, so that the database administrator can know the actual allocation state of the sequence value.
- ⁇ establish a new sequence object to ensure that each business system can normally obtain the sequence values in the database, and improve the operational stability of the entire physical card number distribution system. Since the loop option value is not looped, the assigned sequence values are not cyclically acquired, so the same sequence value is not repeatedly distributed to other service systems. Therefore, the entity card number generation method provided by the embodiment of the present application implements the cross Business systems and the generation of unique physical card numbers across servers avoid the problem of duplicate physical card numbers between multiple distributed servers.
- FIG. 5 shows an implementation flow of a method for generating a physical card number according to another embodiment of the present application, which is described in detail as follows:
- S210 Obtain a history data table, where the history data table is used to record a historical random code generated by each engraving.
- S211 Determine, according to each historical random code stored in the history data table, the number of occurrences of the random code generated by the current engraving in the historical record data table.
- the random code is stored in the history data table to become a historical random code.
- the random code is the same as any of the historical random codes in the history data table, determining the number of the same historical random code as the random code, that is, determining the random code in the historical data table The number of occurrences
- the number of occurrences represents the number of times the random code has been used.
- S212 For each character bit of the random code, determine a cumulative number of times that the value of the historical random code on the character bit is the same as the value of the random code on the character bit.
- the value on each character bit thereof is read. For example, if the random code is "132", the values in the ones, tens, and hundreds are “2", “3", and "1", respectively.
- the number of times the value appears on the same character bit of the historical random code is separately counted.
- the cumulative number represents the sum of the number of times corresponding to each character bit. among them After counting the cumulative number of times, the number of characters in the historical random code is the same as the number of characters in the random code generated by the current engraving. According to the cumulative number of times obtained by the statistics, the number of times the random code is generated on each character bit can be known.
- S213 input the character length x of the random code, the number of occurrences y, and the cumulative number of times z into a preset formula to obtain an output parameter P.
- the selection probability of the value corresponding to the random code is changed to the initial state.
- the probability of selection is 1/10.
- FIG. 6 shows a method for generating a physical card number provided by an embodiment of the present application.
- the specific implementation process of 207 is detailed as follows:
- S2071 Invoking a service identifier carried in the request according to the sequence value, and searching for a service code corresponding to the service identifier in a preset data table.
- the service identifier corresponding to the service system that issues the sequence value invoking request is carried.
- Each type of service has a unique business identity.
- the service code corresponding to the service identifier is matched from the data table. For example, if the service is represented as "KTV-VIP”, the corresponding service code is "124"; if the service is represented as “KTV-NORMAL", the corresponding service code is "123".
- S2072 splicing the service code, the random code, and the updated current sequence value in sequence, and returning the splicing result to the second server, so that the second server will perform the splicing result
- the output is the physical card number.
- the currently obtained service code, the random code generated in the above step S206, and the current sequence value after the sequence object update are sequentially spliced, and the physical card number in another combination manner is used. Thereafter, the physical card number returned to the second server is composed of three pieces of information, which are a service code, a random code, and a current sequence value.
- a physical card number required by the service system is jointly output based on the service code, the current sequence value, and/or the random code, so that the service code can be used as the starting information of the physical card number, thereby causing others to
- the service code can be used as the starting information of the physical card number, thereby causing others to
- After obtaining the physical card with the physical card number stamped it can quickly distinguish the service type to which the physical card belongs; and, based on the identification of the initial information of the physical card number, the business data corresponding to each physical card can be more easily classified. Finishing, thus improving the management efficiency of the business.
- the embodiment of the present application further reduces the repetition probability of the physical card number with respect to the method for generating the physical card number provided by the foregoing embodiments.
- the size of the serial number of each step in the foregoing embodiment does not mean the order of execution sequence, and the execution order of each process should be determined by its function and internal logic, and should not be implemented by the implementation process of the embodiment of the present application. Any restrictions.
- FIG. 7 is a structural block diagram of the physical card number generating apparatus provided by the embodiment of the present application. For the convenience of description, only the parts related to the embodiment of the present application are shown.
- the device includes:
- the creating module 701 is configured to create a sequence object in a database pre-established by the first server.
- the first obtaining module 702 is configured to: when receiving the sequence value invoking request sent by the second server, obtain the sequence object that has been created, and read the current sequence value of the sequence object.
- the generating module 703 is configured to generate a next sequence value of the sequence object according to the preset step size and the current sequence value, and update a current sequence value of the sequence object to the next sequence value.
- the second obtaining module 704 is configured to acquire a card number length value carried by the sequence value invoking request and obtain a character length of the updated current sequence value.
- the third obtaining module 705 is configured to obtain, according to a difference between the card number length value and a character length of the current sequence value, each character whose character length is the difference value.
- the fourth obtaining module 706 is configured to obtain one or more values of the highest selection probability according to a selection probability preset by each of the values, and determine one of the values as the current Engrave the generated random code.
- the returning module 707 is configured to return the updated current sequence value to the second server, so that the second server outputs the updated current sequence value as a physical card number.
- the creating module 701 includes:
- a first obtaining submodule configured to acquire, by the user, an attribute parameter related to the sequence object, where the attribute parameter includes a minimum sequence value, a maximum sequence value, a step size, an initial value, and a loop option value.
- a submodule is created, configured to create a sequence object based on the attribute parameter in a database pre-established by the first server, and output the initial value as a current sequence value of the sequence object.
- the physical card number generating apparatus further includes:
- a stopping module configured to: if a current sequence value of the sequence object is the same as the maximum sequence value, and If the loop option value is not looped, then the next sequence value of the sequence object is stopped.
- a prompting module configured to cause the database to issue a sequence value exhaustion prompt, and return a rejection response after receiving the sequence value invoking request sent by the second server.
- the physical card number generating apparatus further includes:
- the recording module is configured to acquire a history data table, where the history data table is used to record the historical random code generated by each engraving.
- the first determining module is configured to determine, according to each historical random code stored in the history data table, the number of occurrences of the random code generated by the current engraving in the historical record data table.
- a second determining module configured to determine, for each character bit of the random code, a cumulative number of times the value of the historical random code on the character bit is the same as the value of the random code on the character bit .
- the input module is configured to input the character length x of the random code, the number of occurrences y, and the cumulative number of times z into a preset formula to obtain an output parameter P.
- an adjustment module configured to adjust a selection probability of the random code to the output parameter! 5 .
- the returning module 707 includes:
- the search submodule is configured to invoke the service identifier carried by the request according to the sequence value, and search for a service code corresponding to the service identifier in a preset data table.
- a splicing submodule configured to sequentially splicing the service code, the random code, and the updated current sequence value, and returning the splicing result to the second server, so that the second server
- the splicing result is output as a physical card number.
- the electronic device 8 of this embodiment includes: a processor 80, a memory 81, and computer readable instructions 82 stored in the memory 81 and executable on the processor 80, such as physical card number generation. program.
- the processor 80 executes the computer readable instructions 82 to implement the steps in the foregoing embodiments of the respective physical card number generation methods, such as steps 201 to 207 shown in FIG.
- the processor 80 executes the computer readable instructions 82
- the computer readable instructions 82 may be partitioned into one or more modules/units, the one or more modules/units being stored in the memory 81 and by the processor 80 is executed to complete the application.
- the one or more modules/units may be a series of computer readable instruction segments capable of performing a particular function, the instruction segments being used to describe the execution of the computer readable instructions 82 in the electronic device 8.
- the electronic device 8 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
- the electronic device can include, but is not limited to, a processor 80, a memory 81.
- FIG. 8 is merely an example of the electronic device 8, and does not constitute a limitation on the electronic device 8, and may include more or less components than those illustrated, or combine some components, or different components.
- the electronic device may further include an input/output device, a network access device, a bus, and the like.
- the processor 80 may be a central processing unit (CPU), or may be another general-purpose processor, a digital signal processor (DSP), or an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), ready-to-use programmable gate array
- CPU central processing unit
- DSP digital signal processor
- ASIC Application Specific Integrated Circuit
- the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
- the memory 81 may be an internal storage unit of the electronic device 8, such as a hard disk or a memory of the electronic device 8.
- the memory 81 may also be an external storage device of the electronic device 8, such as a plug-in hard disk provided on the electronic device 8, and a smart memory card (Smart Media Card,
- the memory 81 may also include both an internal storage unit of the electronic device 8 and an external storage device.
- the memory 81 is for storing the computer readable instructions and other programs and data required by the electronic device.
- the memory 81 can also be used to temporarily store data that has been output or is about to be output.
- each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. Realized.
- the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
- a computer readable storage medium A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present application.
- the foregoing storage medium includes: a U disk, a removable hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like, which can store program codes. .
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Software Systems (AREA)
- Computer Security & Cryptography (AREA)
- Mathematical Physics (AREA)
- Computational Mathematics (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Pure & Applied Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
Description
说明书 发明名称:实体卡号生成方法、 装置、 电子设备及介质 Specification Name of Invention: Method, device, electronic device and medium for generating physical card number
[0001] 本申请要求于 2017年 09月 11日提交中国专利局、 申请号为 201710811816.6、 发 明名称为" 实体卡号生成方法及终端设备"的中国专利申请的优先权, 其全部内 容通过引用结合在本申请中。 [0001] This application claims the priority of the Chinese Patent Application filed on Sep. 11, 2017, the Chinese Patent Application No. 201710811816.6, entitled "The Entity Card Number Generation Method and Terminal Equipment", the entire contents of which are incorporated by reference. In this application.
技术领域 Technical field
[0002] 本申请属于数据处理技术, 尤其涉及一种实体卡号生成方法、 装置、 电子设备 及介质。 [0002] The present application relates to a data processing technology, and in particular, to a method, an apparatus, an electronic device, and a medium for generating a physical card number.
背景技术 Background technique
[0003] 现有的各类实体卡, 如会员卡、 银行卡、 积分卡等, 都需要具备一个唯一的卡 号标识。 若出现重复的卡号, 则会使得后台系统的管理数据出现差错, 例如, 使得两张会员卡的消费积分信息记录到同一数据记录中。 因此, 在制作并发行 每一张实体卡之前, 都需要预先生成用于唯一标识该实体卡的一个实体卡号。 [0003] Existing types of physical cards, such as membership cards, bank cards, and loyalty cards, need to have a unique card number identifier. If a duplicate card number occurs, the management data of the background system may be wrong, for example, the consumption credit information of the two membership cards is recorded in the same data record. Therefore, before creating and distributing each physical card, it is necessary to pre-generate a physical card number for uniquely identifying the physical card.
[0004] 现有技术中, 在为某一类型的业务生成相应的一类实体卡号吋, 通常是在业务 管理系统的服务器内部, 基于 Java、 Javascript等各类幵发语言所提供的函数来生 成随机数值。 在每生成一个随机数值后, 需要判断该随机数值是否为业务管理 系统中早已存在的一个实体卡号。 若该随机数值并不是业务管理系统中早已存 在的一个实体卡号, 则可将该随机数值进行记录, 以将该随机数值作为一个新 的实体卡号, 用于制作一张新的实体卡。 然而, 若业务管理系统的实体卡号记 录表中已存在数目较多的实体卡号, 则往往需要重复执行多次上述函数, 才能 获得一个尚未存在于实体卡号记录表中的随机数值, 由此导致了实体卡号的生 成效率较为低下; 并且, 生成的实体卡号只能保证在同一业务管理系统的服务 器内不重复。 若业务管理系统具有多台分布式的服务器, 则依然会生成重复的 实体卡号, 从而导致业务数据混乱。 [0004] In the prior art, a corresponding type of physical card number is generated for a certain type of service, which is usually generated in a server of a business management system, based on functions provided by various bursting languages such as Java and Javascript. Random number. After each random number is generated, it is necessary to determine whether the random value is a physical card number already existing in the service management system. If the random value is not a physical card number already existing in the service management system, the random value may be recorded to use the random value as a new physical card number for making a new physical card. However, if a large number of physical card numbers already exist in the physical card number record table of the service management system, it is often necessary to repeatedly perform the above functions multiple times in order to obtain a random value that does not exist in the physical card number record table, thereby causing The generation efficiency of the physical card number is relatively low; and the generated physical card number can only be guaranteed not to be repeated in the server of the same service management system. If the service management system has multiple distributed servers, duplicate physical card numbers will still be generated, resulting in confusion of business data.
技术问题 technical problem
[0005] 有鉴于此, 本申请实施例提供了一种实体卡号生成方法、 装置、 电子设备及介 质, 以解决现有技术中实体卡号的生成效率较为低下且容易出现重复卡号的问 题。 [0005] In view of this, the embodiment of the present application provides a method, a device, an electronic device, and a medium for generating a physical card number, so as to solve the problem that the generation efficiency of the physical card number in the prior art is relatively low and the duplicate card number is prone to occur. question.
问题的解决方案 Problem solution
技术解决方案 Technical solution
[0006] 本申请实施例的第一方面, 提供了一种实体卡号生成方法, 包括: A first aspect of the embodiments of the present application provides a method for generating a physical card number, including:
[0007] 在第一服务器所预先建立的数据库中, 创建序列对象; [0007] creating a sequence object in a database pre-established by the first server;
[0008] 当接收到第二服务器发出的序列值调用请求吋, 获取已创建的所述序列对象, 并读取所述序列对象的当前序列值; [0008] when receiving the sequence value call request issued by the second server, acquiring the sequence object that has been created, and reading the current sequence value of the sequence object;
[0009] 根据预设的步长以及所述当前序列值, 生成所述序列对象的下一序列值, 并更 新所述序列对象的当前序列值为所述下一序列值; [0009] generating a next sequence value of the sequence object according to a preset step size and the current sequence value, and updating a current sequence value of the sequence object to the next sequence value;
[0010] 获取所述序列值调用请求所携带的卡号长度值以及获取更新后的所述当前序列 值的字符长度; [0010] acquiring a card number length value carried by the sequence value invoking request and obtaining a character length of the updated current sequence value;
[0011] 根据所述卡号长度值与所述当前序列值的字符长度的差值, 获取字符长度为所 述差值的每一数值; [0011] obtaining, according to a difference between the card number length value and a character length of the current sequence value, a character length of each value of the difference value;
[0012] 根据每一所述数值所预先设置的选取概率, 获取所述选取概率最高的一个或多 个所述数值, 并将其中的一个所述数值确定为当前吋刻所生成的随机码; [0012] obtaining one or more of the values of the highest selection probability according to a selection probability preset by each of the values, and determining one of the values as a random code generated by the current engraving;
[0013] 将所述随机码与更新后的所述当前序列值进行拼接, 并将拼接结果返回至所述 第二服务器, 以使所述第二服务器将所述拼接结果输出为实体卡号。 [0013] splicing the random code with the updated current sequence value, and returning the splicing result to the second server, so that the second server outputs the splicing result as a physical card number.
[0014] 本申请实施例的第二方面, 提供了一种实体卡号生成装置, 包括: [0014] A second aspect of the embodiments of the present application provides a physical card number generating apparatus, including:
[0015] 创建模块, 用于在第一服务器所预先建立的数据库中, 创建序列对象; [0015] a creating module, configured to create a sequence object in a database pre-established by the first server;
[0016] 第一获取模块, 用于当接收到第二服务器发出的序列值调用请求吋, 获取已创 建的所述序列对象, 并读取所述序列对象的当前序列值; [0016] a first obtaining module, configured to: when receiving a sequence value call request issued by the second server, acquire the created sequence object, and read a current sequence value of the sequence object;
[0017] 生成模块, 用于根据预设的步长以及所述当前序列值, 生成所述序列对象的下 一序列值, 并更新所述序列对象的当前序列值为所述下一序列值; [0017] a generating module, configured to generate a next sequence value of the sequence object according to a preset step size and the current sequence value, and update a current sequence value of the sequence object to the next sequence value;
[0018] 第二获取模块, 用于获取所述序列值调用请求所携带的卡号长度值以及获取更 新后的所述当前序列值的字符长度; [0018] a second obtaining module, configured to acquire a card number length value carried by the sequence value invoking request, and obtain a character length of the updated current sequence value;
[0019] 第三获取模块, 用于根据所述卡号长度值与所述当前序列值的字符长度的差值[0019] a third obtaining module, configured to determine, according to the difference between the card number length value and the character length of the current sequence value
, 获取字符长度为所述差值的每一数值; , obtaining a character length of each value of the difference;
[0020] 第四获取模块, 用于根据每一所述数值所预先设置的选取概率, 获取所述选取 概率最高的一个或多个所述数值, 并将其中的一个所述数值确定为当前吋刻所 生成的随机码; [0020] a fourth obtaining module, configured to acquire the selection according to a selection probability preset by each of the values One or more of the values having the highest probability, and determining one of the values as the random code generated by the current engraving;
[0021] 返回模块, 用于将更新后的所述当前序列值返回至所述第二服务器, 以使所述 第二服务器将更新后的所述当前序列值输出为实体卡号。 [0021] a returning module, configured to return the updated current sequence value to the second server, so that the second server outputs the updated current sequence value as a physical card number.
[0022] 本申请实施例的第三方面, 提供了一种电子设备, 包括存储器、 处理器及存储 在所述存储器上并可在所述处理器上运行的计算机可读指令, 所述处理器执行 所述计算机序吋实现如上述第一方面所述的实体卡号生成方法的步骤。 [0022] A third aspect of the embodiments of the present application provides an electronic device, including a memory, a processor, and computer readable instructions stored on the memory and executable on the processor, the processor The computer program is executed to implement the steps of the physical card number generating method according to the first aspect described above.
[0023] 本申请实施例的第四方面, 提供了一种计算机可读存储介质, 所述计算机可读 存储介质存储有计算机可读指令, 所述计算机可读指令被至少一个处理器执行 吋实现如上述第一方面所述的实体卡号生成方法的步骤。 [0023] A fourth aspect of the embodiments of the present application provides a computer readable storage medium storing computer readable instructions, the computer readable instructions being executed by at least one processor The steps of the physical card number generating method as described in the first aspect above.
发明的有益效果 Advantageous effects of the invention
有益效果 Beneficial effect
[0024] 本申请实施例中, 业务系统只需基于第二服务器向第一服务器发出序列值调用 请求, 便能将第一服务器所创建的序列对象的当前序列值与其实吋生成的随机 码进行拼接, 以输出为一个新的实体卡号。 由于序列对象的当前序列值是实吋 生成后才更新的, 因而不会出现重复分发同一实体卡号的情况, 由此也使得业 务系统每次获取得到序列对象的当前序列值后, 可以直接将其与一随机码的拼 接结果输出为实体卡号, 无须再判断该实体卡号是否早已存在, 从而提高了实 体卡号的生成效率。 通过解析序列值调用请求所携带的卡号长度值, 能够根据 卡号长度值与当前序列值的差值, 动态获取不同字符长度的随机码; 通过将随 机码与当前序列值进行拼接, 使得第一服务器所输出的实体卡号能够与业务系 统实际所需的卡号长度值匹配, 由此满足了不同业务系统的实际需求; 由于随 机码的长度不同, 且其数值具有随机性, 故令其与当前序列值拼接, 进一步地 降低了实体卡号的重复概率。 另外, 多个业务系统可以共享第一服务器的数据 库中的序列对象, 故实现了跨业务系统以及跨服务器生成唯一的实体卡号, 避 免了多台分布式服务器之间会出现重复的实体卡号的问题。 [0024] In the embodiment of the present application, the service system only needs to send a sequence value call request to the first server based on the second server, so that the current sequence value of the sequence object created by the first server and the random code generated by the first server can be performed. Splicing to output as a new physical card number. Since the current sequence value of the sequence object is updated after the actual generation, there is no repeated distribution of the same entity card number, thereby enabling the service system to directly obtain the current sequence value of the sequence object each time it is obtained. The result of the splicing with a random code is output as the physical card number, and it is not necessary to judge whether the physical card number already exists, thereby improving the generation efficiency of the physical card number. By parsing the sequence value to call the card number length value carried in the request, the random code of different character lengths can be dynamically obtained according to the difference between the card number length value and the current sequence value; and the first server is spliced by splicing the random code with the current sequence value The output physical card number can match the actual card number length value required by the service system, thereby satisfying the actual needs of different service systems; since the random code has different lengths and its value is random, it is compared with the current sequence value. The splicing further reduces the repetition probability of the physical card number. In addition, multiple service systems can share sequence objects in the database of the first server, so that a unique physical card number is generated across the service system and across servers, thereby avoiding the problem of duplicate physical card numbers between multiple distributed servers. .
对附图的简要说明 Brief description of the drawing
附图说明 [0025] 为了更清楚地说明本申请实施例中的技术方案, 下面将对实施例或现有技术描 述中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是 本申请的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动性 的前提下, 还可以根据这些附图获得其他的附图。 DRAWINGS [0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings to be used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description are merely Some embodiments of the present application can also obtain other figures from those skilled in the art without departing from the drawings.
[0026] 图 1是本申请实施例提供的实体卡号生成方法所适用的系统架构图; 1 is a system architecture diagram applicable to a method for generating a physical card number according to an embodiment of the present application;
[0027] 图 2是本申请实施例提供的实体卡号生成方法的实现流程图; [0027] FIG. 2 is a flowchart of an implementation of a method for generating a physical card number according to an embodiment of the present application;
[0028] 图 3是本申请实施例提供的实体卡号生成方法 S201的具体实现流程图; [0028] FIG. 3 is a flowchart of a specific implementation of a method for generating a physical card number S201 according to an embodiment of the present application;
[0029] 图 4是本申请另一实施例提供的实体卡号生成方法的实现流程图; 4 is a flowchart of an implementation of a method for generating a physical card number according to another embodiment of the present application;
[0030] 图 5是本申请又一实施例提供的实体卡号生成方法的实现流程图; [0030] FIG. 5 is a flowchart of an implementation of a method for generating a physical card number according to another embodiment of the present disclosure;
[0031] 图 6是本申请实施例提供的实体卡号生成方法 S207的具体实现流程图; [0031] FIG. 6 is a flowchart of a specific implementation of a method for generating a physical card number S207 according to an embodiment of the present application;
[0032] 图 7是本申请实施例提供的实体卡号生成装置的结构框图; 7 is a structural block diagram of a physical card number generating apparatus according to an embodiment of the present application;
[0033] 图 8是本申请实施例提供的电子设备的示意图。 FIG. 8 is a schematic diagram of an electronic device according to an embodiment of the present application.
本发明的实施方式 Embodiments of the invention
[0034] 以下描述中, 为了说明而不是为了限定, 提出了诸如特定系统结构、 技术之类 的具体细节, 以便透彻理解本申请实施例。 然而, 本领域的技术人员应当清楚 , 在没有这些具体细节的其它实施例中也可以实现本申请。 在其它情况中, 省 略对众所周知的系统、 装置、 电路以及方法的详细说明, 以免不必要的细节妨 碍本申请的描述。 [0034] In the following description, for purposes of illustration and description However, it will be apparent to those skilled in the art that the present invention may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the application.
[0035] 为了说明本申请所述的技术方案, 下面通过具体实施例来进行说明。 [0035] In order to explain the technical solutions described in the present application, the following description will be made by way of specific embodiments.
[0036] 图 1示出了本申请实施例提供的实体卡号生成方法所适用的系统架构图, 为了 便于说明, 仅示出了与本实施例相关的部分。 [0036] FIG. 1 is a system architecture diagram of a method for generating a physical card number provided by an embodiment of the present application. For convenience of description, only parts related to the embodiment are shown.
[0037] 参照图 1, 该系统由第一服务器 11和多个第二服务器 12组成。 其中, 第一服务 器 11用于根据预先创建的序列对象, 对序列对象每次更新后的当前序列值进行 分发, 以使序列对象所对应的每一序列值均能够与一随机码拼接后作为一个用 于制作实体卡的实体卡号。 具体地, 上述序列对象存在于第一服务器 11的数据 库中。 上述数据库还用于存储与第二服务器 12相关的业务数据, 以使得第一服 务器 11能够在为第二服务器 12分发实体卡号的同吋, 进行业务数据的管理, 避 免需要进行数据库的额外搭建。 [0037] Referring to FIG. 1, the system is composed of a first server 11 and a plurality of second servers 12. The first server 11 is configured to distribute the current sequence value after each update of the sequence object according to the sequence object created in advance, so that each sequence value corresponding to the sequence object can be spliced with a random code as a The physical card number used to make the physical card. Specifically, the above sequence object exists in the database of the first server 11. The foregoing database is further configured to store the service data related to the second server 12, so that the first server 11 can manage the service data and distribute the business data of the same number of the physical card number for the second server 12. No additional setup of the database is required.
[0038] 在该系统中, 第二服务器 12用于作为请求客户端, 向第一服务器 11发送序列值 调用请求, 以使得第一服务器 11能够根据该请求, 更新序列对象的当前序列值 。 第二服务器 12还用于运行一类或多类业务的业务系统, 使得第一服务器所返 回的每个响应结果均能够输出为业务系统所需的一个实体卡号。 In the system, the second server 12 is configured to, as a requesting client, send a sequence value call request to the first server 11 to enable the first server 11 to update the current sequence value of the sequence object according to the request. The second server 12 is also used to run a business system of one or more types of services, so that each response returned by the first server can be output as a physical card number required by the business system.
[0039] 图 2示出了本申请实施例提供的实体卡号生成方法的实现流程图, 详述如下: [0039] FIG. 2 is a flowchart showing an implementation of a method for generating a physical card number according to an embodiment of the present application, which is described in detail as follows:
[0040] S201 : 在第一服务器所预先建立的数据库中, 创建序列对象。 [0040] S201: Create a sequence object in a database pre-established by the first server.
[0041] 第一服务器所预先建立的数据库包括但不限于 Omcle、 Sql [0041] The database pre-established by the first server includes but is not limited to Omcle, Sql
Server. DB2以及 PostgreSQL等各种类型的数据库。 由于 Oracle数据库的可移植 性好、 使用方便、 功能强, 适用于各类大、 中、 小、 微机环境, 故本申请实施 例中所建立的数据库优选为 Oracle数据库。 Server. DB2 and PostgreSQL and other types of databases. Because the Oracle database is portable, easy to use, and powerful, it is applicable to all kinds of large, medium, small, and micro-computer environments. Therefore, the database established in the embodiment of the present application is preferably an Oracle database.
[0042] 在 Oracle数据库中, 当接收到外部系统或者数据库管理员发出的序列创建指令 吋, 通过预设的序列生成方法, 创建序列对象。 序列对象即用于产生一系列唯 一数值的数据库对象, 其为特殊的单行表。 [0042] In the Oracle database, when a sequence creation instruction issued by an external system or a database administrator is received, a sequence object is created by a preset sequence generation method. A sequence object is a database object that is used to generate a series of unique values, which is a special one-line table.
[0043] 作为本申请的一个实施例, 图 3示出了本申请实施例提供的实体卡号生成方法 S 201的具体实现流程, 详述如下: [0043] As an embodiment of the present application, FIG. 3 shows a specific implementation process of the physical card number generation method S201 provided by the embodiment of the present application, which is described in detail as follows:
[0044] S2011 : 获取用户输入的与所述序列对象相关的属性参数, 所述属性参数包括 最小序列值、 最大序列值、 步长、 初始值以及循环选项值。 [0044] S2011: Acquire an attribute parameter input by the user related to the sequence object, where the attribute parameter includes a minimum sequence value, a maximum sequence value, a step size, an initial value, and a loop option value.
[0045] 在 Oracle数据库中, 根据用户输入的序列创建指令, 如 create [0045] In the Oracle database, an instruction is created according to a sequence input by the user, such as create
sequence以及 create any sequence语句等, 创建 Oracle序列对象。 序列创建指令中 携带有与用户所需创建的序列对象相关的属性参数, 包括最小序列值、 最大序 列值、 步长、 初始值以及循环选项值等。 The sequence and the create any sequence statement, etc., create an Oracle sequence object. The sequence creation instruction carries the attribute parameters related to the sequence object that the user needs to create, including the minimum sequence value, the maximum sequence value, the step size, the initial value, and the loop option value.
[0046] 上述携带有与用户所需创建的序列对象相关的属性参数的序列创建指令, 可以 定义代码如下: [0046] The sequence creation instruction carrying the attribute parameter related to the sequence object that the user needs to create may be defined as follows:
[0047] CREATE SEQUENCE sequence [0047] CREATE SEQUENCE sequence
[0048] INCREMENT BY n [0048] INCREMENT BY n
[0049] START WITH a [0049] START WITH a
[0050] MAXVALUE b [0051] MINVALUE c [0050] MAXVALUE b [0051] MINVALUE c
[0052] CYCLE I NOCYCLE CYCLE I NOCYCLE
[0053] 其中, 上述 sequence、 n、 a、 b、 c以及 CYCLE / NOCYCLE均为序列对象的属 性参数。 sequence表示序列对象的序列名称; n表示序列对象的步长; a表示序列 值的初始值; b和 c分别表示序列对象的最大值以及最小值; CYCLE [0053] wherein the above sequence, n, a, b, c, and CYCLE / NOCYCLE are all attribute parameters of the sequence object. Sequence represents the sequence name of the sequence object; n represents the step size of the sequence object; a represents the initial value of the sequence value; b and c represent the maximum and minimum values of the sequence object, respectively; CYCLE
以及 NOCYCLE均为序列对象的循环选项值, 且 CYCLE表示序列对象可循环, N OCYCLE表示序列对象不可循环。 其中, 步长表示序列对象中, 下一序列值与 当前序列值的差值大小。 And NOCYCLE is the loop option value of the sequence object, and CYCLE indicates that the sequence object can be looped, and N OCYCLE indicates that the sequence object cannot be looped. The step size indicates the difference between the next sequence value and the current sequence value in the sequence object.
[0054] S2012: 在第一服务器所预先建立的数据库中, 基于所述属性参数创建序列对 象, 并将所述初始值输出为所述序列对象的当前序列值。 [0054] S2012: In a database pre-established by the first server, a sequence object is created based on the attribute parameter, and the initial value is output as a current sequence value of the sequence object.
[0055] 根据接收到的序列创建指令, 解析出序列创建指令中的各项属性参数, 以在数 据库中创建与属性参数匹配的序列对象。 [0055] According to the received sequence creation instruction, each attribute parameter in the sequence creation instruction is parsed to create a sequence object matching the attribute parameter in the database.
[0056] 优选地, 属性参数还包括内存选项值。 若内存选项值为 CACHE, 则将序列对 象存入内存中, 以提高序列值的处理速度以及提高序列对象中各个序列值的生 成效率。 [0056] Preferably, the attribute parameter further includes a memory option value. If the memory option value is CACHE, the sequence object is stored in memory to improve the processing speed of the sequence value and improve the efficiency of each sequence value in the sequence object.
[0057] 本申请实施例中, 由于序列对象所对应的每一序列值最终将与随机码共同输出 为业务系统所需的一实体卡号, 故由用户输入序列对象的属性参数, 可以提供 给用户更多自定义空间, 使得用户可以根据业务系统的制卡需求, 自定义一部 分实体卡号的生成规则, 因此在一定程度上提高了实体卡号的分配灵活性。 [0057] In the embodiment of the present application, each sequence value corresponding to the sequence object is finally output together with the random code as a physical card number required by the service system, so that the attribute parameter of the sequence object input by the user can be provided to the user. More custom space allows the user to customize the generation rules of a part of the physical card number according to the card-making requirements of the business system, thus improving the flexibility of the distribution of the physical card number to a certain extent.
[0058] S202: 当接收到第二服务器发出的序列值调用请求吋, 获取已创建的所述序列 对象, 并读取所述序列对象的当前序列值。 [0058] S202: When receiving the sequence value invoking request issued by the second server, acquiring the sequence object that has been created, and reading the current sequence value of the sequence object.
[0059] 在第二服务器中, 运行了一个或多个管理系统, 每一管理系统用于管理与一种 类型的业务相关联的业务数据。 [0059] In the second server, one or more management systems are run, each management system for managing business data associated with one type of service.
[0060] 当任一业务系统需要获取新的实体卡号吋, 将生成基于 Oracle数据库中已创建 的序列对象的序列值调用请求, 并将该序列值调用请求发送至上述 Oracle数据库 。 当 Oracle数据库接收到第二服务器发出的序列值调用请求吋, 运行与序列值调 用请求相匹配的操作指令, 即, 根据序列值调用请求所携带的序列名称, 获取 与该序列名称匹配的序列对象, 并读取序列对象的当前序列值。 由于不同序列 值调用请求所携带的序列名称均与一种类型的业务对应, 故不同类型的业务将 调用不同的序列对象, 从而保证同一类业务下不会出现重复的实体卡号。 [0060] When any business system needs to acquire a new physical card number, a sequence value invocation request based on the sequence object that has been created in the Oracle database is generated, and the sequence value invocation request is sent to the above Oracle database. When the Oracle database receives the sequence value call request issued by the second server, the operation instruction matching the sequence value call request is executed, that is, the sequence name carried by the request is called according to the sequence value, and the sequence object matching the sequence name is obtained. , and read the current sequence value of the sequence object. Due to different sequences The sequence name carried by the value invocation request corresponds to one type of service, so different types of services will call different sequence objects, so that duplicate card numbers will not appear under the same type of service.
[0061] 本申请实施例中, 通过伪列 currval方式, 获取序列对象的当前序列值。 [0061] In the embodiment of the present application, the current sequence value of the sequence object is obtained by the pseudo column currval mode.
[0062] S203: 根据预设的步长以及所述当前序列值, 生成所述序列对象的下一序列值[0062] S203: Generate a next sequence value of the sequence object according to a preset step size and the current sequence value.
, 并更新所述序列对象的当前序列值为所述下一序列值。 And updating the current sequence value of the sequence object to the next sequence value.
[0063] 根据序列对象所对应的预设步长以及 S202所获得的当前序列值, 通过伪列 next val的方式, 实吋生成序列对象的下一序列值, 则序列对象的当前序列值将替换 为所述下一序列值。 [0063] According to the preset step size corresponding to the sequence object and the current sequence value obtained by S202, the next sequence value of the sequence object is generated by the pseudo column next val, and the current sequence value of the sequence object is replaced. Is the next sequence value.
[0064] 例如, 在接收到第二服务器发出的序列值调用请求吋, 若读取到的与序列值调 用请求匹配的序列对象的当前序列值为 a, 序列对象的增长步长为 2, 则生成的下 一序列值为 a+2, 且在最新吋刻下, 序列对象的当前序列值将变更为 a+2。 [0064] For example, after receiving the sequence value call request issued by the second server, if the current sequence value of the sequence object that is read to match the sequence value call request is a, and the growth step of the sequence object is 2, The next sequence value generated is a+2, and at the latest engraving, the current sequence value of the sequence object will be changed to a+2.
[0065] S204: 获取所述序列值调用请求所携带的卡号长度值以及获取更新后的所述当 前序列值的字符长度。 [0065] S204: Acquire a card number length value carried by the sequence value invoking request and obtain a character length of the updated current sequence value.
[0066] S205: 根据所述卡号长度值与所述当前序列值的字符长度的差值, 获取字符长 度为所述差值的每一数值。 S205: Obtain, according to a difference between the card number length value and a character length of the current sequence value, each character length of the difference is obtained.
[0067] 当接收到第二服务器发出的序列值调用请求吋, 对该序列值调用请求进行解析 , 以获取序列值调用请求所携带的卡号长度值以及序列名称。 其中, 卡号长度 值表示第二服务器所需获取的一个实体卡号的字符长度; 序列名称表示第二服 务器所需调用的序列对象的名称。 [0067] When receiving the sequence value call request sent by the second server, the sequence value call request is parsed to obtain the card number length value and the sequence name carried by the sequence value call request. The card number length value indicates the character length of a physical card number that the second server needs to obtain; the sequence name indicates the name of the sequence object to be called by the second server.
[0068] 根据序列值调用请求所携带的序列名称, 令与该序列名称匹配的序列对象生成 下一序列值, 并将下一序列值更新为当前序列值后, 识别出当前序列值的字符 长度。 计算序列值调用请求所携带的卡号长度值与当前序列值的字符长度的差 值。 And [0068] calling the sequence name carried by the request according to the sequence value, causing the sequence object matching the sequence name to generate the next sequence value, and updating the next sequence value to the current sequence value, and identifying the character length of the current sequence value. . Calculates the difference between the card number length value carried by the sequence value call request and the character length of the current sequence value.
[0069] 例如, 若卡号长度值为 11位, 当前序列值为 238246223, 则当前序列值的字符 长度为 9位, 卡号长度值与当前序列值的字符长度的差值为 11-9=2。 For example, if the card number length value is 11 bits and the current sequence value is 238246223, the current sequence value has a character length of 9 bits, and the difference between the card number length value and the current sequence value character length is 11-9=2.
[0070] 获取位数与上述差值相同的所有数值。 例如, 在上述示例中, 若卡号长度值与 当前序列值的字符长度的差值为 2, 则所需获取的数值为位数为 2的数值, 即 00 至 99之间的所有数值。 [0071] S206: 根据每一所述数值所预先设置的选取概率, 获取所述选取概率最高的一 个或多个所述数值, 并将其中的一个所述数值确定为当前吋刻所生成的随机码 [0070] All values having the same number of bits as the above difference are obtained. For example, in the above example, if the difference between the card number length value and the character length of the current sequence value is 2, the value to be acquired is a value of 2 digits, that is, all values between 00 and 99. [0071] S206: Obtain one or more of the values with the highest probability of selection according to a selection probability preset by each of the values, and determine one of the values as a random number generated by the current engraving code
[0072] 不同位数的数值预先生成于第一服务器。 其中, 位数相同的各个数值预先存储 于一个数据表中, 且每一数值与一选取概率对应。 每一数值的选取概率用于表 示在位数相同的所有数值中, 该数值能够被选取作为一个随机码的概率。 在初 始状态下, 同一数据表中各个数值的选取概率相同, 均为 1/10 , 为数值的位数 [0072] Values of different numbers of bits are generated in advance on the first server. Wherein, each value having the same number of bits is stored in advance in a data table, and each value corresponds to a selection probability. The probability of selection of each value is used to represent the probability that the value can be selected as a random code for all values of the same number of bits. In the initial state, the selection probability of each value in the same data table is the same, both are 1/10, which is the number of digits.
[0073] 例如, 在生成 00至 99之间的一百个数值吋, 对于其中的每一数值, 其在初始状 态下的选取概率均为 1/100。 [0073] For example, in generating a hundred values 00 between 00 and 99, for each of these values, the probability of selection in the initial state is 1/100.
[0074] 从 S205所获得的各个数值中, 确定出选取概率最高的一个或多个数值。 通过预 设的随机数选取算法, 在确定出的各个数值中选取出一个数值, 将该数值作为 当前吋刻所生成的随机码。 可知, 随机码的字符长度为卡号长度值与当前序列 值的字符长度的差值。 [0074] Among the respective values obtained by S205, one or more values having the highest selection probability are determined. Through the preset random number selection algorithm, a value is selected among the determined values, and the value is used as the random code generated by the current engraving. It can be seen that the character length of the random code is the difference between the card number length value and the character length of the current sequence value.
[0075] S207: 将所述随机码与更新后的所述当前序列值进行拼接, 并将拼接结果返回 至所述第二服务器, 以使所述第二服务器将所述拼接结果输出为实体卡号。 [0075] S207: splicing the random code with the updated current sequence value, and returning the splicing result to the second server, so that the second server outputs the splicing result as a physical card number. .
[0076] 第一服务器在返回实体卡号之前, 将生成的随机码置于序列对象的当前序列值 之前, 并通过预设的拼接算法拼接上述随机码以及当前序列值, 从而输出一实 体卡号。 由此可知, 输出的实体卡号的卡号长度与序列值调用请求所携带的卡 号长度值相同。 [0076] Before returning the physical card number, the first server places the generated random code before the current sequence value of the sequence object, and concatenates the random code and the current sequence value by a preset splicing algorithm, thereby outputting an actual card number. It can be seen that the length of the card number of the output physical card number is the same as the length of the card number carried by the sequence value call request.
[0077] 本申请实施例适用于业务系统所需生成的实体卡号与序列对象的当前序列值的 字符长度存在差异的情况之下, 例如, 若业务系统需要分配 11位数字长度的实 体卡号, 则数据库中序列对象的当前序列值为 9位, 则序列值调用请求所携带的 卡号长度值以及更新后的当前序列值的字符长度的差值为 2, 故生成 2位数值的 随机码, 使得 2位数值的随机码与 9位数字的当前序列值在拼接后能够输出为业 务系统所需的一个 11位的实体卡号, 满足业务的实际需求。 [0077] The embodiment of the present application is applicable to a case where the physical card number generated by the service system is different from the character length of the current sequence value of the sequence object, for example, if the service system needs to allocate an entity card number of 11 digits in length, If the current sequence value of the sequence object in the database is 9 bits, the difference between the card number length value carried by the sequence value calling request and the updated character length of the current sequence value is 2, so a random code of 2 digit values is generated, so that 2 The random code of the bit value and the current sequence value of the 9-digit number can be output as an 11-bit physical card number required by the business system after splicing to meet the actual needs of the service.
[0078] 本申请实施例中, 业务系统只需基于第二服务器向第一服务器发出序列值调用 请求, 便能将第一服务器所创建的序列对象的当前序列值与其实吋生成的随机 码进行拼接, 以输出为一个新的实体卡号。 由于序列对象的当前序列值是实吋 生成后才更新的, 因而不会出现重复分发同一实体卡号的情况, 由此也使得业 务系统每次获取得到序列对象的当前序列值后, 可以直接将其与一随机码的拼 接结果输出为实体卡号, 无须再判断该实体卡号是否早已存在, 从而提高了实 体卡号的生成效率。 通过解析序列值调用请求所携带的卡号长度值, 能够根据 卡号长度值与当前序列值的差值, 动态获取不同字符长度的随机码; 通过将随 机码与当前序列值进行拼接, 使得第一服务器所输出的实体卡号能够与业务系 统实际所需的卡号长度值匹配, 由此满足了不同业务系统的实际需求; 由于随 机码的长度不同, 且其数值具有随机性, 故令其与当前序列值拼接, 进一步地 降低了实体卡号的重复概率。 另外, 多个业务系统可以共享第一服务器的数据 库中的序列对象, 故实现了跨业务系统以及跨服务器生成唯一的实体卡号, 避 免了多台分布式服务器之间会出现重复的实体卡号的问题。 [0078] In the embodiment of the present application, the service system only needs to issue a sequence value call request to the first server according to the second server, so that the current sequence value of the sequence object created by the first server and the random number generated by the first server can be generated. The code is stitched to output as a new physical card number. Since the current sequence value of the sequence object is updated after the actual generation, there is no repeated distribution of the same entity card number, thereby enabling the service system to directly obtain the current sequence value of the sequence object each time it is obtained. The result of the splicing with a random code is output as the physical card number, and it is not necessary to judge whether the physical card number already exists, thereby improving the generation efficiency of the physical card number. By parsing the sequence value to call the card number length value carried in the request, the random code of different character lengths can be dynamically obtained according to the difference between the card number length value and the current sequence value; and the first server is spliced by splicing the random code with the current sequence value The output physical card number can match the actual card number length value required by the service system, thereby satisfying the actual needs of different service systems; since the random code has different lengths and its value is random, it is compared with the current sequence value. The splicing further reduces the repetition probability of the physical card number. In addition, multiple service systems can share sequence objects in the database of the first server, so that a unique physical card number is generated across the service system and across servers, thereby avoiding the problem of duplicate physical card numbers between multiple distributed servers. .
[0079] 作为本申请的另一实施例, 如图 4所示, 在上述 S202之后, 还包括: [0079] As another embodiment of the present application, as shown in FIG. 4, after the foregoing S202, the method further includes:
[0080] S208: 若所述序列对象的当前序列值与所述最大序列值相同, 且所述循环选项 值为不循环, 则停止生成所述序列对象的下一序列值。 [0080] S208: If the current sequence value of the sequence object is the same as the maximum sequence value, and the loop option value is not looping, stop generating the next sequence value of the sequence object.
[0081] S209: 令所述数据库发出序列值耗尽提示, 并在接收到所述第二服务器发出的 序列值调用请求吋, 返回拒绝响应。 [0081] S209: Let the database issue a sequence value exhaustion prompt, and return a rejection response after receiving the sequence value call request issued by the second server.
[0082] 最大序列值为用户预先定义的序列对象所对应的各个序列值中的最大值。 若步 骤 S202中所读取到的当前序列值与预设的最大序列值相同, 则读取序列对象的 循环选项值, 以判断该循环选项值为循环还是不循环。 [0082] The maximum sequence value is the maximum value among the respective sequence values corresponding to the sequence object defined by the user. If the current sequence value read in step S202 is the same as the preset maximum sequence value, the loop option value of the sequence object is read to determine whether the loop option value is a loop or not.
[0083] 若循环选项值为不循环, 则数据库发出序列值耗尽提示, 以提示数据库管理员 当前所创建的序列对象所对应的各个序列值均已分配至与其匹配的业务系统, 即, 提示数据库管理员当前序列对象中已无可用于分配的其他序列值。 因此, 基于该序列值耗尽提示, 数据库管理员可确认是否需要重新创建与该业务系统 匹配的另一序列对象。 若需要重新创建另一序列对象, 则数据库管理员可重新 输入新的序列对象的属性参数。 在接收到序列创建指令之前, 若持续接收到该 业务系统发出的序列值调用请求, 则将拒绝响应信息返回至该业务系统所在的 第二服务器。 [0084] 优选地, 在默认状态下, 序列对象的循环选项值为不循环。 [0083] If the loop option value is not looped, the database issues a sequence value exhaustion prompt to prompt the database administrator that each sequence value corresponding to the sequence object currently created has been assigned to the matching business system, ie, prompt There are no other sequence values available for allocation in the database manager's current sequence object. Therefore, based on the sequence value exhaustion prompt, the database administrator can confirm whether another sequence object that matches the business system needs to be recreated. If another sequence object needs to be recreated, the database administrator can re-enter the attribute parameters of the new sequence object. Before receiving the sequence creation instruction, if the sequence value call request sent by the service system is continuously received, the rejection response information is returned to the second server where the service system is located. [0084] Preferably, in the default state, the loop option value of the sequence object is not looped.
[0085] 本申请实施例中, 通过在序列对象的当前值达到最大序列值, 且循环选项值为 不循环吋, 发出序列值耗尽提示, 使得数据库管理员能够获知序列值的实吋分 配状态, 及吋建立新的序列对象, 以保证各个业务系统能够正常获取数据库中 的序列值, 提高了整个实体卡号分配系统的运行稳定性。 由于循环选项值为不 循环吋, 已分配的各个序列值不会被循环获取, 故不会将同一序列值重复分发 至其他业务系统, 因此, 本申请实施例提供的实体卡号生成方法实现了跨业务 系统以及跨服务器生成唯一的实体卡号, 避免了多台分布式服务器之间会出现 重复的实体卡号的问题。 [0085] In the embodiment of the present application, by reaching the maximum sequence value in the current value of the sequence object, and the loop option value is not looping, the sequence value exhaustion prompt is issued, so that the database administrator can know the actual allocation state of the sequence value. And 吋 establish a new sequence object to ensure that each business system can normally obtain the sequence values in the database, and improve the operational stability of the entire physical card number distribution system. Since the loop option value is not looped, the assigned sequence values are not cyclically acquired, so the same sequence value is not repeatedly distributed to other service systems. Therefore, the entity card number generation method provided by the embodiment of the present application implements the cross Business systems and the generation of unique physical card numbers across servers avoid the problem of duplicate physical card numbers between multiple distributed servers.
[0086] 作为本申请的一个实施例, 图 5示出了本申请又一实施例提供的实体卡号生成 方法的实现流程, 详述如下: [0086] As an embodiment of the present application, FIG. 5 shows an implementation flow of a method for generating a physical card number according to another embodiment of the present application, which is described in detail as follows:
[0087] S210: 获取历史记录数据表, 所述历史记录数据表用于记录各个吋刻所生成的 历史随机码。 [0087] S210: Obtain a history data table, where the history data table is used to record a historical random code generated by each engraving.
[0088] S211 : 根据历史记录数据表所存储的各个历史随机码, 确定当前吋刻所生成的 所述随机码的在所述历史记录数据表中的出现次数。 [0088] S211: Determine, according to each historical random code stored in the history data table, the number of occurrences of the random code generated by the current engraving in the historical record data table.
[0089] 本申请实施例中, 从预先生成的各个数值中确定出用于作为随机码的一个数值 后, 该随机码将被存储至历史记录数据表, 使其成为一历史随机码。 In the embodiment of the present application, after determining a value used as a random code from each of the pre-generated values, the random code is stored in the history data table to become a historical random code.
[0090] 在 S206中选取出当前吋刻的一个随机码后, 判断该随机码是否与历史记录数据 表中的任一历史随机码相同。 [0090] After selecting a random code currently engraved in S206, it is determined whether the random code is the same as any historical random code in the history data table.
[0091] 若该随机码与历史记录数据表中的任一历史随机码相同, 则确定与该随机码相 同的历史随机码的个数, 即, 确定该随机码的在历史记录数据表中的出现次数[0091] if the random code is the same as any of the historical random codes in the history data table, determining the number of the same historical random code as the random code, that is, determining the random code in the historical data table The number of occurrences
。 可知, 出现次数表征了该随机码曾经被使用的次数。 . It can be seen that the number of occurrences represents the number of times the random code has been used.
[0092] S212: 对于所述随机码的每一字符位, 确定所述历史随机码在该字符位上的数 值与所述随机码在该字符位上的数值相同的累积次数。 [0092] S212: For each character bit of the random code, determine a cumulative number of times that the value of the historical random code on the character bit is the same as the value of the random code on the character bit.
[0093] 对于当前吋刻所生成的随机码, 读取其各个字符位上的数值。 例如, 若随机码 为" 132", 则个位、 十位和百位上的数值分别为 "2"、 "3"、 "1"。 [0093] For the random code generated by the current engraving, the value on each character bit thereof is read. For example, if the random code is "132", the values in the ones, tens, and hundreds are "2", "3", and "1", respectively.
[0094] 对于随机码在每一字符位上的数值, 分别统计该数值在历史随机码的同一字符 位上所出现的次数。 累积次数表示各个字符位所对应的所述次数的总和。 其中 , 在统计累积次数吋, 历史随机码的字符位数与当前吋刻所生成的随机码的字 符位数相同。 根据统计得到的累积次数, 可获知随机码在各个字符位上的数值 所生成过的次数。 [0094] For the value of the random code on each character bit, the number of times the value appears on the same character bit of the historical random code is separately counted. The cumulative number represents the sum of the number of times corresponding to each character bit. among them After counting the cumulative number of times, the number of characters in the historical random code is the same as the number of characters in the random code generated by the current engraving. According to the cumulative number of times obtained by the statistics, the number of times the random code is generated on each character bit can be known.
[0095] S213: 将所述随机码的字符长度 x、 所述出现次数 y以及所述累积次数 z输入预 设公式, 得到输出参数 P。 [0095] S213: input the character length x of the random code, the number of occurrences y, and the cumulative number of times z into a preset formula to obtain an output parameter P.
[0096] 其中, 所述预设公式如下: [0096] wherein the preset formula is as follows:
[0097] P=(l-y/z)/10 " , y≠0^.z≠0; P=(l-y/z)/10 " , y≠0^.z≠0;
[0098] Ρ=(1+ζ/10 /10 , y≠0^.z≠0; Ρ=(1+ζ/10 /10 , y≠0^.z≠0;
[0099] P=l/10 x, y=0且 z=0。 [0099] P = 1/10 x , y = 0 and z = 0.
[0100] S214: 将所述随机码的选取概率调整为所述输出参数 P。 [0100] S214: Adjust the selection probability of the random code to the output parameter P.
[0101] 若当前吋刻所生成的随机码的出现次数 y不为零, 且字符位上出现相同数值的 累积次数 z也不为零, 则表示该随机码被用于制作实体卡号的次数相对较多, 因 而在 S205存储有数值及其选取概率的数据表中, 降低当前随机码所对应的数值 的选取概率, 使其选取概率变更为 (l-y/z)/10 x。 [0101] If the number of occurrences y of the random code generated by the current engraving is not zero, and the cumulative number z of occurrences of the same value on the character bit is not zero, it indicates that the number of times the random code is used to create the physical card number is relatively There are many, so in the data table in which S205 stores the value and its selection probability, the selection probability of the value corresponding to the current random code is lowered, and the selection probability is changed to (ly/z)/10 x.
[0102] 若当前吋刻所生成的随机码的出现次数 y为零, 但字符位上出现相同数值的累 积次数 z不为零, 则表示该随机码从未被用于制作实体卡号, 因而在 S205存储有 数值及其选取概率的数据表中, 增大当前随机码所对应的数值的选取概率进行 调整, 使其选取概率变更为(l+z/10 /10 。 [0102] If the number of occurrences y of the random code generated by the current engraving is zero, but the cumulative number z of occurrences of the same value on the character bit is not zero, it indicates that the random code has never been used to create a physical card number, and thus S205 stores a numerical value and a probability of selecting the data table, and increases the selection probability of the value corresponding to the current random code to adjust the selection probability to (l+z/10 /10).
[0103] 若当前吋刻所生成的随机码的出现次数 y为零, 且字符位上出现相同数值的累 积次数也为零, 则将该随机码所对应的数值的选取概率变更为初始状态下的选 取概率 1/10 。 [0103] If the number of occurrences y of the random code generated by the current engraving is zero, and the cumulative number of occurrences of the same value on the character bit is also zero, the selection probability of the value corresponding to the random code is changed to the initial state. The probability of selection is 1/10.
[0104] 本申请实施例在生成每一随机码后, 通过在随机码及其字符位的数值出现次数 较高的情况下, 增大随机码的选取概率, 在随机码及其字符位的数值出现次数 较低的情况下, 降低随机码的选取概率, 实现了随机码的选取概率的自动调节 , 使得第一服务器在下次基于数据表中的选取概率来生成随机码吋, 能够最大 限度地避免该吋刻会生成重复的随机码。 基于重复性较低的随机码来拼接序列 值, 也进一步地降低了拼接后所得到的实体卡号的重复概率。 [0104] In the embodiment of the present application, after each random code is generated, by increasing the random code selection probability in the case where the random code and the number of occurrences of the character bit are high, the value of the random code and its character bit When the number of occurrences is low, the selection probability of the random code is lowered, and the automatic adjustment of the selection probability of the random code is realized, so that the first server generates the random code 下次 based on the selection probability in the data table next time, which can avoid the maximum This engraving generates a random random code. The splicing of the sequence values based on the less repetitive random code further reduces the repetition probability of the physical card number obtained after splicing.
[0105] 作为本申请的一个实施例, 图 6示出了本申请实施例提供的实体卡号生成方法 S 207的具体实现流程, 详述如下: [0105] As an embodiment of the present application, FIG. 6 shows a method for generating a physical card number provided by an embodiment of the present application. The specific implementation process of 207 is detailed as follows:
[0106] S2071 : 根据所述序列值调用请求所携带的业务标识, 在预设的数据表中, 査 找与所述业务标识对应的业务代码。 [0106] S2071: Invoking a service identifier carried in the request according to the sequence value, and searching for a service code corresponding to the service identifier in a preset data table.
[0107] 序列值调用请求中, 除了携带有上述卡号长度值以及序列名称之外, 还携带了 发出该序列值调用请求的业务系统所对应的业务标识。 每一类型的业务具有唯 一的一个业务标识。 在序列对象创建之前, 在第一服务器的数据库中, 根据数 据库管理员发出的设置指令, 预先建立一个数据表, 用于存储业务标识以及业 务代码的对应关系。 [0107] In the sequence value invoking request, in addition to carrying the card number length value and the sequence name, the service identifier corresponding to the service system that issues the sequence value invoking request is carried. Each type of service has a unique business identity. Before the sequence object is created, in the database of the first server, according to the setting instruction issued by the database administrator, a data table is pre-established for storing the correspondence between the service identifier and the service code.
[0108] 在解析出序列值调用请求所携带的业务标识之后, 从数据表中, 匹配出与该业 务标识对应的业务代码。 例如, 若业务表示为 "KTV-VIP", 则对应的业务代码为 "124"; 若业务表示为 "KTV-NORMAL" , 则对应的业务代码为 "123"。 [0108] After parsing the service identifier carried in the sequence value call request, the service code corresponding to the service identifier is matched from the data table. For example, if the service is represented as "KTV-VIP", the corresponding service code is "124"; if the service is represented as "KTV-NORMAL", the corresponding service code is "123".
[0109] S2072: 依次拼接所述业务代码、 所述随机码以及更新后的所述当前序列值, 并将拼接结果返回至所述第二服务器, 以使所述第二服务器将所述拼接结果输 出为实体卡号。 [0109] S2072: splicing the service code, the random code, and the updated current sequence value in sequence, and returning the splicing result to the second server, so that the second server will perform the splicing result The output is the physical card number.
[0110] 本申请实施例中, 依次对当前所获得的业务代码、 上述步骤 S206所生成的随机 码以及序列对象更新后的当前序列值进行拼接处理, 以另一组合方式的实体卡 号。 此吋, 返回至第二服务器的实体卡号由三部分信息组成, 分别为业务代码 、 随机码以及当前序列值。 In the embodiment of the present application, the currently obtained service code, the random code generated in the above step S206, and the current sequence value after the sequence object update are sequentially spliced, and the physical card number in another combination manner is used. Thereafter, the physical card number returned to the second server is composed of three pieces of information, which are a service code, a random code, and a current sequence value.
[0111] 示例性地, 若业务代码为 "103", 随机码为" 382", 当前序列值为 "233999903", 则将该三部分信息依次拼接后所得到的拼接结果为" 103382233999903", 也即, 第二服务器所获得的实体卡号为" 103382233999903"。 [0111] Exemplarily, if the service code is "103", the random code is "382", and the current sequence value is "233999903", the splicing result obtained by sequentially splicing the three parts of information is "103382233999903", That is, the physical card number obtained by the second server is "103382233999903".
[0112] 本申请实施例中, 基于业务代码、 当前序列值和 /或随机码来共同输出业务系 统所需的一实体卡号, 保证了业务代码能够作为实体卡号的起始信息, 由此使 得他人在获取到印记有实体卡号的实体卡吋, 能够快速分辨出该实体卡所属的 业务类型; 并且, 基于对实体卡号的起始信息的识别, 使得各实体卡所对应的 业务数据能够更加易于分类整理, 因而提高了业务的管理效率。 另外, 由于实 体卡号由三部分信息组成, 因而相对于上述各个实施例所提供的实体卡号生成 方法, 本申请实施例还进一步地降低了实体卡号的重复概率。 [0113] 应理解, 上述实施例中各步骤的序号的大小并不意味着执行顺序的先后, 各过 程的执行顺序应以其功能和内在逻辑确定, 而不应对本申请实施例的实施过程 构成任何限定。 [0112] In the embodiment of the present application, a physical card number required by the service system is jointly output based on the service code, the current sequence value, and/or the random code, so that the service code can be used as the starting information of the physical card number, thereby causing others to After obtaining the physical card with the physical card number stamped, it can quickly distinguish the service type to which the physical card belongs; and, based on the identification of the initial information of the physical card number, the business data corresponding to each physical card can be more easily classified. Finishing, thus improving the management efficiency of the business. In addition, since the physical card number is composed of three pieces of information, the embodiment of the present application further reduces the repetition probability of the physical card number with respect to the method for generating the physical card number provided by the foregoing embodiments. It should be understood that the size of the serial number of each step in the foregoing embodiment does not mean the order of execution sequence, and the execution order of each process should be determined by its function and internal logic, and should not be implemented by the implementation process of the embodiment of the present application. Any restrictions.
[0114] 对应于上文实施例所述的实体卡号生成方法, 图 7示出了本申请实施例提供的 实体卡号生成装置的结构框图。 为了便于说明, 仅示出了与本申请实施例相关 的部分。 [0114] Corresponding to the physical card number generating method described in the foregoing embodiment, FIG. 7 is a structural block diagram of the physical card number generating apparatus provided by the embodiment of the present application. For the convenience of description, only the parts related to the embodiment of the present application are shown.
[0115] 参照图 7, 该装置包括: [0115] Referring to FIG. 7, the device includes:
[0116] 创建模块 701, 用于在第一服务器所预先建立的数据库中, 创建序列对象。 [0116] The creating module 701 is configured to create a sequence object in a database pre-established by the first server.
[0117] 第一获取模块 702, 用于当接收到第二服务器发出的序列值调用请求吋, 获取 已创建的所述序列对象, 并读取所述序列对象的当前序列值。 [0117] The first obtaining module 702 is configured to: when receiving the sequence value invoking request sent by the second server, obtain the sequence object that has been created, and read the current sequence value of the sequence object.
[0118] 生成模块 703, 用于根据预设的步长以及所述当前序列值, 生成所述序列对象 的下一序列值, 并更新所述序列对象的当前序列值为所述下一序列值。 [0118] The generating module 703 is configured to generate a next sequence value of the sequence object according to the preset step size and the current sequence value, and update a current sequence value of the sequence object to the next sequence value. .
[0119] 第二获取模块 704, 用于获取所述序列值调用请求所携带的卡号长度值以及获 取更新后的所述当前序列值的字符长度。 [0119] The second obtaining module 704 is configured to acquire a card number length value carried by the sequence value invoking request and obtain a character length of the updated current sequence value.
[0120] 第三获取模块 705, 用于根据所述卡号长度值与所述当前序列值的字符长度的 差值, 获取字符长度为所述差值的每一数值。 [0120] The third obtaining module 705 is configured to obtain, according to a difference between the card number length value and a character length of the current sequence value, each character whose character length is the difference value.
[0121] 第四获取模块 706, 用于根据每一所述数值所预先设置的选取概率, 获取所述 选取概率最高的一个或多个所述数值, 并将其中的一个所述数值确定为当前吋 刻所生成的随机码。 [0121] The fourth obtaining module 706 is configured to obtain one or more values of the highest selection probability according to a selection probability preset by each of the values, and determine one of the values as the current Engrave the generated random code.
[0122] 返回模块 707, 用于将更新后的所述当前序列值返回至所述第二服务器, 以使 所述第二服务器将更新后的所述当前序列值输出为实体卡号。 [0122] The returning module 707 is configured to return the updated current sequence value to the second server, so that the second server outputs the updated current sequence value as a physical card number.
[0123] 可选地, 所述创建模块 701包括: [0123] Optionally, the creating module 701 includes:
[0124] 第一获取子模块, 用于获取用户输入的与所述序列对象相关的属性参数, 所述 属性参数包括最小序列值、 最大序列值、 步长、 初始值以及循环选项值。 And a first obtaining submodule, configured to acquire, by the user, an attribute parameter related to the sequence object, where the attribute parameter includes a minimum sequence value, a maximum sequence value, a step size, an initial value, and a loop option value.
[0125] 创建子模块, 用于在第一服务器所预先建立的数据库中, 基于所述属性参数创 建序列对象, 并将所述初始值输出为所述序列对象的当前序列值。 [0125] a submodule is created, configured to create a sequence object based on the attribute parameter in a database pre-established by the first server, and output the initial value as a current sequence value of the sequence object.
[0126] 可选地, 所述实体卡号生成装置还包括: [0126] Optionally, the physical card number generating apparatus further includes:
[0127] 停止模块, 用于若所述序列对象的当前序列值与所述最大序列值相同, 且所述 循环选项值为不循环, 则停止生成所述序列对象的下一序列值。 [0127] a stopping module, configured to: if a current sequence value of the sequence object is the same as the maximum sequence value, and If the loop option value is not looped, then the next sequence value of the sequence object is stopped.
[0128] 提示模块, 用于令所述数据库发出序列值耗尽提示, 并在接收到所述第二服务 器发出的序列值调用请求吋, 返回拒绝响应。 [0128] a prompting module, configured to cause the database to issue a sequence value exhaustion prompt, and return a rejection response after receiving the sequence value invoking request sent by the second server.
[0129] 可选地, 所述实体卡号生成装置还包括: [0129] Optionally, the physical card number generating apparatus further includes:
[0130] 记录模块, 用于获取历史记录数据表, 所述历史记录数据表用于记录各个吋刻 所生成的历史随机码。 [0130] The recording module is configured to acquire a history data table, where the history data table is used to record the historical random code generated by each engraving.
[0131] 第一确定模块, 用于根据历史记录数据表所存储的各个历史随机码, 确定当前 吋刻所生成的所述随机码的在所述历史记录数据表中的出现次数。 [0131] The first determining module is configured to determine, according to each historical random code stored in the history data table, the number of occurrences of the random code generated by the current engraving in the historical record data table.
[0132] 第二确定模块, 用于对于所述随机码的每一字符位, 确定所述历史随机码在该 字符位上的数值与所述随机码在该字符位上的数值相同的累积次数。 [0132] a second determining module, configured to determine, for each character bit of the random code, a cumulative number of times the value of the historical random code on the character bit is the same as the value of the random code on the character bit .
[0133] 输入模块, 用于将所述随机码的字符长度 x、 所述出现次数 y以及所述累积次数 z输入预设公式, 得到输出参数 P。 [0133] The input module is configured to input the character length x of the random code, the number of occurrences y, and the cumulative number of times z into a preset formula to obtain an output parameter P.
[0134] 调整模块, 用于将所述随机码的选取概率调整为所述输出参数!5。 [0134] an adjustment module, configured to adjust a selection probability of the random code to the output parameter! 5 .
[0135] 其中, 所述预设公式如下: [0135] wherein the preset formula is as follows:
[0136] P=(l-y/z)/10 " , y≠0^.z≠0; P=(l-y/z)/10 " , y≠0^.z≠0;
[0137] P=(l+z/10 ") /10 " , y≠0^.z≠0; [0137] P=(l+z/10 ") /10 " , y≠0^.z≠0;
[0138] Ρ=1/10 χ, y=0且 ζ=0。 [0138] Ρ=1/10 χ , y=0 and ζ=0.
[0139] 可选地, 所述返回模块 707包括: [0139] Optionally, the returning module 707 includes:
[0140] 査找子模块, 用于根据所述序列值调用请求所携带的业务标识, 在预设的数据 表中, 査找与所述业务标识对应的业务代码。 [0140] The search submodule is configured to invoke the service identifier carried by the request according to the sequence value, and search for a service code corresponding to the service identifier in a preset data table.
[0141] 拼接子模块, 用于依次拼接所述业务代码、 所述随机码以及更新后的所述当前 序列值, 并将拼接结果返回至所述第二服务器, 以使所述第二服务器将所述拼 接结果输出为实体卡号。 [0141] a splicing submodule, configured to sequentially splicing the service code, the random code, and the updated current sequence value, and returning the splicing result to the second server, so that the second server The splicing result is output as a physical card number.
[0142] 图 8是本申请一实施例提供的电子设备的示意图。 如图 8所示, 该实施例的电子 设备 8包括: 处理器 80、 存储器 81以及存储在所述存储器 81中并可在所述处理器 80上运行的计算机可读指令 82, 例如实体卡号生成程序。 所述处理器 80执行所 述计算机可读指令 82吋实现上述各个实体卡号生成方法实施例中的步骤, 例如 图 2所示的步骤 201至 207。 或者, 所述处理器 80执行所述计算机可读指令 82吋实 现上述各装置实施例中各模块 /单元的功能, 例如图 7所示模块 701至 707的功能。 8 is a schematic diagram of an electronic device according to an embodiment of the present application. As shown in FIG. 8, the electronic device 8 of this embodiment includes: a processor 80, a memory 81, and computer readable instructions 82 stored in the memory 81 and executable on the processor 80, such as physical card number generation. program. The processor 80 executes the computer readable instructions 82 to implement the steps in the foregoing embodiments of the respective physical card number generation methods, such as steps 201 to 207 shown in FIG. Alternatively, the processor 80 executes the computer readable instructions 82 The functions of the modules/units in the above-described respective device embodiments, such as the functions of the modules 701 to 707 shown in FIG.
[0143] 示例性的, 所述计算机可读指令 82可以被分割成一个或多个模块 /单元, 所述 一个或者多个模块 /单元被存储在所述存储器 81中, 并由所述处理器 80执行, 以 完成本申请。 所述一个或多个模块 /单元可以是能够完成特定功能的一系列计算 机可读指令段, 该指令段用于描述所述计算机可读指令 82在所述电子设备 8中的 执行过程。 [0143] Illustratively, the computer readable instructions 82 may be partitioned into one or more modules/units, the one or more modules/units being stored in the memory 81 and by the processor 80 is executed to complete the application. The one or more modules/units may be a series of computer readable instruction segments capable of performing a particular function, the instruction segments being used to describe the execution of the computer readable instructions 82 in the electronic device 8.
[0144] 所述电子设备 8可以是桌上型计算机、 笔记本、 掌上电脑及云端服务器等计算 设备。 所述电子设备可包括, 但不仅限于, 处理器 80、 存储器 81。 本领域技术 人员可以理解, 图 8仅仅是电子设备 8的示例, 并不构成对电子设备 8的限定, 可 以包括比图示更多或更少的部件, 或者组合某些部件, 或者不同的部件, 例如 所述电子设备还可以包括输入输出设备、 网络接入设备、 总线等。 [0144] The electronic device 8 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. The electronic device can include, but is not limited to, a processor 80, a memory 81. It will be understood by those skilled in the art that FIG. 8 is merely an example of the electronic device 8, and does not constitute a limitation on the electronic device 8, and may include more or less components than those illustrated, or combine some components, or different components. For example, the electronic device may further include an input/output device, a network access device, a bus, and the like.
[0145] 所称处理器 80可以是中央处理单元 (Central Processing Unit, CPU) , 还可以是其 他通用处理器、 数字信号处理器(Digital Signal Processor, DSP)、 专用集成电路 (Application Specific Integrated Circuit, ASIC)、 现成可编程门阵列 The processor 80 may be a central processing unit (CPU), or may be another general-purpose processor, a digital signal processor (DSP), or an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), ready-to-use programmable gate array
(Field-Programmable Gate Array , FPGA)或者其他可编程逻辑器件、 分立门或者 晶体管逻辑器件、 分立硬件组件等。 通用处理器可以是微处理器或者该处理器 也可以是任何常规的处理器等。 (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
[0146] 所述存储器 81可以是所述电子设备 8的内部存储单元, 例如电子设备 8的硬盘或 内存。 所述存储器 81也可以是所述电子设备 8的外部存储设备, 例如所述电子设 备 8上配备的插接式硬盘, 智能存储卡 (Smart Media Card, [0146] The memory 81 may be an internal storage unit of the electronic device 8, such as a hard disk or a memory of the electronic device 8. The memory 81 may also be an external storage device of the electronic device 8, such as a plug-in hard disk provided on the electronic device 8, and a smart memory card (Smart Media Card,
SMC) , 安全数字 (Secure Digital, SD) 卡, 闪存卡 (Flash Card) 等。 进一步 地, 所述存储器 81还可以既包括所述电子设备 8的内部存储单元也包括外部存储 设备。 所述存储器 81用于存储所述计算机可读指令以及所述电子设备所需的其 他程序和数据。 所述存储器 81还可以用于暂吋地存储已经输出或者将要输出的 数据。 SMC), Secure Digital (SD) card, Flash Card, etc. Further, the memory 81 may also include both an internal storage unit of the electronic device 8 and an external storage device. The memory 81 is for storing the computer readable instructions and other programs and data required by the electronic device. The memory 81 can also be used to temporarily store data that has been output or is about to be output.
[0147] 另外, 在本申请各个实施例中的各功能单元可以集成在一个处理单元中, 也可 以是各个单元单独物理存在, 也可以两个或两个以上单元集成在一个单元中。 上述集成的单元既可以采用硬件的形式实现, 也可以采用软件功能单元的形式 实现。 [0147] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. Realized.
[0148] 所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用 吋, 可以存储在一个计算机可读取存储介质中。 基于这样的理解, 本申请的技 术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分 可以以软件产品的形式体现出来, 该计算机软件产品存储在一个存储介质中, 包括若干指令用以使得一台计算机设备 (可以是个人计算机, 服务器, 或者网 络设备等) 执行本申请各个实施例所述方法的全部或部分步骤。 而前述的存储 介质包括: U盘、 移动硬盘、 只读存储器 (ROM, Read-Only Memory) 、 随机 存取存储器 (RAM, Random Access Memory) 、 磁碟或者光盘等各种可以存储 程序代码的介质。 [0148] The integrated unit, if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application, in essence or the contribution to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium. A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: a U disk, a removable hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like, which can store program codes. .
[0149] 以上所述, 以上实施例仅用以说明本申请的技术方案, 而非对其限制; 尽管参 照前述实施例对本申请进行了详细的说明, 本领域的普通技术人员应当理解: 其依然可以对前述各实施例所记载的技术方案进行修改, 或者对其中部分技术 特征进行等同替换; 而这些修改或者替换, 并不使相应技术方案的本质脱离本 申请各实施例技术方案的精神和范围。 The above embodiments are only used to explain the technical solutions of the present application, and are not limited thereto; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that The technical solutions described in the foregoing embodiments may be modified, or some of the technical features may be equivalently replaced; and the modifications or substitutions do not deviate from the spirit and scope of the technical solutions of the embodiments of the present application. .
Claims
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710811816.6A CN107622102B (en) | 2017-09-11 | 2017-09-11 | Entity card number generation method and terminal device |
| CN201710811816.6 | 2017-09-11 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2019047351A1 true WO2019047351A1 (en) | 2019-03-14 |
Family
ID=61089557
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2017/108621 Ceased WO2019047351A1 (en) | 2017-09-11 | 2017-10-31 | Method, device, electronic apparatus and medium for generating physical card number |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN107622102B (en) |
| WO (1) | WO2019047351A1 (en) |
Families Citing this family (11)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108664821B (en) * | 2018-05-08 | 2021-11-30 | 北京小米移动软件有限公司 | Card copying method, device and storage medium |
| CN108829650B (en) * | 2018-06-01 | 2022-08-23 | 腾讯科技(北京)有限公司 | Card number generation method, device, server and storage medium |
| CN110765738A (en) * | 2018-07-24 | 2020-02-07 | 鸿合科技股份有限公司 | System and method for generating card number and electronic equipment |
| CN110888910A (en) * | 2018-09-11 | 2020-03-17 | 北京京东尚科信息技术有限公司 | Number segment switching method and device for unique identification code |
| CN111225073B (en) * | 2018-11-26 | 2023-05-12 | 北京京东尚科信息技术有限公司 | Service code distribution method and device, storage medium and computer system |
| CN110795604A (en) * | 2019-10-29 | 2020-02-14 | 中国工商银行股份有限公司 | Method, apparatus, computing device and medium for generating transaction serial number |
| CN111125569A (en) * | 2019-12-25 | 2020-05-08 | 北京同邦卓益科技有限公司 | Data identifier generation method and device, electronic equipment and medium |
| CN112835555A (en) * | 2021-01-22 | 2021-05-25 | 广东智源机器人科技有限公司 | Random number generation method, device and equipment |
| CN113342819B (en) * | 2021-06-28 | 2024-09-20 | 深圳前海微众银行股份有限公司 | Card number generation method, device, equipment and storage medium |
| CN113721887A (en) * | 2021-08-30 | 2021-11-30 | 上海通联金融服务有限公司 | Method for generating system card number by random hash algorithm |
| CN114297212B (en) * | 2021-12-28 | 2025-07-15 | 金蝶云科技有限公司 | Method and system for generating voucher number |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20120105462A1 (en) * | 2010-10-28 | 2012-05-03 | Mizuho-Dl Financial Technology Co., Ltd. | Parallelization of random number generation processing by employing gpu |
| CN103164418A (en) * | 2011-12-12 | 2013-06-19 | 阿里巴巴集团控股有限公司 | Method and device for processing serial numbers |
| CN104866601A (en) * | 2015-06-01 | 2015-08-26 | 走遍世界(北京)信息技术有限公司 | Serial number generating method and device |
| CN106657216A (en) * | 2016-09-19 | 2017-05-10 | 腾讯征信有限公司 | Serial number generation method and serial number generation device |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| GB2502773B (en) * | 2012-05-28 | 2015-03-11 | Swivel Secure Ltd | Method and system for secure user identification |
| WO2014131677A1 (en) * | 2013-02-28 | 2014-09-04 | Koninklijke Philips N.V. | Random number generator and stream cipher |
| CN105095263B (en) * | 2014-05-08 | 2019-12-17 | 创新先进技术有限公司 | Method and device for generating card number |
| CN105072160A (en) * | 2015-07-17 | 2015-11-18 | 联动优势科技有限公司 | Serial number generating method and device, and a server |
-
2017
- 2017-09-11 CN CN201710811816.6A patent/CN107622102B/en active Active
- 2017-10-31 WO PCT/CN2017/108621 patent/WO2019047351A1/en not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20120105462A1 (en) * | 2010-10-28 | 2012-05-03 | Mizuho-Dl Financial Technology Co., Ltd. | Parallelization of random number generation processing by employing gpu |
| CN103164418A (en) * | 2011-12-12 | 2013-06-19 | 阿里巴巴集团控股有限公司 | Method and device for processing serial numbers |
| CN104866601A (en) * | 2015-06-01 | 2015-08-26 | 走遍世界(北京)信息技术有限公司 | Serial number generating method and device |
| CN106657216A (en) * | 2016-09-19 | 2017-05-10 | 腾讯征信有限公司 | Serial number generation method and serial number generation device |
Also Published As
| Publication number | Publication date |
|---|---|
| CN107622102B (en) | 2019-04-19 |
| CN107622102A (en) | 2018-01-23 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2019047351A1 (en) | Method, device, electronic apparatus and medium for generating physical card number | |
| CN109597822B (en) | User data storage and query method and user data processing device | |
| US11281793B2 (en) | User permission data query method and apparatus, electronic device and medium | |
| US10795874B2 (en) | Creating index in blockchain-type ledger | |
| CN107395358A (en) | Information request and offer method and apparatus, storage medium and equipment | |
| CN106776809A (en) | A kind of data query method and system | |
| US20200143076A1 (en) | Method for a secure storage of data records | |
| US20230205925A1 (en) | Generating hash values for input strings | |
| US8538013B2 (en) | Rules-driven hash building | |
| CN114448702B (en) | Data encryption method and device based on privacy set intersection | |
| WO2019205790A1 (en) | Data operating method and device | |
| CN112434062A (en) | Quasi-real-time data processing method, device, server and storage medium | |
| CN106062739A (en) | Dynamic stream computing topology | |
| CN113742332B (en) | Data storage method, device, equipment and storage medium | |
| CN112487032A (en) | Data query method and device, storage medium and electronic equipment | |
| CN113468187B (en) | Multi-party data integration method and device, computer equipment and storage medium | |
| CN115002211A (en) | Cloud-native-based after-sale micro-service implementation method, device, equipment and medium | |
| CN112380494B (en) | A method and device for determining object characteristics | |
| CN114116637A (en) | Data sharing method, device, equipment and storage medium | |
| CN117390011A (en) | Report data processing methods, devices, computer equipment and storage media | |
| CN116055144A (en) | Data security analysis method, device, equipment and storage based on internet of things | |
| CN108667647A (en) | A kind of setting method of device parameter, equipment and server | |
| CN114614972A (en) | Data alignment method, system, electronic device and storage medium | |
| CN114840550A (en) | Index generation method, apparatus, computer device, medium, and program product | |
| CN114140256A (en) | Data processing method, apparatus, apparatus, medium and program product |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 30/09/2020) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 17924657 Country of ref document: EP Kind code of ref document: A1 |