Disclosure of Invention
In view of the above, the embodiments of the present invention provide a method and an apparatus for automatically switching number segments, which can solve the problems of insufficient utilization rate of old number segments and untimely or even failure in switching new and old number segments in the process of manually switching number segments or changing rules in a configuration manner.
To achieve the above object, according to one aspect of the embodiments of the present invention, there is provided a method for automatically switching a number segment, including: generating a current number according to a first number segment rule, recording a log of the current number, updating a record of a maximum number, and storing the maximum number into a cache; if the maximum number obtained from the cache exceeds the early warning threshold value of the first number segment rule and the previous number of the current number does not exceed the early warning threshold value, determining a second number segment rule according to the number segment configuration information in the number segment configuration rule; and if the maximum number acquired from the cache is the last number generated according to the first number segment rule, taking the second number segment rule as a new first number segment rule.
Optionally, the determining the second number segment rule according to the number segment configuration information in the number segment configuration rule includes: determining a preparation number segment rule according to the number segment configuration information in the number segment configuration rule; judging whether the preparation number segment rule meets the verification requirement, and if so, taking the preparation number segment rule as a second number segment rule.
Optionally, the determining the preliminary number segment rule according to the number segment configuration information in the number segment configuration rule includes: obtaining number segment configuration information in a number segment configuration rule, wherein the number segment configuration information comprises: number segment prefix, number segment range, early warning threshold value and reminding mode; and determining a preparation number segment rule according to the number segment prefix, the number segment range, the early warning threshold value and the reminding mode.
Optionally, the verification requirement includes: the prepared number generated according to the prepared number segment rule is different from the historical number; the prefix of the prepared number is consistent with the prefix of the number segment in the prepared number segment rule; the prepared number is in the range of the number segment of the prepared number segment rule.
Optionally, after the generating the current number according to the first number segment rule, the method further includes: if the current number exceeds the early warning threshold value of the first number segment rule, an early warning log of the first number segment rule is generated; if the early warning log of the first segment rule is generated, judging whether the second segment rule is determined, if not, alarming in a reminding mode in the first segment rule, and configuring the second segment rule in a manual mode.
According to another aspect of the embodiment of the present invention, there is provided an apparatus for automatically switching a number segment, including: the number generation module is used for: generating a current number according to a first number segment rule, recording a log of the current number, updating a record of a maximum number, and storing the maximum number into a cache; a processing module for: if the maximum number acquired from the cache exceeds the early warning threshold value of the first number segment rule, determining a second number segment rule according to the number segment configuration information in the number segment configuration rule; a switching module, configured to: and if the maximum number acquired from the cache is the last number generated according to the first number segment rule, taking the second number segment rule as a new first number segment rule.
Optionally, the processing module is further configured to: determining a preparation number segment rule according to the number segment configuration information in the number segment configuration rule; judging whether the preparation number segment rule meets the verification requirement, and if so, taking the preparation number segment rule as a second number segment rule.
Optionally, the processing module is further configured to: obtaining number segment configuration information in a number segment configuration rule, wherein the number segment configuration information comprises: number segment prefix, number segment range, early warning threshold value and reminding mode; and determining a preparation number segment rule according to the number segment prefix, the number segment range, the early warning threshold value and the reminding mode.
Optionally, the processing module is further configured to determine the verification requirement: the prepared number generated according to the prepared number segment rule is different from the historical number; the prefix of the prepared number is consistent with the prefix of the number segment in the prepared number segment rule; the prepared number is in the range of the number segment of the prepared number segment rule.
Optionally, the processing module is further configured to: if the current number exceeds the early warning threshold value of the first number segment rule, an early warning log of the first number segment rule is generated; if the early warning log of the first segment rule is generated, judging whether the second segment rule is determined, if not, alarming in a reminding mode in the first segment rule, and configuring the second segment rule in a manual mode.
According to still another aspect of an embodiment of the present invention, there is provided an electronic apparatus including: one or more processors; and the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are enabled to realize the method for automatically switching the number segments according to the embodiment of the invention.
According to a further aspect of an embodiment of the present invention, there is provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements a method for automatically switching number segments as proposed by an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: because the use condition of the number segments is dynamically monitored in real time by setting the early warning threshold value so as to determine the new number segment rule in advance, the technical problems that the utilization rate of the old number segments is insufficient and the new number segments are not timely or even fail in the process of manually switching the number segments or changing the rule by a configuration mode are solved, the old number segments are smoothly switched to the new number segments according to the new number segment rule after the original number segments are exhausted, the waste of the old number segments is avoided, and meanwhile, the technical effect of smooth and non-perception switching is achieved.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a basic flow of a method of automatically switching number segments according to an embodiment of the present invention. As shown in fig. 1, an embodiment of the present invention provides a method for automatically switching a number segment, including:
s101, generating a current number according to a first number segment rule, recording a log of the current number, updating a record of a maximum number, and storing the maximum number into a cache;
step S102, if the maximum number obtained from the cache exceeds an early warning threshold value of the first number segment rule, determining a second number segment rule according to the number segment configuration information in the number segment configuration rule;
and S103, if the maximum number obtained from the cache is the last number generated according to the first number segment rule, taking the second number segment rule as a new first number segment rule to finish the switching of the number segments.
The technical means of dynamically monitoring the use condition of the number segments in real time by setting the early warning threshold value to determine the new number segment rule in advance is adopted, so that the technical problems that the utilization rate of the old number segments is insufficient and the new number segments are not timely or even fail in the process of manually switching the number segments or changing the rule by a configuration mode are solved, the old number segments are directly and smoothly switched to the new number segments according to the new number segment rule after the original number segments are exhausted, the waste of the old number segments is avoided, and the technical effect of smooth and non-perception switching is achieved.
In the embodiment of the present invention, the determining the second number segment rule according to the number segment configuration information in the number segment configuration rule includes: determining a preparation number segment rule according to the number segment configuration information in the number segment configuration rule; judging whether the preparation number segment rule meets the verification requirement, and if so, taking the preparation number segment rule as a second number segment rule. The verification of the rule of the preparation number segment can accurately and timely find out the problems of the rule of the preparation number segment, thereby ensuring the correctness of the newly generated number after switching and avoiding faults.
In the embodiment of the present invention, the determining the preliminary number segment rule according to the number segment configuration information in the number segment configuration rule includes: obtaining number segment configuration information in a number segment configuration rule, wherein the number segment configuration information comprises: number segment prefix, number segment range, early warning threshold value and reminding mode; and determining a preparation number segment rule according to the number segment prefix, the number segment range, the early warning threshold value and the reminding mode.
In an embodiment of the present invention, the verification requirement includes: the prepared number generated according to the prepared number segment rule is different from the historical number; the prefix of the prepared number is consistent with the prefix of the number segment in the prepared number segment rule; the prepared number is in the range of the number segment of the prepared number segment rule. The method has the advantages that the uniqueness and the correctness of the prepared number segment rule are verified, and the problems of the prepared number segment rule can be accurately and timely found, so that the reliability and the correctness of the new number segment rule after switching are ensured, smooth switching is realized, and faults are avoided.
In the embodiment of the present invention, after the current number is generated according to the first number segment rule, the method further includes: if the current number exceeds the early warning threshold value of the first number segment rule, an early warning log of the first number segment rule is generated; if the early warning log of the first segment rule is generated, judging whether the second segment rule is determined, if not, alarming in a reminding mode in the first segment rule, and configuring the second segment rule in a manual mode. In the automatic switching process, a switching fault is found in time, and the fault is solved in a manual configuration mode.
FIG. 2 is a schematic diagram of a preferred flow of a method of automatically switching number segments according to an embodiment of the present invention; as shown in fig. 2, after carrier number information is obtained, the number is matched with a number generation rule (a generation rule of a current number, namely, a first number segment rule) and whether an early warning threshold is exceeded or not is verified, if yes, reminding such as a short message or a mail is carried out, information such as a new number segment rule needs to be input to the carrier and the number segment rule of early warning, and the uniqueness and the correctness of the information of the new number segment rule (a preparation number segment rule) are verified during input. After each time the carrier express number information is acquired, whether the number is the last number needs to be judged, if the number is the last number, the method is automatically switched to a new number segment rule which is verified to generate a new number.
The setting of the number segment rule is to perform unified management on the number segments of all carriers, and when the original number segment is fast to the end of use, the number segment rule is automatically switched to a new corresponding number segment rule. FIG. 3 is a diagram of segment configuration rule core information according to an embodiment of the present invention; as shown in fig. 3, the number segment configuration rule core information mainly includes information such as a bracket segment prefix, a number segment range, an early warning threshold value, a reminding mode and the like. And generating and determining data such as types and ranges covered by the bill through the number segment prefix and the number segment range, and carrying out early warning after the generated number reaches or remains a certain configuration early warning threshold value and reminding in a mail, short message and other modes.
When a new rule or a modification rule needs to be set, firstly, assembling numbers are simulated according to the related rule through new rule configuration data, then, correctness and uniqueness verification are carried out on the numbers, whether the main verification number generation rule is matched with the document actually generated belongs to the corresponding carrier and the number segment range or not is verified, and the uniqueness verification mainly verifies that the numbers generated by different carriers according to the rule are required to be ensured to exist uniquely in the whole system. FIG. 4 is a segment rule validation test flow chart according to an embodiment of the invention; as shown in fig. 4, if the correct and unique verification is passed, a verification passing log is recorded and a verification passing state is updated, and if the verification is failed, a verification failing reason is recorded and a verification failure state is updated. When verification fails, a corresponding prompt is made, so that an operator can find out the problem in time to make corresponding adjustment for resetting.
FIG. 5 is a schematic diagram of segment usage monitoring and early warning according to an embodiment of the present invention; as shown in fig. 5, after the newly generated number information is acquired, the number and the corresponding rule of the number need to be compared, if the range comparison is performed, the difference comparison is analyzed, whether the number reaches the early warning threshold value is judged according to the rule, and if the number reaches the threshold value, early warning reminding needs to be performed. After the reminding is generated, a number early warning log is required to be recorded, an alarm reminding log is required to be recorded, if the number early warning log is required to be recorded, the number section value is required to be close to the range section to be switched, at the moment, whether preset automatic switching new number section rule data exist or not is required to be inquired and confirmed, if the number section rule data exist, the number section rule data are not processed temporarily, and after the number section is used up, the number section rule is directly switched, if the number section rule data do not exist, a short message or mail reminding is required to be carried out, and the new number section rule of a carrier is required to be manually maintained and increased.
FIG. 6 is a schematic diagram of segment switch monitoring in accordance with an embodiment of the invention; as shown in fig. 6, after the current latest number is obtained according to the current number rule, whether the number is the last number segment of the rule needs to be judged, if the last number segment is not reached, the current number is returned, and if the last number segment is reached, a new number segment value needs to be generated by obtaining a new number segment rule and the new number segment value is used. The newly generated number is generated by adopting the latest rule, at the moment, the rule data needs to be changed, the latest rule data is updated into the existing rule, and the switching and change logs are recorded, so that the switching time and the switching rule content are convenient to trace.
Fig. 7 is a schematic diagram of basic modules of an apparatus for automatically switching number segments according to an embodiment of the present invention. As shown in fig. 7, an embodiment of the present invention provides an apparatus 700 for automatically switching a number segment, including: a number generation module 701, configured to: generating a current number according to a first number segment rule, recording a log of the current number and storing the log of the current number into a database; a processing module 702, configured to: if the current number exceeds the early warning threshold value of the first number segment rule, determining a second number segment rule according to the number segment configuration information in the number segment configuration rule; a switching module 703, configured to: and if the current number is the last number generated according to the first number segment rule, taking the second number segment rule as a new first number segment rule to finish the switching of the number segments.
In the embodiment of the present invention, the processing module 702 is further configured to: determining a preparation number segment rule according to the number segment configuration information in the number segment configuration rule; judging whether the preparation number segment rule meets the verification requirement, and if so, taking the preparation number segment rule as a second number segment rule.
In the embodiment of the present invention, the processing module 702 is further configured to: obtaining number segment configuration information in a number segment configuration rule, wherein the number segment configuration information comprises: number segment prefix, number segment range, early warning threshold value and reminding mode; and determining a preparation number segment rule according to the number segment prefix, the number segment range, the early warning threshold value and the reminding mode.
In the embodiment of the present invention, the processing module 702 is further configured to determine the verification requirement: the prepared number generated according to the prepared number segment rule is different from the historical number; the prefix of the prepared number is consistent with the prefix of the number segment in the prepared number segment rule; the prepared number is in the range of the number segment of the prepared number segment rule.
In the embodiment of the present invention, the processing module 702 is further configured to: if the current number exceeds the early warning threshold value of the first number segment rule, an early warning log of the first number segment rule is generated; if the early warning log of the first segment rule is generated, judging whether the second segment rule is determined, if not, alarming in a reminding mode in the first segment rule, and configuring the second segment rule in a manual mode.
Fig. 8 illustrates an exemplary system architecture 800 of a method or apparatus for automatically switching segments in which embodiments of the present invention may be applied.
As shown in fig. 8, a system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. The network 804 serves as a medium for providing communication links between the terminal devices 801, 802, 803 and the server 805. The network 804 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 805 through the network 804 using the terminal devices 801, 802, 803 to receive or send messages or the like. Various communication client applications, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc., may be installed on the terminal devices 801, 802, 803.
The terminal devices 801, 802, 803 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 805 may be a server providing various services, such as a background management server providing support for shopping-type websites browsed by the user using the terminal devices 801, 802, 803. The background management server can analyze and other data of the received product information inquiry request and feed back the processing result to the terminal equipment.
It should be noted that, the method for automatically switching the number segments provided in the embodiment of the present invention is generally executed by the server 805, and accordingly, the device for automatically switching the number segments is generally disposed in the server 805.
It should be understood that the number of terminal devices, networks and servers in fig. 8 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
According to an embodiment of the invention, the invention further provides an electronic device and a computer readable medium.
The electronic equipment of the embodiment of the invention comprises: one or more processors; and the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are enabled to realize the method for automatically switching the number segments according to the embodiment of the invention.
A computer readable medium of an embodiment of the present invention has stored thereon a computer program which, when executed by a processor, implements a method for automatically switching segments as proposed by the embodiment of the present invention.
Referring now to FIG. 9, there is illustrated a schematic diagram of a computer system 900 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 9 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 9, the computer system 900 includes a central processing module (CPU) 901 that can execute various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 902 or a program loaded from a storage section 908 into a Random Access Memory (RAM) 903. In the RAM903, various programs and data necessary for the operation of the system 900 are also stored. The CPU901, ROM902, and RAM903 are connected to each other through a bus 904. An input/output (I/O) interface 905 is also connected to the bus 904.
The following components are connected to the I/O interface 905: an input section 906 including a keyboard, a mouse, and the like; an output portion 907 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage portion 908 including a hard disk or the like; and a communication section 909 including a network interface card such as a LAN card, a modem, or the like. The communication section 909 performs communication processing via a network such as the internet. The drive 910 is also connected to the I/O interface 905 as needed. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on the drive 910 so that a computer program read out therefrom is installed into the storage section 908 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from the network via the communication portion 909 and/or installed from the removable medium 911. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a central processing module (CPU) 901.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a unit, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present invention may be implemented in software or in hardware. The described units may also be provided in a processor, for example, described as: a processor, comprising: the names of these units do not constitute a limitation on the unit itself in some cases, and for example, the "number generation module" may also be described as "a module for generating a current number".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include: generating a current number according to a first number segment rule, recording a log of the current number, updating a record of a maximum number, and storing the maximum number into a cache; if the maximum number acquired from the cache exceeds the early warning threshold value of the first number segment rule, determining a second number segment rule according to the number segment configuration information in the number segment configuration rule; and if the maximum number acquired from the cache is the last number generated according to the first number segment rule, taking the second number segment rule as a new first number segment rule.
According to the technical scheme of the embodiment of the invention, the technical means of dynamically monitoring the use condition of the number segments in real time by setting the early warning threshold value to determine the new number segment rule in advance is adopted, so that the technical problems that the utilization rate of the old number segments is insufficient and the new number segments are not timely or even fail to be switched in the process of manually switching the number segments or changing the rule by a configuration mode are solved, the new number segments are smoothly switched to the new number segments directly according to the new number segment rule after the original number segments are exhausted, the waste of the old number segments is avoided, and meanwhile, the technical effect of smooth and non-perception switching is achieved.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.