A method of integrating multiple standard data interfaces into one data interface

By writing combined data interface configuration information and using the Apache Calcite engine to execute SQL queries, the problem of low efficiency in integrating multiple standard data interfaces was solved, achieving efficient and flexible data interface integration and maintenance, and lowering the technical threshold.

CN120705172BActive Publication Date: 2025-12-16CHINA LIFE INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511143240.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-15
Publication Date
2025-12-16
Estimated Expiration
2045-08-15

AI Technical Summary

Technical Problem

In the process of report development and data processing, calling multiple standard data interfaces requires writing a lot of code to handle parameter merging, parameter conversion and data merging, resulting in low efficiency, complex code, difficult maintenance and high technical threshold, which ordinary business personnel cannot configure independently.

Method used

By writing combined data interface configuration information, defining interface dependencies and parameter rules using the INI format, and executing SQL queries using the Apache Calcite engine, multiple standard data interfaces can be integrated. The configuration information is transmitted and stored using an unlimited-level INI format and AJAX requests, and a unique ID is generated for configuration management.

Benefits of technology

It achieves efficient integration of multiple standard data interfaces, lowers the technical threshold, improves maintenance efficiency and flexibility, reduces redundant code development, and allows business personnel to configure it independently without writing complex code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120705172B_ABST
    Figure CN120705172B_ABST
Patent Text Reader

Abstract

The application discloses a method for integrating multiple standard data interfaces into one data interface, comprising the following steps: S1, filling in combined data interface configuration information and sending an HTTP request; S2, a backend system receiving HTTP request data sent by a front end, checking and saving to a database; S3, calling the combined data interface; the application replaces hard coding with a configuration mode, supports any multiple standard data interfaces and automatic parameter conversion, reduces the technical threshold of multi-interface integration, improves system flexibility and development efficiency, and solves problems such as high interface change cost and dependence on professional skills in traditional methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer software technology, and in particular to a method for integrating multiple standard data interfaces into a single data interface. Background Technology

[0002] In fields such as report development, data processing, and application development, standard data interfaces define unified data formats, transmission protocols, and operating specifications. They standardize the management of data interfaces for different applications or databases, reducing the development workload and difficulty caused by inconsistencies in data formats and interfaces between different systems. This lowers the cost of software development and maintenance and greatly facilitates developers.

[0003] However, when developers call multiple standard data interfaces for report development or data processing, they still need to write a significant amount of code to handle parameter merging, parameter conversion, and data merging issues across these interfaces. This approach is inefficient, the code is complex, requiring different code to be written for different parameter merging, conversion, and data merging problems, making it non-reusable and difficult to maintain. The mixed configuration information in the code is difficult to reuse, and the same integration logic needs to be repeatedly developed in different scenarios, resulting in wasted resources. Furthermore, developers need to master the details of multiple interfaces, and the configuration of traditional technical tools requires the participation of data engineers, creating a high technical barrier that ordinary business personnel cannot configure independently. Summary of the Invention

[0004] The purpose of this invention is to solve the above-mentioned problems by proposing a method for integrating multiple standard data interfaces into one data interface. This method involves writing combined data interface configuration information, parsing the combined data interface configuration information to obtain the standard data interface ID, standard data interface parameters, parameter conversion functions, processing statements, and common parameters. The parameter conversion functions are used to convert the common parameters into standard data interface parameters. The standard data interfaces are then called to obtain standard data interface data. Finally, the processing statements are used to merge the standard data interface data to generate the final data, thereby integrating multiple standard data interfaces into one data interface.

[0005] To achieve the above objectives, the following technical solution was adopted:

[0006] A method for integrating multiple standard data interfaces into a single data interface includes the following steps:

[0007] S1: Fill in the combined data interface configuration information and send an HTTP request;

[0008] Includes the following sub-steps:

[0009] S11: Enter the name of the combined data interface;

[0010] Assign a unique name to the combined data interface, which is used to identify and invoke the combined data interface in the system.

[0011] S12: Fill in the combined data interface configuration;

[0012] The combined data interface is configured in the INI format, which supports an unlimited number of levels.

[0013] Write the configuration information for the combined data interface. The format of the combined data interface configuration is INI format, and unlimited levels are supported by using delimiters in the section names.

[0014] The configuration information for the combined data interface includes:

[0015] The combined data interface configuration has two top-level sections: section [api] and section [common_params].

[0016] The section [api] contains one or more subsections, such as the section [api.alias]. These subsections are alias subsections; that is, the alias within a subsection is an alias for the result set of the standard data interface.

[0017] The alias subsection contains a key-value pair, where the key is "name" and the value is the standard data interface ID. The alias subsection also contains a [params] subsection, such as [api.alias.params], which is the parameter configuration section.

