Data conversion method and device, electronic equipment and storage medium

By using transformation mapping relationships in software development to associate the data to be converted with the target data format, the entity class conversion problem caused by differences in different service data structures is solved, which improves development efficiency and saves resources.

CN120144647APending Publication Date: 2025-06-13JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311712062.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-13
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

During the software development process, due to the differences in data structures of different services, a large number of entity conversions are required, which reduces development efficiency and wastes development resources.

Method used

By obtaining the target data format for the target service, and determining the corresponding data to be converted in the target service based on the pre-configured conversion mapping relationship, the data to be converted in the target service is finally associated with the target data format to complete the data conversion.

Benefits of technology

It avoids entity conversion work between different services, reduces development workload, improves development efficiency, saves development resources, and ensures conversion efficiency and service performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120144647A_ABST
    Figure CN120144647A_ABST
Patent Text Reader

Abstract

The invention provides a data conversion method and device, electronic equipment and a storage medium. Relates to the technical field of computers. The method comprises the following steps: in response to a received service calling request for a target service, obtaining a target data format of a service calling party; according to a conversion mapping relationship, determining corresponding to-be-converted data of the target data format in a target service; the conversion mapping relation is a pre-configured data format corresponding relation between different services; and establishing association between the to-be-converted data and the target data format to complete data conversion. According to the method and the device, the problems of low development efficiency and resource waste caused by inconsistent data structures in related technologies are solved to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technologies, and in particular, to a data conversion method, an apparatus, an electronic device, and a storage medium. Background Art

[0002] During the software development process, the development of different services is involved. When a newly developed service needs to be connected to an existing service, due to the difference in data structures between the two services, entity class conversion generally needs to be performed to meet the data structure consistency requirements of the service, which will bring a large amount of entity class conversion workload, greatly reducing the development efficiency and consuming development resources.

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

[0004] The purpose of the embodiments of the present disclosure is to provide a data conversion method, an apparatus, an electronic device, and a storage medium, thereby solving, to a certain extent, the problems of low development efficiency and resource waste caused by inconsistent data structures in the related art.

[0005] According to a first aspect of the present disclosure, a data conversion method is provided, including: in response to receiving a service call request for a target service, obtaining a target data format of a service caller; determining, according to a conversion mapping relationship, data to be converted corresponding to the target data format in the target service, where the conversion mapping relationship is a pre-configured corresponding relationship between data formats of different services; associating the data to be converted with the target data format to complete data conversion.

[0006] Optionally, the target data format includes target attribute fields, and obtaining the target data format of the service caller includes: intercepting, through a preset aspect function, methods and target attribute fields of a target entity class associated with the service call request, where the target attribute fields are determined by configured annotations.

[0007] Optionally, the data to be converted includes to-be-converted attribute fields and corresponding field values, and determining, according to the conversion mapping relationship, data to be converted corresponding to the target data format in the target service includes: determining, according to the conversion mapping relationship, to-be-converted attribute fields corresponding to the target attribute fields in the target service; obtaining corresponding field values according to entity classes corresponding to the to-be-converted attribute fields.

[0008] Optionally, establishing an association between the data to be converted and the target data format includes: constructing a corresponding target expression according to the acquisition path of the field value; parsing the target expression by using a target parser to obtain the field value; and establishing a mapping association between the target attribute field and the field value.

[0009] Optionally, the method further includes: storing the target attribute field and the target expression in a shared variable of the current thread.

[0010] Optionally, the method further includes: obtaining the processing logic corresponding to the target expression by calling the shared variable; and constructing a target parser according to the processing logic.

[0011] Optionally, the method further includes: sending request data in the target data format to a service invoker.

[0012] According to a second aspect of the present disclosure, there is provided a data conversion device, including: an acquisition module configured to acquire a target data format of a service invoker in response to receiving a service call request for a target service; a determination module configured to determine data to be converted corresponding to the target data format in the target service according to a conversion mapping relationship, where the conversion mapping relationship is a data format correspondence relationship between different services configured in advance; and a conversion module configured to establish an association between the data to be converted and the target data format to complete data conversion.

[0013] According to a third aspect of the present disclosure, there is provided a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method of any of the above embodiments is implemented.

[0014] According to a fourth aspect of the present disclosure, there is provided an electronic device, including: one or more processors; and a storage device for one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are caused to execute the method of any of the above embodiments.

[0015] The exemplary embodiments of the present disclosure may have some or all of the following beneficial effects:

