Business data query method and device, equipment, storage medium and program product
By receiving business query requests and obtaining change log information, and updating candidate data mirror tables, the real-time problem of banking business data query is solved, real-time query and data consistency of banking business data is realized, and query timeliness and system performance is improved. .
Patent Information
- Application Number
- CN202411522009.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2024-12-27
AI Technical Summary
In the existing technology, the real-time query of banking business processing data is poor, and it takes T+1 day to query omni-channel business processing data, and real-time query cannot be realized.
By receiving service query requests, target service data is determined based on service query conditions and multiple candidate data mirror tables, and change log information of target service data tables of each service channel is obtained, and the change log information is parsed based on streaming calculations, and update it Candidate data mirroring table to realize real-time data synchronization.
Real-time query of customer business processing data is realized, the timeliness of business data query is improved, and the load on various business channel systems is reduced to ensure data consistency.
Smart Images

Figure CN119201992A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a business data query method, device, equipment, storage medium and program product. Background Art
[0002] With the rapid development of banking business, business processing can be carried out through multiple business channels. For example, when handling the purchase of items, it can be handled through various business channels such as high counters, low counters, personal online banking, bank mobile phones, and e-commerce websites within the bank. Customers' business processing data is also stored in different databases of multiple business channels. Therefore, how to query omni-channel business processing data has become an urgent problem to be solved.
[0003] In the prior art, each business channel uploads the customer's business processing data to the data warehouse, uses batch tasks to process reports, and then queries the business processing data of all channels on T+1 day.
[0004] However, using existing technologies, it takes T+1 day to query a customer's business processing data, and the real-time performance of data query is poor. Summary of the invention
[0005] Based on this, it is necessary to provide a business data query method, device, equipment, storage medium and program product that can query the customer's business processing data in real time to address the above technical problems.
[0006] In a first aspect, the present application provides a business data query method, comprising:
[0007] Receiving a business query request, wherein the business query request includes a business query condition;
[0008] Determine the target business data corresponding to the business query request according to the business query condition and multiple candidate data mirror tables; wherein the multiple candidate data mirror tables are mirror tables corresponding to the business data tables of multiple business channels;
[0009] Output target business data;
[0010] The method further includes:
[0011] For each business channel, obtain the change log information corresponding to the target business data table of the business channel; wherein the target business data table is the business data table corresponding to the business channel where the change operation occurs; and perform change processing on the candidate data mirror table corresponding to the target business data table of the business channel according to the change log information.
[0012] In one embodiment, the method further comprises:
[0013] Business data tables of multiple business channels are obtained; and multiple candidate data mirror tables are constructed according to the business data tables of the multiple business channels.
[0014] In one embodiment, obtaining change log information corresponding to a target business data table of a business channel includes:
[0015] Collect the change log information corresponding to the target business data table of the business channel, and store the change log information in the message queue; obtain the change log information from the message queue in sequence.
[0016] In one embodiment, performing a change process on a candidate data mirror table corresponding to a target business data table of a business channel according to the change log information includes:
[0017] Based on streaming computing, the change log information is parsed and processed to obtain the candidate data mirror table and the target change operation type corresponding to the target business data table of the business channel; the business data in the candidate data mirror table is changed according to the target change operation type.
[0018] In one embodiment, the business query condition includes a first business query condition and a second business query condition, and determining target business data corresponding to the business query request according to the business query condition and a plurality of candidate data mirror tables includes:
[0019] According to the first business query condition and the plurality of candidate data mirror tables, a target query result is determined; according to the second business query condition and the target query result, target business data is determined.
[0020] In one embodiment, determining a target query result according to a first business query condition and a plurality of candidate data mirror tables includes:
[0021] According to the first business query condition and multiple candidate data mirror tables, at least one target data mirror table and candidate query results corresponding to the target data mirror table are determined; according to the candidate query results corresponding to the at least one target data mirror table, a target query result is determined.
[0022] In one of the embodiments, the at least one target data mirror table includes a plurality of target data mirror tables, and determining the target query result according to the candidate query result corresponding to the at least one target data mirror table includes:
[0023] The candidate query results corresponding to the multiple target data mirror tables are merged to obtain the target query result.
[0024] In a second aspect, the present application also provides a business data query device, including:
[0025] A receiving module, used to receive a business query request, wherein the business query request includes a business query condition;
[0026] A determination module, used to determine the target business data corresponding to the business query request according to the business query conditions and multiple candidate data mirror tables; wherein the multiple candidate data mirror tables are mirror tables corresponding to the business data tables of multiple business channels;
[0027] Output module, used for outputting target business data;
[0028] The change module is used to obtain the change log information corresponding to the target business data table of the business channel for each business channel; wherein the target business data table is the business data table corresponding to the business channel where the change operation occurs; and perform change processing on the candidate data mirror table corresponding to the target business data table of the business channel according to the change log information.
[0029] In one of the embodiments, the device further includes a construction module, the construction module being used to obtain business data tables of multiple business channels; and construct multiple candidate data mirror tables according to the business data tables of the multiple business channels.
[0030] In one of the embodiments, the change module is specifically used to collect change log information corresponding to the target business data table of the business channel, and store the change log information in the message queue; and obtain the change log information from the message queue in sequence.
[0031] In one of the embodiments, the change module is specifically used to parse and process the change log information based on streaming computing to obtain a candidate data mirror table and a target change operation type corresponding to a target business data table of a business channel; and perform change processing on the business data in the candidate data mirror table according to the target change operation type.
[0032] In one of the embodiments, the business query condition includes a first business query condition and a second business query condition, and the determination module is specifically used to determine the target query result according to the first business query condition and multiple candidate data mirror tables; and determine the target business data according to the second business query condition and the target query result.
[0033] In one of the embodiments, the determination module is specifically used to determine at least one target data mirror table and candidate query results corresponding to the target data mirror table based on the first business query condition and multiple candidate data mirror tables; and determine the target query result based on the candidate query results corresponding to the at least one target data mirror table.
[0034] In one of the embodiments, at least one target data mirror table includes multiple target data mirror tables, and the determination module is specifically used to merge candidate query results corresponding to the multiple target data mirror tables to obtain the target query result.
[0035] In a third aspect, the present application further provides a business data query device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, any of the methods described in the first aspect is implemented.
[0036] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the methods described in the first aspect above.
[0037] In a fifth aspect, the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements any of the methods described in the first aspect above.
[0038] The above-mentioned business data query method, device, equipment, storage medium and program product receive a business query request, wherein the business query request includes a business query condition, and then determine the target business data corresponding to the business query request according to the business query condition and multiple candidate data mirror tables, wherein the multiple candidate data mirror tables are mirror tables corresponding to the business data tables of multiple business channels, and finally output the target business data. At the same time, for each business channel, the change log information corresponding to the target business data table of the business channel is obtained; wherein the target business data table is the business data table corresponding to the business channel where the change operation occurs; and the candidate data mirror table corresponding to the target business data table of the business channel is changed according to the change log information. In this way, by establishing a candidate data mirror table, the business data isolated from each other between various business channels are updated in the mirror table in a timely manner, and then the target business data is determined from the candidate data mirror table according to the received business query request, which can provide real-time omni-channel customer business data query, improve the timeliness of business data query, and at the same time, convert the original data query for each business channel into a merged query mirror table, which can reduce the load of the system corresponding to each business channel, and when the target business data table changes, its change log information is obtained in time, and the corresponding candidate data mirror table is changed according to the change log information. In this way, the data in the mirror table can be updated in time, so that the candidate data mirror table is completely consistent with the data in the business data table, ensuring that the target business data can be determined based on the business query request and multiple candidate data mirror tables in the future. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0040] FIG1 is an application environment diagram of a business data query method in one embodiment;
[0041] FIG2 is a schematic diagram of a flow chart of a business data query method in one embodiment;
[0042] FIG3 is a schematic diagram of a flow chart of a business data query method in another embodiment;
[0043] FIG4 is a schematic diagram of a flow chart of a business data query method in another embodiment;
[0044] FIG5 is a flow chart of the steps of obtaining change log information in one embodiment;
[0045] FIG6 is a flow chart of steps for changing a candidate data mirror table in one embodiment;
[0046] FIG7 is a schematic diagram of a process for determining target business data in one embodiment;
[0047] FIG8 is a schematic diagram of a process for determining a target query result in one embodiment;
[0048] FIG9 is a schematic diagram of a flow chart of a business data query method in another embodiment;
[0049] FIG10 is a system architecture diagram of a business data query method in one embodiment;
[0050] FIG11 is a structural block diagram of a service data query device in one embodiment;
[0051] FIG. 12 is a diagram showing the internal structure of a business data query device in one embodiment. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. It should be noted that in the embodiments of the present application, certain software, groups, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0053] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations. The acquisition, storage, use, and processing of data in the technical solution of this application are in compliance with relevant provisions of national laws and regulations.
[0054] The business data query method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The business data query method provided in the embodiment of the present application can be applied to the server 104, and can also be implemented through the interaction between the terminal 102 and the server 104. The server 104 sends a business query request by receiving the terminal 102, wherein the business query request includes a business query condition, and then the server 104 determines the target business data corresponding to the business query request according to the business query condition and multiple candidate data mirror tables, wherein the multiple candidate data mirror tables are mirror tables corresponding to the business data tables of multiple business channels, and finally, the server 10 outputs the target business data to the terminal 102. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices, and the Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. The portable wearable device may be a smart watch, a smart bracelet, a head-mounted device, etc. The head-mounted device may be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server 104 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0055] In an exemplary embodiment, as shown in FIG2 , a business data query method is provided, which is described by taking the method applied to the server in FIG1 as an example, and includes the following steps 201 to 203. Among them:
[0056] Step 201: receiving a service query request.
[0057] The service query request includes service query conditions.
[0058] Optionally, a service query request may be sent through a terminal, and the format of the service query request may be formed according to a preset request format. For example, the service query request may include a current requesting user identifier, a request time, a service query condition, and the like.
[0059] Optionally, when receiving a business query request, an authorization authentication can be performed according to the current requesting user ID, and the business query request can be processed after the authorization authentication is passed. If the authorization authentication fails, the business query request is rejected. It is understandable that the current requesting user can be a bank staff member, or a public customer or a private customer, and this embodiment of the application does not limit this.
[0060] Optionally, the business query conditions may include information such as query conditions, sorting methods or paging parameters. The query conditions may be information that defines data filtering rules, such as time range, specific numerical value or text matching, etc. The sorting method may determine the display order of the target business data. For example, common sorting methods include descending and ascending. Single or multiple fields can be sorted as needed. For example, the target business data can be sorted in order from high to low order volume; the paging parameters may include the current page number and the number of records displayed per page. When processing a large amount of data, loading all records at once to the terminal front-end page for display may cause performance problems. Therefore, the paging parameters can be used to load only part of the target business data each time the page is scrolled or clicked, instead of loading all the target business data at once.
[0061] Optionally, for private customers, the query conditions may include business category, transaction channel, evidence type, evidence number, customer name, query date range and other conditions; for corporate customers, the query conditions may include business category, transaction channel, corporate current account, customer name, query date range and other conditions.
[0062] Optionally, the business query condition may also include a query field, which may be a field that is desired to be included in the target business data. The user may clearly indicate which fields are important or required when performing a business query, which may optimize query performance and reduce unnecessary data transmission, thereby improving query efficiency. It is understandable that when the user sends a business query request at the terminal, the user may select a query field according to the information that the user wants to query, and when the user does not select a query field, the target business data may be returned according to the default query field.
[0063] Step 202: Determine the target business data corresponding to the business query request according to the business query condition and a plurality of candidate data mirror tables.
[0064] The multiple candidate data mirror tables are mirror tables corresponding to the business data tables of the multiple business channels.
[0065] Optionally, multiple business channels correspond to different business systems, and the business data tables of the corresponding business channels are stored in different databases, that is, the business data tables are isolated from each other and cannot be merged in real time during business queries. Multiple candidate data mirror tables are in the same database, which can also be a distributed database. Each business data table in each business channel has a corresponding candidate data mirror table in the distributed database, and the structure and data of the business data table are exactly the same as those of the corresponding candidate data mirror table, and they are changed in time with the changes of the business data table. It can be understood that the candidate data mirror table is a copy of the business data table.
[0066] Optionally, the change of the candidate data mirror table is introduced below. As shown in FIG. 3 , the candidate data mirror table is changed in time with the change of the business data table, which may include the following steps 301 to 302, wherein:
[0067] Step 301: For each business channel, obtain the change log information corresponding to the target business data table of the business channel.
[0068] The target business data table is the business data table corresponding to the business channel where the change operation occurs.
[0069] Optionally, change log information of each business channel may be collected in real time. The target business data table may be a business data table in which data has changed. The types of changes may include addition (INSERT), deletion (DELETE) and update (UPDATE). The types of changes may also include changes in the table structure, such as adding, deleting or modifying fields in the table.
[0070] Alternatively, real-time acquisition can be the process of automatically and continuously collecting, processing, and transmitting data without human intervention, and committed changes can be obtained from database logs.
[0071] Optionally, to obtain the change log information corresponding to the target business data table of the business channel, you can configure the database parameters to actively send the database log to the collector for processing, such as MySQL's binlog and Oracle's AWR report. You can also use the database's audit function or third-party tools to monitor database operation events and capture and process log data in real time. You can also use database log collection tools, such as CANEL, Logstash, Fluentd, etc., which can support multiple databases and formats.
[0072] Optionally, when adding query logic, you only need to configure the collection of change log information of the business channel database, and there is no need to modify the transaction program of the business channel, which can improve the stability of the business channel transaction system.
[0073] Step 302: Perform change processing on the candidate data mirror table corresponding to the target business data table of the business channel according to the change log information.
[0074] Optionally, the change log information can be analyzed to determine the specific type of change and the specific change data, and then the candidate data mirror table corresponding to the target business data table can be changed according to the specific type of change and the specific change data, so that when the business data table changes, the change can be synchronized to the candidate data mirror table in time to ensure that the business data in the business data table and the candidate data mirror table are completely consistent.
[0075] For each business channel, the change log information corresponding to the target business data table of the business channel is obtained, and then the candidate data mirror table corresponding to the target business data table of the business channel is changed according to the change log information. In this way, the database change log information can be collected in real time and the candidate data mirror table can be changed. The candidate data mirror table completely follows the change operation of the business data table without manual intervention. In this way, real-time business data query can be provided for all channels, effectively improving the query timeliness.
[0076] Optionally, since the structure and data in the candidate data mirror table are exactly the same as those in the business data table, after determining the business query conditions in the business query request, multiple candidate data mirror tables can be determined according to the business query conditions, and the target business data can be queried from the candidate data mirror tables according to the business query conditions.
[0077] Optionally, the business data in the candidate data mirror table corresponding to each business channel can be merged according to the data service, wherein the data service can be a service for querying and retrieving various data sources, enabling users to easily obtain the required target business data, thereby supporting various data analysis and applications. The data service has the advantages of multiple data source support, unified query interface and efficient query.
[0078] Step 203: output target business data.
[0079] In a possible implementation, the target business data may be output to a terminal, and the target data may be displayed through a front-end page of the terminal.
[0080] In another possible implementation, the target business data can be output in the form of a table or other type of file format. It can be understood that the user can obtain the target business data by clicking a download button, download the target business data to a terminal storage medium, or output the target business data to the user via email or message push.
[0081] The above-mentioned business data query method receives a business query request, wherein the business query request includes a business query condition, and then determines the target business data corresponding to the business query request according to the business query condition and multiple candidate data mirror tables, wherein the multiple candidate data mirror tables are mirror tables corresponding to the business data tables of multiple business channels, and finally outputs the target business data. In this way, by establishing a candidate data mirror table, the business data isolated from each business channel is updated in the mirror table in a timely manner, and then the target business data is determined from the candidate data mirror table according to the received business query request, which can provide real-time omni-channel customer business data query, improve the timeliness of business data query, and at the same time, convert the original data query for each business channel into a merged query mirror table, which can reduce the load of the system corresponding to each business channel.
[0082] In an exemplary embodiment, optionally, as shown in FIG4 , the method further includes the following steps 401 to 402. Among them:
[0083] Step 401, obtaining business data tables of multiple business channels.
[0084] Optionally, the obtained business data tables of the multiple business channels may include table structures and table data of the business data tables.
[0085] Optionally, when obtaining the table structure of each business data table, the table structure of the business data table of each business channel can be exported to a table structure SQL file by using the export function of a database management tool or by performing an export operation through a database command line interface. The table structure of each business data table can also be obtained from the design document of the business system corresponding to each business channel, or the table structure of each business data table can be obtained by parsing the log information of each database.
[0086] Optionally, when obtaining the table data of each business data table, you can also use the export function of the database management tool or perform an export operation through the database command line interface to export the table data of the business data table of each business channel into a table data SQL file. You can also obtain the table data of each business data table by parsing the log information of each database.
[0087] Step 402: construct multiple candidate data mirror tables based on the business data tables of multiple business channels.
[0088] Optionally, the table structures in multiple table structure SQL files are imported into the target database respectively, and multiple candidate data mirror tables are constructed in the target database. After the import is completed, the business data in the multiple table data SQL files can be imported into the corresponding candidate data mirror tables in the target database respectively. The import operation can be performed through the import function of the database management tool or through the command line interface, which is not limited to this in the embodiments of the present application.
[0089] Optionally, the target database can be a distributed database, which can be a database system that stores business data on multiple computer nodes and connects them together through a network. Each node can process data requests independently, and the nodes can work together to improve performance and reliability. Distributed databases have the advantages of high scalability, high availability, and high concurrency, and are suitable for processing large-scale data and high-load applications. Common distributed databases include Google Spanner, TiDB, OLTP transaction library, and OLAP data analysis library.
[0090] By acquiring business data tables of multiple business channels and constructing multiple candidate data mirror tables according to the business data tables of multiple business channels, candidate data mirror tables corresponding to each business data table can still be constructed even after each business channel has been online for a period of time, and candidate data mirror tables can be constructed more flexibly.
[0091] In an exemplary embodiment, optionally, as shown in FIG5 , obtaining the change log information corresponding to the target business data table of the business channel includes the following steps 501 to 502 . Among them:
[0092] Step 501: collect change log information corresponding to the target business data table of the business channel, and store the change log information in a message queue.
[0093] Optionally, the log information of the database corresponding to each business channel can be collected in real time through a database log collection tool. After collecting the change log information corresponding to the target business data table of the business channel, the change log information is sent to the message queue in real time.
[0094] Optionally, the message queue can be a message system, which can be used to implement asynchronous communication technology between systems in a distributed system. The message system allows information to be exchanged between different components by sending and receiving messages, thereby achieving decoupling and parallel processing. The message system can be Apache Kafka, RabbitMQ, ActiveMQ, RocketMQ or Redis, etc. The embodiment of the present application does not limit the type of message system.
[0095] Step 502, obtaining change log information from the message queue in order.
[0096] Optionally, after the change log information is collected, the change log information may be stored in a message queue, and then the change log information may be obtained from the message queue in the order in which it is stored.
[0097] Optionally, when obtaining the change log information from the message queue, the change log information may be obtained on demand according to the processing capability and processing speed of the server.
[0098] In the above, the change log information corresponding to the target business data table of the business channel is collected, and the change log information is stored in the message queue, and the change log information is obtained from the message queue in sequence. In this way, by introducing the intermediate service layer of the message queue, the coupling between the producer (i.e., the log collector) and the consumer (the candidate data mirror table change processor) is reduced, and the flexibility and scalability of the business data query method can be improved. It can be understood that the log collector and the candidate data mirror table change processor both belong to the system corresponding to the business data query method. At the same time, the change log information is stored in the form of message backlog, and the downstream service pulls the message consumption according to its own processing capacity, which can avoid the collapse of the downstream service due to too dense and too large a number of change log information. In addition, the message queue has the advantages of high availability, reliability, and persistent storage, which can ensure that each change of the business data table can be synchronized to the corresponding candidate data mirror table in time.
[0099] In an exemplary embodiment, optionally, as shown in FIG6 , performing a change process on the candidate data mirror table corresponding to the target business data table of the business channel according to the change log information includes the following steps 601 to 602. Among them:
[0100] Step 601: parse and process the change log information based on streaming computing to obtain a candidate data mirror table corresponding to a target business data table of a business channel and a target change operation type.
[0101] Optionally, stream computing can be a technology for processing large amounts of data streams in real time. It can process change log information immediately when it is obtained. Unlike traditional big data batch processing technology, there is no need to wait for data to accumulate to a certain level before processing. Stream computing has the advantages of low latency and high throughput when processing real-time change log information. Stream computing can be implemented based on a stream computing framework. Common stream computing frameworks, such as Apache Flink, provide a wealth of application programming interfaces (Application Programming Interface) and tools.
[0102] Optionally, when parsing the change log information, a corresponding parsing method can be selected according to the specific format and content structure of the change log information to parse the change log information to determine the candidate data mirror table and the target change operation type corresponding to the target business data table of the business channel, where the target change operation type can include addition, deletion and update, and can also include changes in table structure, etc.
[0103] Exemplarily, the content structure of the change log information may be a JSON string, which records the change information in a key-value format.
[0104] Step 602: Perform change processing on the business data in the candidate data mirror table according to the target change operation type.
[0105] It is understandable that when the business data in the candidate data mirror table is changed, the SQL statement executed is the same as the SQL statement executed in the target business data table.
[0106] Optionally, after determining the candidate data mirror table corresponding to the target business data table, the business data in the candidate data mirror table can be changed according to the target change operation type. For example, when the target change operation type is addition, the corresponding SQL statement for adding business data obtained by parsing the change log information is executed to also perform the addition operation on the candidate data mirror table; when the target change operation type is update, the corresponding SQL statement for updating business data obtained by parsing the change log information is executed to also perform the update operation on the candidate data mirror table. Other target change operation types are not further described here.
[0107] Optionally, by collecting change log information in real time and sending it to a message queue, the change log information in the message queue is read and processed in real time based on streaming computing. Since there is only a real-time collection link between the candidate data mirror table and the target business data table, the synchronization delay is very small.
[0108] The above-mentioned streaming computing-based analysis and processing of the change log information obtains the candidate data mirror table and the target change operation type corresponding to the target business data table of the business channel, and the business data in the candidate data mirror table is changed according to the target change operation type. In this way, the business data table can be completely consistent with the business data in the corresponding candidate data mirror table, and omni-channel business data query can be realized based on the candidate data mirror table, thereby improving the timeliness of business data query.
[0109] In an exemplary embodiment, optionally, as shown in FIG7 , the business query condition includes a first business query condition and a second business query condition, and according to the business query condition and a plurality of candidate data mirror tables, determining the target business data corresponding to the business query request includes the following steps 701 to 702. Among them:
[0110] Step 701: determine a target query result according to a first business query condition and a plurality of candidate data mirror tables.
[0111] Optionally, the business query condition may include a first business query condition and a second business query condition, wherein the first business query condition may include a query condition and a query field, and the second business query condition may include a sorting method and a paging parameter.
[0112] Optionally, as shown in FIG8 , determining the target query result according to the first business query condition and a plurality of candidate data mirror tables includes the following steps 801 to 802 . Among them:
[0113] Step 801: Determine at least one target data mirror table and candidate query results corresponding to the target data mirror table according to a first business query condition and a plurality of candidate data mirror tables.
[0114] Optionally, dynamic SQL is used to dynamically combine SQL statement blocks according to the first business query condition to meet different query condition requirements, wherein dynamic SQL refers to the technology of dynamically generating and executing SQL statements during query. Compared with static SQL, dynamic SQL has higher flexibility and scalability, and can generate different SQL statements according to changes such as the input first business query condition.
[0115] Optionally, the candidate data mirror table includes business data tables of various business channels, and there are multiple business data tables in one business channel. The business data types stored in the multiple business data tables in one business channel are different. At least one target data mirror table can be determined according to the first business query condition, and the corresponding candidate query results can be queried from the target data mirror table according to dynamic SQL.
[0116] Optionally, if there are multiple target data mirror tables, they may be business data tables in each business channel, or multiple business data tables in one business channel, which is not limited in this embodiment of the present application.
[0117] Step 802: Determine a target query result according to the candidate query result corresponding to at least one target data mirror table.
[0118] Optionally, when there is only one target data mirror table, the candidate query result corresponding to the target data mirror table may be used as the target query result.
[0119] Optionally, when the at least one target data mirror table includes multiple target data mirror tables, candidate query results corresponding to the multiple target data mirror tables are merged to obtain a target query result.
[0120] In one possible implementation, if multiple target data mirror tables only include multiple business data tables in one business channel, the JOIN keyword can be used for a joint query to combine the data of multiple business data tables in one business channel to obtain a candidate query result for the business channel, and use the candidate query result as the target query result.
[0121] In another possible implementation, if multiple target data mirror tables include business data tables in multiple business channels, candidate query results for each business channel may be determined, and then the candidate query results for each business channel may be merged using the UNION ALL keyword to obtain the target query result.
[0122] Optionally, when merging the candidate query results, fields with the same business meaning in different business channels are copied to the same field. For fields unique to a certain business channel, other business channels return null values. For example, the candidate query results of the target data mirror table corresponding to business channel A have fields 1 and 2, and the candidate query results of the target data mirror table corresponding to business channel B have fields 1 and 3. The target query results may be shown in Table 1 below:
[0123] Table 1
[0124]
[0125] It is understandable that only two tables of two business channels are used as an example to illustrate the main processing logic. Multiple tables of multiple business channels can be processed in a similar way, which will not be elaborated here.
[0126] Step 702: Determine target business data according to the second business query condition and the target query result.
[0127] Optionally, the target query results may be sorted or paged according to the second business query condition to obtain target business data.
[0128] Exemplarily, according to the second business query condition and the target query result, the processing logic for determining the target business data may be as follows:
[0129] Candidate query results corresponding to business channel A
[0130] UNION ALL
[0131] Candidate query results corresponding to business channel B
[0132] ORDER BY order_column1, order_column2,…
[0133] Limit $(page_size) OFFSET $(page_start)
[0134] Among them, UNION ALL is used to merge two candidate query results, ORDER BY is used to sort the merged candidate query results, order_column1 and order_column2 are the sorting parameters in the second business query condition. By default, they are sorted in ascending order according to the sorting parameters. You can also use the statement "ORDER BY order_column1 DESC" to sort the candidate query results in descending order according to the sorting parameters. LIMIT...OFFSET... is used to control the number of query results returned and the starting position. The paging parameter page_size after LIMIT indicates the maximum number of rows to be returned, and the paging parameter page_start after OFFSET indicates which row to start returning the results from. $ is a placeholder for parameterized queries, and # can also be used, that is, the above paging statement can also be expressed by LIMIT #{page_size} OFFSET #{page_start}.
[0135] Exemplarily, the candidate query results corresponding to business channel A can be determined by the following logic:
[0136] SELECT column1,column2,…
[0137] FROM Table 1'
[0138] WHERE judgment condition 1
[0139] <if test="”动态判断条件1”">Dynamic SQL statement 1< / if>
[0140] Among them, column1 and column2 can be query fields, table 1' is the target data mirror table corresponding to the target business data table, <if test="”动态判断条件1”"> Dynamic SQL statement 1< / if> "Use dynamic SQL to dynamically combine SQL statements according to query conditions, and the logic for determining the candidate query results corresponding to business channel B will not be repeated.
[0141] Optionally, the above embodiment provides an example of performing a simple query on Table 1' and then sorting and paging. The logic of the actual data service is the result set of a complex dynamic SQL query that associates multiple tables based on business needs. In actual use, the processing logic for determining the target business data can be determined based on the specific business logic.
[0142] As an optional implementation, as shown in FIG9 , the business data query method provided in the embodiment of the present application may include the following specific steps:
[0143] Step 901, obtaining business data tables of multiple business channels.
[0144] Step 902: construct multiple candidate data mirror tables based on the business data tables of multiple business channels.
[0145] Step 903: For each business channel, the change log information corresponding to the target business data table of the business channel is collected, and the change log information is stored in the message queue.
[0146] The target business data table is the business data table corresponding to the business channel where the change operation occurs.
[0147] Step 904, obtaining change log information from the message queue in order.
[0148] Step 905: parse and process the change log information based on streaming computing to obtain a candidate data mirror table corresponding to the target business data table of the business channel and a target change operation type.
[0149] Step 906: Perform change processing on the business data in the candidate data mirror table according to the target change operation type.
[0150] Step 907: receiving a service query request.
[0151] The service query request includes service query conditions, and the service query conditions include a first service query condition and a second service query condition.
[0152] Step 908: Determine at least one target data mirror table and candidate query results corresponding to the target data mirror table according to the first business query condition and the plurality of candidate data mirror tables.
[0153] The multiple candidate data mirror tables are mirror tables corresponding to the business data tables of the multiple business channels.
[0154] Step 909: merge the candidate query results corresponding to the multiple target data mirror tables to obtain the target query result.
[0155] Step 910: Determine target business data according to the second business query condition and the target query result.
[0156] Step 911, output target business data.
[0157] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0158] Optionally, as shown in Figure 10, it is a system architecture diagram corresponding to a possible business data query method, including multiple business channels, through real-time collection of log change information of each business channel, storing it in a message queue, obtaining change log information in real time based on streaming computing and parsing it, changing multiple candidate data mirror tables in the distributed database, and when receiving a business query request, determining the target business data from the candidate data mirror table according to the data service, and outputting the target business data to the terminal, and displaying the target business data on the front-end interface of the terminal.
[0159] Based on the same inventive concept, the embodiment of the present application also provides a business data query device for implementing the business data query method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more business data query device embodiments provided below can refer to the limitations on the business data query method above, and will not be repeated here.
[0160] In an exemplary embodiment, as shown in FIG. 11 , a business data query device 1100 is provided, comprising: a receiving module 1101, a determining module 1102, an output module 1103 and a changing module 1104, wherein:
[0161] The receiving module 1101 is used to receive a service query request, wherein the service query request includes a service query condition;
[0162] The determination module 1102 is used to determine the target business data corresponding to the business query request according to the business query condition and multiple candidate data mirror tables; wherein the multiple candidate data mirror tables are mirror tables corresponding to the business data tables of multiple business channels;
[0163] Output module 1103, used for outputting target business data;
[0164] The change module 1104 is used to obtain the change log information corresponding to the target business data table of the business channel for each business channel; wherein the target business data table is the business data table corresponding to the business channel where the change operation occurs; and perform change processing on the candidate data mirror table corresponding to the target business data table of the business channel according to the change log information.
[0165] In an exemplary embodiment, the device further includes a construction module, which is used to obtain business data tables of multiple business channels; and construct multiple candidate data mirror tables according to the business data tables of the multiple business channels.
[0166] In an exemplary embodiment, the change module 1104 is specifically used to collect change log information corresponding to the target business data table of the business channel, and store the change log information in the message queue; and obtain the change log information from the message queue in sequence.
[0167] In an exemplary embodiment, the change module 1104 is specifically used to parse and process the change log information based on streaming computing to obtain a candidate data mirror table and a target change operation type corresponding to a target business data table of a business channel; and perform change processing on the business data in the candidate data mirror table according to the target change operation type.
[0168] In an exemplary embodiment, the business query condition includes a first business query condition and a second business query condition, and the determination module 1102 is specifically used to determine the target query result according to the first business query condition and multiple candidate data mirror tables; and determine the target business data according to the second business query condition and the target query result.
[0169] In an exemplary embodiment, the determination module 1102 is specifically used to determine at least one target data mirror table and candidate query results corresponding to the target data mirror table based on the first business query condition and multiple candidate data mirror tables; and determine the target query result based on the candidate query results corresponding to the at least one target data mirror table.
[0170] In an exemplary embodiment, the at least one target data mirror table includes multiple target data mirror tables, and the determination module 1103 is specifically configured to merge candidate query results corresponding to the multiple target data mirror tables to obtain a target query result.
[0171] Each module in the above-mentioned business data query device can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module above.
[0172] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG12. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store business data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a business data query method is implemented.
[0173] Those skilled in the art will understand that the structure shown in FIG. 12 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0174] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0175] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0176] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0177] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0178] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0179] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A business data query method, characterized in that: The method comprises: Receiving a service query request, wherein the service query request includes a service query condition; Determine the target business data corresponding to the business query request according to the business query condition and a plurality of candidate data mirror tables; wherein the plurality of candidate data mirror tables are mirror tables corresponding to business data tables of a plurality of business channels; Outputting the target business data; The method further comprises: For each of the business channels, obtaining change log information corresponding to a target business data table of the business channel; wherein the target business data table is a business data table corresponding to the business channel where a change operation has occurred; The candidate data mirror table corresponding to the target business data table of the business channel is changed according to the change log information.
2. The method according to claim 1, characterized in that The method further comprises: Obtaining business data tables of the multiple business channels; A plurality of candidate data mirror tables are constructed according to the business data tables of the plurality of business channels.
3. The method according to claim 1, characterized in that The obtaining of change log information corresponding to the target business data table of the business channel includes: Collecting change log information corresponding to the target business data table of the business channel, and storing the change log information in a message queue; The change log information is obtained from the message queue in sequence.
4. The method according to claim 1, characterized in that: The changing process of the candidate data mirror table corresponding to the target business data table of the business channel according to the change log information includes: Parsing the change log information based on streaming computing to obtain a candidate data mirror table and a target change operation type corresponding to a target business data table of the business channel; The business data in the candidate data mirror table is changed according to the target change operation type.
5. The method according to any one of claims 1 to 2, characterized in that: The business query condition includes a first business query condition and a second business query condition, and determining the target business data corresponding to the business query request according to the business query condition and a plurality of candidate data mirror tables includes: Determining a target query result according to the first business query condition and the multiple candidate data mirror tables; The target business data is determined according to the second business query condition and the target query result.
6. The method according to claim 5, characterized in that The determining a target query result according to the first business query condition and the plurality of candidate data mirror tables includes: Determine, according to the first business query condition and the plurality of candidate data mirror tables, at least one target data mirror table and a candidate query result corresponding to the target data mirror table; The target query result is determined according to at least one candidate query result corresponding to the target data mirror table.
7. The method according to claim 6, characterized in that The at least one target data mirror table includes a plurality of the target data mirror tables, and determining the target query result according to the candidate query result corresponding to the at least one target data mirror table includes: The candidate query results corresponding to the multiple target data mirror tables are merged to obtain the target query result.
8. A business data query device, characterized in that: The device comprises: A receiving module, configured to receive a service query request, wherein the service query request includes a service query condition; A determination module, configured to determine the target business data corresponding to the business query request according to the business query condition and a plurality of candidate data mirror tables; wherein the plurality of candidate data mirror tables are mirror tables corresponding to business data tables of a plurality of business channels; An output module, used for outputting the target business data; The change module is used to obtain the change log information corresponding to the target business data table of the business channel for each of the business channels; wherein the target business data table is the business data table corresponding to the business channel where the change operation occurs; and perform change processing on the candidate data mirror table corresponding to the target business data table of the business channel according to the change log information.
9. The device according to claim 8, characterized in that The device further includes a construction module, wherein the construction module is configured to obtain the business data tables of the multiple business channels; and construct a plurality of the candidate data mirror tables according to the business data tables of the multiple business channels.
10. The device according to claim 8, characterized in that The change module is specifically used to collect change log information corresponding to the target business data table of the business channel, and store the change log information in the message queue; The change log information is obtained from the message queue in sequence.
11. The device according to claim 8, characterized in that The change module is specifically used to parse and process the change log information based on streaming computing to obtain a candidate data mirror table and a target change operation type corresponding to the target business data table of the business channel; The business data in the candidate data mirror table is changed according to the target change operation type.
12. The device according to any one of claims 8 to 9, characterized in that The business query condition includes a first business query condition and a second business query condition, and the determination module is specifically used to determine a target query result according to the first business query condition and the multiple candidate data mirror tables; The target business data is determined according to the second business query condition and the target query result.
13. The device according to claim 12, characterized in that The determining module is specifically configured to determine at least one target data mirror table and a candidate query result corresponding to the target data mirror table according to the first business query condition and the plurality of candidate data mirror tables; The target query result is determined according to at least one candidate query result corresponding to the target data mirror table.
14. The device according to claim 13, characterized in that The at least one target data mirror table includes a plurality of target data mirror tables, and the determining module is specifically configured to merge candidate query results corresponding to the plurality of target data mirror tables to obtain the target query result.
15. A business data query device, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.