Data format conversion method and device, electronic equipment and storage medium
By automating data format conversion through pre-configured conversion rules and execution conditions, the system solves the problems of high error rates and low efficiency caused by manual coding, and achieves efficient, accurate and standardized data format conversion.
Patent Information
- Application Number
- CN202510946453.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-09
- Publication Date
- 2025-11-11
AI Technical Summary
In existing technologies, manually writing complex code logic to achieve format conversion between different data types results in high error rates and low efficiency.
By using pre-configured conversion rules and execution conditions, the system automatically manages the set of variables during the execution of the target service, achieving unified conversion and standardization of data formats, including mapping of variable names to parameter names, data type conversion, conditional judgment, and visual editing, and supports advanced conversion capabilities such as JSON encoding/decoding.
It improves the efficiency and accuracy of data format conversion, realizes the automation and standardization of data format conversion, reduces development and maintenance costs, and enhances the compatibility and reliability of data interaction processes.
Smart Images

Figure CN120929520A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing technology, and in particular to a data format conversion method and apparatus, electronic device and storage medium. Background Technology
[0002] With the continuous development and application of technologies such as big data, cloud computing, and the Internet of Things in various fields, the scale of data is growing exponentially, and data types are becoming increasingly diversified. Data interaction between different systems and services is becoming more and more frequent, and data type format conversion has become a key link in data interaction.
[0003] Currently, manually writing complex code logic to achieve format conversion between different data types not only consumes a lot of manpower, but also results in a high error rate in the conversion process due to the complexity of the code logic, which cannot meet the needs of efficient and accurate data format conversion. Summary of the Invention
[0004] This disclosure provides a data format conversion method, apparatus, electronic device, and storage medium. Its main purpose is to solve the problems of high error rate and low efficiency that exist in the prior art when manually writing complex code logic to achieve format conversion between different data types.
[0005] According to a first aspect of this disclosure, a data format conversion method is provided, comprising:
[0006] During the execution of the target service, the first target variable required by the target service is obtained from the variable set;
[0007] According to the pre-configured first conversion rule, the format of the first target variable is converted into the corresponding first target format to obtain the target parameter;
[0008] If the target parameters are determined to meet the preset first execution conditions, the target parameters are transmitted to the target service to obtain the function execution result;
[0009] According to the pre-configured second conversion rule, the format of the function execution result is converted into the corresponding second target format to obtain the second target variable;
[0010] The second target variable is stored in the variable set.
[0011] In some embodiments, after storing the second target variable in the variable set, the method further includes:
[0012] If the second target variable is determined to meet the preset second execution condition, the target service is controlled to execute cyclically.
[0013] If it is determined that the second target variable does not meet the preset second execution condition, the target service is terminated.
[0014] In some embodiments, converting the format of the first target variable into a corresponding first target format according to a pre-configured first conversion rule to obtain the target parameters includes:
[0015] Determine the variable name for the first target variable;
[0016] Based on the variable name of the first target variable and the pre-configured first conversion rule, the target parameter name corresponding to the variable name of the first target variable and the first target format corresponding to the target parameter name are determined; wherein, the pre-configured first conversion rule records the mapping relationship between the variable name and the parameter name, as well as the data type corresponding to the variable name and the data type corresponding to the parameter name;
[0017] The first target variable is converted into the target parameter according to the first target format.
[0018] In some embodiments, converting the format of the function execution result into a corresponding second target format according to a pre-configured second conversion rule to obtain a second target variable includes:
[0019] Determine the parameter names of the function execution result;
[0020] Based on the parameter names of the function execution result and the pre-configured second conversion rule, determine the target variable name corresponding to the parameter name of the function execution result and the second target format corresponding to the target variable name; wherein, the pre-configured second conversion rule records the mapping relationship between parameter names and variable names, as well as the data type corresponding to the parameter name and the data type corresponding to the variable name;
[0021] According to the second target format, the parameter names of the function execution result are converted into the second target variable.
[0022] In some embodiments, the method further includes:
[0023] In response to a received first update instruction for the first conversion rule and / or the second conversion rule, the first conversion rule and / or the second conversion rule are updated according to the update content corresponding to the first update instruction;
[0024] Specifically, when the first conversion rule and / or the second conversion rule are operated on in the visual editing interface, the first update instruction is triggered.
[0025] In some embodiments, the method further includes:
[0026] In response to a received second update instruction for the preset first execution condition and / or preset second execution condition, the preset first execution condition and / or preset second execution condition are updated according to the update content corresponding to the second update instruction;
[0027] Specifically, when operating on the preset first execution condition and / or the preset second execution condition in the visual editing interface, the second update instruction is triggered.
[0028] In some embodiments, the step of converting the format of the first target variable into a corresponding first target format according to a pre-configured first conversion rule to obtain the target parameter further includes:
[0029] In the scenario where the first target variable required by the target service cannot be obtained from the set of variables, the default value is determined to be the target parameter.
[0030] According to a second aspect of this disclosure, a data format conversion apparatus is provided, comprising:
[0031] The acquisition unit is used to acquire the first target variable required by the target service from the variable set during the execution of the target service;
[0032] The first conversion unit is used to convert the format of the first target variable into the corresponding first target format according to the pre-configured first conversion rule to obtain the target parameter;
[0033] The determining unit is configured to transmit the target parameters to the target service to obtain the function execution result when it is determined that the target parameters meet the preset first execution conditions;
[0034] The second conversion unit is used to convert the format of the function execution result into the corresponding second target format according to the pre-configured second conversion rules, so as to obtain the second target variable;
[0035] A storage unit is used to store the second target variable in the variable set.
[0036] In some embodiments, the apparatus further includes:
[0037] The control unit is configured to, after the storage unit stores the second target variable in the variable set, control the target service to execute cyclically if it is determined that the second target variable meets a preset second execution condition;
[0038] The exit unit is used to exit the target service if it is determined that the second target variable does not meet the preset second execution conditions.
[0039] In some embodiments, the first conversion unit includes:
[0040] The first determining module is used to determine the variable name of the first target variable;
[0041] The second determining module is used to determine the target parameter name corresponding to the variable name of the first target variable and the first target format corresponding to the target parameter name based on the variable name of the first target variable and the pre-configured first conversion rule; wherein, the pre-configured first conversion rule records the mapping relationship between the variable name and the parameter name, as well as the data type corresponding to the variable name and the data type corresponding to the parameter name;
[0042] The first conversion module is used to convert the first target variable into the target parameter according to the first target format.
[0043] In some embodiments, the second conversion unit includes:
[0044] The third determining module is used to determine the parameter names of the function execution result;
[0045] The fourth determining module is used to determine the target variable name corresponding to the parameter name of the function execution result and the second target format corresponding to the target variable name based on the parameter name of the function execution result and the pre-configured second conversion rule; wherein, the pre-configured second conversion rule records the mapping relationship between parameter names and variable names, as well as the data type corresponding to the parameter name and the data type corresponding to the variable name;
[0046] The second conversion module is used to convert the parameter names of the function execution result into the second target variable according to the second target format.
[0047] In some embodiments, the apparatus further includes:
[0048] The first update unit is configured to update the first conversion rule and / or the second conversion rule in response to a received first update instruction for the first conversion rule and / or the second conversion rule, according to the update content corresponding to the first update instruction;
[0049] Specifically, when the first conversion rule and / or the second conversion rule are operated on in the visual editing interface, the first update instruction is triggered.
[0050] In some embodiments, the apparatus further includes:
[0051] The second update unit is configured to, in response to a received second update instruction for the preset first execution condition and / or the preset second execution condition, update the preset first execution condition and / or the preset second execution condition according to the update content corresponding to the second update instruction;
[0052] Specifically, when operating on the preset first execution condition and / or the preset second execution condition in the visual editing interface, the second update instruction is triggered.
[0053] In some embodiments, the first conversion unit further includes:
[0054] The fifth determining module is used to determine the default value as the target parameter when the first target variable required by the target service cannot be obtained from the variable set.
[0055] According to a third aspect of this disclosure, an electronic device is provided, comprising:
[0056] At least one processor; and
[0057] A memory communicatively connected to the at least one processor; wherein,
[0058] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect above.
[0059] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the method described in the first aspect above.
[0060] According to a fifth aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method described in the first aspect above.
[0061] The data format conversion method, apparatus, electronic device, and storage medium disclosed herein include: during the execution of a target service, obtaining a first target variable required by the target service from a variable set; converting the format of the first target variable to a corresponding first target format according to a pre-configured first conversion rule to obtain a target parameter; if the target parameter meets a preset first execution condition, transmitting the target parameter to the target service to obtain a function execution result; converting the format of the function execution result to a corresponding second target format according to a pre-configured second conversion rule to obtain a second target variable; and storing the second target variable in the variable set. Compared with related technologies, the solution disclosed herein can uniformly manage the variables required by each service through a variable set, convert the first target variable in the variable set to the target parameter required by the service through a configurable first conversion rule, determine whether to transmit the target parameter to the service before service execution based on a conditional judgment mechanism, and convert the function execution result of the service to the second target variable in the variable set through a configurable second conversion rule. This improves the efficiency and accuracy of data format conversion and realizes the automation and standardization of data format conversion.
[0062] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0063] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0064] Figure 1 A flowchart illustrating a data format conversion method provided in an embodiment of this disclosure;
[0065] Figure 2 A visual configuration interface for a first data format conversion rule provided in an embodiment of this disclosure;
[0066] Figure 3 A visual configuration interface for a first execution condition provided in an embodiment of this disclosure;
[0067] Figure 4 This is a schematic flowchart illustrating a first target variable format conversion provided in an embodiment of this disclosure;
[0068] Figure 5 A flowchart illustrating the format conversion of function execution results provided in this embodiment of the disclosure;
[0069] Figure 6 A schematic diagram illustrating a process for dynamically updating conversion rules, provided in an embodiment of this disclosure;
[0070] Figure 7 A schematic diagram illustrating a process for dynamically updating execution conditions, provided as an embodiment of this disclosure;
[0071] Figure 8 A flowchart illustrating another data format conversion method provided in this embodiment of the disclosure;
[0072] Figure 9 This is a schematic diagram of the structure of a data format conversion device provided in an embodiment of the present disclosure;
[0073] Figure 10 A schematic diagram of another data format conversion device provided in an embodiment of this disclosure;
[0074] Figure 11 A schematic block diagram of an example electronic device 1100 provided for embodiments of this disclosure. Detailed Implementation
[0075] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0076] The following description, with reference to the accompanying drawings, outlines a data format conversion method, apparatus, electronic device, and storage medium according to embodiments of the present disclosure.
[0077] Figure 1 This is a flowchart illustrating a data format conversion method provided in an embodiment of the present disclosure.
[0078] like Figure 1 As shown, the method includes the following steps:
[0079] Step 101: During the execution of the target service, obtain the first target variable required by the target service from the variable set.
[0080] The variable collection is a single-level or multi-level key-value pair container used in this disclosure for centralized data management. It adopts a structured storage method and can accommodate various data types (basic types, maps, arrays, and nested structures). The variable collection realizes centralized access to data through a unified interface, avoiding interaction chaos caused by scattered data storage.
[0081] A target service refers to a business logic unit that requires data format conversion, receives input parameters in a specific format, and outputs execution results in a specific format. Its form can be diverse, including but not limited to: functions in a program, independent code modules, scripts, etc. Specifically, this disclosure does not limit the type of service.
[0082] During the execution of the target service, the variable name corresponding to the first target variable required by the target service is determined. Data is then located from the variable set using the variable name corresponding to the first target variable (i.e., the first target variable required by the target service is obtained). In the specific implementation, the data location process may differ depending on the data type. For example, for basic types such as integers and strings, data can be directly extracted by variable name; for map types, hierarchical data can be accessed using `map.key`; for array types, elements can be accessed using `array.index`; and for nested structures such as nested maps and arrays, data can be accessed via chained field paths.
[0083] This step achieves centralized data management through a set of variables, effectively avoiding the interaction chaos and redundancy problems caused by scattered data storage; the retrieval method based on field path parsing provides a unified access logic for various types of data such as basic types, maps, arrays, and nested structures, eliminating the need to write separate retrieval code for different data types, reducing manual coding and lowering development costs.
[0084] Step 102: According to the pre-configured first conversion rule, convert the format of the first target variable into the corresponding first target format to obtain the target parameter.
[0085] After obtaining the first target variable, it will be formatted according to the pre-configured first transformation rule to finally obtain the target parameters that meet the requirements of the target service.
[0086] In some embodiments, the first conversion rule records the mapping relationship between the variable name and the parameter name, and the correspondence between the data type of the variable and the data type of the parameter.
[0087] In some embodiments, to facilitate the configuration of the first transformation rule, this disclosure embodiment uses a visual configuration interface for configuring the first transformation rule, such as... Figure 2As shown, its content includes the mapping relationship between variable names and parameter names (i.e., which variable corresponds to which parameter), the correspondence between primitive data types of variables (such as integers, maps) and data types of parameters (such as strings, JSON strings), and processing instructions for special data types (such as whether JSON encoding or decoding is required, or whether merge, replace, or other merging strategies are used).
[0088] Based on the first target variable determined in step 101, the mapping relationship between the variable name of the first target variable and the parameter name of the target parameter, and the correspondence between the original data type of the first target variable and the data type of the target parameter are found according to the configured first transformation rule, so as to obtain the target parameter that meets the requirements of the target service.
[0089] This step effectively solves the problems of low efficiency and error-proneness in traditional manual encoding methods for data format conversion through a configurable automated conversion mechanism. The pre-configured conversion rules abstract the complex data type mapping logic into reusable configuration items, avoiding the need to repeatedly write conversion code for each data interaction scenario, significantly reducing development and maintenance costs. At the same time, it supports advanced conversion capabilities such as JSON encoding / decoding and nested structure processing, which can flexibly cope with diverse data format requirements and improve the compatibility of data interaction.
[0090] Step 103: If the target parameters meet the preset first execution conditions, the target parameters are transmitted to the target service to obtain the function execution result.
[0091] In some embodiments, to facilitate the configuration of the first execution condition, this disclosure embodiment uses a visual configuration interface to configure the first execution condition, such as... Figure 3 As shown, its content includes the field path of the parameter to be judged, the comparison rule, the target value corresponding to the comparison rule, and the processing instructions when the condition is met or not met.
[0092] After the format conversion from the first target variable to the target parameter is completed in step 102, the target parameter is validated according to the preset first execution condition to determine whether to transmit it to the target service. The preset first execution condition refers to the judgment rule pre-configured by the user, which is used to judge the input parameter before the target service is executed. Its content includes the field path of the target parameter to be judged (such as "judgeReWriteStatus"), the comparison rule (such as equal to, greater than, contain, not equal to, etc.), the target value corresponding to the comparison rule, and the processing instructions when the condition is met or not met.
[0093] By enabling dynamic control over the execution of target services through preset conditions, this solves the problem of insufficient flexibility caused by the hard-coded coupling of process judgment and business logic in traditional solutions, and reduces the cost of business changes; pre-execution parameter verification can intercept abnormal data and improve process reliability.
[0094] Step 104: According to the pre-configured second conversion rule, convert the format of the function execution result into the corresponding second target format to obtain the second target variable.
[0095] After the target service completes execution and generates the function execution result, the result is format-converted according to the pre-configured second conversion rule to obtain a second target variable that can be stored in the variable set. The second conversion rule here is logically consistent with the first conversion rule in step 102, also including the mapping relationship between parameter names and variable names, the correspondence between the source data type (i.e., the type of the function execution result) and the second target format (i.e., the type of the second target variable), and special processing instructions (such as JSON encoding / decoding, merging strategies). The difference lies in the reverse data flow; the second conversion rule is used to convert the result output by the target service into a format that the variable set can store. Therefore, this embodiment of the disclosure will not elaborate on the second conversion rule.
[0096] This step achieves a standardized transformation of the target service output to the variable set through the second transformation rule, avoiding the tedious process of manually writing result parsing code.
[0097] Step 105: Store the second target variable in the variable set.
[0098] After obtaining the second target variable that conforms to the second target format based on step 104, the variable is stored in the variable set according to the preset storage path to ensure that the storage location and hierarchical relationship of the variable in the set are clear and traceable.
[0099] This method can uniformly manage the variables required by each service through a variable set, convert the first target variable in the variable set into the target parameter required by the service through a configurable first conversion rule, determine whether to transmit the target parameter to the service before the service is executed based on a condition judgment mechanism, and convert the function execution result of the service into the second target variable in the variable set through a configurable second conversion rule. This improves the efficiency and accuracy of data format conversion and realizes the automation and standardization of data format conversion.
[0100] In one possible implementation of this disclosure, in order to achieve dynamic control over the execution flow of the target service, this disclosure provides a cyclic execution judgment method based on a second target variable, including:
[0101] If the second target variable is determined to meet the preset second execution condition, the target service is controlled to execute cyclically; if the second target variable is determined not to meet the preset second execution condition, the target service is exited.
[0102] If the second target variable extracted from the variable set meets the preset second execution condition, the "loop execution" instruction is triggered to execute the target service in a loop; if the second target variable does not meet the preset second execution condition, the "terminate" instruction is triggered to exit the execution process of the target service.
[0103] Using the above method, without modifying the code of the target service, the cyclic execution or termination of the target service can be flexibly controlled by configuring a preset second execution condition, which significantly improves the flexibility of process control and business adaptability.
[0104] In one possible implementation of this disclosure, in order to achieve automated conversion of different data formats, this disclosure further describes the first target variable format conversion process in step 102, such as... Figure 4 As shown, it includes:
[0105] Step 201: Determine the variable name of the first target variable.
[0106] In some embodiments, the process of retrieving variables from a variable set is based on field path parsing. The field path parsing process differs for different data types. For example, for basic types such as integers and strings, data can be directly extracted via field paths when locating data; for map types, hierarchical data can be accessed via map.key when locating data; for array types, elements can be accessed via array.index when locating data; and for nested structures such as nested map arrays, data can be accessed via chained field paths when locating data.
[0107] Step 202: Based on the variable name of the first target variable and the pre-configured first conversion rule, determine the target parameter name corresponding to the variable name of the first target variable and the first target format corresponding to the target parameter name; wherein, the pre-configured first conversion rule records the mapping relationship between variable names and parameter names, as well as the data type corresponding to the variable name and the data type corresponding to the parameter name.
[0108] Based on the variable name of the first target variable determined in step 201, the target parameter name corresponding to the variable name of the first target variable and the first target format corresponding to the target parameter name are searched from the pre-configured first transformation rules.
[0109] In some embodiments, the first conversion rule is stored in the configuration area of the variable set in the form of a configuration file, which records the mapping relationship between variable names and parameter names, as well as the correspondence between variable data types and parameter data types.
[0110] Step 203: Convert the first target variable into the target parameter according to the first target format.
[0111] Based on the first target format determined by the first conversion rule in step 202, perform a format conversion operation on the first target variable.
[0112] In some embodiments, for basic data types, direct type conversion can be performed, such as converting an integer to a string; for complex structured data such as maps and arrays, conversion can be performed, including but not limited to methods such as JSON encoding / decoding and hierarchical path parsing. Specifically, this disclosure does not limit the parsing method for complex structured data.
[0113] The standardized conversion process based on configuration rules described above replaces the traditional method of manually writing conversion code, eliminating the need to repeatedly develop conversion logic for different data types and target services. Configurable mapping relationships and type conversion rules enable the system to quickly adapt to changes in business needs, significantly improving the efficiency and accuracy of data format conversion while reducing development and maintenance costs.
[0114] In one possible implementation of this disclosure, in order to achieve standardized reuse of the target service output results, this disclosure further explains the implementation process of the second conversion rule in step 104, as follows: Figure 5 As shown, it includes:
[0115] Step 301: Determine the parameter name of the function execution result.
[0116] In response to the received function execution result, retrieve the parameter name of the function execution result.
[0117] Step 302: Based on the parameter name of the function execution result and the pre-configured second conversion rule, determine the target variable name corresponding to the parameter name of the function execution result and the second target format corresponding to the target variable name; wherein, the pre-configured second conversion rule records the mapping relationship between parameter names and variable names, as well as the data type corresponding to the parameter name and the data type corresponding to the variable name.
[0118] Based on the parameter names of the function execution result determined in step 301, the variable names and their corresponding formats are determined from the pre-configured second conversion rules.
[0119] In some embodiments, the second conversion rule is stored in the configuration area of the variable set in the form of a configuration file, which records the mapping relationship between parameter names and variable names, as well as the data types corresponding to the parameter names and the data types corresponding to the variable names.
[0120] Step 303: Convert the parameter names of the function execution result into the second target variable according to the second target format.
[0121] The format of the function execution result is converted according to the format determined by the second conversion rule in step 302.
[0122] In some embodiments, for basic data types, type conversion can be performed directly, such as converting a string to an integer; for complex structured data such as maps and arrays, conversion can be performed, including but not limited to JSON encoding / decoding, hierarchical path parsing, etc. Specifically, the parsing method for complex structured data is not limited in the embodiments of this disclosure.
[0123] In some embodiments, if the "items" parameter returned by the target service is a JSON array, and it is desired to store it as a nested map structure variable, then the "items" field is JSON decoded according to the rules to finally obtain the variable that meets the requirements.
[0124] Through the standardized conversion process based on configuration rules described above, a unified format processing of the target service output results is achieved, eliminating the need to write customized parsing code for the return results of different services. The configurable mapping relationships and type conversion rules enable the system to flexibly adapt to the output formats of various service interfaces.
[0125] In one possible implementation of this disclosure, to achieve real-time adjustment of the conversion rules, this disclosure also proposes a method for dynamically updating the conversion rules through visual editing, such as... Figure 6 As shown, it includes:
[0126] Step 401: During the execution of the target service, obtain the first target variable required by the target service from the variable set.
[0127] Step 402: According to the pre-configured first conversion rule, the format of the first target variable is converted into the corresponding first target format to obtain the target parameter.
[0128] Step 403: If the target parameters meet the preset first execution conditions, the target parameters are transmitted to the target service to obtain the function execution result.
[0129] Step 404: According to the pre-configured second conversion rule, the format of the function execution result is converted into the corresponding second target format to obtain the second target variable.
[0130] Step 405: Store the second target variable in the variable set.
[0131] For explanations of steps 401 to 405, please refer to [link / reference needed]. Figure 1 The detailed description of the relevant steps will not be repeated here.
[0132] Step 406: In response to the received first update instruction for the first conversion rule and / or the second conversion rule, update the first conversion rule and / or the second conversion rule according to the update content corresponding to the first update instruction;
[0133] Specifically, when the first conversion rule and / or the second conversion rule are operated on in the visual editing interface, the first update instruction is triggered.
[0134] When business needs to adjust data transformation rules, users can edit the data transformation rules through the visual editing interface according to their own needs.
[0135] Please continue reading. Figure 2 The interface displays the current configuration in a table format: the "Variable Set" column on the left shows the variable names and data types to be converted, and the "Interface Input Parameters" column on the right corresponds to the target parameter name, data type, default value, and merging method. When the user performs an operation on the visual interface, the first update command is triggered.
[0136] In practical applications, the first conversion rule and / or the second conversion rule can be in the same visual editing interface or in different visual editing interfaces. This embodiment of the disclosure does not limit the specific presentation form of the first conversion rule and / or the second conversion rule; and the first update instruction is triggered to update the first conversion rule and / or the second conversion rule.
[0137] This instruction carries the specific details of the rule update, including information such as newly added variables, parameter mappings, modified data types or default values. Specifically, this disclosure does not limit the specific information to be updated.
[0138] In response to the received first update instruction, the first transformation rule and / or the second transformation rule are updated according to the update content corresponding to the instruction.
[0139] In some embodiments, if a user adds a rule mapping the "userName" variable to the "username_param" parameter, in response to the received update instruction, the mapping relationship, the corresponding data type, and other information are added to the transformation rule; if a user modifies the default value of the "model" parameter corresponding to the "nop" variable, in response to the received update instruction, the default value configuration in that rule item is updated.
[0140] In this way, without modifying the code, adjustments to the transformation rules (first transformation rule and / or second transformation rule) can be made through a visual interface. Business personnel do not need complex coding skills to flexibly adapt to business changes.
[0141] In one possible implementation of this disclosure, to achieve real-time adjustment of execution conditions, this disclosure proposes a dynamic update mechanism for execution conditions based on visual editing, such as... Figure 7 As shown, it includes:
[0142] Step 501: During the execution of the target service, obtain the first target variable required by the target service from the variable set.
[0143] Step 502: According to the pre-configured first conversion rule, convert the format of the first target variable into the corresponding first target format to obtain the target parameter.
[0144] Step 503: If the target parameters meet the preset first execution conditions, the target parameters are transmitted to the target service to obtain the function execution result.
[0145] Step 504: According to the pre-configured second conversion rule, the format of the function execution result is converted into the corresponding second target format to obtain the second target variable.
[0146] Step 505: Store the second target variable in the variable set.
[0147] For explanations of steps 501 to 505, please refer to [link / reference needed]. Figure 1 The detailed description of the relevant steps will not be repeated here.
[0148] Step 506: In response to the received second update instruction for the preset first execution condition and / or preset second execution condition, update the preset first execution condition and / or preset second execution condition according to the update content corresponding to the second update instruction;
[0149] Specifically, when operating on the preset first execution condition and / or the preset second execution condition in the visual editing interface, the second update instruction is triggered.
[0150] When the data execution conditions need to be adjusted, users can enter the visual editing interface for the preset first and second execution conditions.
[0151] Please continue reading. Figure 3 The interface displays the current configuration in a table format, including configuration items such as field path, type, comparison method, target value, and trigger command. The operation column has remove and add buttons, supporting the deletion and addition of conditions.
[0152] When the user interacts with the visual interface, the second update command is automatically triggered.
[0153] This instruction carries the specific details of the condition update, including the modified comparison logic, newly added condition entries, and deleted condition rules.
[0154] In response to the received second update instruction, the preset first execution condition and the preset second execution condition are updated according to the update content corresponding to the second update instruction.
[0155] In some embodiments, if a user adds a condition "trigger the continued execution of flow if schema equals 1", the field path, comparison method, trigger command, and other information of the condition are added to the corresponding execution condition configuration; if a user modifies the target value of "judgeRewriteStatus" to "3", the target value setting of the condition item is updated.
[0156] In this way, without interrupting services or writing complex code, the execution conditions (first and / or second execution conditions) can be adjusted through a visual interface. Business personnel do not need advanced coding skills to flexibly adapt to business changes.
[0157] In one possible implementation of this disclosure, to improve the robustness of the data format conversion process, this disclosure provides a further improved conversion mechanism by adding a default value compensation strategy, such as... Figure 8 As shown, it includes:
[0158] Step 601: During the execution of the target service, obtain the first target variable required by the target service from the variable set.
[0159] Step 602: In the scenario where the first target variable required by the target service cannot be obtained from the variable set, the default value is determined as the target parameter.
[0160] When the target service is executing and extracting the first target variable from the variable set, if a variable is missing or a field path does not exist, the default value mechanism is automatically triggered. This mechanism uses pre-configured default value mapping rules to directly determine the preset default value as the target parameter, ensuring the smooth execution of subsequent processes.
[0161] In some embodiments, during the user registration process, the target service needs to obtain the `user.level` field as a level parameter, but the variable set only contains basic user information. In this case, the conversion module will search for the default value configuration corresponding to `user.level` in the first conversion rule, find that the preset value is "Level 1", and verify the type matching of the default value according to the data type requirements of the target parameter to ensure that "Level 1" conforms to the type constraints of `user.level`. Finally, the default value "Level 1" is directly passed to the target service as the target parameter to avoid process interruption due to missing variables.
[0162] Step 603: If the target parameters meet the preset first execution conditions, the target parameters are transmitted to the target service to obtain the function execution result.
[0163] Step 604: According to the pre-configured second conversion rule, the format of the function execution result is converted into the corresponding second target format to obtain the second target variable.
[0164] Step 605: Store the second target variable in the variable set.
[0165] For explanations of steps 601, 603 to 605, please refer to [link / reference needed]. Figure 1 The detailed description of the relevant steps will not be repeated here.
[0166] This method improves the robustness and fault tolerance of the data processing flow through a configurable default value compensation strategy.
[0167] Corresponding to the data format conversion method described above, this invention also proposes a data format conversion apparatus. Since the apparatus embodiments of this invention correspond to the method embodiments described above, details not disclosed in the apparatus embodiments can be referred to in the method embodiments described above, and will not be repeated here.
[0168] Figure 9 This is a schematic diagram of the structure of a data format conversion device provided in an embodiment of the present disclosure, such as... Figure 9 As shown, it includes:
[0169] The acquisition unit 91 is used to acquire the first target variable required by the target service from the variable set during the execution of the target service;
[0170] The first conversion unit 92 is used to convert the format of the first target variable into the corresponding first target format according to the pre-configured first conversion rule to obtain the target parameter;
[0171] The determining unit 93 is used to transmit the target parameters to the target service to obtain the function execution result when it is determined that the target parameters meet the preset first execution conditions;
[0172] The second conversion unit 94 is used to convert the format of the function execution result into the corresponding second target format according to the pre-configured second conversion rule, so as to obtain the second target variable;
[0173] Storage unit 95 is used to store the second target variable in the variable set.
[0174] This device can uniformly manage the variables required by various services through a variable set, convert the first target variable in the variable set into the target parameter required by the service through a configurable first conversion rule, determine whether to transmit the target parameter to the service before the service is executed based on a condition judgment mechanism, and convert the function execution result of the service into the second target variable in the variable set through a configurable second conversion rule. This improves the efficiency and accuracy of data format conversion and realizes the automation and standardization of data format conversion.
[0175] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 10 As shown, the device further includes:
[0176] The control unit 96 is configured to, after the storage unit stores the second target variable in the variable set, control the target service to execute cyclically when it is determined that the second target variable meets a preset second execution condition;
[0177] Exit unit 97 is used to exit the target service if it is determined that the second target variable does not meet the preset second execution conditions.
[0178] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 10 As shown, the first conversion unit 92 includes:
[0179] The first determining module 921 is used to determine the variable name of the first target variable;
[0180] The second determining module 922 is used to determine the target parameter name corresponding to the variable name of the first target variable and the first target format corresponding to the target parameter name based on the variable name of the first target variable and the pre-configured first conversion rule; wherein, the pre-configured first conversion rule records the mapping relationship between the variable name and the parameter name, as well as the data type corresponding to the variable name and the data type corresponding to the parameter name;
[0181] The first conversion module 923 is used to convert the first target variable into the target parameter according to the first target format.
[0182] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 10 As shown, the second conversion unit 94 includes:
[0183] The third determining module 941 is used to determine the parameter name of the function execution result;
[0184] The fourth determining module 942 is used to determine the target variable name corresponding to the parameter name of the function execution result and the second target format corresponding to the target variable name based on the parameter name of the function execution result and the pre-configured second conversion rule; wherein, the pre-configured second conversion rule records the mapping relationship between the parameter name and the variable name, as well as the data type corresponding to the parameter name and the data type corresponding to the variable name;
[0185] The second conversion module 943 is used to convert the parameter name of the function execution result into the second target variable according to the second target format.
[0186] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 10 As shown, the device further includes:
[0187] The first update unit 98 is configured to update the first conversion rule and / or the second conversion rule in response to a received first update instruction for the first conversion rule and / or the second conversion rule, according to the update content corresponding to the first update instruction;
[0188] Specifically, when the first conversion rule and / or the second conversion rule are operated on in the visual editing interface, the first update instruction is triggered.
[0189] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 10 As shown, the device further includes:
[0190] The second update unit 99 is configured to, in response to a received second update instruction for the preset first execution condition and / or the preset second execution condition, update the preset first execution condition and / or the preset second execution condition according to the update content corresponding to the second update instruction;
[0191] Specifically, when operating on the preset first execution condition and / or the preset second execution condition in the visual editing interface, the second update instruction is triggered.
[0192] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 10 As shown, the first conversion unit 92 further includes:
[0193] The fifth determining module 924 is used to determine the default value as the target parameter when the first target variable required by the target service cannot be obtained from the variable set.
[0194] It should be noted that the foregoing explanation of the method embodiments also applies to the apparatus of the embodiments of this disclosure, and the principle is the same. Therefore, the embodiments of this disclosure are not limited thereto.
[0195] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0196] Figure 11 A schematic block diagram of an example electronic device 1100 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0197] like Figure 11As shown, the electronic device 1100 includes a computing unit 1101, which can perform various appropriate actions and processes according to a computer program stored in ROM (Read-Only Memory) 1102 or loaded from storage unit 1108 into RAM (Random Access Memory) 1103. The RAM 1103 may also store various programs and data required for the operation of the electronic device 1100. The computing unit 1101, ROM 1102, and RAM 1103 are interconnected via bus 1104. An I / O (Input / Output) interface 1105 is also connected to bus 1104.
[0198] Multiple components in electronic device 1100 are connected to I / O interface 1105, including: input unit 1106, such as keyboard, mouse, etc.; output unit 1107, such as various types of displays, speakers, etc.; storage unit 1108, such as disk, optical disk, etc.; and communication unit 1109, such as network card, modem, wireless transceiver, etc. Communication unit 1109 allows electronic device 1100 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0199] The computing unit 1101 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1101 include, but are not limited to, CPUs (Central Processing Units), GPUs (Graphics Processing Units), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSPs (Digital Signal Processors), and any suitable processor, controller, microcontroller, etc. The computing unit 1101 performs the various methods and processes described above, such as data format conversion methods. For example, in some embodiments, the data format conversion method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1108. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1100 via ROM 1102 and / or communication unit 1109. When the computer program is loaded into RAM 1103 and executed by the computing unit 1101, one or more steps of the methods described above may be performed. Alternatively, in other embodiments, the computing unit 1101 may be configured to perform the aforementioned data format conversion method by any other suitable means (e.g., by means of firmware).
[0200] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System-on-Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0201] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0202] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0203] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0204] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include LANs (Local Area Networks), WANs (Wide Area Networks), the Internet, and blockchain networks.
[0205] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0206] It's important to note that artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies primarily include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.
[0207] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0208] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A data format conversion method, characterized in that, include: During the execution of the target service, the first target variable required by the target service is obtained from the variable set; According to the pre-configured first conversion rule, the format of the first target variable is converted into the corresponding first target format to obtain the target parameter; If the target parameters are determined to meet the preset first execution conditions, the target parameters are transmitted to the target service to obtain the function execution result; According to the pre-configured second conversion rule, the format of the function execution result is converted into the corresponding second target format to obtain the second target variable; The second target variable is stored in the variable set.
2. The method according to claim 1, characterized in that, After storing the second target variable in the variable set, the method further includes: If the second target variable is determined to meet the preset second execution condition, the target service is controlled to execute cyclically. If it is determined that the second target variable does not meet the preset second execution condition, the target service is terminated.
3. The method according to claim 1, characterized in that, The step of converting the format of the first target variable into a corresponding first target format according to a pre-configured first conversion rule to obtain the target parameters includes: Determine the variable name for the first target variable; Based on the variable name of the first target variable and the pre-configured first conversion rule, the target parameter name corresponding to the variable name of the first target variable and the first target format corresponding to the target parameter name are determined; wherein, the pre-configured first conversion rule records the mapping relationship between the variable name and the parameter name, as well as the data type corresponding to the variable name and the data type corresponding to the parameter name; The first target variable is converted into the target parameter according to the first target format.
4. The method according to claim 1, characterized in that, The step of converting the format of the function execution result into the corresponding second target format according to the pre-configured second conversion rule to obtain the second target variable includes: Determine the parameter names of the function execution result; Based on the parameter names of the function execution result and the pre-configured second conversion rule, determine the target variable name corresponding to the parameter name of the function execution result and the second target format corresponding to the target variable name; wherein, the pre-configured second conversion rule records the mapping relationship between parameter names and variable names, as well as the data type corresponding to the parameter name and the data type corresponding to the variable name; According to the second target format, the parameter names of the function execution result are converted into the second target variable.
5. The method according to claim 1, characterized in that, The method further includes: In response to a received first update instruction for the first conversion rule and / or the second conversion rule, the first conversion rule and / or the second conversion rule are updated according to the update content corresponding to the first update instruction; Specifically, when the first conversion rule and / or the second conversion rule are operated on in the visual editing interface, the first update instruction is triggered; Optionally, In response to a received second update instruction for the preset first execution condition and / or preset second execution condition, the preset first execution condition and / or preset second execution condition are updated according to the update content corresponding to the second update instruction; Specifically, when operating on the preset first execution condition and / or the preset second execution condition in the visual editing interface, the second update instruction is triggered.
6. The method according to any one of claims 1-5, characterized in that, The step of converting the format of the first target variable into the corresponding first target format according to a pre-configured first conversion rule to obtain the target parameters further includes: In the scenario where the first target variable required by the target service cannot be obtained from the set of variables, the default value is determined to be the target parameter.
7. A data format conversion device, characterized in that, include: The acquisition unit is used to acquire the first target variable required by the target service from the variable set during the execution of the target service; The first conversion unit is used to convert the format of the first target variable into the corresponding first target format according to the pre-configured first conversion rule to obtain the target parameter; The determining unit is configured to transmit the target parameters to the target service to obtain the function execution result when it is determined that the target parameters meet the preset first execution conditions; The second conversion unit is used to convert the format of the function execution result into the corresponding second target format according to the pre-configured second conversion rules, so as to obtain the second target variable; A storage unit is used to store the second target variable in the variable set.
8. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-6.
10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method according to any one of claims 1-6.
Citation Information
Patent Citations
Service calling method and device and electronic equipment
CN112532564A
Game service request processing method and device, electronic equipment and storage medium
CN117717768A
Business script generation method and related device thereof
CN119536697A
Data tranformations between a source application and service-oriented target applications supporting different data formats
US20100185635A1