[0016] In the data conversion method provided by the exemplary embodiments of the present disclosure, the target data format for the target service can be obtained, and the data to be converted corresponding to the target data format in the target service can be determined according to the conversion mapping relationship; the data to be converted is associated with the target data format to complete the data conversion. On the one hand, by pre-configuring the corresponding relationship of data formats between different services and establishing a mapping relationship between the data to be converted of the target service and the target data format, the conversion work of entity classes between different services can be avoided, greatly reducing the development workload, improving the development efficiency, and saving development resources. On the other hand, by establishing an association between the data to be converted and the target data format for data conversion, no additional calculation amount needs to be added, ensuring the conversion efficiency and service performance.

[0017] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The accompanying drawings here are incorporated into the specification and constitute a part of this specification, showing the embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure. Obviously, the accompanying drawings in the following description are only some embodiments of the present disclosure, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.

[0019] Figure 1 FIG. 1 schematically shows one of the flow diagrams of the data conversion method according to an embodiment of the present disclosure.

[0020] Figure 2 FIG. 2 schematically shows the schematic diagram of the association process between the target attribute field and the field value according to an embodiment of the present disclosure.

[0021] Figure 3 FIG. 3 schematically shows the second of the flow diagrams of the data conversion process according to an embodiment of the present disclosure.

[0022] Figure 4 FIG. 4 schematically shows the structural block diagram of the data conversion device according to an embodiment of the present disclosure.

[0023] Figure 5 FIG. 5 shows the block diagram of the electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0024] Example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of the present disclosure. However, those skilled in the art will recognize that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or may be implemented using other methods, components, devices, steps, etc. In other cases, well-known technical solutions are not shown or described in detail to avoid obscuring aspects of the present disclosure.

[0025] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus repeated descriptions thereof will be omitted. Some of the 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, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0026] The data conversion method of the present disclosure can be applied to various business systems including terminals and servers. For two services with a dependency relationship, there is often an interaction process during business processing. When a newly developed service (target service) needs to access an existing service, it is necessary to adapt to the data format requirements (target data format) of the existing service. During this data format adaptation process, the server can obtain the target data format for the target service; determine the data to be converted corresponding to the target data format in the target service according to the conversion mapping relationship; the conversion mapping relationship is a pre-configured data format correspondence relationship between different services; establish an association between the data to be converted and the target data format to complete the data conversion. The terminal is used for the user to trigger the business including the above data format adaptation process and receive the returned business execution result.

[0027] The terminal can be a laptop computer, a tablet computer, a desktop computer, a set-top box, various mobile terminals such as a mobile phone, a tablet, or a wearable device, etc. The server can be a backend server providing services for performing various computing services. Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, and cloud storage, or a node in a blockchain. This example is not limited thereto.

[0028] Next, in combination with specific embodiments, the data conversion method disclosed in the embodiments of this specification will be introduced.

[0029] Refer to Figure 1 As shown, a data conversion method according to an exemplary embodiment provided by the present disclosure can be applied to a server and may include the following steps:

[0030] Step S110, in response to receiving a service call request for a target service, obtain the target data format of the service caller.

[0031] Step S120, according to the conversion mapping relationship, determine the data to be converted corresponding to the target data format in the target service; the conversion mapping relationship is the corresponding relationship of data formats between different services pre-configured.

[0032] Step S130, establish an association between the data to be converted and the target data format to complete the data conversion.

[0033] In the data conversion method provided by this exemplary embodiment, the target data format for the target service can be obtained, and according to the conversion mapping relationship, the data to be converted corresponding to the target data format in the target service can be determined; an association is established between the data to be converted and the target data format to complete the data conversion. On the one hand, by pre-configuring the corresponding relationship of data formats between different services and establishing a mapping relationship between the data to be converted in the target service and the target data format, the entity class conversion work between different services can be avoided, greatly reducing the development workload, improving the development efficiency, and saving development resources. On the other hand, by establishing an association between the data to be converted and the target data format for data conversion, no additional calculation amount needs to be added, ensuring the conversion efficiency and service performance.

[0034] The following describes each step of the present disclosure in more detail.

[0035] In step S110, in response to receiving a service call request for a target service, obtain the target data format of the service caller.

