Method for integrating multiple standard data interfaces into one data interface
By combining data interface configuration information and using the Apache Calcite engine, the problem of inefficient integration of multiple standard data interfaces is solved, efficient and flexible data interface integration and maintenance are achieved, the technical threshold is lowered, and business personnel are supported to configure independently.
Patent Information
- Application Number
- CN202511143240.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-15
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2045-08-15
AI Technical Summary
During report development and data processing, when calling multiple standard data interfaces, a large amount of code needs to be written to handle parameter merging, parameter conversion, and data merging. This leads to low efficiency, complex code, difficult maintenance, and high technical barriers, making it impossible for ordinary business personnel to configure it independently.
By writing combined data interface configuration information, using the INI format and the Apache Calcite engine, a unique ID is generated and the configuration information is stored, the integration of multiple standard data interfaces is achieved, the infinite-level INI format and SQL query statements are used to define the data integration logic, and the configuration information is saved using AJAX requests and back-end system verification. The Apache Calcite engine is used to execute SQL queries to generate the final results.
It improves the efficiency of data interface integration, lowers the technical threshold, realizes the automatic adaptation and flexible integration of multiple standard data interfaces, reduces the difficulty of repeated code development and maintenance, and business personnel can configure it independently without relying on developers.
Smart Images

Figure CN120705172A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer software technology, and in particular to a method for integrating multiple standard data interfaces into one data interface. Background Art
[0002] In the fields of report development, data processing, application development, etc., standard data interfaces define unified data formats, transmission protocols and operating specifications, standardize the management of data interfaces of different applications or databases, reduce the development workload and difficulty caused by inconsistent data formats and interfaces between different systems, reduce the cost of software development and maintenance, and greatly facilitate developers.
[0003] However, when developers call multiple standard data interfaces for report development or data processing, they still need to write a large amount of code to handle parameter merging, parameter conversion, and data consolidation across multiple standard data interfaces. This approach is inefficient and complex, requiring different code to be written for different parameter merging, parameter conversion, and data consolidation issues, making it difficult to reuse and 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 a waste of resources. Furthermore, developers need to master the details of multiple interfaces, and the configuration of traditional technical tools requires the participation of data engineers, which has a high technical threshold and is difficult for ordinary business personnel to configure independently. Summary of the Invention
[0004] The purpose of the present invention is to solve the above-mentioned problem, and a method for integrating multiple standard data interfaces into one data interface is proposed. The method comprises writing the combined data interface configuration information, applying the parsed combined data interface configuration information, obtaining the standard data interface ID, standard data interface parameters, parameter conversion function, processing statement and common parameters, using the parameter conversion function to convert the common parameters into standard data interface parameters, calling the standard data interface to obtain standard data interface data, using the processing statement to merge the standard data interface data, and generating the final data, thereby realizing the integration of multiple standard data interfaces into one data interface.
[0005] In order to achieve the above purpose, the following technical solutions are adopted: A method for integrating multiple standard data interfaces into one data interface comprises the following steps: S1: Fill in the combined data interface configuration information and send an HTTP request; The following sub-steps are included: S11: Fill in the name of the combined data interface; A unique identification name is assigned to the combined data interface, and the name is used to identify and call the combined data interface in the system.
[0006] S12: Fill in the combined data interface configuration; The format of the combined data interface configuration adopts the INI format that supports unlimited levels; The combined data interface configuration information is written. The format of the combined data interface configuration adopts the INI format, and supports unlimited levels by using separators in the section name.
[0007] The combined data interface configuration information includes: The combined data interface configuration has two top-level sections, namely section [api] and section [common_params]; The section [api] contains one or more subsections, such as section [api.alias]. The subsections are alias subsections, i.e., the alias in the subsection is the alias of the result set of the standard data interface; There is a key-value pair under the alias subsection, the key of the key-value pair is name, and the value is the standard data interface ID. There is a [params] subsection under the alias subsection, such as [api.alias.params], which is a parameter configuration section; The [params] subsection contains one or more key-value pairs, where the key is the parameter name of the standard data interface and the value is a parameter conversion function, a specific value, or a parameter marker in the form of $name; The section [common_params] is a 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; S13: Write SQL query statements; Based on the Apache Calcite query engine syntax, write SQL query statements to define the integration logic of multi-standard data interface result sets.
[0008] The SQL query statement is one of a with...select statement or a select statement; The function of the SQL query statement is to process and output data on the result set of the standard data interface; S14: The user clicks the “Save” button on the front-end interface; The user clicks the "Save" button on the front-end page.
[0009] S15: The front-end interface creates an AJAX request; Based on the saving action in step S14 , the front-end interface creates an asynchronous HTTP request, namely an AJAX request.
[0010] AJAX request is an HTTP request used to allow the front-end and back-end to interact with each other. S16: Store the combined data interface configuration information into FormData; Encapsulate the completed combined data interface configuration information into FormData.
[0011] The encapsulation includes mapping the combined data interface name, configuration information and SQL query statement in S1 into key-value pairs of FormData respectively; FormData is an API provided by the front-end page for encapsulating combined data interface configuration information. It is essentially a collection data structure of key-value pairs and is sent through HTTP requests to ensure that it is accurately delivered to the system. S17: Send FormData to the backend system through AJAX request; The front-end page sends FormData to the back-end system through AJAX request.
[0012] S2: The backend system receives the HTTP request data sent by the frontend, verifies it and saves it to the database; The following sub-steps are included: S21: The backend system receives the HTTP request and obtains the request data from the request body of the HTTP request; The backend system listens to and receives the HTTP request sent by the frontend, parses the request body according to the HTTP protocol to obtain the request data encapsulated in FormData; The request data is combined data interface configuration information; S22: The backend system verifies the format of the requested data; The verification is to determine whether the combined data interface configuration information is correct; The back-end system verifies the request data to determine whether the format of the interface configuration in the combined data interface configuration information is correct. If the verification result is incorrect, the response data indicating the verification failure error is returned to the front-end page. If the verification result is correct, the next step is carried out. S23: Generate a unique ID and save the unique ID and the request data into the database; The unique ID is a string or a sequence of numbers and is globally unique; If the verification result is correct, the backend system generates a unique ID, associates the unique ID with the request data verified to be correct in step S22, and saves it to the database; S24: Return the response data of successful saving; The response data includes a status code and a response body, wherein the status code is used to indicate whether the save is successful or failed, and the response body includes the unique ID or specific error information; After successful saving, the saved response data will be returned to the front-end page.
[0013] S3: Call the combined data interface; The following sub-steps are included: S31: Call the combined data interface API and pass in the unique ID and execution parameter set; The developer calls the API code of the combined data interface and passes in the unique ID and execution parameter set used to locate the combined data interface configuration information; The execution parameter set is of Map key-value pair type; Map is a data type with a key-value pair structure; S32: Determine the unique ID and query the combined data interface configuration information from the database according to the unique ID; The back-end system determines whether the unique ID 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 corresponding combined data interface configuration information is queried from the database through an SQL query statement 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 next step is executed; S33: Create an infinite-level INI format parser, parse the interface configuration in the combined data interface configuration information queried in S32 through the parser, and store it in the variable apiInfo; The variable apiInfo consists of a List set of standard data interface information and a Map set of public parameters; The Map set is a set with Map as the base unit; The standard data interface information List set is a set of standard data interface information, and its elements are standard data interface information, including alias, standard data interface ID, and interface parameters; The alias is the alias in the section [api.alias], and 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, and the data is all key-value pairs in the section [api.alias.params]; The common parameters are a Map collection, and the data are all key-value pairs in the [common_params] section; S34: traverse each element in the standard data interface information List collection in the variable apiInfo, that is, 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, and store the alias and the result set of the standard data interface as a key-value pair in TableInfoMap; 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. The data type is the type of the database table field, such as int, varchar(10), decimal(10,2), date, etc.
[0014] The data set is a List set, and the elements of the set are key-value pairs of Map type; TableInfoMap is a Map collection, a key-value pair structure; 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: S341: traverse each key-value pair element in the public parameter of the variable apiInfo, and determine whether the key of the key-value pair exists in the execution parameter set; The backend system traverses each key-value pair element in the public parameter of the variable apiInfo and determines whether the key of the key-value pair exists in the execution parameter set. If so, the value of the key-value pair in the public parameter is replaced with the value of the corresponding key of the execution parameter. If not, the value of the key-value pair retains the original value and does not need to be replaced. S342: traverse 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 back-end system traverses each key-value pair element in the interface parameters of the current standard data interface and determines the value of the key-value pair element. If the value of the key-value pair element is a parameter conversion function, the function executor in the system is called to accept the parameter conversion function and public parameters, return the function value, and update the value of the corresponding key in the interface parameter to the function value; if the value of the key-value pair element is a parameter marker, the corresponding parameter value is directly queried from the public parameters according to the name of the parameter marker, and the value of the corresponding key in the interface parameter is updated to the function value; The main function of the function executor is to store functions, parse and execute parameters, convert functions and return results; S35: Load the Apache Calcite driver and create a JDBC connection; The backend system loads the Apache Calcite driver and establishes a session channel with the Apache Calcite engine through the database connection specification, that is, a JDBC connection; The Apache Calcite driver is an SQL query engine that converts result sets from multiple standard data interfaces into SQL tables and performs join and aggregation operations using a unified SQL syntax. The JDBC connection is a session established with the calcite engine, used to submit SQL queries and obtain execution results; S36: Get the root schema from the JDBC connection; Using the JDBC connection established by the Apache Calcite engine, call the getRootSchema() method of CalciteConnection to directly obtain the root schema; CalciteConnection is a special extension of the Apache Calcite engine that provides a getRootSchema() method for obtaining the root schema. The root schema is the root node of the entire database metadata and is used to store all memory tables; S37: Traverse each key-value pair element in TableInfoMap, that is, the result set of the alias and the standard data interface, and package the result set into a memory table, using the key as the table name, and store the memory table in the root schema for SQL query reference; The packaging steps are as follows: creating a memory table, determining the memory table structure using the data type set in the result set of the standard data interface in TableInfoMap, and using the system iterator to package the data set into an iterable object, which serves as the data of the memory table; S38: Execute the SQL query statement in the combined data interface configuration information and return the final result set; Parse and execute the SQL query statement defined in step S13 through the Apache Calcite engine, and generate the final integration result based on the memory table data packaged and stored in the root schema in step S37; The final result is a List collection, and the elements of the collection are key-value pairs of Map type.
[0015] Compared with the prior art, the present invention has the following beneficial effects: 1. The present invention pre-stores the integration rules of the combined interface in the system by compiling the combined data interface configuration information, determines the unique ID and stores the configuration information in association with the unique ID, and directly calls the combined data interface through the unique ID to avoid repeated 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, eliminating the compilation and deployment links, improving the efficiency of data interface integration, and improving maintenance efficiency.
[0016] 2. The present invention adopts an infinite-level INI format, establishes interface dependencies and parameter rules with the two top-level sections [api] and [common_params] as the core, and defines data integration logic using SQL statements to improve the adaptability to complex interface dependencies.
[0017] 3. This invention adopts a configuration-based approach, defining data integration logic by writing SQL query statements and executing them through the Apache Calcite engine. This enables standardized association, aggregation, and other processing of multiple standard data interface result sets. Business personnel can independently configure based on common SQL syntax without relying on developers to write integration code, thus lowering the technical threshold.
[0018] 4. The present invention preprocesses the interface parameters of different standard data interfaces, and through the three parts of execution parameters-common parameters-interface parameters, the execution parameters cover the common parameters, and the common parameters cover the interface parameters. Developers can flexibly and freely set dynamic or static parameters and automatically perform function conversion, thereby realizing automatic adaptation of parameter formats between different standard data interfaces, replacing the manual coding conversion method in the prior art, and reducing call errors caused by format mismatch. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A flowchart of the steps of a method for integrating multiple standard data interfaces into one data interface according to the present invention; DETAILED DESCRIPTION
[0020] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are described in detail below with reference to the accompanying drawings.
[0021] like Figure 1 As shown, a method for integrating multiple standard data interfaces into one data interface includes the following steps: S1: Fill in the combined data interface configuration information and send an HTTP request; The following sub-steps are included: S11: Fill in the name of the combined data interface; The developer inputs a unique identification name for the combined data interface on the front-end page, and the name is used to identify and call the combined data interface in the system.
[0022] S12: Fill in the combined data interface configuration; Write the combined data interface configuration information. The format of the combined data interface configuration adopts the INI format that supports unlimited levels. Support for unlimited levels is achieved by using separators in the section name.
[0023] The combined data interface configuration information includes: The combined data interface configuration has two top-level sections, namely section [api] and section [common_params]; The section [api] contains one or more subsections, such as section [api.alias]. The subsections are alias subsections, i.e., the alias in the subsection is the alias of the result set of the standard data interface; There is a key-value pair under the alias subsection, the key of the key-value pair is name, and the value is the standard data interface ID. There is a [params] subsection under the alias subsection, such as [api.alias.params], which is a parameter configuration section; In 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; The [params] subsection contains one or more key-value pairs, where the key is the parameter name of the standard data interface and the value is a parameter conversion function, a specific value, or a parameter marker in the form of $name; The format of the parameter conversion function is: parameter conversion function name (parameter value 1, parameter value 2, ...).
[0024] The parameter conversion function can have 0 or more parameters. If the parameter needs to use the value of the key in the following section [common_params], the parameter must be in the format of $name, where name is the key name of the section common_params.
[0025] The name in the parameter marker of the form $name is the key name of the section [common_params].
[0026] The section [common_params] is a common parameter configuration section, which contains one or more key-value pairs. The key of the key-value pair is the parameter name, and the value is the parameter value, which is shared by all standard data interfaces.
[0027] S13: Write SQL query statements; Based on the Apache Calcite query engine syntax, write SQL query statements to define the integration logic of multiple standard data interface result sets, and to define the integration logic of multiple interface results.
[0028] The SQL query statement may be a with...select statement or a select statement; The function of the SQL query statement is to process and output data on the result set of the standard data interface.
[0029] S14: The user clicks the “Save” button on the front-end interface; The user clicks the "Save" button on the front-end page.
[0030] S15: The front-end interface creates an AJAX request; Based on the save action of clicking the button in step S14, the front-end interface creates an asynchronous HTTP request, namely an AJAX request.
[0031] AJAX request is an HTTP request used to allow the front-end and back-end to interact with each other. S16: Store the combined data interface configuration information into FormData; The front-end page encapsulates the saved combined data interface configuration information into FormData.
[0032] FormData is an API provided by the front-end page for encapsulating combined data interface configuration information. It is essentially a collection data structure of key-value pairs and is sent through HTTP requests to ensure that it is accurately delivered to the system. The encapsulation includes mapping the combined data interface name, configuration information and SQL query statement in S1 into key-value pairs of FormData respectively; S17: Send FormData to the backend system through AJAX request; The front-end page sends FormData to the back-end system through AJAX request to complete the transmission of configuration information.
[0033] Step S1 defines the core rules of the combined interface in a configuration-based manner, replacing traditional hard coding. The configuration content is intuitive and easy to understand, facilitating subsequent maintenance and modification, and allowing business personnel to complete the configuration without writing code, thereby lowering the technical threshold. After the configuration code is written, the user clicks the "Save" button, triggering the front-end page to send an AJAX request and FormData to the back-end system. After the configuration information is written on the front-end page, it is directly sent to the back-end system for saving. This process realizes the direct transmission of configuration information from the front-end page to the back-end system. The automated process is triggered by user operations to ensure that the configuration information enters the system storage link in real time and accurately, providing a data basis for subsequent interface calls. At the same time, the asynchronous request mechanism avoids blocking of the front-end page and improves the user operation experience.
[0034] S2: The backend system receives the HTTP request data sent by the frontend, verifies it and saves it to the database; The following sub-steps are included: S21: The backend system receives the HTTP request and obtains the request data from the request body of the HTTP request; The backend system listens to and receives 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.
[0035] The request data is combined data interface configuration information; S22: The backend system verifies the format of the requested data; The back-end system verifies the request data to determine whether the format of the interface configuration in the combined data interface configuration information is correct. If the verification result is incorrect, the response data of the verification failure error is returned to the front-end page. If the verification result is correct, the next step is carried out.
[0036] The verification is to determine whether the combined data interface configuration information is correct; S23: Generate a unique ID and save the unique ID and the request data into the database; After the verification is passed, the back-end system generates a unique ID, associates the unique ID with the request data verified to be correct in step S22, and saves it to the database.
[0037] The unique ID is a string or a sequence of numbers and is globally unique; S24: Return the response data of successful saving; After successful saving, the saved response data will be returned to the front-end page.
[0038] The response data includes a status code and a response body, wherein the status code is used to indicate whether the save is successful or failed, and the response body includes the unique ID or specific error information; Step S2 verifies the accuracy of the structure of the configuration information to ensure subsequent execution, and associates the configuration through a unique ID to achieve persistent management of the configuration, intercept invalid configurations in advance, and avoid subsequent call failures. The unique ID provides a precise positioning basis for subsequent calls, achieving "one-time configuration, multiple reuse".
[0039] S3: Call the combined data interface; The following sub-steps are included: S31: Call the combined data interface API and pass in the unique ID and execution parameter set; The developer calls the API code of the combined data interface and passes in the unique ID and execution parameter set used to locate the combined data interface configuration information; The execution parameter set is of Map key-value pair type; Map is a data type with a key-value pair structure; S32: Determine the unique ID and query the combined data interface configuration information from the database according to the unique ID; The back-end system verifies the legitimacy of the unique ID and determines whether the unique ID 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 corresponding combined data interface configuration information is queried from the database through an SQL query statement 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 next step is executed.
[0040] S33: Create an infinite-level INI format parser, parse the interface configuration in the combined data interface configuration information queried in S32 through the parser, and store it in the variable apiInfo; The infinite-level INI format parser adopts the following rules: mapping multi-level node paths into nested Map key-value pair data structures. The key steps can be summarized as: reading files, filtering invalid lines, identifying node paths, splitting levels, and building nested structures.
[0041] The variable apiInfo consists of a List set of standard data interface information and a Map set of public parameters; The standard data interface information List set is a set of standard data interface information, and its elements are standard data interface information, including alias, standard data interface ID, and interface parameters; The alias is the alias in the section [api.alias], and 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, and the data is all key-value pairs in the section [api.alias.params]; The common parameters are a Map collection, and the data are all key-value pairs in the [common_params] section; S34: traverse each element in the standard data interface information List collection in the variable apiInfo, that is, 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, and store the alias and the result set of the standard data interface as a key-value pair in TableInfoMap; 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. The data type is the type of the database table field, such as int, varchar(10), decimal(10,2), date, etc.
[0042] The data set is a List set, and the elements of the set are key-value pairs of Map type; TableInfoMap is a Map collection, a key-value pair structure; 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: S341: traverse each key-value pair element in the public parameter of the variable apiInfo, and determine whether the key of the key-value pair exists in the execution parameter set; The backend system traverses each key-value pair element in the public parameter of the variable apiInfo to determine whether the key of the key-value pair exists in the execution parameter set. If so, the value of the key-value pair in the public parameter is replaced with the value of the corresponding key of the execution parameter. If not, the value of the key-value pair retains the original value and does not need to be replaced. S342: traverse 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 back-end system traverses each key-value pair element in the interface parameters of the current standard data interface and determines the value of the key-value pair element. If the value of the key-value pair element is a parameter conversion function, the function executor in the system is called to accept the parameter conversion function and public parameters, return the function value, and update the value of the corresponding key in the interface parameter to the function value; if the value of the key-value pair element is a parameter marker, the corresponding parameter value is directly queried from the public parameters according to the name of the parameter marker, and the value of the corresponding key in the interface parameter is updated to the function value; The above process can be simply summarized as follows: the value of the key-value pair in the public parameter is replaced with the value of the corresponding key of the execution parameter, and the value of the key-value pair in the interface parameter is converted into a parameter function or parameter marker, which is replaced with the value of the corresponding key of the public parameter through the function executor. The processed interface parameters can be called by the standard data interface API.
[0043] The main function of the function executor is to store functions, parse and execute parameters, convert functions and return results; S35: Load the Apache Calcite driver and create a JDBC connection; The backend system loads the Apache Calcite driver and establishes a session channel with the Apache Calcite engine through the database connection specification, that is, the JDBC connection.
[0044] The Apache Calcite driver is an SQL query engine that converts result sets from multiple standard data interfaces into SQL tables and performs join and aggregation operations using a unified SQL syntax. The JDBC connection is a session established with the calcite engine, used to submit SQL queries and obtain execution results; S36: Get the root schema from the JDBC connection; Through the JDBC connection established by the Apache Calcite engine, call the getRootSchema() method of CalciteConnection to directly obtain the root schema.
[0045] CalciteConnection is a special extension of the Apache Calcite engine that provides a getRootSchema() method for obtaining the root schema. The root schema is the root node of the entire database metadata and is used to store all memory tables; S37: Traverse each key-value pair element in TableInfoMap, that is, the result set of the alias and the standard data interface, and package the result set into a memory table, using the key as the table name, and store the memory table in the root schema for SQL query reference.
[0046] The packaging steps are as follows: creating a memory table, determining the memory table structure using the data type set in the result set of the standard data interface in TableInfoMap, and using the system iterator to package the data set into an iterable object, which serves as the data of the memory table; S38: Execute the SQL query statement in the combined data interface configuration information and return the final result set; 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 packaged and stored in the root schema in step S37.
[0047] The final result is a List collection, and the elements of the collection are key-value pairs of Map type.
[0048] Step S3 automatically performs parameter conversion, interface calls, and result integration based on pre-stored configurations and execution parameters, and finally returns the integrated data. Through infinite-level parsing and parameter preprocessing, it automatically handles interface dependencies and format conversions. With the help of the Apache Calcite engine, the standard data interface results are virtualized into memory tables, and flexible integration is achieved through SQL without the need for hard-coded association logic.
[0049] This approach defines the core rules for combining data interfaces through configuration, combines them with standardized transmission mechanisms, and then implements automated verification and storage processes, ultimately achieving flexible integration of multiple standard data interfaces through dynamic execution. This approach supports any number of standard data interfaces, automatically converting parameter formats without hard coding, and enables data association without complex SQL statements. This significantly lowers the technical barriers to multi-interface integration, improves the system's responsiveness to business changes, and improves maintenance efficiency. It effectively addresses the low development efficiency, poor flexibility, and reliance on specialized skills inherent in traditional hard-coding approaches.
[0050] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Those skilled in the art will appreciate that the present application may have other optimization schemes and additional functions. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A method for integrating multiple standard data interfaces into one data interface, characterized in that: The following steps are involved: S1: Fill in the combined data interface configuration information and send an HTTP request; The following sub-steps are included: S11: Fill in the name of the combined data interface; S12: Fill in the combined data interface configuration; The format of the combined data interface configuration adopts the INI format that supports unlimited levels; S13: Write SQL query statements; The function of the SQL query statement is to process and output data on 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; AJAX request is an HTTP request used to allow the front-end and back-end to interact with each other. S16: Store the combined data interface configuration information into FormData; FormData is an API provided by the front-end page for encapsulating combined data interface configuration information. It is essentially a collection data structure of key-value pairs and is sent through HTTP requests to ensure that it is accurately delivered to the system. S17: Send FormData to the backend system through AJAX request; S2: The backend system receives the AJAX request data sent by the frontend, verifies it and saves it to the database; The following sub-steps are included: S21: The backend system receives the AJAX request and obtains the request data from the request body of the AJAX request; The request data is combined data interface configuration information; S22: The backend system verifies the format of the requested data; The verification is to determine whether the combined data interface configuration information is correct; S23: Generate a unique ID and save the unique ID and the request data into the database; The unique ID is a string or a sequence of numbers and is globally unique; S24: Return the response data of successful saving; The response data includes a status code and a response body, wherein the status code is used to indicate whether the save is successful or failed, and the response body includes the unique ID or specific error information; S3: Call the combined data interface; The following sub-steps are included: S31: Call the combined data interface API and pass in the unique ID and execution parameter set; The execution parameter set is a Map key-value pair type, which is the dynamic business data passed in when calling; Map is a data type with a "key-value pair" structure; S32: Determine the unique ID and query the combined data interface configuration information from the database according to the unique ID; S33: Create an infinite-level INI format parser, parse the interface configuration in the combined data interface configuration information queried in S32 through the parser, and store it in the variable apiInfo; The variable apiInfo consists of a List set of standard data interface information and a Map set of public parameters; The standard data interface information List set is a set of standard data interface information, and its elements are standard data interface information, including alias, standard data interface ID, and interface parameters; The Map set is a set with Map as the base unit; S34: traverse each element in the standard data interface information List collection in the variable apiInfo, that is, 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, and store the alias and the result set of the standard data interface as a key-value pair in TableInfoMap; 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 that virtualizes the result sets of multiple standard data interfaces into database tables and performs association and aggregation operations using a unified SQL syntax. The JDBC connection is a session established with the calcite engine, used to submit SQL queries and obtain execution results; S36: Get the root schema from the JDBC connection; The root schema is the root node of the entire database metadata and is used to store all memory tables; S37: Traverse each key-value pair element in TableInfoMap, that is, the result set of the alias and the standard data interface, and package the result set into a memory table, using the key as the table name, and store the 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 set, and the elements of the set are key-value pairs of Map type.
2. The method for integrating multiple standard data interfaces into one data interface according to claim 1, wherein: The specific contents of step S1 are as follows: S11: Fill in the name of the combined data interface; Assigning a unique identification name to the combined data interface for identifying and calling the combined data interface in the system; S12: Fill in the combined data interface configuration; Write the combined data interface configuration information. The combined data interface configuration adopts the INI format and supports unlimited levels by using separators in the section name. S13: Write SQL query statements; 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 compiled combined data interface configuration information into FormData; The encapsulation includes mapping the combined data interface name, configuration information and SQL query statement in S1 into key-value pairs of FormData respectively; S17: Send FormData to the backend system through AJAX request; The front-end page sends FormData to the back-end system through AJAX request.
3. The method for integrating multiple standard data interfaces into one data interface according to claim 2, wherein: In step S12, the combined data interface configuration information includes: The combined data interface configuration has two top-level sections, namely section [api] and section [common_params]; The section [api] has one or more subsections, such as section [api.alias], which are alias subsections. That is, the alias in the subsection is the alias of the result set of the standard data interface; There is a key-value pair under the alias subsection, the key of the key-value pair is name, and the value is the standard data interface ID. There is a [params] subsection under the alias subsection, such as [api.alias.params], which is a parameter configuration section; The [params] subsection contains one or more key-value pairs, where the key is the parameter name of the standard data interface and the value is a parameter conversion function, a specific value, or a parameter marker in the form of $name; The section [common_params] is a 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.
4. The method for integrating multiple standard data interfaces into one data interface according to claim 1, wherein: The specific content of step S2 is as follows: S21: The backend system receives the HTTP request and obtains the request data from the request body of the HTTP request; The backend system listens to and receives the request body of the HTTP request sent by the frontend, parses the request body according to the HTTP protocol to obtain the request data encapsulated in FormData; S22: The backend system verifies the requested data; The back-end system verifies the request data to determine whether the format of the interface configuration in the combined data interface configuration information is correct. If the verification result is incorrect, the response data indicating the verification failure error is returned to the front-end page. If the verification result is correct, the next step is carried out. S23: Generate a unique ID and save the unique ID and the request data into the database; If the verification result is correct, the backend system generates a unique ID, associates the unique ID with the request data verified to be correct in step S22, and saves it to the database; S24: Return the response data of 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 according to claim 1, wherein: In step S32, the backend system determines whether the unique ID 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 corresponding combined data interface configuration information is queried from the database through an SQL query statement based on the unique ID; If the combination data interface configuration information is found to be empty, an exception report is thrown and returned to the API caller; if the combination data interface configuration information is not empty, the next step is executed.
6. The method for integrating multiple standard data interfaces into one data interface according to claim 1, wherein: In step S33, the alias is alias in the section [api.alias], and 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, and the data is all key-value pairs in the section [api.alias.params]; The common parameters are a Map collection, and the data are all key-value pairs in the [common_params] section.
7. The method for integrating multiple standard data interfaces into one data interface according to claim 1, wherein: 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 column data type, which is the type of the database table field; The data set is a List set, and the elements of the set are key-value pairs of Map type.
8. The method for integrating multiple standard data interfaces into one data interface according to claim 1, wherein: In step S34, the purpose of preprocessing is to execute the parameter conversion function, thereby obtaining the function value and replacing the parameter conversion function in the interface parameter. The specific steps of the preprocessing are as follows: S341: traverse each key-value pair element in the public parameter of the variable apiInfo, and determine whether the key of the key-value pair exists in the execution parameter set; The backend system traverses each key-value pair element in the public parameter of the variable apiInfo to determine whether the key of the key-value pair exists in the execution parameter set. If so, the value of the key-value pair in the public parameter is replaced with the value of the corresponding key of the execution parameter. If not, the value of the key-value pair retains the original value and does not need to be replaced. S342: traverse 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 back-end system traverses each key-value pair element in the interface parameters of the current standard data interface and determines the value of the key-value pair element. If the value of the key-value pair element is a parameter conversion function, the function executor in the system is called to accept the parameter conversion function and public parameters, return the function value, and update the value of the corresponding key in the interface parameter to the function value; if the value of the key-value pair element is a parameter marker, the corresponding parameter value is directly queried from the public parameters according to the name of the parameter marker, and the value of the corresponding key in the interface parameter is updated to the function value; The main function of the function executor is to store functions, parse and execute parameters, convert functions and return results.
9. The method for integrating multiple standard data interfaces into one data interface according to claim 1, wherein: In sub-step S37, the packaging step is: create a memory table, determine the memory table structure with 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.
10. The method for integrating multiple standard data interfaces into one data interface according to claim 1, wherein: 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 packaged and stored in the root schema in step S37.
Citation Information
Patent Citations
Heterogeneous service integration method based on service call tracking
CN111913713A
Data query method and system supporting multiple data sources
CN115269629A
Metadata directory management system and method for massive scientific data
CN116737113A
Design method for multi-source data merging service processing system
CN118035583A
Visual interface configuration method and device and storage medium
CN120295663A
Cited By
Method for converting different database query statements into standard data interfaces
CN120910143A