[0018] The [params] subsection contains one or more key-value pairs. The key of each key-value pair is the parameter name of the standard data interface, and the value is one of the following: parameter conversion function, specific value, or parameter identifier in the form of $name.

[0019] The section [common_params] is the common parameter configuration section, which contains one or more key-value pairs, where the key of the key-value pair is the parameter name and the value is the parameter value;

[0020] S13: Write the SQL query statement;

[0021] Based on the Apache Calcite query engine syntax, write SQL query statements to define the integration logic of multi-standard data interface result sets.

[0022] The SQL query statement is either a with...select statement or a select statement;

[0023] The purpose of the SQL query statement is to process and output data from the result set of the standard data interface.

[0024] S14: The user clicks the "Save" button on the front-end interface;

[0025] The user clicks the "Save" button on the front-end page.

[0026] S15: The front-end interface creates an AJAX request;

[0027] Based on the save action in step S14, the front-end interface creates an asynchronous HTTP request, i.e., an AJAX request.

[0028] An AJAX request is an HTTP request used to enable data interaction between the front-end and the back-end.

[0029] S16: Store the combined data interface configuration information into FormData;

[0030] The completed combined data interface configuration information is encapsulated into FormData.

[0031] The encapsulation includes mapping the combined data interface name, configuration information, and SQL query statement in S1 to key-value pairs of FormData respectively;

[0032] FormData is an API provided by the front-end page for encapsulating and combining data interface configuration information. It is essentially a collection of key-value pairs and is sent via HTTP requests to ensure that it is accurately transmitted to the system.

[0033] S17: Send FormData to the backend system via an AJAX request;

[0034] The front-end page sends FormData to the back-end system via an AJAX request.

[0035] S2: The backend system receives HTTP request data sent by the frontend, verifies it, and saves it to the database;

[0036] Includes the following sub-steps:

[0037] S21: The backend system receives the HTTP request and retrieves the request data from the request body of the HTTP request;

[0038] The backend system listens for and receives HTTP requests sent by the frontend, and parses the request body according to the HTTP protocol to obtain the request data encapsulated in FormData;

[0039] The requested data is the combined data interface configuration information;

[0040] S22: The backend system validates the format of the request data;

[0041] The verification is used to determine whether the combined data interface configuration information is correct;

[0042] The backend system validates the request data to determine if the format of the interface configuration in the combined data interface configuration information is correct. If the validation result is incorrect, the system returns the validation failure response data to the frontend page. If the validation result is correct, the system proceeds to the next step.

[0043] S23: Generate a unique ID and save the unique ID and request data to the database;

[0044] The unique ID is a string or a sequence of numbers and is globally unique.

[0045] If the verification result is correct, the backend system generates a unique ID, associates the unique ID with the correctly verified request data in step S22, and saves it to the database.

[0046] S24: Returns the response data indicating successful saving;

[0047] The response data includes a status code and a response body. The status code is used to indicate whether the saving was successful or failed, and the response body contains the unique ID or specific error information.

[0048] After successful saving, the saved response data will be returned to the front-end page.

[0049] S3: Call the combined data interface;

[0050] Includes the following sub-steps:

[0051] S31: Call the combined data interface API, passing in a unique ID and a set of execution parameters;

[0052] Developers call the API code of the composite data interface and pass in a unique ID and a set of execution parameters used to locate the configuration information of the composite data interface;

[0053] The set of execution parameters is of Map key-value pair type;

[0054] Map is a data type with a key-value pair structure;

[0055] S32: Determine the unique ID and query the combined data interface configuration information from the database based on the unique ID;

[0056] The backend system checks if the unique ID is empty. If the unique ID is empty, it throws an exception report and returns it to the API caller. If the unique ID is not empty, it queries the database for the corresponding combined data interface configuration information based on the unique ID using an SQL query statement. If the combined data interface configuration information is found to be empty, it throws an exception report and returns it to the API caller. If the combined data interface configuration information is not empty, it proceeds to the next step.

[0057] S33: Create an infinite-level INI format parser, which parses the interface configuration in the combined data interface configuration information queried in S32 and stores it in the variable apiInfo;

[0058] The variable apiInfo consists of a List collection of standard data interface information and a Map collection of public parameters;

[0059] The Map collection is a collection that uses Map as the base unit;

[0060] The standard data interface information List collection is a collection of standard data interface information, and the elements are standard data interface information, including aliases, standard data interface IDs, and interface parameters;

[0061] The alias is the alias in the section [api.alias], where alias is a user-defined alias;

[0062] The standard data interface ID is the value corresponding to the key 'name' in the section [api.alias].

[0063] The interface parameter is a Map collection, containing all key-value pairs in the section [api.alias.params].

[0064] The common parameters are a Map collection, containing all key-value pairs in the [common_params] section;

