Business information processing method and apparatus, electronic device, and storage medium

By storing subsystem data in an independent database within a distributed information system and using dynamic data source identification and database replication mechanisms, the challenges of data isolation and integration in traditional systems are solved, achieving efficient data management and rapid response.

CN120492460BActive Publication Date: 2025-11-04BANK OF NINGBO
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510998071.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-21
Publication Date
2025-11-04
Estimated Expiration
2045-07-21

AI Technical Summary

Technical Problem

Traditional distributed information systems struggle to simultaneously meet the needs of physical data isolation at the sub-level and data integration across different levels of organizations, resulting in high system complexity, increased response latency, and exorbitant transformation costs.

Method used

The business data of each subsystem is stored in an independent database. A dynamic data source identifier and a thread-local variable mechanism are used to pass the data source identifier through the HTTP request header. Combined with the database replication mechanism, the data source identification and operation between systems are realized.

Benefits of technology

It achieves physical isolation and centralized aggregation of data in sub-level organizations, reduces the risk and cost of system transformation, improves system response speed and concurrent processing capabilities, and supports dynamic expansion and global analysis of multi-level organizations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120492460B_ABST
    Figure CN120492460B_ABST
Patent Text Reader

Abstract

The application discloses a business information processing method and device, electronic equipment and a storage medium. The method comprises the following steps: a gateway module receives an HTTP request from a client, obtains a database name corresponding to an access object according to ID information of the access object in the HTTP request; the database identifier is put into the HTTP request, and the HTTP request is forwarded to a business module; the business module obtains the database identifier based on the HTTP request, and stores the database identifier into a thread local variable of a current thread; the database name is obtained from the thread local variable, and a corresponding database connection pool is selected according to a key-value pair; when other business modules are called, the corresponding database identifier is obtained from the thread local variable through an interceptor, and the database name is written into a new HTTP request header and transmitted to the called other business modules. The application ensures that the system can accurately match the corresponding data source when processing data, and meets the business secret protection requirement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to physical isolation technology for business data in distributed information systems, and more particularly to a business information processing method, apparatus, electronic device, and storage medium. Background Technology

[0002] Business data management refers to a series of management activities involving the collection, storage, processing, analysis, and application of data related to business activities during the operation of a multi-level system or organization. Its aim is to ensure the accuracy, integrity, consistency, and availability of data to support core business objectives such as decision-making, process optimization, resource allocation, and planning, while adhering to relevant laws, regulations, and industry standards to guarantee data security and privacy. Currently, existing technical solutions in the field of business data management include data sharding and partitioning methods, data federation technology, data virtualization technology, cross-domain data synchronization technology, multi-tenant architecture technology, distributed database cluster technology, data platform integration technology, and middleware-based data routing technology. In the organizational structure of large-scale, multi-level systems, the multi-level system achieves diversified business layout by establishing multiple independently operating sub-level organizations. Each sub-level organization needs to maintain operational autonomy while also accepting the control of the multi-level system. To address this characteristic, information systems at hierarchical levels need to simultaneously meet two core requirements: first, to achieve physical isolation of business data at the storage level for sub-hierarchical organizations, ensuring the independence of operational data to meet compliance requirements such as industry regulation and trade secret protection; and second, to possess data integration capabilities across sub-hierarchical organizations, supporting analysis, risk monitoring, and resource allocation at the hierarchical level. However, traditional distributed information systems often employ a single database storage model, making it difficult to simultaneously meet these dual requirements. With the exponential growth of business data such as payment data, user accounts, and logistics information, modifying existing systems requires large-scale adjustments to data processing logic, involving deep restructuring of the technical architecture, which is not only costly but also carries the risk of business interruption. For example, data storage requires accurate identification of the hierarchical organization to which the data belongs and targeted writing to the corresponding database; data retrieval requires complex aggregation across multiple databases, significantly increasing system complexity and response latency. Therefore, a technical solution is urgently needed that can achieve efficient and accurate cross-hierarchical data aggregation while ensuring physical isolation of data at the sub-hierarchical level. Summary of the Invention

[0003] This application provides a business information processing method, apparatus, electronic device, and storage medium, which can at least solve the aforementioned technical problems.

[0004] According to a first aspect of the embodiments of this application, a business information processing method is provided, which stores the business data of each subsystem in an independent database, enables each module in the subsystem to connect to all databases simultaneously to form a data source, and defines a dynamic data source identifier; uses multiple databases storing the business data of each subsystem as master databases, and creates new databases as slave databases; the method includes:

