CN104866601A - Serial number generating method and device - Google Patents

Serial number generating method and device Download PDF

Info

Publication number
CN104866601A
CN104866601A CN201510294124.XA CN201510294124A CN104866601A CN 104866601 A CN104866601 A CN 104866601A CN 201510294124 A CN201510294124 A CN 201510294124A CN 104866601 A CN104866601 A CN 104866601A
Authority
CN
China
Prior art keywords
character string
sequence number
string
character
system time
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.)
Pending
Application number
CN201510294124.XA
Other languages
Chinese (zh)
Inventor
张洪学
肖武
范彦忠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
All Over World (beijing) Information Technology Co Ltd
Original Assignee
All Over World (beijing) Information Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by All Over World (beijing) Information Technology Co Ltd filed Critical All Over World (beijing) Information Technology Co Ltd
Priority to CN201510294124.XA priority Critical patent/CN104866601A/en
Publication of CN104866601A publication Critical patent/CN104866601A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a serial number generating method and device. Wherein, the method comprises the steps of: acquiring a triggering signal, wherein the triggering signal is used for triggering to generate a new serial number; according to the triggering signal, acquiring a quantity parameter n of a counter; according to the triggering signal, obtaining a current system time; generating the serial number at least according to the quantity parameter n and the system time with a serial number generating algorithm. The method solves the problems of repeated serial number and poor safety caused by the fact that automatically increased serial numbers are used in the prior art.

Description

