Data query method and device, electronic equipment and computer readable medium
By obtaining the business identifier and query conditions, determining the data source and target execution engine, using the pre-paging component to calculate the number of data items and the starting position, calling the data query component to query each data source in parallel, and aggregating the results based on the data source priority, the problems of low query efficiency and high traffic usage of multiple data sources in Internet applications are solved, and efficient and accurate data display is achieved.
Patent Information
- Application Number
- CN202410418108.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-08
- Publication Date
- 2025-10-17
AI Technical Summary
In Internet applications, when a list page needs to integrate multiple data sources, existing technologies result in large data query traffic, poor timeliness, low efficiency, and are prone to errors.
By responding to data query requests, obtaining business identifiers and query conditions, determining the data source and target execution engine, using the pre-paging component to calculate the number of data items and the starting position, calling the data query component to query each data source in parallel, and aggregating the query results based on the data source priority, the results are displayed in the same list.
It improves the efficiency and accuracy of data query, reduces traffic usage, and improves the timeliness of data query.
Smart Images

Figure CN120804184A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of big data, and in particular to a data query method and device, electronic equipment and a computer readable medium. BACKGROUND
[0002] At present, there are mostly list-related display pages in the front-end applications of the Internet industry. For example, the address management list, order list, evaluation list, and coupon list of e-commerce applications. For another example, in some Internet medical applications, there are the list of diagnosis lists, conversation lists, my services, and my coupons.
[0003] When a list page needs to integrate multiple data sources, since each data source interfaces with different downstreams, and the sorting and paging of the backend are complex, the existing operation mode returns the query results based on each data source to the front end, and then the front end simulates the paging processing of each query result, which leads to large data query traffic occupation, poor timeliness, low efficiency, and easy errors. SUMMARY
[0004] Therefore, the embodiments of the present application provide a data query method and device, electronic equipment and a computer readable medium, which can solve the problems of large data query traffic occupation, poor timeliness, low efficiency, and easy errors when a list page needs to integrate multiple data sources.
[0005] To achieve the above-mentioned purpose, according to an aspect of the present application, a data query method is provided, comprising:
[0006] In response to a data query request, the corresponding business identifier and query condition are obtained, and then the corresponding data source and target execution engine are determined according to the business identifier;
[0007] The number of data sources is obtained, and in response to the number being greater than a preset threshold, the target execution engine is called to determine the number of data to be queried and the starting position of each data source in each page using a pre-paging component;
[0008] The data query component is called to execute corresponding data query and obtain the query result data corresponding to each data source according to the data source, the query condition, the number of data, and the starting position;
[0009] Based on the preset data source priority, the query result data is aggregated to obtain aggregated data, and the aggregated data is displayed in the same list.
[0010] Optionally, before the target execution engine is called, the method further comprises:
[0011] The list page interface logic corresponding to the preset business is obtained;
[0012] The list page interface logic is abstracted in logical steps, and then an execution engine is encapsulated;
[0013] The preset business identifier corresponding to the preset business is associated with the corresponding execution engine, and the association relationship is saved.
[0014] Optionally, the pre-paging component is used to determine the number of data to be queried and the starting position of each data source in each page, including:
[0015] The sorting rule of each data source and the paging configuration data of the data query request are obtained;
[0016] The pre-paging component is called to determine the number of data to be queried and the starting position of each data source in each page according to the sorting rule and the paging configuration data.
[0017] Optionally, the data query component is called to execute corresponding data query according to the data source, the query condition, the number of data and the starting position, and obtain the query result data corresponding to each data source, including:
[0018] If the data sources are distributed in different systems, the data query component is called to execute corresponding data query in parallel from different systems based on the query condition, the number of data and the starting position through remote calling, to obtain the query result data corresponding to each data source.
[0019] Optionally, before aggregating each query result data, the method further includes:
[0020] According to the sorting rule, a preset data source priority is determined.
[0021] Optionally, each query result data is aggregated to obtain aggregated data, including:
[0022] Each query result data is sorted and assembled according to the corresponding data source priority to obtain the aggregated data.
[0023] Optionally, before executing corresponding data query and obtaining the query result data corresponding to each data source, the method further includes:
[0024] The validity period of the query condition is verified, and in response to the verification being unsuccessful, the data query request is intercepted and a warning information is issued.
[0025] In addition, the application also provides a data query device, including:
[0026] The acquisition unit is configured to obtain the corresponding business identifier and the query condition in response to the data query request, and then determine the corresponding data source and the target execution engine according to the business identifier;
[0027] The pre-paging unit is configured to acquire the number of data sources, and in response to the number being greater than a preset threshold, invoke a target execution engine to determine the number of data items and the starting position of each data source to be queried in each page using a pre-paging component;
[0028] The query unit is configured to invoke a data query component to perform corresponding data query according to the data sources, the query condition, the number of data items and the starting position, and obtain the query result data corresponding to each data source;
[0029] The data aggregation unit is configured to aggregate each query result data based on a preset data source priority to obtain aggregated data, and display the aggregated data in a same list.
[0030] Optionally, the data query device further comprises an encapsulation unit configured to:
[0031] acquire a list page interface logic corresponding to a preset business;
[0032] perform logical step abstraction on the list page interface logic, and then encapsulate to obtain an execution engine;
[0033] associate a preset business identifier corresponding to the preset business with the corresponding execution engine and save the association relationship.
[0034] Optionally, the pre-paging unit is further configured to:
[0035] acquire the sorting rule of each data source and the paging configuration data of the data query request;
[0036] invoke the pre-paging component to determine the number of data items and the starting position of each data source to be queried in each page according to the sorting rule and the paging configuration data.
[0037] Optionally, the query unit is further configured to:
[0038] if the data sources are distributed in different systems, invoke the data query component to perform corresponding data query in parallel from different systems based on the query condition, the number of data items and the starting position through a remote calling manner, to obtain the query result data corresponding to each data source.
[0039] Optionally, the data query device further comprises a priority determination unit configured to:
[0040] determine a preset data source priority according to the sorting rule.
[0041] Optionally, the data aggregation unit is further configured to:
[0042] sort and assemble and merge each query result data according to the corresponding data source priority to obtain the aggregated data.
[0043] Optionally, the data query device further comprises a pre-warning unit configured to:
[0044] verify the validity period of the query condition, and in response to the verification being unsuccessful, intercept the data query request and issue a pre-warning message.
[0045] In addition, the present application also provides a data query electronic device, comprising: 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 data query method as described above.
[0046] In addition, the present application also provides a computer readable medium having a computer program stored thereon, the program being executed by a processor to implement the data query method as described above.
[0047] An embodiment of the above application has the following advantages or beneficial effects: the present application responds to the data query request to obtain the corresponding business identifier and query condition, and then determines the corresponding data source and target execution engine according to the business identifier; obtains the number of data sources, and in response to the number being greater than a preset threshold, calls the target execution engine to use the pre-paging component to determine the number of data to be queried and the starting position of each data source in each page; calls the data query component to execute corresponding data query and obtain the query result data corresponding to each data source according to the data source, the query condition, the number of data and the starting position; based on the preset data source priority, aggregate each query result data to obtain aggregated data, and display the aggregated data in the same list. Thus, the efficiency and accuracy of data query when a list page needs to integrate multiple data sources are improved, the flow occupation is reduced, and the data query timeliness is improved.
[0048] The further effects of the above-mentioned non-conventional optional mode will be described in the following with reference to the specific embodiments. BRIEF DESCRIPTION OF DRAWINGS
[0049] The accompanying drawings serve to better understand the present application and do not constitute an improper limitation thereof. Among them:
[0050] Figure 1 is a schematic diagram of the main process of the data query method provided by an embodiment of the present application;
[0051] Figure 2 is a schematic diagram of the main process of the data query method provided by an embodiment of the present application;
[0052] Figure 3 is a schematic diagram of the main process of the data query method provided by an embodiment of the present application;
[0053] Figure 4is a schematic diagram of main units of a data query device according to an embodiment of the present application;
[0054] Figure 5 is an exemplary system architecture diagram to which embodiments of the present application can be applied;
[0055] Figure 6 is a structural schematic diagram of a computer system of a terminal device or a server suitable for implementing embodiments of the present application. DETAILED DESCRIPTION
[0056] Exemplary embodiments of the present application are described below with reference to the accompanying drawings, which include various details of the embodiments of the present application to assist in understanding, which should be considered in their context only. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Also, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description. It should be noted that in the technical solutions of the present disclosure, the collection, collection, update, analysis, processing, use, transmission, storage, etc. of user personal information involved in the technical solutions comply with relevant laws and regulations, are used for legal purposes, and do not violate public order and good customs. Necessary measures are taken for user personal information to prevent illegal access to user personal information data, and to maintain user personal information security, network security and national security.
[0057] Figure 1 is a schematic diagram of the main process of a data query method according to an embodiment of the present application, as shown in Figure 1 The data query method comprises:
[0058] Step S101, in response to a data query request, obtaining a corresponding business identifier and query condition, and then determining a corresponding data source and target execution engine according to the business identifier.
[0059] In this embodiment, the execution subject (for example, which can be a server) of the data query method can receive the data query request through wired or wireless connection. After receiving the data query request, the execution subject can obtain the business identifier and the query condition carried in the request. The business identifier, for example, businessId, is used to distinguish different business sources, that is, different data sources. The target execution engine can be an execution engine corresponding to the business identifier in the execution engine list obtained by pre-arrangement, that is, an execution engine corresponding to the business process of the business identifier, which can be executed according to the preset steps of the business process.
[0060] In step S102, the number of data sources is obtained, and in response to the number being greater than a preset threshold, a target execution engine is called to determine the number of data to be queried and the starting position in each page of each data source by using a pre-paging component.
[0061] For example, the preset threshold can be 1, and the pre-paging component is located in the target execution engine. By calling the target execution engine, when the number of data sources exceeds 1, the pre-paging component in the target execution engine can determine the number of data to be queried and the starting position of each data source according to the input parameters of the data query request, such as the first page, 10 per page, and the sorting of each data source. For example, the first data source has a total of 4 data, the second data source has a total of 1 data, the third data source has a total of 3 data, and the fourth data source has a total of 12 data. Therefore, all data needs to be queried from the first data source, all data needs to be queried from the second data source, all data needs to be queried from the third data source, and 2 data needs to be queried from the fourth data source. The above data forms a total of 10 data. When the page is requested to be paginated to the second page, only the third to twelfth data of the fourth data source needs to be queried, that is, when the second page is queried, the starting position is the third data of the fourth data source.
[0062] Specifically, before calling the target execution engine, the data method further comprises: obtaining a list page interface logic corresponding to a preset business; abstracting the logic steps of the list page interface logic, and then encapsulating to obtain an execution engine; and associating a preset business identifier corresponding to the preset business with the corresponding execution engine and saving the association relationship.
[0063] By pre-abstracting the list page interface logic corresponding to the preset business, the corresponding execution engine can be encapsulated in advance, and the association relationship between the business identifier and the encapsulated corresponding execution engine is saved, so that the execution engine can be called in time when needed in the future, and the data query rate is improved.
[0064] In step S103, the data query component is called to execute corresponding data query according to the data source, the query condition, the data number and the starting position, and obtain the query result data corresponding to each data source.
[0065] Specifically, the data query component is called to execute corresponding data query according to the data source, the query condition, the data number and the starting position, and obtain the query result data corresponding to each data source, including: if the data sources are distributed in different systems, the data query component is called to execute corresponding data query in parallel from different systems based on the query condition, the data number and the starting position by using remote calling, so as to obtain the query result data corresponding to each data source.
[0066] The data sources can be distributed in different systems, especially in a patient front-end group, the system does not store any data, that is, the data of other systems needs to be obtained through an rpc remote call to complete the data query of each data source to obtain the query result data corresponding to each data source. The remote call can be well implemented in a java class, and in a groovy script, the rpc generalization call capability needs to be used, and in this way, the rpc remote call can be directly used in the script without registering a consumer. Through the data query component, the development can be completely completed through the script (configuration) mode, and the development cost is greatly reduced.
[0067] In step S104, based on the preset data source priority, the query result data is aggregated to obtain aggregated data, and the aggregated data is displayed in the same list.
[0068] Specifically, before aggregating the query result data, the method further comprises: determining the preset data source priority according to the sorting rule.
[0069] According to the sorting rule, the order of each data source is determined, and then according to the order of each data source, the preset data source priority is determined. The priority of the data source in the front is higher than the priority of the data source in the back.
[0070] Specifically, aggregating the query result data to obtain aggregated data comprises: sorting and assembling each query result data according to the corresponding data source priority to obtain aggregated data.
[0071] Each query result data includes the query result of each data source in each page, and the query result of each data source in each page is assembled and merged according to the data source priority, and then the aggregated data is obtained, and the aggregated data is displayed in the same list and returned to the interface calling party for user review.
[0072] In this embodiment, in response to a data query request, the corresponding business identifier and query condition are obtained, and then the corresponding data source and target execution engine are determined according to the business identifier; the number of data sources is obtained, and in response to the number being greater than a preset threshold, the target execution engine is called to determine the number of data to be queried and the starting position of each data source in each page using the pre-paging component; the data query component is called to execute corresponding data query and obtain query result data corresponding to each data source according to the data source, the query condition, the number of data and the starting position; based on the preset data source priority, the query result data is aggregated to obtain aggregated data, and the aggregated data is displayed in the same list. Thus, when a list page needs to integrate multiple data sources, the efficiency and accuracy of data query are improved, the flow occupation is reduced, and the data query timeliness is improved.
[0073] Figure 2 is a main flowchart of a data query method according to an embodiment of the present application, as shown in Figure 2 The data query method comprises the following steps:
[0074] In step S201, in response to a data query request, a corresponding business identifier and query condition are acquired, and then a corresponding data source and target execution engine are determined according to the business identifier.
[0075] The data query request can be a request for querying data of one or more data sources in a multi-table page. After receiving the data query request, the execution subject can acquire the business identifier corresponding to the request. The corresponding data source and target execution engine needed are determined through the business identifier.
[0076] In step S202, the number of data sources is acquired, and in response to the number being greater than a preset threshold, the target execution engine is called to acquire the sorting rules of each data source and the paging configuration data of the data query request.
[0077] When the number of data sources is multiple, the execution subject can call the target execution engine to acquire the preset sorting rules of each data source, i.e., the order of sorting of each data source, and acquire the user-defined paging configuration data carried in the data query request. The total number of pages and the number of data per page can be included in the paging configuration data, and the embodiments of the present application do not make specific limitations on the paging configuration data.
[0078] In step S203, a pre-paging component is called to determine the number of data to be queried and the starting position of each data source in each page according to the sorting rules and the paging configuration data.
[0079] The execution subject can call the pre-paging component to determine the number of data to be queried and the starting position of each data source in the next page according to the sorting rules.
[0080] In step S204, a data query component is called to execute corresponding data query and obtain query result data corresponding to each data source according to the data source, the query condition, the number of data, and the starting position.
[0081] The execution subject can call the data query component to perform parallel data query from each corresponding data source according to the number of data for each page and the starting position of each page in combination with the query condition, so as to obtain query result data corresponding to each data source in each page.
[0082] Specifically, before executing the corresponding data query and obtaining the query result data corresponding to each data source, the method further comprises: verifying the validity period of the query condition, and in response to the verification being unsuccessful, intercepting the data query request and issuing a warning information.
[0083] Step S205, based on the preset data source priority, aggregate each query result data to obtain aggregated data, and display the aggregated data in the same list.
[0084] The data source priority can be changed in real time. Specifically, the execution subject can obtain the number of clicks of each data source by the user in real time, update the priority of each data source in real time according to the number of clicks of each data source by the user, aggregate each data source-based query result data based on the real-time updated data source priority to obtain aggregated data, and display the aggregated data in the same list. The data is updated in real time to improve the user interaction experience.
[0085] Figure 3 is the main flow diagram of the data query method provided according to an embodiment of the present application. As shown in Figure 3 When the user queries data through the list interface, the security-related logic needs to be executed, such as interface flow limiting, interface data burying, interface monitoring, and logic of returning to a lower level, and the business-related execution engine (obtained through the DUCC configuration platform) is called after the interface monitoring logic to perform authentication & configuration acquisition, and then the parameter verification component is executed (the execution engine provides three ways of parameter verification, java class execution, groovy script execution, and aviator online expression evaluation, and if there is an error, an error is returned), the pre-paging component is executed (parallel execution through a thread pool), the data query component is executed (parallel execution through a thread pool to query each data source in the downstream system), the data processing component is executed, and the data aggregation is returned (data is returned after the data aggregation is completed).
[0086] In the embodiment of the present application, the configuration center DUCC can be replaced by the open source nacos configuration center. The remote call JSF can be replaced by the open source dubbo. Aviator online expression evaluation itself is an open source function, and can also be replaced by other open source components such as jslt. DUCC: Configuration center, type Nacos. JSF: Remote call component, similar to Dubbo. Interface: refers to the gateway interface for front-end and back-end interaction, which is a language of the program and can be understood as a method or a program. Data source: The source of data, in the embodiment of the present application, can be the source of list data, such as the medical consultation list, whose data comes from the medical consultation data of the order middle platform. The embodiment of the present application designs a general external interface by abstracting the functional flow of the list interface (input parameter check, input parameter conversion, multi-source data pre-paging, data query, data processing, data merging, assembly return), and distinguishes different business sources (medical consultation list, my service, etc.) according to the businessId (business ID) in the input parameter. Through a configuration, you can see what list functions are available on the patient side of the entire mutual medical system. You can maintain only one interface document and use common monitoring, alarming, current limiting, degradation and other horizontal system stability functions. At the same time, the universal list interface integrates aviator online expressions, groovy dynamic scripting language, and jsf (type Dubbo RPC) generalized calling capabilities. As a result, back-end interface development can be carried out through online editing and configuration, reducing the time for code debugging and deployment, branching and production environment launch, greatly improving delivery efficiency. It can also improve the timeliness of potential problem repair. By abstracting the multi-source data paging query function, multi-source data paging aggregation query can be implemented through simple configuration. Specifically, through the pre-paging component (multiple data sources and their aggregation sorting rules are obtained based on the configuration item information), data is loaded in parallel through the thread pool, and through the processing components of each data source, the data is finally assembled and returned through the aggregation result component. It can easily solve the demand for aggregating and sorting multiple data sources on the same list page.
[0087] For example, the list interface abstraction process: By observing the logic of multiple list interfaces in the patient front-end system, such as the consultation list, conversation list, health record list, medication management list, my doctor list, my service list, follow-up plan list, and my coupon list, it is found that most of these list interfaces have the same process logic:
[0088] 0) Security related (including: interface monitoring, current limiting, downgrade plan, data tracking, etc.);
[0089] 1) Parameter verification;
[0090] 2) Parameter conversion (for example, the "completed consultation" option actually includes statuses such as normal completion, cancellation, and sale completion);
[0091] 3) Whether multiple data sources (for example: whether the list data comes from only one place, such as the list of consultation forms, the data is from the consultation form; my service list, the data has private doctor data, family doctor data, user benefit card data, care card data, etc.);
[0092] 4) Data query (including: single data source query, multiple data source query);
[0093] 5) Data processing (such as: field translation, desensitization coding, interactive button exposure judgment, data structure required by the front end, etc.);
[0094] 6) Data merging and sorting (only for multiple data source query);
[0095] 7) Assembly return (return a specific structure with paging data, including status code, error code, error information, data, etc.);
[0096] Most of the interfaces have all or part of the above repeated logic steps. After abstracting the logic steps of this type of interface (here referring to the list data page interface), the execution engine can be used as a framework for executing the above all or part of the repeated logic steps.
[0097] Specifically, as a general list component execution engine, the meaning of the execution engine is: a general component execution tool that can support step arrangement. In order to achieve the core indicators of rapid delivery, aviator online expression, groovy dynamic script language, jsf generalization call and other capabilities are used in the execution engine. The following is a specific description of the role and application of these component capabilities:
[0098] The execution engine defines the following general functions: monitoring function, flow limiting function, degradation function, data reporting function.
[0099] Regarding the general functions, the monitoring system function, the flow limiting and degradation function, and the data collection and analysis system function of the Internet hospital are used.
[0100] The execution engine (such as the target execution engine of the embodiment of the present application) defines the following core components: configuration parsing module, parameter verification module, multi-source data pre-paging component, data query component, data processing component, data assembly component. Examples:
[0101] 1) Configuration parsing module
[0102] The configuration file implementation uses the configuration file in the DUCC configuration platform, which has a function similar to the open-source nacos configuration center. This module is the core component of the implementation of orchestration execution, and its role is to obtain the custom configuration resources under the business identifier (for example, it can be a paging configuration data).
[0103] The custom configuration resources include parameter verification related configurations, data query related configurations, and data processing related configurations.
[0104] After completing the integrity verification of the configuration resources, the interface original input parameters and custom configuration items are placed in the context of the execution engine to enter the next step.
[0105] 2) Parameter verification module
[0106] The engine provides three ways of parameter verification: java class execution, groovy script execution, and aviator online expression evaluation.
[0107] Simple verification can be implemented through online expression, so only DUCC configuration needs to be modified to complete development; more complex verification can be implemented through groovy script, which can also be developed through configuration; and a small number of extremely complex demands that cannot be met through the above methods can be developed through javaBean.
[0108] Parameter verification related configuration items include:
[0109] beanName (corresponding to the registered javeBean in the tomcat container, which needs to implement the parameter verification interface of the execution engine);
[0110] fassBeanName (corresponding to the script id in the mutual medical internal platform, which needs to implement the parameter verification interface of the engine);
[0111] checklist (using aviator el online evaluation expression configuration, the expression execution returns success or failure, and the error code and error information returned by the interface when failing can be configured at the same time);
[0112] beanName and fassBeanName can only exist one, and need to implement the parameter verification standard interface specification of the execution engine. Checklist can be configured multiple times and will be executed in series according to the configuration order;
[0113] The above three methods can be configured at the same time and can be executed in the order of checklist->fassBeanName->beanName. If any of them returns failure, the execution ends and the next step is entered after passing the verification.
[0114] 3) Whether multi-data source aggregation
[0115] By judging the number of data sources in the data query related configuration, if it is greater than 1, it represents multi-data source aggregation query.
[0116] If it is a multi-data source case, a pre-paging component is executed, which is used to calculate the number of real data required by each data source and the starting position in advance through the sorting rules of multiple data sources and the paging in the current request, for the next data query.
[0117] 4) Data query component
[0118] The execution engine provides two ways of data query, java class execution and groovy script execution.
[0119] In single data source query, the data is obtained from the downstream system in combination with the query conditions of the interface input parameters and the paging situation (such as the list of ongoing consultation orders, the first page, 10 per page).
[0120] In multi-data source query, the data is obtained from the downstream system in parallel in combination with the query conditions of the interface input parameters and the paging situation calculated by the pre-paging component (for example, the list of “my services” is aggregated with the list of care cards and the list of benefits to display together, the care card data is displayed first, the first page is 10 per page, the pre-paging component calculates that the care card data is a total of 4, so the paging situation of the care card query is: all; the benefit list data is a total of 18, so it needs to query from the first to the sixth; together to return 10 data. Similarly, the second page is 10 per page, only the seventh to sixteenth data of the benefit list data needs to be queried and returned).
[0121] The data source can be distributed in different systems, especially the patient front-end group, which does not store any data, that is, it needs to obtain the data of other systems through rpc remote invocation. In java class, this call can be well implemented, in groovy script, rpc generalized call capability needs to be used, in this way, rpc remote call can be directly used in the script without registering the consumer. Therefore, the data query component can be completely developed through the script (configuration) method, greatly reducing the development cost.
[0122] 5) Data processing component
[0123] The execution engine provides two ways of data processing, java class execution and groovy script execution.
[0124] This step is not a necessary step and can be directly skipped to enter data assembly. In general, the queried data needs to be processed.
[0125] Data processing includes but is not limited to: data format conversion (from one entity to the required structure of the front end), data content translation (for example: the status code of the inquiry form is "1", which needs to be translated into "to be received"), sensitive data coding and encryption (for example: mobile phone number, patient name, etc.), operation button set (for example: in the to-be-received state, the user can cancel; in the reception state, the user can enter the inquiry; in the end state, the user can evaluate, etc.) and other processing operations. The above list is for easy understanding, and the execution engine does not make specific restrictions on the data processing component.
[0126] 6) Data assembly component
[0127] According to the data sorting requirements in the configuration information, the processed list data is aggregated and returned to the interface caller. If multiple data sources are configured in the multi-source data aggregation paging component (i.e. the pre-paging component), the component needs to plan the number of data to be queried and its starting position of each data source in advance before executing data query. For example: taking the patient end "My Service" of the Internet hospital as an example, it is composed of four parts of data: user's rights information, user's family doctor, user's private doctor, and user's care card. The four parts of data come from different downstream systems. The business party needs to decide the sorting requirements of the four parts of data, assuming that the order is sorted according to the above writing. The execution logic of the component is: according to the interface input parameter query condition (assuming the condition is not expired), the data volume of the four downstream data sources is queried through thread pool, for example, the rights information has 4 data, the family doctor has 1 data, the private doctor has 3 data, and the care card has 12 data. According to the input parameter paging condition (10 data per page for the first page), it is calculated that: all data needs to be queried from the rights information downstream; all data needs to be queried from the family doctor downstream; all data needs to be queried from the private doctor downstream; the first data to the second data needs to be queried from the care card downstream, which totals 10 data for return. When the request is paginated to the second page, only the third data to the twelfth data needs to be queried from the care card downstream for return. The multi-source data aggregation paging component (i.e. the pre-paging component) does not really query data, but provides the calculation of the paging conditions of the multi-source data for the next step of data query.
[0128] To sum up, the embodiment of the application can clearly and quickly complete the development of a list interface, each step component supports online expression and script language, that is, the development, joint debugging, online, etc. of a requirement can be completed through the configuration mode (without code development and deployment online), which can greatly improve the development efficiency. Since the list general interface unifies numerous list type interfaces, the security coding such as monitoring, burying, flow limiting, and degradation can be reused, which can greatly reduce the development cost. The general list component execution engine: through configuration analysis, step arrangement execution, combined with online evaluation expression and script language, the engine can realize pure configuration development, and combined with thread pool technology and cache technology, the performance can also be guaranteed. The multi-source data aggregation paging component (i.e. the pre-paging component): through the built-in calculation logic, the data source priority is simply configured, the query paging conditions of each data source are calculated, combined with the subsequent steps, the function of multi-source data aggregation display on the same list can be easily realized.
[0129] Figure 4 is a schematic diagram of main units of a data query device according to the embodiment of the application. As shown in Figure 4 , the data query device 400 includes an acquisition unit 401, a pre-paging unit 402, a query unit 403, and a data aggregation unit 404.
[0130] The acquisition unit 401 is configured to acquire the corresponding business identifier and query condition in response to the data query request, and then determine the corresponding data source and target execution engine according to the business identifier.
[0131] The pre-paging unit 402 is configured to acquire the number of data sources, and in response to the number being greater than a preset threshold, call the target execution engine to determine the number of data to be queried and the starting position of each data source in each page by using the pre-paging component.
[0132] The query unit 403 is configured to call the data query component to perform corresponding data query and obtain the query result data corresponding to each data source according to the data source, the query condition, the number of data, and the starting position.
[0133] The data aggregation unit 404 is configured to aggregate each query result data based on a preset data source priority to obtain aggregated data, and display the aggregated data on the same list.
[0134] In some embodiments, the data query device further includes Figure 4 a packaging unit not shown in the figure, which is configured to: acquire the list page interface logic corresponding to the preset business; abstract the logic steps of the list page interface logic, and then package the execution engine; and associate and save the association relationship between the preset business identifier corresponding to the preset business and the corresponding execution engine.
[0135] In some embodiments, the pre-paging unit 402 is further configured to acquire the sorting rule of each data source and the paging configuration data of the data query request; and invoke the pre-paging component to determine the number of data and the starting position of each data source required to be queried in each page according to the sorting rule and the paging configuration data.
[0136] In some embodiments, the query unit 403 is further configured to, if the data sources are distributed in different systems, invoke the data query component to perform corresponding data query from different systems in parallel based on the query condition, the number of data and the starting position by means of remote invocation, so as to obtain the query result data corresponding to each data source.
[0137] In some embodiments, the data query apparatus further comprises Figure 4 a priority determination unit not shown in the figure, configured to determine the preset data source priority according to the sorting rule.
[0138] In some embodiments, the data aggregation unit 404 is further configured to sort and assemble and merge each query result data according to the corresponding data source priority, so as to obtain the aggregated data.
[0139] In some embodiments, the data query apparatus further comprises Figure 4 a warning unit not shown in the figure, configured to verify the validity period of the query condition, and in response to the verification failure, intercept the data query request and issue a warning information.
[0140] It should be noted that the data query method and the data query apparatus of the present application have a corresponding relationship in the specific implementation content, and therefore the repeated content will not be described.
[0141] Figure 5 An exemplary system architecture 500 to which the data query method or the data query apparatus of the embodiments of the present application can be applied is shown.
[0142] As shown in Figure 5 , the system architecture 500 can include terminal devices 501, 502, 503, a network 504 and a server 505. The network 504 is used to provide a communication link medium between the terminal devices 501, 502, 503 and the server 505. The network 504 can include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0143] The user can use the terminal devices 501, 502, and 503 to interact with the server 505 through the network 504 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 501, 502, and 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0144] The terminal devices 501, 502, and 503 can be various electronic devices with data query processing screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, etc.
[0145] The server 505 can be a server providing various services, such as a background management server providing support for data query requests submitted by the user using the terminal devices 501, 502, and 503 (only as an example). The background management server can respond to the data query request, obtain the corresponding business identifier and query condition, and then determine the corresponding data source and target execution engine according to the business identifier; obtain the number of data sources, and in response to the number being greater than a preset threshold, call the target execution engine to determine the number of data items and the starting position of each data source that need to be queried in each page using the pre-paging component; call the data query component to execute corresponding data queries and obtain the query result data corresponding to each data source according to the data source, the query condition, the number of data items, and the starting position; based on a preset data source priority, aggregate each query result data to obtain aggregated data, and display the aggregated data in the same list. Thus, the efficiency and accuracy of data query when a list page needs to be integrated with multiple data sources are improved, the traffic occupation is reduced, and the data query timeliness is improved.
[0146] It should be noted that the data query method provided by the embodiments of the present application is generally executed by the server 505, and correspondingly, the data query apparatus is generally arranged in the server 505.
[0147] It should be understood that Figure 5 The number of terminal devices, networks, and servers in the above description is only illustrative. Any number of terminal devices, networks, and servers can be provided according to the implementation needs.
[0148] Reference is made below to Figure 6 which shows a structural schematic diagram of a computer system 600 of a terminal device suitable for use to implement the embodiments of the present application. Figure 6 The terminal device shown is only an example and should not impose any limitation on the functions and use range of the embodiments of the present application.
[0149] As Figure 6As shown, the computer system 600 includes a central processing unit (CPU) 601 which can perform various appropriate actions and processes according to programs stored in a read only memory (ROM) 602 or loaded into a random access memory (RAM) 603 from a storage section 608. In the RAM 603, various programs and data required for the operation of the computer system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0150] Connected to the I / O interface 605 are an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a display device such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as necessary. A removable recording medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 610 as necessary, so that a computer program read therefrom is installed into the storage section 608 as necessary.
[0151] In particular, according to the embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, the embodiments of the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program codes for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network by the communication section 609, and / or installed from the removable recording medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-described functions defined in the system of the present application are executed.
[0152] Note that the computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium or a combination thereof. The computer-readable storage medium can include, for example, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, the computer-readable storage medium can be any tangible medium that contains or stores a program used by an instruction execution system, apparatus, or device to function according to the program. In the present application, the computer-readable signal medium can include a computer-readable storage medium or any computer-readable medium that transmits, propagates, or transfers programs used by an instruction execution system, apparatus, or device to function according to the programs. The program code contained in the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber, RF, etc., or any suitable combination of the foregoing.
[0153] The flow diagrams and block diagrams in the drawings are schematic illustrations of possible architectures, functions, and operations of systems, methods, and computer program products in accordance with various embodiments of the present application. In this regard, each block in the flow diagrams or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or in the reverse order, depending on the functionality involved. It will also be noted that each block of the block diagrams or flow diagrams, and combinations of blocks in the block diagrams or flow diagrams, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or combinations of special purpose hardware and computer instructions.
[0154] The units described in the embodiments of the present application can be implemented in the form of software, or can be implemented in the form of hardware. The described units can also be arranged in a processor, for example, can be described as: a processor includes an acquisition unit, a pre-paging unit, a query unit and a data aggregation unit. In some cases, the names of these units do not constitute a limitation on the units themselves.
[0155] As another aspect, the present application also provides a computer readable medium, which can be included in the device described in the above embodiments, or can exist independently without being assembled into the device. The computer readable medium carries one or more programs, when the one or more programs are executed by the device, the device acquires the corresponding service identifier and query condition in response to the data query request, and then determines the corresponding data source and target execution engine according to the service identifier; acquires the number of data sources, and in response to the number being greater than a preset threshold, calls the target execution engine to determine the number of data to be queried and the starting position of each data source in each page using the pre-paging component; calls the data query component to execute corresponding data query and obtain the query result data corresponding to each data source according to the data source, the query condition, the number of data and the starting position; based on the preset data source priority, aggregates each query result data to obtain aggregated data, and displays the aggregated data in the same list.
[0156] According to the technical scheme of the embodiments of the present application, the efficiency and accuracy of data query can be improved when a list page needs to integrate multiple data sources, the flow occupancy is reduced, and the data query timeliness is improved.
[0157] The above specific embodiments do not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can occur depending on design requirements and other factors. Any modification, equivalent replacement and improvement made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A data query method, characterized in that: include: In response to a data query request, obtaining a corresponding service identifier and query conditions, and then determining a corresponding data source and target execution engine according to the service identifier; Obtaining the number of the data sources, and in response to the number being greater than a preset threshold, calling the target execution engine to use a pre-paging component to determine the number and starting position of data items to be queried for each of the data sources in each page; Calling a data query component to execute a corresponding data query based on the data source, the query condition, the number of data items, and the starting position, and obtain query result data corresponding to each data source; Based on the preset data source priority, each query result data is aggregated to obtain aggregated data, and the aggregated data is displayed in the same list.
2. The method according to claim 1, characterized in that Before calling the target execution engine, the method further includes: Get the list page interface logic corresponding to the preset business; Abstracting the logic steps of the list page interface logic and then encapsulating it to obtain an execution engine; The preset service identifier corresponding to the preset service is associated with the corresponding execution engine and the association relationship is saved.
3. The method according to claim 1, characterized in that The method of using the pre-paging component to determine the number of data items and the starting position of each data source to be queried in each page includes: Obtaining sorting rules for each of the data sources and paging configuration data for the data query request; The pre-paging component is called to determine the number of data items and the starting position that each of the data sources needs to query in each page according to the sorting rule and the paging configuration data.
4. The method according to claim 1, wherein The calling of the data query component to execute a corresponding data query and obtain query result data corresponding to each data source according to the data source, the query condition, the number of data items, and the starting position includes: If the data sources are distributed in different systems, the data query component is called to execute corresponding data queries in parallel from the different systems based on the query conditions, the number of data items and the starting position through remote calls to obtain query result data corresponding to each data source.
5. The method according to claim 3, characterized in that Before aggregating the query result data, the method further includes: According to the sorting rule, a preset data source priority is determined.
6. The method according to claim 1, characterized in that Aggregating the query result data to obtain aggregated data includes: The query result data are sorted according to the corresponding data source priority and assembled and merged to obtain aggregated data.
7. The method according to claim 1, characterized in that Before executing the corresponding data query and obtaining the query result data corresponding to each of the data sources, the method further includes: The validity period of the query condition is verified, and in response to failure of the verification, the data query request is intercepted and an early warning message is issued.
8. A data query device, characterized in that: include: an acquisition unit configured to acquire a corresponding service identifier and a query condition in response to a data query request, and then determine a corresponding data source and a target execution engine according to the service identifier; a pre-paging unit configured to obtain the number of the data sources, and in response to the number being greater than a preset threshold, call the target execution engine to use the pre-paging component to determine the number and starting position of data items to be queried for each of the data sources in each page; A query unit is configured to call a data query component to execute a corresponding data query according to the data source, the query condition, the number of data items and the starting position, and obtain query result data corresponding to each data source; The data aggregation unit is configured to aggregate the query result data based on a preset data source priority to obtain aggregated data, and display the aggregated data in the same list.
9. The device according to claim 8, characterized in that The device further includes a packaging unit configured to: Get the list page interface logic corresponding to the preset business; Abstracting the logic steps of the list page interface logic and then encapsulating it to obtain an execution engine; The preset service identifier corresponding to the preset service is associated with the corresponding execution engine and the association relationship is saved.
10. The device according to claim 8, characterized in that The pre-paging unit is further configured to: Obtaining sorting rules for each of the data sources and paging configuration data for the data query request; The pre-paging component is called to determine the number of data items and the starting position that each of the data sources needs to query in each page according to the sorting rule and the paging configuration data.
11. A data query electronic device, 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 7.
12. 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 7 is implemented.