Data processing method and device, storage medium, electronic equipment and program product

By setting up an interface data converter within the component and converting the format of the target data obtained through the extended interface, the upgrade and release problems caused by component interface changes are solved, and the compatibility and maintainability of the component are achieved.

CN120848969APending Publication Date: 2025-10-28BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410509298.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-25
Publication Date
2025-10-28

AI Technical Summary

Technical Problem

Changes in the component's data request interface lead to component upgrade and release issues, affecting the normal operation of the project. In addition, the component upgrade cost is high and cannot be upgraded in time to adapt to the interface changes.

Method used

An interface data converter is set up in the component to obtain the target data through the extended interface and convert the data format to generate data suitable for the component, ensuring that the component is compatible with different data request interfaces and avoiding the impact of component upgrades and releases.

Benefits of technology

Ensure that components can still work normally when the interface changes, avoid the impact of component upgrades on existing projects, and enhance the compatibility and maintainability of components.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120848969A_ABST
    Figure CN120848969A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method and device, a storage medium, electronic equipment and a program product, and relates to the technical field of computers. The method comprises the following steps: sending a data acquisition request to a server through a data request interface of a component, and receiving target data returned by the server in response to the data acquisition request; in response to the condition that the data request interface is an expansion interface of the component, performing data format conversion on the target data through an interface data converter of the component to obtain component data which is data suitable for the component; and in response to the data request interface being an internal interface of the component, determining the target data as component data. According to the method, the component can be compatible with different data request interfaces, so that the component which is installed and operated in the project cannot work normally due to interface change, and the influence of component upgrading and publishing on the existing component is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a data processing method, a data processing apparatus, a computer-readable storage medium, an electronic device, and a computer program product. Background Technology

[0002] Component-based development has become mainstream in front-end frameworks. This approach has significantly improved code maintainability, reusability, and development efficiency. A front-end framework typically comprises multiple components, each containing data retrieval logic. These components can obtain data from the server to process related business logic. For example, an application selector component is responsible for retrieving application data from the server and presenting it to the user for selection.

[0003] When a component's data request interface changes, the component's code needs to be adjusted accordingly. However, such adjustments often involve component upgrades and releases, which can lead to a series of problems. Components already installed and running in the project may malfunction due to interface changes, posing a risk of user unavailability. Component upgrades can avoid this risk; however, they are costly and cannot guarantee that projects using the component will be able to upgrade in a timely manner.

[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] The purpose of this disclosure is to provide a data processing method, data processing apparatus, computer-readable storage medium, electronic device, and computer program product to overcome or at least partially solve the above-mentioned problems.

[0006] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.

[0007] According to one aspect of this disclosure, a data processing method is provided, comprising: sending a data acquisition request to a server through a component's data request interface, and receiving target data returned by the server in response to the data acquisition request; in response that the data request interface is an extended interface of the component, converting the target data into a data format through the component's interface data converter to obtain component data; the component data being data applicable to the component; and in response that the data request interface is an internal interface of the component, determining that the target data is the component data.

[0008] In some embodiments of this disclosure, the step of converting the target data into a data format using the component's interface data converter to obtain component data includes: obtaining the data conversion rules corresponding to the extended interface; transmitting the data conversion rules corresponding to the extended interface to the interface data converter; and converting the target data into a data format using the component's interface data converter according to the data conversion rules corresponding to the extended interface to obtain the component data.

[0009] In some embodiments of this disclosure, the method further includes: obtaining a first data structure corresponding to the internal interface and a second data structure corresponding to the extended interface; the first data structure includes a first data field, and the second data structure includes a second data field; in response to the first data structure being the same as the second data structure and the first data field being different from the second data field, generating a data conversion rule corresponding to the extended interface based on the first data field and the second data field; in response to the first data structure being different from the second data structure, generating a data conversion rule corresponding to the extended interface based on the first data structure and the second data structure.

[0010] In some embodiments of this disclosure, generating the data conversion rule corresponding to the extended interface based on the first data field and the second data field includes: establishing a first mapping relationship between the first data field and the second data field; and generating the first data conversion rule corresponding to the extended interface based on the established first mapping relationship.

[0011] In some embodiments of this disclosure, the target data includes a second data field and a target data value corresponding to the second data field, wherein the target data value is the original data returned by the server in response to the data acquisition request; wherein, the step of converting the target data into a data format according to the data conversion rules corresponding to the extended interface through the component's interface data converter to obtain the component data includes: obtaining the second data field and the target data value corresponding to the second data field in the target data through the component's interface data converter; querying the first data field corresponding to the second data field based on the first mapping relationship in the first data conversion rule to determine that the target data value corresponding to the second data field is the data value corresponding to the first data field; associating the first data field and the data value corresponding to the first data field according to the first data structure to obtain the component data.