[0065] S34: Iterate through each element in the List collection of standard data interface information in the variable apiInfo, i.e., the standard data interface information. Preprocess the interface parameters of the current element, then call the standard data interface API, and pass in the standard data interface ID and the preprocessed interface parameters to obtain the result set of the standard data interface. Store the result set of the standard data interface as a key-value pair in TableInfoMap using the alias and the result set of the standard data interface.

[0066] The result set of the standard data interface consists of two parts: the first part is the data type set, and the second part is the data set.

[0067] The data type set is a Map key-value pair, where the key is the column name and the value is the data type of the column. This data type is the type of the database table field, such as int, varchar(10), decimal(10,2), date, etc.

[0068] The data set is a List collection, and the elements of the collection are key-value pairs of type Map;

[0069] TableInfoMap is a Map collection, a key-value pair structure;

[0070] The purpose of preprocessing the interface parameters is to execute the parameter conversion function, thereby obtaining the function value and replacing the parameter conversion function in the interface parameters. The specific steps of the preprocessing are as follows:

[0071] S341: Iterate through each key-value pair element in the public parameters of the variable apiInfo and determine whether the key of the key-value pair exists in the execution parameter set;

[0072] The backend system iterates through each key-value pair in the public parameters of the variable apiInfo and checks whether the key of the key-value pair exists in the execution parameter set. If it exists, the value of the key-value pair in the public parameters is replaced with the value of the corresponding key in the execution parameter. If it does not exist, the value of the key-value pair is left unchanged and no replacement is needed.

[0073] S342: Iterate through each key-value pair in the interface parameters of the current standard data interface and determine the value of the key-value pair element;

[0074] The backend system iterates through each key-value pair in the interface parameters of the current standard data interface and judges the value of each key-value pair. If the value of the key-value pair is a parameter conversion function, the system's function executor is called to accept the parameter conversion function and common parameters, return the function value, and update the value of the corresponding key in the interface parameters to the function value. If the value of the key-value pair is a parameter identifier, the corresponding parameter value is directly retrieved from the common parameters based on the name of the parameter identifier, and the value of the corresponding key in the interface parameters is updated to the function value.

[0075] The main function of the function executor is to store functions, parse and execute parameters, convert them into function return results;

[0076] S35: Load the Apache Calcite driver and create a JDBC connection;

[0077] The backend system loads the Apache Calcite driver and establishes a session channel with the Apache Calcite engine through the database connection specification, i.e., a JDBC connection.

[0078] The Apache Calcite driver is an SQL query engine used to virtualize the result sets of multiple standard data interfaces into SQL tables and perform association and aggregation operations through a unified SQL syntax.

[0079] The JDBC connection is a session established with the Calcite engine, used to submit SQL queries and obtain execution results;

[0080] S36: Obtain the root schema from the JDBC connection;

[0081] The root schema can be obtained directly by calling the getRootSchema() method of CalciteConnection through a JDBC connection established by the Apache Calcite engine.

[0082] CalciteConnection is a unique extension of the Apache Calcite engine, providing the getRootSchema() method to retrieve the root schema;

[0083] The root schema is the root node of the entire database metadata, used to store all in-memory tables;

[0084] S37: Iterate through each key-value pair element in TableInfoMap, i.e., the result set of aliases and standard data interfaces, and pack the result set into an in-memory table, using the key as the table name, and store the in-memory table in the root schema for SQL query reference;

[0085] The packaging steps are as follows: create an in-memory table, determine the structure of the in-memory table using the data type set in the result set of the standard data interface in TableInfoMap, and use the system iterator to wrap the data set into an iterable object, which serves as the data of the in-memory table.

[0086] S38: Execute the SQL query statement in the combined data interface configuration information and return the final result set;

[0087] The SQL query statement defined in step S13 is parsed and executed using the Apache Calcite engine, and the final integrated result is generated based on the memory table data of the root schema packaged and stored in step S37.

[0088] The final result is a List collection, and the elements of the collection are key-value pairs of type Map.

[0089] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0090] 1. This invention pre-stores the integration rules of the combined data interface in the system by writing configuration information for the combined data interface, determines a unique ID, and stores the configuration information in association with the unique ID. The combined data interface can be called directly through the unique ID, avoiding the duplication of code development. When the interface logic changes, only the INI configuration or SQL query statement needs to be modified, and it will take effect after verification. This eliminates the compilation and deployment steps, improves the efficiency of data interface integration, and enhances maintenance efficiency.

[0091] 2. This invention adopts an infinite-level INI format to establish interface dependencies and parameter rules, as well as SQL statements to define data integration logic, with the two top-level sections [api] and [common_params] as the core, thereby improving the adaptability to complex interface dependencies.