[0036] In this exemplary embodiment, the target service refers to the service called by the service invoker (such as other services), that is, the service that needs to match the data format of the service invoker. For example, it can be a microservice that divides an independent application system into multiple groups of small services, and each microservice can run in the form of an independent process in the system. The target data format refers to the data format that needs to be converted, that is, the converted data format, which can include methods and target attribute fields, etc. The process of triggering the target service call process and data conversion process can be triggered through business trigger operations or data requests of the user client. For example, in response to the product query operation of the user client, a data conversion process is performed when the product information service is called. In this example, the service call request can be implemented through a remote procedure call (RPC) or a Uniform Resource Locator (URL), and the service call can also be implemented through other interaction methods. This example does not limit this. In this example, the target data format can be determined by obtaining the method used in the service call request, or can be determined by the request parameter description included in the service call request. This example does not limit this.

[0037] Exemplarily, the method and target attribute fields of the target entity class corresponding to the service call request can be intercepted through a preset aspect function to determine the attribute fields that need to be converted.

[0038] In this exemplary embodiment, a dedicated aspect function can be configured for the data conversion process so that the aspect function can be shared among different entity classes to implement the data conversion processes of different entity classes. An entity class represents a certain individual, and the attributes in the class are the specific manifestations of this individual. For example, for a user entity class, name, age, and occupation are the attributes of this entity class. An entity class can correspond to a database. The attribute fields that need to be data-converted by the calling party service can be identified by configuring annotations on the methods and attribute fields of each entity class. For example, a method primary key such as @Transform can be configured in the aspect function, and an attribute primary key such as @DateTransform(“Value”) can be configured, where Value is the attribute primary key value. During the service call process, the method and Value attribute field of the target entity class can be intercepted through this aspect function.

[0039] In step S120, according to the conversion mapping relationship, the data to be converted corresponding to the target data format in the target service is determined.

[0040] In the present exemplary embodiment, the conversion mapping relationship is the corresponding relationship of data formats between different pre-configured services. Exemplarily, the conversion mapping relationship is the corresponding relationship of attribute fields between different pre-configured services. For example, the conversion mapping relationship can establish a corresponding relationship between "name" and "nickName". The data to be converted refers to the data that needs to be converted in the request data corresponding to the service call request. The corresponding request data can be determined based on information such as the request parameters of the service call request, and then the request data is matched with the conversion mapping relationship to determine the data to be converted in the request data. The data to be converted can include the attribute fields to be converted and the corresponding field values. For example, "name", "age", and "position" are the attribute fields to be converted, and the corresponding field values are Zhang San, 23, and doctor, respectively.

[0041] Exemplarily, during the service call process, the field value of the attribute field to be converted can be obtained through the following steps. First, according to the conversion mapping relationship, determine the attribute field to be converted corresponding to the target attribute field in the target service; according to the entity class corresponding to the attribute field to be converted, obtain the corresponding field value.

[0042] In the present exemplary embodiment, a corresponding conversion mapping table can be generated based on the conversion mapping relationship. Search for the attribute field to be converted corresponding to the target attribute field in the conversion mapping table, and then according to the entity class corresponding to the attribute field to be converted, obtain the value of the attribute field to be converted in the current method through the reflection mechanism, and at the same time determine the acquisition path of the field value.

[0043] In step S130, associate the data to be converted with the target data format to complete the data conversion.

[0044] In the present exemplary embodiment, a mapping relationship can be established between the attribute fields corresponding to the data to be converted and the target data format to associate the two. This association process can be implemented through a logical expression. For example, it can be implemented through a logical expression based on the Spring Expression Language (SpEL). The Spring Expression Language can query and operate on data at runtime, which can reduce the amount of code and optimize the code structure.

[0045] Exemplarily, the process of associating the data to be converted with the target data format can include the following steps:

[0046] First step, construct the corresponding target expression according to the acquisition path of the field value.

[0047] In the present exemplary embodiment, according to the acquisition path of the field value of the attribute to be converted, the Spring Expression Language can be used to construct a target expression to obtain the field value of the mapped attribute at the data layer. For example, the target expression is args[i]&.name, where args represents the field value passed to the current method for use, [i] represents the array marker bit i, name represents the name of the attribute to be converted, & represents the memory address of name, and. represents the acquisition path for parsing the value of name.

[0048] In the second step, the target parser is used to parse the target expression to obtain the corresponding field value.

[0049] In the present exemplary embodiment, a corresponding parser can be constructed based on the expression language of the target expression. For example, a Spring Expression Language parser can be constructed to parse the target expression to obtain the field value.