[0005] The gateway module receives HTTP requests from clients, obtains the database name corresponding to the accessed object based on the ID information of the accessed object in the HTTP request, puts the database identifier into the HTTP request, and forwards the HTTP request to the business module.

[0006] Among them, the business module is based on the abstract routing data source of the Spring framework, and forms key-value pairs locally with the database name as the key and the database connection pool as the value;

[0007] The business module obtains the database identifier based on an HTTP request, stores the database identifier in a thread-local variable of the current thread, retrieves the database name from the thread-local variable, and selects the corresponding database connection pool based on the key-value pair.

[0008] When calling other business modules, the corresponding database identifier is obtained from the thread-local variable through the interceptor, and the database name is written into the new HTTP request header and passed to the other business modules being called.

[0009] As one implementation, the method further includes:

[0010] Configure the gateway module with settings that define the mapping between subsystems and databases. The settings use the subsystem identifier as an index to establish a mapping between the subsystem identifier and the database name.

[0011] As one implementation, the method further includes:

[0012] Create an independent connection pool for each database and load the connection parameters for each database; initialize multiple database connections and form key-value pairs for multiple database connections; store the database name and the corresponding connection pool in a key-value pair data structure in memory; where the database name is the key and the database connection pool is the key-value pair.

[0013] When performing database operations to execute business logic, the database name is obtained from the thread identifier, and the corresponding database connection pool is obtained from the key-value pair using the database name.

[0014] As one implementation, the method further includes:

[0015] Create a new configuration table for each master database, configuring a serial number prefix; the configuration values ​​in the configuration table are different for each master database. If the database table structure changes, create a new table for each master database, and also create a new table for each slave database during synchronization. Optimize the parameters of the slave database's configuration file, obtain error codes that the configuration file ignores, and adjust the slave database's configuration file and its parameters based on the error codes.

[0016] Thread-local variables are created and stored using the ThreadLocal technology.

[0017] As one implementation, the method further includes:

[0018] When calling other business modules, a new interceptor is added to the call. The interceptor retrieves the current database identifier from the thread-local variable based on the thread identifier; it then looks up the database key value based on the database identifier, and finally looks up the corresponding database connection pool based on the key value.

[0019] The interceptor executes before the HTTP request is sent, adds the database identifier from the thread-local variable to the request header, and passes it to other business modules.

[0020] According to a second aspect of the embodiments of this application, a business information processing apparatus is provided, comprising:

[0021] Create a module to store the business data of each subsystem in an independent database, enabling each module in the subsystem to connect to all databases simultaneously to form a data source, and define a dynamic data source identifier; use multiple databases storing the business data of each subsystem as master databases, and create new databases as slave databases;

[0022] The gateway module receives HTTP requests from clients, obtains the database name corresponding to the accessed object based on the ID information of the accessed object in the HTTP request, puts the database identifier into the HTTP request, and forwards the HTTP request to the business module.

[0023] The business module is used for the abstract routing data source based on the Spring framework. It forms key-value pairs locally with the database name as the key and the database connection pool as the value; it obtains the database identifier based on the HTTP request and stores the database identifier in the thread-local variable of the current thread; it obtains the database name from the thread-local variable and selects the corresponding database connection pool according to the key-value pair.

[0024] The interceptor module is used to retrieve the corresponding database identifier from a thread-local variable when calling other business modules, and write the database name into a new HTTP request header to pass to the other business modules being called.

[0025] As one implementation, the device further includes:

[0026] The first configuration unit is used to set configuration items for the gateway module. The configuration items contain the correspondence between subsystems and databases. The configuration items use the subsystem identifier as an index to establish a mapping relationship between the subsystem identifier and the database name.

[0027] As one implementation method, the creation module is also used for:

[0028] Create an independent connection pool for each database and load the connection parameters for each database; initialize multiple database connections and form key-value pairs for multiple database connections; store the database name and the corresponding connection pool in a key-value pair data structure in memory; where the database name is the key and the database connection pool is the key-value pair.

[0029] The gateway module is also used to obtain the database name from the thread identifier and obtain the corresponding database connection pool from the key-value pair when performing database operations on business logic.

[0030] As one implementation, the device further includes:

[0031] The second configuration unit is used to add a configuration table for each master database, configure a serial number prefix, and ensure that the configuration values ​​in the configuration table are different for each master database. If the database table structure changes, a new table is added for each master database, and a new table is also added for each slave database during synchronization. The unit optimizes the parameters of the slave database's configuration file, obtains error codes that the configuration file ignores, and adjusts the slave database's configuration file and its parameters based on the error codes.