[0092] 3. This invention adopts a configuration-based approach, defining data integration logic by writing SQL query statements and executing the SQL query statements through the Apache Calcite engine. This enables standardized association, aggregation, and other processing of result sets from multiple standard data interfaces. Business personnel can configure the data independently based on general SQL syntax, without relying on developers to write integration code, thus lowering the technical threshold.

[0093] 4. This invention preprocesses the interface parameters of different standard data interfaces, and uses three parts: execution parameters, common parameters, and interface parameters. The execution parameters cover the common parameters, and the common parameters cover the interface parameters. Developers can flexibly set dynamic or static parameters and automatically execute function conversions. This achieves automatic adaptation of parameter formats between different standard data interfaces, replacing the manual encoding conversion method in the prior art and reducing calling errors caused by format mismatch. Attached Figure Description

[0094] Figure 1 This is a flowchart illustrating the steps of a method for integrating multiple standard data interfaces into a single data interface according to the present invention. Detailed Implementation

[0095] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the specific embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0096] like Figure 1 As shown, a method for integrating multiple standard data interfaces into a single data interface includes the following steps:

[0097] S1: Fill in the combined data interface configuration information and send an HTTP request;

[0098] Includes the following sub-steps:

[0099] S11: Enter the name of the combined data interface;

[0100] Developers input a unique identifier name for the combined data interface on the front-end page. This name is used to identify and invoke the combined data interface in the system.

[0101] S12: Fill in the combined data interface configuration;

[0102] Write the configuration information for the combined data interface. The format of the combined data interface configuration adopts the INI format that supports unlimited levels. This is achieved by using delimiters in the section names.

[0103] The configuration information for the combined data interface includes:

[0104] The combined data interface configuration has two top-level sections: section [api] and section [common_params].

[0105] The section [api] contains one or more subsections, such as the section [api.alias]. These subsections are alias subsections; that is, the alias within a subsection is an alias for the result set of the standard data interface.

[0106] The alias subsection contains a key-value pair, where the key is "name" and the value is the standard data interface ID. The alias subsection also contains a [params] subsection, such as [api.alias.params], which is the parameter configuration section.

[0107] Within the subsection, the actual interface is associated with a key-value pair with the key being name and the value being the standard data interface ID, and the parameter rules are defined in the [api.alias.params] subsection;

[0108] The [params] subsection contains one or more key-value pairs. The key of each key-value pair is the parameter name of the standard data interface, and the value is one of the following: parameter conversion function, specific value, or parameter identifier in the form of $name.

[0109] The format of the parameter conversion function is: parameter conversion function name (parameter value 1, parameter value 2, ...).

[0110] The parameter conversion function can have zero or more parameters. If a parameter needs to use the value of a key in the [common_params] section below, the parameter must be in the format $name, where name is the key name of the common_params section.

[0111] In the parameter identifier of the form $name, name is the key name of the section [common_params].

[0112] The [common_params] section is the common parameter configuration section, which contains one or more key-value pairs. The key of each key-value pair is the parameter name, and the value is the parameter value, which is shared by all standard data interfaces.

[0113] S13: Write the SQL query statement;

[0114] Based on the Apache Calcite query engine syntax, write SQL query statements to define the integration logic of result sets from multiple standard data interfaces.

[0115] The SQL query statement can be either a with...select statement or a select statement;

[0116] The purpose of the SQL query statement is to process and output data from the result set of the standard data interface.

[0117] S14: The user clicks the "Save" button on the front-end interface;

[0118] The user clicks the "Save" button on the front-end page.

[0119] S15: The front-end interface creates an AJAX request;

[0120] Based on the save action of clicking the button in step S14, the front-end interface creates an asynchronous HTTP request, i.e., an AJAX request.

[0121] An AJAX request is an HTTP request used to enable data interaction between the front-end and the back-end.

[0122] S16: Store the combined data interface configuration information into FormData;

[0123] The front-end page encapsulates the saved combined data interface configuration information into FormData.

[0124] FormData is an API provided by the front-end page for encapsulating and combining data interface configuration information. It is essentially a collection of key-value pairs and is sent via HTTP requests to ensure that it is accurately transmitted to the system.

[0125] The encapsulation includes mapping the combined data interface name, configuration information, and SQL query statement in S1 to key-value pairs of FormData respectively;

[0126] S17: Send FormData to the backend system via an AJAX request;

[0127] The front-end page sends FormData to the back-end system via an AJAX request to complete the transmission of configuration information.