[0050] In the third step, a mapping association is established between the target attribute field and the field value.

[0051] In the present exemplary embodiment, the field value is mapped to the target attribute field marked in the annotation to obtain the conversion result.

[0052] Exemplarily, the method further includes storing the target expression in a shared variable of the current thread.

[0053] In the present exemplary embodiment, after the target expression is constructed, the target expression can be stored in a shared variable of the current thread. The target expression (such as a shared variable) can be cached in various ways such as local caching or distributed caching (such as redis processing), and this exemplary embodiment does not limit this. For example, the target expression can be stored based on ThreadLocal. ThreadLocal is a class in Java for creating thread-local variables. Using the key value in ThreadLocall as the cache primary key can ensure thread-safe data conversion. By storing the target expression in the shared variable of the local thread for caching, it is convenient for more efficient parsing and calculation later.

[0054] Exemplarily, the processing logic corresponding to the target expression can be obtained by calling the shared variable; according to the processing logic, a target parser is constructed. In this exemplary embodiment, by caching the target expression, during subsequent data conversion, based on the target attribute field, a match is made in the cache. If a match is found, the expression can be directly obtained from the cache for parsing and calculation. For example, the stored target expression can be obtained from the cache by calling the corresponding method (such as the get method) of the current thread, which can improve the conversion processing efficiency.

[0055] For example, such as Figure 2As shown, the association between the target attribute field and the field value of the annotation can be carried out through the following steps.

[0056] First step, according to the acquisition path of the field value and the attribute field to be converted, deduce the corresponding target expression.

[0057] Second step, store the target attribute field corresponding to the target expression and the speculated target expression in the cache.

[0058] Third step, obtain the target expression corresponding to the target attribute field.

[0059] Fourth step, construct a SpEL parser according to the target expression.

[0060] Fifth step, use the SpEL parser to parse the target expression.

[0061] Sixth step, according to the parsing result, establish a mapping association between the target attribute field required in the annotation value and the parsing result.

[0062] In some embodiments, after obtaining the conversion result, a request data in the target data format can be sent to the service invoker.

[0063] In the present exemplary implementation manner, a response message of the service call request can be generated based on the conversion result, and the request response can be made to the service invoker. It is also possible to return the conversion result to the service invoker in JSON form. The present example does not limit this form of interaction data.

[0064] In some embodiments, a data conversion function component can be formed based on the above data conversion process. After obtaining the conversion result, a print log service, etc. can also be provided. This method can be applied between the upstream service and the downstream service, where the downstream service invokes the upstream service, and can also be applied between other services with a dependency relationship. The present example does not limit this.

[0065] For example, the implementation process of the data conversion method of the present disclosure is as Figure 3 shown. Taking the data conversion in the server as an example for illustration, it can be specifically implemented through the following steps.

[0066] Step S301, receive a service call request from the service invoker for the target service.

[0067] Step S302, intercept the method and target attribute field of the target entity class corresponding to the service call request through the preset aspect function.

[0068] Step S303, according to the conversion mapping relationship, determine the attribute field to be converted corresponding to the target attribute field in the target service.

[0069] Step S304, determine whether there is a target expression corresponding to the attribute to be converted in the cache. If so, go to S308; otherwise, go to S305.

[0070] Step S305, obtain the corresponding field value according to the entity class corresponding to the attribute field to be converted.

[0071] Step S306, construct a target expression for the field value acquisition path.

[0072] Step S307, store the target expression in the shared variable of the current thread.

[0073] Step S308, obtain the target expression and construct a target parser corresponding to the target expression.

[0074] Step S309, use the target parser to parse the target expression to obtain the field value.

[0075] Step S310, map the field value to the target attribute field marked by the annotation to obtain the request data in the target data format.

[0076] Step S311, send the request data in the target data format to the service invoker.

[0077] In this example, the expression of the data layer acquisition path of the field value corresponding to the attribute to be converted can be deduced through the attribute to be converted and the acquisition path of the corresponding field value. Then, by constructing a parser for this expression, the field value can be parsed and mapped to the target attribute field to obtain the conversion result. The conversion result can be sent to the invoker through various interaction methods, avoiding the entity class conversion work and improving the development efficiency.

[0078] The specific details of each step in this embodiment have been described in detail in the foregoing embodiments, so they will not be repeated here.