[0012] In some embodiments of this disclosure, generating the data conversion rule corresponding to the extended interface based on the first data structure and the second data structure includes: determining a path for obtaining the data value corresponding to the second data field based on the structural relationship between the data field and the data value corresponding to the data field in the second data structure; establishing a second mapping relationship between the first data field and the path for obtaining the data value corresponding to the second data field; and generating a second conversion rule corresponding to the extended interface based on the established second mapping relationship.

[0013] In some embodiments of this disclosure, the target data includes a second data field and a target data value corresponding to the second data field, wherein the target data value is the original data returned by the server in response to the data acquisition request; wherein, the step of converting the target data into a data format according to the data conversion rules corresponding to the extended interface through the component's interface data converter to obtain the component data includes: obtaining a path for acquiring the target data value corresponding to the second data field through the component's interface data converter, acquiring the target data value corresponding to the second data field according to the path for acquiring the target data value corresponding to the second data field; querying the first data field corresponding to the path for acquiring the target data value corresponding to the second data field based on the second mapping relationship in the second conversion rules, and determining that the target data value corresponding to the second data field is the data value corresponding to the first data field; associating the first data field and the data value corresponding to the first data field according to the first data structure to obtain the component data.

[0014] According to another aspect of this disclosure, a data processing apparatus is provided, comprising: a data acquisition module, configured to send a data acquisition request to a server through a component's data request interface, and receive target data returned by the server in response to the data acquisition request; and a data conversion module, configured to, in response to the data request interface being an extended interface of the component, convert the target data into a data format using the component's interface data converter to obtain component data; wherein the component data is data applicable to the component; and in response to the data request interface being an internal interface of the component, determine that the target data is the component data.

[0015] According to another aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the above-described data processing method.

[0016] According to another aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the above-described data processing method by executing the executable instructions.

[0017] According to another aspect of this disclosure, a computer program product is provided, comprising a computer program / instructions, characterized in that, when the computer program / instructions are executed by a processor, they implement the above-described data processing method.

[0018] The data processing method of this disclosure can determine that the target data is component data when requesting data through an internal interface, thus preserving the component's internal interface and not affecting the component's original logic. When requesting data through an extended interface, the method utilizes an interface data converter set within the component to convert the target data obtained through the extended interface into a data format suitable for the component. This enables the component to be compatible with different data request interfaces, ensuring that components already installed and running in the project will not malfunction due to interface changes. It also avoids the impact of component upgrades and releases on existing components.

[0019] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0021] Figure 1 This is a diagram illustrating the process by which existing components retrieve data from the server.

[0022] Figure 2 This is a flowchart illustrating a data processing method according to an exemplary embodiment;

[0023] Figure 3 This is a schematic diagram illustrating the process by which a component obtains data from a server through an extended interface, according to an exemplary embodiment.

[0024] Figure 4 This is a schematic diagram illustrating data conversion rules under different data fields according to an exemplary embodiment;

[0025] Figure 5 This is a flowchart illustrating the process of converting target data into target component data according to an exemplary embodiment;

[0026] Figure 6 This is a schematic diagram illustrating data transformation rules under different data structures according to an exemplary embodiment;

[0027] Figure 7 This is a flowchart illustrating the process of converting target data into target component data according to yet another exemplary embodiment;

[0028] Figure 8 This is a block diagram of a data processing apparatus according to an exemplary embodiment; and

[0029] Figure 9 This is a structural block diagram of an electronic device according to an exemplary embodiment. Detailed Implementation

[0030] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0031] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein.

[0032] The following exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this disclosure more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more of the specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this disclosure.

[0033] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0034] It should be noted that the collection, gathering, updating, analysis, processing, use, transmission, and storage of user personal information involved in this disclosed technical solution all comply with relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken to prevent unauthorized access to user personal information data and to safeguard user personal information security, network security, and national security.

[0035] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0036] Figure 1 This is a diagram illustrating the process by which existing components retrieve data from the server. (Reference) Figure 1 Component 110 includes a data request interface 111. Data is requested from server 120 via data request interface 111. Server 120 responds to the request sent by data request interface 111 by retrieving data from the database and returning it to data request interface 111. Data request interface 111 processes the data retrieved from the database by the server according to a key-value pair data structure before passing it to component 110. Here, key 1, key 2, ..., key n represent the data fields corresponding to data request interface 111, and value 1, value 2, ..., value n represent the data retrieved from the database.