[0128] Step S1 defines the core rules of the composite interface through configuration, replacing traditional hard coding. The configuration content is intuitive and easy to understand, facilitating subsequent maintenance and modification. Furthermore, it allows business personnel to complete the configuration without writing code, lowering the technical barrier. After the configuration code is written, clicking the "Save" button triggers the front-end page to send an AJAX request and FormData to the back-end system. This ensures that the configuration information, after being written on the front-end page, is directly sent to the back-end system for saving. This process achieves direct transmission of configuration information from the front-end page to the back-end system. User actions trigger an automated process, ensuring that the configuration information enters the system storage in real time and accurately, providing a data foundation for subsequent interface calls. Simultaneously, the asynchronous request mechanism avoids front-end page blocking, improving the user experience.

[0129] S2: The backend system receives HTTP request data sent by the frontend, verifies it, and saves it to the database;

[0130] Includes the following sub-steps:

[0131] S21: The backend system receives the HTTP request and retrieves the request data from the request body of the HTTP request;

[0132] The backend system listens for and receives HTTP requests sent by the frontend, and parses the request body according to the HTTP protocol to obtain the request data encapsulated in FormData.

[0133] The requested data is the combined data interface configuration information;

[0134] S22: The backend system validates the format of the request data;

[0135] The backend system validates the requested data to determine if the format of the interface configuration in the combined data interface configuration information is correct. If the validation result is incorrect, the system returns the validation failure response data to the frontend page. If the validation result is correct, the system proceeds to the next step.

[0136] The verification is used to determine whether the combined data interface configuration information is correct;

[0137] S23: Generate a unique ID and save the unique ID and request data to the database;

[0138] After successful verification, the backend system generates a unique ID, associates the unique ID with the correctly verified request data in step S22, and saves it to the database.

[0139] The unique ID is a string or a sequence of numbers and is globally unique.

[0140] S24: Returns the response data indicating successful saving;

[0141] After successful saving, the saved response data will be returned to the front-end page.

[0142] The response data includes a status code and a response body. The status code is used to indicate whether the saving was successful or failed, and the response body contains the unique ID or specific error information.

[0143] Step S2 verifies the accuracy of the configuration information structure to ensure subsequent execution, and associates the configuration with a unique ID to achieve persistent management of the configuration, intercepts invalid configurations in advance to avoid subsequent call failures, and the unique ID provides a precise location basis for subsequent calls, realizing "configuration once, reuse multiple times".

[0144] S3: Call the combined data interface;

[0145] Includes the following sub-steps:

[0146] S31: Call the combined data interface API, passing in a unique ID and a set of execution parameters;

[0147] Developers call the API code of the composite data interface and pass in a unique ID and a set of execution parameters used to locate the configuration information of the composite data interface;

[0148] The set of execution parameters is of Map key-value pair type;

[0149] Map is a data type with a key-value pair structure;

[0150] S32: Determine the unique ID and query the combined data interface configuration information from the database based on the unique ID;

[0151] The backend system verifies the validity of the unique ID by checking if it is empty. If the unique ID is empty, an exception report is thrown and returned to the API caller. If the unique ID is not empty, the system queries the database for the corresponding combined data interface configuration information using an SQL query based on the unique ID. If the combined data interface configuration information is found to be empty, an exception report is thrown and returned to the API caller. If the combined data interface configuration information is not empty, the system proceeds to the next step.

[0152] S33: Create an infinite-level INI format parser, which parses the interface configuration in the combined data interface configuration information queried in S32 and stores it in the variable apiInfo;

[0153] The infinite-level INI format parser adopts the following rules: it maps multi-level node paths to a nested Map key-value pair data structure. The key steps can be summarized as: reading the file, filtering invalid lines, identifying node paths, splitting levels, and building the nested structure.

[0154] The variable apiInfo consists of a List collection of standard data interface information and a Map collection of public parameters;

[0155] The standard data interface information List collection is a collection of standard data interface information, and the elements are standard data interface information, including aliases, standard data interface IDs, and interface parameters;

[0156] The alias is the alias in the section [api.alias], where alias is a user-defined alias;

[0157] The standard data interface ID is the value corresponding to the key 'name' in the section [api.alias].

[0158] The interface parameter is a Map collection, containing all key-value pairs in the section [api.alias.params].

[0159] The common parameters are a Map collection, containing all key-value pairs in the [common_params] section;

[0160] S34: Iterate through each element in the List collection of standard data interface information in the variable apiInfo, i.e., the standard data interface information. Preprocess the interface parameters of the current element, then call the standard data interface API, and pass in the standard data interface ID and the preprocessed interface parameters to obtain the result set of the standard data interface. Store the result set of the standard data interface as a key-value pair in TableInfoMap using the alias and the result set of the standard data interface.

[0161] The result set of the standard data interface consists of two parts: the first part is the data type set, and the second part is the data set.

[0162] The data type set is a Map key-value pair, where the key is the column name and the value is the data type of the column. This data type is the type of the database table field, such as int, varchar(10), decimal(10,2), date, etc.

[0163] The data set is a List collection, and the elements of the collection are key-value pairs of type Map;