[0079] In the present disclosure, since newly developed services currently cannot directly provide services to downstream services, entity class conversion is required to meet the format requirements of the data structures of downstream services. For the case where the downstream service is a mature existing service, to achieve the docking between the developed service and the downstream service, entity class conversion of the developed service is needed, consuming a large amount of conversion time and development resources. Through custom annotations for data conversion, the present disclosure identifies the methods and attribute fields that require data conversion, then determines the attributes to be converted and their field values corresponding to the attribute fields of the annotation through a conversion mapping relationship, deduces the field value calculation expression at the data layer based on the field value acquisition path, and finally realizes the association between the mapped attribute (target attribute) and the field value at the data layer by constructing a parser. On the one hand, it can enable the target service to quickly access the downstream service, saving development time and improving development efficiency. On the other hand, by using the expression for deducing the field value to obtain data in the target data format and performing the mapping process of attributes and values, an accurate and rapid data conversion process is realized. In addition, this data conversion process can be applied between any two services with different data structures, and has a wide application scope.

[0080] Further, in the exemplary embodiment of the present disclosure, a data conversion device 400 is also provided. The data conversion device 400 can be applied to an application platform. Refer to Figure 4 As shown, the data conversion device 400 may include: an acquisition module 410, a determination module 420, and a conversion module 430, where: The acquisition module 410 is configured to, in response to receiving a service call request for a target service, acquire the target data format of the service caller; The determination module 420 is configured to determine the data to be converted corresponding to the target data format in the target service according to the conversion mapping relationship; The conversion mapping relationship is a pre-configured correspondence of data formats between different services; The conversion module 430 is configured to establish an association between the data to be converted and the target data format to complete the data conversion.

[0081] In an exemplary embodiment of the present disclosure, the target data format includes target attribute fields, and the acquisition module 410 may also be configured to: intercept the methods and target attribute fields of the target entity class associated with the service call request through a preset aspect function, and the target attribute fields are determined by the configured annotations.

[0082] In an exemplary embodiment of the present disclosure, the data to be converted includes the attribute fields to be converted and the corresponding field values, and the determination module 420 may also be configured to: determine the attribute fields to be converted corresponding to the target attribute fields in the target service according to the conversion mapping relationship; acquire the corresponding field values according to the entity class corresponding to the attribute fields to be converted.

[0083] In an exemplary embodiment of the present disclosure, the conversion module may further be configured to: construct a corresponding target expression according to the acquisition path of the field value; parse the target expression by using a target parser to obtain the field value; and establish a mapping association between the target attribute field and the field value.

[0084] In an exemplary embodiment of the present disclosure, the apparatus 400 may further include: a storage module, which is configured to store the target attribute field and the target expression in the shared variable of the current thread.

[0085] In an exemplary embodiment of the present disclosure, the apparatus 400 may further include: a parser construction module, which is configured to: obtain the processing logic corresponding to the target expression by calling the shared variable; and construct a target parser according to the processing logic.

[0086] In an exemplary embodiment of the present disclosure, the apparatus 400 may further include: a sending module, which is configured to send request data in a target data format to a service invoker.

[0087] The specific details of each module or unit in the above data conversion apparatus have been described in detail in the corresponding data conversion method, and thus will not be elaborated herein.

[0088] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or may exist alone without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the one or more programs are executed by an electronic device, the electronic device is caused to implement the method in the following embodiments. For example, the electronic device may implement the various steps as Figures 1 - 3 shown.

[0089] It should be noted that the computer-readable medium shown in this disclosure can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this disclosure, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. And in this disclosure, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0090] Next, refer to Figure 5 to describe the electronic device 500 according to this embodiment of the present disclosure. Figure 5 The shown electronic device 500 is only an example and should not impose any limitation on the functions and usage scope of the embodiments of the present disclosure.

[0091] As Figure 5 shown, the electronic device 500 is presented in the form of a general-purpose computing device. The components of the electronic device 500 can include, but are not limited to: at least one of the above-mentioned processing units 510, at least one of the above-mentioned storage units 520, a bus 530 connecting different system components (including the storage unit 520 and the processing unit 510), and a display unit 540.

[0092] Among them, the storage unit stores program code, which can be executed by the processing unit 510, so that the processing unit 510 executes the steps according to various exemplary embodiments of the present disclosure described in the above "Exemplary Method" section of this specification.

[0093] The storage unit 520 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 5201 and / or a cache storage unit 5202, and may further include a read-only storage unit (ROM) 5203.