[0037] Because different data request interfaces can process data retrieved from the database by the server according to different data structures and fields, the component's code must be adjusted accordingly when the component's data request interface changes. However, such adjustments often involve component upgrades and releases, which can lead to a series of problems. Components already installed and running in the project may malfunction due to interface changes, potentially causing users to be unable to use the component. Upgrading the component can avoid this risk; however, component upgrades are costly and cannot guarantee that projects using the component will be able to upgrade in a timely manner.

[0038] To address the aforementioned issues, this disclosure provides a data processing method that includes an interface data converter within a component and an external extension interface. The interface data converter within the component is used to convert the data format obtained through the extension interface to obtain component data suitable for the component. This enables the component to be compatible with different data request interfaces, ensuring that components already installed and running in the project will not malfunction due to interface changes. It also avoids the impact of component upgrades and releases on existing components.

[0039] Figure 2 This is a flowchart illustrating a data processing method according to an exemplary embodiment. Figure 2 The methods provided in the embodiments can be executed by any electronic device, such as a terminal device, a server, or a combination of both, but this disclosure does not limit this. The terminal devices described in this disclosure may include mobile terminals such as mobile phones, tablets, laptops, handheld computers, and personal digital assistants (PDAs), as well as fixed terminals such as desktop computers. Reference Figure 2 The data processing method may include the following steps.

[0040] Step S210: Send a data retrieval request to the server through the component's data request interface, and receive the target data returned by the server in response to the data retrieval request.

[0041] When a component needs to retrieve data, it sends a data retrieval request to the server through a data request interface. Upon receiving the request, the server retrieves the corresponding data from the database and returns it. After receiving the data retrieved from the database, the data request interface processes it according to its corresponding data structure and fields to obtain the target data.

[0042] In this embodiment of the disclosure, the target data is the data after the data request interface processes the data extracted from the database by the server in response to the data acquisition request, according to its corresponding data structure and data fields.

[0043] Step S220: In response to the data request interface being an extended interface of the component, the target data is converted into a data format using the component's interface data converter to obtain the component data.

[0044] Among them, component data is data applicable to the component, that is, data in a data format that the component can understand and process.

[0045] If the data request interface used to send the data retrieval request is an extension interface of the component, then the target data is the data processed by the extension interface according to its corresponding data structure and data fields after the data retrieved from the database returned by the server. Therefore, the target data may not be data in a format that the component can understand and process.

[0046] In this embodiment of the disclosure, the component is provided with an interface data converter, which can convert the target data into a data format suitable for the component when it is determined that the data request interface is an extended interface.

[0047] Step S230: In response to the data request interface being the internal interface of the component, the target data is determined to be component data.

[0048] If the data request interface used to send the data retrieval request is an internal interface of the component, then the target data is the data processed by the internal interface according to its corresponding data structure and data fields, based on the data retrieved from the database and returned by the server. In this case, no data format conversion is required; the target data is considered to be component data suitable for the component, meaning it is data that the component can understand and process.

[0049] The data processing method of this disclosure requests data from a server through a component's data request interface and receives target data returned by the server in response to the request through the same data request interface. If the data request interface is an extended interface of the component, an interface data converter within the component is used to convert the target data's data format to obtain component data suitable for the component. If the data request interface is an internal interface of the component, the target data is determined to be component data suitable for the component. Thus, when requesting data through an internal interface, the target data can be determined to be component data, preserving the component's internal interface and not affecting the component's original logic. When requesting data through an extended interface, an interface data converter set within the component is used to convert the target data obtained through the extended interface to obtain component data suitable for the component. This allows the component to be compatible with different data request interfaces, ensuring that components already installed and running in the project will not malfunction due to interface changes, and also avoiding the impact of component upgrades and releases on existing components.

[0050] In an exemplary embodiment, obtaining component data by converting the target data's data format through the component's interface data converter may include: obtaining the data conversion rules corresponding to the extended interface, passing the data conversion rules corresponding to the extended interface to the interface data converter; and converting the target data's data format according to the data conversion rules corresponding to the extended interface through the component's interface data converter to obtain the component data.

[0051] If the data request interface used to send the data acquisition request is an extension interface of the component, the data conversion rules corresponding to the extension interface can be obtained. The data conversion rules corresponding to the extension interface are then passed to the interface data converter set within the component. The interface data converter can then convert the target data format according to the data conversion rules corresponding to the extension interface, and finally obtain the component data.

[0052] Figure 3 This is a schematic diagram illustrating the process by which a component retrieves data from a server through an extended interface, according to an exemplary embodiment. (Reference) Figure 3 The component 310 has an internal interface 311 and an interface data converter 312, and an external expansion interface 313.