[0164] TableInfoMap is a Map collection, a key-value pair structure;

[0165] The purpose of preprocessing the interface parameters is to execute the parameter conversion function, thereby obtaining the function value and replacing the parameter conversion function in the interface parameters. The specific steps of the preprocessing are as follows:

[0166] S341: Iterate through each key-value pair element in the public parameters of the variable apiInfo and determine whether the key of the key-value pair exists in the execution parameter set;

[0167] The backend system iterates through each key-value pair in the public parameters of the variable apiInfo, and checks whether the key of the key-value pair exists in the execution parameter set. If it exists, the value of the key-value pair in the public parameters is replaced with the value of the corresponding key in the execution parameter. If it does not exist, the value of the key-value pair is left as is and no replacement is needed.

[0168] S342: Iterate through each key-value pair in the interface parameters of the current standard data interface and determine the value of the key-value pair element;

[0169] The backend system iterates through each key-value pair in the interface parameters of the current standard data interface and judges the value of each key-value pair. If the value of the key-value pair is a parameter conversion function, the system's function executor is called to accept the parameter conversion function and common parameters, return the function value, and update the value of the corresponding key in the interface parameters to the function value. If the value of the key-value pair is a parameter identifier, the corresponding parameter value is directly retrieved from the common parameters based on the name of the parameter identifier, and the value of the corresponding key in the interface parameters is updated to the function value.

[0170] In simple terms, the above process involves replacing the values ​​of key-value pairs in the public parameters with the values ​​of the corresponding keys in the execution parameters, and then replacing the values ​​of key-value pairs in the interface parameters with parameter conversion functions or parameter identifiers. These values ​​are then replaced with the values ​​of the corresponding keys in the public parameters by the function executor. The processed interface parameters can then be called by the standard data interface API.

[0171] The main function of the function executor is to store functions, parse and execute parameters, convert them into function return results;

[0172] S35: Load the Apache Calcite driver and create a JDBC connection;

[0173] The backend system loads the Apache Calcite driver and establishes a session channel with the Apache Calcite engine through the database connection specification, i.e., a JDBC connection.

[0174] The Apache Calcite driver is an SQL query engine used to virtualize the result sets of multiple standard data interfaces into SQL tables and perform association and aggregation operations through a unified SQL syntax.

[0175] The JDBC connection is a session established with the Calcite engine, used to submit SQL queries and obtain execution results;

[0176] S36: Obtain the root schema from the JDBC connection;

[0177] The root schema can be obtained directly by calling the getRootSchema() method of CalciteConnection through a JDBC connection established by the Apache Calcite engine.

[0178] CalciteConnection is a unique extension of the Apache Calcite engine, providing the getRootSchema() method to retrieve the root schema;

[0179] The root schema is the root node of the entire database metadata, used to store all in-memory tables;

[0180] S37: Iterate through each key-value pair element in TableInfoMap, i.e., the result set of aliases and standard data interfaces, and wrap the result set into an in-memory table with the key as the table name. Store the in-memory table in the root schema for SQL queries to reference.

[0181] The packaging steps are as follows: create an in-memory table, determine the structure of the in-memory table using the data type set in the result set of the standard data interface in TableInfoMap, and use the system iterator to wrap the data set into an iterable object, which serves as the data of the in-memory table.

[0182] S38: Execute the SQL query statement in the combined data interface configuration information and return the final result set;

[0183] The SQL query statement defined in step S13 is parsed and executed using the Apache Calcite engine, and the final integrated result is generated based on the memory table data packaged and stored in the root schema in step S37.

[0184] The final result is a List collection, and the elements of the collection are key-value pairs of type Map.

[0185] Step S3, based on pre-stored configuration and execution parameters, automatically performs parameter conversion, interface calls, and result integration, ultimately returning integrated data. Through infinite-level parsing and parameter preprocessing, it automatically handles interface dependencies and format conversions. Furthermore, with the help of the Apache Calcite engine, it virtualizes the results of standard data interfaces into in-memory tables, enabling flexible integration via SQL without the need for hard-coded association logic.

[0186] This method defines the core rules of combined data interfaces through configuration, combines them with a standardized transmission mechanism, and then uses automated verification and storage processes to achieve flexible integration of multiple standard data interfaces through dynamic execution. This method supports automatic parameter format conversion for any number of standard data interfaces without hard-coding, and data association can be performed without complex SQL statements. It significantly lowers the technical threshold for multi-interface integration, improves the system's response speed to business changes and maintenance efficiency, and effectively solves the problems of low development efficiency, poor flexibility, and reliance on specialized skills inherent in traditional hard-coding methods.