[0032] The creation module is also used to create thread-local variables using ThreadLocal technology and store the created thread-local variables.

[0033] As one implementation, the interceptor module is also used for:

[0034] When calling other business modules, the current database identifier is obtained from the thread-local variable based on the thread identifier; the database key value is found based on the database identifier, and the corresponding database connection pool is found based on the key value;

[0035] Executed before the HTTP request is sent, the database identifier from the thread-local variable is added to the request header and passed to other business modules.

[0036] According to a third aspect of the embodiments of this application, a non-transitory computer-readable storage medium is provided, wherein when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is able to perform the steps of the business information processing method.

[0037] The technical solutions provided by the embodiments of this application may include the following beneficial effects:

[0038] The technical solution of this application is lightweight, reducing the workload of modifying business logic. It also shields the information system from the physically dispersed nature of business data storage, supporting dynamic expansion of subsystems. It is suitable for systems where data is logically separated into a single database and needs to be transformed into systems with multiple physically separated databases. By decoupling business logic from data storage, it is particularly suitable for information technology upgrades of multi-level organizations with diversified business segments and a strong emphasis on data sovereignty. By storing the business data of each subsystem in independent databases and assigning a unique identifier to each data source, combined with HTTP request headers to transmit data source identifiers and thread marking mechanisms, the system ensures accurate matching of corresponding data sources during data processing, effectively avoiding data confusion and unauthorized access issues, and meeting compliance requirements and commercial confidentiality protection needs. It can acquire business data from all sub-level organizations in real time, forming a unified data query and analysis entry point, facilitating global analysis, risk monitoring, and resource allocation, and improving overall system management efficiency. It does not require large-scale reconstruction of existing information systems; only the introduction of a data source identification mechanism at the data transmission layer and the configuration of a master-slave replication mechanism at the data aggregation layer are needed to achieve the dual goals of physical isolation and centralized management, reducing the risk of business interruption and development costs associated with system transformation. Intelligent data source matching is achieved through a thread-marking mechanism, avoiding the complex routing logic required for traditional cross-database queries and significantly improving system response speed. Simultaneously, combining database replication and caching technologies further optimizes high-frequency query performance and enhances the system's concurrent processing capabilities. The system architecture supports dynamically adding new subsystem database instances and can flexibly respond to business growth and complex scenarios through load balancing, distributed transactions, and other mechanisms.

[0039] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0040] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0041] Figure 1 This is a flowchart illustrating a business information processing method according to an embodiment of this application;

[0042] Figure 2 This is a schematic diagram illustrating the processing flow of business data in a distributed system according to an embodiment of this application;

[0043] Figure 3 This is a schematic diagram illustrating the data processing flow of an interceptor in a distributed system, as shown in an embodiment of this application.

[0044] Figure 4This is a schematic diagram of the composition structure of a business information processing device shown in an embodiment of this application;

[0045] Figure 5 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation

[0046] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application.

[0047] This application's embodiment is based on an information system architecture with multi-data source management and database replication mechanisms, aiming to achieve physical isolation and centralized aggregation of business data from sub-level organizations to improve data security and management efficiency. This technical solution is primarily applied to multi-level system-level information systems, particularly suitable for data management scenarios with multiple independent operating units such as subsidiaries or business-level organizations. At the data storage level, this application's embodiment stores the business data of each sub-level organization in independent databases, forming multiple logically separate data sources. Each data source is assigned a unique identifier and managed using a unified naming rule. Various functional modules within the information system connect to multiple databases simultaneously, ensuring access to all relevant data sources. During data transmission, HTTP request headers are used as the transmission medium for data source identifiers, embedding the data source name into the request header to achieve cross-system data source identification. Each module adds a unique marker to its processing thread based on the received data source identifier, enabling subsequent operations to automatically match the corresponding data source based on this marker, thereby achieving accurate access and operation of data from different sub-level organizations and effectively avoiding data confusion and unauthorized access issues. Regarding data aggregation, this application's embodiment uses the independent databases of each sub-level organization as master databases, and creates a unified slave database to centrally store data from all master databases. By configuring an efficient data replication mechanism, such as log-based incremental synchronization or real-time replication technology, it is ensured that the slave database can synchronize data changes across the master databases in real time and completely. This design not only achieves centralized aggregation of business data but also provides a unified data query and analysis entry point for multi-level organizations, facilitating global data governance and decision support. In summary, the technical solution of this application embodiment, through the dynamic transmission of data source identifiers and intelligent matching of thread markers, combined with an efficient database replication mechanism, constructs a secure, efficient, and scalable multi-level system-level data management system, effectively solving the technical challenges of data isolation and centralized management in multi-sub-level organizations.

