Serial number generation method and device, equipment, storage medium and product
By dynamically adjusting the sequence number generation request using geographic region identifiers and configuration files in a distributed environment, the flexibility and scalability issues of sequence number generation in existing technologies are solved, achieving data consistency and accuracy in high-concurrency scenarios and improving system performance and user experience.
Patent Information
- Application Number
- CN202511664468.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-13
- Publication Date
- 2026-02-10
AI Technical Summary
Existing technologies lack flexibility and scalability in generating serial numbers in distributed deployment environments, making it difficult to meet the requirements for data uniqueness and accuracy in high-concurrency scenarios.
By acquiring geographic region identifiers and transmission scenario identifiers, and utilizing the pre-established correspondence between geographic regions and database identifiers and configuration files, the sequence number generation request is dynamically adjusted to achieve precise positioning of the target database and generation of sequence number values, avoiding blind searches and duplicate conflicts.
It improves the flexibility and scalability of serial number generation, reduces database pressure, ensures data consistency and accuracy, adapts to various business scenarios, and improves system stability and performance, especially under high concurrency conditions.
Smart Images

Figure CN121501795A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of big data, mobile Internet and data processing, and particularly relate to a sequence number generation method, device, equipment, storage medium and product. BACKGROUND
[0002] With the rapid development of business environment, various businesses have increasing demand for efficient and flexible data interaction. As a key link to ensure data uniqueness and accuracy, sequence number generation, especially in high concurrency scenarios, a sequence number system capable of generating non-repetitive and regular sequence numbers has a significant impact on the smooth execution of business processes and data security.
[0003] In related technologies, a method of generating sequence numbers based on a database version is usually used, which meets the demand for sequence number generation to some extent, but it relies on a single database trigger, limiting flexibility and scalability in distributed deployment environments. SUMMARY
[0004] Embodiments of the present application provide a sequence number generation method, device, equipment, storage medium and product to solve the problems of low flexibility and poor scalability of sequence number generation.
[0005] In a first aspect, embodiments of the present application provide a sequence number generation method applied to an application server, comprising:
[0006] In response to receiving a data transmission request sent by a front-end device, obtaining a first-level geographic area identifier and a target transmission scenario identifier carried in the data transmission request;
[0007] According to a pre-established corresponding relationship between geographic area identifiers and database identifiers, determining a target database identifier corresponding to the first-level geographic area identifier;
[0008] According to a pre-set configuration file, determining a target data table identifier and target sequence number adjustment data corresponding to the target transmission scenario identifier;
[0009] Sending a sequence number generation request carrying the first-level geographic area identifier, the target data table identifier and the target sequence number adjustment data to a target database server corresponding to the target database identifier, so that the target database server finds a target data record corresponding to the first-level geographic area identifier from a target data table corresponding to the target data table identifier stored in a target database, and generates a target sequence number value according to the target sequence number adjustment data and an original sequence number value in the target data record;
[0010] receive the target serial number value returned by the target database server, and send a response message to the front-end device based on the target serial number value.
[0011] In a second aspect, the embodiments of the present application further provide a serial number generation method, applied to a database server, comprising:
[0012] receive a serial number generation request carrying a first-level geographic area identifier, a target data table identifier and target serial number adjustment data, sent by an application server; wherein the serial number generation request is sent by the application server after receiving a data transmission request sent by a front-end device, determining a target database identifier according to a first-level geographic area identifier carried in the data transmission request, and determining the target data table identifier and the target serial number adjustment data according to a target transmission scenario identifier carried in the data transmission request;
[0013] find a target data table corresponding to the target data table identifier from the target database, and find a target data record corresponding to the first-level geographic area identifier from the target data table;
[0014] read an original serial number value in the target data record, and generate a target serial number value according to the target serial number adjustment data and the original serial number value;
[0015] update the original serial number value in the target data record to the target serial number value, and send the target serial number value to the application server.
[0016] In a third aspect, the embodiments of the present application further provide a serial number generation device, configured in an application server, comprising:
[0017] an application response module, configured to, in response to receiving a data transmission request sent by a front-end device, acquire a first-level geographic area identifier and a target transmission scenario identifier carried in the data transmission request;
[0018] an identifier determination module, configured to determine a target database identifier corresponding to the first-level geographic area identifier according to a pre-established corresponding relationship between geographic area identifiers and database identifiers;
[0019] a configuration determination module, configured to determine a target data table identifier and target serial number adjustment data corresponding to the target transmission scenario identifier according to a pre-set configuration file;
[0020] The request sending module is configured to send a sequence number generation request carrying the first-level geographic area identifier, the target data table identifier and the target sequence number adjustment data to the target database server, so that the target database server finds a target data record corresponding to the first-level geographic area identifier from a target data table corresponding to the target data table identifier stored in the target database, and generates a target sequence number value according to the target sequence number adjustment data and an original sequence number value in the target data record.
[0021] The response sending module is configured to receive the target sequence number value returned by the target database server, and send a response message to the front-end device based on the target sequence number value.
[0022] In a fourth aspect, an embodiment of the present application further provides a sequence number generation device configured in a database server, and the device comprises:
[0023] The request receiving module is configured to receive a sequence number generation request carrying a first-level geographic area identifier, a target data table identifier and target sequence number adjustment data sent by an application server.
[0024] The record finding module is configured to find a target data table corresponding to the target data table identifier from a target database, and find a target data record corresponding to the first-level geographic area identifier from the target data table.
[0025] The sequence number generation module is configured to read an original sequence number value in the target data record, and generate a target sequence number value according to the target sequence number adjustment data and the original sequence number value.
[0026] The sequence number sending module is configured to update the original sequence number value in the target data record to the target sequence number value, and send the target sequence number value to the application server.
[0027] In a fifth aspect, an embodiment of the present application further provides an electronic device, which comprises a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements the sequence number generation method according to any one of the embodiments of the present application when executing the program.
[0028] In a sixth aspect, the embodiments of the present application further provide a computer readable storage medium, which has stored thereon a computer program, the program being executed by a processor to implement the sequence number generation method according to any one of the embodiments of the present application.
[0029] In a seventh aspect, the embodiments of the present application further provide a computer program product, which comprises a computer program, the computer program being executed by a processor to implement the sequence number generation method according to any one of the embodiments of the present application.
[0030] In the embodiments of the present application, the data transmission request of the front-end device is received to obtain the first-level geographic area identifier and the target transmission scenario identifier, the target database identifier corresponding to the first-level geographic area identifier is determined according to the preset corresponding relationship between the geographic area identifier and the database identifier, the target data table identifier and the target sequence number adjustment data corresponding to the target transmission scenario identifier are determined according to the preset configuration file, the accuracy of subsequent positioning of the target database and the data table is improved, the sequence number generation request carrying the first-level geographic area identifier, the target data table identifier and the target sequence number adjustment data is sent to the target database server corresponding to the target database identifier, the target database server searches the target data record corresponding to the first-level geographic area identifier from the target data table corresponding to the target data table identifier stored in the target database, and generates the target sequence number value according to the target sequence number adjustment data and the original sequence number value in the target data record, the application server receives the target sequence number value returned by the target database server, and sends the response message to the front-end device based on the target sequence number value, the dynamic adjustment of the sequence number is implemented, the blind search and the repeated conflict are avoided, the database pressure is reduced, the data storage management efficiency, the system performance and the availability are improved, the consistency and the accuracy of the data are ensured, and the sequence number generation flexibility, the scalability and the stability are improved in the data high-concurrency business scenario. BRIEF DESCRIPTION OF DRAWINGS
[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0032] Figure 1 A flowchart of a sequence number generation method provided by the embodiments of the present application;
[0033] Figure 2 A flowchart of another sequence number generation method provided by the embodiments of the present application;
[0034] Figure 3 A flow chart of another sequence number generation method provided for an embodiment of the present application;
[0035] Figure 4 A schematic diagram of sequence number generation applicable to an embodiment of the present application;
[0036] Figure 5 A structural schematic diagram of a sequence number generation device provided for an embodiment of the present application;
[0037] Figure 6 A structural schematic diagram of another sequence number generation device provided for an embodiment of the present application;
[0038] Figure 7 A structural schematic diagram of an electronic device provided for an embodiment of the present application. DETAILED DESCRIPTION
[0039] The present application will be further described below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely intended for the purpose of explanation and are not limiting of the present application. In addition, it should be noted that only the parts related to the present application are shown in the accompanying drawings for the purpose of description, rather than all the structures.
[0040] It should be noted that: similar reference numbers and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. Meanwhile, in the description of the present application, the terms "first", "second", etc. are only used for differentiation, and cannot be understood as indicating or implying relative importance. The acquisition, storage, use, processing, etc. of data in the technical solution of the present application all comply with the relevant provisions of national laws and regulations. It should be noted that in the embodiments of the present application, some industry existing solutions, components, models, etc. may be mentioned, which should be considered as exemplary, and the purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the related content of the solution.
[0041] In the process of a large amount of data interaction, various types of data sequence numbers are the key to ensuring the uniqueness and accuracy of data. With the increasing frequency and diversity of business data interaction, developing a rule-based sequence number generator that can generate non-repeating sequence numbers and can cope with high concurrency requirements is crucial for the output quality and risk control of business services. Specifically, the sequence number generator is a software tool or service for generating unique sequence numbers, and the core role of the sequence number is to identify and distinguish different transmission data, such as identifying and distinguishing different provident fund file data.
[0042] Currently, the related art generally adopts a simple sequence number generator relying on a database, that is, the next sequence number is obtained by connecting a database and querying a database sequencer. However, this method needs to add a sequencer in the database environment when generating a sequence number, and the added sequencer relies on the creation version of the newly created database, which increases the complexity of development and maintenance. On the other hand, using this method requires modifying the application server code, and must be tested with the database before going online, which greatly limits the generality and reuse possibility.
[0043] In terms of performance, the single-point generation mode can easily cause performance bottlenecks in high-concurrency scenarios, and once the single point fails, the entire system will be directly affected. On the other hand, although some sequence number generators can reduce database access frequency through caching, they will consume a large amount of additional memory resources, indirectly causing additional consumption of input and output resources.
[0044] In terms of sequence number generation and function migration, this method cannot dynamically configure the growth value and fixed prefix suffix, reducing the flexibility of sequence number generation. Moreover, since the sequencer relies on the creation version of the newly created database, the generator mechanism differs between different databases, which will consume a lot of manpower during migration compatibility and may cause sequence number loss problems, further increasing the maintenance and management cost.
[0045] Figure 1 A flowchart of a sequence number generation method provided by an embodiment of the present application is shown. The method can be applied to the generation of sequence numbers, and can be executed by a sequence number generation device. The sequence number generation device can be implemented in the form of hardware and / or software, and can generally be configured in an application server. The application server can be understood as a software system running on a server hardware platform, providing a running environment for application programs. It can communicate with clients (such as personal computers and mobile devices) through the Internet or an internal network, and respond to the requests of the clients to execute corresponding application program logic. Figure 1 The method includes the following steps:
[0046] S110, in response to receiving a data transmission request sent by a front-end device, obtaining a first-level geographic area identifier and a target transmission scenario identifier carried in the data transmission request.
[0047] In this embodiment of the invention, a data transmission request can be specifically understood as a request sent by the front-end device to the application server. The request may be for the application server to send data to the front-end device, and may include data that the server needs to process, such as a first-level geographic region identifier and a target transmission scenario identifier. The first-level geographic region identifier can be specifically understood as a code or name used to identify the geographic location of a user or business, such as a country code, province code, or city code. This helps the server determine which geographic region's database the data should be stored in, thereby applying the corresponding geographic region's sequence number generation rules.
[0048] The target transmission scenario identifier can be specifically understood as an identifier used to identify the business scenario or data transmission type to which the request belongs. For example, it can indicate that this is a user registration request, an order submission request, a housing provident fund business processing request, or other types of requests. It helps the server determine how to process the request, such as sending the data to the server or database table corresponding to the target transmission scenario identifier.
[0049] Specifically, in response to receiving a data transmission request from the front-end device (i.e., the client), the system extracts the first-level geographic region identifier and the target transmission scenario identifier carried in the request. The first-level geographic region identifier and the target transmission scenario identifier can be included in the data transmission request as parameters or header information.
[0050] Optionally, based on the above embodiments, the data transmission request also carries a second-level geographic region identifier, which is used by the target database server to find the target data record. The second-level geographic region is the next level of geographic region after the first-level geographic region.
[0051] In this embodiment of the invention, the second-level geographic region identifier can be specifically understood as: in addition to the first-level geographic region identifier, the data transmission request also carries a more detailed geographic region identifier, which is the next level of geographic region below the first-level geographic region. For example, if the first-level geographic region identifier is a country code, then the second-level geographic region identifier can be a province or municipality code; if the first level is a province code, then the second level can be a city or region code.
[0052] Understandably, data records in a database can be organized or indexed based on geographic regions, allowing for quick location of specific data records by combining second-level geographic region identifiers with first-level geographic region identifiers.
[0053] Specifically, the front-end device sends a data transmission request containing the user's location information (divided into a first level (such as country or province) and a second level (such as city or region)). After receiving the request, the application server parses out the first-level and second-level geographic region identifiers, determines the target database server based on the first-level geographic region identifier, and then determines the corresponding target data record based on the second-level geographic region identifier. For example, the first-level geographic region identifier determines the target database server corresponding to a certain province, and the second-level geographic region identifier is used to search for the data record of the city corresponding to the second-level geographic region identifier in the database of that province.
[0054] By including a second-level geographic region identifier in data transmission requests, the system achieves more precise data positioning, improving the efficiency and accuracy of data retrieval. The refined geographic region division optimizes data management and maintenance, supports more complex business logic, and can execute corresponding business rules based on different geographic location levels, meeting diverse business needs. This enhances the system's flexibility and scalability, facilitating adaptation to new business requirements or market changes without requiring large-scale modifications to the entire system architecture. Ultimately, this improves the user experience, enabling users to obtain more localized and customized services, thus increasing user satisfaction.
[0055] Optionally, based on the above embodiments, the first-level geographic region identifier is a provincial-level geographic region identifier, and the second-level geographic region identifier is a municipal-level geographic region identifier.
[0056] In this embodiment of the invention, the first-level geographical region identifier can be specifically understood as a provincial-level geographical region identifier, such as Guangdong. The second-level geographical region identifier can be specifically understood as a municipal-level geographical region identifier, such as Guangzhou.
[0057] By introducing provincial and municipal geographic area identifiers, the system can quickly locate data within specific regions, improving the accuracy and efficiency of data retrieval, optimizing the implementation of regional business strategies, and making it easier to adapt to changes in geographic areas without large-scale reconstruction, thus improving the system's adaptability and flexibility.
[0058] S120. Based on the pre-established correspondence between geographic region identifiers and database identifiers, determine the target database identifier corresponding to the first-level geographic region identifier.
[0059] In this embodiment of the invention, a database identifier can be specifically understood as: a name or code used to uniquely identify a database. In a distributed database system, multiple databases can exist, and each database is used to store data from a specific geographical location or type. A distributed database can be specifically understood as: a database system that stores data across multiple physical nodes. It achieves distributed storage and management of data by dividing the data into several parts and storing each part on different nodes. These nodes communicate and exchange data through network connections, and a management node coordinates data access between the nodes.
[0060] Specifically, the mapping relationship between geographic region identifiers and database identifiers is predefined in the system, such as the mapping relationship between first-level geographic region identifiers and database identifiers. The target database identifier corresponding to the first-level geographic region identifier is determined based on the mapping relationship.
[0061] For example, when a banking system operates in different provinces, and the data for each province is stored in a different database, the system can pre-establish a mapping table to map the code (first-level geographical region identifier) of each province to the corresponding database identifier. When the system receives a transaction request from Guangdong Province, it will look up the database identifier corresponding to Guangdong Province as the target database identifier.
[0062] The distributed database model improves the performance of serial number generation, especially in high-concurrency application scenarios, it can distribute the pressure of serial number generation, prevent downtime or inaccessibility caused by high-frequency access, and prevent the additional consumption of serial number resources due to transaction rollback.
[0063] S130. Determine the target data table identifier and target sequence number adjustment data corresponding to the target transmission scenario identifier according to the pre-set configuration file.
[0064] In this embodiment of the invention, the configuration file can be specifically understood as: a file in the system used to store various parameters and configuration data, used to define the behavior of the system, such as the serial number generation rules, including the target data table identifier corresponding to the target transmission scenario identifier and the target serial number adjustment data.
[0065] The target data table identifier can be understood as an identifier found in the configuration file based on the target transmission scenario identifier, indicating which data table the data is stored in. For example, if the transmission scenario is user registration, the target data table identifier could be "users". If the transmission scenario is housing provident fund processing, the target data table identifier could be "GJJ". The target sequence number adjustment data can be understood as parameters found in the configuration file based on the target transmission scenario identifier, indicating how to adjust the sequence number. For example, the sequence number step size, initial value, and update rules.
[0066] Optionally, based on the above embodiments, determining the target data table identifier and target sequence number adjustment data corresponding to the target transmission scenario identifier according to a pre-set configuration file may include:
[0067] Read a pre-configured XML file from the local machine;
[0068] Based on the first correspondence between the transmission scenario identifier and the sequence number name recorded in the XML file, the target sequence number name corresponding to the target transmission scenario identifier is determined;
[0069] Based on the second correspondence between the serial number name, data table identifier, and serial number adjustment data recorded in the XML file, the target data table identifier and target serial number adjustment data corresponding to the target serial number name are determined.
[0070] In this embodiment of the invention, Extensible Markup Language (XML) can be specifically understood as a data format used for storing and transmitting data, which may include data structures such as elements, attributes, and hierarchical relationships. It is understood that XML files can be configured during system deployment or initialization.
[0071] The first correspondence can be understood as the mapping relationship from the transmission scenario identifier to the serial number name defined in the XML file. For example, if the transmission scenario identifier is "user registration", the corresponding serial number name can be "USER_REG_SEQ"; if the transmission scenario identifier is "housing provident fund processing", the corresponding serial number name can be "GJJ_SEQ".
[0072] The second correspondence can be understood as the mapping relationship defined in the XML file from the target serial number name to the data table identifier and the serial number adjustment data. For example, if the serial number name is "USER_REG_SEQ", the corresponding data table identifier could be the "users" table, and the serial number adjustment data could have a step size of 1.
[0073] Specifically, the system reads a pre-configured XML file from the local machine, searches for the corresponding target sequence number name in the XML file based on the first correspondence relationship according to the received transmission scenario identifier, and then searches for the corresponding target data table identifier and target sequence number in the XML file based on the second correspondence relationship according to the target sequence number name to adjust the data.
[0074] By using pre-configured configuration files to determine the target data table identifier and target sequence number adjustment data corresponding to the target transmission scenario identifier, the system can quickly adapt to changes in business requirements without modifying the code. This enhances the system's flexibility and configurability, simplifies system maintenance and upgrade processes, reduces maintenance costs, and minimizes the risk of errors introduced by code changes. By clearly defining the correspondence between elements, the accuracy of data management is enhanced, the system's scalability is improved, and the difficulty of adding new transmission scenarios or sequence number types is reduced. Since sequence number generation no longer depends on the database version number, no new data definition language scripts are needed. New sequence number types can be configured at any time, reducing repetitive code development, lowering manpower costs, and avoiding the need to develop and test across multiple systems. Using a universal database table configuration method, maintenance and management can be completed in the context of database migration in a new environment simply by updating the configuration file. This reduces maintenance work and data loss issues caused by different database mechanisms, improving maintenance and management efficiency.
[0075] Optionally, based on the above embodiments, in the sequence number generation method proposed in this invention, the database can adopt a master-slave architecture. This architecture may include a master database that handles all write operations and multiple slave databases that handle read operations. The slave databases can take over the service when the master database fails, and can also reduce the load on the master database by distributing read operations to the slave databases, thereby achieving redundant backup and load balancing of data, and improving data availability and reliability. Furthermore, master-slave replication simplifies the data backup and recovery process and improves query performance. Especially in distributed systems, users can read data from the geographically nearest slave database, reducing network latency. Maintenance and upgrade processes are also simplified because they can be performed on the slave databases without interfering with the master database service.
[0076] Optionally, based on the above embodiments, the target transmission scenario identifier may include a provident fund document transmission scenario identifier; and / or, the target sequence number adjustment data may include: adjustment step size and / or adjustment direction.
[0077] In this embodiment of the invention, adjusting the step size can be specifically understood as specifying the amount of change during sequence number generation. For example, if the step size is 1, the sequence number changes by 1 each time; if the step size is 5, the sequence number changes by 5 each time. Adjusting the direction can be specifically understood as specifying the generation direction of the sequence number. For example, it can be specified whether the sequence number is generated incrementally or decrementally.
[0078] Specifically, the target sequence number adjustment data may include: adjustment step size and / or adjustment direction. The target transmission scenario identifier can be the provident fund document transmission scenario identifier (e.g., "provident fund"). Correspondingly, the first-level geographical region identifier can be the first-level branch number, for example, the first-level branch number for Guangdong Province can be 01, and the second-level geographical region identifier can be the institution number, for example, the institution number for the Guangzhou business institution can be 002.
[0079] By incorporating the housing provident fund document transmission scenario identifier into the target transmission scenario identifier, and allowing the target sequence number adjustment data to include the adjustment step size and adjustment direction, the system achieves accurate identification and processing of housing provident fund related document transmission requests, improves the flexibility of housing provident fund business sequence number generation and management, and particularly enhances the stability of housing provident fund business sequence number generation under high concurrency conditions.
[0080] S140. Send a serial number generation request carrying the first-level geographic region identifier, the target data table identifier, and the target serial number adjustment data to the target database server corresponding to the target database identifier, so that the target database server can find the target data record corresponding to the first-level geographic region identifier from the target data table stored in the target database corresponding to the target data table identifier, and generate a target serial number value according to the target serial number adjustment data and the original serial number value in the target data record.
[0081] In this embodiment of the invention, the original sequence number value can be specifically understood as: the sequence number value generated in the target data record last time.
[0082] Specifically, the application server sends a sequence number generation request to the target database server corresponding to the target database identifier. This sequence number generation request carries the first-level geographic region identifier, the target data table identifier, and target sequence number adjustment data.
[0083] The target database server, corresponding to the target database identifier, processes the request. It searches the target database for the table corresponding to the target data table identifier. Within this table, the server further searches for data records matching the first-level geographic region identifier, reads the original sequence number value, and adjusts the data (such as step size and direction) based on the target sequence number. This generates a new target sequence number value; for example, if the original sequence number is 002, the step size is 1, and the direction is incrementing, the target sequence number value will be 003. The generated target sequence number value is then returned to the application server.
[0084] Optionally, based on the above embodiments, the second correspondence is the correspondence between the serial number name and the data table identifier, the serial number adjustment data, and the serial number value range;
[0085] Accordingly, based on the above embodiments, sending a sequence number generation request carrying the first-level geographical region identifier, the target data table identifier, and the target sequence number adjustment data to the target database server corresponding to the target database identifier may include:
[0086] The range of target serial number values corresponding to the target serial number name is determined based on the second correspondence relationship;
[0087] Send a serial number generation request carrying the first-level geographical region identifier, the target data table identifier, the target serial number adjustment data, and the target serial number value range to the target database server corresponding to the target database identifier, so that the target database server generates a target serial number value according to the target serial number value range.
[0088] In this embodiment of the invention, the target sequence number range can be specifically understood as: a condition used to restrict the target sequence number value, which can be a minimum value, a maximum value or other restrictive conditions for the sequence number.
[0089] Specifically, the second correspondence is the correspondence between the serial number name and the data table identifier, the serial number adjustment data, and the serial number value range. Accordingly, when sending the serial number generation request, in addition to carrying the first-level geographic region identifier, the target data table identifier, and the target serial number adjustment data, it also includes the target serial number value range corresponding to the serial number name, determined according to the second correspondence.
[0090] When generating a serial number, the target database server needs to consider not only the adjustment data of the serial number, but also the range of values for the serial number, to ensure that the generated serial number conforms to the business rules and is within the preset range.
[0091] By introducing a range of serial number values into the serial number generation request, more precise and efficient serial number management is achieved. This ensures that serial numbers increment or decrement within a preset range, thereby avoiding duplication or conflicts and enhancing data consistency and integrity. The introduction of a serial number value range improves the system's scalability and flexibility, allowing it to more easily adapt to new business needs and dynamically adjust serial number rules without requiring large-scale modifications to existing logic.
[0092] S150: Receive the target serial number value returned by the target database server, and send a response message to the front-end device based on the target serial number value.
[0093] Specifically, after receiving the target sequence number value returned by the target database server, the application server constructs a response message based on the target sequence number value. The response message may include the target sequence number value, operation status, timestamp, and other relevant information. This response message is then sent back to the front-end device. Upon receiving the response message, the front-end device can process it accordingly based on the target sequence number value and other information. For example, if the target sequence number value is used for housing provident fund transactions, the front-end device can concatenate the target sequence number value with the housing provident fund file data to be transmitted and transmit the data containing the concatenated target sequence number value to the destination, thus using the target sequence number value as an identification marker for the housing provident fund file data.
[0094] Optionally, based on the above embodiments, the second correspondence is the correspondence between the serial number name and the data table identifier, the serial number adjustment data, and the prefix and suffix;
[0095] Accordingly, based on the above embodiments, sending a response message to the front-end device based on the target serial number value may include:
[0096] Based on the second correspondence, determine the prefix and / or suffix corresponding to the target serial number name, and concatenate the determined prefix and / or suffix with the target serial number value;
[0097] A response message is generated based on the target serial number value concatenated with the prefix and / or suffix, and the response message is sent to the front-end device.
[0098] In this embodiment of the invention, the prefix and suffix can be statically defined strings or dynamically generated according to certain rules, such as using the abbreviation of the target serial number name dynamically generated according to the target serial number name as the prefix or suffix.
[0099] Specifically, the second correspondence is the correspondence between the serial number name and the data table identifier, the serial number adjustment data, and the prefix and suffix. Accordingly, the application server can determine the prefix and suffix corresponding to the target serial number name based on the second correspondence. After determining the prefix and suffix, they can be concatenated with the target serial number value generated from the database server to generate a complete serial number. Based on the concatenated complete serial number, the application server generates a response message and sends it to the front-end device. For example, when the prefix is GJJQ, the suffix is GJJH, and the target serial number value is 002, it can be concatenated into GJJQ002GJJH according to preset rules.
[0100] By associating serial number names with data table identifiers, serial number adjustment data, and prefixes and suffixes, the readability and recognizability of serial numbers are improved. Flexible prefix and suffix configuration enhances data organization, adaptability to complex business rules, and scalability of serial number generation rules. Serial numbers with prefixes and suffixes can provide more contextual information, improving the user experience.
[0101] In this embodiment of the invention, by receiving a data transmission request from a front-end device, the first-level geographic region identifier and the target transmission scenario identifier are obtained. Based on a preset correspondence between geographic region identifiers and database identifiers, the target database identifier corresponding to the first-level geographic region identifier is determined. According to a preset configuration file, the target data table identifier and target sequence number adjustment data corresponding to the target transmission scenario identifier are determined, improving the accuracy of subsequent target database and data table location. A sequence number generation request carrying the first-level geographic region identifier, the target data table identifier, and the target sequence number adjustment data is sent to the target database server corresponding to the target database identifier, enabling the target database server to retrieve the data from the target database. The target data table identifies the target data table, searches for the target data record corresponding to the first-level geographic region identifier, and generates a target sequence number value by adjusting the original sequence number value in the data and target data record based on the target sequence number. The application server receives the target sequence number value returned by the target database server and sends a response message to the front-end device based on the target sequence number value, realizing dynamic adjustment of the sequence number. This avoids blind searching and duplicate conflicts, reduces database pressure, improves data storage management efficiency, system performance and availability, ensures data consistency and accuracy, and adapts to various business scenarios, especially improving the flexibility, scalability and stability of sequence number generation in high-concurrency data business scenarios.
[0102] Figure 2The flowchart illustrates another serial number generation method provided by an embodiment of the present invention. This method is applicable to the generation of serial numbers and can be executed by a serial number generation device. This device can be implemented in hardware and / or software and is generally configured within a database server. Specifically, a database server can be understood as a computer system used for storing, managing, and providing data access services. Figure 2 As shown, the method includes:
[0103] S210, Receive a sequence number generation request sent by the application server, which carries the first-level geographic region identifier, target data table identifier, and target sequence number adjustment data.
[0104] The serial number generation request is sent by the application server after receiving the data transmission request sent by the front-end device. The application server determines the target database identifier based on the first-level geographical region identifier carried in the data transmission request, and determines the target data table identifier and target serial number based on the target transmission scenario identifier carried in the data transmission request.
[0105] Specifically, the application server receives a data transmission request from the front-end device and extracts the first-level geographic region identifier and the target transmission scenario identifier from the request. Based on the extracted first-level geographic region identifier, it determines the target database identifier; based on the target transmission scenario identifier, it determines the target data table identifier and target sequence number adjustment data; and it sends a sequence number generation request containing the above information to the target database server corresponding to the target database identifier.
[0106] The database server receives a sequence number generation request from the application server, which carries the first-level geographic region identifier, the target data table identifier, and the target sequence number adjustment data.
[0107] S220. Search for the target data table corresponding to the target data table identifier in the target database, and search for the target data record corresponding to the first-level geographical region identifier in the target data table.
[0108] Specifically, the database server locates the corresponding data table in the target database based on the target data table identifier. Then, it searches for the corresponding target data record in that data table based on the first-level geographic region identifier, for example, through a database query operation statement. It should be noted that the data record in the data table may include fields such as serial number name, serial number value, database name, data table name, first-level geographic region identifier, and second-level geographic region identifier.
[0109] Optionally, based on the above embodiments, the data transmission request further carries a second-level geographic region identifier, where the second-level geographic region is the next level down from the first-level geographic region; correspondingly, based on the above embodiments, searching for the target data record corresponding to the first-level geographic region identifier in the target data table may include:
[0110] Search the target data table for the target data record corresponding to the first-level geographic region identifier and the second-level geographic region identifier.
[0111] Specifically, the data transmission request also carries a second-level geographic region identifier, which is the next level down from the first-level geographic region. Correspondingly, after determining the target data table, the system can combine the first-level and second-level geographic region identifiers to locate the target data record.
[0112] By further refining geographic location information based on the first-level geographic region identifier and adding a second-level geographic region identifier to data transmission requests, the accuracy and efficiency of data positioning are improved, data management flexibility is enhanced, and data operations can be performed based on more specific geographic location information, supporting more complex business logic. For users, more accurate geographic location information can lead to a better personalized service experience, optimized resource allocation, and improved operational efficiency and customer satisfaction. The system can more easily adapt to changes in business development and geographic location division, improving adaptability and scalability.
[0113] Optionally, based on the above embodiments, the first-level geographic region identifier is a provincial-level geographic region identifier, and the second-level geographic region identifier is a municipal-level geographic region identifier.
[0114] By introducing provincial and municipal geographic area identifiers, the system can quickly locate data within specific regions, improving the accuracy and efficiency of data retrieval, optimizing the implementation of regional business strategies, and making it easier to adapt to changes in geographic areas without large-scale reconstruction, thus improving the system's adaptability and flexibility.
[0115] S230. Read the original serial number value in the target data record, and generate the target serial number value by adjusting the data and the original serial number value according to the target serial number.
[0116] Specifically, from the retrieved target data record, the field storing the sequence number is read to obtain the current original sequence number value. Based on the target sequence number adjustment data, the sequence number adjustment rule (e.g., step size of 1, direction of increment) is determined, and the original sequence number value is adjusted and calculated to generate a new target sequence number value. For example, if the current sequence number is 100, the step size is 1, and the direction is incrementing, then the new sequence number will be 101.
[0117] S240. Update the original serial number value in the target data record to the target serial number value, and send the target serial number value to the application server.
[0118] Specifically, the calculated target sequence number value is written back to the target data record, replacing the original sequence number value, and then the target sequence number value is sent to the application server.
[0119] Understandably, when no target data table corresponding to the target data table identifier is found in the target database, it indicates that this is the first request. A new target data table corresponding to the target data table identifier needs to be created, and an initial data record is generated and stored in the target data table. This initial data record contains a target sequence number value (taking the initial value), and may also include the target sequence number name, target database name, target data table name, first-level geographic region identifier, and second-level geographic region identifier. Then, the target sequence number value is sent to the application server. Conversely, when no target data record corresponding to the first-level geographic region identifier is found in the target data table, or when no target data record corresponding to both the first-level and second-level geographic region identifiers is found, a new target data record needs to be created in the target data table and stored there. This target data record contains a target sequence number value (taking the initial value), and may also include the target sequence number name, target database name, target data table name, first-level geographic region identifier, and second-level geographic region identifier. Then, the target sequence number value is sent to the application server.
[0120] In this embodiment of the invention, a serial number generation request carrying a first-level geographic region identifier, a target data table identifier, and target serial number adjustment data is received from an application server. The system then searches the target database for the target data table corresponding to the target data table identifier, and searches the target data table for the target data record corresponding to the first-level geographic region identifier. This avoids blind searching and duplicate conflicts, reduces database pressure, and improves data storage management efficiency, system performance, and availability. The system reads the original serial number value from the target data record, generates a target serial number value based on the target serial number adjustment data and the original serial number value, updates the original serial number value in the target data record to the target serial number value, and sends the target serial number value to the application server. This achieves dynamic adjustment of the serial number, ensuring data consistency and accuracy, and adapting to various business scenarios. In particular, it improves the flexibility, scalability, and stability of serial number generation in high-concurrency data scenarios.
[0121] Figure 3 This is a flowchart of another serial number generation method provided by an embodiment of the present invention. This embodiment is a refinement of the above embodiment of "generating a target serial number value based on the target serial number adjustment data and the original serial number value". Specifically, it may include: adjusting the original serial number value according to the target serial number adjustment data to obtain an adjusted intermediate serial number value; reading the target serial number name in the target data record, and concatenating the target serial number name, the first-level geographical region identifier and the intermediate serial number value to obtain the target serial number value.
[0122] Correspondingly, such as Figure 3 As shown, the method includes:
[0123] S310, Receive a sequence number generation request sent by the application server, which carries the first-level geographic region identifier, target data table identifier, and target sequence number adjustment data.
[0124] The serial number generation request is sent by the application server after receiving the data transmission request sent by the front-end device. The application server determines the target database identifier based on the first-level geographical region identifier carried in the data transmission request, and determines the target data table identifier and target serial number based on the target transmission scenario identifier carried in the data transmission request.
[0125] Optionally, based on the above embodiments, the target transmission scenario identifier may include a provident fund document transmission scenario identifier; and / or, the target sequence number adjustment data may include: adjustment step size and / or adjustment direction.
[0126] By incorporating the housing provident fund document transmission scenario identifier into the target transmission scenario identifier, and allowing the target sequence number adjustment data to include the adjustment step size and adjustment direction, the system achieves accurate identification and processing of housing provident fund related document transmission requests, improves the flexibility of housing provident fund business sequence number generation and management, and particularly enhances the stability of housing provident fund business sequence number generation under high concurrency conditions.
[0127] S320. Search the target data table corresponding to the target data table identifier in the target database, and search the target data record corresponding to the first-level geographical region identifier in the target data table.
[0128] S330. Read the original serial number value in the target data record, adjust the original serial number value according to the target serial number adjustment data, and obtain the adjusted intermediate serial number value.
[0129] In this embodiment of the invention, the intermediate serial number value can be specifically understood as: the serial number value obtained after the original serial number value is adjusted and calculated based on the target serial number adjustment data. This value is an intermediate result and not the final serial number value.
[0130] S340. Read the target sequence number name in the target data record, and concatenate the target sequence number name, the first-level geographical region identifier, and the intermediate sequence number value to obtain the target sequence number value.
[0131] Specifically, the target serial number name, the first-level geographic region identifier, and the intermediate serial number value are concatenated using a string concatenation operation according to a preset format to form a complete serial number value, which serves as the target serial number value. For example, the concatenation order can be "target serial number name - first-level geographic region identifier - intermediate serial number value". When the target serial number name is GJJ (representing housing provident fund business), the first-level geographic region identifier is 01 (representing Guangdong), and the intermediate serial number value is 011 (representing the 11th business number), then the target serial number value is GJJ-01-011, enabling flexible configuration of the serial number value and increasing its diversity.
[0132] S350. Update the original serial number value in the target data record to the target serial number value, and send the target serial number value to the application server.
[0133] In a specific example, taking the generation of bank housing provident fund business serial numbers as an example, Figure 4 This is a schematic diagram illustrating a serial number generation method applicable to an embodiment of the present invention, such as... Figure 4As shown in the diagram, there are three application servers: application server 1, application server 2, and application server 3. These application servers are connected to different database servers, namely the Guangdong database, the Beijing database, and the Shanghai database, indicating that different application servers can access different databases. The specific access selection is determined based on the first-level geographical region identifier.
[0134] Each database contains at least one list, and different lists can be distinguished by different data table identifiers. For example, the data table identifier for the data table that records the housing provident fund serial number information can be gjj.
[0135] The list shows the different data records stored in the database, each including a city and its corresponding original serial number value. For example, the Guangdong database contains Guangzhou (001), Shenzhen (006), Dongguan (005), and Huizhou (006); the Beijing database contains Dongcheng (002), Xicheng (010), Chaoyang (015), and Fengtai (006); and the Shanghai database contains Huangpu (002), Xuhui (016), Changning (030), and Jing'an (005). These original serial number values are identifiers used to identify and distinguish housing provident fund transactions in different cities.
[0136] The application server responds to the data transmission request sent by the front-end device by obtaining the first-level geographic region identifier, i.e., the first-level branch identifier (e.g., Guangdong), the second-level geographic region identifier, i.e., the institution identifier (e.g., Guangzhou), and the target transmission scenario identifier (e.g., housing provident fund) carried in the data transmission request. Assume that the correspondence between geographic region identifiers and database identifiers is 01 for Beijing, 02 for Shanghai, and 03 for Guangdong. Based on the pre-established correspondence between geographic region identifiers and database identifiers, the target database identifier (03) corresponding to the first-level geographic region identifier is determined. Based on the pre-set configuration file, the target data table identifier (e.g., gjj) and target sequence number adjustment data (e.g., step size of 1, direction of increment) corresponding to the target transmission scenario identifier (housing provident fund) are determined. A sequence number generation request carrying the first-level geographic region identifier (Guangdong), the second-level geographic region identifier (Guangzhou), the target data table identifier (gjj), and the target sequence number adjustment data (step size of 1, direction of increment) is sent to the target database server (Guangdong database) corresponding to the target database identifier (03).
[0137] The database server receives a sequence number generation request from the application server, carrying a first-level geographic region identifier (Guangdong), a second-level geographic region identifier (Guangzhou), a target data table identifier (gjj), and target sequence number adjustment data (step size 1, direction incrementing). It searches the target database (Guangdong database) for the target data table (housing provident fund business table) corresponding to the target data table identifier (gjj), and then searches the target data table (housing provident fund business table) for the target data record (e.g., Guangzhou: 001) corresponding to the first-level geographic region identifier (Guangdong) and the second-level geographic region identifier (Guangzhou). It reads the original sequence number value (001) from the target data record (Guangzhou: 001), and generates a target sequence number value (002) based on the target sequence number adjustment data (step size 1, direction incrementing) and the original sequence number value (001). It updates the original sequence number value (001) in the target data record to the target sequence number value (002), at which point the corresponding data record is "Guangzhou: 002", and sends the target sequence number value (002) to the application server.
[0138] The application server receives the target serial number value returned by the target database server and sends a response message to the front-end device based on the target serial number value.
[0139] Optionally, after receiving the target sequence number value returned by the target database server, the application server can determine the prefix and suffix according to the correspondence and concatenate them. For example, if the prefix is GJJ, which identifies the business attribute, and the first-level branch identifier, then the final concatenated target sequence number value is GJJ01002.
[0140] Optionally, based on the above embodiments, the serial number generation request also carries the target serial number value range;
[0141] Accordingly, based on the above embodiments, sending the target sequence number value to the application server may include:
[0142] Determine whether the target serial number value exceeds the range of serial number values. If so, restrict the target serial number value to the range of target serial number values, or regenerate the target serial number value within the range of target serial number values.
[0143] The target serial number value, which is limited to the range of values of the target serial number, or the regenerated target serial number value, is sent to the application server.
[0144] Specifically, the serial number generation request also carries the target serial number value range. Correspondingly, after the database server generates a new target serial number value based on the information in the request, it checks whether the generated target serial number value is within the specified range. If the target serial number value exceeds this range, the system can restrict the target serial number value to that range. For example, if the range is limited to 3 digits or less, when the target serial number is 4 digits, the first 3 digits can be truncated as the target serial number value. Alternatively, a new serial number value within the range can be generated, for example, by changing the target serial number value back to its initial value, to cyclically generate the serial number value to be used within the specified range.
[0145] Whether it's the restricted serial number value or the regenerated serial number value, the database server will send it to the application server.
[0146] By adding a target sequence number value range to the sequence number generation request and performing a range check on the generated sequence number values before sending them to the application server, the system ensures that the sequence numbers conform to specific formats or business rules. This avoids the use of invalid or erroneous sequence numbers, reduces the risk of sequence number conflicts in multi-threaded or distributed systems, enhances data consistency, and improves the effectiveness and reliability of sequence number management. Furthermore, the system better adapts to changes in sequence number rules as the business evolves, improving business scalability.
[0147] Furthermore, based on the above embodiments, the serial number generation method may further include:
[0148] After finding the target data record from the target data table, the target data record is locked using a database row lock to prevent other transactions from accessing the target data record simultaneously.
[0149] After updating the original serial number value in the target data record to the target serial number value, the lock on the target data record is released.
[0150] In this embodiment of the invention, a database row lock can be specifically understood as a function used to lock specific data records during transaction processing to prevent other transactions from accessing or modifying these records simultaneously.
[0151] Specifically, after locating the target data record in the target data table, it indicates that the record is about to be modified. Therefore, a database row lock is used to lock the target data record to prevent other transactions from accessing it simultaneously and to avoid data inconsistency. Once the target data record is locked, the current transaction can safely update the sequence number value in that record. After the sequence number value is updated, the transaction releases the lock on the target data record. Unlocking allows other transactions to access and modify this record, thereby improving the database's concurrency performance.
[0152] By locking and unlocking target data records using database row locks, other transactions are prevented from modifying the same record simultaneously, thus ensuring data consistency, avoiding data conflicts, and improving transaction isolation. This ensures that transactions are not interfered with by other transactions during execution. Since only the data rows that need to be accessed are locked, rather than the entire data table, more transactions can be executed simultaneously without blocking each other, enhancing the system's concurrency control capabilities.
[0153] Understandably, after locating the target data record in the target data table, gap locking can be used to lock the gaps before and after the target data record. Before the current transaction completes, other transactions cannot insert new data records into this gap, preventing phantom reads and ensuring data consistency during transaction execution. After the sequence number value is updated, the lock on the gap containing the target data record is released, allowing other transactions to insert new data records into this gap.
[0154] In this embodiment of the invention, a serial number generation request carrying a first-level geographic region identifier, a target data table identifier, and target serial number adjustment data is received from an application server; the target data table corresponding to the target data table identifier is searched in the target database, and the target data record corresponding to the first-level geographic region identifier is searched in the target data table. This avoids blind searching and duplicate conflicts, reduces database pressure, and improves data storage management efficiency, system performance, and availability; the original serial number value in the target data record is read, and the original serial number value is adjusted according to the target serial number adjustment data to obtain an adjusted intermediate serial number value; the target serial number name in the target data record is read, and the target... The target sequence number value is obtained by concatenating the sequence number name, the first-level geographic region identifier, and the intermediate sequence number value. This concatenation method ensures that each sequence number contains both geographic location and sequence name information, enhancing the readability and recognizability of the sequence number. The concatenation strategy allows for customized adjustments to the sequence number according to different business needs, increasing the flexibility of sequence number generation. The original sequence number value in the target data record is updated to the target sequence number value, and the target sequence number value is sent to the application server, enabling dynamic adjustment of the sequence number. This ensures data consistency and accuracy, while adapting to various business scenarios, especially improving the flexibility, scalability, and stability of sequence number generation in high-concurrency data scenarios.
[0155] Figure 5 This is a schematic diagram of a serial number generation device provided in an embodiment of the present invention, as shown below. Figure 5 As shown, the device includes: an application response module 510, an identifier determination module 520, a configuration determination module 530, a request sending module 540, and a response sending module 550, wherein:
[0156] The application response module 510 is used to respond to receiving a data transmission request sent by the front-end device and obtain the first-level geographical area identifier and the target transmission scene identifier carried in the data transmission request.
[0157] The identifier determination module 520 is used to determine the target database identifier corresponding to the first-level geographic region identifier based on the pre-established correspondence between geographic region identifiers and database identifiers.
[0158] The configuration determination module 530 is used to determine the target data table identifier and target sequence number adjustment data corresponding to the target transmission scenario identifier according to a pre-set configuration file.
[0159] The request sending module 540 is used to send a serial number generation request carrying the first-level geographic region identifier, the target data table identifier, and the target serial number adjustment data to the target database server corresponding to the target database identifier, so that the target database server can find the target data record corresponding to the first-level geographic region identifier from the target data table stored in the target database corresponding to the target data table identifier, and generate a target serial number value according to the target serial number adjustment data and the original serial number value in the target data record;
[0160] The response sending module 550 is used to receive the target sequence number value returned by the target database server, and send a response message to the front-end device based on the target sequence number value.
[0161] In this embodiment of the invention, by receiving a data transmission request from a front-end device, the first-level geographic region identifier and the target transmission scenario identifier are obtained. Based on a preset correspondence between geographic region identifiers and database identifiers, the target database identifier corresponding to the first-level geographic region identifier is determined. According to a preset configuration file, the target data table identifier and target sequence number adjustment data corresponding to the target transmission scenario identifier are determined, improving the accuracy of subsequent target database and data table location. A sequence number generation request carrying the first-level geographic region identifier, the target data table identifier, and the target sequence number adjustment data is sent to the target database server corresponding to the target database identifier, enabling the target database server to retrieve the data from the target database. The target data table identifies the target data table, searches for the target data record corresponding to the first-level geographic region identifier, and generates a target sequence number value by adjusting the original sequence number value in the data and target data record based on the target sequence number. The application server receives the target sequence number value returned by the target database server and sends a response message to the front-end device based on the target sequence number value, realizing dynamic adjustment of the sequence number. This avoids blind searching and duplicate conflicts, reduces database pressure, improves data storage management efficiency, system performance and availability, ensures data consistency and accuracy, and adapts to various business scenarios, especially improving the flexibility, scalability and stability of sequence number generation in high-concurrency data business scenarios.
[0162] Based on the above embodiments, the data transmission request also carries a second-level geographic region identifier, which is used by the target database server to find the target data record. The second-level geographic region is the next level of geographic region after the first-level geographic region.
[0163] Based on the above embodiments, the first-level geographic region identifier is the provincial-level geographic region identifier, and the second-level geographic region identifier is the municipal-level geographic region identifier.
[0164] Based on the above embodiments, the configuration determination module 530 is specifically used for:
[0165] Read a pre-configured XML file from the local machine;
[0166] Based on the first correspondence between the transmission scenario identifier and the sequence number name recorded in the XML file, the target sequence number name corresponding to the target transmission scenario identifier is determined;
[0167] Based on the second correspondence between the serial number name, data table identifier, and serial number adjustment data recorded in the XML file, the target data table identifier and target serial number adjustment data corresponding to the target serial number name are determined.
[0168] Based on the above embodiments, the second correspondence is the correspondence between the serial number name and the data table identifier, the serial number adjustment data, and the prefixes and suffixes;
[0169] Accordingly, based on the above embodiments, the response sending module 550 is specifically used for:
[0170] Based on the second correspondence, determine the prefix and / or suffix corresponding to the target serial number name, and concatenate the determined prefix and / or suffix with the target serial number value;
[0171] A response message is generated based on the target serial number value concatenated with the prefix and / or suffix, and the response message is sent to the front-end device.
[0172] Based on the above embodiments, the second correspondence is the correspondence between the serial number name and the data table identifier, the serial number adjustment data, and the serial number value range;
[0173] Accordingly, based on the above embodiments, the request sending module 540 is specifically used for:
[0174] The range of target serial number values corresponding to the target serial number name is determined based on the second correspondence relationship;
[0175] Send a serial number generation request carrying the first-level geographical region identifier, the target data table identifier, the target serial number adjustment data, and the target serial number value range to the target database server corresponding to the target database identifier, so that the target database server generates a target serial number value according to the target serial number value range.
[0176] Based on the above embodiments, the target transmission scenario identifier may include a provident fund document transmission scenario identifier; and / or, the target sequence number adjustment data may include: adjustment step size and / or adjustment direction.
[0177] The serial number generation device provided in the embodiments of the present invention can execute the serial number generation method for application servers provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0178] Figure 6 This is a schematic diagram of another serial number generation device provided in an embodiment of the present invention, as shown below. Figure 6 As shown, the device includes: a request receiving module 610, a record lookup module 620, a serial number generation module 630, and a serial number sending module 640, wherein:
[0179] The request receiving module 610 is used to receive a serial number generation request sent by the application server, which carries a first-level geographic region identifier, a target data table identifier, and target serial number adjustment data. The serial number generation request is sent by the application server after receiving a data transmission request from the front-end device, based on the first-level geographic region identifier carried in the data transmission request, determining the target database identifier, and based on the target transmission scenario identifier carried in the data transmission request, determining the target data table identifier and the target serial number adjustment data.
[0180] The record lookup module 620 is used to look up the target data table corresponding to the target data table identifier in the target database, and to look up the target data record corresponding to the first-level geographical region identifier in the target data table;
[0181] The serial number generation module 630 is used to read the original serial number value in the target data record, and generate a target serial number value by adjusting the data and the original serial number value according to the target serial number;
[0182] The serial number sending module 640 is used to update the original serial number value in the target data record to the target serial number value, and send the target serial number value to the application server.
[0183] In this embodiment of the invention, a serial number generation request carrying a first-level geographic region identifier, a target data table identifier, and target serial number adjustment data is received from an application server. The system then searches the target database for the target data table corresponding to the target data table identifier, and searches the target data table for the target data record corresponding to the first-level geographic region identifier. This avoids blind searching and duplicate conflicts, reduces database pressure, and improves data storage management efficiency, system performance, and availability. The system reads the original serial number value from the target data record, generates a target serial number value based on the target serial number adjustment data and the original serial number value, updates the original serial number value in the target data record to the target serial number value, and sends the target serial number value to the application server. This achieves dynamic adjustment of the serial number, ensuring data consistency and accuracy, and adapting to various business scenarios, especially improving the stability of serial number generation in high-concurrency data scenarios.
[0184] Based on the above embodiments, the data transmission request also carries a second-level geographic region identifier, which is the next level of geographic region after the first-level geographic region.
[0185] Accordingly, based on the above embodiments, the record lookup module 620 is specifically used for:
[0186] Search the target data table for the target data record corresponding to the first-level geographic region identifier and the second-level geographic region identifier.
[0187] Based on the above embodiments, the first-level geographic region identifier is the provincial-level geographic region identifier, and the second-level geographic region identifier is the municipal-level geographic region identifier.
[0188] Based on the above embodiments, the serial number generation module 630 is specifically used for:
[0189] The original serial number value is adjusted according to the target serial number adjustment data to obtain the adjusted intermediate serial number value;
[0190] Read the target sequence number name from the target data record, and concatenate the target sequence number name, the first-level geographical region identifier, and the intermediate sequence number value to obtain the target sequence number value.
[0191] Based on the above embodiments, the serial number generation request also carries the target serial number value range;
[0192] Accordingly, based on the above embodiments, the serial number sending module 640 is specifically used for:
[0193] Determine whether the target serial number value exceeds the range of serial number values. If so, restrict the target serial number value to the range of target serial number values, or regenerate the target serial number value within the range of target serial number values.
[0194] The target serial number value, which is limited to the range of values of the target serial number, or the regenerated target serial number value, is sent to the application server.
[0195] Furthermore, based on the above embodiments, the serial number generation device may further include: a locking module and an unlocking module, wherein:
[0196] The locking module is used to lock the target data record by means of database row lock after the target data record is found from the target data table, so as to prevent other transactions from accessing the target data record at the same time.
[0197] The unlocking module is used to unlock the target data record after updating the original serial number value in the target data record to the target serial number value.
[0198] Based on the above embodiments, the target transmission scenario identifier may include a provident fund document transmission scenario identifier; and / or, the target sequence number adjustment data may include: adjustment step size and / or adjustment direction.
[0199] The serial number generation device provided in the embodiments of the present invention can execute the serial number generation method for database servers provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0200] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0201] Figure 7 A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0202] like Figure 7As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0203] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0204] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the serial number generation method applied to an application server, i.e.:
[0205] In response to receiving a data transmission request sent by a front-end device, the first-level geographical region identifier and the target transmission scenario identifier carried in the data transmission request are obtained;
[0206] Based on the pre-established correspondence between geographic region identifiers and database identifiers, the target database identifier corresponding to the first-level geographic region identifier is determined.
[0207] The target data table identifier and target sequence number adjustment data corresponding to the target transmission scenario identifier are determined according to the pre-set configuration file;
[0208] Send a serial number generation request carrying the first-level geographic region identifier, the target data table identifier, and the target serial number adjustment data to the target database server corresponding to the target database identifier, so that the target database server can find the target data record corresponding to the first-level geographic region identifier from the target data table stored in the target database corresponding to the target data table identifier, and generate a target serial number value based on the target serial number adjustment data and the original serial number value in the target data record;
[0209] The system receives the target serial number value returned by the target database server and sends a response message to the front-end device based on the target serial number value.
[0210] Alternatively, for example, the serial number generation method applied to database servers, namely:
[0211] The system receives a sequence number generation request from an application server, which carries a first-level geographic region identifier, a target data table identifier, and target sequence number adjustment data. The sequence number generation request is sent by the application server after receiving a data transmission request from a front-end device, based on the first-level geographic region identifier carried in the data transmission request, determining the target database identifier, and based on the target transmission scenario identifier carried in the data transmission request, determining the target data table identifier and the target sequence number adjustment data.
[0212] Search the target database for the target data table corresponding to the target data table identifier, and search the target data table for the target data record corresponding to the first-level geographical region identifier;
[0213] Read the original serial number value from the target data record, and generate the target serial number value by adjusting the data and the original serial number value according to the target serial number;
[0214] The original serial number value in the target data record is updated to the target serial number value, and the target serial number value is sent to the application server.
[0215] In some embodiments, the serial number generation method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the serial number generation method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the serial number generation method by any other suitable means (e.g., by means of firmware).
[0216] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0217] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0218] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0219] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0220] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0221] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0222] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the serial number generation method provided in any embodiment of this application.
[0223] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0224] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A serial number generation method, characterized in that, Applied to an application server, the method includes: In response to receiving a data transmission request sent by a front-end device, the first-level geographical region identifier and the target transmission scenario identifier carried in the data transmission request are obtained; Based on the pre-established correspondence between geographic region identifiers and database identifiers, the target database identifier corresponding to the first-level geographic region identifier is determined. The target data table identifier and target sequence number adjustment data corresponding to the target transmission scenario identifier are determined according to the pre-set configuration file; Send a serial number generation request carrying the first-level geographic region identifier, the target data table identifier, and the target serial number adjustment data to the target database server corresponding to the target database identifier, so that the target database server can find the target data record corresponding to the first-level geographic region identifier from the target data table stored in the target database corresponding to the target data table identifier, and generate a target serial number value based on the target serial number adjustment data and the original serial number value in the target data record; The system receives the target serial number value returned by the target database server and sends a response message to the front-end device based on the target serial number value.
2. The method according to claim 1, characterized in that, The data transmission request also carries a second-level geographic region identifier, which is used by the target database server to locate the target data record. The second-level geographic region is the next level down from the first-level geographic region.
3. The method according to claim 2, characterized in that, The first-level geographic region identifier is the provincial-level geographic region identifier, and the second-level geographic region identifier is the municipal-level geographic region identifier.
4. The method according to claim 1, characterized in that, The step of determining the target data table identifier and target sequence number adjustment data corresponding to the target transmission scenario identifier according to the pre-set configuration file includes: Read a pre-configured Extensible Markup Language (XML) file from the local machine; Based on the first correspondence between the transmission scenario identifier and the sequence number name recorded in the XML file, the target sequence number name corresponding to the target transmission scenario identifier is determined; Based on the second correspondence between the serial number name, data table identifier, and serial number adjustment data recorded in the XML file, the target data table identifier and target serial number adjustment data corresponding to the target serial number name are determined.
5. The method according to claim 4, characterized in that, The second correspondence is the correspondence between serial number name and data table identifier, serial number adjustment data, and prefixes and suffixes; Sending a response message to the front-end device based on the target serial number value includes: Based on the second correspondence, determine the prefix and / or suffix corresponding to the target serial number name, and concatenate the determined prefix and / or suffix with the target serial number value; A response message is generated based on the target serial number value concatenated with the prefix and / or suffix, and the response message is sent to the front-end device.
6. The method according to claim 4, characterized in that, The second correspondence is the correspondence between the serial number name and the data table identifier, the serial number adjustment data, and the serial number value range; the step of sending a serial number generation request carrying the first-level geographical region identifier, the target data table identifier, and the target serial number adjustment data to the target database server corresponding to the target database identifier includes: The range of target serial number values corresponding to the target serial number name is determined based on the second correspondence relationship; Send a serial number generation request carrying the first-level geographical region identifier, the target data table identifier, the target serial number adjustment data, and the target serial number value range to the target database server corresponding to the target database identifier, so that the target database server generates a target serial number value according to the target serial number value range.
7. The method according to any one of claims 1-6, characterized in that, The target transmission scenario identifier includes a provident fund document transmission scenario identifier; and / or, The target sequence number adjustment data includes: adjusting the step size and / or adjusting the direction.
8. A serial number generation method, characterized in that, Applied to a database server, the method includes: The system receives a sequence number generation request from an application server, which carries a first-level geographic region identifier, a target data table identifier, and target sequence number adjustment data. The sequence number generation request is sent by the application server after receiving a data transmission request from a front-end device, based on the first-level geographic region identifier carried in the data transmission request, determining the target database identifier, and based on the target transmission scenario identifier carried in the data transmission request, determining the target data table identifier and the target sequence number adjustment data. Search the target database for the target data table corresponding to the target data table identifier, and search the target data table for the target data record corresponding to the first-level geographical region identifier; Read the original serial number value from the target data record, and generate the target serial number value by adjusting the data and the original serial number value according to the target serial number; The original serial number value in the target data record is updated to the target serial number value, and the target serial number value is sent to the application server.
9. The method according to claim 8, characterized in that, The data transmission request also carries a second-level geographic region identifier, which is the next level of geographic region after the first-level geographic region. The step of searching for the target data record corresponding to the first-level geographic region identifier in the target data table includes: Search the target data table for the target data record corresponding to the first-level geographic region identifier and the second-level geographic region identifier.
10. The method according to claim 9, characterized in that, The first-level geographic region identifier is the provincial-level geographic region identifier, and the second-level geographic region identifier is the municipal-level geographic region identifier.
11. The method according to claim 8, characterized in that, The step of generating a target serial number value based on the target serial number adjustment data and the original serial number value includes: The original serial number value is adjusted according to the target serial number adjustment data to obtain the adjusted intermediate serial number value; Read the target sequence number name from the target data record, and concatenate the target sequence number name, the first-level geographical region identifier, and the intermediate sequence number value to obtain the target sequence number value.
12. The method according to claim 8, characterized in that, The serial number generation request also carries a target serial number value range; sending the target serial number value to the application server includes: Determine whether the target serial number value exceeds the range of serial number values. If so, restrict the target serial number value to the range of target serial number values, or regenerate the target serial number value within the range of target serial number values. The target serial number value, which is limited to the range of values of the target serial number, or the regenerated target serial number value, is sent to the application server.
13. The method according to claim 8, characterized in that, The method further includes: After finding the target data record from the target data table, the target data record is locked using a database row lock to prevent other transactions from accessing the target data record simultaneously. After updating the original serial number value in the target data record to the target serial number value, the lock on the target data record is released.
14. The method according to any one of claims 8-13, characterized in that, The target transmission scenario identifier includes a provident fund document transmission scenario identifier; and / or, The target sequence number adjustment data includes: adjusting the step size and / or adjusting the direction.
15. A serial number generation device, characterized in that, Configured on an application server, the device includes: The application response module is used to respond to a data transmission request sent by the front-end device and obtain the first-level geographical region identifier and the target transmission scenario identifier carried in the data transmission request. The identifier determination module is used to determine the target database identifier corresponding to the first-level geographic region identifier based on the pre-established correspondence between geographic region identifiers and database identifiers. The configuration determination module is used to determine the target data table identifier and target sequence number adjustment data corresponding to the target transmission scenario identifier according to the pre-set configuration file. The request sending module is used to send a sequence number generation request carrying the first-level geographic region identifier, the target data table identifier, and the target sequence number adjustment data to the target database server corresponding to the target database identifier, so that the target database server can find the target data record corresponding to the first-level geographic region identifier from the target data table stored in the target database corresponding to the target data table identifier, and generate a target sequence number value based on the target sequence number adjustment data and the original sequence number value in the target data record; The response sending module is used to receive the target sequence number value returned by the target database server, and send a response message to the front-end device based on the target sequence number value.
16. A serial number generation device, characterized in that, Configured on a database server, the device includes: The request receiving module is used to receive a serial number generation request sent by the application server, which carries a first-level geographic region identifier, a target data table identifier, and target serial number adjustment data. The serial number generation request is sent by the application server after receiving a data transmission request from the front-end device, based on the first-level geographic region identifier carried in the data transmission request, determining the target database identifier, and based on the target transmission scenario identifier carried in the data transmission request, determining the target data table identifier and the target serial number adjustment data. The record lookup module is used to look up the target data table corresponding to the target data table identifier in the target database, and to look up the target data record corresponding to the first-level geographical region identifier in the target data table; The serial number generation module is used to read the original serial number value in the target data record, adjust the data and the original serial number value according to the target serial number, and generate a target serial number value. The serial number sending module is used to update the original serial number value in the target data record to the target serial number value, and send the target serial number value to the application server.
17. An electronic device, characterized in that, The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the computer program, implements the serial number generation method as described in any one of claims 1-14.
18. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the serial number generation method as described in any one of claims 1-14.
19. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the serial number generation method as described in any one of claims 1-14.