Field assignment method and device
By obtaining and parsing the assignment configuration file and dynamically processing the field assignment logic of financial service messages, the problem of complex and difficult maintenance of field assignment logic in the existing technology is solved, flexible and efficient field assignment is achieved, and the system maintenance is improved. and scalability.
Patent Information
- Application Number
- CN202411198050.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-08-28
AI Technical Summary
In the financial business system, the field assignment logic of financial business messages in the prior art is complex, and the encoding method leads to large code volume and many repetitive codes, which easily generates assignment errors, and it is difficult to maintain and expand the system.
By obtaining the assignment configuration file, parse the configuration items to obtain source and destination field information and conversion functions, dynamically process field assignment logic for different message types, reduce code modification, use configuration files to add configuration items to support different message types, and reduce errors Possibility, improve system maintainability and scalability.
Flexible field assignment is realized, reducing manual intervention, improving the accuracy and efficiency of assignment, reducing code complexity, and enhancing the maintainability and scalability of the system.
Smart Images

Figure CN119211390A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a field assignment method and device. Background Art
[0002] Currently, in financial business systems, during the system business transaction processing initiated by financial business messages, the financial business messages need to be parsed, and the fields in the parsed messages need to be processed and assigned to the transaction form for display, or the fields in the transaction form need to be processed and assigned to the financial business messages.
[0003] In the related art, encoding is usually used to process and assign values to fields. However, when the number of message types increases, the assignment logic of the form fields on the same page will become more, which is prone to problems such as assignment errors. In addition, when the above encoding method is used to process the assignment logic, the encoding workload will increase with the increase in message types, there will be more repetitive codes, and the code quality risk will be higher. Summary of the invention
[0004] The present disclosure provides a field assignment method and device to solve one of the technical problems in the related art at least to a certain extent. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, a field assignment method is provided, comprising: obtaining an assignment configuration file, and reading each configuration item in the assignment configuration file in sequence; parsing the configuration item currently read to obtain source configuration information, destination configuration information and configuration information of a conversion function in the configuration item currently read; wherein the source field indicated by the source configuration information is located in a source object, and the destination field indicated by the destination configuration information is located in a destination object, the source object is one of a business form and a business message, and the destination object is the other of the business form and the business message; determining a field value to be converted according to the source configuration information; calling the conversion function according to the configuration information of the conversion function to convert the field value to be converted to obtain a converted field value; and assigning a destination field in the destination object according to the destination configuration information and the converted field value.
[0006] According to a second aspect of an embodiment of the present disclosure, a field assignment device is provided, comprising: a reading module, used to obtain an assignment configuration file, and read each configuration item in the assignment configuration file in sequence; a parsing module, used to parse the configuration item currently read to obtain source configuration information, destination configuration information and configuration information of a conversion function in the configuration item currently read; wherein the source field indicated by the source configuration information is located in a source object, and the destination field indicated by the destination configuration information is located in a destination object, the source object is one of a business form and a business message, and the destination object is the other of the business form and the business message; a determination module, used to determine a field value to be converted according to the source configuration information; a calling module, used to call the conversion function according to the configuration information of the conversion function, so as to convert the field value to be converted and obtain the converted field value; an assignment module, used to assign a destination field in the destination object according to the destination configuration information and the converted field value.
[0007] According to the third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the field assignment method as described in the embodiment of the first aspect of the present disclosure.
[0008] According to the fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute the field assignment method as described in the embodiment of the first aspect of the present disclosure.
[0009] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, including: a computer program, which, when executed by a processor, implements the field assignment method as described in the embodiment of the first aspect of the present disclosure.
[0010] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0011] In the present technical scheme, an assignment configuration file is obtained, and each configuration item in the assignment configuration file is read in sequence; the currently read configuration item is parsed to obtain source configuration information, destination configuration information and configuration information of a conversion function in the currently read configuration item; wherein the source field indicated by the source configuration information is located in the source object, and the destination field indicated by the destination configuration information is located in the destination object; according to the source configuration information, the value of the field to be converted is determined; according to the configuration information of the conversion function, the conversion function is called to convert the value of the field to be converted to obtain the converted field value; according to the destination configuration information and the converted field value, the destination field in the destination object is assigned a value. Thus, by obtaining the assignment configuration file and reading the configuration items therein in sequence, it is possible to achieve the assignment rule of adjusting the field without modifying and recompiling the code for each assignment, dynamically process the field assignment logic of different message types, and according to the source configuration information, destination configuration information and configuration information of the conversion function in the configuration item, it is possible to flexibly select the source object from the source object. The field value is extracted and assigned to the destination object after conversion, thereby improving the flexibility of field assignment; in addition, when the message type increases, it is only necessary to add the corresponding configuration items in the assignment configuration file without modifying and expanding the complex code logic, thereby greatly reducing the possibility of errors and improving the maintainability and scalability of the system; wherein, when determining the field value to be converted according to the source configuration information, by configuring the first configuration field name and / or configuration field value of at least one source field in the source configuration information, and then assigning the destination field based on the field value and / or configuration field value of the first configuration field name, the flexibility of field assignment is improved; in addition, when the second configuration field name of at least one destination field is included in the destination configuration information, the corresponding target field value is automatically identified and matched from the converted field value, and then these destination fields are accurately assigned, thereby improving the degree of automation of data processing, without the need for manual intervention, thereby improving the efficiency and accuracy of field assignment, and further improving the flexibility of field assignment.
[0012] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0014] Figure 1 is a flowchart of a field assignment method shown in the first embodiment of the present disclosure;
[0015] Figure 2 is a flowchart of a field assignment method shown in the second embodiment of the present disclosure;
[0016] Figure 3 is a flowchart of a field assignment method shown in the third embodiment of the present disclosure;
[0017] Figure 4 is a flowchart of a field assignment method shown in the fourth embodiment of the present disclosure;
[0018] Figure 5 is a flowchart of a field assignment method shown in an embodiment of the present disclosure;
[0019] Figure 6 is a schematic diagram of the input-output mapping of the conversion function shown in the embodiment of the present disclosure;
[0020] Figure 7 is a structural diagram of a field assignment device shown in the fifth embodiment of the present disclosure;
[0021] Figure 8 It is a schematic structural diagram of an electronic device shown in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0022] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0024] It should be noted that in the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information are all carried out with the user's consent, and are in compliance with the relevant laws and regulations and do not violate public order and good morals.
[0025] It is important to understand that when manual transaction processing generates financial business messages, directional operations are also required. The current processing method also uses coding. Therefore, it will also lead to problems such as large amount of coding testing, high quality risks, and more repetitive codes.
[0026] In addition, the above encoding method requires multiple repairs when a message is generated in the same business field, or when a problem occurs in the assignment of a business field to the same message field. Multiple modifications are also required when modifying the logic, which is relatively risky.
[0027] The field assignment method and device of the embodiments of the present disclosure are described below with reference to the accompanying drawings.
[0028] Figure 1 It is a flowchart of the field assignment method shown in the first embodiment of the present disclosure.
[0029] like Figure 1 As shown, the field assignment method includes the following steps:
[0030] Step 101, obtain a value assignment configuration file, and read each configuration item in the value assignment configuration file in sequence.
[0031] In order to reduce the coupling between code and fields, as a possible implementation method, when assigning values to fields, the mapping relationship between the fields is configured through the assignment configuration file. As an example, the assignment configuration file is obtained under the specified path, and each configuration item in the assignment configuration file is read in sequence.
[0032] For example, the configuration items in the configuration file are as follows:
[0033] {"fromFields":["CrCustInfo.accNo","CrCustInfo.name","CrCustInfo.addr"],"toFields":["formData.baseData.payeeMsg"],"forwardFunc":"getPayeeMsg"}.
[0034] Step 102: parse the configuration item currently read to obtain source configuration information, destination configuration information, and configuration information of the conversion function in the configuration item currently read.
[0035] Among them, the source field indicated by the source configuration information is located in the source object, the destination field indicated by the destination configuration information is located in the destination object, the source object is one of the business form and the business message, and the destination object is the other of the business form and the business message.
[0036] In order to accurately implement field assignment, as an example, the currently read configuration item is parsed to obtain various configuration information in the currently read configuration item, wherein the configuration information includes but is not limited to: source configuration information, destination configuration information and configuration information of the conversion function.
[0037] For example, taking the currently read configuration item of “{“fromFields”:[“CrCustInfo.accNo”,”CrCustInfo.name”,”CrCustInfo.addr”], “toFields”:[“formData.baseData.payeeMsg”],”forwardFunc”:”getP ayeeMsg”}” as an example, the source configuration information includes: “fromFields”:[“CrCustInfo.accNo”,”CrCustInfo.name”,”CrCustInfo.addr”], the destination configuration information includes: “toFields”:[“formData.baseData.payeeMsg”], and the configuration information of the conversion function includes: “forwardFunc”:”getPayeeMsg”.
[0038] It should be noted that the source field indicated by the source configuration information is located in the source object, and the destination field indicated by the destination configuration information is located in the destination object. As an example, the source object is one of the business form and the business message, and the destination object is the other of the business form and the business message, that is, the source object is a business form or a business message, and the destination object is a business form or a business message, wherein the source object and the destination object are different. For example, when the field value of a field in a business form is assigned to a field in a business message, the source object is the business form and the destination object is the business message; for another example, when the field value of a field in a business message is assigned to a field in a business form, the source object is the business message and the destination object is the business form.
[0039] For example, the source configuration information “fromFields”: [“CrCustInfo.accNo”, “CrCustInfo.name”, “CrCustInfo.add r”], the source fields indicated by the source configuration information are accNo, name and addr, and the source fields accNo, name and addr are located in the source object CrCustInfo; the destination configuration information “toFields”: [“formData.baseData.payeeMsg”], the destination field indicated by the destination configuration information is payeeMsg, and the destination field payeeMsg is located in the destination field formData.baseData.
[0040] Step 103: Determine the field value to be converted according to the source configuration information.
[0041] In order to improve the flexibility and accuracy of field assignment, as a possible implementation method, when assigning a field value, a conversion function is used to convert the field value to be converted, and the field value is assigned based on the converted field value. Therefore, in the source configuration information, the field value to be converted is configured.
[0042] As an example, the field value to be converted is directly configured in the source configuration information, for example, “()” is used in the source configuration information to configure the field value to be converted.
[0043] As another example, in the source configuration information, the path information of the source field is configured, the field value of the source field is read through the path information, and the field value to be converted is determined according to the field value of the source field.
[0044] Step 104: Call the conversion function according to the configuration information of the conversion function to convert the field value to be converted to obtain the converted field value.
[0045] Further, based on the configuration information of the conversion function, the conversion function is determined, the field value to be converted is input into the conversion function, and the conversion function is called, so as to obtain the converted field value output by the conversion function.
[0046] As an example, according to the configuration information of the conversion function, the function path information and identification information of the conversion function to be called are determined; according to the function path information and the identification information, the conversion function is called to convert the field value to be converted; and the converted field value output by the conversion function is received.
[0047] For example, the configuration information of the conversion function is: "forwardFunc":"getPayeeMsg", where the name of the conversion function is "getPayeeMsg", and then, the path information of the conversion function is queried, and the conversion function is called according to the path information and the function name, that is, the conversion function is used to convert the field value to be converted, and the converted field value output by the conversion function is obtained.
[0048] Step 105: assign a value to the destination field in the destination object according to the destination configuration information and the converted field value.
[0049] In order to accurately assign field values, as an example, the destination field is determined according to the destination configuration information, and the converted field value is assigned to the destination field.
[0050] It should be noted that when the conversion function outputs the converted field value, it also outputs the destination field corresponding to each converted field value. Therefore, the converted field value can be accurately assigned to the corresponding destination field.
[0051] In addition, it should be noted that the number of converted field values and the number of destination fields may be the same or different. When the destination field does not need to be assigned a value, "_" can be used in the destination configuration information for configuration, which means that the corresponding field does not need to be assigned a value. In addition, the conversion function is a reusable function. When assigning a value to a field, if the required conversion function is not found in the existing conversion function, the required conversion function needs to be rewritten.
[0052] In summary, by obtaining the assignment configuration file and reading the configuration items therein in sequence, it is possible to adjust the field assignment rules without having to modify and recompile the code every time an assignment is made, dynamically handle the field assignment logic of different message types, and according to the source configuration information, destination configuration information and conversion function configuration information in the configuration item, flexibly extract field values from the source object and assign them to the destination object after conversion, thereby improving the flexibility of field assignment; in addition, when the message types increase, it is only necessary to add the corresponding configuration items to the assignment configuration file without modifying and expanding the complex code logic, thereby greatly reducing the possibility of errors and improving the maintainability and scalability of the system.
[0053] In order to clearly illustrate how the above embodiment determines the field value to be converted according to the source configuration information, the present disclosure proposes another field value assignment method.
[0054] Figure 2 It is a flowchart of the field assignment method shown in the second embodiment of the present disclosure.
[0055] like Figure 2 As shown, the field assignment method includes the following steps:
[0056] Step 201, obtain the value assignment configuration file, and read each configuration item in the value assignment configuration file in sequence.
[0057] Step 202: parse the currently read configuration item to obtain source configuration information, destination configuration information, and configuration information of the conversion function in the currently read configuration item.
[0058] Among them, the source field indicated by the source configuration information is located in the source object, the destination field indicated by the destination configuration information is located in the destination object, the source object is one of the business form and the business message, and the destination object is the other of the business form and the business message.
[0059] Step 203: In response to the source configuration information including at least one first configuration field name of a source field, source path information of the at least one first configuration field name is determined from the source configuration information.
[0060] In order to improve the flexibility of field assignment, as a possible implementation manner, the first configuration field name of the source field and / or the configuration field value of the source field are configured in the source configuration information.
[0061] As an example, the source configuration information includes the first configuration field name of at least one source field, such as, the source configuration information "fromFields": ["CrCustInfo.accNo", "CrCustInfo.name", "CrCustInfo.addr"], the first configuration field name of at least one source field includes: accNo, name and addr, and then, from the source configuration information, the path information of the first configuration field name can be determined, that is, the source path information of the first configuration field name, such as, accNo, name and addr are located in CrCustInfo.
[0062] Step 204: for any first configuration field name, obtain a field value matching any first configuration field name according to the source path information of any first configuration field name.
[0063] In order to accurately obtain the field value corresponding to each first configuration field name, as an example, the source path information of each first configuration field name is retrieved, and the field value matching each first configuration field name is extracted.
[0064] Step 205: Determine the field value to be converted according to the field value matching each first configuration field name.
[0065] In order to improve the accuracy of data conversion, based on the conversion function, the field values that need to be converted are accurately selected or identified from the field values corresponding to each first configuration field name. These field values are the field values to be converted.
[0066] As an example, for any input item of at least one input item of the conversion function, determine whether the value of any input item is allowed to be empty; in response to the value of any input item not being allowed to be empty, determine whether the field value of the source field matching any input item is empty; wherein the first configuration field name of the matching source field corresponds to any input item; in response to the field value of the matching source field being not empty, use the field value of the matching source field as the field value to be converted.
[0067] That is to say, when selecting or identifying the field value to be converted from the field values corresponding to each first configuration field name, it is necessary to determine whether there is an input item that is allowed to be empty in at least one input item of the conversion function, and the input item in the conversion function is not allowed to be empty and the field value matched by the first configuration field name corresponding to the input item is not empty, and the field value matched by the first configuration field name corresponding to the input item is used as the field value to be converted. It should be noted that each input item has a corresponding input flag bit, such as, if the input flag is skipInputNull and the value is 1, it means that the input item in the conversion function is allowed to be empty; for another example, if the input flag is skipInputNull and the value is 0, it means that the input item in the conversion function is not allowed to be empty.
[0068] As another example, in response to the value of any input item being allowed to be empty, the field value of the matching source field is used as the field value to be converted.
[0069] That is to say, when the input item in the conversion function is allowed to be empty and the input skip is no, the field value of the source field that matches the input item is directly input into the conversion function as the field value to be converted.
[0070] As another example, in response to the fact that the value of any input item is not allowed to be empty and the field value of the matching source field is empty, the assignment of the destination field corresponding to any input item is terminated.
[0071] That is to say, if the input item in the conversion function is not allowed to be empty, and the field value of the matching source field is empty, the assignment of the destination field corresponding to the input item is terminated.
[0072] Step 206: Call the conversion function according to the configuration information of the conversion function to convert the field value to be converted to obtain the converted field value.
[0073] Step 207: assign a value to the destination field in the destination object according to the destination configuration information and the converted field value.
[0074] It should be noted that the execution process of steps 201 to 202 and steps 206 to 207 can be implemented in any way in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.
[0075] In summary, in response to the first configuration field name of at least one source field included in the source configuration information, the source path information of at least one first configuration field name is determined from the source configuration information; for any first configuration field name, the field value matching any first configuration field name is obtained according to the source path information of any first configuration field name; and the field value to be converted is determined according to the field value matching each first configuration field name. Thus, when the first configuration field name of the source field is included in the source configuration information, by determining the source path information of each field, the field value matching the first configuration field name is efficiently and accurately obtained.
[0076] In order to clearly explain how to determine the field value to be converted according to the source configuration information in the above embodiment, the present disclosure proposes another field value assignment method.
[0077] Figure 3 It is a flowchart of the field assignment method shown in the third embodiment of the present disclosure.
[0078] like Figure 3 As shown, the field assignment method includes the following steps:
[0079] Step 301, obtain the value assignment configuration file, and read each configuration item in the value assignment configuration file in sequence.
[0080] Step 302: parse the currently read configuration item to obtain source configuration information, destination configuration information, and configuration information of the conversion function in the currently read configuration item.
[0081] Among them, the source field indicated by the source configuration information is located in the source object, the destination field indicated by the destination configuration information is located in the destination object, the source object is one of the business form and the business message, and the destination object is the other of the business form and the business message.
[0082] Step 303: In response to the source configuration information including the configuration field value of at least one source field, obtaining the configuration field value of at least one source field from the source configuration information.
[0083] In order to improve the flexibility of field assignment, as an example, a configuration field value of at least one source field is configured in the source configuration information.
[0084] For example, “()” is used to wrap the configuration field value, such as the source configuration information “fromFields”: [“(01102)”, (01103)”, (01104)”], where “01102”, “01103” and “01104” are all configuration field values.
[0085] Step 304: Use the configured field value of at least one source field as the field value to be converted.
[0086] In order to improve the efficiency of field assignment, as an example, the configuration field value of at least one source field is directly used as the field value to be converted.
[0087] Step 305: Call the conversion function according to the configuration information of the conversion function to convert the field value to be converted to obtain the converted field value.
[0088] Step 306: assign a value to the destination field in the destination object according to the destination configuration information and the converted field value.
[0089] It should be noted that the execution process of steps 301 to 302 and steps 305 to 306 can be implemented in any way in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be repeated.
[0090] In summary, by responding to the configuration field value of at least one source field included in the source configuration information, the configuration field value of at least one source field is obtained from the source configuration information; the configuration field value of at least one source field is used as the field value to be converted, thereby, the configuration field value of at least one source field included in the source configuration information is directly obtained from the source configuration information, and it is used as the field value to be converted, without the need for additional conversion or calculation steps, thereby improving the efficiency of field assignment.
[0091] In order to clearly explain how to assign values to destination fields in a destination object according to destination configuration information and converted field values in the above embodiment, the present disclosure proposes another field assignment method.
[0092] Figure 4 It is a flowchart of the field assignment method shown in the fourth embodiment of the present disclosure.
[0093] like Figure 4 As shown, the field assignment method includes the following steps:
[0094] Step 401, obtain the value assignment configuration file, and read each configuration item in the value assignment configuration file in sequence.
[0095] Step 402: parse the currently read configuration item to obtain source configuration information, destination configuration information, and configuration information of the conversion function in the currently read configuration item.
[0096] Among them, the source field indicated by the source configuration information is located in the source object, the destination field indicated by the destination configuration information is located in the destination object, the source object is one of the business form and the business message, and the destination object is the other of the business form and the business message.
[0097] Step 403: Determine the field value to be converted according to the source configuration information.
[0098] Step 404: Call the conversion function according to the configuration information of the conversion function to convert the field value to be converted to obtain the converted field value.
[0099] Step 405: In response to the destination configuration information including at least one second configuration field name of the destination field, determine a target field value matching the at least one second configuration field name from the converted field values.
[0100] In order to improve the accuracy of field assignment, as an example, at least one configuration field name of the destination field to be assigned is configured in the destination configuration information, that is, the second configuration field name of at least one second destination field, and the target field value matching the at least one second configuration field name is determined from the converted field value. It should be noted that when the conversion function converts and outputs the field to be converted, it not only outputs the converted field value, but also outputs the field name corresponding to the converted field value. When the field name corresponding to the converted field value is consistent with the second configuration field name, it means that the converted field value matches the second configuration field name.
[0101] Step 406: assign a value to at least one destination field according to a target field value that matches at least one second configuration field name.
[0102] In order to improve the accuracy and flexibility of field assignment, as a possible implementation manner, different assignment strategies are used to assign values to the destination field according to the number of target field values that match the second configuration field name.
[0103] As an example, in response to the destination configuration information including a second configuration field name of a destination field, a target field value matching the second configuration field name is determined from the converted field value; in response to the field value of a destination field not being allowed to be empty, it is determined whether the target field value matching the second configuration field name is empty; in response to the target field value matching the second configuration field name being not empty, the target field value matching the second configuration field name of a destination field is used to assign a value to a destination field.
[0104] That is to say, only one second configuration field name of a destination field is configured in the destination configuration information. Therefore, the target field value that matches the second configuration field name is determined from the converted field value, and then, it is judged whether the field value of the destination field configured in the destination configuration information is allowed to be empty. If the field value of the destination field configured in the destination configuration information is not allowed to be empty, it is judged whether the target field value that matches the second configuration field name is empty. When the target field value that matches the second configuration field name is not empty, the target field value that matches the second configuration field name of one destination field is used to assign a value to the one destination field.
[0105] As another example, in response to the destination configuration information including a second configuration field name of multiple destination fields, the multiple second configuration field names are split out from the destination path of the destination configuration information; the target field values matching the multiple second configuration field names are determined from the converted field values; for any of the multiple destination fields, in response to the field value of any of the destination fields not being allowed to be empty, it is determined whether the target field value matching the second configuration field name of any of the destination fields is empty; in response to the target field value matching the second configuration field name of any of the destination fields being not empty, the target field value matching the second configuration field name of any of the destination fields is used to assign a value to any of the destination fields.
[0106] That is to say, when the destination configuration information includes multiple second configuration field names of the destination fields, for example, the destination configuration information is ""toFields":["formData.baseData.remitCcy1#formData.baseData.remitCcy2"]", then, multiple second configuration field names are split out from the target path of the destination configuration information "formData.baseData.remitCcy1#formData.baseData.re mitCcy2", that is, split with "#" to obtain multiple second configuration field names formData.baseData.remitCcy1 and formData.baseData.remitCcy2, and then, from the converted field values, determine the target field values that match formData.baseData.remitCcy1 and formData.baseData.remitCcy2, for any destination field to which the second configuration field name belongs, determine whether the field value of the destination field is allowed to be empty according to the destination configuration information, for example, for the destination field configuration output item "ski pOutputNull", when the value of "skipOutputNull" is 1, it indicates that the field value of the destination field is not allowed to be empty. When the value of "skipOutputNull" is 0, it indicates that the field value of the destination field is allowed to be empty. As an example, when the field value of the destination field is not allowed to be empty, determine whether the target field value matching the second configuration field name of the destination field is empty. When the target field value matching the second configuration field name of the destination field is not empty, the target field value matching the second configuration field name of the destination field is used to assign a value to the destination field. As another example, when the field value of the destination field is allowed to be empty, no value is assigned to the destination field.
[0107] It should be noted that the execution process of steps 401 to 404 can be implemented in any manner in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.
[0108] In summary, in response to the second configuration field name of at least one destination field included in the destination configuration information, a target field value matching the at least one second configuration field name is determined from the converted field value; and at least one destination field is assigned a value based on the target field value matching the at least one second configuration field name. Thus, when the second configuration field name of at least one destination field is included in the destination configuration information, the corresponding target field value is automatically identified and matched from the converted field value, and then these destination fields are accurately assigned values, thereby improving the degree of automation in data processing, eliminating the need for manual intervention, thereby improving the efficiency and accuracy of field assignment, and at the same time improving the flexibility of field assignment.
[0109] Based on any embodiment of the present disclosure, Figure 5 As shown, the field assignment method of the embodiment of the present disclosure can also be implemented based on the following steps:
[0110] 1. Read the corresponding mapping configuration from the assignment configuration file (read from form to message or message to form in different scenarios), and traverse each minimum unit to perform mapping assignment processing;
[0111] That is, each configuration item in the assignment configuration file is read in sequence, and the currently read configuration item is parsed to obtain the source configuration information, the destination configuration information, and the configuration information of the conversion function in the currently read configuration item;
[0112] It should be noted that the structure of each configuration item is shown in Table 1.
[0113] Table 1 Structural configuration table of each configuration item
[0114]
[0115]
[0116] Among them, 1. Definition of fromFields item:
[0117] 1) If you need to get a value from the source object or the destination object, just configure the corresponding path, for example, "for mData.baseData.remitCcy";
[0118] 2) If the value is passed directly, use parentheses () to wrap the value, for example (Y)
[0119] 3) Array values can be obtained using Python slices, for example, "f71F[0].currency"
[0120] 2. Definition of toFields
[0121] 1) If you need to get a value from the source object or the destination object, just configure the corresponding path, for example, "for mData.baseData.remitCcy";
[0122] 2) If no value is required, use "_" instead;
[0123] 3) Array values can be assigned using Python slice assignment, such as "f71F[0].currency";
[0124] 4) If multiple attributes with the same value are assigned, use the "#" sign to separate them, for example "f32A.currency#f32B.currency";
[0125] 3. Definition of forwardFunc
[0126] The forwardFunc conversion method (conversion function) has an array of input and output parameters, which are used to uniformly receive the value of the source field and the value of the output field. If it is a one-to-one mapping assignment, the configuration can be omitted, such as Figure 6 As shown, if it is many-to-many, you can write the implementation logic of the method through the extended interface, and then call it when obtaining the value;
[0127] 4. Definition of skipInputNull item
[0128] No mapping is done when the input is empty;
[0129] 5. Definition of skipOutputNull
[0130] No mapping is done when the output is empty;
[0131] 2. Read the input configuration of each minimum mapping unit (configuration items in the assignment configuration file), enter by passing the form and message object, and obtain and calculate the corresponding specific value through the configuration of each input item;
[0132] 3. Calculate the input value by calling the conversion method (conversion function) to obtain the output value (converted field value);
[0133] 4. Read the output configuration of each minimum mapping unit, process the output path according to the corresponding rules, and map the values generated in the previous step to the positions of the corresponding values one by one in order; that is, assign the destination field in the destination object according to the destination configuration information and the converted field value;
[0134] 5. Through the above logic, the assignment of fields is finally completed (it can be from form field to message field or from message field to form field);
[0135] In the embodiments of the present disclosure, in the above assignment logic scenarios, one-to-one mapping scenarios are the majority, so during the assignment process, it is only necessary to configure the paths one by one according to the corresponding configuration, which greatly reduces the development workload, and the subsequent maintenance can also intuitively see the assignment logic between the fields. At the same time, the data conversion and processing methods can also be shared. For example, it is necessary to assign customer-related information to the page form according to a customer account field in the message, which corresponds to a one-to-many scenario. The implementation logic is to pass in the account to query the corresponding customer information and then return the customer's relevant information. The destination path values can be mapped one by one in order. When multiple types of message types need to bring out customer information to the transaction form, they can be directly reused, which greatly improves the development efficiency.
[0136] Corresponding to the field assignment method provided in the above embodiment, the present disclosure also provides a field assignment device. Since the field assignment device provided in the embodiment of the present disclosure corresponds to the field assignment method provided in the above embodiment, the implementation method of the field assignment method is also applicable to the field assignment device provided in the embodiment of the present disclosure, and will not be described in detail in the embodiment of the present disclosure.
[0137] Figure 7 It is a structural diagram of a field assignment device shown in the fifth embodiment of the present disclosure.
[0138] like Figure 7 As shown, the field assignment device 700 includes: a reading module 710, a parsing module 720, a determining module 730, a calling module 740 and an assignment module 750.
[0139] Among them, the reading module 710 is used to obtain the assignment configuration file and read each configuration item in the assignment configuration file in turn; the parsing module 720 is used to parse the configuration item currently read to obtain the source configuration information, the destination configuration information and the configuration information of the conversion function in the configuration item currently read; wherein the source field indicated by the source configuration information is located in the source object, and the destination field indicated by the destination configuration information is located in the destination object, the source object is one of the business form and the business message, and the destination object is the other of the business form and the business message; the determination module 730 is used to determine the field value to be converted according to the source configuration information; the calling module 740 is used to call the conversion function according to the configuration information of the conversion function to convert the field value to be converted and obtain the converted field value; the assignment module 750 is used to assign the destination field in the destination object according to the destination configuration information and the converted field value.
[0140] As a possible implementation method of an embodiment of the present disclosure, a determination module 730 is used to determine, in response to a first configuration field name including at least one source field in the source configuration information, source path information of at least one first configuration field name from the source configuration information; for any first configuration field name, obtain a field value matching any first configuration field name according to the source path information of any first configuration field name; and determine a field value to be converted according to the field value matching each first configuration field name.
[0141] As a possible implementation method of an embodiment of the present disclosure, a determination module 730 is used to determine whether the value of any input item of at least one input item of a conversion function is allowed to be empty; in response to the value of any input item not being allowed to be empty, determine whether the field value of a source field matching any input item is empty; wherein the first configuration field name of the matching source field corresponds to the any input item; in response to the field value of the matching source field not being empty, use the field value of the matching source field as the field value to be converted.
[0142] As a possible implementation method of the embodiment of the present disclosure, the determination module 730 is also used to, in response to the value of any input item being allowed to be empty, use the field value of the matching source field as the field value to be converted; in response to the value of any input item not being allowed to be empty and the field value of the matching source field being empty, end the assignment of the destination field corresponding to any input item.
[0143] As a possible implementation method of the embodiment of the present disclosure, the determination module 730 is used to obtain the configuration field value of at least one source field from the source configuration information in response to the configuration field value of at least one source field included in the source configuration information; and use the configuration field value of at least one source field as the field value to be converted.
[0144] As a possible implementation method of the embodiment of the present disclosure, the assignment module 750 is used to determine, in response to a second configuration field name including at least one destination field in the destination configuration information, a target field value matching the at least one second configuration field name from the converted field value; and assign a value to the at least one destination field according to the target field value matching the at least one second configuration field name.
[0145] As a possible implementation method of the embodiment of the present disclosure, the assignment module 750 is used to, in response to the second configuration field name of a destination field included in the destination configuration information, determine the target field value matching the second configuration field name from the converted field value; in response to the field value of a destination field not being allowed to be empty, determine whether the target field value matching the second configuration field name is empty; in response to the target field value matching the second configuration field name not being empty, use the target field value matching the second configuration field name of a destination field to assign a value to a destination field.
[0146] As a possible implementation method of the embodiment of the present disclosure, the assignment module 750 is used to, in response to the second configuration field name including multiple destination fields in the destination configuration information, split out multiple second configuration field names from the target path of the destination configuration information; determine the target field value matching the multiple second configuration field names from the converted field value; for any destination field among the multiple destination fields, in response to the field value of any destination field not being allowed to be empty, determine whether the target field value matching the second configuration field name of any destination field is empty; in response to the target field value matching the second configuration field name of any destination field being not empty, use the target field value matching the second configuration field name of any destination field to assign a value to any destination field.
[0147] As a possible implementation method of the embodiment of the present disclosure, the calling module 740 is used to determine the function path information and identification information of the conversion function to be called according to the configuration information of the conversion function; call the conversion function according to the function path information and the identification information to convert the field value to be converted; and receive the converted field value output by the conversion function.
[0148] The field assignment device of the embodiment of the present disclosure, by acquiring an assignment configuration file and reading the configuration items therein in sequence, realizes the need to adjust the field assignment rules without modifying and recompiling the code for each assignment, dynamically handles the field assignment logic of different message types, and according to the source configuration information, destination configuration information and configuration information of the conversion function in the configuration items, realizes the flexible extraction of field values from the source object and the assignment to the destination object after conversion, thereby improving the flexibility of field assignment; in addition, when the message types increase, it is only necessary to add the corresponding configuration items to the configuration file without modifying and expanding the complex code logic, thereby greatly reducing the possibility of errors and improving the maintainability and scalability of the system.
[0149] In an exemplary embodiment, an electronic device is also provided.
[0150] Among them, electronic equipment includes:
[0151] processor;
[0152] a memory for storing processor-executable instructions;
[0153] The processor is configured to execute instructions to implement the field assignment method proposed in any of the aforementioned embodiments.
[0154] As an example, Figure 8 is a schematic diagram of the structure of an electronic device 800 shown in an exemplary embodiment of the present disclosure, such as Figure 8 As shown, the electronic device 800 may further include:
[0155] The memory 810 and the processor 820, a bus 830 connecting different components (including the memory 810 and the processor 820), the memory 810 stores a computer program, and when the processor 820 executes the program, the field assignment method described in the embodiment of the present disclosure is implemented.
[0156] Bus 830 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.
[0157] The electronic device 800 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by the electronic device 800, including volatile and non-volatile media, removable and non-removable media.
[0158] The memory 810 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 840 and / or cache memory 850. The server 800 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 860 may be used to read and write non-removable, non-volatile magnetic media ( Figure 8 not shown, usually called a "hard drive"). Although Figure 8 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 830 via one or more data medium interfaces. The memory 810 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.
[0159] A program / utility 880 having a set (at least one) of program modules 870 may be stored, for example, in the memory 810, such program modules 870 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 870 generally perform the functions and / or methods of the embodiments described in the present disclosure.
[0160] The electronic device 800 may also communicate with one or more external devices 890 (e.g., keyboard, pointing device, display 891, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 800, and / or may communicate with any device that enables the electronic device 800 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed via an input / output (I / O) interface 892. Furthermore, the electronic device 800 may also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and / or public network, such as the Internet) via a network adapter 893. As shown, the network adapter 893 communicates with other modules of the electronic device 800 via a bus 830. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0161] The processor 820 executes various functional applications and data processing by running the programs stored in the memory 810 .
[0162] It should be noted that the implementation process and technical principles of the electronic device of this embodiment refer to the aforementioned explanation of the field assignment method of the embodiment of the present disclosure, and will not be repeated here.
[0163] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the above instructions can be executed by a processor of an electronic device to complete the field assignment method proposed in any of the above embodiments. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0164] In an exemplary embodiment, a computer program product is also provided, including a computer program / instruction, characterized in that when the computer program / instruction is executed by a processor, the field assignment method proposed in any of the above embodiments is implemented.
[0165] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0166] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A field assignment method, characterized in that: include: Obtaining a configuration file, and reading each configuration item in the configuration file in sequence; Parsing the currently read configuration item to obtain source configuration information, destination configuration information, and configuration information of the conversion function in the currently read configuration item; wherein the source field indicated by the source configuration information is located in a source object, the destination field indicated by the destination configuration information is located in a destination object, the source object is one of a business form and a business message, and the destination object is the other of the business form and the business message; Determine the field value to be converted according to the source configuration information; According to the configuration information of the conversion function, the conversion function is called to convert the field value to be converted to obtain the converted field value; The destination field in the destination object is assigned a value according to the destination configuration information and the converted field value.
2. The method according to claim 1, characterized in that The step of determining the field value to be converted according to the source configuration information includes: In response to the source configuration information including at least one first configuration field name of the source field, determining source path information of at least one first configuration field name from the source configuration information; For any first configuration field name, obtaining a field value matching any first configuration field name according to source path information of the any first configuration field name; The field value to be converted is determined according to the field value matching each of the first configuration field names.
3. The method according to claim 2, characterized in that The step of determining the to-be-converted field value according to the field value matching each of the first configuration field names includes: For any input item of the at least one input item of the conversion function, determine whether a value of the any input item is allowed to be empty; In response to the value of any one of the input items not being allowed to be empty, determining whether the field value of the source field matching the any one of the input items is empty; wherein the first configuration field name of the matching source field corresponds to the any one of the input items; In response to the field value of the matched source field being not empty, the field value of the matched source field is used as the field value to be converted.
4. The method according to claim 3, characterized in that The method further comprises: In response to the value of any of the input items being allowed to be empty, taking the field value of the matched source field as the field value to be converted; In response to the fact that the value of any one of the input items is not allowed to be empty, and the field value of the matched source field is empty, the assignment of the value to the destination field corresponding to the any one of the input items is terminated.
5. The method according to claim 1, characterized in that The step of determining the field value to be converted according to the source configuration information includes: In response to the source configuration information including a configuration field value of at least one of the source fields, acquiring the configuration field value of at least one of the source fields from the source configuration information; The configuration field value of at least one of the source fields is used as the field value to be converted.
6. The method according to claim 1, characterized in that The assigning a value to a destination field in the destination object according to the destination configuration information and the converted field value includes: In response to the destination configuration information including at least one second configuration field name of the destination field, determining a target field value matching the at least one second configuration field name from the converted field values; According to the target field value matching the at least one second configuration field name, a value is assigned to at least one of the destination fields.
7. The method according to claim 6, characterized in that The assigning a value to at least one of the destination fields according to a target field value matching the at least one second configuration field name comprises: In response to a second configuration field name of a destination field included in the destination configuration information, determining a target field value matching the second configuration field name from the converted field values; In response to the field value of the one destination field not being allowed to be empty, determining whether the target field value matching the second configuration field name is empty; In response to the target field value matching the second configuration field name being not empty, the target field value matching the second configuration field name of the one destination field is adopted to assign a value to the one destination field.
8. The method according to claim 6, characterized in that The assigning a value to at least one of the destination fields according to a target field value matching the at least one second configuration field name comprises: In response to the second configuration field name including a plurality of destination fields in the destination configuration information, splitting a plurality of the second configuration field names from the target path of the destination configuration information; Determine, from the converted field values, target field values that match a plurality of the second configuration field names; For any destination field among the multiple destination fields, in response to the field value of any destination field not being allowed to be empty, determining whether a target field value matching a second configuration field name of any destination field is empty; In response to the target field value matching the second configuration field name of any of the destination fields being not empty, the target field value matching the second configuration field name of any of the destination fields is used to assign a value to any of the destination fields.
9. The method according to claim 1, characterized in that: The step of calling the conversion function according to the configuration information of the conversion function to convert the field value to be converted to obtain the converted field value includes: Determine, according to the configuration information of the conversion function, function path information and identification information of the conversion function to be called; Calling the conversion function according to the function path information and the identification information to convert the field value to be converted; The converted field value output by the conversion function is received.
10. A field assignment device, characterized in that: include: A reading module is used to obtain a value assignment configuration file and read each configuration item in the value assignment configuration file in sequence; A parsing module, used to parse the currently read configuration item to obtain source configuration information, destination configuration information and configuration information of the conversion function in the currently read configuration item; wherein the source field indicated by the source configuration information is located in the source object, the destination field indicated by the destination configuration information is located in the destination object, the source object is one of a business form and a business message, and the destination object is the other of the business form and the business message; A determination module, used to determine the field value to be converted according to the source configuration information; A calling module, used for calling the conversion function according to the configuration information of the conversion function to convert the field value to be converted and obtain the converted field value; An assignment module is used to assign a value to a destination field in the destination object according to the destination configuration information and the converted field value.
Citation Information
Patent Citations
Data caching method and device and electronic equipment
CN113918602A
Field assignment code generation method and device, equipment and storage medium
CN114625348A
Interface field configuration method and device
CN115640064A
Message conversion method and device, equipment and storage medium
CN116436989A