[0048] The following specific examples further illustrate the essence of the technical solutions in the embodiments of this application.

[0049] Figure 1 This is a flowchart illustrating a business information processing method according to an embodiment of this application, such as... Figure 1 As shown, the business information processing method in this application embodiment may include the following processing steps:

[0050] Step 101: The gateway module receives an HTTP request from the client, obtains the database name corresponding to the accessed object based on the ID information of the accessed object in the HTTP request, puts the database identifier into the HTTP request, and forwards the HTTP request to the business module.

[0051] In this embodiment, the access object can be a sub-level organization in a multi-level system. The business data of each sub-level organization is stored in an independent database, allowing each module of the information system to connect to multiple databases simultaneously, forming multiple data sources. A unique name is assigned to each data source. The business data of each subsystem is stored in an independent database, allowing each module within the subsystem to connect to all databases simultaneously, forming data sources, and a dynamic data source identifier is defined. Multiple databases storing the business data of each subsystem serve as master databases, and newly created databases serve as slave databases.

[0052] Create a new configuration table for each master database, configure a serial number prefix, and ensure that the configuration values ​​in the configuration table are different for each master database. If the database table structure changes, create a new table for each master database and also create a new table for each slave database during synchronization. Optimize the parameters of the slave database's configuration file, obtain error codes that the configuration file ignores, and adjust the slave database's configuration file and its parameters based on the error codes.

[0053] In this embodiment, the business module uses the abstract routing data source of the Spring framework to form key-value pairs locally, with the database name as the key and the database connection pool as the value.

[0054] Configuration items are set for the gateway module, which specify the mapping between subsystems and databases. These configuration items use the subsystem identifier as an index to establish a mapping between the subsystem identifier and the database name. An independent connection pool is created for each database, and the connection parameters for each database are loaded. Multiple database connections are initialized, forming key-value pairs for each connection. The database name and its corresponding connection pool are stored in a key-value pair data structure in memory; the database name serves as the key, and the database connection pool as the key-value pair. When performing database operations based on business logic, the database name is retrieved from the thread identifier, and the corresponding database connection pool is obtained from the key-value pair using the database name.

[0055] Step 102: The business module obtains the database identifier based on an HTTP request, stores the database identifier in the thread-local variable of the current thread, retrieves the database name from the thread-local variable, and selects the corresponding database connection pool based on the key-value pair.

[0056] In this embodiment, the gateway module contains a configuration item that sets the mapping between hierarchical organization numbers and databases. The gateway module retrieves the database name from this configuration item based on the hierarchical organization number of the currently logged-in user. When forwarding a request to the business module, the gateway includes the database name in the HTTP request header. Correspondingly, the business module inherits the abstract routing data source from the Spring framework and initializes connections to multiple databases upon startup. Upon receiving a request, the business module retrieves the database name from the HTTP request header, identifies the thread currently receiving / processing the request, and executes the business logic. This means that regardless of the number of database table operations performed by this thread within the business logic, the corresponding database will always be selected based on the database name.

[0057] Step 103: When calling other business modules, the corresponding database identifier is obtained from the thread-local variable through the interceptor, and the database name is written into the new HTTP request header and passed to the other business modules being called.

[0058] In this embodiment of the application, when calling other business modules, a new interceptor is added to the call. The interceptor is triggered to obtain the current database identifier from the thread-local variable based on the thread identifier; the database key value is found according to the database identifier; and the corresponding database connection pool is found according to the key value. The interceptor is executed before the HTTP request is sent, adds the database identifier in the thread-local variable to the request header, and passes it to other business modules.