Sequence number generation method and device
Technical field
The present invention relates to computer realm, in particular to a kind of sequence number generation method and device.
Background technology
In existing large-scale website, sequence number adopts the method from increasing to carry out formation sequence number usually.Namely, when needs formation sequence, accumulating operation is carried out on the basis of sequence number last time, obtains new sequence number.
Carry out formation sequence number with the method certainly increased, often can run into some mistakes, such as, when high concurrent request, the sequence number generated can be caused to occur to repeat or lead to errors because processing speed is slow.In addition, the sequence number generated from the method increased is adopted, LINEAR CONTINUOUS, poor stability.
For using from increasing sequence number in prior art, the sequence number caused repeats, and the problem of poor stability, not yet proposes effective solution at present.
Summary of the invention
Fundamental purpose of the present invention is to provide a kind of sequence number generation method and device, uses from increasing sequence number to solve in prior art, and the sequence number caused repeats, the problem of poor stability.
To achieve these goals, according to an aspect of the embodiment of the present invention, a kind of sequence number generation method is provided.The method comprises: obtain trigger pip, and trigger pip generates new sequence number for triggering; According to trigger pip, obtain the number parameter n of counter; According to trigger pip, obtain present system time; At least according to number parameter n and system time according to serial number gencration algorithm formation sequence number.
To achieve these goals, according to the another aspect of the embodiment of the present invention, provide a kind of sequence number generating apparatus, this device comprises: the first acquisition module, and for obtaining trigger pip, trigger pip generates new sequence number for triggering; Second acquisition module, for according to trigger pip, obtains the number parameter n of counter; 3rd acquisition module, for according to trigger pip, obtains present system time; Processing module, at least according to number parameter n and system time according to serial number gencration algorithm formation sequence number.
According to inventive embodiments, by obtaining trigger pip, trigger pip generates new sequence number for triggering; According to trigger pip, obtain the number parameter n of counter; According to trigger pip, obtain present system time; At least according to number parameter n and system time according to serial number gencration algorithm formation sequence number, solve prior art and use from increasing sequence number, the sequence number caused repeats, the problem of poor stability.Achieve at least by number parameter n and system time Two Variables formation sequence number, prevent the effect that sequence number duplicates.
Accompanying drawing explanation
The accompanying drawing forming a application's part is used to provide a further understanding of the present invention, and schematic description and description of the present invention, for explaining the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is the process flow diagram of the sequence number generation method according to the embodiment of the present invention one;
Fig. 2 is the structural representation of the sequence number generating apparatus according to the embodiment of the present invention two;
Fig. 3 is the structural representation according to the optional sequence number generating apparatus of the embodiment of the present invention two; And
Fig. 4 is the structural representation according to the optional sequence number generating apparatus of the embodiment of the present invention two.
Embodiment
It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combine mutually.Below with reference to the accompanying drawings and describe the present invention in detail in conjunction with the embodiments.
The present invention program is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the embodiment of a part of the present invention, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, should belong to the scope of protection of the invention.
It should be noted that, term " first ", " second " etc. in instructions of the present invention and claims and above-mentioned accompanying drawing are for distinguishing similar object, and need not be used for describing specific order or precedence.Should be appreciated that the data used like this can be exchanged, in the appropriate case so that embodiments of the invention described herein.In addition, term " comprises " and " having " and their any distortion, intention is to cover not exclusive comprising, such as, contain those steps or unit that the process of series of steps or unit, method, system, product or equipment is not necessarily limited to clearly list, but can comprise clearly do not list or for intrinsic other step of these processes, method, product or equipment or unit.
Embodiment 1
Embodiments provide a kind of sequence number generation method.Fig. 1 is the process flow diagram of the sequence number generation method according to the embodiment of the present invention.As shown in Figure 1, it is as follows that the method comprising the steps of:
Step S11, obtains trigger pip, and trigger pip generates new sequence number for triggering.
Concrete, when needing to generate new sequence number, send trigger pip to server.Whether get trigger pip by step S11, judge whether to generate new sequence number.
Step S13, according to trigger pip, obtains the number parameter n of counter.
Concrete, in step s 13, when getting trigger pip, obtain the number parameter n in counter, wherein, number parameter n as a part for sequence number, for marking the quantity of formation sequence number.Certainly, the number parameter n in counter can reset once, to be recorded in the number of the sequence number generated in current time interval each regular time.Such as, can per hour, every day, weekly the number parameter n in counter is reset.
Step S15, according to trigger pip, obtains present system time.
Concrete, in step S15, when getting trigger pip, except obtaining the number parameter n in counter, also obtain the time of current system.Wherein, system time can be the system time receiving trigger pip, also can be the system time performing sequence number generation method, also can be the transmitting apparatus sending trigger pip, the system time obtained from transmitting apparatus when sending.In addition, in advance according to the frequency that sequence number generates, the precision obtaining system time can also be set.
Step S17, at least according to number parameter n and system time according to serial number gencration algorithm formation sequence number.
Concrete, in step S17, the system time that the number parameter n got by step 13 to major general and step 15 are got combines according to predetermined serial number gencration algorithm, formation sequence number.Concrete generating algorithm, can according to the demand of reality, to number parameter n and system time according to predetermined rule, carries out arranging, combining, generates the sequence number conformed to actual demand.
In addition, can also according to trigger pip, obtain the facility information such as IP address, MAC Address, IMEI sequence number of the transmitting apparatus sending trigger pip, facility information for the server of formation sequence number, when formation sequence, can one or more according to serial number gencration algorithm formation sequence number by the above-mentioned facility information got.
By above-mentioned steps S11 to step S17, obtain trigger pip, and obtain the number parameter n and system time that are used for formation sequence number according to trigger pip, by number parameter n and system time according to serial number gencration algorithm, formation sequence number.Said method, at least carry out formation sequence number by number parameter n and this Two Variables of system time, both the quantity of formation sequence in section sometime number had been reflected in by number parameter n, again by the temporal information of system time reflection sequence number generation, also utilize above-mentioned number parameter n and system time at least Two Variables simultaneously, avoid sequence number to repeat the problem generated.
In summary, the invention solves in prior art and use from increasing sequence number, the sequence number caused repeats, and the problem of poor stability, achieves at least by number parameter n and system time Two Variables formation sequence number, prevent the effect that sequence number duplicates.
Preferably, in the above embodiments of the present application, in step S17 at least according to number parameter and system time according in serial number gencration algorithm formation sequence number, comprising:
Step S171, generates the init string of predetermined figure.
Step S173, replaces init string by number parameter, generates intermediate character string.
Step S175, replaces intermediate character string, formation sequence number by system time.
Concrete, by step S171 to step S175, when formation sequence, the character string that first generation one is initial, the character in character string is set to original character, such as, alphabet in character string can be set to " 0 ".Then by the precalculated position in the init string of number parameter discrepancy that gets, intermediate character string is generated.Finally the system time got is replaced in intermediate character string, formation sequence number.
Wherein, number parameter and system time according to the front and back position of character string, successively can replace init string according to character sequence; Also can pre-set Substitution Rules, number parameter and system time are replaced to preposition according to the Substitution Rules pre-set.
In the middle of practical application, for metric character string, first the init string " 000000000000 " of a group 12 " 0 " can be generated, then by the number parameter " 18 " that gets and system time " 20150305 ", replace original character according to sequencing, generate the sequence number " 001820150315 " of 12.
Preferably, in the above embodiments of the present application, in step S13 according to trigger pip, after obtaining the number parameter of counter, said method also comprises:
Step S141, compares number parameter n and the threshold value pre-set.
Step S143, when number parameter n is more than or equal to threshold value, is set to 0 by the number parameter n of counter.
Step S145, when number parameter n is less than threshold value, is set to n+1 by the number parameter n of counter.
Concrete, because the figure place of sequence number limited, when the number parameter in counter is excessive, easily cause sequence number generation error.Therefore, by above-mentioned steps S141 to step S145, the maximal value of number parameter n is judged.When number parameter n is more than or equal to the threshold value pre-set, rezero operation is carried out to counter.When number parameter n is less than the threshold value pre-set, add-one operation is carried out to the skilled parameter in counter.
Preferably, in the above embodiments of the present application, sequence number is scale-of-two, scale-of-eight, the decimal system or sexadecimal.
Concrete, according to actual needs, the sequence number generated by said method can be scale-of-two, scale-of-eight, the decimal system or sexadecimal, can strengthen the dirigibility of sequence number in application and the adaptability of raising sequence number.In addition, certainly can also be generated the sequence number of arbitrary carry system by said method, to increase the complexity of sequence number, that improves sequence number cracks difficulty.
Preferably, in the above embodiments of the present application, in step S173, number parameter is replaced init string, generates in intermediate character string, comprising:
Step S1731, is converted to binary first character string by number parameter.
Step S1733, uses the first character string to replace the first precalculated position character of init string, generates intermediate character string.
Concrete, by step S1731 to step S1733.First the number parameter in counter is changed, obtain the first character string, then replace the first precalculated position of init string by the first character string, generate intermediate character string.
In the middle of practical application, for the scale-of-two of 64, when needing the binary-coded serial numbers of generation 64, character string front 18 for representing number parameter.The maximum displayed value of the scale-of-two of 18 is metric 262143, therefore, can be 260000 by the threshold value of number parameter.Number parameter in counter is " 2580 " (decimal system), now, is changed by system, obtains binary first character string of 12 for " 101000010100 ".1st to the 18th character of the intermediate character string obtained after first character string of obtain 12 is replaced init string, the 1st after replacement to the 18th character is " 000000101000010100 ".
Further, in the above embodiments of the present application, in step S175, system time is replaced intermediate character string, in formation sequence number, comprising:
Step S1751a, is converted to binary second character string by system time.
Step S1753a, uses the second character string to replace the second precalculated position character of intermediate character string, formation sequence number.
Concrete, after generation first character string, by step S1751a to step S1753a, first, the system time got system is as required changed.Then the second character string be converted to is replaced the respective symbols in the second precalculated position in intermediate character string, obtain complete sequence number.
In actual applications, for scale-of-two, first, the system time got " 20150315 " is changed, after conversion, obtain binary second character string " 1001100110111100000101011 " of 25.The second character string be converted to is replaced the 25th to the 55th character of intermediate character string, the 25th that obtains after replacement to the 55th character is " 10011001101111000001010110000000 ".
As from the foregoing, number parameter and the character string of system time through being converted to, likely different from needing the figure place of the character string of replacing, we can, according to the type of numeral, select to carry out polishing character string with " 0 " before or after the character string through being converted to.Such as, when carrying out polishing operation to number parameter, can before character string, " 0 " be used to carry out polishing operation.When carrying out polishing operation to system time, can after character string, " 0 " be used not play operation.Concrete mode, can arrange according to actual needs, repeat no more herein.
Preferably, in the above embodiments of the present application, system time is replaced intermediate character string by step S175, and formation sequence number comprises:
Step S1751b, is converted to binary three-character doctrine string by system time.
Step S1753b, judges whether the figure place of three-character doctrine string is greater than book character figure place.
Step S1755b, when the figure place of three-character doctrine string is less than or equal to book character figure place, uses three-character doctrine string to replace the 3rd precalculated position character of intermediate character string, formation sequence number.
Step S1757b, when the figure place of three-character doctrine string is greater than book character figure place, replaces the 3rd precalculated position character of intermediate character string to three-character doctrine string after doing negate computing, and the 3rd last position, precalculated position character of intermediate character string is set to 1.
Concrete, when carrying out system conversion, especially when high system is to low system conversion, because the numeral of high system is excessive, cause in transfer process, the digit of low system exceeds predetermined figure.So, by step S1751b to step S1757b, the figure place of the three-character doctrine string after conversion is judged, carry out abnormality processing to the three-character doctrine string exceeding book character figure place.
Preferably, in the above embodiments of the present application, when the server for formation sequence number is at least two, use the first character string to replace the first precalculated position character of init string in step S1733, after generating intermediate character string, method also comprises:
Step S1734, obtains the numeral number of server.
Step S1735, is converted to binary 4th character string by numeral number.
Step S1736, uses the 4th character string to replace the 4th precalculated position character of intermediate character string, generates intermediate character string.
Concrete, when utilizing multiple servers to use above-mentioned serial number gencration method to generate sequence number simultaneously, the numeral number of server can be added in sequence number.Wherein, by step S1734 to step S1736, first the numeral number of server is converted to binary 4th character string, the 4th character string is replaced the 4th precalculated position of intermediate character string, generate new intermediate character string.
In sum, in the middle of practical application, memcache network processes framework can be used, the algorithm of above-mentioned sequence number generation method is embedded in memcached, when the specific key of in called side get memcached time, triggers above-mentioned serial number gencration algorithm, produce 64 bit digital sequence numbers, return to called side, improve network frame, forbid that multithreading starts, this service entirety is one process service.
Wherein, select the network frame reason of memcache as follows:
1, memcache is a kind of high-performance internal memory process service, can process high concurrent request.
2, the technology maturation of memcache, stable.
Use the advantage of above-mentioned sequence number generation method:
1, comprise the much information such as time, Servers installed in the sequence number generated by said method, enrich than the simple content adopting the sequence number generated from the method increased to comprise.
2, by the linear discontinuous feature increased progressively of sequence number that said method generates, malice conjecture is prevented.
3, legitimate verification can be carried out to the sequence number generated by said method.
When multiple servers uses said method formation sequence, concrete dispositions method is as follows:
Can in multiple servers deploy, the different numbering of every platform service configuration can dispose 16 at most, by said method in theory these 16 per secondly can produce more than 100 ten thousand unduplicated sequence numbers, the longest can ensure to use 20-30 not an occurrence sequence number situation about repeating occur.The mode that specifically multimachine can be adopted to dispose according to sequence number generated frequency, formation sequence number, to improve system concurrency and handling capacity, and fault-tolerant ability.
Embodiment 2
The embodiment of the present invention additionally provides a kind of sequence number generating apparatus, and as shown in Figure 2, this device can comprise: the first acquisition module 21, second acquisition module 23, the 3rd acquisition module 25 and processing module 27.
Wherein, the first acquisition module 21, for obtaining trigger pip, trigger pip generates new sequence number for triggering;
Second acquisition module 23, for according to trigger pip, obtains the number parameter n of counter;
3rd acquisition module 25, for according to trigger pip, obtains present system time;
Processing module 27, at least according to number parameter n and system time according to serial number gencration algorithm formation sequence number.
By the first acquisition module 21, second acquisition module 23, the 3rd acquisition module 25 and processing module 27, obtain trigger pip, and the number parameter n and system time that are used for formation sequence number is obtained according to trigger pip, by number parameter n and system time according to serial number gencration algorithm, formation sequence number.Said method, at least carry out formation sequence number by number parameter n and this Two Variables of system time, both the quantity of formation sequence in section sometime number had been reflected in by number parameter n, again by the temporal information of system time reflection sequence number generation, also utilize above-mentioned number parameter n and system time at least Two Variables simultaneously, avoid sequence number to repeat the problem generated.
In summary, the invention solves in prior art and use from increasing sequence number, the sequence number caused repeats, and the problem of poor stability, achieves at least by number parameter n and system time Two Variables formation sequence number, prevent the effect that sequence number duplicates.
Preferably, as shown in Figure 3, in the above embodiments of the present application, processing module 27 comprises: first generates submodule 271, second generates submodule 273 and the 3rd generation submodule 275.
Wherein, first generates submodule 271, for generating the init string of predetermined figure.Second generates submodule 273, for number parameter is replaced init string, generates intermediate character string.3rd generates submodule 275, for system time being replaced intermediate character string, formation sequence number.
Concrete, generate submodule 271, second by first and generate submodule 273 and the 3rd generation submodule 275, when formation sequence, first the character string that generation one is initial, character in character string is set to original character, such as, alphabet in character string can be set to " 0 ".Then by the precalculated position in the init string of number parameter discrepancy that gets, intermediate character string is generated.Finally the system time got is replaced in intermediate character string, formation sequence number.
Wherein, number parameter and system time according to the front and back position of character string, successively can replace init string according to character sequence; Also can pre-set Substitution Rules, number parameter and system time are replaced to preposition according to the Substitution Rules pre-set.
In the middle of practical application, for metric character string, first the init string " 000000000000 " of a group 12 " 0 " can be generated, then by the number parameter " 18 " that gets and system time " 20150305 ", replace original character according to sequencing, generate the sequence number " 001820150315 " of 12.
Preferably, as shown in Figure 4, in the above embodiments of the present application, device also comprises: judge module 241, first arranges module 243 and second and arranges module 245.
Wherein, judge module 241, for comparing number parameter n and the threshold value pre-set.
First arranges module 243, and the number parameter n of counter, when number parameter n is more than or equal to threshold value, is set to 0 by application.
Second arranges module 245, for when number parameter n is less than threshold value, the number parameter n of counter is set to n+1.
Concrete, because the figure place of sequence number limited, when the number parameter in counter is excessive, easily cause sequence number generation error.Therefore, module 243 and second is set by judge module 241, first module 245 is set, the maximal value of number parameter n is judged.When number parameter n is more than or equal to the threshold value pre-set, rezero operation is carried out to counter.When number parameter n is less than the threshold value pre-set, add-one operation is carried out to the skilled parameter in counter.
Further, sequence number is scale-of-two, scale-of-eight, the decimal system or sexadecimal.
Concrete, according to actual needs, the sequence number generated by said method can be scale-of-two, scale-of-eight, the decimal system or sexadecimal, can strengthen the dirigibility of sequence number in application and the adaptability of raising sequence number.In addition, certainly can also be generated the sequence number of arbitrary carry system by said method, to increase the complexity of sequence number, that improves sequence number cracks difficulty.
Further, generate submodule 273 by second and perform above-mentioned steps S1731 to step S1733.First the number parameter in counter is changed, obtain the first character string, then replace the first precalculated position of init string by the first character string, generate intermediate character string.
In the middle of practical application, for the scale-of-two of 64, when needing the binary-coded serial numbers of generation 64, character string front 18 for representing number parameter.The maximum displayed value of the scale-of-two of 18 is metric 262143, therefore, can be 260000 by the threshold value of number parameter.Number parameter in counter is " 2580 " (decimal system), now, is changed by system, obtains binary first character string of 12 for " 101000010100 ".1st to the 18th character of the intermediate character string obtained after first character string of obtain 12 is replaced init string, the 1st after replacement to the 18th character is " 000000101000010100 ".
Further, generate submodule 275 by the 3rd and perform above-mentioned steps S1751a to step S1753a.After generation first character string, generate submodule 275 by the 3rd and perform above-mentioned steps, first, the system time got system is as required changed.Then the second character string be converted to is replaced the respective symbols in the second precalculated position in intermediate character string, obtain complete sequence number.
In actual applications, for scale-of-two, first, the system time got " 20150315 " is changed, after conversion, obtain binary second character string " 1001100110111100000101011 " of 25.The second character string be converted to is replaced the 25th to the 55th character of intermediate character string, the 25th that obtains after replacement to the 55th character is " 10011001101111000001010110000000 ".
As from the foregoing, number parameter and the character string of system time through being converted to, likely different from needing the figure place of the character string of replacing, we can, according to the type of numeral, select to carry out polishing character string with " 0 " before or after the character string through being converted to.Such as, when carrying out polishing operation to number parameter, can before character string, " 0 " be used to carry out polishing operation.When carrying out polishing operation to system time, can after character string, " 0 " be used not play operation.Concrete mode, can arrange according to actual needs, repeat no more herein.
Further, generate submodule 275 by the 3rd and perform above-mentioned steps S1751b to step S1757b.When carrying out system conversion, especially when high system is to low system conversion, because the numeral of high system is excessive, cause in transfer process, the digit of low system exceeds predetermined figure.So, generate the figure place of submodule 275 to the three-character doctrine string after conversion by the 3rd and judge, carry out abnormality processing to the three-character doctrine string exceeding book character figure place.
Further, generate submodule 273 by second and perform above-mentioned steps S1734 to step S1736.When utilizing multiple servers to use above-mentioned serial number gencration method to generate sequence number simultaneously, the numeral number of server can be added in sequence number.Wherein, generate submodule 273 by second and perform above-mentioned steps, first the numeral number of server is converted to binary 4th character string, the 4th character string is replaced the 4th precalculated position of intermediate character string, generate new intermediate character string.
It should be noted that, for aforesaid each embodiment of the method, in order to simple description, therefore it is all expressed as a series of combination of actions, but those skilled in the art should know, the present invention is not by the restriction of described sequence of movement, because according to the present invention, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in instructions all belongs to preferred embodiment, and involved action and module might not be that the present invention is necessary.
In the above-described embodiments, the description of each embodiment is all emphasized particularly on different fields, in certain embodiment, there is no the part described in detail, can see the associated description of other embodiments.
In several embodiments that the application provides, should be understood that, disclosed device, the mode by other realizes.Such as, device embodiment described above is only schematic, the such as division of described unit, be only a kind of logic function to divide, actual can have other dividing mode when realizing, such as multiple unit or assembly can in conjunction with or another system can be integrated into, or some features can be ignored, or do not perform.Another point, shown or discussed coupling each other or direct-coupling or communication connection can be by some interfaces, and the indirect coupling of device or unit or communication connection can be electrical or other form.
The described unit illustrated as separating component or can may not be and physically separates, and the parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of unit wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, also can be that the independent physics of unit exists, also can two or more unit in a unit integrated.Above-mentioned integrated unit both can adopt the form of hardware to realize, and the form of SFU software functional unit also can be adopted to realize.
If described integrated unit using the form of SFU software functional unit realize and as independently production marketing or use time, can be stored in a computer read/write memory medium.Based on such understanding, the part that technical scheme of the present invention contributes to prior art in essence in other words or all or part of of this technical scheme can embody with the form of software product, this computer software product is stored in a storage medium, comprises all or part of step of some instructions in order to make a computer equipment (can be personal computer, mobile terminal, server or the network equipment etc.) perform method described in each embodiment of the present invention.And aforesaid storage medium comprises: USB flash disk, ROM (read-only memory) (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), portable hard drive, magnetic disc or CD etc. various can be program code stored medium.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (11)

