Third-party interface response result conversion and efficiency improvement method based on dimension coordinates
By using a transformation method based on dimensional coordinates, the problems of high cost and low efficiency in interface integration were solved, resulting in shorter interface integration cycles, reduced maintenance costs, and improved development efficiency and code reusability.
Patent Information
- Application Number
- CN202511021038.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-24
- Publication Date
- 2025-10-24
AI Technical Summary
Existing technologies suffer from high costs and low efficiency in interface integration, and require significant manpower for development and maintenance when integrating new interfaces.
A dimensional coordinate-based transformation method is adopted. By establishing a dimensional coordinate model, the response results of third-party interfaces are converted into a unified JSON Node, and then converted into a standard format according to preset mapping rules. The dimensional mapping rules are dynamically configured to adapt to different interface formats.
It reduces repetitive code development work, shortens the integration cycle, lowers maintenance costs, and improves interface integration efficiency and code reuse rate.
Smart Images

Figure CN120835102A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a third-party interface response result conversion method based on dimension coordinates. BACKGROUND
[0002] In the existing system integration scheme, there are mainly two ways to connect or maintain third-party interfaces. One is a direct connection method, that is, an independent conversion module is developed for each third-party interface, and the response result is directly converted into a target format. This method is simple to implement, but has problems such as large development workload, high modification cost of the corresponding conversion module when the interface format changes, and low code reuse rate due to repeated conversion logic of different interfaces. The second is an intermediate format method, that is, a unified intermediate format is defined, and the third-party interface response result is converted into the intermediate format and then converted into the target format. This method improves the code reuse rate, but has problems such as that the intermediate format is too complex because it needs to consider all possible fields and structures, that part of the information may be lost in the conversion process, affecting data integrity, and that the maintenance cost is high because multiple third-party interface changes need to be considered.
[0003] It can be seen that the above methods have certain limitations, and when a new interface is accessed, both of the above methods need to invest manpower for development and maintenance. Therefore, a new interface response result conversion method is needed to effectively solve the above problems and improve the interface connection efficiency. SUMMARY
[0004] The present application relates to the technical field of computer, in particular to a third-party interface response result conversion method based on dimension coordinates.
[0005] In order to achieve the above purpose, the present application adopts the following technical scheme: a third-party interface response result conversion method based on dimension coordinates, comprising the following steps:
[0006] Step S1, a dimension coordinate model is established, the dimension coordinate model defines the standard dimensions of the system, and each dimension is used to identify specific information in the response result;
[0007] Step S2, the third-party interface response result is converted into a dimension coordinate, and the third-party interface data message is converted into a unified JSON Node;
[0008] Step S3, according to the preset mapping conversion rule, the dimension label and value in the dimension coordinate are converted into a standard format response result.
[0009] Preferably, in step S1, the following substeps are further included:
[0010] S1-1, define a standard dimension coordinate model, the dimension coordinate model including dimension definition, dimension configuration and dimension mapping, the dimension definition is defined according to the system, the dimension configuration includes the name, alias, type, data type information of the dimension, and the dimension mapping defines the corresponding relationship between the node information in the third party interface response result and the dimension;
[0011] S1-2, each dimension is used for identifying specific information in the response result: dimension coordinate information, including two parts, wherein K represents the dimension defined according to the business type, and V represents the coordinate information converted according to the configured dimension coordinate rule by analyzing the third party interface response result;
[0012] Attribute value, including two parts, wherein K represents the attribute key obtained by analyzing the third party interface response result, and V represents the attribute value obtained by analyzing the third party interface response result.
[0013] Preferably, the dimension mapping is dynamically configured to adapt to the response result format of different third party interfaces, and the rules of the dimension mapping include the following modes:
[0014] a. The specified node has a certain dimension;
[0015] b. All the subordinate nodes of the specified node have the same dimension;
[0016] c. All the nodes of the same level of the specified node have the same dimension;
[0017] Meanwhile, a field type is added in the dimension mapping configuration for distinguishing the above three modes.
[0018] Preferably, in step S2, the following substeps are further included:
[0019] S2-1, analyze the third party interface response result to obtain the node information in the response result;
[0020] S2-2, according to the preset dimension mapping rule, map the node information to the corresponding dimension;
[0021] S2-3, generate a dimension coordinate including a dimension label and a corresponding value.
[0022] Preferably, the third party interface data packet is converted into a unified JSON Node, the key in the Node is the absolute path of the original corresponding packet, the path from the root node to the current node, and the nodes between each layer are connected with “.”, and when the node is an array, “[]” is added after it to identify;
[0023] The value in the Node is the value in the original response packet;
[0024] The type in the Node identifies the data structure of the current node, including Array, String, Integer, and BigDecimal types of data structures;
[0025] List in the Node <node>Identify the lower level node of the current node.
[0026] Preferably, in step S3, further comprising the following sub-steps:
[0027] S3-1, the fields in the target message are single data, without hierarchical structure, wherein the keys of the target fields are all full path representations, the data is converted into a template of a target message, and the value is a mapping rule of dimension coordinates, including the following types:
[0028] a. Fixed value, that is, the value is not from the third-party response message, which is a fixed value and will not change with different third-party corresponding results;
[0029] b. Value assignment through a field in the third-party response result;
[0030] c. Multiple fields in the third-party response result, value assignment after executing a certain method;
[0031] In the finally generated target template, the key is the key of the target result, the value is a fixed value, or a key of a third-party response result, or a list of methods and parameters that need to be executed;
[0032] S3-2, traversing the target template, executing the corresponding logic according to the value in the template, replacing the value in the target template, and during the traversal process, when the data structure of the key in the target template is an array type, filling according to the number of corresponding nodes of the third-party response result.
[0033] The technical scheme provided by the application brings at least the following beneficial effects:
[0034] 1. In the present application, there is no need to develop an independent conversion module for each third-party interface, the standardized conversion is realized through the dimension coordinate model, the access period is shortened by 40% compared with direct docking, a large amount of repeated code development work is reduced, the code is modified frequently due to frequent changes in interface format, the development efficiency of interface docking is significantly improved.
[0035] 2. In the present application, the dimension coordinates, mapping rules and the like can be dynamically configured, the code does not need to be modified when the interface format changes, and only the configuration relationship needs to be adjusted, the maintenance cost is reduced by 30%. The dimension mapping is configured on demand, not all fields are forced to be mapped, the parsing and mapping efficiency is improved, and the maintenance workload is reduced.
[0036] In summary, the present application realizes the standardized conversion of the third-party interface response result to the target format by introducing the dimension coordinate intermediate layer, effectively solves the problems of large development workload, high maintenance cost and low code reuse rate in the prior art, improves the interface docking efficiency, and reduces the development and maintenance cost. BRIEF DESCRIPTION OF DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art and the advantages thereof, the accompanying drawings that need to be used in the description of the embodiments or the prior art will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without any creative effort.
[0038] Figure 1 A business implementation logic diagram of a third-party interface response result conversion efficiency method based on dimensional coordinates proposed by the present application;
[0039] Figure 2 A dimensional coordinate model diagram of a third-party interface response result conversion efficiency method based on dimensional coordinates proposed by the present application;
[0040] Figure 3 A data structure diagram of a Node of a third-party interface response result conversion efficiency method based on dimensional coordinates proposed by the present application;
[0041] Figure 4 A dimensional coordinate conversion logic diagram of a third-party interface response result conversion efficiency method based on dimensional coordinates proposed by the present application;
[0042] Figure 5 A dimensional coordinate mapping rule diagram of a third-party interface response result conversion efficiency method based on dimensional coordinates proposed by the present application;
[0043] Figure 6 A target template traversal diagram of a third-party interface response result conversion efficiency method based on dimensional coordinates proposed by the present application. DETAILED DESCRIPTION
[0044] In order to further illustrate the technical means and effects adopted by the present application to achieve the predetermined inventive purpose, the specific embodiments, structures, features and effects of a third-party interface response result conversion efficiency method based on dimensional coordinates proposed by the present application will be described in detail below in combination with the drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, the specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.
[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs.
[0046] The following embodiments are for illustrative purposes only and are not intended to limit the scope of the present application.
[0047] The application provides a dimension coordinate-based third-party interface response result conversion and efficiency improvement method.
[0048] Please refer to Figures 1 to 6 which shows a dimension coordinate-based third-party interface response result conversion and efficiency improvement method provided by an embodiment of the application, and includes the following steps.
[0049] Step S1: establishing a dimension coordinate model, the dimension coordinate model defines standard dimensions of a system, and each dimension is used for identifying specific information in a response result; for example, a solution dimension, a journey dimension, a segment dimension, a fare dimension and the like.
[0050] Step S2: converting a third-party interface response result into a dimension coordinate, and converting all third-party interface data messages into a unified JSON Node.
[0051] Step S3: converting a dimension label and a value in the dimension coordinate into a standard format response result according to a preset mapping conversion rule.
[0052] In step S1, the following substeps are further included.
[0053] S1-1: defining a standard dimension coordinate model, the dimension coordinate model is the basis of the application, and taking an air ticket booking system as an example, the dimension coordinate model defines standard dimensions of the air ticket booking system, and includes dimension definition, dimension configuration and dimension mapping.
[0054] The solution dimension is used for identifying information of a complete journey.
[0055] The journey dimension is used for identifying journey information.
[0056] The segment dimension is used for identifying segment information.
[0057] The cabinClass dimension is used for identifying cabin information.
[0058] The fare dimension is used for identifying price information.
[0059] The paxType dimension is used for identifying passenger type information.
[0060] The chargeType dimension is used for identifying charge type information.
[0061] The above dimension definition is defined by accessing the air ticket booking system, so the dimension is dynamically configured to adapt to the response result format of different third-party interfaces. The dimension configuration includes the name, alias, type, and data type information of the dimension.
[0062] The dimension mapping defines the correspondence between the node information in the third-party interface response result and the dimension.
[0063] S1-2, each dimension is used to identify specific information in the response result: see Figure 2 Dimension coordinate information includes two parts, where K represents the dimension customized according to the business type, and V represents the coordinate information converted according to the configured dimension coordinate rules by analyzing the third-party interface response result.
[0064] Attribute value includes two parts, where K represents the attribute key obtained by analyzing the third-party interface response result, and V represents the attribute value obtained by analyzing the third-party interface response result.
[0065] The dimension mapping is dynamically configured to adapt to the response result format of different third-party interfaces. The dimension mapping does not need to specify all fields in the third-party response result corresponding to a certain dimension. It is configured on demand to improve the parsing and mapping efficiency. The rules of dimension mapping include the following ways:
[0066] a. The specified node has a certain dimension;
[0067] b. All subordinate nodes of the specified node have the same dimension;
[0068] c. All nodes of the same level of the specified node have the same dimension;
[0069] The above three cases basically cover the mapping of third-party response results and dimension coordinates. To achieve this purpose, a field type is added to the dimension mapping configuration to distinguish the above three cases.
[0070] In step S2, the following sub-steps are also included:
[0071] S2-1, analyze the third-party interface response result to obtain the node information in the response result;
[0072] S2-2, according to the preset dimension mapping rule, map the node information to the corresponding dimension;
[0073] S2-3, generate a dimension coordinate containing the dimension label and the corresponding value.
[0074] Convert the third-party interface data message into a unified JSON Node. The data structure of the Node is shown in Figure 3 , the key in Node is the absolute path of the original corresponding message, the path from the root node to the current node, and the nodes between each layer are connected with ". ", and when the node is an array, " [] " is added after it to identify it;
[0075] The value in Node is the value in the original response message;
[0076] The type in Node identifies the data structure of the current node, including Array, String, Integer, and BigDecimal data structures;
[0077] List in Node <node>Identify the lower level nodes of the current node, detailed third-party response result conversion to dimensional coordinates logic, see Figure 4 .
[0078] In step S3, also includes the following sub-steps:
[0079] S3-1, the fields in the target message are single data, no hierarchical structure, wherein the key of the target field is the full path representation, convert the data into a target message template, in the template, the key is no longer represented by the full path, but is removed from all parent nodes, see Figure 5 , the value is the mapping rule of the dimensional coordinates, including the following types:
[0080] a. Fixed value, that is, the value is not from the third-party response message, it is a fixed value, which will not change with the different third-party response results; For example: the hand luggage of an airline is fixed at 7KG, the airline response result does not contain this data, and in the conversion to the target message, the default assignment is performed.
[0081] b. Assign a value through a field in the third-party response result; For example: in the return result of an airline, the departure field is departure, and the value is BKK. When assigning the value in the template, the full path of the departure field in the original message is assigned.
[0082] c. Multiple fields in the third-party response result, perform a method and assign a value; For example: an airline returns a price detail list, but the target message is a total price field, which needs to be accumulated to get a result. When assigning the value in the template, it is a method name that needs to be executed and which third-party response result fields need to be calculated. Note: Sometimes multiple methods need to be executed to calculate the result, at which time the value in the template is a list of method names, and in the parsing mapping, the methods will be executed in the order of the list.
[0083] In the final generated target template, the key is the key of the target result, the value is a fixed value, or a third-party response result key, or a list of methods and parameters that need to be executed.
[0084] S3-2, traverse the target template, execute the corresponding logic according to the value in the template, replace the value in the target template, see Figure 6 During the traversal process, if the key in the target template is an array, the number of nodes corresponding to the third-party response will be filled in. For example, if an airline returns two flight segments, but the target template only represents one segment, the segment information in the target template will be expanded when generating the final result, and the number of nodes will be filled in according to the two segments returned by the airline.
[0085] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.< / node> < / node>
Claims
1. A method for converting and improving efficiency of third-party interface response results based on dimensional coordinates, characterized in that, The method comprises the following steps: Step S1, establishing a dimension coordinate model, the dimension coordinate model defines the standard dimensions of the system, each dimension is used to identify specific information in the response result; Step S2, converting the third-party interface response result into a dimension coordinate, each third-party interface data message is converted into a unified JSON Node; Step S3, according to the preset mapping conversion rule, converting the dimension label and value in the dimension coordinate into a standard format response result.
2. The conversion efficiency method of the third-party interface response result based on the dimension coordinate according to claim 1, wherein: In step S1, the following sub-steps are further included: S1-1, defining a standard dimension coordinate model, the dimension coordinate model includes dimension definition, dimension configuration and dimension mapping, the dimension definition is defined according to the system, the dimension configuration includes the name, alias, type, data type information of the dimension, and the dimension mapping defines the corresponding relationship between the node information in the third-party interface response result and the dimension; S1-2, each dimension is used to identify specific information in the response result: dimension coordinate information, including two parts, wherein K represents the dimension customized according to the business type, and V represents the coordinate information converted according to the configured dimension coordinate rule by analyzing the third-party interface response result; Attribute value, including two parts, wherein K represents the attribute key obtained by analyzing the third-party interface response result, and V represents the attribute value obtained by analyzing the third-party interface response result.
3. The conversion efficiency method of the third-party interface response result based on the dimension coordinate according to claim 2, wherein: The dimension mapping is dynamically configured to adapt to the response result format of different third-party interfaces, and the rules of the dimension mapping include the following modes: a. A specified node has a certain dimension; b. All subordinate nodes of the specified node have the same dimension; c. All nodes of the same level of the specified node have the same dimension; Meanwhile, a field type is added in the dimension mapping configuration, which is used to distinguish the above three modes.
4. The conversion efficiency method of the third-party interface response result based on the dimension coordinate according to claim 1, wherein: In step S2, the following sub-steps are further included: S2-1, analyzing the third-party interface response result to obtain the node information in the response result; S2-2, according to the preset dimension mapping rule, mapping the node information to the corresponding dimension; S2-3, generating a dimension coordinate containing a dimension label and a corresponding value.
5. The conversion efficiency method of the third-party interface response result based on the dimension coordinate according to claim 4, wherein: Each third-party interface data message is converted into a unified JSON Node, the key in the Node is the absolute path of the original corresponding message, the path from the root node to the current node, and each layer of nodes is connected by ".”, and when the node is an array, "[]” is added after it to identify; The value in the Node is the value in the original response message. The type in Node identifies the data structure of the current node, including Array, String, Integer, and BigDecimal types; List in Node <node> Identifies the node below the current node.< / node> 6. The method for improving conversion efficiency of third-party interface response results based on dimensional coordinates according to claim 5, characterized in that: In step S3, the following sub-steps are also included: S3-1: The fields in the target message are all single data, without a hierarchical structure. The key of the target field is a full path representation. The data is converted into a template of the target message. The value is the mapping rule of the dimension coordinate, including the following types: a. A fixed value, meaning that the value does not come from a third-party response message and is a fixed value that does not change with the third-party response result; b. Assign a value to a field in the third-party response result; c. Multiple fields in the third-party response result are assigned values after executing a certain method; In the final generated target template, key is the key of the target result, and value is a fixed value, or a key of a third-party response result, or a list and parameters of the method to be executed; S3-2, traverse the target template, execute the corresponding logic according to the value in the template, and replace the value in the target template. During the traversal process, when the data structure of the key in the target template is an array type, fill it according to the number of nodes corresponding to the third-party response result.