[0059] In this embodiment, data processing mainly involves the storage, identification, transmission, and synchronization mechanisms of business data. The business data of each sub-level organization originates from its internal operating systems, including but not limited to financial systems, customer relationship management systems (CRM), and supply chain management systems (SCM). This data is typically stored in a structured format, such as a table structure in a relational database, containing fields of integer, floating-point, string, date, and time types. To achieve physical isolation and centralized management of data across multiple sub-level organizations, it is first necessary to uniformly name and identify the data sources of each sub-level organization. Each database instance of a sub-level organization is assigned a unique identifier, such as "SG001" or "SG002," which follows a unified naming convention to ensure uniqueness and identifiability throughout the information system. This naming convention can be defined as: SG + three-digit number + suffix identifier (e.g., _DB), forming standard formats such as "SG001_DB" and "SG002_DB." During data transmission, the HTTP request header is used as the transmission medium for the data source identifier. Specifically, when the client initiates a request, the identifier name of the target data source is passed to the server via an HTTP request header field (such as X-Data-Source-ID). Upon receiving the request, the server parses the X-Data-Source-ID field in the request header and uses it as a unique identifier for the current thread, used to automatically match the corresponding data source in subsequent operations. This identifier can be stored in a thread-local variable (ThreadLocal) to ensure that data confusion does not occur between different threads in a multi-threaded environment. Furthermore, to ensure data consistency and integrity, necessary preprocessing operations are required during the data acquisition phase, including data cleaning, deduplication, and format standardization. For example, for the same business entity (such as customer information) from different sub-level organizations, field names and data types need to be unified to avoid data parsing errors caused by inconsistent fields. Data cleaning can be achieved through regular expression matching of illegal characters, null value filling, and outlier filtering. The core system architecture of this application embodiment consists of multiple independent databases, a unified data source identifier management module, business function modules, and a master-slave database replication mechanism. At the data storage layer, the business data of each sub-level organization is stored in independent database instances. These database instances are deployed on different servers or virtual machines, logically isolated from each other, and further physically isolated through network firewalls to enhance data security. Each database instance is configured with independent access control policies, allowing only authorized users or system modules to access it. At the application layer, various functional modules of the information system (such as order management, inventory management, report analysis, etc.) are connected to the database instances of all sub-level organizations, forming multi-data source access capabilities.Upon receiving a request, each module dynamically switches its database connection pool based on the data source identifier in the HTTP request header, ensuring that operations are always executed against the correct data source. At the data aggregation layer, a "multi-master, one-slave" database replication strategy is employed. The master database consists of independent database instances organized at each sub-level, while the slave database is a centrally established database instance. The slave database achieves incremental data synchronization by reading the master database's log files (such as MySQL's binlog or PostgreSQL's WAL log), ensuring real-time data updates. The synchronization mechanism supports both asynchronous and synchronous modes. Asynchronous mode is suitable for scenarios with lower real-time requirements, while synchronous mode is suitable for business scenarios requiring strong consistency guarantees.

[0060] Figure 2 This is a schematic diagram illustrating the processing flow of business data in a distributed system according to an embodiment of this application, such as... Figure 2 As shown, the data source identifier transmission and matching process employs an identifier transmission algorithm based on HTTP request headers. Its core steps are as follows: 1. The client constructs an HTTP request, writing the target data source identifier into the request header; 2. The server receives the request and parses the data source identifier in the request header; 3. The data source identifier is stored in a thread-local variable; 4. All subsequent database operations select the corresponding database connection pool based on this identifier; 5. After the operation is completed, the thread-local variable is cleared to prevent memory leaks. This algorithm, because it only involves simple string parsing and variable assignment operations, does not affect the overall system performance.

[0061] like Figure 2 As shown, the web / mobile client initiates an HTTP request for login or transaction.

[0062] The gateway module has internal configuration options that define the mapping between hierarchical organization numbers and databases. The gateway module retrieves the database name from these configuration options based on the hierarchical organization number of the currently logged-in user.

[0063] When the gateway module forwards an HTTP request to the business module, it includes the database name in the HTTP request header.

[0064] The business module inherits the abstract routing data source of the Spring framework and initializes connections to multiple databases upon startup.

[0065] Once the business module receives the request, it retrieves the database name from the HTTP request header.

[0066] Mark the thread that is currently receiving / processing an HTTP request.

[0067] Execute business logic; that is, no matter how many database table operations this thread performs in the business logic, it will always select the corresponding database based on the database name.

[0068] If business module two needs to be called, the database name will be placed in the request header.

[0069] After receiving the HTTP request, business module 2 obtains the database name from the HTTP request header and selects the corresponding database based on the database name. This embodiment of the application, based on different business modules and different databases, completes the transmission and closure of the database name, realizing the physical isolation of hierarchically organized business data.