1. a sequence number generation method, is characterized in that, comprising:
Obtain trigger pip, described trigger pip generates new sequence number for triggering;
According to described trigger pip, obtain the number parameter n of counter;
According to described trigger pip, obtain present system time;
At least according to described number parameter n and described system time according to serial number gencration algorithm formation sequence number.
2. method according to claim 1, is characterized in that, at least comprises according to serial number gencration algorithm formation sequence number according to described number parameter and described system time:
Generate the init string of predetermined figure;
Described number parameter is replaced described init string, generates intermediate character string;
Described system time is replaced described intermediate character string, formation sequence number.
3. method according to claim 2, is characterized in that, according to described trigger pip, after obtaining the number parameter of counter, described method also comprises:
Described number parameter n and the threshold value pre-set are compared;
When described number parameter n is more than or equal to described threshold value, the described number parameter n of described counter is set to 0;
When described number parameter n is less than described threshold value, the described number parameter n of described counter is set to n+1.
4. method according to claim 3, is characterized in that, described sequence number is scale-of-two, scale-of-eight, the decimal system or sexadecimal.
5. method according to claim 4, is characterized in that, when described sequence number is scale-of-two, described described number parameter is replaced described init string, generates intermediate character string and comprises:
Described number parameter is converted to binary first character string;
Use described first character string to replace the first precalculated position character of described init string, generate described intermediate character string.
6. method according to claim 5, is characterized in that, described system time is replaced described intermediate character string, and formation sequence number comprises:
Described system time is converted to binary second character string;
Use described second character string to replace the second precalculated position character of described intermediate character string, generate described sequence number.
7. method according to claim 5, is characterized in that, described system time is replaced described intermediate character string, and formation sequence number comprises:
Described system time is converted to binary three-character doctrine string;
Judge whether the figure place of described three-character doctrine string is greater than book character figure place;
When the figure place of described three-character doctrine string is less than or equal to described book character figure place, uses described three-character doctrine string to replace the 3rd precalculated position character of described intermediate character string, generate described sequence number;
When the figure place of described three-character doctrine string is greater than described book character figure place, replace the 3rd precalculated position character of described intermediate character string after negate computing is done to described three-character doctrine string, and described 3rd last position, the precalculated position character of described intermediate character string is set to 1.
8. according to the method in claim 5 to 7 described in any one, it is characterized in that, when the server for generating described sequence number is at least two, the the first precalculated position character using described first character string to replace described init string, after generating described intermediate character string, described method also comprises:
Obtain the numeral number of described server;
Described numeral number is converted to binary 4th character string;
Use described 4th character string to replace the 4th precalculated position character of described intermediate character string, generate new intermediate character string.
9. a sequence number generating apparatus, is characterized in that, comprising:
First acquisition module, for obtaining trigger pip, described trigger pip generates new sequence number for triggering;
Second acquisition module, for according to described trigger pip, obtains the number parameter n of counter;
3rd acquisition module, for according to described trigger pip, obtains present system time;
Processing module, at least according to described number parameter n and described system time according to serial number gencration algorithm formation sequence number.
10. device according to claim 9, is characterized in that, described processing module comprises:
First generates submodule, for generating the init string of predetermined figure;
Second generates submodule, for described number parameter is replaced described init string, generates intermediate character string;
3rd generates submodule, for described system time being replaced described intermediate character string, formation sequence number.
11. devices according to claim 10, is characterized in that, described device also comprises:
Judge module, for comparing described number parameter n and the threshold value pre-set;
First arranges module, and the described number parameter n of described counter, when described number parameter n is more than or equal to described threshold value, is set to 0 by application;
Second arranges module, for when described number parameter n is less than described threshold value, the described number parameter n of described counter is set to n+1.
CN201510294124.XA 2015-06-01 2015-06-01 Serial number generating method and device Pending CN104866601A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510294124.XA CN104866601A (en) 2015-06-01 2015-06-01 Serial number generating method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510294124.XA CN104866601A (en) 2015-06-01 2015-06-01 Serial number generating method and device