[0053] Component 310 requests data from server 320 through extended interface 313. Server 320 responds to the request by retrieving data from the database and returning it to extended interface 313. Extended interface 313 processes the data retrieved from the database by the server according to a key-value pair data structure to obtain the target data, and then passes the target data to interface data converter 312. Here, key a1, key a2, ... key an represent the data fields corresponding to data request interface 111, and value 1, value2, ... value n represent the data retrieved from the database.

[0054] Since component 310 requests data through extension interface 313, the data conversion rules corresponding to extension interface 313 are passed to interface data converter 312. Then, interface data converter 312 can convert the target data passed by extension interface 313 according to the data conversion rules corresponding to extension interface to obtain component data suitable for the component.

[0055] from Figure 3 As can be seen, the extended interface 313 can be considered as an interface of the component other than the internal interface. If data is requested through an interface other than the internal interface, the data conversion rule corresponding to that interface needs to be passed to the interface data converter 312, so that the interface data converter 312 can perform data format conversion processing on the data transmitted by the interface according to the data conversion rule. Alternatively, data can be requested directly through the internal interface 311. If data is requested through the internal interface 311, then it is not necessary to perform data format conversion processing on the data transmitted by the interface through the interface data converter 312.

[0056] In this embodiment of the disclosure, when it is determined that data is requested through the extended interface of the component, the data conversion rules corresponding to the extended interface can be passed to the interface data converter. This allows the interface data converter to perform data format conversion on the target data passed by the extended interface according to the data conversion rules corresponding to the extended interface, and finally obtain component data suitable for the component. This allows data format conversion to be performed by the interface data converter within the component according to the corresponding data conversion rules without changing the component code. It can adapt to different data formats and changes in requirements, making the component compatible with different data request interfaces. Furthermore, the data conversion rules and extended interfaces are independent of the component, making the data conversion rules and extended interfaces easy to manage and maintain.

[0057] In an exemplary embodiment, the method further includes generating data conversion rules corresponding to the extended interface. Specifically, this may include: obtaining a first data structure corresponding to the internal interface and a second data structure corresponding to the extended interface, wherein the first data structure includes a first data field and the second data structure includes a second data field; in response to the first data structure being the same as the second data structure and the first data field being different from the second data field, generating data conversion rules corresponding to the extended interface based on the first data field and the second data field; and in response to the first data structure being different from the second data structure, generating data conversion rules corresponding to the extended interface based on the first data structure and the second data structure.

[0058] Different data request interfaces correspond to different data structures or data fields. In this embodiment of the disclosure, corresponding data conversion rules can be set for different data structures, and corresponding data conversion rules can also be set for different data fields.

[0059] Specifically, the implementation involves obtaining a first data structure corresponding to the internal interface, which includes a first data field, i.e., obtaining the data structure of the data returned by the internal interface and the data field in the data structure; and obtaining a second data structure corresponding to the extended interface, which includes a second data field, i.e., obtaining the data structure of the data returned by the extended interface and the data field in the data structure.

[0060] Next, it is determined whether the first data structure and the second data structure are the same. If they are the same, it is further determined whether the first data field and the second data field are the same. If it is determined that the first data field and the second data field are different, data conversion rules corresponding to the extended interface can be generated based on the first data field and the second data field. If the first data structure and the second data structure are different, data conversion rules corresponding to the extended interface can be generated based on the first data structure and the second data structure.

[0061] In an exemplary embodiment, generating data conversion rules corresponding to the extended interface based on the first data field and the second data field may include: establishing a first mapping relationship between the first data field and the second data field; and generating the first data conversion rules corresponding to the extended interface based on the established first mapping relationship.

[0062] If the first data structure corresponding to the internal interface (i.e., the data structure required by the component) is the same as the second data structure corresponding to the extended interface, it means that the data structure required by the component is the same as the data structure returned by the extended interface. However, the first data field corresponding to the internal interface is different from the second data field corresponding to the extended interface. Therefore, a first mapping relationship can be established between the first data field and the second data field, and then a first data conversion rule corresponding to the extended interface can be generated based on the established first mapping relationship.

[0063] Figure 4 This is a schematic diagram illustrating data transformation rules for different data fields according to an exemplary embodiment. (Reference) Figure 4 Both the first data structure corresponding to the internal interface and the second data structure corresponding to the extended interface are key-value pair data structures. The first data field in the first data structure is key1, key2, ..., keyn, and the second data field in the second data structure is keya1, keya2, ..., keyan. Therefore, a mapping relationship can be established between the first data fields key1, key2, ..., keyn and the second data fields keya1, keya2, ..., keyan, i.e., key1 corresponds to keya1, key2 corresponds to keya2, and so on, generating the first data conversion rule.