[0094] The storage unit 520 may also include a program / utilities 5204 having a set (at least one) of program modules 5205. Such program modules 5205 include, but are 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.

[0095] The bus 530 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus structures.

[0096] The electronic device 500 may also communicate with one or more external devices 570 (such as a keyboard, a pointing device, a Bluetooth device, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 500, and / or may communicate with any device that enables the electronic device 500 to communicate with one or more other electronic devices (such as a router, a modem, etc.). Such communication may be carried out through an input / output (I / O) interface 550. Also, the electronic device 500 may communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 560. As shown in the figure, the network adapter 560 communicates with other modules of the electronic device 500 through the bus 530. It should be understood that although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RA identification systems, tape drives, and data backup storage systems, etc.

[0097] In an exemplary embodiment, there is also provided a computer program product including one or more instructions that may be executed by a processor of a computer device to complete the data conversion method provided in each of the above embodiments.

[0098] Through the description of the above embodiments, those skilled in the art can easily understand that the exemplary embodiments described herein can be implemented by software or by a combination of software and necessary hardware. Therefore, the technical solution according to the embodiments of the present 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, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable an electronic device (such as a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.

[0099] In addition, the above drawings are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, rather than for limiting purposes. It is easy to understand that the processes shown in the above drawings do not indicate or limit the chronological order of these processes. Additionally, it is also easy to understand that these processes can be executed synchronously or asynchronously in, for example, multiple modules.

[0100] It should be noted that although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that these steps must be executed in that specific order, or that all the steps shown must be executed to achieve the desired result. Additionally or alternatively, certain steps can be omitted, multiple steps can be combined into one step for execution, and / or one step can be decomposed into multiple steps for execution, etc., all of which should be regarded as part of the present disclosure.

[0101] It should be understood that the present disclosure disclosed and defined in this specification extends to all alternative combinations of two or more separate features mentioned or obvious in the text and / or drawings. All these different combinations constitute multiple alternative aspects of the present disclosure. The embodiments of this specification illustrate the best mode known for implementing the present disclosure and will enable those skilled in the art to utilize the present disclosure.

Claims

1. A data conversion method, characterized in that, it includes: In response to receiving a service call request for a target service, obtain the target data format of the service caller; According to the conversion mapping relationship, determine the data to be converted corresponding to the target data format in the target service; the conversion mapping relationship is the data format correspondence relationship pre-configured between different services; Associate the data to be converted with the target data format to complete data conversion.

2. The data conversion method according to claim 1, characterized in that, The target data format includes target attribute fields, and the obtaining of the target data format of the service caller includes: Through a preset aspect function, intercept the methods and target attribute fields of the target entity class associated with the service call request, and the target attribute fields are determined by configured annotations.

3. The data conversion method according to claim 2, characterized in that, The data to be converted includes fields to be converted and corresponding field values. According to the conversion mapping relationship, determining the data to be converted corresponding to the target data format in the target service includes: According to the conversion mapping relationship, determine the fields to be converted corresponding to the target attribute fields in the target service; According to the entity class corresponding to the fields to be converted, obtain the corresponding field values.

4. The data conversion method according to claim 3, characterized in that, Associating the data to be converted with the target data format includes: According to the acquisition path of the field value, construct a corresponding target expression; Use a target parser to parse the target expression to obtain the field value; Establish a mapping association between the target attribute field and the field value.

5. The data conversion method according to claim 4, characterized in that, The method further includes: Store the target attribute field and the target expression in the shared variable of the current thread.

6. The data conversion method according to claim 5, characterized in that, The method further includes: By calling the shared variable, obtain the processing logic corresponding to the target expression; According to the processing logic, construct a target parser.

7. The data conversion method according to any one of claims 1 to 6, characterized in that, The method further includes: Send the request data of the target data format to the service caller.

8. A data conversion device, characterized in that, The device includes: An acquisition module, configured to obtain the target data format of the service caller in response to receiving a service call request for a target service; A determination module, configured to determine the data to be converted corresponding to the target data format in the target service according to the conversion mapping relationship; the conversion mapping relationship is the data format correspondence relationship pre-configured between different services; A conversion module, configured to associate the data to be converted with the target data format to complete data conversion.

9. An electronic device, characterized in that, it includes: One or more processors; And A storage device for storing one or more programs which, when executed by one or more processors, cause the one or more processors to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having stored thereon a computer program, wherein, the program, when executed by a processor, implements the method according to any one of claims 1 to 7.