WO2018177350A1 - 一种提供序列号的方法、装置、电子设备和可读存储介质 - Google Patents

一种提供序列号的方法、装置、电子设备和可读存储介质 Download PDF

Info

Publication number
WO2018177350A1
WO2018177350A1 PCT/CN2018/081014 CN2018081014W WO2018177350A1 WO 2018177350 A1 WO2018177350 A1 WO 2018177350A1 CN 2018081014 W CN2018081014 W CN 2018081014W WO 2018177350 A1 WO2018177350 A1 WO 2018177350A1
Authority
WO
WIPO (PCT)
Prior art keywords
list
serial number
generating
available
methods
Prior art date
Application number
PCT/CN2018/081014
Other languages
English (en)
French (fr)
Inventor
李�瑞
Original Assignee
北京京东尚科信息技术有限公司
北京京东世纪贸易有限公司
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 北京京东尚科信息技术有限公司, 北京京东世纪贸易有限公司 filed Critical 北京京东尚科信息技术有限公司
Priority to US16/496,750 priority Critical patent/US11314712B2/en
Publication of WO2018177350A1 publication Critical patent/WO2018177350A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2272Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/067Enterprise or organisation modelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2457Query processing with adaptation to user needs
    • G06F16/24578Query processing with adaptation to user needs using ranking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/08Logistics, e.g. warehousing, loading or distribution; Inventory or stock management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/08Logistics, e.g. warehousing, loading or distribution; Inventory or stock management
    • G06Q10/083Shipping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/08Logistics, e.g. warehousing, loading or distribution; Inventory or stock management
    • G06Q10/087Inventory or stock management, e.g. order filling, procurement or balancing against orders
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/544Remote

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, an electronic device, and a readable storage medium for providing a serial number.
  • All the distribution links include: pre-sorting, sorting, delivery, receiving, distribution, logistics tracking, etc., all of which use the waybill number as the unique identifier for data recording and data interaction.
  • pre-sorting sorting, delivery, receiving, distribution, logistics tracking, etc.
  • the waybill number obtained by the merchant background is usually generated based on redis, and the generated waybill number is stored in the memory, and the case where the waybill number is lost may occur.
  • the existing method of generating the waybill number is relatively simple, and it relies entirely on redis. Once the Redis server fails, it will cause the merchant to fail to obtain the waybill number.
  • the generation of the waybill number in the prior art is single and completely dependent on redis. If there is a problem with the redis server, there will be a problem that the waybill number cannot be generated, or the generated waybill number cannot be used, not only It may cause the merchant to fail to get the waybill number. Moreover, due to the waste and loss of the single number, the growth rate of the single number is fast, resulting in a tight resource of the single number.
  • the present invention provides a method, an apparatus, an electronic device, and a readable storage medium for providing a serial number, which can configure different serial number generation methods according to different service scenarios, and solves the problem that completely relies on a serial number generation method.
  • the problem is that the serial number that satisfies the business scenario can be generated in time, and the stability of the logistics distribution system is finally improved.
  • a method of providing a serial number is provided.
  • the method for providing a serial number according to the present invention includes: storing various methods for generating a sequence number; determining a method for generating a sequence number of the scene from the method for generating a sequence number according to a service scenario of the requesting end, and then generating according to the determined
  • the method of serial number obtains a list of available methods for the scene; the sequence number of the scene is generated using the method in the list of available methods to provide to the requesting end.
  • the step of determining a method for generating a sequence number of the scenario from the method for generating a sequence number according to the service scenario of the requesting end to obtain a list of available methods of the scenario includes: writing the determined method to the list Get a list of available methods for this scene.
  • the step of generating a sequence number of the scenario by using the method in the available method list to provide to the requesting end includes: calling a method of sorting the first generated sequence in the available method list; determining current Whether the called method successfully generates the required serial number, and if so, returns the generated serial number to the requesting end; otherwise, the other methods in the available method list are called in order, and the currently called method is available from the available The method list is removed and the method is placed in the unavailable list.
  • the method further includes: recording a time when the method enters the unavailable list, and then returning the method to the Available in the list of methods.
  • the method further includes: determining, by the set period, whether the currently invoked method can generate the required time in the second time period that is set.
  • the serial number if yes, the counter is cleared, otherwise, the counter is incremented by 1; it is determined whether the value of the counter is greater than the first set value, and if so, the method is placed in the exception method list; otherwise, the execution is repeated.
  • the method further includes: recording a time when the method enters the abnormal method list, and then returning the method to the location after the third time period is set. In the list of available methods.
  • the method for generating a serial number includes: a database self-incrementing id method, a data table column value generating method, a redis method, and a snowflake method.
  • an apparatus for providing a serial number is provided.
  • the apparatus for providing a serial number includes: a saving module, configured to save various methods for generating a serial number; and a generating module, configured to determine, according to a service scenario of the requesting end, the generation of the scene from the method for generating a serial number a method of serial number, and then obtaining a list of available methods of the scene according to the determined method for generating a serial number; providing a module for generating a sequence number of the scene using the method in the available method list to provide to the requesting end.
  • the generating module is further configured to: write the determined method into the list to obtain a list of available methods of the scenario.
  • the providing module is further configured to: invoke a method of sorting the generated sequence in the available method list; determine whether the currently invoked method successfully generates the required sequence number, and if yes, generate the sequence The number is returned to the requester; otherwise, the other methods in the list of available methods are called in order, the currently called method is removed from the list of available methods, and the method is placed in the unavailable list.
  • the first recording module is further configured to: record the time when the method enters the unavailable list, and then return the method to the available method list after the set first duration.
  • the method further includes: a determining module, configured to: determine, at a set period, whether the currently invoked method can generate a required sequence number within the set second time period; if yes, the counter is cleared, otherwise, the counter is incremented by one. Determining whether the value of the counter is greater than the first set value, and if so, placing the method in the exception method list; otherwise, repeating the step of determining whether the value of the counter is greater than the first set value.
  • a determining module configured to: determine, at a set period, whether the currently invoked method can generate a required sequence number within the set second time period; if yes, the counter is cleared, otherwise, the counter is incremented by one. Determining whether the value of the counter is greater than the first set value, and if so, placing the method in the exception method list; otherwise, repeating the step of determining whether the value of the counter is greater than the first set value.
  • the second recording module is further configured to: record the time when the method enters the abnormal method list, and then return the method to the available method list after the set third duration.
  • the method for generating a serial number includes: a database self-incrementing id method, a data table column value generating method, a redis method, and a snowflake method.
  • an electronic device is provided.
  • An electronic device includes: one or more processors; storage means for storing one or more programs, when one or more programs are executed by one or more processors, such that one or more The processor implements the method of providing a serial number in an embodiment of the present invention.
  • a computer readable medium is provided.
  • a computer readable medium of the embodiment of the present invention wherein a computer program is stored thereon, and when the program is executed by the processor, the method for providing a serial number in the embodiment of the present invention is implemented.
  • FIG. 1 is a schematic diagram of a method of providing a serial number according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of an apparatus for providing a serial number according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a hardware structure of an electronic device for providing a serial number for implementing an embodiment of the present invention.
  • FIG. 1 is a schematic diagram of a method of providing a serial number in accordance with an embodiment of the present invention. As shown in FIG. 1, the method for providing a serial number according to an embodiment of the present invention mainly includes steps S10 to S12.
  • Step S10 Save various methods of generating a serial number.
  • the method for generating a serial number includes: a database self-incrementing id method, a data table column value generating method, a redis method, and a snowflake method.
  • Pre-storing various methods for generating serial numbers can make it possible to select a method for satisfying the generation sequence number of the scene in different service scenarios, which not only avoids the problems of the single serial number generation method, but also when one of the methods fails. Switching is performed to increase the success rate of generating the serial number.
  • Step S11 Determine a method for generating a sequence number of the scenario from the method for generating a sequence number according to the service scenario of the requesting end, and then obtain a list of available methods of the scenario according to the determined method for generating a sequence number.
  • the requesting end requests to obtain the serial number (such as the delivery order number), according to the service scenario of the requesting end, it is assumed that the method for satisfying the scenario can be generated in the generated sequence method saved in step S10 as the database self-incrementing id.
  • Step S12 Generate a sequence number of the scene by using the method in the available method list to provide to the requesting end.
  • the method of sorting in the first place in the available method list is first called, and the order of the three methods in step S11 is as follows: database self-increment id method, data table column value generating method, redis method, and snowflake method.
  • the database self-increment id method first call the database self-increment id method to generate the serial number of the scene, and then determine whether the currently called method successfully generates the required serial number, and if so, return the serial number generated according to the method to the requesting end; otherwise, press Sequentially calling other methods in the list of available methods (ie calling the data table column value generation method to generate the required sequence number of the scene), while the currently called method (ie, the database self-incrementing id method) is available from the The method list is deleted, and the method is placed in the unavailable list, indicating that the database auto-increment id method is currently temporarily unavailable.
  • step S12 For the method of generating the generated sequence in the unavailable list in step S12, recording the time when the method enters the unavailable list, and then returning the method to the available after the set first duration (for example, 3 minutes) In the method list.
  • the set first duration for example, 3 minutes
  • step S12 After the method of generating the serial number is called in step S12, it is determined whether the currently called method can generate the required serial number within the set second duration (10 seconds) every set period (for example, 1 minute), and if so, Then the counter is cleared, otherwise, the counter is incremented by one; the counter is used to record whether the method of generating the sequence times out continuously when generating the sequence number; if the value of the counter is greater than the first set value (ie, the number of consecutive timeouts) Threshold), if yes, put the method into the exception method list, indicating that the method is currently in an abnormal state, and then sequentially call other methods in the available method list; otherwise, repeatedly executing to determine whether the value of the counter is greater than the first The steps to set the value.
  • the first set value ie, the number of consecutive timeouts
  • the time at which the method enters the list of exception methods is recorded, and then after the set third duration has elapsed, the method is placed back into the list of available methods.
  • the apparatus 20 for providing a serial number mainly includes: a saving module 21, a generating module 22, and a providing module 23; the saving module 21 is configured to save various methods for generating a serial number; and the generating module 22 And a method for determining a generated sequence number of the scenario from the method for generating a sequence number according to the service scenario of the requesting end, to obtain a list of available methods of the scenario; and providing a module 23 for using the method in the available method list
  • the serial number of the scene is generated to be provided to the requesting end.
  • the generating module 22 of the device 20 for providing the serial number is further configured to: determine a method for generating a sequence number required for the scene according to the service scenario of the requesting end, and then write the determined method into the list to obtain a list of available methods of the scenario.
  • the device 20 providing module of the serial number may further be configured to: invoke a method of sorting the generated sequence in the available method list; determine whether the currently invoked method successfully generates the required sequence number, and if so, generate the generated sequence number The serial number is returned to the requesting end; otherwise, other methods in the list of available methods are invoked in order, the currently invoked method is removed from the list of available methods, and the method is placed in an unavailable list.
  • the apparatus 20 for providing a serial number may further include a first recording module (not shown) for recording the time when the method enters the unavailable list, and then putting the method back after the set first duration The list of available methods.
  • a first recording module (not shown) for recording the time when the method enters the unavailable list, and then putting the method back after the set first duration The list of available methods.
  • the apparatus 20 for providing a serial number may further include a judging module (not shown) for: determining, at a set period, whether the currently invoked method can generate a desired serial number within a set second duration, and if so, Then the counter is cleared, otherwise, the counter is incremented by one; it is judged whether the value of the counter is greater than the first set value, and if so, the method is placed in the abnormal method list; otherwise, the execution of the counter is repeatedly performed to determine whether the value of the counter is A step greater than the first set value.
  • a judging module not shown for: determining, at a set period, whether the currently invoked method can generate a desired serial number within a set second duration, and if so, Then the counter is cleared, otherwise, the counter is incremented by one; it is judged whether the value of the counter is greater than the first set value, and if so, the method is placed in the abnormal method list; otherwise, the execution of the counter is repeatedly performed to determine whether the value of the counter is A step greater
  • the apparatus 20 for providing a serial number may further include a second recording module (not shown) for recording the time when the method enters the abnormal method list, and then putting the method back after the set third duration The list of available methods.
  • a second recording module (not shown) for recording the time when the method enters the abnormal method list, and then putting the method back after the set third duration The list of available methods.
  • the present invention also provides an apparatus for providing a serial number and a non-transitory computer readable storage medium.
  • the apparatus for providing a serial number of the present invention includes: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the one processor, the instructions Executed by the at least one processor to cause the at least one processor to perform the method of providing a serial number provided by the present invention.
  • the computer readable storage medium of the present invention the computer readable storage medium storing computer instructions for causing the computer to perform the method of providing a serial number provided by the present invention.
  • FIG. 3 is a schematic diagram showing the hardware structure of a device for providing a serial number according to an embodiment of the present invention.
  • the electronic device includes: one or more processors 31 and a memory 32, and one processor 31 is taken as an example in FIG.
  • the memory 32 is the non-transitory computer readable storage medium provided by the present invention.
  • the processor 31 and the memory 32 may be connected by a bus or other means, and the connection by a bus is taken as an example in FIG.
  • the memory 32 is a computer readable storage medium, and can be used to store a software program, a computer executable program, and a module, such as a program instruction/module corresponding to the method for providing a serial number in the embodiment of the present invention (for example, as shown in FIG. 2
  • the processor 31 executes various functional applications and data processing of the server by executing software programs, instructions, and modules stored in the memory 32, that is, a method of providing a serial number in the above method embodiments.
  • the memory 32 may include a storage program area and an storage data area, wherein the storage program area may store an operating system, an application required for at least one function; the storage data area may store data created when the device providing the serial number is used, and the like.
  • memory 32 can include high speed random access memory, and can also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device.
  • memory 32 may optionally include memory remotely located relative to processor 31, which may be connected to the device providing the serial number over a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • the input device 33 can receive a method of generating a serial number each, and generate a key signal input related to user settings and function control of the device providing the serial number.
  • Output device 34 can include a display device such as a display screen.
  • the one or more modules are stored in the memory 32, and when executed by the one or more processors 31, perform the method of providing a serial number in any of the above method embodiments.
  • the above product can perform the method provided by the embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
  • the above product can perform the method provided by the embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Economics (AREA)
  • Strategic Management (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Resources & Organizations (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Operations Research (AREA)
  • Development Economics (AREA)
  • Marketing (AREA)
  • Quality & Reliability (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Educational Administration (AREA)
  • Game Theory and Decision Science (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Computational Linguistics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本发明提供一种提供序列号的方法、装置、电子设备和可读存储介质,能够根据不同的业务场景配置不同的序列号生成方法,解决了完全依赖于一种序列号生成方法的问题,能够及时的生成满足业务场景的序列号,最终提高了物流配送系统的稳定性。本发明的提供序列号的方法,包括:保存各种生成序列号的方法;根据请求端的业务场景,从所述生成序列号的方法中确定该场景的生成序列号的方法,然后根据确定的生成序列号的方法得到该场景的可用方法列表;使用所述可用方法列表中的方法生成所述场景的序列号,以提供给请求端。

Description

一种提供序列号的方法、装置、电子设备和可读存储介质 技术领域
本发明涉及计算机技术领域,特别地涉及一种提供序列号的方法、装置、电子设备和可读存储介质。
背景技术
物流配送系统中,运单号的生成与获取是非常关键的一个环节。所有的配送环节包括:预分拣、分拣、发货、收货、配送、物流跟踪等都是以运单号为唯一标识进行数据记录与数据交互的。在互联网高速发展的今天,大数据量、高并发将对运单号的生成提出了更高的要求。
现有技术中,商家后台所获取的运单号通常是基于redis生成的,而且生成的运单号存储在内存中,很可能出现运单号丢失的情况。现有的运单号生成方法比较单一,完全依赖于redis,一旦redis服务器出现故障,就会导致商家获取运单号失败。
综上所述,现有技术中的运单号的生成方发单一,完全依赖redis,如果redis服务器出现问题,就会发生无法生成运单号,或者生成的运单号无法使用的问题,不仅可能导致商家获取运单号失败。而且由于存在单号浪费和丢失,导致单号增长速度快,造成单号资源紧张。
发明内容
有鉴于此,本发明提供一种提供序列号的方法、装置、电子设备和可读存储介质,能够根据不同的业务场景配置不同的序列号生成方法,解决了完全依赖于一种序列号生成方法的问题,能够及时的生成满足业务场景的序列号,最终提高了物流配送系统的稳定性。
为实现上述目的,根据本发明的第一个方面,提供了一种提供序列号的方法。
本发明的提供序列号的方法,包括:保存各种生成序列号的方法;根据请求端的业务场景,从所述生成序列号的方法中确定该场景的生成序列号的方法,然后根据确定的生成序列号的方法得到该场景的可用方法列表;使用所述可用方法列表中的方法生成所述场景的序列号,以提供给请求端。
可选地,根据请求端的业务场景,从所述生成序列号的方法中确定该场景的生成序列号的方法,以得到该场景的可用方法列表的步骤包括:将确定的所述方法写入列表中以得到该场景的可用方法列表。
可选地,所述使用所述可用方法列表中的方法生成所述场景的序列号,以提供给请求端的步骤包括:调用所述可用方法列表中排序为第一的生成序列的方法;判断当前所调用的方法是否成功生成所需序列号,若是,则将生成的序列号返回给请求端;否则,按顺序调用所述可用方法列表中的其他方法,将该当前所调用的方法从该可用方法列表中删除,以及将该方法放入不可用列表中。
可选地,所述将该方法放入不可用列表中的步骤之后,还包括:记录该方法进入不可用列表的时间,然后在经过设定的第一时长后,将该方法放回所述可用方法列表中。
可选地,所述按照所述可用方法列表的顺序调用该列表中的方法的步骤之后,还包括:每隔设定周期判断当前调用的方法是否能在设定的第二时长内生成所需序列号,若是,则计数器清零,否则,计数器加1;判断所述计数器的值是否大于第一设定值,若是,则将所述方法放入异常方法列表中;否则,重复执行判断所述计数器的值是否大于第一设定值的步骤。
可选地,所述将所述方法放入异常方法列表中的步骤之后,还包括:记录该方法进入异常方法列表的时间,然后在经过设定的第三时长后,将该方法放回所述可用方法列表中。
可选地,所述生成序列号的方法包括:数据库自增id方法、数据表列值生成方法、redis方法、以及snowflake方法。
根据本发明的第二个方面,提供了一种提供序列号的装置。
本发明的提供序列号的装置,包括:保存模块,用于保存各种生成序列号的方法;生成模块,用于根据请求端的业务场景,从所述生成序列号的方法中确定该场景的生成序列号的方法,然后根据确定的生成序列号的方法得到该场景的可用方法列表;提供模块,用于使用所述可用方法列表中的方法生成所述场景的序列号,以提供给请求端。
可选地,所述生成模块还用于:将确定的所述方法写入列表中以得到该场景的可用方法列表。
可选地,所述提供模块还用于:调用所述可用方法列表中排序为第一的生成序列的方法;判断当前所调用的方法是否成功生成所需序列号,若是,则将生成的序列号返回给请求端;否则,按顺序调用所述可用方法列表中的其他方法,将该当前所调用的方法从该可用方法列表中删除,以及将该方法放入不可用列表中。
可选地,还包括第一记录模块,用于:记录该方法进入不可用列表的时间,然后在经过设定的第一时长后,将该方法放回所述可用方法列表中。
可选地,还包括判断模块,用于:每隔设定周期判断当前调用的 方法是否能在设定的第二时长内生成所需序列号,若是,则计数器清零,否则,计数器加1;判断所述计数器的值是否大于第一设定值,若是,则将所述方法放入异常方法列表中;否则,重复执行判断所述计数器的值是否大于第一设定值的步骤。
可选地,还包括第二记录模块,用于:记录该方法进入异常方法列表的时间,然后在经过设定的第三时长后,将该方法放回所述可用方法列表中。
可选地,所述生成序列号的方法包括:数据库自增id方法、数据表列值生成方法、redis方法、以及snowflake方法。
为实现上述目的,根据本发明实施例的再一方面,提供了一种电子设备。
本发明实施例的一种电子设备包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当一个或多个程序被一个或多个处理器执行,使得一个或多个处理器实现本发明实施例的提供序列号的方法。
为实现上述目的,根据本发明实施例的又一方面,提供了一种计算机可读介质。
本发明实施例的一种计算机可读介质,其上存储有计算机程序,程序被处理器执行时实现本发明实施例的提供序列号的方法。
根据本发明的技术方案,由于预先保存了不同的生成序列号的方法,因而能够根据不同的业务场景配置不同的序列号生成方法,解决了完全依赖于一种序列号生成方法的问题,能够在一种方法出现故障的时候进行方法切换,及时生成满足业务场景的序列号,最终提高了 物流配送系统的稳定性。
上述的非惯用的可选方式所具有的进一步效果将在下文中结合具体实施方式加以说明。
附图说明
附图用于更好地理解本发明,不构成对本发明的不当限定。其中:
图1是根据本发明实施例的一种提供序列号的方法的示意图;
图2是根据本发明实施例的一种提供序列号的装置的示意图;
图3是用于实现本发明实施例的提供序列号的电子设备的硬件结构示意图。
具体实施方式
以下结合附图对本发明的示范性实施例做出说明,其中包括本发明实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本发明的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。
图1是根据本发明实施例的一种提供序列号的方法的示意图。如图1所示,本发明实施例的提供序列号的方法主要包括步骤S10至S12。
步骤S10:保存各种生成序列号的方法。在该步骤中,所述生成序列号的方法包括:数据库自增id方法、数据表列值生成方法、redis方法、以及snowflake方法。预先保存各种生成序列号的方法,可以使得在不同业务场景下选择满足场景的生成序列号的方法,不仅避免了单一序列号生成方法所存在问题,还可以在其中一种方法发生故障的时候进行切换,提高了生成序列号的成功率。
步骤S11:根据请求端的业务场景,从所述生成序列号的方法中 确定该场景的生成序列号的方法,然后根据确定的生成序列号的方法得到该场景的可用方法列表。在该步骤中,当请求端请求获取序列号(比如快递单号)时,根据该请求端的业务场景,假设步骤S10中所保存的生成序列方法中能生成满足该场景的方法为数据库自增id方法、数据表列值生成方法、redis方法、以及snowflake方法,那么在确定了具体的方法后,将该三种方法写入列表中,从而得到该场景的可用方法列表。
步骤S12:使用所述可用方法列表中的方法生成所述场景的序列号,以提供给请求端。在步骤S12中,首先调用可用方法列表中的排序在第一位的方法,假设步骤S11中三种方法排序依次为:数据库自增id方法、数据表列值生成方法、redis方法、以及snowflake方法;那么首先调用数据库自增id方法生成该场景的序列号,然后判断当前所调用的方法是否成功生成所需序列号,若是,则将根据该方法生成的序列号返回给请求端;否则,按顺序调用所述可用方法列表中的其他方法(即调用数据表列值生成方法生成该场景的所需的序列号),同时将该当前所调用的方法(即数据库自增id方法)从该可用方法列表中删除,以及将该方法放入不可用列表中,说明数据库自增id方法当前暂时不可用。
对于步骤S12中放入不可用列表中的生成序列的方法,记录该方法进入不可用列表的时间,然后在经过设定的第一时长后(比如3分钟),将该方法放回所述可用方法列表中。
在步骤S12中调用了生成序列号的方法后,每隔设定周期(比如1分钟)判断当前调用的方法是否能在设定的第二时长(10秒)内生成所需序列号,若是,则计数器清零,否则,计数器加1;该计数器用于记录该生成序列的方法在生成序列号时是否连续超时;如果所述计数器的值是否大于第一设定值(即连续超时的次数的阈值),若是,则将所述方法放入异常方法列表中,说明该方法当前处于异常状态, 然后顺序调用可用方法列表中的其他方法;否则,重复执行判断所述计数器的值是否大于第一设定值的步骤。
同样,对于放入异常方法列表中的方法,记录该方法进入异常方法列表的时间,然后在经过设定的第三时长后,将该方法放回所述可用方法列表中。
图2是根据本发明实施例的一种提供序列号的装置的示意图。如图2所示,本发明实施例的提供序列号的装置20主要包括:保存模块21、生成模块22、以及提供模块23;保存模块21用于保存各种生成序列号的方法;生成模块22用于根据请求端的业务场景,从所述生成序列号的方法中确定该场景的生成序列号的方法,以得到该场景的可用方法列表;提供模块23用于使用所述可用方法列表中的方法生成所述场景的序列号,以提供给请求端。
提供序列号的装置20的生成模块22还可用于:根据请求端的业务场景确定生成该场景所需序列号的方法,然后将确定的所述方法写入列表中以得到该场景的可用方法列表。
提供序列号的装置20提供模块23还可用于:调用所述可用方法列表中排序为第一的生成序列的方法;判断当前所调用的方法是否成功生成所需序列号,若是,则将生成的序列号返回给请求端;否则,按顺序调用所述可用方法列表中的其他方法,将该当前所调用的方法从该可用方法列表中删除,以及将该方法放入不可用列表中。
提供序列号的装置20还可包括第一记录模块(图中未示出),用于:记录该方法进入不可用列表的时间,然后在经过设定的第一时长后,将该方法放回所述可用方法列表中。
提供序列号的装置20还可包括判断模块(图中未示出),用于: 每隔设定周期判断当前调用的方法是否能在设定的第二时长内生成所需序列号,若是,则计数器清零,否则,计数器加1;判断所述计数器的值是否大于第一设定值,若是,则将所述方法放入异常方法列表中;否则,重复执行判断所述计数器的值是否大于第一设定值的步骤。
提供序列号的装置20还可包括第二记录模块(图中未示出),用于:记录该方法进入异常方法列表的时间,然后在经过设定的第三时长后,将该方法放回所述可用方法列表中。
根据本发明的实施例,本发明还提供了一种提供序列号的设备和一种非暂态计算机可读存储介质。
本发明的提供序列号的设备包括:至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器执行本发明所提供的提供序列号的方法。
本发明的计算机可读存储介质,所态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行本发明所提供的提供序列号的方法。
图3是根据本发明实施例的提供序列号的设备的硬件结构示意图。如图3,该电子设备包括:一个或多个处理器31以及存储器32,图3中以一个处理器31为例。其中,存储器32即为本发明所提供的非暂态计算机可读存储介质。
处理器31、存储器32可以通过总线或者其他方式连接,图3中以通过总线连接为例。
存储器32作为一种计算机可读存储介质,可用于存储软件程序、 计算机可执行程序以及模块,如本发明实施例中的提供序列号的方法对应的程序指令/模块(例如,附图2所示的保存模块21、生成模块22和提供模块23)。处理器31通过运行存储在存储器32中的软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现上述方法实施例中的提供序列号的方法。
存储器32可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储使用提供序列号的装置时所创建的数据等。此外,存储器32可以包括高速随机存取存储器,还可以包括非暂态存储器,例如至少一个磁盘存储器件、闪存器件、或其他非暂态固态存储器件。在一些实施例中,存储器32可选包括相对于处理器31远程设置的存储器,这些远程存储器可以通过网络连接至提供序列号的装置。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
输入装置33可接收各自生成序列号的方法,以及产生与提供序列号的装置的用户设置以及功能控制有关的键信号输入。输出装置34可包括显示屏等显示设备。
所述一个或者多个模块存储在所述存储器32中,当被所述一个或者多个处理器31执行时,执行上述任意方法实施例中的提供序列号的方法。
上述产品可执行本发明实施例所提供的方法,具备执行方法相应的功能模块和有益效果。未在本实施例中详尽描述的技术细节,可参见本发明实施例所提供的方法。
根据本发明的技术方案,由于预先保存了不同的生成序列号的方法,因而能够根据不同的业务场景配置不同的序列号生成方法,解决了完全依赖于一种序列号生成方法的问题,能够在一种方法出现故障 的时候进行方法切换,及时生成满足业务场景的序列号,最终提高了物流配送系统的稳定性。
上述具体实施方式,并不构成对本发明保护范围的限制。本领域技术人员应该明白的是,取决于设计要求和其他因素,可以发生各种各样的修改、组合、子组合和替代。任何在本发明的精神和原则之内所作的修改、等同替换和改进等,均应包含在本发明保护范围之内。

Claims (16)

  1. 一种提供序列号的方法,其特征在于,包括:
    保存各种生成序列号的方法;
    根据请求端的业务场景,从所述生成序列号的方法中确定该场景的生成序列号的方法,然后根据确定的生成序列号的方法得到该场景的可用方法列表;
    使用所述可用方法列表中的方法生成所述场景的序列号,以提供给请求端。
  2. 根据权利要求1所述的方法,其特征在于,根据确定的生成序列号的方法得到该场景的可用方法列表的步骤包括:将确定的所述方法写入列表中以得到该场景的可用方法列表。
  3. 根据权利要求1所述的方法,其特征在于,所述使用所述可用方法列表中的方法生成所述场景的序列号,以提供给请求端的步骤包括:
    调用所述可用方法列表中排序为第一的生成序列的方法;
    判断当前所调用的方法是否成功生成所需序列号,若是,则将生成的序列号返回给请求端;否则,按顺序调用所述可用方法列表中的其他方法,将该当前所调用的方法从该可用方法列表中删除,以及将该方法放入不可用列表中。
  4. 根据权利要求3所述的方法,其特征在于,所述将该方法放入不可用列表中的步骤之后,还包括:记录该方法进入不可用列表的时间,然后在经过设定的第一时长后,将该方法放回所述可用方法列表中。
  5. 根据权利要求3所述的方法,其特征在于,所述按照所述可用方法列表的顺序调用该列表中的方法的步骤之后,还包括:
    每隔设定周期判断当前调用的方法是否能在设定的第二时长内生成所需序列号,若是,则计数器清零,否则,计数器加1;
    判断所述计数器的值是否大于第一设定值,若是,则将所述方法放入异常方法列表中;否则,重复执行判断所述计数器的值是否大于第一设定值的步骤。
  6. 根据权利要求5所述的方法,其特征在于,所述将所述方法放入异常方法列表中的步骤之后,还包括:记录该方法进入异常方法列表的时间,然后在经过设定的第三时长后,将该方法放回所述可用方法列表中。
  7. 根据权利要求1至6中任一项所述的方法,其特征在于,所述生成序列号的方法包括以下各项中的至少一项:数据库自增id方法、数据表列值生成方法、redis方法、以及snowflake方法。
  8. 一种提供序列号的装置,其特征在于,包括:
    保存模块,用于保存各种生成序列号的方法;
    生成模块,用于根据请求端的业务场景,从所述生成序列号的方法中确定该场景的生成序列号的方法,然后根据确定的生成序列号的方法得到该场景的可用方法列表;
    提供模块,用于使用所述可用方法列表中的方法生成所述场景的序列号,以提供给请求端。
  9. 根据权利要求8所述的装置,其特征在于,所述生成模块还用于:将确定的所述方法写入列表中以得到该场景的可用方法列表。
  10. 根据权利要求8所述的装置,其特征在于,所述提供模块还用于:
    调用所述可用方法列表中排序为第一的生成序列的方法;
    判断当前所调用的方法是否成功生成所需序列号,若是,则将生 成的序列号返回给请求端;否则,按顺序调用所述可用方法列表中的其他方法,将该当前所调用的方法从该可用方法列表中删除,以及将该方法放入不可用列表中。
  11. 根据权利要求10所述的装置,其特征在于,还包括第一记录模块,用于:记录该方法进入不可用列表的时间,然后在经过设定的第一时长后,将该方法放回所述可用方法列表中。
  12. 根据权利要求10所述的装置,其特征在于,还包括判断模块,用于:
    每隔设定周期判断当前调用的方法是否能在设定的第二时长内生成所需序列号,若是,则计数器清零,否则,计数器加1;
    判断所述计数器的值是否大于第一设定值,若是,则将所述方法放入异常方法列表中;否则,重复执行判断所述计数器的值是否大于第一设定值的步骤。
  13. 根据权利要求12所述的装置,其特征在于,还包括第二记录模块,用于:记录该方法进入异常方法列表的时间,然后在经过设定的第三时长后,将该方法放回所述可用方法列表中。
  14. 根据权利要求8至13中任一项所述的装置,其特征在于,所述生成序列号的方法包括以下各项中的至少一项:数据库自增id方法、数据表列值生成方法、redis方法、以及snowflake方法。
  15. 一种电子设备,其特征在于,包括:
    一个或多个处理器;
    存储装置,用于存储一个或多个程序,
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-7中任一所述的方法。
  16. 一种计算机可读介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现如权利要求1-7中任一所述的方法。
PCT/CN2018/081014 2017-04-01 2018-03-29 一种提供序列号的方法、装置、电子设备和可读存储介质 WO2018177350A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US16/496,750 US11314712B2 (en) 2017-04-01 2018-03-29 Method and apparatus for providing serial number, electronic device and readable storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710211867.5A CN108664521B (zh) 2017-04-01 2017-04-01 一种提供序列号的方法、装置、电子设备和可读存储介质
CN201710211867.5 2017-04-01

Publications (1)

Publication Number Publication Date
WO2018177350A1 true WO2018177350A1 (zh) 2018-10-04

Family

ID=63675212

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/081014 WO2018177350A1 (zh) 2017-04-01 2018-03-29 一种提供序列号的方法、装置、电子设备和可读存储介质

Country Status (3)

Country Link
US (1) US11314712B2 (zh)
CN (1) CN108664521B (zh)
WO (1) WO2018177350A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109597853A (zh) * 2018-10-22 2019-04-09 平安科技(深圳)有限公司 业务场景元素序列号生成方法、装置、介质和计算机设备
CN110807035A (zh) * 2019-11-05 2020-02-18 泰康保险集团股份有限公司 流水号生成方法、装置、设备及存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109450987B (zh) * 2018-10-18 2021-08-03 杭州云永网络科技有限公司 编号生成方法、装置及系统和存储介质
CN111861292A (zh) * 2019-04-25 2020-10-30 北京京东尚科信息技术有限公司 运单号生成方法、装置、服务器和存储介质
CN111949730B (zh) * 2020-08-12 2023-09-19 中国银行股份有限公司 分布式全局序列号实现方法及序列分发器

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101976240A (zh) * 2010-09-21 2011-02-16 用友软件股份有限公司 表单编号生成方法和系统
CN102542340A (zh) * 2010-12-15 2012-07-04 金蝶软件(中国)有限公司 业务单据批号编码方法和装置
CN103164418A (zh) * 2011-12-12 2013-06-19 阿里巴巴集团控股有限公司 一种序列号的处理方法及设备
JP2013152580A (ja) * 2012-01-25 2013-08-08 Mitsubishi Electric Corp コード生成装置及びコード生成方法及びプログラム
WO2014051223A1 (ko) * 2012-09-28 2014-04-03 한미아이티주식회사 제품 코드 제공 장치, 방법 및 상기 방법을 위한 컴퓨터 판독 가능한 기록 매체
CN105183794A (zh) * 2015-08-24 2015-12-23 用友网络科技股份有限公司 业务流水号生成装置和方法
CN106203952A (zh) * 2016-07-05 2016-12-07 歌尔股份有限公司 基于项目相关信息的流水号生成方法及系统
CN106649566A (zh) * 2016-11-14 2017-05-10 上海艾融软件股份有限公司 一种序列号生成方法及装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7660812B2 (en) * 2005-09-02 2010-02-09 Imation Corp. Tracking physical inventory of data storage media
CN101299674B (zh) * 2007-04-30 2011-05-11 中国移动通信集团公司 实现终端标识的方法、系统及管理平台
CN101145226A (zh) * 2007-10-30 2008-03-19 金蝶软件(中国)有限公司 一种生成业务编码的方法及系统
CN101533435A (zh) * 2009-04-16 2009-09-16 北京水晶石数字科技有限公司 一种序列号生成和验证的方法
CA2767723C (en) * 2009-07-10 2018-08-28 Certicom Corp. System and method for performing serialization of devices

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101976240A (zh) * 2010-09-21 2011-02-16 用友软件股份有限公司 表单编号生成方法和系统
CN102542340A (zh) * 2010-12-15 2012-07-04 金蝶软件(中国)有限公司 业务单据批号编码方法和装置
CN103164418A (zh) * 2011-12-12 2013-06-19 阿里巴巴集团控股有限公司 一种序列号的处理方法及设备
JP2013152580A (ja) * 2012-01-25 2013-08-08 Mitsubishi Electric Corp コード生成装置及びコード生成方法及びプログラム
WO2014051223A1 (ko) * 2012-09-28 2014-04-03 한미아이티주식회사 제품 코드 제공 장치, 방법 및 상기 방법을 위한 컴퓨터 판독 가능한 기록 매체
CN105183794A (zh) * 2015-08-24 2015-12-23 用友网络科技股份有限公司 业务流水号生成装置和方法
CN106203952A (zh) * 2016-07-05 2016-12-07 歌尔股份有限公司 基于项目相关信息的流水号生成方法及系统
CN106649566A (zh) * 2016-11-14 2017-05-10 上海艾融软件股份有限公司 一种序列号生成方法及装置

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109597853A (zh) * 2018-10-22 2019-04-09 平安科技(深圳)有限公司 业务场景元素序列号生成方法、装置、介质和计算机设备
CN109597853B (zh) * 2018-10-22 2024-01-23 平安科技(深圳)有限公司 业务场景元素序列号生成方法、装置、介质和计算机设备
CN110807035A (zh) * 2019-11-05 2020-02-18 泰康保险集团股份有限公司 流水号生成方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN108664521B (zh) 2020-09-01
US11314712B2 (en) 2022-04-26
US20200081877A1 (en) 2020-03-12
CN108664521A (zh) 2018-10-16

Similar Documents

Publication Publication Date Title
WO2018177350A1 (zh) 一种提供序列号的方法、装置、电子设备和可读存储介质
CN108536761B (zh) 报表数据查询方法及服务器
US10467192B2 (en) Method and apparatus for updating data table in keyvalue database
CN110309161B (zh) 一种数据同步方法、装置及服务器
CN107423404B (zh) 流程实例数据同步处理方法和装置
US8725684B1 (en) Synchronizing data stores
CN104601696A (zh) 服务处理方法、服务调用框架、装置和架构
CN108345977A (zh) 一种业务处理方法及装置
EP3722973A1 (en) Data processing method and device for distributed database, storage medium, and electronic device
CN112363857B (zh) 微前端架构的应用系统、同步方法、存储介质和设备
CN111008246A (zh) 数据库日志同步方法、装置、计算机设备及可读存储介质
CN107133160B (zh) 服务器和客户端
KR102020358B1 (ko) 단말 및 그 단말에서 애플리케이션 동기화 방법
CN110750453B (zh) 基于html5的智能移动端测试方法、系统、服务器及存储介质
CN110677321B (zh) 一种弹性伸缩的云压测方法、装置、设备及存储介质
CN112632035A (zh) 面向自主可控数据库迁移方法及存储介质
CN116302708A (zh) 基于负载均衡的数据备份方法、装置、设备及存储介质
CN110532058B (zh) 容器集群服务的管理方法、装置、设备及可读存储介质
CN103605610A (zh) 一种基于Hadoop 的软件测试系统与方法
CN111294377B (zh) 一种依赖关系的网络请求发送方法、终端装置及存储介质
CN107277146B (zh) 一种分布式存储业务流量模型生成方法及系统
CN111367948B (zh) 数据处理方法、装置、电子设备及计算机可读存储介质
CN108769244B (zh) 一种存储任务信息获取方法及相关装置
CN109389271B (zh) 应用性能管理方法及系统
CN110489392A (zh) 多租户间的数据访问方法、装置、系统、存储介质及设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18776109

Country of ref document: EP

Kind code of ref document: A1

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 05.02.2020.

122 Ep: pct application non-entry in european phase

Ref document number: 18776109

Country of ref document: EP

Kind code of ref document: A1