[0064] from Figure 4 As can be seen, the data obtained through the extended interface is converted into a data structure suitable for the component by the first data conversion rule, thus obtaining the data required by the component, that is, the data that the component can understand and process; and since the data structure corresponding to the internal interface is the same as the data structure suitable for the component, the data obtained through the internal interface is the data required by the component, that is, the data that the component can understand and process.

[0065] In an exemplary embodiment, the target data includes a second data field and a target data value corresponding to the second data field. The target data value is the original data returned by the server in response to the data retrieval request, i.e., the data extracted by the server from the database. In other words, when the data request interface is an extension interface of the component, the target data is obtained by the extension interface processing the original data returned by the server according to the second data structure and the second data field corresponding to the extension interface.

[0066] In an exemplary embodiment, in response to the fact that the first data structure is the same as the second data structure and the first data field is different from the second data field, the first data conversion rule corresponding to the extended interface is passed to the interface data converter so that the interface data converter can perform data format conversion on the target data. Figure 5 This is a flowchart illustrating the process of converting target data into target component data according to an exemplary embodiment. (See reference) Figure 5 This may include the following steps.

[0067] Step S510: Obtain the second data field and the target data value corresponding to the second data field from the target data through the component's interface data converter.

[0068] After receiving the raw data returned by the server, the extended interface processes the raw data according to its corresponding second data structure and second data fields to obtain the target data, and then passes the target data to the component's interface data converter.

[0069] If it is determined that data is requested through an extended interface, the first data conversion rule corresponding to the extended interface can be passed to the interface data converter.

[0070] After obtaining the target data transmitted by the extended interface and the corresponding first data conversion rule, the interface data converter then performs data format conversion on the target data according to the first data conversion rule. First, the interface data converter determines that the first data conversion rule is a mapping relationship between data fields, and then obtains the second data field in the target data and the target data value corresponding to that second data field.

[0071] Step S520: Based on the first mapping relationship in the first data transformation rule, query the first data field corresponding to the second data field, and determine that the target data value corresponding to the second data field is the data value corresponding to the first data field.

[0072] The interface data converter can query the first data field corresponding to the second data field based on the first mapping relationship in the first data conversion rule, and then obtain the data value corresponding to the first data segment. For example, if it finds that key a1 corresponds to key1, it determines that the target data value value1 corresponding to key a1 is the data value corresponding to key 1; if it finds that key a2 corresponds to key2, it determines that the target data value value2 corresponding to key a2 is the data value corresponding to key 2; and so on, to obtain the data values ​​corresponding to key1...key n.

[0073] Step S530: According to the first data structure, associate the first data field and the data value corresponding to the first data field to obtain component data.

[0074] According to the first data structure, the first data field is associated and paired with its corresponding data value to obtain the component data. For example, key 1 is associated and paired with its corresponding data value value1 to obtain the key-value pair key 1: value1; key 2 is associated and paired with its corresponding data value value2 to obtain the key-value pair key 2: value2; and so on, to obtain the component data key 1: value1; key 2: value2; ...; key n: value n.

[0075] In an exemplary embodiment, generating data conversion rules corresponding to the extended interface based on the first data structure and the second data structure may include: determining a path for obtaining the data value corresponding to the second data field based on the structural relationship between the data field in the second data structure and the data value corresponding to the data field; establishing a second mapping relationship between the first data field and the path for obtaining the data value corresponding to the second data field; and generating a second conversion rule corresponding to the extended interface based on the established second mapping relationship.

[0076] If the first data structure corresponding to the internal interface (i.e., the data structure required by the component) is different from the second data structure corresponding to the extended interface, then the path for obtaining the data value needs to be explicitly specified in the data conversion rules. Therefore, based on the structural relationship between the data fields and their corresponding data values ​​in the second data interface, the path for obtaining the data value corresponding to the second data field can be obtained, i.e., the access path for the data value corresponding to the second data field; a second mapping relationship is established between the first data field and the path for obtaining the data value corresponding to the second data field, and then the second data conversion rules corresponding to the extended interface are generated based on the established second mapping relationship.

[0077] Figure 6 This is a schematic diagram illustrating data transformation rules under different data structures according to an exemplary embodiment. (Reference) Figure 6The internal interface uses a key-value pair data structure as its first data structure, while the extended interface uses a nested data structure as its second data structure. In the first data structure, the first data field is key1, key2, ..., keyn. In the second data structure, `data` is a key in the top-level object, and its value is a nested object containing key-value pairs: key b1: value1, key b2: value2, ..., key bn: valuen. Based on the second data structure, the path to retrieve each data value can be determined. Specifically, the path to retrieve value1 is `data.key b1`, the path to retrieve value2 is `data.key b2`, and so on, with the path to retrieve valuen being `data.key bn`. Since the data value corresponding to the first data field key 1 in the first data structure is value1, a mapping relationship is established between key 1 and data.key b1; since the data value corresponding to the first data field key 2 in the first data structure is value2, a mapping relationship is established between key 2 and data.key b2; and so on, a mapping relationship is established between each first data field in the first data structure and the path for obtaining each data value determined by the second data structure, and finally the second data transformation rule is generated.