[0070] For database replication, a log-based incremental synchronization algorithm is adopted, with the following basic process: 1. The master database records all write operations to the transaction log; 2. The slave database continuously monitors the master database's transaction log; 3. When a new log entry is detected, the slave database parses the log content and generates the corresponding SQL statement; 4. The SQL statement is executed to synchronize the changes to the local database; 5. The synchronization status is recorded for subsequent latency calculations and fault recovery. The key to this algorithm lies in log parsing efficiency and conflict handling mechanisms. To improve parsing efficiency, a binary log parser can be used to directly read binary data from the log file, rather than text format, thereby reducing I / O overhead.

[0071] Figure 3 This is a schematic diagram illustrating the data processing flow of an interceptor in a distributed system, as shown in the embodiments of this application. Figure 3 As shown in the embodiments of this application, the data processing flow of the interceptor in a distributed system includes:

[0072] Initialize multiple database connections and create key-value pairs for each database connection, where the key is the database name and the value is the database connection pool.

[0073] The database name is obtained from the HTTP request header of the previous gateway module and written to the current thread space for storage. This step completes the thread identification.

[0074] When performing database operations to execute business logic, the database name is obtained from the thread identifier.

[0075] The actual database connection pool is obtained from key-value pairs using the database name.

[0076] When calling other business modules, a new interceptor is added to retrieve the database name from the thread identifier.

[0077] The database name is sent to the HTTP request header and passed to other business modules to implement related database processing.

[0078] Suppose a multi-level system has three sub-level organizations: A, B, and C, corresponding to database instances SG001DB001, SG002DB002, and SG003DB003, respectively. The order management module in the information system needs to access these three databases simultaneously to process order data for each sub-level organization. When a user accesses the order query interface, the front-end system writes the identifier of the target sub-level organization (e.g., SG001DB001) into the HTTP request header and sends it to the back-end service. After receiving the request, the back-end service parses the identifier in the request header and stores it in the ThreadLocal variable of the current thread. Subsequently, the order management module calls the database access layer, selects the corresponding database connection pool based on the identifier in the thread, executes the SQL query operation, and retrieves the order data of the corresponding sub-level organization. The entire process requires no manual intervention; the system automatically completes data source matching and operation execution. For data aggregation, the system creates a unified slave database, CentralDB, as a replica of all master databases. The slave database synchronizes data changes in real time by listening to the transaction logs of the master database. For example, when sub-level organization A adds a new order record, the master database SG001DB001 writes the change record to the binlog. The slave database CentralDB reads this log entry, generates the corresponding INSERT statement, and executes the insert operation, ensuring data consistency. Furthermore, the system supports various scaling methods. For instance, a load balancing mechanism can be introduced to distribute requests to multiple slave database instances to improve query performance; a distributed transaction management mechanism can be used to ensure consistency across database operations; and caching technologies, such as Redis, can be combined to cache frequently queried data, further optimizing response speed.

[0079] This application embodiment constructs a secure, efficient, and scalable multi-level system-level data management system through unified data source identifier management, intelligent thread tag matching, and efficient database replication mechanism, effectively solving the technical challenges of data isolation and centralized management in multi-sub-level organizations.

[0080] Figure 4 This is a schematic diagram of the composition structure of a business information processing device shown in an embodiment of this application, such as... Figure 4 As shown, the business information processing apparatus of this application embodiment includes:

[0081] Create module 40 to store the business data of each subsystem in an independent database, enabling each module in the subsystem to connect to all databases simultaneously to form a data source, and define a dynamic data source identifier; use multiple databases storing the business data of each subsystem as master databases, and create new databases as slave databases;

[0082] Gateway module 41 receives HTTP requests from clients, obtains the database name corresponding to the accessed object based on the ID information of the accessed object in the HTTP request, puts the database identifier into the HTTP request, and forwards the HTTP request to the business module;

[0083] Business module 42 is used for the abstract routing data source based on the Spring framework. It forms key-value pairs locally with the database name as the key and the database connection pool as the value; it obtains the database identifier based on the HTTP request and stores the database identifier in the thread-local variable of the current thread; it obtains the database name from the thread-local variable and selects the corresponding database connection pool according to the key-value pair.

[0084] Interceptor module 43 is used to obtain the corresponding database identifier from the thread-local variable when calling other business modules, and write the database name into the new HTTP request header and pass it to the other business modules being called.

[0085] exist Figure 4 Based on the business information processing apparatus shown, the business information processing apparatus of this application embodiment further includes:

[0086] First configuration unit ( Figure 4 (Not shown in the image) is used to set configuration items for the gateway module. The configuration items configure the correspondence between subsystems and databases. The configuration items establish a mapping relationship between the subsystem identifier and the database name using the subsystem identifier as an index.

[0087] As one implementation, the creation module 40 is also used for:

[0088] Create an independent connection pool for each database and load the connection parameters for each database; initialize multiple database connections and form key-value pairs for multiple database connections; store the database name and the corresponding connection pool in a key-value pair data structure in memory; where the database name is the key and the database connection pool is the key-value pair.

[0089] The gateway module 41 is also used to obtain the database name from the thread identifier and obtain the corresponding database connection pool from the key-value pair when performing database operations to execute business logic.

[0090] exist Figure 4 Based on the business information processing apparatus shown, the business information processing apparatus of this application embodiment further includes:

[0091] Second configuration unit ( Figure 4(Not shown in the image) is used to add a configuration table for each master database, configure a serial number prefix, and the configuration values ​​of the configuration table are different in each master database; if the database table structure changes, a new table is added for each master database, and a new table is also added for slave database synchronization; the parameters of the slave database configuration file are optimized, the error codes that the configuration file ignores are obtained, and the slave database configuration file and its parameters are adjusted based on the error codes; and the creation module 40 is also used to create thread-local variables through ThreadLocal technology and store the created thread-local variables.

[0092] As one implementation, the interceptor module 43 is further configured to:

[0093] When calling other business modules, the current database identifier is obtained from the thread-local variable based on the thread identifier; the database key value is found based on the database identifier; and the corresponding database connection pool is found based on the key value.

[0094] Executed before the HTTP request is sent, the database identifier from the thread-local variable is added to the request header and passed to other business modules.

[0095] In an exemplary embodiment, the aforementioned processing units may be implemented by one or more central processing units (CPUs), graphics processing units (GPUs), baseband processors (BPs), application-specific integrated circuits (ASICs), digital signal processors (DSPs), programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors, or other electronic components.

[0096] In the embodiments of this application, Figure 4 The specific methods by which each unit in the business information processing device performs operations have been described in detail in the embodiments of the relevant method, and will not be elaborated here.

[0097] Figure 5This is a block diagram illustrating an electronic device according to an exemplary embodiment. The electronic device 800 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 may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, 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 present application described and / or claimed herein.

[0098] like Figure 5 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. The RAM 803 may also store various programs and data required for the operation of the electronic device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0099] Multiple components in electronic device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of displays, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows electronic device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0100] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 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 computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as business information processing methods. For example, in some embodiments, the business information processing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the business information processing method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured as a business information processing method by any other suitable means (e.g., by means of firmware).

[0101] 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), system-on-a-chip (SoCs), complex 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 transferring data and instructions to the storage system, the at least one input device, and the at least one output device.

[0102] The program code used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0103] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. 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 of the foregoing.

[0104] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. 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).

[0105] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user 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., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0106] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0107] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.

[0108] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.

[0109] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A business information processing method, characterized in that, This method is applicable to systems where data is logically separated by a single database but needs to be transformed into systems with multiple physically separated databases. By decoupling business logic from data storage, it is suitable for information technology upgrades of multi-level organizations with diversified business segments and an emphasis on data sovereignty. The business data of each subsystem is stored in an independent database, enabling each module in the subsystem to connect to all databases simultaneously, forming a data source. A unique identifier is assigned to each data source, and the data source identifier is passed through the HTTP request header and the thread marking mechanism to ensure that the system can match the corresponding data source when processing data. Multiple databases storing business data from each subsystem are used as master databases, and newly created databases are used as slave databases. In the data storage layer, the business data of each sub-level organization is stored in independent database instances, which are deployed on different servers or virtual machines. The master database is the independent database instance of each sub-level organization, and the slave database is a centrally established database instance. The slave database achieves incremental data synchronization by reading the master database's log files; the method includes: The gateway module receives HTTP requests from clients, obtains the database name corresponding to the accessed object based on the ID information of the accessed object in the HTTP request, puts the database identifier into the HTTP request, and forwards the HTTP request to the business module. Among them, the business module is based on the abstract routing data source of the Spring framework, and forms key-value pairs locally with the database name as the key and the database connection pool as the value; The business module obtains the database identifier based on an HTTP request, stores the database identifier in a thread-local variable of the current thread, retrieves the database name from the thread-local variable, and selects the corresponding database connection pool based on the key-value pair. When calling other business modules, the corresponding database identifier is obtained from the thread-local variable through the interceptor, and the database identifier is written into the new HTTP request header and passed to the other business modules being called.

