Method, device, equipment and computer-readable medium for processing business data
Through the configuration of library rules and the use of index libraries, the problem of slow data processing of insurance policy is solved, and the rapid query and expansion of seamless switching is achieved, meeting business needs.
Patent Information
- Application Number
- CN202111237270.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-21
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2041-10-21
AI Technical Summary
When processing insurance policy data, the data processing speed is slow and it is difficult to meet actual needs. Especially when the insurance policy volume is growing rapidly, the IO and performance of a single database have reached a bottleneck and cannot support business development.
The database partition rule configuration is adopted, and the database partition list is set according to the policy channel and/or product number, the business database is connected through the database connection pool, the index database and search engine are used to store the corresponding relationship between the policy number and the business database, and the hash value is determined to determine the switching between the index table and the business database, avoid repeated data storage, and support the expansion of the business database and rapid query.
It improves data processing speed, meets the processing requirements of actual policy data, supports separate processing of different products, avoids data migration during capacity expansion, and ensures the continuity and efficiency of the system.
Smart Images

Figure CN113986917B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, apparatus, device, and computer-readable medium for processing business data. Background Art
[0002] The number of policies for each insurance product varies, and the time required to process policy data also varies. In the early stages, when data volumes are small, a single database can be used for data storage, with read / write separation implemented using a primary / standby database. Multiple applications can simultaneously connect to this single database for business processing.
[0003] As the business scale expanded, the number of insurance policies also grew rapidly, leading to a corresponding surge in data volume. The I / O and performance of a single database had reached a bottleneck, making it unable to support business growth.
[0004] In the process of realizing the present invention, the inventors found that there are at least the following problems in the prior art: since the policy data processing needs to be completed in a short time, the data processing speed is slow and it is difficult to meet the actual policy data processing requirements. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a method, apparatus, device, and computer-readable medium for processing business data, which can improve data processing speed and meet the processing requirements of actual insurance policy data.
[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for processing business data is provided, comprising:
[0007] Based on the policy number, the application's search engine is used to obtain the database sharding list in the sharding rule configuration, which is configured based on the policy channel and / or product number, and connect to the database connection pool.
[0008] Determining, according to the database sub-library list, the business database in which the policy data is stored, wherein the data in the business database belongs to the same channel and / or product number;
[0009] The business database is connected through the database connection pool to query the data of the insurance policy to process the business data.
[0010] The method further comprises:
[0011] According to the business ID of the insurance policy, the business database ID is added to the database sub-library list in the sub-library rule configuration. The business ID includes the channel number and / or product number.
[0012] After receiving the policy number of the policy in question, also include:
[0013] According to the policy number of the insurance policy, the database shard list newly added in the shard rule configuration is obtained in the search engine.
[0014] The method further comprises:
[0015] According to the policy's business ID, the database sharding list in the sharding rule configuration is obtained from the cache and connected to the database connection pool;
[0016] Switch the business database according to the number of business databases in the database sub-library list,
[0017] After the policy data is stored in the business database, the business database connection is switched to the index library to store the corresponding relationship between the policy number of the policy and the business database in the index table, and the corresponding relationship is stored in the search engine.
[0018] The switching of the business database according to the number of the business databases in the database sub-library list includes:
[0019] If the number is greater than 1, an index of the database sub-library list is established based on the hash value of the policy number;
[0020] The index is used to determine the identifier of the business database in the database sub-library list to switch the business database.
[0021] The corresponding relationship between the policy number of the insurance policy and the business database is stored in the index table, including:
[0022] Determine the table number of the index table based on the hash value of the policy number, where the index table is a horizontal sub-table;
[0023] The corresponding relationship between the policy number and the business database is stored in the index table corresponding to the table number.
[0024] The method further comprises:
[0025] The policy number is saved in the redis database to verify the duplication of the policy number.
[0026] The method further comprises:
[0027] According to the database sub-library list, the business database storing the policy data is not found;
[0028] In the index database, an index table is determined based on the policy number;
[0029] In the index table, the identifier of the business database corresponding to the policy number is found.
[0030] According to a second aspect of an embodiment of the present invention, there is provided an apparatus for processing service data, including:
[0031] The acquisition module is used to obtain the database sharding list in the sharding rule configuration according to the policy number of the insurance policy from the application's search engine and connect to the database connection pool. The sharding rule configuration is set according to the policy channel and / or product number;
[0032] a determination module, configured to determine, according to the database sub-library list, a business database in which the data of the insurance policy is stored, wherein the data in the business database belongs to the same channel and / or product number;
[0033] The processing module is used to connect to the business database through the database connection pool, query the data of the insurance policy to process the business data.
[0034] According to a third aspect of an embodiment of the present invention, there is provided an electronic device for processing service data, including:
[0035] one or more processors;
[0036] a storage device for storing one or more programs,
[0037] When the one or more programs are executed by the one or more processors, the one or more processors implement the above-described method.
[0038] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described above is implemented.
[0039] One embodiment of the above invention has the following advantages or beneficial effects: according to the policy number of the insurance policy, the database sub-library list in the sub-library rule configuration is obtained in the search engine of the application, and the database connection pool is connected, and the sub-library rule configuration is set according to the channel and / or product number of the insurance policy; according to the database sub-library list, the business database where the data of the insurance policy is stored is determined, and the data of the business database belongs to the same channel and / or product number; the business database is connected through the database connection pool, and the business data of the insurance policy is queried to process the business data. The data of the insurance policy is stored in the corresponding business database according to the policy number, and the business data can be directly obtained from the business database according to the policy number. The increase in insurance policies does not affect the speed of obtaining business data, so the data processing speed can be improved to meet the processing requirements of actual insurance policy data.
[0040] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings are provided for a better understanding of the present invention and are not intended to limit the present invention.
[0042] Figure 1 is a schematic diagram of the main flow of a method for processing business data according to an embodiment of the present invention;
[0043] Figure 2 is a schematic diagram of an index library and a business database according to an embodiment of the present invention;
[0044] Figure 3 is a schematic diagram of configuring database partitioning rules according to an embodiment of the present invention;
[0045] Figure 4 is a schematic diagram of creating a database connection pool according to an embodiment of the present invention;
[0046] Figure 5 is a schematic diagram of a process for storing insurance policy data according to an embodiment of the present invention;
[0047] Figure 6 is a schematic diagram of a process for switching a service database according to an embodiment of the present invention;
[0048] Figure 7 1 is a flow chart of storing the corresponding relationship between the policy number of an insurance policy and the business database according to an embodiment of the present invention;
[0049] Figure 8 is a schematic diagram of a process for querying an identifier of a service database according to an embodiment of the present invention;
[0050] Figure 9 is a schematic diagram of processing business data according to an embodiment of the present invention;
[0051] Figure 10 is a schematic diagram of the main structure of an apparatus for processing service data according to an embodiment of the present invention;
[0052] Figure 11 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
[0053] Figure 12 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0054] The following description of exemplary embodiments of the present invention is made in conjunction with the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding. These details should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0055] To support the development of insurance installment products, a platform was established specifically for this business. This platform enables features such as policy synchronization, automatic deductions, proactive payments, re-signing, overdue expiration, premium adjustments, and SMS notifications. During the development of this platform, it was necessary to store, query, and update massive amounts of policy installment data, as well as to process policy data for specific products separately.
[0056] A key function of the installment platform is the automatic deduction of premiums for installment policies. However, the number of policies for each product varies, as does the number of policies awaiting deduction. Furthermore, the deduction schedule and rules vary across products, necessitating separate processing for each product. Simultaneous deductions for multiple products, each with a large policy volume, and the requirement to process policy data quickly place high demands on data processing speed.
[0057] The existing solution for storing massive data is to shard databases and tables, using multiple databases to form a cluster to store data. This solution requires horizontal sharding of databases and tables when storing policy installment data.
[0058] Horizontal sharding splits data from one database into multiple databases based on fields and according to pre-set policies. The union of all databases produces the full data set. With the increase in databases, I / O and CPU pressures are reduced. However, sharding is not sufficient to address issues caused by high concurrency.
[0059] Horizontal table partitioning splits the data in a single table into multiple tables based on fields and preset strategies. The union of all tables represents the full data set. Excessive data in each table can affect SQL efficiency, increase CPU load, and even become a bottleneck.
[0060] At present, the commonly used massive data storage solutions include: ShardingSphere-JDBC, an application framework that assists applications in implementing sharding and table sharding, and Mycat, a database middleware product that can implement MySQL clusters.
[0061] ShardingSphere-JDBC is positioned as a lightweight Java framework that provides additional services at the JDBC layer of Java. It uses the client to directly connect to the database and provides services in the form of jar packages, without the need for additional deployment and dependencies. It can be understood as an enhanced JDBC driver that is fully compatible with JDBC and various ORM frameworks.
[0062] Mycat, a database middleware, is currently the most popular database middleware written in Java. It is a server that implements the MySQL protocol. Front-end users can regard it as a database proxy and access it using MySQL client tools and command lines. Its back-end can communicate with multiple MySQL servers using the MySQL native protocol, or with most mainstream database servers using the JDBC protocol. Its core function is sharding. In conjunction with the master-slave mode of the database, read-write separation can also be achieved. MyCat is developed based on the open source Cobar product. Cobar's stability, reliability, excellent architecture and performance, as well as numerous mature use cases, make MyCat very powerful. Simply put, MyCat is a solution for data storage of massive data by implementing database clusters.
[0063] The above technologies can address the problem of massive data storage, but they cannot fully meet current needs. This is because they all require sharding data into separate databases and tables based on fixed fields and fixed algorithms. When database capacity is expanded, the number of databases changes, leading to changes in the factors in the algorithm. To ensure that historical data can be retrieved when using the new algorithm for data queries after expansion, historical data must be migrated based on the calculation results of the new algorithm and rearranged and stored in the cluster with the newly added database.
[0064] In summary, it can be seen that the data processing speed in the existing technology is slow, and it is difficult to achieve separate processing of insurance policy data.
[0065] In order to solve the technical problem of slow data processing speed, the following technical solutions in the embodiments of the present invention may be adopted.
[0066] See also Figure 1 , Figure 1 This is a schematic diagram of the main process of the method for processing business data according to an embodiment of the present invention, which connects to the business database of the insurance policy through the database connection pool, thereby realizing timely processing of business data. Figure 1 As shown, the specific steps include:
[0067] S101. According to the policy number of the insurance policy, obtain the database sub-library list in the sub-library rule configuration in the application search engine, and connect to the database connection pool. The sub-library rule configuration is set according to the channel and / or product number of the insurance policy.
[0068] In this embodiment of the present invention, an index library and a business database are involved. The index library includes multiple index tables, each with the same table structure. As an example, if the index library includes X index tables, the formula for calculating X is: (estimated maximum policy volume / 10 million) × 5, rounded up.
[0069] The business database is used to store business data. There can be multiple business databases. Business data tables are created in the business database to store data based on business needs.
[0070] See also Figure 2 , Figure 2 Schematic diagram of an index library and a business database according to an embodiment of the present invention. Figure 2 It includes an index library and four business databases, namely business database 1, business database 2, business database 3 and business database 4.
[0071] In the embodiment of the present invention, considering that there are more than one business databases, it is necessary to set a database partitioning rule configuration. In the embodiment of the present invention, the database partitioning rule configuration is set according to the channel and / or product number of the insurance policy.
[0072] As an example, configure the sharding rules through the configuration center. For example, a developer logs in to the configuration center and configures the sharding rules based on the policy's business identifier. The policy's business identifier includes the channel number and / or product number. The channel number is the channel number for purchasing the policy and / or the source of information. As an example, channels include apps, websites, and telephone numbers. The product number is the number of the product to which the policy belongs. As an example, products include auto insurance, life insurance, and dividend insurance. The product number includes the auto insurance number, life insurance number, and dividend insurance number. As an example, the product number includes the product identifier for payments made according to a preset period. For example, the preset period is one year.
[0073] The sharding rule configuration, which includes the database ID and database connection information for data storage, determines which databases the product's data is stored in. The sharding rule configuration is stored in Redis for easy access by all applications and is pushed to each application through the configuration push interface.
[0074] In an embodiment of the present invention, an application (APP) is an application program that can be installed on a mobile terminal. Through the application, relevant information about the insurance policy can be obtained. In other words, business can be processed in the application based on the policy number.
[0075] See also Figure 3 , Figure 3 2 is a schematic diagram of configuring database partitioning rules according to an embodiment of the present invention. Figure 3 In the configuration center, developers configure sharding rules based on the policy's business identifier. They then push the sharding rule configuration to Application 1 through an interface and store it in the Redis cache. Application 1 can then read the sharding rule configuration from the Redis cache.
[0076] See also Figure 4 , Figure 4 Schematic diagram of creating a database connection pool according to an embodiment of the present invention. When the application starts, a database connection pool for connecting to the index library is created. That is, Figure 4 The database connection pool of application 1 and the database connection pool of application 2.
[0077] When the application service starts, the sharding rule configuration in Redis is loaded into the server memory. According to the database sharding list (dbList) in the sharding rule configuration, a database connection pool is created to connect to the corresponding database in order to dynamically switch the data source.
[0078] Figure 4 In the example, the database connection pools of the two applications are connected to the index library, business database 1, business database 2, business database 3, and business database 4 respectively.
[0079] After setting up the database sharding rule configuration and creating a database connection pool, you can store insurance policy data in the business database.
[0080] See also Figure 5 , Figure 5 The flowchart of storing insurance policy data according to an embodiment of the present invention specifically includes the following steps:
[0081] S501. According to the business identifier of the insurance policy, obtain the database shard list in the shard rule configuration from the cache and connect to the database connection pool.
[0082] Policy data is pushed to the app from other systems, including the policy number, channel number, product number, and payment plan. The payment plan is the time schedule for policy payments.
[0083] After receiving the policy data, the application retrieves the database list from the cache based on the policy's business ID. For example, if the business ID is 08600000001+10N00001, the database list includes business databases db0 and db1.
[0084] In order to store data in the business database, the application needs to connect to the database connection pool.
[0085] S502: Switch the business database according to the number of business databases in the database sub-library list.
[0086] The number of business databases involved in the database sub-library list includes 0, 1, and greater than 1. The following three cases are used to illustrate the switching of business databases.
[0087] Case 1:
[0088] The number of business databases involved in the application in the database sub-library list is 0, that is, the number of business databases is not configured or set to zero, and the default database is used.
[0089] Case 2:
[0090] If the number of business databases involved in the application in the database sharding list is 1, the application connection will be directly switched to this business database.
[0091] Case 3: The number of business databases involved in the application in the database sub-library list is greater than 1, that is, it involves multiple business databases.
[0092] See also Figure 6 , Figure 6 FIG. 1 is a flow chart of switching a service database according to an embodiment of the present invention, which specifically includes the following steps:
[0093] S601. The number of business databases is greater than 1. Based on the hash value of the policy number, an index of the database sub-library list is established.
[0094] If the number of business databases involved in the database sub-library list is greater than 1, the hash value is determined according to the policy number, and then the index of the database sub-library list is established based on the hash value.
[0095] Specifically, the policy number's hash value is calculated, then converted to a long type and its absolute value is taken. The result is modulo the configured number of databases, and the modulo result is used as the index into the database shard list. This index can then be used to retrieve the corresponding database number from the shard list.
[0096] S602: Use the index to determine the identifier of the business database in the database sub-library list to switch the business database.
[0097] The business database ID is determined in the database sub-database list using an index, and the business database ID is used to switch the business database. After the database switch is completed, the policy data can be stored in the business database in the same way as a single database.
[0098] The specific formula is:
[0099] index=|(long)hash(policyNo)|%dbList.size().
[0100] According to the number of the business database obtained, the corresponding database information is retrieved and switched to this business database.
[0101] As an example, the calculated result of (T210506000000060140006 is 1, and the corresponding database in the dbList array is db1.
[0102] exist Figure 6 In an embodiment, when the number of business servers is greater than 1, the identifier of the business database is determined by indexing to switch the business database to store the policy data.
[0103] S503. After the policy data is stored in the business database, the business database connection is switched to the index library to store the corresponding relationship between the policy number of the policy and the business database in the index table, and the corresponding relationship is stored in the search engine.
[0104] After the policy data is stored in the business database, the corresponding relationship between the policy number and the business database can be saved. In an embodiment of the present invention, the corresponding relationship between the policy number and the business database is stored in an index table in the index library. In addition, the corresponding relationship between the policy number and the business database can also be stored in a search engine.
[0105] Specifically, after the policy data is stored in the business database, the business database connection is switched to the index database, and then the corresponding relationship between the policy number of the policy and the business database is stored in the index table and the search engine.
[0106] See also Figure 7 , Figure 7 This is a flow chart of storing the corresponding relationship between the policy number of an insurance policy and the business database according to an embodiment of the present invention, specifically including:
[0107] S701. Determine the table number of the index table based on the hash value of the policy number. The index table is a horizontally partitioned table.
[0108] After the policy data is stored, the database connection is switched to the index database, and the corresponding relationship between the policy number (policyNo) and the business database is stored in the index table. The corresponding relationship between the policy number and the business database includes the corresponding relationship between the policy number and the business database number (dbNo).
[0109] The index table is a horizontally partitioned table. To calculate which index table to save the policy number to, you can determine the index table number based on the policy number's hash value.
[0110] Specifically, calculate the hash value of the policy number, then convert the hash value to long type and take the absolute value. Then, take the result of the absolute value and modulo the number of index tables (indexpolicyNumber). The result of the modulo corresponds to the table number of the index table (tableNo).
[0111] The specific formula is:
[0112] tableNo=|(long)hash(policyNo)|%indexpolicyNumber
[0113] As an example, the modulo result is 23, and the correspondence between the policy number and the business database should be stored in the indexpolicy_23 index table.
[0114] S702. Store the corresponding relationship between the policy number and the database in the index table corresponding to the table number.
[0115] The correspondence between the policy number and the database is stored in the index table corresponding to the table number, which is then easy to query.
[0116] exist Figure 7 In an embodiment, an index table is determined based on a hash value of the policy number to store the correspondence between the policy number and the business database.
[0117] In one embodiment of the present invention, in order to quickly query the correspondence between the policy number and the business database, the correspondence can also be stored in a search engine. As an example, the search engine includes Elasticsearch (ES). ES is an open source search engine with distributed multi-user capabilities.
[0118] In one embodiment of the present invention, to avoid duplicate storage of data for the same policy, the policy number can be stored in a Redis database, thereby eliminating duplicate policy numbers. For example, if the policy number is found to already exist in the Redis database, the policy data is not saved; if the policy number is not found to already exist in the Redis database, the policy data is saved.
[0119] In an embodiment of the present invention, after the policy data is stored in the business database, the application's search engine can be used to retrieve the database sharding list in the sharding rule configuration based on the policy number and connect to the database connection pool. As an example, the search engine is ES.
[0120] That is, in the application, the database shard list is obtained based on the policy number and connected to the database connection pool in the application. It should be noted that the shard rule configuration is set according to the policy channel and / or product number. This is because when it is necessary to operate the same channel product, or the same product, the data of the same channel product and / or the same product will usually be stored in the same business database, making it easier to retrieve business data.
[0121] S102. Determine the business database where the policy data is stored according to the database sub-library list, where the data in the business database belongs to the same channel and / or product number.
[0122] The business database identifier is recorded in the database sub-library list, and the business database in which the policy data is stored can be determined based on the policy number. Subsequently, the policy data can be stored in the business database.
[0123] It should be noted that since the database partitioning rule configuration is set according to the channel and / or product number of the insurance policy, the data stored in the business database belongs to the same channel and / or product number.
[0124] For example, business database 1 stores data for insurance policies with channel number A01 and product number B02. This allows users to retrieve data for multiple policies at once when processing policies with channel number A01 and product number B02. This eliminates the need to retrieve data for policies with channel number A01 and product number B02 from multiple different databases.
[0125] In one embodiment of the present invention, if the business database is not found in the database sub-category, it is necessary to search the business database through the index table.
[0126] See also Figure 8 , Figure 8 1 is a schematic diagram of a process for querying an identifier of a service database according to an embodiment of the present invention, specifically including:
[0127] S801. According to the database sub-library list, the business database storing the insurance policy data is not found.
[0128] According to the database sub-library list, the business database where the insurance policy data is stored is not found, which means that the insurance policy number of the insurance policy is not stored in the database sub-library list.
[0129] S802. In the index database, determine the index table based on the policy number.
[0130] The index library stores the correspondence between policy numbers and business databases. Furthermore, an index table can be determined in the index library based on the policy number of the policy. As an example, the index table can be determined based on the policy number using the formula in S701. The determined index table stores the correspondence between the policy number and the business database.
[0131] S803. In the index table, find the identifier of the business database corresponding to the policy number.
[0132] In the index table, the identifier of the business database corresponding to the policy number is found based on the policy number.
[0133] exist Figure 8 In the embodiment, if the business database is not found in the database sub-library list, the business database can be found in the index table.
[0134] In one embodiment of the present invention, if the identifier of the business database corresponding to the policy number is not found in the index table based on the policy number, all business databases in the sub-database rule configuration can be polled to query the policy data.
[0135] S103. Connect to the business database through the database connection pool, query the policy data to process the business data.
[0136] Based on the business database found, the application switches its connection to the database using a database connection pool. The application then searches for policy data in the business database and processes the business data based on the policy data. For example, the application performs a business operation based on the policy data.
[0137] In one embodiment of the present invention, when the data of a product policy needs to be processed separately, the following solution can be adopted. It should be noted that the difference between the separate processing method and obtaining data from the business database is that the database sub-library list is polled to query all the data of the product policy.
[0138] The application receives the channel number and product number of the product to be processed, or the application processes certain products in a fixed manner, reads the product configuration that needs to be processed by the application from the configuration, and obtains the channel number and product number.
[0139] The database sharding rule configuration is obtained from the cache according to the business ID of the insurance policy to determine the database sharding list.
[0140] The application polls the database sub-database list, first connects to the first business database, queries the insurance policy data in the business database, and performs business processing.
[0141] After the processing of the first business database is completed, switch to the next business database in the database sub-database list, query the data of the insurance policy in the currently connected business database, and perform business processing.
[0142] Switch to the next business database in the database sub-library list again until all business databases in the database sub-library list are processed.
[0143] In one embodiment of the present invention, considering the limited storage capacity of the original business database, it is necessary to add a business database on the basis of the original business database, that is, to expand the database.
[0144] First, add a new business database in the configuration center. That is, according to the business ID of the insurance policy, add the business database ID to the database list in the database sharding rule configuration. The business ID includes the channel number and / or product number.
[0145] As an example, a developer logs in to the configuration center, modifies the existing sharding rule configuration according to the business ID, and adds a new business database. After the modification is complete, the configuration center automatically updates the configuration and pushes the updated sharding rule configuration to the relevant applications. The applications receive the updated sharding rule configuration and create a database connection pool to connect to the newly added business database. After receiving the insurance policy data, the applications recalculate the business database ID for the data based on the updated sharding rule configuration, and thus select the newly added business database.
[0146] When querying policy data, the corresponding relationship between the policy number and the business database is found through the search engine and index library. The storage location of historical policy data remains unchanged, so there is no need to migrate data.
[0147] After receiving the policy number, if you need to query the policy data, you can use the policy ID to obtain the newly added database shard list in the shard rule configuration through the search engine. Then, you can query the policy data according to the updated database shard list, i.e. the newly added database list.
[0148] In the above-mentioned embodiment of the present invention, according to the policy number of the insurance policy, the database sub-library list in the sub-library rule configuration is obtained in the search engine of the application, and the database connection pool is connected. The sub-library rule configuration is set according to the channel and / or product number of the insurance policy; according to the database sub-library list, the business database where the data of the insurance policy is stored is determined, and the data in the business database belongs to the same channel and / or product number; the business database is connected through the database connection pool, and the business data of the insurance policy is queried to process the business data. The data of the insurance policy is stored in the corresponding business database according to the policy number, and the business data can be directly obtained from the business database according to the policy number, because the business database data belongs to the same channel and / or product number. As the number of insurance policies increases, data is still queried from the same business database, and the speed of obtaining business data is not affected, thereby improving the data processing speed and meeting the processing requirements of actual insurance policy data.
[0149] See also Figure 9 , Figure 9 is a schematic diagram of processing business data according to an embodiment of the present invention. Figure 9 In the project, there are eight applications responsible for processing business data: one index library, seven business databases, one Redis database, and one ES. The configuration center is the infrastructure responsible for pushing configurations to each application.
[0150] Figure 9 In the embodiment, the embodiment of the present invention is used in the installment platform system as a data storage solution.
[0151] The following describes the implementation process of the embodiment of the present invention in the installment platform by taking the example of storing the data of the insurance policies of two products and processing the deduction business of the two products.
[0152] There is a partner channel, channel number: A01, which sells two installment products, product numbers: B01 and B02. After the policy is issued, the installment payment plan must be pushed to the installment platform, which will then automatically deduct the payment according to the payment plan.
[0153] First, the policy data needs to be stored in the business server.
[0154] (1) The developer sets the database partitioning rules for two products in the configuration center. The configuration is as follows:
[0155] Configuration 1: A01+B01 are stored in business database 0 and business database 1, that is, the database sub-library list is: [db0,db1].
[0156] Configuration 2: A01+B02 are stored in business database 0, business database 1, and business database 2, that is, the database sub-database list: [db0,db1,db2].
[0157] (2) After the configuration is completed, push the database partitioning rule configuration to application 1 and application 2.
[0158] Application 1 processes product B01 of channel A01, receives database sharding rule configuration 1, and connects business database 0 and business database 1.
[0159] Application 2 processes product B02 of channel A01, receives sharding rule configuration 2, and connects to business databases 0, 1, and 2.
[0160] (3) The policy data is stored separately according to the database partitioning rules:
[0161] Product B01 of channel A01 is stored in business database No. 0 and business database No. 1.
[0162] Product B02 of channel A01 is stored in business database No. 0, business database No. 1, and business database No. 2.
[0163] (4) When automatic deduction is required, Application 1 and Application 2 respectively perform deductions for the two products, that is, first query the policy data and then process the above data.
[0164] Application 1 polls business database 0 and business database 1 to process the policy data for product B01.
[0165] Application 2 polls business databases 0, 1, and 2 to process the policy data for product B02.
[0166] (5) When the number of policies for a certain product is too large and the existing business database cannot handle it, capacity expansion can be performed.
[0167] For example, when the number of policies for product B01 increases, the original two databases, Business Database 0 and Business Database 1, cannot handle the workload. Developers can modify the database sharding rule configuration to store the A01+B01 policies in Business Database 0, Business Database 1, Business Database 3, and Business Database 4, i.e., the database sharding list is [db0, db1, db3, db4].
[0168] After modifying the configuration, push the database sharding rule configuration to the application again. Subsequent policy data can be stored in four databases: Business Database 0, Business Database 1, Business Database 3, and Business Database 4. The original data storage location remains unchanged. This operation can take effect immediately without downtime.
[0169] The technical solution of the embodiment of the present invention supports different automatic deduction rules for different installment products, and can add separate processing applications for products with large data volumes, speeding up the deduction process, ensuring that a large number of policies to be deducted are deducted in a timely manner, and avoiding premium loss.
[0170] During application, the technical solution in the embodiments of the present invention is adopted to support the allocation of business databases for specific data. When processing business data, the application does not need to connect to all business databases to query data. Instead, it only needs to query a limited number of databases according to the database partition list, which can significantly improve data processing speed.
[0171] Furthermore, the technical solutions in the embodiments of this invention solve the problem of storing massive amounts of data in separate databases. Theoretically, there is no upper limit to the amount of storage that can be supported, and the technology is highly versatile, making it applicable to other systems that require massive data storage. It supports elastic expansion of business databases without requiring downtime during the expansion process or migrating historical data after expansion, significantly reducing operational and maintenance workload and ensuring system continuity.
[0172] See also Figure 10 , Figure 10 is a schematic diagram of the main structure of an apparatus for processing business data according to an embodiment of the present invention. The apparatus for processing business data can implement a method for processing business data, such as Figure 10 As shown, the device for processing business data specifically includes:
[0173] Acquisition module 1001 is used to obtain the database sharding list in the sharding rule configuration according to the policy number of the insurance policy from the application search engine, and connect to the database connection pool. The sharding rule configuration is set according to the channel and / or product number of the insurance policy;
[0174] A determination module 1002 is configured to determine, according to the database sub-library list, a business database in which the policy data is stored, wherein the data in the business database belongs to the same channel and / or product number;
[0175] The processing module 1003 is used to connect to the business database through the database connection pool, query the data of the insurance policy to process the business data.
[0176] In one embodiment of the present invention, the acquisition module 1001 is further configured to add an identifier of a business database to the database partition list in the partition rule configuration according to the business identifier of the insurance policy, wherein the business identifier includes a channel number and / or a product number;
[0177] According to the policy number of the insurance policy, the database shard list newly added in the shard rule configuration is obtained in the search engine.
[0178] In one embodiment of the present invention, the acquisition module 1001 is further configured to acquire the database sharding list in the sharding rule configuration from the cache according to the service identifier of the insurance policy, and connect to the database connection pool;
[0179] Switch the business database according to the number of business databases in the database sub-library list,
[0180] After the policy data is stored in the business database, the business database connection is switched to the index library to store the corresponding relationship between the policy number of the policy and the business database in the index table, and the corresponding relationship is stored in the search engine.
[0181] In one embodiment of the present invention, the acquisition module 1001 is specifically configured to establish an index of a database sub-library list based on a hash value of the policy number when the number is greater than 1;
[0182] The index is used to determine the identifier of the business database in the database sub-library list to switch the business database.
[0183] In one embodiment of the present invention, the acquisition module 1001 is specifically configured to determine the table number of the index table based on the hash value of the policy number, where the index table is a horizontal sub-table;
[0184] The corresponding relationship between the policy number and the business database is stored in the index table corresponding to the table number.
[0185] In one embodiment of the present invention, the acquisition module 1001 is specifically used to save the policy number to the redis database to verify the duplication of the policy number.
[0186] In one embodiment of the present invention, the acquisition module 1001 is further configured to query the business database in which the data of the insurance policy is not stored according to the database sub-library list;
[0187] In the index database, an index table is determined based on the policy number;
[0188] In the index table, the identifier of the business database corresponding to the policy number is found.
[0189] Figure 11 An exemplary system architecture 1100 is shown to which the method for processing business data or the apparatus for processing business data according to an embodiment of the present invention can be applied.
[0190] like Figure 11 As shown, system architecture 1100 may include terminal devices 1101, 1102, and 1103, a network 1104, and a server 1105. Network 1104 is used to provide a medium for communication links between terminal devices 1101, 1102, and 1103 and server 1105. Network 1104 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0191] Users can use terminal devices 1101, 1102, and 1103 to interact with server 1105 via network 1104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 1101, 1102, and 1103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0192] The terminal devices 1101 , 1102 , and 1103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0193] Server 1105 may be a server that provides various services, such as a backend management server (for example only) that supports shopping websites browsed by users using terminal devices 1101, 1102, and 1103. The backend management server may analyze and process received data such as product information query requests, and feed back processing results (for example, target push information and product information—for example only) to the terminal device.
[0194] It should be noted that the method for processing business data provided in the embodiment of the present invention is generally executed by the server 1105 , and accordingly, the device for processing business data is generally set in the server 1105 .
[0195] It should be understood that Figure 11 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0196] Reference below Figure 12 , which shows a schematic structural diagram of a computer system 1200 of a terminal device suitable for implementing an embodiment of the present invention. Figure 12 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0197] like Figure 12 As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1202 or a program loaded from a storage unit 1208 into a random access memory (RAM) 1203. Various programs and data required for the operation of the system 1200 are also stored in the RAM 1203. The CPU 1201, the ROM 1202, and the RAM 1203 are connected to each other via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0198] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, and the like; an output section 1207 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and speakers; a storage section 1208 including a hard disk; and a communication section 1209 including a network interface card such as a LAN card or a modem. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the I / O interface 1205 as needed. Removable media 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 1210 as needed, so that computer programs read therefrom can be installed into the storage section 1208 as needed.
[0199] In particular, according to the embodiments disclosed herein, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed herein include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1209, and / or installed from a removable medium 1211. When the computer program is executed by the central processing unit (CPU) 1201, the above-mentioned functions defined in the system of the present invention are performed.
[0200] It should be noted that the computer-readable medium described in the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.
[0201] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0202] The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The modules described may also be provided in a processor. For example, they may be described as follows: a processor includes an acquisition module, a determination module, and a processing module. The names of these modules do not, in some cases, constitute a limitation on the module itself. For example, the acquisition module may also be described as "used to obtain the database sub-library list in the sub-library rule configuration in the search engine according to the policy number of the insurance policy, and connect to the database connection pool."
[0203] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiments, or may exist independently without being incorporated into the device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the device, the device includes:
[0204] Based on the policy number, the application's search engine is used to obtain the database sharding list in the sharding rule configuration, which is configured based on the policy channel and / or product number, and connect to the database connection pool.
[0205] Determining, according to the database sub-library list, the business database in which the policy data is stored, wherein the data in the business database belongs to the same channel and / or product number;
[0206] The business database is connected through the database connection pool to query the data of the insurance policy to process the business data.
[0207] According to the technical solution of an embodiment of the present invention, based on the policy number of the insurance policy, the database sub-library list in the sub-library rule configuration is obtained in the search engine of the application, and the database connection pool is connected, and the sub-library rule configuration is set according to the channel and / or product number of the insurance policy; according to the database sub-library list, the business database where the data of the insurance policy is stored is determined, and the data of the business database belongs to the same channel and / or product number; the business database is connected through the database connection pool, and the business data of the insurance policy is queried to process the business data. The data of the insurance policy is stored in the corresponding business database according to the policy number, and the business data can be directly obtained from the business database according to the policy number. The increase in insurance policies does not affect the speed of obtaining business data, so it can improve the data processing speed and meet the processing requirements of actual insurance policy data.
[0208] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A method for processing business data, characterized in that: include: Based on the policy number, the application's search engine is used to obtain the database sharding list in the sharding rule configuration, which is configured based on the policy channel and / or product number, and connect to the database connection pool. Determining, according to the database sub-library list, the business database in which the policy data is stored, wherein the data in the business database belongs to the same channel and / or product number; Connecting to the business database through the database connection pool to query the data of the insurance policy to process the business data; The method further comprises: According to the policy's business ID, the database sharding list in the sharding rule configuration is obtained from the cache and connected to the database connection pool; Switch the business database according to the number of business databases in the database sub-library list, After the business database stores the data of the insurance policy, switching the business database connection to the index library to store the corresponding relationship between the policy number of the insurance policy and the business database in the index table, and storing the corresponding relationship in the search engine; According to the database sub-library list, the business database storing the policy data is not found; In the index database, an index table is determined based on the policy number; In the index table, the identifier of the business database corresponding to the policy number is found.
2. The method for processing business data according to claim 1, characterized in that: The method further comprises: According to the business ID of the insurance policy, the business database ID is added to the database sub-library list in the sub-library rule configuration. The business ID includes the channel number and / or product number. After receiving the policy number of the policy in question, also include: According to the policy number of the insurance policy, the database shard list newly added in the shard rule configuration is obtained in the search engine.
3. The method for processing business data according to claim 1, characterized in that: The switching of the business database according to the number of the business databases in the database sub-library list includes: If the number is greater than 1, an index of the database sub-library list is established based on the hash value of the policy number; The index is used to determine the identifier of the business database in the database sub-library list to switch the business database.
4. The method for processing business data according to claim 1, characterized in that: The corresponding relationship between the policy number of the insurance policy and the business database is stored in the index table, including: Determine the table number of the index table based on the hash value of the policy number, where the index table is a horizontal sub-table; The corresponding relationship between the policy number and the business database is stored in the index table corresponding to the table number.
5. The method for processing business data according to claim 1, characterized in that: The method further comprises: The policy number is saved in the redis database to verify the duplication of the policy number.
6. A device for processing business data, characterized in that: include: An acquisition module is used to obtain, in the search engine of the application, a list of database sub-libraries in the sub-library rule configuration according to the policy number of the insurance policy, and connect to the database connection pool, wherein the sub-library rule configuration is set according to the channel and / or product number of the insurance policy; and, according to the business identifier of the insurance policy, obtain the list of database sub-libraries in the sub-library rule configuration from the cache and connect to the database connection pool; switch the business database according to the number of business databases in the database sub-library list, and after the business database stores the data of the insurance policy, switch the business database connection to the index library to store the corresponding relationship between the policy number of the insurance policy and the business database in the index table, and store the corresponding relationship in the search engine; Furthermore, according to the database sub-library list, the business database storing the data of the insurance policy is not found; In the index database, an index table is determined based on the policy number; In the index table, the identifier of the business database corresponding to the policy number is searched; a determination module, configured to determine, according to the database sub-library list, a business database in which the data of the insurance policy is stored, wherein the data in the business database belongs to the same channel and / or product number; The processing module is used to connect to the business database through the database connection pool, query the data of the insurance policy to process the business data.
7. An electronic device for processing business data, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.
8. A computer-readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Business rule control method, device, equipmentand storage medium
CN109325843A
Data access method and apparatus
CN109460409A
Data processing method and data processing device
CN112835904A