[0187] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of this application. Those skilled in the art may find other optimizations and additional functions in this application. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for integrating multiple standard data interfaces into a single data interface, characterized in that: Includes the following steps: S1: Fill in the combined data interface configuration information and send an HTTP request; Includes the following sub-steps: S11: Enter the name of the combined data interface; S12: Fill in the combined data interface configuration; The combined data interface is configured in the INI format, which supports an unlimited number of levels. S13: Write the SQL query statement; The purpose of the SQL query statement is to process and output data from the result set of the standard data interface. S14: The user clicks the "Save" button on the front-end interface; S15: The front-end interface creates an AJAX request; An AJAX request is an HTTP request used to enable data interaction between the front-end and the back-end. S16: Store the combined data interface configuration information into FormData; FormData is an API provided by the front-end page for encapsulating and combining data interface configuration information. It is essentially a collection of key-value pairs and is sent via HTTP requests to ensure that it is accurately transmitted to the system. S17: Send FormData to the backend system via an AJAX request; S2: The backend system receives AJAX request data sent by the frontend, verifies it, and saves it to the database; Includes the following sub-steps: S21: The backend system receives the AJAX request and retrieves the request data from the request body of the AJAX request; The requested data is the combined data interface configuration information; S22: The backend system validates the format of the request data; The verification is used to determine whether the combined data interface configuration information is correct; S23: Generate a unique ID and save the unique ID and request data to the database; The unique ID is a string or a sequence of numbers and is globally unique. S24: Returns the response data indicating successful saving; The response data includes a status code and a response body. The status code is used to indicate whether the saving was successful or failed, and the response body contains the unique ID or specific error information. S3: Call the combined data interface; Includes the following sub-steps: S31: Call the combined data interface API, passing in a unique ID and a set of execution parameters; The set of execution parameters is of Map key-value pair type; Map is a key-value pair data type; S32: Determine the unique ID and query the combined data interface configuration information from the database based on the unique ID; S33: Create an infinite-level INI format parser, which parses the interface configuration in the combined data interface configuration information queried in S32 and stores it in the variable apiInfo; The variable apiInfo consists of a List collection of standard data interface information and a Map collection of public parameters; The Map collection is a collection that uses Map as the base unit; The standard data interface information List collection is a collection of standard data interface information, and the elements are standard data interface information, including aliases, standard data interface IDs, and interface parameters; S34: Iterate through each element in the List collection of standard data interface information in the variable apiInfo, i.e., the standard data interface information. Preprocess the interface parameters of the current element, then call the standard data interface API, and pass in the standard data interface ID and the preprocessed interface parameters to obtain the result set of the standard data interface. Store the result set of the standard data interface as a key-value pair in TableInfoMap using the alias and the result set of the standard data interface. The preprocessing includes the following sub-steps: S341: Iterate through each key-value pair element in the public parameters of the variable apiInfo and determine whether the key of the key-value pair exists in the execution parameter set; The backend system iterates through each key-value pair in the public parameters of the variable apiInfo, and checks whether the key of the key-value pair exists in the execution parameter set. If it exists, the value of the key-value pair in the public parameters is replaced with the value of the corresponding key in the execution parameter. If it does not exist, the value of the key-value pair is left as is and no replacement is needed. S342: Iterate through each key-value pair in the interface parameters of the current standard data interface and determine the value of the key-value pair element; The backend system iterates through each key-value pair in the interface parameters of the current standard data interface and judges the value of each key-value pair. If the value of the key-value pair is a parameter conversion function, the system's function executor is called to accept the parameter conversion function and common parameters, return the function value, and update the value of the corresponding key in the interface parameters to the function value. If the value of the key-value pair is a parameter identifier, the corresponding parameter value is directly retrieved from the common parameters based on the name of the parameter identifier, and the value of the corresponding key in the interface parameters is updated to the function value. The main function of the function executor is to store functions, parse and execute parameters, convert them into function return results; TableInfoMap is a Map collection, a key-value pair structure; S35: Load the Apache Calcite driver and create a JDBC connection; The Apache Calcite driver is an SQL query engine used to virtualize the result sets of multiple standard data interfaces into database tables and perform association and aggregation operations through unified SQL syntax. The JDBC connection is a session established with the Calcite engine, used to submit SQL queries and obtain execution results; S36: Obtain the root schema from the JDBC connection; The root schema is the root node of the entire database metadata, used to store all in-memory tables; S37: Iterate through each key-value pair element in TableInfoMap, i.e., the result set of aliases and standard data interfaces, and pack the result set into an in-memory table, using the key as the table name, and store the in-memory table in the root schema; S38: Execute the SQL query statement in the combined data interface configuration information and return the final result set; The final result set is a List collection, and the elements of the collection are key-value pairs of type Map.