2. The method according to claim 1, characterized in that, The method further includes: Configure the gateway module with settings that define the mapping between subsystems and databases. The settings use the subsystem identifier as an index to establish a mapping between the subsystem identifier and the database name.

3. The method according to claim 1, characterized in that, The method further includes: Create an independent connection pool for each database and load the connection parameters for each database; initialize multiple database connections and form key-value pairs for multiple database connections; store the database name and the corresponding connection pool in a key-value pair data structure in memory; where the database name is the key and the database connection pool is the key-value pair. When performing database operations to execute business logic, the database name is obtained from the thread identifier, and the corresponding database connection pool is obtained from the key-value pair using the database name.

4. The method according to claim 1, characterized in that, The method further includes: Create a new configuration table for each master database, configuring a serial number prefix; the configuration values ​​in the configuration table are different for each master database. If the database table structure changes, create a new table for each master database, and also create a new table for each slave database during synchronization. Optimize the parameters of the slave database's configuration file, obtain error codes that the configuration file ignores, and adjust the slave database's configuration file and its parameters based on the error codes. Thread-local variables are created and stored using the ThreadLocal technology.

5. The method according to claim 1, characterized in that, The method further includes: When calling other business modules, a new interceptor is added to the call. The interceptor retrieves the current database identifier from the thread-local variable based on the thread identifier; it then looks up the database key value based on the database identifier, and finally looks up the corresponding database connection pool based on the key value. The interceptor executes before the HTTP request is sent, adds the database identifier from the thread-local variable to the request header, and passes it to other business modules.

6. A business information processing device, characterized in that, The device is suitable for systems where data is logically stored in a single database but need to be transformed into systems with multiple physically separated databases; by decoupling business logic from data storage, it is used for information technology upgrades of multi-level organizations with diversified business segments and an emphasis on data sovereignty; including: A module is created to store the business data of each subsystem in an independent database. This allows each module within a subsystem to connect to all databases simultaneously, forming a data source. Each data source is assigned a unique identifier, and the system uses HTTP request headers to pass the data source identifier and a thread tagging mechanism to ensure that the system can match the corresponding data source when processing data. Multiple databases storing the business data of each subsystem serve as master databases, and newly created databases serve as slave databases. In the data storage layer, the business data of each sub-level is stored in an independent database instance, deployed on different servers or virtual machines. The master database consists of the independent database instances of each sub-level, while the slave database is a centrally established database instance. The slave database achieves incremental data synchronization by reading the log files of the master database. The gateway module receives HTTP requests from clients, obtains the database name corresponding to the accessed object based on the ID information of the accessed object in the HTTP request, puts the database identifier into the HTTP request, and forwards the HTTP request to the business module. The business module is used for the abstract routing data source based on the Spring framework. It forms key-value pairs locally with the database name as the key and the database connection pool as the value; it obtains the database identifier based on the HTTP request and stores the database identifier in the thread-local variable of the current thread; it obtains the database name from the thread-local variable and selects the corresponding database connection pool according to the key-value pair. The interceptor module is used to retrieve the corresponding database identifier from a thread-local variable when calling other business modules, and write the database identifier into a new HTTP request header to pass to the other business modules being called.

7. The apparatus according to claim 6, characterized in that, The creation module is also used for: Create an independent connection pool for each database and load the connection parameters for each database; initialize multiple database connections and form key-value pairs for multiple database connections; store the database name and the corresponding connection pool in a key-value pair data structure in memory; where the database name is the key and the database connection pool is the key-value pair. The gateway module is also used to obtain the database name from the thread identifier and obtain the corresponding database connection pool from the key-value pair when performing database operations on business logic.

8. The apparatus according to claim 6, characterized in that, The device further includes: The second configuration unit is used to add a configuration table for each master database, configure a serial number prefix, and ensure that the configuration values ​​in the configuration table are different for each master database. If the database table structure changes, a new table is added for each master database, and a new table is also added for each slave database during synchronization. The unit optimizes the parameters of the slave database's configuration file, obtains error codes that the configuration file ignores, and adjusts the slave database's configuration file and its parameters based on the error codes. The creation module is also used to create thread-local variables using ThreadLocal technology and store the created thread-local variables.

9. An electronic device, characterized in that, include: At least one processor; A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the steps of the business information processing method according to any one of claims 1 to 5.

10. A non-transitory computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to perform the steps of the business information processing method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Data isolation method and system based on tenants

    CN115481435A

  • Multi-version dynamically extensible data source method and device, terminal and storage medium

    CN120315681A