[0078] from Figure 6 As can be seen, the data obtained through the extended interface is converted into a data structure suitable for the component by the second data conversion rule, thus obtaining the data required by the component, that is, the data that the component can understand and process; and since the data structure corresponding to the internal interface is the same as the data structure suitable for the component, the data obtained through the internal interface is the data required by the component, that is, the data that the component can understand and process.

[0079] In an exemplary embodiment, the target data includes the second data field and the target data value corresponding to the second data field. The target data value is the original data returned by the server in response to the data acquisition request. Figure 7 This is a flowchart illustrating the process of converting target data into target component data according to yet another exemplary embodiment. (See reference) Figure 7 This may include the following steps.

[0080] Step S710: Obtain the path for obtaining the target data value corresponding to the second data field through the component's interface data converter, and obtain the target data value corresponding to the second data field according to the path for obtaining the target data value corresponding to the second data field.

[0081] After receiving the raw data returned by the server, the extended interface processes the raw data according to its corresponding second data structure and second data fields to obtain the target data, and then passes the target data to the component's interface data converter.

[0082] If it is determined that data is requested through an extended interface, the second data conversion rule corresponding to the extended interface can be passed to the interface data converter.

[0083] After the interface data converter obtains the target data transmitted by the extended interface and the second data conversion rule corresponding to the extended interface, the interface data converter then performs data format conversion on the target data according to the second data conversion rule.

[0084] The interface data converter obtains the path for retrieving the target data value corresponding to the second data field according to the second data conversion rule, and retrieves the target data value corresponding to the second data field according to the path.

[0085] In other words, if the interface data converter receives the second data conversion rule, it iterates through the target data transmitted by the extended interface and obtains the value corresponding to each data field according to the second data conversion rule. Specifically, the second data conversion rule yields a path array, which is the path used to obtain the data value corresponding to the data field. The built-in function of the path array iterates through the data array layer by layer to finally obtain the target data value corresponding to the second data field.

[0086] by Figure 6 Taking this as an example, the path array corresponding to value 1 in the extended interface is data.key b1. By traversing the path array data.key b1 layer by layer, the data value corresponding to the second data field key b1 is finally obtained as value 1.

[0087] Step S720: Based on the second mapping relationship in the second conversion rule, query the first data field corresponding to the path used to obtain the target data value corresponding to the second data field, and determine that the target data value corresponding to the second data field is the data value corresponding to the first data field.

[0088] The interface data converter can, based on the second mapping relationship in the second data conversion rule, query the first data field corresponding to the path used to obtain the target data value corresponding to the second data field, and thus determine the data value corresponding to the first data segment. For example, if key 1 corresponds to data.key b1, the target data value value1 obtained through the path data.key b1 is determined to be the data value corresponding to key 1; if key 2 corresponds to data.key b2, the target data value value2 obtained through the path data.key b2 is determined to be the data value corresponding to key 2; and so on, to obtain the data values ​​corresponding to key 1...key n.

[0089] Step S730: According to the first data structure, associate the first data field and the data value corresponding to the first data field to obtain component data.

[0090] According to the first data structure, the first data field is associated and paired with its corresponding data value to obtain the component data. For example, key 1 is associated and paired with its corresponding data value value1 to obtain the key-value pair key 1: value1; key 2 is associated and paired with its corresponding data value value2 to obtain the key-value pair key 2: value2; and so on, to obtain the component data key 1: value1; key 2: value2; ...; key n: value n.

[0091] In this embodiment, for cases where the data structure corresponding to the internal interface differs from the data interface corresponding to the extended interface, and for cases where the data structure corresponding to the internal interface is the same as the data interface corresponding to the extended interface but the data fields corresponding to the internal interface and the extended interface differ, corresponding data conversion rules are generated. When data is requested through the extended interface, these data conversion rules are passed to the component's interface data converter. The interface data converter then converts the target data passed by the extended interface into component data suitable for the component based on these data conversion rules. By considering cases where different interfaces correspond to different data structures or data fields, and because the generated data conversion rules are independent of the component code, when the conversion logic needs to be modified or updated, only the data conversion rules need to be adjusted, without modifying the component code. This enhances the maintainability of the component code.

