Parameter conversion method, device and equipment, computer storage medium and program product
By receiving configuration modification instructions for target conversion code, adjusting the conversion configuration rules, and dynamic adjustment of parameter conversion methods is achieved, the problem of inflexible and low efficiency of parameter conversion in the prior art is solved, and the efficiency of parameter conversion and business processing efficiency are improved.
Patent Information
- Application Number
- CN202411373982.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-09-29
AI Technical Summary
The existing parameter conversion method needs to be re-modified when the conversion conditions change, resulting in large labor investment, low efficiency, and inflexible, making it difficult to meet the rapid adjustment of business needs.
By receiving configuration modification instructions for the target parameters and target conversion code to be converted, adjusting the conversion type and/or conversion parameters in the conversion configuration rules, dynamic adjustment of the parameter conversion method is realized, code modification is avoided, and real-time effect is achieved.
It improves the flexibility and efficiency of parameter conversion, reduces workload, and can complete the modification of parameter conversion method without deploying tests, improving the work efficiency of business processing.
Smart Images

Figure CN119271300A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of big data technology, and in particular relates to a parameter conversion method, device, equipment, computer storage medium and program product. Background Art
[0002] At present, parameter conversion is often required in various business docking scenarios. Parameter conversion realizes the function of converting parameters from one expression form to another, but the existing parameter conversion method has the following defects: when the conversion conditions change, for example, if the request parameter name is modified, or the conversion method needs to be adjusted, the code needs to be modified again according to the new conversion conditions, which requires a lot of manpower and the parameter maintenance efficiency is low. Therefore, there are problems such as inflexible parameter conversion implementation, large workload and long time consumption.
[0003] Based on this, the industry is still in urgent need of a new parameter conversion solution to achieve the purpose of efficiently and flexibly realizing configuration modification and parameter conversion of the parameter conversion method. Summary of the invention
[0004] The embodiments of the present application provide a parameter conversion method, apparatus, device, computer storage medium and program product, which can more efficiently and flexibly implement configuration modification and parameter conversion of the parameter conversion method, thereby effectively improving the overall parameter conversion efficiency under different business requirements and improving the efficiency of business processing work.
[0005] In a first aspect, an embodiment of the present application provides a parameter conversion method, the parameter conversion method comprising:
[0006] Receive a first target parameter to be converted and a configuration modification instruction corresponding to a target conversion code, wherein there is a mapping relationship between a target service type of the first target parameter and the target conversion code, and the configuration modification instruction is used to instruct to modify a parameter conversion mode defined by the target conversion code from an initial conversion mode to a target conversion mode;
[0007] In response to the configuration modification instruction, a conversion type and / or conversion parameter set by at least one first conversion configuration rule among N conversion configuration rules corresponding to the target conversion code is adjusted to obtain a second conversion configuration rule after configuration modification; wherein each conversion configuration rule among the N conversion configuration rules is provided with a corresponding conversion type and conversion parameter, and N is a positive integer;
[0008] The first target parameter is converted according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain a second target parameter that conforms to the target conversion method.
[0009] In some possible implementations, before receiving the first target parameter to be converted and the configuration modification instruction corresponding to the target conversion code, the parameter conversion method further includes:
[0010] Receiving a plurality of preset conversion codes and mapping relationships between the plurality of preset conversion codes and a plurality of service classifications, the plurality of preset conversion codes including a target conversion code, the plurality of preset conversion codes respectively defining different parameter conversion modes;
[0011] Before receiving the first target parameter to be converted and the configuration modification instruction corresponding to the target conversion code, the parameter conversion method further includes:
[0012] receiving a parameter conversion request of a first target parameter, the parameter conversion request including the first target parameter and a target field, the target field being used to indicate that a business classification of the first target parameter is a target business type;
[0013] Based on the mapping relationship between a plurality of preset conversion codes and a plurality of service classifications, a target conversion code having a mapping relationship with a target service type is determined.
[0014] In some possible implementations, before converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified to obtain the second target parameter that conforms to the target conversion method, the parameter conversion method further includes:
[0015] Obtain M global conversion configuration rules corresponding to the first target parameter, where M is a positive integer;
[0016] The first target parameter is converted according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain a second target parameter that conforms to the target conversion method, including:
[0017] According to the M global conversion configuration rules, the second conversion configuration rule, and the remaining conversion configuration rules that have not been modified in the N conversion configuration rules, the first target parameter is converted to obtain the second target parameter.
[0018] In some possible implementations, converting the first target parameter to obtain the second target parameter according to the M global conversion configuration rules, the second conversion configuration rule, and the remaining conversion configuration rules that have not been modified in the N conversion configuration rules includes:
[0019] Sorting the M global conversion configuration rules, the second conversion configuration rule, and the remaining conversion configuration rules that have not been modified in the N conversion configuration rules to obtain a configuration execution order of the conversion configuration rules;
[0020] In accordance with the configuration execution order, according to the M global conversion configuration rules, the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, the loop configuration of the fields in the first target parameter is started to obtain the second target parameter.
[0021] In some possible implementations, before converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain the second target parameter that conforms to the target conversion method, the parameter conversion method further includes:
[0022] Convert the basic data type of the first target parameter from the first data type to the second data type, where the first data type is the initial data type when the first target parameter is input, and the second data type is a data type that is easy for machine parsing;
[0023] After converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain the second target parameter that conforms to the target conversion method, the parameter conversion method further includes:
[0024] The basic data type of the second target parameter is converted from the second data type to the first data type, and the second target parameter of the second data type is output.
[0025] In some possible implementations, the conversion type includes at least one of an enumeration conversion type, a regular conversion type, a copy conversion type, a constant conversion type, a Bean conversion type, and a Spring expression language Spel conversion type;
[0026] When the conversion type is an enumeration conversion type, the value of the corresponding conversion parameter is configured as the value of the target dictionary;
[0027] When the conversion type is a regular conversion type, one of the corresponding conversion parameters is configured as a regular expression, and the value of the second corresponding conversion parameter is configured as the replaced value;
[0028] When the conversion type is a copy conversion type, the value of the corresponding conversion parameter is configured as the copy path of the parameter;
[0029] When the conversion type is a constant conversion type, the value of the corresponding conversion parameter is the target constant;
[0030] When the conversion type is Bean conversion type, the value of the corresponding conversion parameter is the name of the Bean;
[0031] In the case where the conversion type is a Spel conversion type, the value of the corresponding conversion parameter is a Spel expression.
[0032] In some possible implementations, in response to the configuration modification instruction, adjusting the conversion type and / or conversion parameter set by at least one first conversion configuration rule among the N conversion configuration rules corresponding to the target conversion code to obtain a second conversion configuration rule after the configuration modification includes:
[0033] By calling the interface of at least one conversion class among the conversion parameter conversion class and the conversion type conversion class of the native conversion class, the conversion type and / or conversion parameter set by at least one first conversion configuration rule among the N conversion configuration rules corresponding to the target conversion code are adjusted to obtain a second conversion configuration rule with modified configuration.
[0034] In some possible implementations, converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified to obtain the second target parameter that conforms to the target conversion method includes:
[0035] Obtain the second conversion configuration rule and the remaining conversion configuration rules that have not been modified in the N conversion configuration rules from the Nacos service management platform;
[0036] Based on the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, the first target parameter is converted to obtain the second target parameter.
[0037] Based on the same inventive concept, in a second aspect, an embodiment of the present application provides a parameter conversion device, the parameter conversion device comprising:
[0038] A first receiving module is used to receive a first target parameter to be converted and a configuration modification instruction corresponding to a target conversion code, wherein a mapping relationship exists between a target service type of the first target parameter and the target conversion code, and the configuration modification instruction is used to instruct to modify a parameter conversion mode defined by the target conversion code from an initial conversion mode to a target conversion mode;
[0039] A first adjustment module is used to adjust, in response to the configuration modification instruction, a conversion type and / or conversion parameter set by at least one first conversion configuration rule among N conversion configuration rules corresponding to the target conversion code, to obtain a second conversion configuration rule after the configuration modification; wherein each conversion configuration rule among the N conversion configuration rules is set with a corresponding conversion type and conversion parameter, and N is a positive integer;
[0040] The first conversion module is used to convert the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, so as to obtain the second target parameter that conforms to the target conversion mode.
[0041] In a third aspect, an embodiment of the present application provides a parameter conversion device, the parameter conversion device comprising:
[0042] a processor and a memory storing computer program instructions;
[0043] When the processor executes the computer program instructions, it implements the parameter conversion method provided in any one of the above-mentioned embodiments of the present application.
[0044] In a fourth aspect, an embodiment of the present application provides a computer storage medium, on which computer readable storage medium is stored computer program instructions, and when the computer program instructions are executed by a processor, a parameter conversion method as provided in any one of the above-mentioned embodiments of the present application is implemented.
[0045] In a fifth aspect, an embodiment of the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes a parameter conversion method provided in any one of the above-mentioned embodiments of the present application.
[0046] The embodiment of the present application provides a parameter conversion method, device, equipment, computer storage medium and program product, which receives a first target parameter to be converted and a configuration modification instruction corresponding to a target conversion code. There is a mapping relationship between the target business type of the first target parameter and the target conversion code, and the above configuration modification instruction is used to indicate that the parameter conversion mode defined by the target conversion code is changed from the initial conversion mode to the target conversion mode. Then, in response to the configuration modification instruction, the conversion type and / or conversion parameter set by the first conversion configuration rule in the N conversion configuration rules corresponding to the target conversion code is adjusted to obtain a second conversion configuration rule after configuration modification. In this way, the first target parameter is converted according to the second conversion configuration rule and the remaining conversion configuration rules in the N conversion configuration rules that have not been modified, to obtain a second target parameter that conforms to the target conversion mode.
[0047] It can be seen from the above description that a parameter conversion method, device, equipment, computer storage medium and program product of the embodiment of the present application, by receiving the configuration modification instruction corresponding to the target conversion code, thereby adjusting the conversion type and / or conversion parameters set in the conversion configuration rule under the target conversion code, to achieve the adjustment of the parameter conversion mode defined by the target conversion code, and finally converting the first target parameter based on each conversion configuration rule under the adjusted target conversion code, and the converted second target parameter conforms to the required target conversion mode. The embodiment of the present application separates the change point of the conversion parameter from the code to the conversion type and / or conversion parameter of the conversion configuration rule, thereby realizing the real-time effectiveness of the configuration modification of the parameter conversion mode by simply modifying the conversion type and / or conversion parameter in the configuration rule, so as to achieve the modification requirement of the parameter conversion mode without modifying the code and deploying the test. By adopting the parameter conversion method, device, equipment, computer storage medium and program product provided by the embodiment of the present application, the configuration modification and parameter conversion of the parameter conversion mode can be realized more efficiently and flexibly, so as to effectively improve the overall parameter conversion efficiency under different business requirements and improve the efficiency of business processing work. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0049] Figure 1 It is a flow chart of a parameter conversion method provided in an embodiment of the present application;
[0050] Figure 2 is a flow chart of a parameter conversion method provided by another embodiment of the present application;
[0051] Figure 3 It is a scene flow diagram of a parameter conversion method provided in an embodiment of the present application;
[0052] Figure 4 is a schematic diagram of the structure of a parameter conversion device provided in one embodiment of the present application;
[0053] Figure 5 It is a structural schematic diagram of a parameter conversion device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0054] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0055] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0056] It should be noted that the acquisition, storage, use, and processing of data in the technical solution of this application are in compliance with the relevant provisions of national laws and regulations.
[0057] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0058] As described in the background technology section, the current existing parameter conversion method has the following defects: when the conversion conditions change, for example, if the request parameter name is modified, or the conversion method needs to be adjusted, the code processing needs to be modified again according to the new conversion conditions, which requires a lot of manpower and the parameter maintenance efficiency is low. Therefore, there are problems such as inflexible parameter conversion implementation, large workload and long time consumption.
[0059] In terms of specific business processing scenarios, the current common Java Web system development adopts the MVC model, including the three layers of Controller, Service, and Mapper to process business logic. The Controller part is used to receive request messages, parse request messages, convert request messages, verify request parameters, and then convert response parameters and deserialize response parameters according to the return results of the Service. After the Controller serializes the request message into POJO, if the request message needs to be converted, such as unifying dictionary values, numerical formatting, value replacement, etc. The general practice is to use tool classes to convert one by one in the Controller method processing. However, if the request parameter name is modified or the conversion is adjusted, it is necessary to modify the code.
[0060] The current implementation of the technology is done through hard coding. If the requirements change, the code needs to be modified, packaged, and deployed to the environment before entering the testing phase. If it is a single service and multi-node deployment, it will take more time. Therefore, the above parameter conversion method has problems such as inflexible implementation, large workload, and long time consumption.
[0061] In view of the above, in order to solve the problems of the prior art, the embodiments of the present application provide a parameter conversion method, device, equipment, computer storage medium and program product. It should be noted that the embodiments provided in the present application are not intended to limit the scope of the present application.
[0062] The following first introduces the parameter conversion method provided in the embodiment of the present application.
[0063] Figure 1 FIG. 1 is a flow chart of a parameter conversion method provided by an embodiment of the present application. The parameter conversion method is applied to an electronic device, which may include a server or a user terminal. Figure 1 As shown, the parameter conversion method includes the following steps:
[0064] S110, receiving a first target parameter to be converted and a configuration modification instruction corresponding to a target conversion code, wherein a mapping relationship exists between a target service type of the first target parameter and the target conversion code, and the configuration modification instruction is used to instruct to modify a parameter conversion mode defined by the target conversion code from an initial conversion mode to a target conversion mode;
[0065] S120, in response to the configuration modification instruction, adjusting the conversion type and / or conversion parameter set by at least one first conversion configuration rule among the N conversion configuration rules corresponding to the target conversion code, to obtain a second conversion configuration rule after the configuration modification; wherein each conversion configuration rule among the N conversion configuration rules is set with a corresponding conversion type and conversion parameter, and N is a positive integer;
[0066] S130, converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain a second target parameter that conforms to the target conversion method.
[0067] A parameter conversion method provided by an embodiment of the present application receives a first target parameter to be converted and a configuration modification instruction corresponding to a target conversion code, wherein the configuration modification instruction is used to indicate that the parameter conversion mode defined by the target conversion code is modified from an initial conversion mode to a target conversion mode. Then, in response to the configuration modification instruction, the conversion type and / or conversion parameter set by the first conversion configuration rule among the N conversion configuration rules corresponding to the target conversion code is adjusted to obtain a second conversion configuration rule after configuration modification. Then, the first target parameter is converted according to the second conversion configuration rule and the remaining conversion configuration rules among the N conversion configuration rules that have not been modified, to obtain a second target parameter that conforms to the target conversion mode.
[0068] From the above description, it can be seen that a parameter conversion method of an embodiment of the present application receives a configuration modification instruction corresponding to a target conversion code, thereby adjusting the conversion type and / or conversion parameters set in the conversion configuration rules under the target conversion code to adjust the parameter conversion method defined by the target conversion code, and finally converts the first target parameter based on the respective conversion configuration rules under the adjusted target conversion code, and the converted second target parameter meets the required target conversion method.
[0069] The embodiment of the present application separates the modification points of the conversion parameters from the code to the conversion type and / or conversion parameters of the conversion configuration rules, thereby realizing the real-time effectiveness of the configuration modification of the parameter conversion method by simply modifying the conversion type and / or conversion parameters in the configuration rules, so as to achieve the modification requirements of the parameter conversion method without modifying the code or deploying the test. By adopting the parameter conversion method provided by the embodiment of the present application, the configuration modification and parameter conversion of the parameter conversion method can be realized more efficiently and flexibly, thereby effectively improving the overall parameter conversion efficiency under different business requirements and improving the efficiency of business processing work.
[0070] The specific implementation of the above steps 110 to 130 is described in detail below.
[0071] In S110, when implemented specifically, a configuration modification instruction corresponding to a first target parameter to be converted and a target conversion code is received. There is a mapping relationship between the target service type of the first target parameter and the target conversion code. The configuration modification instruction is used to instruct to modify the parameter conversion mode defined by the target conversion code from the initial conversion mode to the target conversion mode.
[0072] It should be added that the reception time of the configuration modification instruction corresponding to the first target parameter and the target conversion code may be different, or may be the same, and no strict restrictions are imposed here. The reception channel of the first target parameter may be, for example, sent by a business platform organization, and the configuration modification instruction corresponding to the target conversion code may be input by a relevant configuration management personnel, and the present application does not impose strict restrictions on this.
[0073] According to some embodiments of the present application, optionally, in order to more reasonably achieve the acquisition of the above-mentioned first target parameter and more accurately determine the mapping relationship between the target conversion code and the target service type, before receiving the first target parameter to be converted and the configuration modification instruction corresponding to the target conversion code, the parameter conversion method may further include:
[0074] Receiving a plurality of preset conversion codes and mapping relationships between the plurality of preset conversion codes and a plurality of service classifications, the plurality of preset conversion codes may include a target conversion code, and the plurality of preset conversion codes respectively define different parameter conversion modes;
[0075] Before receiving the first target parameter to be converted and the configuration modification instruction corresponding to the target conversion code, the parameter conversion method may further include:
[0076] receiving a parameter conversion request of a first target parameter, where the parameter conversion request may include the first target parameter and a target field, where the target field is used to indicate that a business classification of the first target parameter is a target business type;
[0077] Based on the mapping relationship between a plurality of preset conversion codes and a plurality of service classifications, a target conversion code having a mapping relationship with a target service type is determined.
[0078] In this embodiment, multiple preset conversion codes and mapping relationships between the multiple preset conversion codes and multiple business classifications can be preset based on actual business processing experience, and then the above multiple groups of mapping relationships are stored, and the multiple groups of mapping relationships include the mapping relationship between the target conversion code and the target business type.
[0079] The target conversion code is, for example, "BDC203", the target business type is, for example, the business type of the request URL (Uniform Resource Locator), and the target conversion code can be, for example, a URL. Alternatively, the target conversion code can also be, for example, a parameter value such as a transaction code, and the target business type having a mapping relationship therewith is, for example, a specific transaction type (such as transfer, etc.), which is not strictly limited here.
[0080] According to some embodiments of the present application, optionally, in combination with the parameter conversion means in the actual parameter conversion scenario, in order to more fully realize the design of the conversion configuration rules, so that the parameter conversion method can be modified efficiently and flexibly by adjusting at least one of the conversion type and the conversion parameter, the above-mentioned conversion type may include at least one of an enumeration conversion type, a regular conversion type, a copy conversion type, a constant conversion type, a Bean conversion type, and a Spring expression language Spel conversion type;
[0081] When the conversion type is an enumeration conversion type, the value of the corresponding conversion parameter is configured as the value of the target dictionary;
[0082] When the conversion type is a regular conversion type, one of the corresponding conversion parameters is configured as a regular expression, and the value of the second corresponding conversion parameter is configured as the replaced value;
[0083] When the conversion type is a copy conversion type, the value of the corresponding conversion parameter is configured as the copy path of the parameter;
[0084] When the conversion type is a constant conversion type, the value of the corresponding conversion parameter is the target constant;
[0085] When the conversion type is Bean conversion type, the value of the corresponding conversion parameter is the name of the Bean;
[0086] In the case where the conversion type is a Spel conversion type, the value of the corresponding conversion parameter is a Spel expression.
[0087] In this embodiment, the configuration conversion rule includes the above-mentioned multiple conversion types that can be flexibly modified and the corresponding conversion parameters, and the number of parameters of the conversion parameters is at least one.
[0088] For example, in a configuration transformation rule, the configurable transformation types transType include: 1, enumeration, 2 regular, 3 copy, 4 constant, 5Bean, 6SPEL. The value of the transformation type (transType) of the configuration transformation rule is configured as 6. The transformation parameters in the configuration transformation rule include transformation parameter 1 (varContent1) and transformation parameter 2 (varContent2). The values of the transformation parameters are specifically configured according to the transformation type, and the value of transformation parameter 2 may be empty.
[0089] And, in some other more specific embodiments, the above configuration conversion parameters may also include a specific conversion name (fieldName), such as "SendSeqNo returns". Alternatively, the above configuration conversion parameters may also include a field name (varName), and the value of the field name may be the domain name corresponding to the POJO, such as "OutRsp.SendSeqNo".
[0090] In S120, during the specific implementation, in response to the configuration modification instruction, the conversion type and / or conversion parameters set by at least one first conversion configuration rule among N conversion configuration rules corresponding to the target conversion code are adjusted to obtain a second conversion configuration rule after the configuration modification; wherein each conversion configuration rule among the N conversion configuration rules is set with a corresponding conversion type and conversion parameter, and N is a positive integer.
[0091] Exemplarily, the configurable transformation types transType in the configuration transformation rule include: 1. Enumeration, 2. Regular, 3. Copy, 4. Constant, 5. Bean, 6. SPEL. The original value of the transformation type (transType) of the above-mentioned first configuration transformation rule is 6, the value of transformation parameter 1 (varContent1) is Spel expression, and transformation parameter 2 (varContent2) is empty. In response to the configuration modification instruction, by flexibly modifying the value of the transformation type (transType) of the above-mentioned first configuration transformation rule to 1, and modifying the transformation parameter 1 (varContent1) to the value of the target dictionary, the second transformation configuration rule after the configuration modification can be efficiently obtained.
[0092] It should be added that the first configuration conversion rule that needs to be modified may not be limited to one, and may be determined according to the actual parameter conversion mode adjustment requirements, and is not strictly limited here.
[0093] In S130, during specific implementation, the first target parameter is converted according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain a second target parameter that conforms to the target conversion method.
[0094] According to some embodiments of the present application, optionally, considering that in a business docking scenario, request parameters often need to be converted to parameters in a global configuration, based on this, before converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules in the N types of conversion configuration rules that have not been modified in configuration to obtain the second target parameter that conforms to the target conversion method, the parameter conversion method may further include:
[0095] Obtain M global conversion configuration rules corresponding to the first target parameter, where M is a positive integer;
[0096] Converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified to obtain the second target parameter that conforms to the target conversion method may include:
[0097] According to the M global conversion configuration rules, the second conversion configuration rule, and the remaining conversion configuration rules that have not been modified in the N conversion configuration rules, the first target parameter is converted to obtain the second target parameter.
[0098] In this embodiment, the conversion configuration rule under the above target conversion code can be regarded as a local configuration conversion rule that is only effective for the first target parameter.
[0099] In the specific implementation, taking into account the existence of some globally effective parameter conversion configuration situations, the first target parameter is converted comprehensively by obtaining M kinds of global conversion configuration rules corresponding to the first target parameter, and then combining the global conversion configuration rules and the local configuration conversion rules after the configuration update under the target conversion code, so as to obtain the second target parameter that better meets the parameter conversion requirements.
[0100] The above-mentioned global conversion configuration rules may be pre-stored in a database for easy retrieval.
[0101] According to some embodiments of the present application, optionally, in order to achieve more reasonable parameter conversion of the field in the first target parameter, the above conversion of the first target parameter according to the M global conversion configuration rules, the second conversion configuration rule, and the remaining conversion configuration rules in the N conversion configuration rules that have not been modified in configuration to obtain the second target parameter may include:
[0102] Sorting the M global conversion configuration rules, the second conversion configuration rule, and the remaining conversion configuration rules that have not been modified in the N conversion configuration rules to obtain a configuration execution order of the conversion configuration rules;
[0103] In accordance with the configuration execution order, according to the M global conversion configuration rules, the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, the loop configuration of the fields in the first target parameter is started to obtain the second target parameter.
[0104] In this embodiment, the configuration execution order of the conversion configuration rules is obtained by sorting the M global conversion configuration rules, the second conversion configuration rules, and the remaining conversion configuration rules that have not been modified in the N conversion configuration rules. Then, according to the configuration execution order, the loop configuration of the fields in the first target parameter is started, so that the second target parameter can be obtained more efficiently and reasonably.
[0105] It should be supplemented that the conversion configuration rule in this embodiment may also include a sequence number (sortNo), which can be used to indicate the order of configuration execution.
[0106] See below Figure 2 , Figure 2 FIG. 1 is a flow chart of a parameter conversion method provided by another embodiment of the present application. Figure 2 As shown, the parameter conversion method includes the following steps:
[0107] S110~S120;
[0108] S210, obtaining M types of global conversion configuration rules corresponding to the first target parameter, where M is a positive integer;
[0109] S220, sorting the M global conversion configuration rules, the second conversion configuration rule, and the remaining conversion configuration rules that have not been modified in the N conversion configuration rules to obtain a configuration execution order of the conversion configuration rules;
[0110] In accordance with the configuration execution order, according to the M global conversion configuration rules, the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, the loop configuration of the fields in the first target parameter is started to obtain the second target parameter.
[0111] The specific implementation of the above S110 to S120 may refer to the above embodiments.
[0112] In real-world applications, global configuration is typically used for settings that do not change often, while local configuration is used for settings that may vary by request, user, or environment.
[0113] Therefore, when S210 is specifically executed, M types of global conversion configuration rules corresponding to the first target parameter are first obtained. The multiple global conversion configuration rules can be pre-stored in, for example, Nacos for easy calling.
[0114] The above global conversion configuration rules can, for example, set a globally unified date format for different parameter files, or convert string parameters into User objects, etc., so that the conversion is automatically completed through global configuration, and only local configuration is adopted for conversion configuration in specific situations.
[0115] When S220 is specifically performed, the configuration execution order of the conversion configuration rules is obtained by sorting the M global conversion configuration rules, the second conversion configuration rule, and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified.
[0116] Exemplarily, the M types of global configuration rules include global rule A0 and global rule B0. If the conversion configuration rules included in the N types of conversion configuration rules before modification include conversion configuration rule A1, conversion configuration rule B1, and conversion configuration rule C1, the conversion configuration rule A1 and the conversion configuration rule B1 are modified as the first conversion configuration rules that require conversion type and / or conversion parameter adjustment, thereby obtaining the corresponding second conversion configuration rule A2 and the second conversion configuration rule B2. In this case, the remaining conversion configuration rule that has not been modified in the N types of conversion configuration rules is the conversion configuration rule C1.
[0117] In this case, the global rule A0, the global rule B0, the second conversion configuration rule A2, the second conversion configuration rule B2 and the unmodified conversion configuration rule C1 may be sequentially configured according to preset rules.
[0118] For example, considering that the global rules include operations such as unified adjustment of parameter formats or parameter cleaning and deduplication to facilitate more efficient and accurate parameter conversion, in order to facilitate efficient operation of actual configuration, the execution order of the above-mentioned global rules A0 and global rule B0 can be set first, and the second conversion configuration rule A2, the second conversion configuration rule B2 and the unmodified conversion configuration rule C1 can be set later.
[0119] The execution order of the global rule A0 and the global rule B0 can be random. The specific execution order of the second conversion configuration rule A2, the second conversion configuration rule B2 and the unmodified conversion configuration rule C1 can be considered and set according to whether the content of the specific conversion configuration rule has a logical association, whether it can be executed independently, how to maximize the execution efficiency, etc.
[0120] When S230 is specifically executed, the loop configuration of the fields in the first target parameter is started according to the configuration execution order determined in the above step 220, so that the second target parameter can be obtained more efficiently and reasonably.
[0121] It should be added that after determining the configuration execution order corresponding to the above-mentioned conversion configuration rules, the serial number information of the corresponding execution order of different global or local conversion configuration rules can also be identified and recorded, so as to realize the sequential execution of the configuration by reading its serial number information during the specific loop execution.
[0122] According to some embodiments of the present application, optionally, in order to effectively improve the configuration conversion efficiency of the parameter, before converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules in the N types of conversion configuration rules that have not been modified in configuration to obtain the second target parameter that conforms to the target conversion method, the parameter conversion method may further include:
[0123] Convert the basic data type of the first target parameter from the first data type to the second data type, where the first data type is the initial data type when the first target parameter is input, and the second data type is a data type that is easy for machine parsing;
[0124] After converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain the second target parameter that conforms to the target conversion mode, the parameter conversion method may further include:
[0125] The basic data type of the second target parameter is converted from the second data type to the first data type, and the second target parameter of the second data type is output.
[0126] In this embodiment, before the configuration conversion of the first target parameter needs to be performed, the basic data type of the first target parameter is converted into a second data type that is easy for machine parsing, so that the backend can implement more efficient parameter parsing processing.
[0127] For example, JSONObject can be used as a conversion parameter object to convert the basic data type of the first target parameter from the first data type to the second data type. JSONObject can use the property path to obtain the value, which facilitates the subsequent conversion parameter to obtain the value of the specified property.
[0128] And, after obtaining the second target parameter that conforms to the target conversion method, in order to make the second target parameter meet the visual requirements of the actual business, the basic data type of the second target parameter is converted from the second data type to the first data type, and the second target parameter of the second data type is output. For example, after all the conversion configurations are processed, the second target parameter is converted from JSONObject to an object of the Class type of the input parameter, which is not strictly limited in this embodiment.
[0129] According to some embodiments of the present application, optionally, in order to fully and reasonably realize reliable adjustment of the conversion type and / or conversion parameters set by the conversion configuration rule, the above-mentioned response to the configuration modification instruction, adjusting the conversion type and / or conversion parameters set by at least one first conversion configuration rule among the N conversion configuration rules corresponding to the target conversion code, and obtaining the second conversion configuration rule after the configuration modification, may include:
[0130] By calling the interface of at least one conversion class among the conversion parameter conversion class and the conversion type conversion class of the native conversion class, the conversion type and / or conversion parameter set by at least one first conversion configuration rule among the N conversion configuration rules corresponding to the target conversion code are adjusted to obtain a second conversion configuration rule with modified configuration.
[0131] In the specific implementation, this embodiment provides common built-in conversion classes in advance and designs the conversion class interface. Taking the MVC design pattern as an example, the CoreConvert interface in MVC includes three conversion class interfaces, namely, conversion parameter conversion class, whether native conversion class and conversion type conversion class.
[0132] There are six default implementations of CoreConverter, including: ConstantConverter: sets the parameter to the configured constant value; CopyConverter: sets the parameter to the value of another configured parameter; RegexConverter: uses regular expressions to modify parameter values; EnumConverter: uses dictionary replacement to modify parameter values, where the dictionary can be configured in nacos or obtained from a custom table; BeanConverter: calls another configured Bean to modify the parameter value. This implementation class calls the custom conversion class; SpelConverter: uses Spel expressions to modify parameter values.
[0133] It should be added that in BeanConverter, the value of conversion configuration parameter 1 is obtained, which is beanId. The class corresponding to beanId is searched in the Spring container. This class also needs to implement CoreConvter.
[0134] According to some embodiments of the present application, optionally, converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified to obtain the second target parameter that conforms to the target conversion method may include:
[0135] Obtain the second conversion configuration rule and the remaining conversion configuration rules that have not been modified in the N conversion configuration rules from the Nacos service management platform;
[0136] Based on the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, the first target parameter is converted to obtain the second target parameter.
[0137] In this embodiment, by adopting the Nacos service management platform to implement the configuration management and service management functions of the conversion configuration rules, the configuration efficiency of the conversion method can be effectively improved and the reliability of the configuration-related codes can be guaranteed.
[0138] It should be added that, in addition to being specifically stored in Nacos, the above conversion configuration rules can also be stored in a database or configuration file, etc., and this embodiment does not impose strict restrictions on this.
[0139] In order to facilitate understanding of the parameter conversion method provided in the above embodiment, the above method is described below using a specific scenario embodiment. Figure 2 A schematic diagram of a scenario implementation flow of a parameter conversion method provided in one embodiment of the present application.
[0140] In this scenario embodiment, the conversion configuration conversion rules are adjusted in advance, and the following process is mainly carried out for the conversion process of the parameters. This scenario embodiment may specifically include the following steps:
[0141] Step 1. The code calls the conversion entry method to start the parameter conversion process. A parameter conversion request is received, and the parameter conversion request may include a first target parameter and a target field, and the target field is used to indicate that the business classification of the first target parameter is a target business type.
[0142] Step 2. First determine whether the method input parameter is empty, that is, whether the first target parameter is empty. If it is empty, the process ends.
[0143] Step 3. Get the global configuration from nacos. The global configuration can be regarded as the global conversion configuration rule in the above embodiment. The global configuration is effective for all requests.
[0144] Step 4. Get the local configuration specific to the request from nacos. The conversion code (target conversion code) may be a URL or a transaction code. Specifically, according to the target business classification of the first target parameter indicated by the target field, determine the target conversion code that has a mapping relationship with the target business type, and obtain the local configuration under the target conversion code, that is, the multiple conversion configuration rules under the target conversion code in the aforementioned embodiment.
[0145] Step 5. Merge the above global configuration and local configuration.
[0146] Step 6: Determine whether the configurations in the global configuration and the local configuration are both empty. If they are empty, the process ends.
[0147] Step 7. Sort the multiple configurations after the global configuration and the local configuration are merged. The configurations are sorted in reverse order, and the configurations with null numbers are placed at the front. The specific sorting can be set according to the actual parameter conversion requirements.
[0148] Step 8. Convert the parameter object to JSONObject, that is, in the above embodiment: use JSONObject as the conversion parameter object to convert the basic data type of the first target parameter from the first data type to the second data type.
[0149] Here, JSONObject can be an object in the hutool dependency library, for example. JSONObject can use the property path to obtain the value, which is convenient for converting parameters later to obtain the value of the specified property.
[0150] Step 9. According to the aforementioned sorting of the multiple configurations, start looping execution of the configurations. Since there are multiple conversion configurations, the multiple conversion configurations can be regarded as an array for array looping.
[0151] Step 10: Parse the conversion configuration and process the fields corresponding to the first target parameters to obtain the second target parameters.
[0152] Step 11. After all conversion configurations are processed, the second target parameter is converted from JSONObject to an object of the Class type of the input parameter.
[0153] In the embodiment of this scenario, by separating the change points of the conversion parameters from the code to the conversion type and / or conversion parameters of the conversion configuration rules, the real-time effectiveness of the configuration changes of the parameter conversion method can be achieved by simply modifying the conversion type and / or conversion parameters in the configuration rules, so that the modification requirements of the parameter conversion method can be completed without modifying the code or deploying tests.
[0154] In summary, by adopting the parameter conversion device provided in the embodiment of the present application, the configuration modification and parameter conversion of the parameter conversion method can be implemented more efficiently and flexibly, thereby effectively improving the overall parameter conversion efficiency under different business requirements and improving the business processing work efficiency.
[0155] Based on the parameter conversion method provided in the above embodiment, out of the same inventive concept, the present application also provides a parameter conversion device corresponding to the above parameter conversion method. Figure 3 The parameter conversion device is introduced in detail.
[0156] Figure 3 A schematic diagram of the structure of a parameter conversion device provided in an embodiment of the present application is shown. Figure 3 The parameter conversion device 300 shown includes:
[0157] A first receiving module 310 is used to receive a first target parameter to be converted and a configuration modification instruction corresponding to a target conversion code, wherein a mapping relationship exists between a target service type of the first target parameter and the target conversion code, and the configuration modification instruction is used to instruct to modify a parameter conversion mode defined by the target conversion code from an initial conversion mode to a target conversion mode;
[0158] The first adjustment module 320 is used to adjust the conversion type and / or conversion parameter set by at least one first conversion configuration rule among the N conversion configuration rules corresponding to the target conversion code in response to the configuration modification instruction, so as to obtain a second conversion configuration rule after the configuration modification; wherein each conversion configuration rule among the N conversion configuration rules is set with a corresponding conversion type and conversion parameter, and N is a positive integer;
[0159] The first conversion module 330 is used to convert the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain the second target parameter that conforms to the target conversion method.
[0160] A parameter conversion device provided by an embodiment of the present application receives a first target parameter to be converted and a configuration modification instruction corresponding to a target conversion code by setting a corresponding functional module. The configuration modification instruction is used to modify the parameter conversion mode defined by the target conversion code from an initial conversion mode to a target conversion mode. Then, in response to the configuration modification instruction, the conversion type and / or conversion parameter set by the first conversion configuration rule among the N conversion configuration rules corresponding to the target conversion code is adjusted to obtain a second conversion configuration rule after configuration modification. Then, the first target parameter is converted according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain a second target parameter that conforms to the target conversion mode.
[0161] From the above description, it can be seen that a parameter conversion device of an embodiment of the present application, by receiving a configuration modification instruction corresponding to a target conversion code, thereby adjusting the conversion type and / or conversion parameters set in the conversion configuration rules under the target conversion code, realizes the adjustment of the parameter conversion method defined by the target conversion code, and finally converts the first target parameter based on each conversion configuration rule under the adjusted target conversion code, and the converted second target parameter meets the required target conversion method.
[0162] The embodiment of the present application separates the modification points of the conversion parameters from the code to the conversion type and / or conversion parameters of the conversion configuration rules, thereby realizing the real-time effectiveness of the configuration modification of the parameter conversion mode by simply modifying the conversion type and / or conversion parameters in the configuration rules, so as to achieve the modification requirements of the parameter conversion mode without modifying the code or deploying tests. By adopting the parameter conversion device provided by the embodiment of the present application, the configuration modification and parameter conversion of the parameter conversion mode can be realized more efficiently and flexibly, thereby effectively improving the overall parameter conversion efficiency under different business requirements and improving the efficiency of business processing work.
[0163] According to some embodiments of the present application, optionally, before receiving the first target parameter to be converted and the configuration modification instruction corresponding to the target conversion code, the parameter conversion device may further include:
[0164] A second receiving module may be used to receive a plurality of preset conversion codes and mapping relationships between the plurality of preset conversion codes and a plurality of service classifications, wherein the plurality of preset conversion codes may include a target conversion code, and the plurality of preset conversion codes respectively define different parameter conversion modes;
[0165] Before receiving the first target parameter to be converted and the configuration modification instruction corresponding to the target conversion code, the parameter conversion device may further include:
[0166] A third receiving module may be used to receive a parameter conversion request of a first target parameter, where the parameter conversion request may include the first target parameter and a target field, where the target field is used to indicate that a business classification of the first target parameter is a target business type;
[0167] The first determination module may be configured to determine a target conversion code having a mapping relationship with a target service type based on a mapping relationship between a plurality of preset conversion codes and a plurality of service classifications.
[0168] According to some embodiments of the present application, optionally, before converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain the second target parameter that conforms to the target conversion method, the parameter conversion device may further include:
[0169] A first acquisition module may be used to acquire M types of global conversion configuration rules corresponding to the first target parameter, where M is a positive integer;
[0170] The first conversion module 330 converts the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified to obtain the second target parameter that conforms to the target conversion method, which may include:
[0171] According to the M global conversion configuration rules, the second conversion configuration rule, and the remaining conversion configuration rules that have not been modified in the N conversion configuration rules, the first target parameter is converted to obtain the second target parameter.
[0172] According to some embodiments of the present application, optionally, converting the first target parameter according to the M global conversion configuration rules, the second conversion configuration rule, and the remaining conversion configuration rules in the N conversion configuration rules that have not been modified in configuration to obtain the second target parameter may include:
[0173] The first sorting submodule may be used to sort the M global conversion configuration rules, the second conversion configuration rules, and the remaining conversion configuration rules that have not been modified in the N conversion configuration rules to obtain a configuration execution order of the conversion configuration rules;
[0174] The first configuration submodule can be used to start the loop configuration of the fields in the first target parameter in accordance with the configuration execution order, according to M global conversion configuration rules, the second conversion configuration rule and the remaining conversion configuration rules in the N conversion configuration rules that have not been modified, to obtain the second target parameter.
[0175] According to some embodiments of the present application, optionally, before converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N types of conversion configuration rules that have not been modified, to obtain the second target parameter that conforms to the target conversion method, the parameter conversion device may further include:
[0176] A second conversion module may be used to convert the basic data type of the first target parameter from a first data type to a second data type, the first data type being the initial data type when the first target parameter is input, and the second data type being a data type that is easy for machine parsing;
[0177] After converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain the second target parameter that conforms to the target conversion method, the parameter conversion device may further include:
[0178] The third conversion module can be used to convert the basic data type of the second target parameter from the second data type to the first data type, and output the second target parameter of the second data type.
[0179] According to some embodiments of the present application, optionally, the conversion type may include at least one of an enumeration conversion type, a regular conversion type, a copy conversion type, a constant conversion type, a Bean conversion type, and a Spring expression language Spel conversion type;
[0180] When the conversion type is an enumeration conversion type, the value of the corresponding conversion parameter is configured as the value of the target dictionary;
[0181] When the conversion type is a regular conversion type, one of the corresponding conversion parameters is configured as a regular expression, and the value of the second corresponding conversion parameter is configured as the replaced value;
[0182] When the conversion type is a copy conversion type, the value of the corresponding conversion parameter is configured as the copy path of the parameter;
[0183] When the conversion type is a constant conversion type, the value of the corresponding conversion parameter is the target constant;
[0184] When the conversion type is Bean conversion type, the value of the corresponding conversion parameter is the name of the Bean;
[0185] In the case where the conversion type is a Spel conversion type, the value of the corresponding conversion parameter is a Spel expression.
[0186] According to some embodiments of the present application, optionally, the first adjustment module 320, in response to the configuration modification instruction, adjusts the conversion type and / or conversion parameter set by at least one first conversion configuration rule among the N conversion configuration rules corresponding to the target conversion code to obtain a second conversion configuration rule after the configuration modification, which may include:
[0187] By calling the interface of at least one conversion class among the conversion parameter conversion class and the conversion type conversion class of the native conversion class, the conversion type and / or conversion parameter set by at least one first conversion configuration rule among the N conversion configuration rules corresponding to the target conversion code are adjusted to obtain a second conversion configuration rule with modified configuration.
[0188] According to some embodiments of the present application, optionally, the first conversion module 330 converts the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain the second target parameter that conforms to the target conversion method, which may include:
[0189] Obtain the second conversion configuration rule and the remaining conversion configuration rules that have not been modified in the N conversion configuration rules from the Nacos service management platform;
[0190] Based on the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, the first target parameter is converted to obtain the second target parameter.
[0191] Based on the parameter conversion method provided in the above embodiment, out of the same inventive concept, the present application also provides a parameter conversion device corresponding to the above parameter conversion method. Figure 4 A detailed introduction to parameter conversion equipment is given.
[0192] See below Figure 4 , Figure 4 It is a structural schematic diagram of a parameter conversion device provided in one embodiment of the present application.
[0193] The parameter conversion device may include a processor 401 and a memory 402 storing computer program instructions.
[0194] Specifically, the processor 401 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0195] Memory 402 may include a large capacity memory for data or instructions. By way of example and not limitation, memory 402 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, memory 402 may include a removable or non-removable (or fixed) medium. In appropriate cases, memory 402 may be inside or outside of an integrated gateway disaster recovery device. In a specific embodiment, memory 402 is a non-volatile solid-state memory.
[0196] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.
[0197] The processor 401 implements any one of the parameter conversion methods in the above embodiments by reading and executing computer program instructions stored in the memory 402 .
[0198] In one example, the data parameter conversion device may further include a communication interface 403 and a bus 410. Figure 4As shown, the processor 401, the memory 402, and the communication interface 403 are connected via a bus 410 and communicate with each other.
[0199] The communication interface 403 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0200] Bus 410 includes hardware, software or both, and the parts of parameter conversion equipment are coupled to each other.For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 410 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.
[0201] The parameter conversion device executes the parameter conversion method in the embodiment of the present application, thereby realizing the parameter conversion method described in the embodiment of the present application.
[0202] In addition, in combination with the parameter conversion method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the parameter conversion methods in the above embodiment is implemented.
[0203] Based on the parameter conversion method in the above embodiment, an embodiment of the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the parameter conversion method provided in any one of the above embodiments of the present application.
[0204] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0205] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0206] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0207] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0208] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A parameter conversion method, characterized in that: The method comprises: Receive a first target parameter to be converted and a configuration modification instruction corresponding to a target conversion code, wherein a mapping relationship exists between a target service type of the first target parameter and the target conversion code, and the configuration modification instruction is used to instruct to modify a parameter conversion mode defined by the target conversion code from an initial conversion mode to a target conversion mode; In response to the configuration modification instruction, a conversion type and / or conversion parameter set by at least one first conversion configuration rule among the N conversion configuration rules corresponding to the target conversion code is adjusted to obtain a second conversion configuration rule after configuration modification; wherein each conversion configuration rule among the N conversion configuration rules is set with a corresponding conversion type and conversion parameter, and N is a positive integer; The first target parameter is converted according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain a second target parameter that conforms to the target conversion method.
2. The method according to claim 1, characterized in that Before receiving the first target parameter to be converted and the configuration modification instruction corresponding to the target conversion code, the method further includes: receiving a plurality of preset conversion codes and mapping relationships between the plurality of preset conversion codes and a plurality of service classifications, the plurality of preset conversion codes including the target conversion code, the plurality of preset conversion codes respectively defining different parameter conversion modes; Before receiving the first target parameter to be converted and the configuration modification instruction corresponding to the target conversion code, the method further includes: receiving a parameter conversion request of the first target parameter, the parameter conversion request including the first target parameter and a target field, the target field being used to indicate that a business classification of the first target parameter is the target business type; Based on the mapping relationships between the plurality of preset conversion codes and a plurality of service classifications, the target conversion code having a mapping relationship with the target service type is determined.
3. The method according to claim 1, characterized in that Before converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified to obtain the second target parameter that conforms to the target conversion mode, the method further includes: Obtain M types of global conversion configuration rules corresponding to the first target parameter, where M is a positive integer; The converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified to obtain the second target parameter that conforms to the target conversion method includes: According to the M types of global conversion configuration rules, the second conversion configuration rules, and the remaining conversion configuration rules of the N types of conversion configuration rules that have not been modified, the first target parameter is converted to obtain the second target parameter.
4. The method according to claim 3, characterized in that The converting the first target parameter according to the M types of global conversion configuration rules, the second conversion configuration rule, and the remaining conversion configuration rules of the N types of conversion configuration rules that have not been modified, to obtain the second target parameter, includes: Sorting the M types of global conversion configuration rules, the second conversion configuration rules, and the remaining conversion configuration rules of the N types of conversion configuration rules that have not been modified, to obtain a configuration execution order of the conversion configuration rules; According to the configuration execution order, based on the M types of global conversion configuration rules, the second conversion configuration rules and the remaining conversion configuration rules of the N types of conversion configuration rules that have not been modified, start the loop configuration of the fields in the first target parameter to obtain the second target parameter.
5. The method according to claim 1, characterized in that Before converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain a second target parameter that conforms to the target conversion method, the method further includes: Convert the basic data type of the first target parameter from a first data type to a second data type, where the first data type is the initial data type when the first target parameter is input, and the second data type is a data type that is easy for machine parsing; After converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, to obtain the second target parameter that conforms to the target conversion mode, the method further includes: The basic data type of the second target parameter is converted from the second data type to the first data type, and the second target parameter of the second data type is output.
6. The method according to claim 1, characterized in that The conversion type includes at least one of an enumeration conversion type, a regular conversion type, a copy conversion type, a constant conversion type, a Bean conversion type, and a Spring expression language Spel conversion type; In the case where the conversion type is the enumeration conversion type, the value of the corresponding conversion parameter is configured as the value of the target dictionary; In the case where the conversion type is the regular conversion type, one of the corresponding conversion parameters is configured as a regular expression, and the value of the second corresponding conversion parameter is configured as a replaced value; In the case where the conversion type is the copy conversion type, the value of the corresponding conversion parameter is configured as a copy path of the parameter; In the case where the conversion type is the constant conversion type, the value of the corresponding conversion parameter is the target constant; In the case where the conversion type is the Bean conversion type, the value of the corresponding conversion parameter is the name of the Bean; In the case where the conversion type is the Spel conversion type, the corresponding value of the conversion parameter is a Spel expression.
7. The method according to any one of claims 1 to 6, characterized in that: The step of adjusting, in response to the configuration modification instruction, a conversion type and / or conversion parameter set by at least one first conversion configuration rule among the N conversion configuration rules corresponding to the target conversion code to obtain a second conversion configuration rule after configuration modification includes: By calling the interface of at least one conversion class among the conversion parameter conversion class and the conversion type conversion class of the native conversion class, the conversion type and / or conversion parameter set by at least one first conversion configuration rule among the N conversion configuration rules corresponding to the target conversion code are adjusted to obtain a second conversion configuration rule after the configuration is modified.
8. The method according to any one of claims 1 to 6, characterized in that: The converting the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified to obtain the second target parameter that conforms to the target conversion method includes: Acquire the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified from the Nacos service management platform; Based on the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, the first target parameter is converted to obtain the second target parameter.
9. A parameter conversion device, characterized in that: The device comprises: A first receiving module is used to receive a first target parameter to be converted and a configuration modification instruction corresponding to a target conversion code, wherein there is a mapping relationship between a target service type of the first target parameter and the target conversion code, and the configuration modification instruction is used to instruct to modify a parameter conversion mode defined by the target conversion code from an initial conversion mode to a target conversion mode; A first adjustment module is used to adjust, in response to the configuration modification instruction, a conversion type and / or conversion parameter set by at least one first conversion configuration rule among the N conversion configuration rules corresponding to the target conversion code, to obtain a second conversion configuration rule after configuration modification; wherein each conversion configuration rule among the N conversion configuration rules is set with a corresponding conversion type and conversion parameter, and N is a positive integer; The first conversion module is used to convert the first target parameter according to the second conversion configuration rule and the remaining conversion configuration rules of the N conversion configuration rules that have not been modified, so as to obtain a second target parameter that conforms to the target conversion method.
10. A parameter conversion device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the parameter conversion method according to any one of claims 1 to 8 is implemented.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the parameter conversion method according to any one of claims 1 to 8 is implemented.
12. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the parameter conversion method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Service execution method and device
CN114648303A
Message conversion method and device based on service type, equipment and storage medium
CN115118777A
Parameter type conversion method and device, storage medium and electronic equipment
CN116483432A
Configuration management task derivation
US20190227814A1
Interface parameter verification and conversion method and apparatus, and device and storage medium
WO2022126966A1