Sequence number acquisition method and apparatus
By asynchronously acquiring a new sequence number set when the first sequence number set has not reached the usage threshold, the problem of business process suspension caused by the completion of sequence number usage in the existing technology is solved, thereby realizing the continuity of business processes and improving efficiency.
Patent Information
- Application Number
- CN202411259833.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2044-09-09
AI Technical Summary
The existing method of obtaining serial numbers causes the business process to pause when it is finished, resulting in a decrease in business processing efficiency.
When the number of items in the first sequence number set does not reach the usage threshold, a sequence number retrieval request is constructed and sent asynchronously to the server to obtain a new sequence number set, ensuring the continuity of the business process.
By asynchronously obtaining a new sequence number set when the first sequence number set has not reached the usage threshold, the business process is avoided from being paused, thus improving the smoothness and efficiency of business processing.
Smart Images

Figure CN119127349B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a serial number acquisition method, apparatus, computer device, computer-readable storage medium, and computer program product. Background Technology
[0002] In the process of processing business logic, sequence numbers are needed to identify data, transactions, messages, etc., on the business side. Therefore, sequence numbers are an essential part of business data. When the sequence numbers on the business side are exhausted, the business side needs to obtain new sequence numbers through a sequence number retrieval method.
[0003] The current method for obtaining sequence numbers involves pausing the business process on the application side when the sequence number is no longer needed. The application side then constructs a sequence number retrieval request and sends it to the server. The server then generates a second sequence number set based on the request and returns it to the application side.
[0004] However, the current method of obtaining the serial number involves pausing the business process on the business side to obtain a new serial number, which causes the business process to be unsmooth and leads to a decrease in business processing efficiency. Summary of the Invention
[0005] Therefore, it is necessary to provide a serial number acquisition method, apparatus, computer device, computer-readable storage medium, and computer program product to address the aforementioned technical problems.
[0006] Firstly, this application provides a method for obtaining a serial number, the method being applied to a business application, the method comprising:
[0007] The business process is executed according to the first sequence number set, and it is checked whether the first quantity of the first sequence number set has reached the usage threshold; the first sequence number set is an incrementing sequence number sequence.
[0008] If the first quantity does not reach the usage quantity threshold, a sequence number acquisition request is constructed and sent to the server; the sequence number acquisition request is used to determine the second sequence number set corresponding to the business terminal;
[0009] The server receives the second sequence number set, where the starting sequence number in the second sequence number set is greater than the ending sequence number in the first sequence number set.
[0010] In one embodiment, detecting whether the first quantity of the first sequence number set has reached the usage threshold includes:
[0011] The number of sequence numbers in the first sequence number set in the cache is determined as the first quantity;
[0012] The product of the acquisition quantity and the usage ratio threshold is determined as the usage quantity threshold;
[0013] Determine whether the first quantity has reached the usage quantity threshold.
[0014] In one embodiment, before determining the product of the acquired quantity and the usage ratio threshold as the usage quantity threshold, the method further includes:
[0015] Obtain the historical sequence number usage dataset of the business process within the historical time period, and process the historical sequence number usage dataset according to the usage frequency algorithm to obtain the usage frequency;
[0016] The number of items to be acquired is determined based on the frequency of use, and the frequency of use is determined using the dataset based on the historical serial number.
[0017] In one embodiment, constructing a sequence number retrieval request and sending the sequence number retrieval request to the server includes:
[0018] Establish an asynchronous thread with a sequence number, and construct a sequence number retrieval request using the asynchronous thread with the sequence number, the sequence number identifier, the retrieval quantity, and the end sequence number of the first sequence number set;
[0019] The asynchronous thread obtains the sequence number and sends the sequence number retrieval request to the server.
[0020] In one embodiment, after constructing the sequence number retrieval request and sending the sequence number retrieval request to the server, the method further includes:
[0021] Determine whether the first quantity is less than or equal to a preset alarm threshold;
[0022] If the first quantity is less than or equal to the alarm threshold, increase the usage ratio threshold to obtain the increased usage ratio threshold.
[0023] Update the alarm count and determine whether the alarm count exceeds a preset alarm count threshold;
[0024] If the number of alarms exceeds the alarm count threshold, alarm information is constructed based on the sequence number identifier, the service identifier, and the information that the first quantity is less than or equal to the alarm threshold, and the alarm information is sent to the target object.
[0025] Secondly, this application provides a method for obtaining a serial number, the method being applied to a server, the method comprising:
[0026] Receive a sequence number retrieval request sent by the service terminal; the sequence number retrieval request includes a sequence number identifier, an end sequence number, and a retrieval quantity;
[0027] Based on the sequence number identifier, query the initial second sequence number set;
[0028] The second sequence number set is determined based on the initial second sequence number set, the ending sequence number, and the number of acquisitions, and the second sequence number set is sent to the service terminal.
[0029] In one embodiment, determining the second sequence number set based on the initial second sequence number set, the ending sequence number, and the number of acquisitions includes:
[0030] Determine whether the second number of sequence numbers in the initial second sequence number set is greater than or equal to the number obtained in the sequence number request;
[0031] If the second quantity is greater than or equal to the quantity obtained, a starting sequence number is determined based on the ending sequence number, and a second sequence number set for the quantity obtained is determined from the initial second sequence number set, starting from the starting sequence number.
[0032] In one embodiment, after determining whether the second number of sequence numbers in the initial second sequence number set is greater than or equal to the number obtained in the sequence number request, the method further includes:
[0033] If the second quantity is less than the obtained quantity, a third sequence number set is generated based on the sequence number rule corresponding to the sequence number identifier;
[0034] The initial second sequence number set is updated based on the third sequence number set to obtain the updated initial second sequence number set;
[0035] The starting sequence number is determined based on the ending sequence number, and the second sequence number set for the quantity to be obtained is determined from the updated initial second sequence number set, starting from the starting sequence number.
[0036] Thirdly, this application also provides a serial number acquisition device, comprising:
[0037] The detection module executes the business process according to the first sequence number set and detects whether the first quantity in the first sequence number set has reached the usage threshold; the first sequence number set is an incrementing sequence number sequence.
[0038] The construction module is configured to construct a sequence number acquisition request and send the sequence number acquisition request to the server when the first quantity does not reach the usage quantity threshold; the sequence number acquisition request is used to determine the second sequence number set corresponding to the business end.
[0039] The first receiving module is used to receive the second sequence number set sent by the server; the starting sequence number in the second sequence number set is greater than the ending sequence number in the first sequence number set.
[0040] Fourthly, this application also provides a serial number acquisition device, comprising:
[0041] The second receiving module is used to receive a sequence number acquisition request sent by the service terminal; the sequence number acquisition request includes a sequence number identifier, an end sequence number, and an acquisition quantity;
[0042] The query module is used to query the initial second sequence number set based on the sequence number identifier;
[0043] The determining module is used to determine a second sequence number set based on the initial second sequence number set, the ending sequence number, and the number of acquisitions, and send the second sequence number set to the service terminal.
[0044] Fifthly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0045] The business process is executed according to the first sequence number set, and it is checked whether the first quantity of the first sequence number set has reached the usage threshold; the first sequence number set is an incrementing sequence number sequence.
[0046] If the first quantity does not reach the usage quantity threshold, a sequence number acquisition request is constructed and sent to the server; the sequence number acquisition request is used to determine the second sequence number set corresponding to the business terminal;
[0047] The server receives the second sequence number set, where the starting sequence number in the second sequence number set is greater than the ending sequence number in the first sequence number set.
[0048] Sixthly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0049] Receive a sequence number retrieval request sent by the service terminal; the sequence number retrieval request includes a sequence number identifier, an end sequence number, and a retrieval quantity;
[0050] Based on the sequence number identifier, query the initial second sequence number set;
[0051] The second sequence number set is determined based on the initial second sequence number set, the ending sequence number, and the number of acquisitions, and the second sequence number set is sent to the service terminal.
[0052] Seventhly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0053] The business process is executed according to the first sequence number set, and it is checked whether the first quantity of the first sequence number set has reached the usage threshold; the first sequence number set is an incrementing sequence number sequence.
[0054] If the first quantity does not reach the usage quantity threshold, a sequence number acquisition request is constructed and sent to the server; the sequence number acquisition request is used to determine the second sequence number set corresponding to the business terminal;
[0055] The server receives the second sequence number set, where the starting sequence number in the second sequence number set is greater than the ending sequence number in the first sequence number set.
[0056] Eighthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0057] Receive a sequence number retrieval request sent by the service terminal; the sequence number retrieval request includes a sequence number identifier, an end sequence number, and a retrieval quantity;
[0058] Based on the sequence number identifier, query the initial second sequence number set;
[0059] The second sequence number set is determined based on the initial second sequence number set, the ending sequence number, and the number of acquisitions, and the second sequence number set is sent to the service terminal.
[0060] Ninthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0061] The business process is executed according to the first sequence number set, and it is checked whether the first quantity of the first sequence number set has reached the usage threshold; the first sequence number set is an incrementing sequence number sequence.
[0062] If the first quantity does not reach the usage quantity threshold, a sequence number acquisition request is constructed and sent to the server; the sequence number acquisition request is used to determine the second sequence number set corresponding to the business terminal;
[0063] The server receives the second sequence number set, where the starting sequence number in the second sequence number set is greater than the ending sequence number in the first sequence number set.
[0064] In a tenth aspect, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0065] Receive a sequence number retrieval request sent by the service terminal; the sequence number retrieval request includes a sequence number identifier, an end sequence number, and a retrieval quantity;
[0066] Based on the sequence number identifier, query the initial second sequence number set;
[0067] The second sequence number set is determined based on the initial second sequence number set, the ending sequence number, and the number of acquisitions, and the second sequence number set is sent to the service terminal.
[0068] The aforementioned sequence number acquisition method, apparatus, computer device, computer-readable storage medium, and computer program product execute a business process based on a first sequence number set and detect whether a first quantity in the first sequence number set has reached a usage threshold. The first sequence number set is an incremental sequence of sequence numbers. If the first quantity has not reached the usage threshold, a sequence number acquisition request is constructed and sent to a server. The sequence number acquisition request is used to determine a second sequence number set corresponding to the business end. The second sequence number set sent by the server is received, wherein the starting sequence number in the second sequence number set is greater than the ending sequence number in the first sequence number set. By employing this method, even when the first quantity in the first sequence number set has not reached the usage threshold, a sequence number acquisition request is constructed and sent to obtain a second sequence number set. This allows the business end to continue executing the business process based on the remaining sequence numbers in the first sequence number set, thereby making the business process smoother and improving business processing efficiency. Attached Figure Description
[0069] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0070] Figure 1 This is an application environment diagram of the serial number acquisition method in one embodiment;
[0071] Figure 2 This is a flowchart illustrating the process of the business side executing the sequence number acquisition method in one embodiment;
[0072] Figure 3 This is a flowchart illustrating the process of determining whether a first quantity has reached a usage quantity threshold in one embodiment;
[0073] Figure 4 This is a schematic diagram of the process for determining the proportion threshold and the quantity to be obtained in one embodiment;
[0074] Figure 5 This is a flowchart illustrating the process of sending a sequence number retrieval request in one embodiment;
[0075] Figure 6 This is a schematic diagram of the process for sending alarm information in one embodiment;
[0076] Figure 7This is a flowchart illustrating the execution of the sequence number acquisition method by the server in one embodiment;
[0077] Figure 8 This is a flowchart illustrating the process of determining the second sequence number set in one embodiment;
[0078] Figure 9 This is a flowchart illustrating the process of determining the second sequence number set in another embodiment;
[0079] Figure 10 This is a schematic diagram of the architecture of a sequence number supplementation method in an exemplary embodiment;
[0080] Figure 11 This is a flowchart illustrating the sequence number supplementation method in an exemplary embodiment;
[0081] Figure 12 This is a structural block diagram of a serial number acquisition device in one embodiment;
[0082] Figure 13 This is a structural block diagram of the serial number acquisition device in another embodiment;
[0083] Figure 14 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0084] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0085] The serial number acquisition method provided in this application embodiment can be applied to, for example... Figure 1 The distributed system 100 shown includes a server 110 and various business terminals 120. Business terminals 120 execute business processes. The server 110 communicates with each business terminal 120 via a network. The server 110 can be an independent physical server, a server cluster consisting of multiple physical servers, or a cloud server providing cloud computing services. Business terminals 120 can be independent physical servers or cloud servers providing cloud computing services.
[0086] In one exemplary embodiment, such as Figure 2 As shown, a method for obtaining serial numbers is provided, which can be applied to... Figure 1 Taking business terminal 120 (hereinafter referred to as business terminal) as an example, the explanation includes the following steps 202 to 206. Among them:
[0087] Step 202: Execute the business process according to the first sequence number set, and check whether the first quantity of the first sequence number set has reached the usage quantity threshold.
[0088] The first sequence number set is an increasing sequence of numbers.
[0089] In implementation, the business-side cache stores a first sequence number set. The business side retrieves sequence numbers from the first sequence number set according to their sequential order to execute the business process. Then, the business side checks whether the first number of sequence numbers in the first sequence number set has reached the usage threshold.
[0090] Specifically, a fourth quantity is pre-set in the business unit. The business unit's cache stores a first sequence number set. The business unit determines the fourth sequence number set for the fourth quantity from the first sequence number set. The business unit retrieves the fourth sequence number set from the first sequence number set. Then, the business unit executes the business process based on the sequence numbers in the fourth sequence number set. The business unit determines the usage quantity threshold based on the retrieved quantity and the usage ratio threshold, and determines whether the first quantity in the first sequence number set has reached the usage quantity threshold.
[0091] In one exemplary embodiment, the first sequence number set is an incrementing sequence of sequence numbers from 0001202408050001 to 0001202408050100. The service terminal starts from 0001202408050001 and retrieves sequence numbers from the first sequence number set in ascending order to execute the business process. Then, the service terminal checks at preset time intervals whether the first quantity of sequence numbers in the first sequence number set has reached a usage threshold.
[0092] Specifically, the fourth quantity is pre-set to 10 in the business unit. The business unit's cache stores a first sequence number set. The first sequence number set is an incrementing sequence from 0001202408050001 to 0001202408050100. Based on the sequence number order of the first sequence number set, the business unit determines the fourth sequence number set for the fourth quantity, resulting in a sequence number set from 0001202408050001 to 0001202408050010. Then, the business unit executes the business process based on the sequence numbers in the fourth sequence number set. The business unit determines the usage quantity threshold based on the acquisition quantity and usage ratio threshold, and checks whether the first quantity in the first sequence number set has reached the usage quantity threshold.
[0093] In an optional embodiment, if the first quantity of the first sequence number set reaches the usage threshold, the business side determines that there are enough sequence numbers available in the first sequence number set and stops executing the sequence number acquisition method.
[0094] Optionally, the business process may be, but is not limited to, business processes in the financial or medical industries. This application embodiment does not limit the business process.
[0095] Optionally, the time interval can be set to 1 minute or 1 hour, depending on business needs. This application embodiment does not limit the time interval.
[0096] Step 204: If the first quantity does not reach the usage threshold, construct a sequence number retrieval request and send the sequence number retrieval request to the server.
[0097] The sequence number retrieval request is used to determine the second sequence number set corresponding to the business side.
[0098] In practice, if the initial quantity does not reach the usage threshold, the business unit constructs a sequence number retrieval request based on the sequence number identifier of the business process and the required quantity. The business unit then sends the sequence number retrieval request to the server.
[0099] Specifically, the business logic (BLU) establishes a new asynchronous thread—the sequence number retrieval asynchronous thread. Then, the BLU constructs a sequence number retrieval request using this thread and sends it to the server. The server receives the request and determines a second sequence number set based on it. The server then sends this second sequence number set back to the BLU.
[0100] In one exemplary embodiment, the business application establishes an asynchronous thread for sequence number retrieval and constructs a sequence number retrieval request based on the asynchronous thread, the sequence number identifier, and the retrieval quantity. The business application then sends the sequence number retrieval request to the server, enabling the server to determine a second sequence number set. The server then sends the second sequence number set back to the business application. The business application receives the second sequence number set sent by the server.
[0101] Step 206: Receive the second sequence number set sent by the server.
[0102] In this case, the starting sequence number in the second sequence number set is greater than the ending sequence number in the first sequence number set.
[0103] In implementation, the server receives a sequence number retrieval request and determines a second sequence number set based on the request. Then, the server sends the second sequence number set to the business application. The business application receives the second sequence number set from the server and updates the first sequence number set according to the second sequence number set, thus obtaining the updated first sequence number set.
[0104] Specifically, the server receives a sequence number retrieval request. This request includes a sequence number identifier and the quantity to be retrieved. The server determines the starting sequence number of the second sequence number set based on the sequence number identifier, and then determines the sequence number for the retrieved quantity based on the starting sequence number, thus constructing the second sequence number set. The server then sends the second sequence number set to the application client via a network connection. The application client receives the second sequence number set and adds all the sequence numbers from the second sequence number set to the first sequence number set, obtaining the updated first sequence number set.
[0105] In the above sequence number acquisition method, if the first quantity in the first sequence number set does not reach the usage threshold, a sequence number acquisition request is constructed and sent to obtain the second sequence number set. This allows the business end to continue executing the business process based on the remaining sequence numbers in the first sequence number set, thereby making the business process smoother and improving business processing efficiency.
[0106] In one exemplary embodiment, such as Figure 3 As shown, the specific processing steps for detecting whether the first quantity of the first sequence number set has reached the usage threshold in step 202 include steps 302 to 306. Wherein:
[0107] Step 302: Determine the number of sequence numbers in the first sequence number set in the cache as the first quantity.
[0108] In implementation, the business side counts the serial numbers in the first serial number set to obtain the first quantity.
[0109] Specifically, the cache on the business side stores a first sequence number set. When the business side executes a business process, it retrieves sequence numbers from the first sequence number set to provide the necessary data for the business process. Then, the business side determines the total number of sequence numbers in the first sequence number set and sets this number as the first quantity.
[0110] In an exemplary embodiment, the service-side cache contains a first sequence number set. When the service-side executes a business process, it determines a fourth sequence number set from the first sequence number set according to a predetermined fourth quantity, and executes the business process based on the sequence numbers in the fourth sequence number set. Then, the service-side counts the sequence numbers in the first sequence number set to obtain the total number of sequence numbers in the first sequence number set, i.e., the first quantity.
[0111] Optionally, the first sequence number set may exist in the form of a queue or a set, but this application embodiment does not limit the form of the first sequence number set.
[0112] Step 304: The product of the quantity obtained and the usage ratio threshold is determined as the usage quantity threshold.
[0113] In implementation, the business side determines the acquisition quantity and usage ratio threshold. Then, the business side multiplies the acquisition quantity and usage ratio threshold to obtain the usage quantity threshold.
[0114] In one exemplary embodiment, the acquisition quantity and usage ratio thresholds are positively correlated with the frequency of use of the sequence number. The higher the usage frequency, the higher the acquisition quantity and usage ratio thresholds. The business unit determines the acquisition quantity and usage ratio thresholds based on the usage frequency. Then, the business unit multiplies the acquisition quantity and usage ratio thresholds to obtain the product, and determines the product as the usage quantity threshold for the business process.
[0115] For example, if the acquisition quantity is 2000 and the usage ratio threshold is 0.5, the business side multiplies 2000 and 0.5 to obtain a usage quantity threshold of 1000.
[0116] Step 306: Determine whether the first quantity has reached the usage threshold.
[0117] In implementation, the business unit determines whether the first quantity has reached the usage threshold. If the first quantity reaches the usage threshold, the business unit determines that there are enough sequence numbers in the first sequence number set to execute the business process. If the first quantity has not reached the usage threshold, the business unit continues to execute step 204 above. The specific processing procedure of step 204 has been described in detail in the above embodiments, and will not be repeated here.
[0118] Specifically, the business logic determines whether the first quantity is greater than or equal to the usage threshold to determine if the first quantity has reached the usage threshold. If the first quantity is greater than or equal to the usage threshold, the business logic determines that there are enough sequence numbers in the first sequence number set to execute the business process and stops executing the sequence number acquisition method. If the first quantity is less than the usage threshold, the business logic continues to execute step 204 above.
[0119] In an exemplary embodiment, the service terminal determines whether a sequence number exists in the cache. If no sequence number exists, the service terminal obtains the sequence number of the quantity to be retrieved from the server and continues to determine whether a sequence number exists in the cache. If a sequence number exists in the cache, the service terminal executes step 302 as described above. The specific processing procedure of step 302 has been described in detail in the above embodiments, and will not be repeated here.
[0120] For example, if the initial quantity is 900 and the usage threshold is 1000, the business logic determines that the initial quantity has not reached the usage threshold and continues with step 204.
[0121] In this embodiment, by detecting whether the first quantity in the first sequence number set has reached the usage quantity threshold, it is determined whether there is a sufficient number of sequence numbers in the first sequence number set to support the execution of the business process, making the execution of the business process smoother and improving the execution efficiency of the business process.
[0122] In an exemplary embodiment, the acquisition quantity and usage ratio thresholds need to be determined before determining the usage quantity threshold based on the acquisition quantity and usage ratio thresholds. For example... Figure 4 As shown, prior to step 304, the specific processing steps of this sequence number acquisition method further include steps 402 to 404. Wherein:
[0123] Step 402: Obtain the historical sequence number usage dataset of business processes within the historical time period, and determine the usage frequency based on the historical sequence number usage dataset.
[0124] The historical sequence number uses the sequence number used for each day within the historical time period contained in the dataset.
[0125] In implementation, historical time periods are pre-set in the business unit. The business unit obtains the historical sequence numbers of business processes within the historical time period using a dataset. The business unit then calculates the total number of sequence numbers in the dataset based on these historical sequence numbers. Finally, the business unit performs data calculations on the total number of sequence numbers using a usage frequency algorithm to obtain the usage frequency.
[0126] In one exemplary embodiment, the historical time period of the dataset used for historical serial numbers is 7 days. The total number of serial numbers is 23,520. The business side performs data calculations on the total number of serial numbers according to the usage frequency algorithm, obtaining a usage frequency of 20 serial numbers per hour.
[0127] In an optional embodiment, the historical sequence number uses a dataset containing the historical usage frequency for each hour within a historical time period. The service terminal inputs each historical usage frequency into a neural network, and the neural network performs prediction processing on each historical usage frequency to obtain the usage frequency.
[0128] Optionally, the neural network may be, but is not limited to, a Long Short-Term Memory network. This application does not limit the neural network in its embodiments.
[0129] Optionally, the historical time period can be set to 7 days or 30 days, but this application embodiment does not limit the historical time period.
[0130] Step 404: Determine the acquisition quantity based on usage frequency, and determine the usage ratio threshold based on usage frequency and business characteristic information of business processes.
[0131] In implementation, an adjustment range is pre-set in the business unit. A correspondence between usage frequency and initial usage ratio threshold is established in the business unit. The business unit determines the target adjustment value within the adjustment range. Then, the sum of the usage frequency and the target adjustment value is used to determine the acquisition quantity. Next, the business unit determines the initial usage ratio threshold corresponding to the usage frequency. Then, the business unit determines whether the business characteristic information of the business process meets the preset adjustment conditions. If the business characteristic information meets the preset adjustment conditions, the business unit adjusts the initial usage ratio threshold to obtain the ratio threshold.
[0132] Specifically, the business side pre-sets an adjustment range. Business characteristic information includes the business category. The business side determines the target adjustment value within the adjustment range based on the adjustment range and historical usage frequency. For example, if the historical usage frequency shows a downward trend, the business side determines the target adjustment value to be negative; if the historical usage frequency shows an upward trend, the business side determines the target adjustment value to be positive. The more pronounced the downward trend, the smaller the target adjustment value; the more pronounced the upward trend, the larger the target adjustment value. Then, the business side adds the usage frequency and the target adjustment value to obtain the acquisition quantity. Next, the business side determines the initial ratio threshold corresponding to the usage frequency. Then, the business side determines whether the business category of the business process is the target business category based on the business characteristic information. If the business category is the target business category, the business side adjusts the initial usage ratio threshold upwards to obtain the usage ratio threshold. If the business category is not the target business category, the business side determines the initial usage ratio threshold as the actual usage ratio threshold.
[0133] For example, the adjustment range is -5 to 5. Historical usage frequency shows an upward trend, with a usage frequency of 20. The correspondence between usage frequency and the initial usage ratio threshold is as follows: if the usage frequency is less than 10, the initial usage ratio threshold is 0.1. If the usage frequency is 10 to 20, the initial usage ratio threshold is 0.2. If the usage frequency is 20 to 30, the initial usage ratio threshold is 0.3. If the usage frequency is 30 to 40, the initial usage ratio threshold is 0.4. If the usage frequency is greater than 40, the initial usage ratio threshold is 0.5. The target business category is the transfer category. The business end determines the target adjustment value to be 5 within the adjustment range. Then, the business end determines the acquisition quantity by the sum of the usage frequency and the target adjustment value, 25. The business end determines the initial usage ratio threshold corresponding to the usage frequency to be 0.2. Then, the business end determines whether the business category of the business process is the transfer category based on the business characteristic information. If the business category is not the transfer category, the business end determines the initial usage ratio threshold to be the usage ratio threshold.
[0134] In an optional embodiment, the business terminal responds to a request to generate acquisition parameters for a business process by displaying an acquisition parameter template. The acquisition parameter template includes usage frequency and business characteristic information of the business process. The user can determine the acquisition quantity based on the displayed usage frequency and input the acquisition quantity. The business terminal responds to an edit operation on the acquisition quantity and retrieves the input acquisition quantity. The user can also input a usage ratio threshold based on the displayed usage frequency and business characteristic information. The business terminal responds to an input operation on the usage ratio threshold and retrieves the user-input usage ratio threshold.
[0135] Optionally, the adjustment range can be set to -5 to 5, depending on the frequency of use of the business process. This application embodiment does not limit the adjustment range.
[0136] In this embodiment, the usage frequency is determined using a dataset based on historical sequence numbers, thus clarifying the usage of sequence numbers in the business process. Furthermore, based on the usage frequency, the acquisition quantity and usage ratio thresholds are determined, facilitating the subsequent determination of the usage quantity threshold. This ensures that the usage quantity threshold remains within a reasonable range, thereby guaranteeing that the first sequence number set always has sequence numbers to support the operation of the business process. Moreover, these acquisition quantity and usage ratio thresholds can be dynamically adjusted according to the processing status of the business process, meeting the needs of different scenarios and expanding the applicability of the sequence number acquisition method.
[0137] In one exemplary embodiment, such as Figure 5 As shown, the specific processing procedure of step 204 includes steps 502 to 504. Wherein:
[0138] Step 502: Establish an asynchronous thread for sequence number retrieval, and construct a sequence number retrieval request using the asynchronous thread for sequence number retrieval, the sequence number identifier, the retrieval quantity, and the end sequence number of the first sequence number set.
[0139] Among them, the serial number identifier is an identifier that represents the serial number.
[0140] In implementation, the business side establishes an asynchronous thread for sequence number retrieval. Then, this thread determines the ending sequence number from the first sequence number set. The business side then constructs a sequence number retrieval request based on the sequence number identifier, the required number, and the ending sequence number. Simultaneously, the main thread on the business side continues to execute business processes based on the sequence numbers in the first sequence number set.
[0141] In an exemplary embodiment, the business side establishes a new sequence number acquisition thread. The business side constructs a sequence number acquisition request based on the sequence number acquisition thread. Specifically, since the first sequence number set is an increasing sequence of sequence numbers, the ending sequence number in the first sequence number set is the largest sequence number with the largest value in the first sequence number set. The sequence number acquisition thread determines the sequence number identifier corresponding to the business process and determines the largest ending sequence number in the first sequence number set. Then, the sequence number acquisition thread constructs a sequence number acquisition request based on the sequence number identifier, the acquisition quantity, and the ending sequence number.
[0142] Optionally, the serial number identifier can be included in each serial number, that is, the business end determines the serial number identifier in the serial number. This application embodiment does not limit the method of determining the serial number identifier.
[0143] Step 504: The asynchronous thread obtains the sequence number and sends the sequence number retrieval request to the server.
[0144] In implementation, the sequence number acquisition thread on the business side sends a sequence number acquisition request to the server, so that the server determines the second sequence number set based on the sequence number acquisition request and returns the second sequence number set to the business side.
[0145] Specifically, the business side and the server side are connected via a network. The sequence number acquisition thread in the business side calls the network process in the business side. This network process sends the sequence number acquisition thread to the server based on the network connection. The server determines the starting sequence number of the second sequence number set based on the ending sequence number and sequence number identifier in the sequence number acquisition request. Then, the server determines the second sequence number set based on the starting sequence number and the acquisition quantity, and sends the second sequence number set to the business side. The business side receives the second sequence number set. This asynchronous sequence number acquisition thread allows the business process to continue using cached sequence numbers even if the business side's number issuance service fails or is delayed, improving the fault tolerance and availability of the business side. The combined use of the asynchronous sequence number acquisition thread and the usage quantity threshold allows the business system in the distributed system to be expanded and managed more flexibly.
[0146] In this embodiment, an asynchronous thread for sequence number acquisition is established. This thread constructs and sends a sequence number acquisition request, enabling the server to determine and return a second sequence number set based on the request. This asynchronous thread can acquire new sequence numbers from the second sequence number set to support the business process without interrupting the main thread's execution. This avoids inconsistencies in business process handling, improves efficiency, and enhances the concurrency and response speed of the business side.
[0147] In an exemplary embodiment, if the first quantity is less than the usage quantity threshold, it is necessary to determine whether the first quantity has reached an alarm threshold in order to determine whether to adjust the usage ratio threshold. Figure 6 As shown, after step 204 is executed, the specific processing procedure of this sequence number acquisition method further includes steps 602 to 608. Wherein:
[0148] Step 602: Determine whether the first quantity is less than or equal to the preset alarm threshold.
[0149] In implementation, alarm thresholds are pre-set in the business logic. The business logic determines whether the first quantity is less than or equal to the alarm threshold.
[0150] Specifically, alarm thresholds are pre-set in the business logic. The business logic checks if the first quantity is less than or equal to the alarm threshold. If the first quantity is greater than the alarm threshold, it indicates that there are still a certain number of sequence numbers in the business logic that can support the execution of the business process. If the first quantity is less than or equal to the alarm threshold, it indicates that the execution time of the business process is shortening and the execution frequency is increasing, requiring an increase in the usage ratio threshold.
[0151] In an optional embodiment, if the first quantity is greater than the alarm threshold, the service terminal initializes the alarm threshold and continues to execute the business process. Specifically, the service terminal initializes the alarm threshold to 0.
[0152] Optionally, the alarm threshold can be set according to the usage frequency. The alarm threshold should be less than the usage quantity threshold. This application embodiment does not limit the alarm threshold.
[0153] Step 604: If the first quantity is less than or equal to the alarm threshold, increase the usage ratio threshold to obtain the increased usage ratio threshold.
[0154] In implementation, if the first quantity is less than or equal to the alarm threshold, the business side determines that the business process does not have enough sequence numbers to support its execution and that there may be an issue of increased usage frequency. Therefore, the business side increases the usage ratio threshold, resulting in an increased usage ratio threshold.
[0155] Specifically, if the first quantity is less than or equal to the alarm threshold, the business unit determines whether the usage ratio threshold has reached the preset maximum usage ratio threshold. If the usage ratio threshold has not reached the maximum usage ratio threshold, the business unit increases the usage ratio threshold to obtain the increased usage ratio threshold. If the usage ratio threshold has reached the maximum usage ratio threshold, the business unit updates the usage ratio threshold to the maximum usage ratio threshold.
[0156] For example, the usage ratio threshold is 0.4, and the maximum usage ratio threshold is 0.5. If the first quantity is less than or equal to the alarm threshold, the business side determines that the usage ratio threshold has not reached the maximum usage ratio threshold. Then, the business side increases the usage ratio threshold to obtain an increased usage ratio threshold of 0.5.
[0157] Optionally, the increase value is determined according to the acquisition requirements. This application embodiment does not limit the increase value for the increase processing.
[0158] Step 606: Update the alarm count and determine whether the alarm count exceeds the preset alarm count threshold.
[0159] In implementation, the business side pre-sets the alarm count and alarm count threshold. The business side adds the alarm count to 1 to obtain the updated alarm count. Then, the business side determines whether the alarm count exceeds the preset alarm count threshold.
[0160] For example, the current alarm count is 1, and the alarm count threshold is 3. The application updates the current alarm count, resulting in an updated alarm count of 2. Then, the application determines that the alarm count has not exceeded the preset alarm count threshold.
[0161] In an optional embodiment, if the number of alarms does not exceed a preset alarm count threshold, the service terminal continues to execute step 202. The specific processing procedure of step 202 has been described in detail in the above embodiments, and will not be repeated here.
[0162] Optionally, the alarm count threshold is generally set to 3 times, depending on the alarm requirements. This application embodiment does not limit the alarm count threshold.
[0163] Step 608: If the number of alarms exceeds the alarm count threshold, construct alarm information based on the sequence number identifier, service identifier, and information that the first quantity is less than or equal to the alarm threshold, and send the alarm information to the target object.
[0164] During implementation, if the number of alarms exceeds the alarm count threshold, the business side determines that there is a problem with the execution of the sequence number acquisition method and needs to inform the target object of this problem. Therefore, the business side constructs alarm information based on the sequence number identifier, the business identifier of the business process, and the information that the first number is less than or equal to the alarm threshold. Then, the business side feeds back the alarm information to the target object through various methods.
[0165] Specifically, the business unit sends alarm information to the target's mobile terminal via email, SMS, or other means so that the target is aware of the alarm information, and manually sends a second sequence number set to the business unit based on the alarm information.
[0166] Optionally, the target object is generally the mobile device of the operation and maintenance personnel of the business process, or it can be the mobile device of the execution personnel of the business process. This application embodiment does not limit the target object.
[0167] In this embodiment, when the first number is less than the alarm threshold, the usage ratio threshold is updated, dynamically adjusting the usage ratio threshold and improving its accuracy. Furthermore, when the number of alarms exceeds the alarm count threshold, alarm information is sent to the target object, causing the target object to manually issue a second sequence number set, preventing interruption of the business process and improving its execution efficiency.
[0168] In one exemplary embodiment, such as Figure 7 As shown, a method for obtaining serial numbers is provided, which can be applied to... Figure 1 Taking server 110 (hereinafter referred to as server) as an example, the explanation includes the following steps 702 to 706. Among them:
[0169] Step 702: Receive the sequence number retrieval request sent by the business terminal.
[0170] The sequence number retrieval request includes a sequence number identifier, an ending sequence number, and the number of items to be retrieved.
[0171] In implementation, the server receives sequence number retrieval requests from the business unit via a network connection. The sequence number identifier indicates that a sequence number needs to be retrieved. The ending sequence number is used to determine the starting sequence number, and the retrieval quantity is used to determine the total number of sequence numbers to be retrieved.
[0172] Step 704: Query the initial second sequence number set based on the sequence number identifier.
[0173] In practice, the server queries the initial second sequence number set corresponding to the sequence number identifier based on the sequence number identifier.
[0174] In one exemplary embodiment, the sequence number includes a sequence number identifier. The server performs a fuzzy search based on the sequence number identifier to obtain each sequence number, and constructs an initial second sequence number set based on each sequence number.
[0175] Step 706: Determine the second sequence number set based on the initial second sequence number set, the ending sequence number, and the number of items obtained, and send the second sequence number set to the business end.
[0176] In implementation, the server determines whether the initial second sequence number set meets the preset sequence number set update conditions based on the second quantity and the number of acquisitions. If the initial second sequence number set meets the sequence number update conditions, the server generates a third sequence number set and updates the initial second sequence number set according to the third sequence number set, obtaining the updated initial second sequence number set. Then, the server determines the second sequence number set based on the updated second sequence number set, the ending sequence number, and the number of acquisitions, and sends the second sequence number set to the business end. If the initial second sequence number set does not meet the sequence number update conditions, the computer device determines the second sequence number set based on the initial second sequence number set, the ending sequence number, and the number of acquisitions, and sends the second sequence number set to the business end.
[0177] Specifically, the sequence number update condition is that the second quantity is less than the acquired quantity. The server determines whether the second quantity in the initial second sequence number set is less than the acquired quantity. If the second quantity is less than the acquired quantity, the server determines that the initial second sequence number set meets the sequence number update condition. If the second quantity is greater than or equal to the acquired quantity, the server determines that the initial second sequence number set does not meet the sequence number update condition.
[0178] In this embodiment, the server responds to the sequence number acquisition request, determines the second sequence number set according to the sequence number acquisition request, and returns the second sequence number set to the business end, supplementing the sequence numbers in the business end, so that the business end has enough sequence numbers to execute the business process, thereby making the business process processing smoother and improving business processing efficiency.
[0179] In one exemplary embodiment, such as Figure 8 As shown, the specific processing steps in step 706 for determining the second sequence number set based on the initial second sequence number set, the ending sequence number, and the acquisition quantity include steps 802 to 804. Wherein:
[0180] Step 802: Determine whether the second quantity of the sequence numbers in the initial second sequence number set is greater than or equal to the quantity obtained in the sequence number request.
[0181] The second quantity is the total number of serial numbers in the initial second serial number set.
[0182] In implementation, the server counts the sequence numbers in the initial second sequence number set to obtain a second quantity. Then, the server determines whether the second quantity is greater than or equal to the quantity obtained in the sequence number request.
[0183] For example, the server counts the serial numbers in the initial serial number set, obtaining a second set of 100 serial numbers. The server then retrieves 100 serial numbers. The server determines that the second set of 100 serial numbers is greater than or equal to the retrieved set, meaning there are enough serial numbers in the initial second set to send to the application.
[0184] Step 804: If the second quantity is greater than or equal to the quantity to be acquired, determine the starting sequence number based on the ending sequence number, and determine the second sequence number set of the quantity to be acquired from the initial second sequence number set, starting from the starting sequence number.
[0185] In implementation, if the second quantity is greater than or equal to the quantity obtained, the server determines that there are enough sequence numbers in the initial second sequence number set to send to the business end. The server determines a starting sequence number in the initial second sequence number set that is greater than the ending sequence number. Then, starting from the starting sequence number, the server determines the sequence numbers for the quantity to be obtained in the initial sequence number set and constructs a second sequence number set based on these sequence numbers. Finally, the server sends the second sequence number set to the business end.
[0186] Specifically, the sequence number retrieval request also includes a step size, which is the interval between two sequence numbers. If the second quantity is greater than or equal to the quantity to be retrieved, the server determines to perform an addition operation on the ending sequence number and the step size to obtain an initial starting sequence number. Then, the server checks if an initial starting sequence number exists in the initial second sequence number set. If an initial starting sequence number exists in the initial second sequence number set, the server determines the initial starting sequence number as the starting sequence number. If an initial starting sequence number does not exist in the initial second sequence number set, the server searches for a starting sequence number greater than the ending sequence number in the initial second sequence number set. Then, starting with the starting sequence number, the server determines the sequence number for the quantity to be retrieved in the initial sequence number set and constructs a second sequence number set based on each sequence number. Finally, the server sends the second sequence number set to the business end.
[0187] In an exemplary embodiment, the step size in the sequence number acquisition request is 1. The ending sequence number is 0001202408050100. The acquisition quantity is 100. If the second quantity is greater than or equal to the acquisition quantity, the server performs an addition operation on the step size 1 and the ending sequence number to obtain the initial starting sequence number 0001202408050101. The server determines that the initial starting sequence number exists in the initial second sequence number set and determines the initial starting sequence number as the starting sequence number. Then, starting with the starting sequence number 0001202408050101, the server determines 100 sequences in the initial sequence number set and constructs a second sequence number set based on each sequence number. The second sequence number set is then a set from 0001202408050101 to 0001202408050200.
[0188] In this embodiment, by determining whether the second quantity of the initial second sequence number set is greater than or equal to the number of sequences obtained, it is determined whether there are enough sequence numbers in the initial sequence number set to send to the business end. If the second quantity is greater than or equal to the number of sequences obtained, the second sequence number set is determined to facilitate subsequent replenishment of sequence numbers in the business end.
[0189] In an exemplary embodiment, if the second quantity is less than the acquired quantity, a third sequence number set needs to be generated to supplement the initial second sequence number set. For example... Figure 9 As shown, after step 802 is executed, the specific processing procedure of this sequence number acquisition method further includes steps 902 to 906. Wherein:
[0190] Step 902: If the second quantity is less than the quantity obtained, generate a third sequence number set based on the sequence number rule corresponding to the sequence number identifier.
[0191] In implementation, if the second quantity is less than the quantity obtained, the server queries the sequence number rule based on the sequence number identifier. Then, the server generates a third sequence number set according to the sequence number rule.
[0192] Specifically, if the second quantity is less than the quantity obtained, the server queries the database for the sequence number rule corresponding to the sequence number identifier. The sequence number rule includes the sequence number components and the step size. The server determines the maximum value of the sequence numbers in the initial second sequence number set. Then, the server generates the third sequence number set based on the maximum value, the sequence number components, and the step size.
[0193] In an exemplary embodiment, if the second quantity is less than the acquired quantity, the server queries the database for the sequence number rule corresponding to the sequence number identifier. The sequence number rule includes sequence number components, a step size, and a generation quantity. The step size is 1. 100 sequences are generated. The sequence number components include a sequence number identifier, a business process trigger time, and a sequence number sub-value. The server determines the maximum sequence number in the initial second sequence number set to be 0001202408050150. Here, 0001 is the sequence number identifier, 20240805 is the business trigger time, and 0150 is the sequence number sub-value. Based on the maximum sequence number 0001202408050150 and the step size, the server determines the starting sequence number of the third sequence number set to be 0001202408050151. Then, the server generates a third set of serial numbers based on the maximum serial number, the constituent elements of the serial number, and the step size. The third set of serial numbers is a set from 0001202408050151 to 0001202408050250.
[0194] Step 904: Update the initial second sequence number set based on the third sequence number set to obtain the updated initial second sequence number set.
[0195] In practice, the server adds the third sequence number set to the initial second sequence number set to obtain the updated initial sequence number set.
[0196] For example, the initial second sequence number set is the set from 0001202408050101 to 0001202408050150. The third sequence number set is the set from 0001202408050151 to 0001202408050250. The server adds the third sequence number set to the initial second sequence number set, resulting in an updated initial second sequence number set from 0001202408050101 to 0001202408050250.
[0197] Step 906: Determine the starting sequence number based on the ending sequence number, and starting from the starting sequence number, determine the second sequence number set of the quantity to be obtained from the updated initial second sequence number set.
[0198] In implementation, the server determines a starting sequence number that is larger than the ending sequence number in the updated initial second sequence number set. Then, using the starting sequence number as a starting point, the server determines the sequence number for the quantity to be obtained from the updated initial sequence number set, and constructs a second sequence number set based on these sequence numbers. Finally, the server sends the second sequence number set to the business end.
[0199] Specifically, the sequence number retrieval request also includes a step size, which is the interval between two sequence numbers. If the second quantity is greater than or equal to the quantity to be retrieved, the server determines to perform an addition operation on the ending sequence number and the step size to obtain an initial starting sequence number. Then, the server checks whether an initial starting sequence number exists in the updated initial second sequence number set. If an initial starting sequence number exists in the updated initial second sequence number set, the server determines the initial starting sequence number as the starting sequence number. If an initial starting sequence number does not exist in the updated initial second sequence number set, the server searches for a starting sequence number greater than the ending sequence number in the initial second sequence number set. Then, starting with the starting sequence number, the server determines the sequence number for the quantity to be retrieved in the updated initial sequence number set and constructs a second sequence number set based on each sequence number. Finally, the server sends the second sequence number set to the business end.
[0200] In an exemplary embodiment, the step size in the sequence number acquisition request is 1. The ending sequence number is 0001202408050100. The acquisition quantity is 100. If the second quantity is greater than or equal to the acquisition quantity, the server performs an addition operation on the step size 1 and the ending sequence number to obtain the initial starting sequence number 0001202408050101. The server determines that the initial starting sequence number exists in the updated initial second sequence number set and determines the initial starting sequence number as the starting sequence number. Then, starting with the starting sequence number 0001202408050101, the server determines 100 sequences in the updated initial sequence number set and constructs a second sequence number set based on each sequence number. The second sequence number set is then a set from 0001202408050101 to 0001202408050200.
[0201] In this embodiment, when the second quantity is less than the quantity acquired, a third sequence number set is generated, and the initial second sequence number set is updated based on the third sequence number set to obtain an updated initial second sequence number set, ensuring that the updated initial second sequence number set has a sufficient number of sequence numbers. Then, the second sequence number set is determined based on the updated initial second sequence number set, facilitating the subsequent supplementation of sequence numbers in the business terminal.
[0202] In one exemplary embodiment, Figure 10 This is a schematic diagram of the architecture of a sequence number supplementation method in an exemplary embodiment. For example... Figure 10As shown, the sequence number is the request serial number. The request serial number can be, but is not limited to, a core system serial number, a batch accounting group number, a public teller's transaction record, a customer account, a globally unique sequence, etc. The serial number in the business side exists in the JVM (Java Virtual Machine, Java is a programming language) cache and supports a dual-segment cache structure. Specifically, 1=100 is one segment, and 101=200 is another segment. The business side supports storing serial numbers in both segments 1-100 and 101-200. When the remaining amount in the first segment cache does not reach the usage threshold, the second segment cache is filled. When the resources of the first segment are exhausted, the serial number is retrieved from the second segment cache, and the business process continues. This application can periodically or proactively fill the cache according to the consumption status of the serial number resources in the cache to ensure sufficient serial number resources in the cache, and supports a dual-segment filling mode. When the first quantity is less than the alarm threshold, an alarm is triggered.
[0203] In one exemplary embodiment, Figure 11 This is a flowchart illustrating a sequence number supplementation method in an exemplary embodiment. For example... Figure 11 As shown, the method for supplementing the serial number includes:
[0204] Step 1101: The business system retrieves the sequence number from the cache and executes the business process.
[0205] Step 1102: Check if there is a sequence number in the cache. If a sequence number exists, proceed to step 1104; otherwise, proceed to step 1103.
[0206] Step 1103: Construct a sequence number retrieval request and send it to the server to retrieve the second sequence number set from the server and add it to the first sequence number set in the cache. Then, continue to execute step 1102.
[0207] Step 1104: Determine whether the first quantity of the first sequence number set in the cache has reached the preset usage threshold. If the first quantity has not reached the usage threshold, proceed to step 1105. If the first quantity has reached the usage threshold, proceed to step 1101.
[0208] Step 1105: Generate a sequence number to obtain an asynchronous thread, use this sequence number to construct a sequence number retrieval request, and send the sequence number retrieval request to the server.
[0209] Step 1106: Determine whether the first quantity is less than or equal to the alarm threshold. If the first quantity is less than or equal to the alarm threshold, proceed to step 1107; if the first quantity is greater than the alarm threshold, proceed to step 1110.
[0210] Step 1107: Increase the usage ratio threshold and update the alarm count.
[0211] Step 1108: Determine if the number of alarms exceeds the alarm count threshold. If the number of alarms exceeds the alarm count threshold, proceed to step 1109. If the number of alarms does not exceed the alarm count threshold, proceed to step 1110.
[0212] Step 1109: Build alarm information and send the alarm information back to the target object.
[0213] Step 1110: Receive the second sequence number set returned by the server and add the second sequence number set to the first sequence number set in the cache.
[0214] Step 1105 involves replenishing the position. The replenishment rule is that replenishment begins when the first quantity is 0.4, 0.3, 0.2, or 0.1 times the acquired quantity, to prevent concurrency issues. There are a total of four replenishment opportunities.
[0215] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0216] Based on the same inventive concept, this application also provides a serial number acquisition device for implementing the serial number acquisition method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more serial number acquisition device embodiments provided below can be found in the limitations of the serial number acquisition method described above, and will not be repeated here.
[0217] In one exemplary embodiment, such as Figure 12 As shown, a serial number acquisition device 1200 is provided, including: a detection module 1201, a construction module 1202, and a first receiving module 1203, wherein:
[0218] The detection module 1201 executes the business process according to the first sequence number set and detects whether the first quantity of the first sequence number set has reached the usage quantity threshold; the first sequence number set is an incrementing sequence number sequence.
[0219] The construction module 1202 is used to construct a sequence number acquisition request and send the sequence number acquisition request to the server when the first quantity does not reach the usage quantity threshold; the sequence number acquisition request is used to determine the second sequence number set corresponding to the business end.
[0220] The first receiving module 1203 is used to receive the second sequence number set sent by the server; the starting sequence number in the second sequence number set is greater than the ending sequence number in the first sequence number set.
[0221] In one exemplary embodiment, the detection module 1201 includes a first execution submodule and a first detection submodule. The first detection submodule includes:
[0222] The first determination submodule is used to determine the number of sequence numbers in the first sequence number set in the cache as the first quantity.
[0223] The second determining submodule is used to determine the usage quantity threshold by multiplying the acquisition quantity and the usage ratio threshold.
[0224] The first judgment submodule is used to determine whether the first quantity has reached the usage quantity threshold.
[0225] In one exemplary embodiment, the serial number acquisition device 1200 further includes:
[0226] The first acquisition module is used to acquire the historical sequence number usage dataset of business processes within a historical time period, and determine the usage frequency based on the historical sequence number usage dataset.
[0227] The first determining module is used to determine the acquisition quantity based on the usage frequency, and to determine the usage ratio threshold based on the usage frequency and business characteristic information of the business process.
[0228] In one exemplary embodiment, the construction module 1202 includes:
[0229] Create a submodule to establish an asynchronous thread for obtaining sequence numbers, and construct a sequence number retrieval request using the asynchronous thread, sequence number identifier, retrieval quantity, and the last sequence number in the first sequence number set.
[0230] The first sending submodule is used to send a sequence number retrieval request to the server via an asynchronous thread that retrieves the sequence number.
[0231] In one exemplary embodiment, the serial number acquisition device 1200 further includes:
[0232] The first judgment module is used to determine whether the first quantity is less than or equal to the preset alarm threshold.
[0233] The increase module is used to increase the usage ratio threshold if the first quantity is less than or equal to the alarm threshold, and obtain the increased usage ratio threshold.
[0234] The first update module is used to update the alarm count and determine whether the alarm count exceeds the preset alarm count threshold.
[0235] The second construction module is used to construct alarm information based on the sequence number identifier, service identifier, and information that the first quantity is less than or equal to the alarm threshold if the number of alarms exceeds the alarm count threshold, and then send the alarm information to the target object.
[0236] In one exemplary embodiment, such as Figure 13 As shown, a serial number acquisition device 1300 is provided, including: a second receiving module 1301, a query module 1302, and a determining module 1303, wherein:
[0237] The second receiving module 1301 is used to receive a sequence number acquisition request sent by the service terminal; the sequence number acquisition request includes a sequence number identifier, an end sequence number, and an acquisition quantity.
[0238] The query module 1302 is used to query the initial second sequence number set based on the sequence number identifier.
[0239] The determination module 1303 is used to determine the second sequence number set based on the initial second sequence number set, the end sequence number, and the number of acquisitions, and send the second sequence number set to the business end.
[0240] In an exemplary embodiment, the determining module 1303 includes a third determining submodule and a second sending submodule, wherein the third determining submodule includes:
[0241] The second judgment submodule is used to determine whether the second quantity of the serial numbers in the initial second serial number set is greater than or equal to the quantity obtained in the serial number request.
[0242] The fourth determination submodule is used to determine the starting sequence number based on the ending sequence number if the second quantity is greater than or equal to the quantity to be obtained, and to determine the second sequence number set of the quantity to be obtained from the initial second sequence number set starting from the starting sequence number.
[0243] In one exemplary embodiment, the serial number acquisition device 1300 further includes:
[0244] The generation module is used to generate a third sequence number set based on the sequence number rule corresponding to the sequence number identifier if the second quantity is less than the quantity obtained.
[0245] The second update module is used to update the initial second sequence number set based on the third sequence number set, so as to obtain the updated initial second sequence number set.
[0246] The second determining module is used to determine the starting sequence number based on the ending sequence number, and to determine the second sequence number set of the acquisition quantity from the updated initial second sequence number set, starting from the starting sequence number.
[0247] Each module in the aforementioned serial number acquisition device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0248] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 14 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores data used for the serial number acquisition method. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a serial number acquisition method.
[0249] Those skilled in the art will understand that Figure 14 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0250] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0251] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0252] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0253] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0254] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0255] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for obtaining a serial number, characterized in that, The method is applied to the business side, and the method includes: Execute the business process according to the first sequence number set; Obtain the historical sequence number usage dataset of the business process within the historical time period, and determine the usage frequency based on the historical sequence number usage dataset; The acquisition quantity is determined based on the usage frequency, and the usage ratio threshold is determined based on the usage frequency and the business characteristic information of the business process. The business characteristic information includes business categories. The process of determining the acquisition quantity based on the usage frequency and determining the usage ratio threshold based on the usage frequency and the business characteristic information of the business process includes: Based on a preset adjustment range and historical usage frequency, a target adjustment value is determined within the adjustment range; if the historical usage frequency shows a downward trend, the target adjustment value is negative; if the historical usage frequency shows a trend, the target adjustment value is determined to be positive. The usage frequency and the target adjustment value are added together to obtain the quantity, and the initial usage ratio threshold corresponding to the usage frequency is determined. Determine whether the business type of the business process matches the target business category; If the business category is the target business category, the initial usage ratio threshold is adjusted upwards to obtain the usage ratio threshold. If the business category is not the target business category, the initial usage ratio threshold will be determined as the usage ratio threshold. The usage quantity threshold is determined based on the acquired quantity and the usage ratio threshold. Detect whether the first quantity in the first sequence number set reaches the usage quantity threshold; the first sequence number set is an increasing sequence number; the usage quantity threshold is determined based on the acquisition quantity and usage ratio threshold; If the first quantity does not reach the usage threshold, a sequence number acquisition request is constructed and sent to the server; the sequence number acquisition request is used to determine the second sequence number set corresponding to the business terminal; the sequence number acquisition request includes a sequence number identifier, the acquisition quantity, and the end sequence number in the first sequence number set; Determine whether the first quantity is less than or equal to a preset alarm threshold; If the first quantity is less than or equal to the alarm threshold, increase the usage ratio threshold to obtain the increased usage ratio threshold. Update the alarm count and determine whether the alarm count exceeds a preset alarm count threshold; If the number of alarms exceeds the alarm count threshold, alarm information is constructed based on the sequence number identifier, the service identifier, and the information that the first quantity is less than or equal to the alarm threshold, and the alarm information is sent to the target object; the alarm information is used to instruct the target object to send the second sequence number set to the service terminal; The server receives the second sequence number set, where the starting sequence number in the second sequence number set is greater than the ending sequence number in the first sequence number set.
2. The method according to claim 1, characterized in that, The historical sequence number uses a dataset containing the sequence number used for each day within the historical time period.
3. The method according to claim 1, characterized in that, The step of detecting whether the first quantity of the first sequence number set has reached the usage threshold includes: The number of sequence numbers in the first sequence number set in the cache is determined as the first quantity; The product of the acquisition quantity and the usage ratio threshold is determined as the usage quantity threshold; Determine whether the first quantity has reached the usage quantity threshold.
4. The method according to claim 1, characterized in that, The step of constructing a sequence number retrieval request and sending the sequence number retrieval request to the server includes: Establish an asynchronous thread with a sequence number, and construct a sequence number retrieval request using the asynchronous thread with the sequence number, the sequence number identifier, the retrieval quantity, and the end sequence number of the first sequence number set; The asynchronous thread obtains the sequence number and sends the sequence number retrieval request to the server.
5. The method according to claim 4, characterized in that, The serial number identifier is determined in the serial number.
6. A method for obtaining a serial number, characterized in that, The method is applied to the server side, and the method includes: The system receives a sequence number retrieval request from the service terminal. The request includes a sequence number identifier, an ending sequence number, and a retrieval quantity. A usage quantity threshold is determined based on the retrieval quantity and a usage ratio threshold. The retrieval quantity is obtained by acquiring historical sequence number usage datasets of the business process within a historical time period, and determining a target adjustment value within the adjustment range based on a preset adjustment range and historical usage frequency. If the historical usage frequency shows a downward trend, the target adjustment value is negative; if the historical usage frequency shows a trend, the target adjustment value is positive. The retrieval quantity is obtained by adding the usage frequency and the target adjustment value. The usage ratio threshold is determined based on the usage frequency and the business characteristic information of the business process. The business characteristic information includes the business category, and the usage ratio threshold is used to determine the initial usage corresponding to the usage frequency. The process involves several steps: determining whether the business type of the business process is a target business category; adjusting the initial usage ratio threshold upwards if the business category is the target business category; setting the initial usage ratio threshold as the usage ratio threshold if the business category is not the target business category; determining whether the first quantity is less than or equal to a preset alarm threshold; increasing the usage ratio threshold if the first quantity is less than or equal to the alarm threshold; updating the alarm count and determining whether the alarm count exceeds a preset alarm count threshold; constructing alarm information based on the sequence number identifier, business identifier, and the information that the first quantity is less than or equal to the alarm threshold, and sending the alarm information to the target object; and instructing the target object to send a second sequence number set to the business end. Based on the sequence number identifier, query the initial second sequence number set; The second sequence number set is determined based on the initial second sequence number set, the ending sequence number, and the number of acquisitions, and the second sequence number set is sent to the service terminal.
7. The method according to claim 6, characterized in that, The step of determining the second sequence number set based on the initial second sequence number set, the ending sequence number, and the acquisition quantity includes: Determine whether the second number of sequence numbers in the initial second sequence number set is greater than or equal to the number obtained in the sequence number request; If the second quantity is greater than or equal to the quantity obtained, a starting sequence number is determined based on the ending sequence number, and a second sequence number set for the quantity obtained is determined from the initial second sequence number set, starting from the starting sequence number.
8. The method according to claim 7, characterized in that, After determining whether the second quantity of serial numbers in the initial second sequence number set is greater than or equal to the quantity obtained in the sequence number request, the method further includes: If the second quantity is less than the obtained quantity, a third sequence number set is generated based on the sequence number rule corresponding to the sequence number identifier; The initial second sequence number set is updated based on the third sequence number set to obtain the updated initial second sequence number set; The starting sequence number is determined based on the ending sequence number, and the second sequence number set for the quantity to be obtained is determined from the updated initial second sequence number set, starting from the starting sequence number.
9. A serial number acquisition device, characterized in that, The device includes: The detection module is used to execute business processes based on the first sequence number set; The first acquisition module is used to acquire the historical sequence number usage dataset of the business process within a historical time period, and determine the usage frequency based on the historical sequence number usage dataset; The first determining module is used to determine the acquisition quantity based on the usage frequency, and to determine the usage ratio threshold based on the usage frequency and the business characteristic information of the business process; The business characteristic information includes a business category. Specifically, the first determining module is used to determine a target adjustment value within the preset adjustment range and historical usage frequency; if the historical usage frequency shows a downward trend, the target adjustment value is negative; if the historical usage frequency shows a trend, the target adjustment value is positive; the usage frequency and the target adjustment value are added together to obtain the acquisition quantity, and an initial usage ratio threshold corresponding to the usage frequency is determined; it is determined whether the business type of the business process is the target business category; if the business category is the target business category, the initial usage ratio threshold is increased to obtain a usage ratio threshold; if the business category is not the target business category, the initial usage ratio threshold is determined as the usage ratio threshold. The detection module is further configured to determine a usage quantity threshold based on the acquired quantity and the usage ratio threshold; detect whether the first quantity in the first sequence number set reaches the usage quantity threshold; the first sequence number set is an increasing sequence number sequence; the usage quantity threshold is determined based on the acquired quantity and the usage ratio threshold; The first construction module is configured to construct a sequence number acquisition request and send the sequence number acquisition request to the server when the first quantity does not reach the usage quantity threshold; the sequence number acquisition request is used to determine the second sequence number set corresponding to the business end. The first judgment module is used to determine whether the first quantity is less than or equal to a preset alarm threshold. An increase module is used to increase the usage ratio threshold if the first quantity is less than or equal to the alarm threshold, so as to obtain the increased usage ratio threshold. The first update module is used to update the alarm count and determine whether the alarm count exceeds a preset alarm count threshold. The second construction module is used to construct alarm information based on the sequence number identifier, the service identifier, and the information that the first quantity is less than or equal to the alarm threshold if the alarm count exceeds the alarm count threshold, and send the alarm information to the target object; the alarm information is used to instruct the target object to send the second sequence number set to the service terminal; The first receiving module is used to receive the second sequence number set sent by the server; the starting sequence number in the second sequence number set is greater than the ending sequence number in the first sequence number set.
10. A serial number acquisition device, characterized in that, The device includes: The second receiving module is used to receive a sequence number acquisition request sent by the service terminal. The sequence number acquisition request includes a sequence number identifier, an ending sequence number, and an acquisition quantity. The usage quantity threshold is determined based on the acquisition quantity and the usage ratio threshold. The acquisition quantity is obtained by acquiring historical sequence number usage datasets of the business process within a historical time period, and determining a target adjustment value within the adjustment range based on a preset adjustment range and historical usage frequency. If the historical usage frequency shows a downward trend, the target adjustment value is negative; if the historical usage frequency shows a trend, the target adjustment value is positive. The acquisition quantity is obtained by adding the usage frequency and the target adjustment value. The usage ratio threshold is determined based on the usage frequency and the business characteristic information of the business process. The business characteristic information includes a business category, and the usage ratio threshold is determined based on the usage frequency corresponding to... The process involves: determining the initial usage ratio threshold; judging whether the business type of the business process is a target business category; if the business category is the target business category, adjusting the initial usage ratio threshold upwards; if the business category is not the target business category, setting the initial usage ratio threshold as the usage ratio threshold; the business terminal is used to determine whether the first quantity is less than or equal to a preset alarm threshold; if the first quantity is less than or equal to the alarm threshold, increasing the usage ratio threshold to obtain the increased usage ratio threshold; updating the alarm count, and judging whether the alarm count exceeds a preset alarm count threshold; if the alarm count exceeds the alarm count threshold, constructing alarm information based on the sequence number identifier, business identifier, and the information that the first quantity is less than or equal to the alarm threshold, and sending the alarm information to the target object; the alarm information is used to instruct the target object to send a second sequence number set to the business terminal. The query module is used to query the initial second sequence number set based on the sequence number identifier; The determining module is used to determine a second sequence number set based on the initial second sequence number set, the ending sequence number, and the number of acquisitions, and send the second sequence number set to the service terminal.
Citation Information
Patent Citations
Sequence number distribution method and device, equipment and storage medium
CN114895953A
Serial number distribution method and device, computer equipment and storage medium
CN117076519A