[0092] It should be noted that although the steps of the method in this invention are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0093] Figure 8 This is a block diagram of a data processing apparatus according to an exemplary embodiment. (Reference) Figure 8 The data processing device 800 may include a data acquisition module 810 and a data conversion module 820.

[0094] Specifically, the data acquisition module 810 can be used to: send a data acquisition request to the server through the component's data request interface, and receive the target data returned by the server in response to the data acquisition request. The data conversion module 820 can be used to: in response to the data request interface being an extended interface of the component, convert the target data into a data format through the component's interface data converter to obtain component data, wherein the component data is data suitable for the component; in response to the data request interface being an internal interface of the component, determine that the target data is component data.

[0095] In some embodiments of this disclosure, the data conversion module 820 may also be used to: obtain the data conversion rules corresponding to the extended interface, and transmit the data conversion rules corresponding to the extended interface to the interface data converter; and convert the target data according to the data conversion rules corresponding to the extended interface through the component's interface data converter to obtain component data.

[0096] In some embodiments of this disclosure, Figure 8 The data processing device 800 shown also includes a rule generation module 830, which can be used to: obtain a first data structure corresponding to the internal interface and a second data structure corresponding to the extended interface, wherein the first data structure includes a first data field and the second data structure includes a second data field; in response to the first data structure and the second data structure being the same and the first data field and the second data field being different, generate a data conversion rule corresponding to the extended interface based on the first data field and the second data field; in response to the first data structure and the second data structure being different, generate a data conversion rule corresponding to the extended interface based on the first data structure and the second data structure.

[0097] In some embodiments of this disclosure, the rule generation module 830 may also be used to: establish a first mapping relationship between the first data field and the second data field; and generate a first data conversion rule corresponding to the extended interface based on the established first mapping relationship.

[0098] In some embodiments of this disclosure, the target data includes a second data field and a target data value corresponding to the second data field. The target data value is the original data returned by the server in response to the data acquisition request. The data conversion module 820 can also be used to: obtain the second data field and the target data value corresponding to the second data field in the target data through the component's interface data converter; query the first data field corresponding to the second data field based on the first mapping relationship in the first data conversion rule to determine that the target data value corresponding to the second data field is the data value corresponding to the first data field; and associate the first data field and the data value corresponding to the first data field according to the first data structure to obtain component data.

[0099] In some embodiments of this disclosure, the rule generation module 830 may also be used to: determine the path for obtaining the data value corresponding to the second data field based on the structural relationship between the data field and the data value corresponding to the data field in the second data structure; establish a second mapping relationship between the first data field and the path for obtaining the data value corresponding to the second data field; and generate a second conversion rule corresponding to the extended interface based on the established second mapping relationship.

[0100] In some embodiments of this disclosure, the target data includes a second data field and a target data value corresponding to the second data field. The target data value is the original data returned by the server in response to the data acquisition request. The data conversion module 820 can also be used to: obtain a path for acquiring the target data value corresponding to the second data field through the component's interface data converter; acquire the target data value corresponding to the second data field according to the path; query the first data field corresponding to the path for acquiring the target data value corresponding to the second data field based on the second mapping relationship in the second conversion rule; determine that the target data value corresponding to the second data field is the data value corresponding to the first data field; and associate the first data field and the data value corresponding to the first data field according to the first data structure to obtain component data.

[0101] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0102] It should be noted that although several modules or units of the data processing apparatus have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0103] Furthermore, in exemplary embodiments of this disclosure, an electronic device capable of implementing the above-described method is also provided. Reference is made below. Figure 9 To describe an electronic device 900 according to such an embodiment of the present invention. Figure 9 The electronic device 900 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0104] like Figure 9 As shown, the electronic device 900 is presented in the form of a general-purpose computing device. The components of the electronic device 900 may include, but are not limited to: at least one processing unit 910, at least one storage unit 920, a bus 930 connecting different system components (including storage unit 920 and processing unit 910), and a display unit 940.

[0105] The storage unit stores program code, which can be executed by the processing unit 910 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. For example, the processing unit 910 can perform actions such as... Figure 2 The steps are shown in the figure.

[0106] Storage unit 920 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 921 and a cache memory unit 922, and may further include a read-only memory unit (ROM) 923.

[0107] The storage unit 920 may also include a program / utility 924 having a set (at least one) of program modules 925, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.

[0108] Bus 930 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0109] Electronic device 900 can also communicate with one or more external devices 1000 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with electronic device 900, and any device that enables electronic device 900 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 950. Furthermore, electronic device 900 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and public networks such as the Internet) via network adapter 960. As shown, network adapter 960 communicates with other modules of electronic device 900 via bus 930. It should be understood that, although not shown in the figures, other hardware and software modules can be used in conjunction with electronic device 900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0110] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0111] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions that can be executed by a processor of the device to perform the described method. Optionally, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0112] In an exemplary embodiment, a computer program product is also provided, including a computer program and instructions, which, when executed by a processor, implement the data processing method described above.