2. The method for integrating multiple standard data interfaces into one data interface as described in claim 1, characterized in that: The specific details of step S1 are as follows: S11: Enter the name of the combined data interface; Assign a unique name to the combined data interface, the name being used to identify and invoke the combined data interface in the system; S12: Fill in the combined data interface configuration; Write the configuration information for the combined data interface. The format of the combined data interface configuration is INI format, and unlimited levels are supported by using delimiters in the section name. S13: Write the SQL query statement; Based on the Apache Calcite query engine syntax, write SQL query statements to define the integration logic of multi-standard data interface result sets; S14: The user clicks the "Save" button; The user clicks the "Save" button on the front-end page; S15: The front-end interface creates an AJAX request; Based on the save action in step S14, the front-end interface creates an asynchronous HTTP request, i.e., an AJAX request. S16: Store the combined data interface configuration information into FormData; Encapsulate the completed combined data interface configuration information into FormData; The encapsulation includes mapping the combined data interface name, configuration information, and SQL query statement in S1 to key-value pairs of FormData respectively; S17: Send FormData to the backend system via an AJAX request; The front-end page sends FormData to the back-end system via an AJAX request.

3. The method for integrating multiple standard data interfaces into one data interface as described in claim 2, characterized in that: In step S12, the combined data interface configuration information includes: The combined data interface configuration has two top-level sections: section [api] and section [common_params]. The section [api] has one or more subsections, and the subsections are alias subsections; The alias subsection contains a key-value pair, where the key is "name" and the value is the standard data interface ID. The alias subsection also contains a [params] subsection. The [params] subsection contains one or more key-value pairs. The key of each key-value pair is the parameter name of the standard data interface, and the value is one of the following: parameter conversion function, specific value, or parameter identifier in the form of $name. The section [common_params] is the common parameter configuration section, which contains one or more key-value pairs. The key of each key-value pair is the parameter name, and the value is the parameter value.

4. The method for integrating multiple standard data interfaces into one data interface as described in claim 1, characterized in that: The specific details of step S2 are as follows: S21: The backend system receives the HTTP request and retrieves the request data from the request body of the HTTP request; The backend system listens for and receives the request body of the HTTP request sent by the frontend, and parses the request body according to the HTTP protocol to obtain the request data encapsulated in FormData; S22: The backend system validates the requested data; The backend system validates the request data to determine if the format of the interface configuration in the combined data interface configuration information is correct. If the validation result is incorrect, the system returns the validation failure response data to the frontend page. If the validation result is correct, the system proceeds to the next step. S23: Generate a unique ID and save the unique ID and request data to the database; If the verification result is correct, the backend system generates a unique ID, associates the unique ID with the correctly verified request data in step S22, and saves it to the database. S24: Returns the response data indicating successful saving; After successful saving, the saved response data will be returned to the front-end page.

5. The method for integrating multiple standard data interfaces into one data interface as described in claim 1, characterized in that: In step S32, the backend system determines whether the unique ID is empty. If the unique ID is empty, it throws an exception report and returns it to the API caller. If the unique ID is not empty, it queries the database for the corresponding combined data interface configuration information based on the unique ID using an SQL query statement. If the configuration information of the combined data interface is found to be empty, an exception report is thrown and returned to the API caller. If the configuration information of the combined data interface is not empty, the next step is executed.

6. The method for integrating multiple standard data interfaces into one data interface as described in claim 1, characterized in that: In step S33, the alias is the alias in the section [api.alias], where alias is a user-defined alias; The standard data interface ID is the value corresponding to the key 'name' in the section [api.alias]. The interface parameter is a Map collection, containing all key-value pairs in the section [api.alias.params]. The common parameters are a Map collection containing all key-value pairs in the [common_params] section.

7. The method for integrating multiple standard data interfaces into one data interface as described in claim 1, characterized in that: In step S34, the result set of the standard data interface consists of two parts: the first part is a data type set, and the second part is a data set. The data type set is a Map key-value pair, where the key is the column name and the value is the data type of the column, which is the type of the database table field. The data set is a List collection, and the elements of the collection are key-value pairs of type Map.

8. The method for integrating multiple standard data interfaces into one data interface as described in claim 1, characterized in that: In sub-step S37, the packaging step is as follows: create a memory table, determine the memory table structure based on the data type set in the result set of the standard data interface in TableInfoMap, and use the system iterator to package the data set into an iterable object, which serves as the data of the memory table.

9. The method for integrating multiple standard data interfaces into one data interface as described in claim 1, characterized in that: In step S38, the SQL query statement defined in step S13 is parsed and executed by the Apache Calcite engine, and the final integration result is generated based on the memory table data of the root schema packaged and stored in step S37.

Citation Information

Patent Citations

  • Data query method and system supporting multiple data sources

    CN115269629A

  • Metadata directory management system and method for massive scientific data

    CN116737113A