Publications (1)

Publication Number Publication Date
CN104866601A true CN104866601A (en) 2015-08-26

Family

ID=53912427

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510294124.XA Pending CN104866601A (en) 2015-06-01 2015-06-01 Serial number generating method and device

Country Status (1)

Country Link
CN (1) CN104866601A (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105279688A (en) * 2015-10-23 2016-01-27 上海钢富电子商务有限公司 Order form data processing method and system
CN106649566A (en) * 2016-11-14 2017-05-10 上海艾融软件股份有限公司 Serial number generation method and device
CN106790510A (en) * 2016-12-16 2017-05-31 北京小米移动软件有限公司 The generation method of sequence number, device and system
CN108050653A (en) * 2017-10-31 2018-05-18 青岛海尔空调电子有限公司 Precision air conditioner startup password collocation method, configuration system and precision air conditioner
CN108681528A (en) * 2018-04-03 2018-10-19 卓望数码技术(深圳)有限公司 A kind of sequence number generation method and system
CN108763172A (en) * 2018-05-18 2018-11-06 郑州云海信息技术有限公司 The method and device of customization sequence number is automatically generated under a kind of linux system
WO2019047351A1 (en) * 2017-09-11 2019-03-14 平安科技(深圳)有限公司 Method, device, electronic apparatus and medium for generating physical card number
CN109474574A (en) * 2018-09-07 2019-03-15 阿里巴巴集团控股有限公司 A kind of data ciphering method and device, a kind of data decryption method and device
CN109493025A (en) * 2018-10-23 2019-03-19 中国银行股份有限公司 A kind of account generation method and device
CN112035477A (en) * 2020-08-31 2020-12-04 平安医疗健康管理股份有限公司 Serial number conversion method and device of medical insurance text and computer equipment
CN112511662A (en) * 2020-11-20 2021-03-16 珠海格力电器股份有限公司 System communication address generation and distribution method and device and air conditioning system
CN114595105A (en) * 2022-05-09 2022-06-07 深圳佰维存储科技股份有限公司 PSN uniqueness design method and device, readable storage medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101533414A (en) * 2009-04-15 2009-09-16 阿里巴巴集团控股有限公司 A method and a device for generating unique identifier of database record
CN101626291A (en) * 2008-07-07 2010-01-13 谈剑锋 ECC algorithm-based identity authentication system and identity authentication method
CN102217363A (en) * 2008-11-14 2011-10-12 华为技术有限公司 System and method for name binding for multiple packet data network access
US20130166701A1 (en) * 2011-12-27 2013-06-27 Intel Mobile Communications GmbH System Having Trace Resources

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101626291A (en) * 2008-07-07 2010-01-13 谈剑锋 ECC algorithm-based identity authentication system and identity authentication method
CN102217363A (en) * 2008-11-14 2011-10-12 华为技术有限公司 System and method for name binding for multiple packet data network access
CN101533414A (en) * 2009-04-15 2009-09-16 阿里巴巴集团控股有限公司 A method and a device for generating unique identifier of database record
US20130166701A1 (en) * 2011-12-27 2013-06-27 Intel Mobile Communications GmbH System Having Trace Resources

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MAGNETO7: "MongoDB中的_id和ObjectId", 《CSDN博客 HTTP://M.BLOG.CSDN.NET/MAGNETO7/ARTICLE/DETAILS/23842941》 *
郭翔: "基于J2EE开源框架的自测***的设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105279688A (en) * 2015-10-23 2016-01-27 上海钢富电子商务有限公司 Order form data processing method and system
CN106649566B (en) * 2016-11-14 2019-10-15 上海艾融软件股份有限公司 A kind of sequence number generation method and device
CN106649566A (en) * 2016-11-14 2017-05-10 上海艾融软件股份有限公司 Serial number generation method and device
CN106790510A (en) * 2016-12-16 2017-05-31 北京小米移动软件有限公司 The generation method of sequence number, device and system
CN106790510B (en) * 2016-12-16 2020-07-31 北京小米移动软件有限公司 Method, device and system for generating serial number
WO2019047351A1 (en) * 2017-09-11 2019-03-14 平安科技(深圳)有限公司 Method, device, electronic apparatus and medium for generating physical card number
CN108050653A (en) * 2017-10-31 2018-05-18 青岛海尔空调电子有限公司 Precision air conditioner startup password collocation method, configuration system and precision air conditioner
CN108050653B (en) * 2017-10-31 2020-12-08 青岛海尔空调电子有限公司 Precise air conditioner starting password configuration method and system and precise air conditioner
CN108681528A (en) * 2018-04-03 2018-10-19 卓望数码技术(深圳)有限公司 A kind of sequence number generation method and system
CN108763172A (en) * 2018-05-18 2018-11-06 郑州云海信息技术有限公司 The method and device of customization sequence number is automatically generated under a kind of linux system
CN109474574A (en) * 2018-09-07 2019-03-15 阿里巴巴集团控股有限公司 A kind of data ciphering method and device, a kind of data decryption method and device
CN109474574B (en) * 2018-09-07 2021-06-29 创新先进技术有限公司 Data encryption method and device and data decryption method and device
CN109493025A (en) * 2018-10-23 2019-03-19 中国银行股份有限公司 A kind of account generation method and device
CN109493025B (en) * 2018-10-23 2022-03-18 中国银行股份有限公司 Account generating method and device
CN112035477A (en) * 2020-08-31 2020-12-04 平安医疗健康管理股份有限公司 Serial number conversion method and device of medical insurance text and computer equipment
CN112035477B (en) * 2020-08-31 2024-04-09 深圳平安医疗健康科技服务有限公司 Sequence number conversion method and device for medical insurance text and computer equipment
CN112511662A (en) * 2020-11-20 2021-03-16 珠海格力电器股份有限公司 System communication address generation and distribution method and device and air conditioning system
CN112511662B (en) * 2020-11-20 2021-10-29 珠海格力电器股份有限公司 System communication address generation and distribution method and device and air conditioning system
CN114595105A (en) * 2022-05-09 2022-06-07 深圳佰维存储科技股份有限公司 PSN uniqueness design method and device, readable storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN104866601A (en) Serial number generating method and device
US10505671B2 (en) Polar code encoding method and device
CN105630972A (en) Data processing method and device
CN104133765B (en) The test case sending method of network activity and test case server
CN110113393B (en) Message pushing method and device, electronic equipment and medium
CN105677328A (en) Method and device for displaying information and electronic equipment
CN105956921A (en) Method and device for selecting bankcard number by user himself/herself
CN104767761A (en) Cloud storage platform access control method and device
CN108334494A (en) A kind of construction method and device of customer relationship network
Etter et al. Engineering problem solving with C++
CN104572994A (en) Method and device for searching data
CN106788993A (en) A kind of encryption communication method, device and electronic equipment
CN105528365A (en) Method and device for managing executable files
CN114064308A (en) Multi-data sending and receiving method, device and equipment based on column type data scanning
CN112256472A (en) Distributed data calling method and device, electronic equipment and storage medium
CN104967906A (en) Random playing method and apparatus
CN109068286A (en) A kind of method, medium and the equipment of information parsing
CN105187508A (en) User relationship processing method and system
US20220391529A1 (en) Searching, matching, and masking of composite formats
CN104615941A (en) Fast encryption method and device for Android user partition and terminal equipment
CN104536887A (en) Communication data detection method and device
CN102708144B (en) Method and device for information processing
CN107135258A (en) Method and server that message is pushed
CN114039698A (en) Data sending and receiving method, device and equipment based on multiple frequencies
CN114070901A (en) Data sending and receiving method, device and equipment based on multi-data alignment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20150826