[0113] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0114] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A data processing method, characterized in that, include: The component sends a data retrieval request to the server through its data request interface and receives the target data returned by the server in response to the data retrieval request. In response to the fact that the data request interface is an extended interface of the component, the target data is converted into a data format through the interface data converter of the component to obtain component data; the component data is data applicable to the component. In response to the fact that the data request interface is an internal interface of the component, the target data is determined to be the component data.

2. The method according to claim 1, characterized in that, The step of converting the target data into component data using the component's interface data converter includes: Obtain the data conversion rules corresponding to the extended interface, and pass the data conversion rules corresponding to the extended interface to the interface data converter; The component's interface data converter converts the target data according to the data conversion rules corresponding to the extended interface to obtain the component data.

3. The method according to claim 2, characterized in that, The method further includes: Obtain a first data structure corresponding to the internal interface and a second data structure corresponding to the extended interface; the first data structure includes a first data field, and the second data structure includes a second data field; In response to the fact that the first data structure is the same as the second data structure and the first data field is different from the second data field, a data conversion rule corresponding to the extended interface is generated based on the first data field and the second data field; In response to the difference between the first data structure and the second data structure, a data conversion rule corresponding to the extended interface is generated based on the first data structure and the second data structure.

4. The method according to claim 3, characterized in that, The step of generating the data transformation rules corresponding to the extended interface based on the first data field and the second data field includes: Establish a first mapping relationship between the first data field and the second data field; Based on the established first mapping relationship, the first data conversion rule corresponding to the extended interface is generated.

5. The method according to claim 4, characterized in that, The target data includes the second data field and the target data value corresponding to the second data field, and the target data value is the original data returned by the server in response to the data acquisition request; The step of converting the target data according to the data conversion rules corresponding to the extended interface through the interface data converter of the component to obtain the component data includes: The component's interface data converter obtains the second data field and the target data value corresponding to the second data field from the target data. Based on the first mapping relationship in the first data conversion rule, query the first data field corresponding to the second data field, and determine that the target data value corresponding to the second data field is the data value corresponding to the first data field; According to the first data structure, the first data field and the corresponding data value of the first data field are associated to obtain the component data.

6. The method according to claim 3, characterized in that, The step of generating the data transformation rules corresponding to the extended interface based on the first data structure and the second data structure includes: Based on the structural relationship between the data fields and their corresponding data values ​​in the second data structure, determine the path used to obtain the data values ​​corresponding to the second data fields; Establish a second mapping relationship between the first data field and the path used to obtain the data value corresponding to the second data field; Based on the established second mapping relationship, a second conversion rule corresponding to the extended interface is generated.

7. The method according to claim 6, characterized in that, The target data includes the second data field and the target data value corresponding to the second data field, and the target data value is the original data returned by the server in response to the data acquisition request; The step of converting the target data according to the data conversion rules corresponding to the extended interface through the interface data converter of the component to obtain the component data includes: The component's interface data converter obtains a path for acquiring the target data value corresponding to the second data field, and acquires the target data value corresponding to the second data field according to the path for acquiring the target data value corresponding to the second data field. Based on the second mapping relationship in the second conversion rule, query the first data field corresponding to the path used to obtain the target data value corresponding to the second data field, and determine that the target data value corresponding to the second data field is the data value corresponding to the first data field; According to the first data structure, the first data field and the corresponding data value of the first data field are associated to obtain the component data.

8. A data processing apparatus, characterized in that, include: The data acquisition module is used to send a data acquisition request to the server through the component's data request interface and receive the target data returned by the server in response to the data acquisition request. A data conversion module is used to respond to the data request interface being an extended interface of the component, and to convert the target data into a data format using the component's interface data converter to obtain component data; the component data is data suitable for the component. In response to the fact that the data request interface is an internal interface of the component, the target data is determined to be the component data.

9. A computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the data processing method as described in any one of claims 1 to 7.

10. An electronic device, characterized in that, include: processor; and memory for storing the executable instructions of the processor; The processor is configured to perform the data processing method as described in any one of claims 1 to 7 by executing the executable instructions.

11. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the data processing method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • JSON data analysis method and device, computer equipment and storage medium

    CN109684607A

  • Data processing method and device

    CN112416419A

  • Interface data format conversion method and device

    CN113918635A

  • Dynamic configuration heterogeneous interface data conversion method and device, equipment and medium

    CN115840559A

  • Data Transmission Method, Data Transfer Device, and System

    US20160316463A1