Field assignment method and apparatus
By acquiring and parsing information from the assignment configuration file and using conversion functions to dynamically process field assignment logic, the problem of complex and error-prone field assignment logic in financial business systems has been solved, achieving flexible and efficient field assignment processing and improving the maintainability and accuracy of the system.
Patent Information
- Application Number
- CN202411198050.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-08-28
AI Technical Summary
In financial business systems, the field assignment logic in existing technologies is complex, prone to errors, and has high code quality risks, making it difficult to flexibly handle field assignment logic for different message types.
By obtaining the assignment configuration file, parsing the configuration items to obtain source configuration information, destination configuration information, and conversion functions, the field assignment logic is dynamically processed. The conversion functions are used to convert and assign field values, reducing code modifications and improving flexibility and accuracy.
This enables the handling of field assignments for different message types without frequent code modifications, reducing the possibility of errors, improving system maintainability and scalability, and enhancing the efficiency and accuracy of field assignments.
Smart Images

Figure CN119211390B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of data processing, and particularly relates to a field assignment method and device. BACKGROUND
[0002] At present, in a financial business system, in a system business transaction processing process initiated by a financial business message, the financial business message needs to be parsed, and fields in the parsed message are processed and assigned to a transaction form for display, or fields in the transaction form are processed and assigned to the financial business message.
[0003] In the related art, the fields are usually processed and assigned by using an encoding mode. However, when the message type increases, the assignment logic of the same page form field will increase, and errors in assignment and the like are prone to occur. Moreover, when the above-mentioned encoding mode is used for assignment logic processing, the coding workload will increase with the increase of the message type, there are more repetitive codes, and the code quality risk is high. SUMMARY
[0004] The present disclosure provides a field assignment method and device to at least partially solve one of the technical problems in the related art. The technical solutions of the present disclosure are as follows.
[0005] According to a first aspect of an embodiment of the present disclosure, a field assignment method is provided, including: obtaining an assignment configuration file, and sequentially reading each configuration item in the assignment configuration file; parsing a currently read configuration item to obtain source configuration information, destination configuration information, and configuration information of a conversion function in the currently read configuration item; wherein a source field indicated by the source configuration information is located in a source object, a 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 the destination field in the destination object according to the destination configuration information and the converted field value.
[0006] According to a second aspect of the embodiments of the present disclosure, a field assignment apparatus is provided, comprising: a reading module configured to acquire an assignment configuration file and read each configuration item in the assignment configuration file in sequence; a parsing module configured to parse a currently read configuration item 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 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 packet, and the destination object is the other of the business form and the business packet; a determining module configured to determine a field value to be converted according to the source configuration information; a calling module configured to call 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 an assignment module configured to assign the destination field in the destination object according to the destination configuration information and the converted field value.
[0007] According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, comprising: a processor; a memory configured to store instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the field assignment method according to the first aspect of the embodiments of the present disclosure.
[0008] According to a fourth aspect of the embodiments 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 according to the first aspect of the embodiments of the present disclosure.
[0009] According to a fifth aspect of the embodiments of the present disclosure, a computer program product is provided, comprising: a computer program, when the computer program is executed by a processor, the field assignment method according to the first aspect of the embodiments of the present disclosure is implemented.
[0010] The technical solutions provided by the embodiments of the present disclosure at least bring the following beneficial effects:
[0011] In the technical solution, the assignment configuration file is acquired, and each configuration item in the assignment configuration file is read in sequence. The current read configuration item is parsed to obtain source configuration information, destination configuration information and configuration information of a conversion function in the current read configuration item. 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 to-be-converted field value is determined according to the source configuration information. The conversion function is called according to the configuration information of the conversion function to convert the to-be-converted field value and obtain a converted field value. The destination field in the destination object is assigned according to the destination configuration information and the converted field value. Thus, by acquiring the assignment configuration file and reading the configuration items in the assignment configuration file in sequence, the assignment rule of the field is adjusted without modifying and recompiling the code each time, the field assignment logic of different message types is dynamically processed, and the field value is flexibly extracted from the source object according to the source configuration information, the destination configuration information and the configuration information of the conversion function in the configuration item, and then assigned to the destination object after conversion, thereby improving the flexibility of field assignment. In addition, when the message type is increased, only the corresponding configuration item needs to be added in the assignment configuration file, without modifying and extending the complex code logic, thereby greatly reducing the possibility of error and improving the maintainability and scalability of the system. When the to-be-converted field value is determined according to the source configuration information, at least one first configuration field name and / or configuration field value of the source field is configured in the source configuration information, and then the destination field is assigned based on the field value of the first configuration field name and / or the configuration field value, thereby improving the flexibility of field assignment. 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 the destination fields are accurately assigned, thereby improving the automation of data processing, without manual intervention, thereby improving the efficiency and accuracy of field assignment, and further improving the flexibility of field assignment.
[0012] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0013] The accompanying drawings incorporated in the specification and forming a part of it, illustrate embodiments consistent with the present disclosure, and together with the description, serve to explain the principles of the present disclosure, and are not intended to limit 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 a third embodiment of the present disclosure.
[0017] Figure 4 is a flowchart of a field assignment method shown in a 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 conversion function input-output mapping diagram shown in an embodiment of the present disclosure.
[0020] Figure 7 is a structural diagram of a field assignment device shown in a fifth embodiment of the present disclosure.
[0021] Figure 8 is a structural diagram of an electronic device shown in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0022] In order for those skilled 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 described clearly and completely 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 do not necessarily describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The implementation described in the following exemplary embodiments does not represent all implementations consistent with the present disclosure. Rather, they are only 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 solutions of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in the technical solutions are carried out on the premise of obtaining the consent of the user, and comply with the relevant legal regulations and do not violate public order and good customs.
[0025] It should be noted that when a manual transaction processing generates a financial service message, directional operations are also required, and the current processing method also uses coding methods, so that the coding test amount is large, the quality risk is high, and there is a lot of repetitive code.
[0026] In addition, the above coding mode needs to be repaired at multiple places when the same service field in the generated message or the same message field is assigned a service field, and multiple modifications are needed when modifying the logic, which is high-risk.
[0027] The field assignment method and device are described below with reference to the accompanying drawings.
[0028] Figure 1 is a flowchart of the field assignment method shown in the first embodiment of the present disclosure.
[0029] As Figure 1 shown, the field assignment method includes the following steps:
[0030] Step 101, obtain the assignment configuration file, and read each configuration item in the assignment configuration file in sequence.
[0031] To reduce the coupling degree between the code and the field, as a possible implementation, the mapping relationship between the fields is configured by the assignment configuration file when the field is assigned. 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 current read configuration item to obtain the source configuration information, destination configuration information, and conversion function configuration information in the current read configuration item.
[0035] Among them, 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.
[0036] To accurately implement field assignment, as an example, the current read configuration item is parsed to obtain each configuration information in the current read configuration item, wherein the configuration information includes but is not limited to: source configuration information, destination configuration information, and conversion function configuration information.
[0037] For example, taking the currently read configuration item as an example: {“fromFields”:[“CrCustInfo.accNo”,”CrCustInfo.name”,” CrCustInfo.addr”], “toFields”:[“formData.baseData.payeeMsg”],”forwardFunc”:”getPayeeMsg”}, 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 the business form or the business message, and the destination object is the business form or the business message. The source object and the destination object are different. For example, when the field value of the field in the business form is assigned to the field in the 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 the field in the business message is assigned to the field in the 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.addr”] indicates the source fields 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”] indicates the destination field payeeMsg, and the destination field payeeMsg is located in the destination field formData.baseData.
[0040] In step 103, the field value to be converted is determined according to the source configuration information.
[0041] To improve the flexibility and accuracy of field assignment, as a possible implementation, in field assignment, the conversion of the field value to be converted is implemented through a conversion function, and field assignment is implemented 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, the configuration of the field value to be converted is implemented through “()” in the source configuration information.
[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] In step 104, the conversion function is called according to the configuration information of the conversion function to convert the field value to be converted, and the converted field value is obtained.
[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 the identification information of the conversion function to be called are determined; the conversion function is called according to the function path information and the identification information 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”, wherein 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] In step 105, the destination field in the destination object is assigned according to the destination configuration information and the converted field value.
[0049] To accurately perform field assignment, 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, so that the converted field value can be accurately assigned to the corresponding destination field.
[0051] In addition, it is also necessary to point out that the number of converted field values and the number of destination fields can be the same or different, and when the destination field does not need to be assigned, the "_" can be configured in the destination configuration information, which means that the corresponding field does not need to be assigned. In addition, the conversion function is a reusable function, and when the required conversion function is not found in the existing conversion function during field assignment, the required conversion function needs to be re-written.
[0052] In summary, by obtaining the assignment configuration file and sequentially reading the configuration items therein, the need to modify and recompile the code to adjust the field assignment rule each time the assignment is performed is eliminated, and the field assignment logic for different message types is dynamically processed. According to the source configuration information, the destination configuration information, and the configuration information of the conversion function in the configuration item, the field values are flexibly extracted from the source object, and after conversion, the field values are assigned to the destination object, thereby improving the flexibility of field assignment. In addition, when the message type is increased, only the corresponding configuration item needs to be added in the assignment configuration file, and the complex code logic does not need to be modified and extended, thereby greatly reducing the possibility of error and improving the maintainability and scalability of the system.
[0053] In order to clearly illustrate how the above-mentioned embodiment determines the field value to be converted according to the source configuration information, the present disclosure proposes another field assignment method.
[0054] Figure 2 is a flowchart of the field assignment method shown in the second embodiment of the present disclosure.
[0055] As Figure 2 shown, the field assignment method includes the following steps:
[0056] Step 201, obtaining an assignment configuration file and sequentially reading each configuration item in the assignment configuration file.
[0057] Step 202, parsing the currently read configuration item to obtain the source configuration information, the destination configuration information, and the 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, 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.
[0059] Step 203, in response to the first configuration field name including at least one source field in the source configuration information, determining the source path information of the at least one first configuration field name from the source configuration information.
[0060] To improve the flexibility of field assignment, as a possible implementation, 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 first configuration field name of at least one source field is included in the source configuration information, such as the source configuration information "fromFields": ["CrCustInfo.accNo", "CrCustInfo.name", "CrCustInfo.addr"], the first configuration field name of the at least one source field includes: accNo, name and addr, and further, from the source configuration information, the path information of the first configuration field name, i.e., the source path information of the first configuration field name, can be determined, such as accNo, name and addr are located in CrCustInfo.
[0062] Step 204, for any first configuration field name, according to the source path information of any first configuration field name, the field value matched with any first configuration field name is obtained.
[0063] 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 searched, and the field value matched with each first configuration field name is extracted.
[0064] Step 205, according to the field value matched with each first configuration field name, the field value to be converted is determined.
[0065] To improve the accuracy of data conversion, based on the conversion function, the field value to be converted is accurately selected or identified from the field value corresponding to each first configuration field name, which is the field value to be converted.
[0066] As an example, for any input item in at least one input item of the conversion function, it is judged 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, it is judged whether the field value of the source field matched with any input item is empty; wherein the first configuration field name of the matched source field corresponds to any input item; in response to the field value of the matched source field not being empty, the field value of the matched source field is taken as the field value to be converted.
[0067] That is, when selecting or identifying the field value that needs to be converted in the field values corresponding to the respective first configuration field names, it is determined whether there is an input item that is allowed to be null in at least one input item of the conversion function. When the input item in the conversion function is not allowed to be null and the field value matched by the first configuration field name corresponding to the input item is also not null, the field value matched by the first configuration field name corresponding to the input item is taken as the field value to be converted. It should be noted that each input item has a corresponding input flag bit. For example, the value of the input flag skipInputNull is 1, indicating that the input item in the conversion function is allowed to be null. For another example, the value of the input flag skipInputNull is 0, indicating that the input item in the conversion function is not allowed to be null.
[0068] As another example, in response to the value of any input item being allowed to be null, the field value of the matched source field is taken as the field value to be converted.
[0069] That is, when the input item in the conversion function is allowed to be null and the input skip is no, the field value of the source field matched by the input item is directly taken as the field value to be converted and input into the conversion function.
[0070] As another example, in response to the value of any input item being allowed to be null, the field value of the matched source field is taken as the field value to be converted.
[0071] That is, when the input item in the conversion function is not allowed to be null and the field value of the matched source field is null, the assignment to the destination field corresponding to the input item is ended.
[0072] Step 206: According to the configuration information of the conversion function, the conversion function is called to convert the field value to be converted, to obtain a converted field value.
[0073] Step 207: According to the destination configuration information and the converted field value, the destination field in the destination object is assigned.
[0074] It should be noted that the execution processes of steps 201 to 202 and steps 206 to 207 can be implemented by any of the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be repeated.
[0075] In summary, by responding to the first configuration field name including at least one source field in the source configuration information, the source path information of the at least one first configuration field name is determined from the source configuration information; for any first configuration field name, the field value matched with the any first configuration field name is obtained according to the source path information of the any first configuration field name; and the to-be-converted field value is determined according to the field value matched with each first configuration field name, thereby realizing efficient and accurate obtaining of the field value matched with the first configuration field name by determining the source path information of each field when the first configuration field name including the source field is in the source configuration information.
[0076] To clearly illustrate how the to-be-converted field value is determined according to the source configuration information in the above embodiment, the disclosure proposes another field assignment method.
[0077] Figure 3 is a flowchart of the field assignment method shown in the third embodiment of the disclosure.
[0078] As Figure 3 shown, the field assignment method includes the following steps:
[0079] Step 301, obtaining an assignment configuration file and reading each configuration item in the assignment configuration file in sequence.
[0080] Step 302, parsing the currently read configuration item to obtain the source configuration information, the destination configuration information and the 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, and 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, obtaining 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.
[0083] To improve the flexibility of field assignment, as an example, the configuration field value of at least one source field is configured in the source configuration information.
[0084] For example, the configuration field value is wrapped by “( )”, such as the source configuration information “fromFields”:[“(01102)”, “(01103)”, “(01104) ”], wherein “01102”, “01103” and “01104” are all configuration field values.
[0085] Step 304, taking the configuration field value of at least one source field as the to-be-converted field value.
[0086] To improve the field assignment efficiency, as an example, the configuration field value of the at least one source field is directly taken as the to-be-converted field value.
[0087] Step 305, according to the configuration information of the conversion function, the conversion function is called to convert the to-be-converted field value to obtain the converted field value.
[0088] Step 306, according to the destination configuration information and the converted field value, the destination field in the destination object is assigned.
[0089] It should be noted that the execution processes of steps 301 to 302 and steps 305 to 306 can be respectively realized by any one of 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 the at least one source field included in the source configuration information, the configuration field value of the at least one source field is obtained from the source configuration information; the configuration field value of the at least one source field is directly taken as the to-be-converted field value, so that the configuration field value of the at least one source field included in the source configuration information is directly obtained from the source configuration information and taken as the to-be-converted field value, without additional conversion or calculation steps, thereby improving the field assignment efficiency.
[0091] In order to clearly illustrate how the destination field in the destination object is assigned according to the destination configuration information and the converted field value in the above-mentioned embodiments, the present disclosure proposes another field assignment method.
[0092] Figure 4 is a flowchart of the field assignment method shown in the fourth embodiment of the present disclosure.
[0093] As Figure 4 shown, the field assignment method includes the following steps:
[0094] Step 401, obtain the assignment configuration file and read each configuration item in the assignment configuration file in sequence.
[0095] Step 402, parse the currently read configuration item to obtain the source configuration information, the destination configuration information and the 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, and the source object is one of the business form and the business message, and the destination object is the other one of the business form and the business message.
[0097] Step 403, determine the to-be-converted field value according to the source configuration information.
[0098] At step 404, the conversion function is invoked according to the configuration information of the conversion function to convert the field value to be converted to obtain a converted field value.
[0099] At step 405, a target field value matching the at least one second configuration field name is determined from the converted field value in response to the second configuration field name of the at least one destination field included in the destination configuration information.
[0100] To improve the accuracy of field assignment, as an example, the configuration field name of the at least one destination field to be assigned in the destination configuration information is configured, i.e., the second configuration field name of the 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 the conversion function not only outputs the converted field value when converting the field to be converted, but also outputs the field name corresponding to the converted field value. When the field name corresponding to the converted field value matches the second configuration field name, it means that the converted field value matches the second configuration field name.
[0101] At step 406, the at least one destination field is assigned according to the target field value matching the at least one second configuration field name.
[0102] To improve the accuracy and flexibility of field assignment, as a possible implementation manner, different assignment strategies are adopted to assign the destination field according to the number of target field values matching the second configuration field name.
[0103] As an example, the target field value matching the second configuration field name is determined from the converted field value in response to the second configuration field name of the at least one destination field included in the destination configuration information. In response to the field value of the at least one 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 not being empty, the target field value matching the second configuration field name of the at least one destination field is adopted to assign the at least one destination field.
[0104] That is, the second configuration field name of the at least one destination field is configured in the destination configuration information, and therefore, the target field value matching the second configuration field name is determined from the converted field value. Further, it is determined 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 determined whether the target field value matching the second configuration field name is empty. When the target field value matching the second configuration field name is not empty, the target field value matching the second configuration field name of the at least one destination field is adopted to assign the at least one destination field.
[0105] As another example, in response to the second configuration field name including multiple destination fields in the destination configuration information, multiple second configuration field names are split from the target path of the destination configuration information; target field values matching the multiple second configuration field names are determined from the converted field values; for any destination field in the multiple destination fields, in response to the field value of any destination field not being allowed to be empty, it is judged 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 not being empty, the target field value matching the second configuration field name of any destination field is used to assign a value to any destination field.
[0106] That is, when the second configuration field name includes multiple destination fields in the destination configuration information, for example, the destination configuration information is ““toFields”:[“formData.baseData.remitCcy1#formData.baseData.remitCcy2”]”, and then multiple second configuration field names are split from the target path “formData.baseData.remitCcy1#formData.baseData.remitCcy2” of the destination configuration information, that is, split by “#” to obtain multiple second configuration field names formData.baseData.remitCcy1 and formData.baseData.remitCcy2, and then target field values matching formData.baseData.remitCcy1 and formData.baseData.remitCcy2 are determined from the converted field values; for any destination field to which any second configuration field name belongs, it is judged according to the destination configuration information whether the field value of the destination field is allowed to be empty, for example, the destination field is configured with an output item “skipOutputNull”, and when the value of “skipOutputNull” is 1, it indicates that the field value of the destination field is not allowed to be empty, and 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, it is judged whether the target field value matching the second configuration field name of the destination field is empty, and 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, the destination field is not assigned a value.
[0107] It should be noted that the execution process of steps 401 to 404 can be implemented in any of the embodiments of the present disclosure, and the present disclosure does not limit this, and will not be repeated here.
[0108] In summary, in response to the second configuration field name including at least one destination field in the destination configuration information, the target field value matched with the at least one second configuration field name is determined from the converted field value; and the at least one destination field is valued according to the target field value matched with the at least one second configuration field name. Thus, when the second configuration field name of the 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 the destination field is accurately valued, thereby improving the automation degree of data processing, without manual intervention, thereby improving the efficiency and accuracy of field valuation, and improving the flexibility of field valuation.
[0109] On the basis of any embodiment of the present disclosure, as Figure 5 indicated, the field valuation method of the embodiments of the present disclosure can also be implemented based on the following steps:
[0110] 1. From the valuation configuration file, read the corresponding mapping configuration (read from the form to the message or from the message to the form according to the scene), and traverse each minimum unit for mapping and valuation processing;
[0111] That is, each configuration item in the valuation configuration file is read in turn, and the current 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 current read configuration item;
[0112] It should be noted that the structure of each configuration item is shown in Table 1,
[0113] Table 1 Structure of each configuration item
[0114]
[0115] 1. The fromFields item defines:
[0116] 1) If you need to take values from the source object or the destination object, you can directly configure the corresponding path, for example "formData.baseData.remitCcy";
[0117] 2) If it is a direct value transmission, the value is wrapped in parentheses (), for example (Y)
[0118] 3) Array value can be taken in python slicing value mode, for example "f71F[0].currency"
[0119] 2. toFields item definition
[0120] 1) If you need to take values from the source object or destination object, you can directly configure the corresponding path, for example "formData.baseData.remitCcy";
[0121] 2) If you do not need to assign values, use "_" instead;
[0122] 3) Array values can be assigned using python slicing, for example "f71F[0].currency";
[0123] 4) If it is a multi-attribute assignment with the same value, use "#" to separate, for example "f32A.currency#f32B.currency";
[0124] 3. forwardFunc item definition
[0125] forwardFunc conversion method (conversion function), input and output parameters are arrays, used to uniformly receive the values of the source field and the values of the output field, if it is one-to-one mapping assignment, you can omit the configuration, as shown in Figure 6 , if it is many-to-many, you can write the implementation logic of the method through the extended interface, which will be called later when the value is obtained;
[0126] 4. skipInputNull item definition
[0127] Do not do mapping processing when the input is empty;
[0128] 5. skipOutputNull item definition
[0129] Do not do mapping processing when the output is empty;
[0130] 2. Read the input configuration of each minimum mapping unit (each configuration item in the assignment configuration file), enter through the form and message objects, and calculate the corresponding specific value through the configuration of each input item;
[0131] 3. Calculate the output value (converted field value) by calling the conversion method (conversion function);
[0132] 4. Read the output configuration of each minimum mapping unit, process the output path according to the corresponding rules, and map the value generated in the previous step to the corresponding value position in order; that is, according to the destination configuration information and the converted field value, assign values to the destination fields in the destination object;
[0133] 5, the field assignment processing is finally completed by traversing the above logic (it can be form field to message field or message field to form field;
[0134] In the above assignment logic scenario, the one-to-one mapping scenario is the majority in the embodiment of the present disclosure, so only the path one-to-one configuration needs to be configured according to the corresponding configuration during the assignment processing, which greatly reduces the development workload, and the subsequent maintenance can also intuitively see the assignment logic between the fields, and the data conversion processing method can also be shared, for example, a customer account field of a message needs to be assigned to a page form, which corresponds to a one-to-many scenario, the implementation logic is to return the customer's related information after querying the corresponding customer information according to the account, and the path value is mapped in order one by one, when multiple types of message types need to take out customer information to the transaction form, it can be directly reused, which greatly improves the development efficiency.
[0135] 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 of the field assignment method is also applicable to the field assignment device provided in the embodiment of the present disclosure, which will not be described in detail in the embodiment of the present disclosure.
[0136] Figure 7 is a structural schematic diagram of the field assignment device shown in the fifth embodiment of the present disclosure.
[0137] As Figure 7 shown, the field assignment device 700 includes a reading module 710, an analysis module 720, a determination module 730, a calling module 740 and an assignment module 750.
[0138] The reading module 710 is configured to obtain an assignment configuration file and read each configuration item in the assignment configuration file in sequence. The analysis module 720 is configured to analyze the currently read configuration item to obtain source configuration information, destination configuration information and configuration information of a conversion function in the currently read configuration item. The source configuration information indicates a source field in a source object, the destination configuration information indicates a destination field 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. The determination module 730 is configured to determine a field value to be converted according to the source configuration information. The calling module 740 is configured to call 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. The assignment module 750 is configured to assign the destination field in the destination object according to the destination configuration information and the converted field value.
[0139] As a possible implementation manner of the embodiment of the present disclosure, the determining module 730 is configured to: in response to the source configuration information including at least one source field with a first configuration field name, determine, from the source configuration information, source path information of the at least one first configuration field name; for any first configuration field name, acquire a field value matched with the any first configuration field name according to the source path information of the any first configuration field name; and determine a to-be-converted field value according to the field values matched with the first configuration field names.
[0140] As a possible implementation manner of the embodiment of the present disclosure, the determining module 730 is configured to: for any input item in the at least one input item of the conversion function, judge whether a value of the any input item is allowed to be empty; in response to the value of the any input item not being allowed to be empty, judge whether a field value of a source field matched with the any input item is empty, wherein a first configuration field name of the matched source field corresponds to the any input item; and in response to the field value of the matched source field not being empty, take the field value of the matched source field as the to-be-converted field value.
[0141] As a possible implementation manner of the embodiment of the present disclosure, the determining module 730 is further configured to: in response to the value of the any input item being allowed to be empty, take the field value of the matched source field as the to-be-converted field value; and in response to the value of the any input item not being allowed to be empty and the field value of the matched source field being empty, end the assignment to the destination field corresponding to the any input item.
[0142] As a possible implementation manner of the embodiment of the present disclosure, the determining module 730 is configured to: in response to the source configuration information including configuration field values of at least one source field, acquire, from the source configuration information, the configuration field values of the at least one source field; and take the configuration field values of the at least one source field as the to-be-converted field values.
[0143] As a possible implementation manner of the embodiment of the present disclosure, the assigning module 750 is configured to: in response to the destination configuration information including at least one destination field with a second configuration field name, determine, from the converted field values, a target field value matched with the at least one second configuration field name; and assign to the at least one destination field according to the target field value matched with the at least one second configuration field name.
[0144] As a possible implementation manner of the embodiment of the present disclosure, the assigning module 750 is configured to: in response to the destination configuration information including one destination field with a second configuration field name, determine, from the converted field values, a target field value matched with the second configuration field name; in response to a field value of the one destination field not being allowed to be empty, judge whether the target field value matched with the second configuration field name is empty; and in response to the target field value matched with the second configuration field name not being empty, assign to the one destination field by using the target field value matched with the second configuration field name of the one destination field.
[0145] As a possible implementation manner of the embodiment of the present disclosure, the assigning module 750 is configured to: in response to the second configuration field name including a plurality of destination fields in the destination configuration information, split the plurality of second configuration field names from the target path of the destination configuration information; determine the target field value matched with the plurality of second configuration field names from the converted field value; in response to the field value of any destination field not being allowed to be empty, determine whether the target field value matched with the second configuration field name of any destination field is empty; and in response to the target field value matched with the second configuration field name of any destination field not being empty, assign the target field value matched with the second configuration field name of any destination field to any destination field.
[0146] As a possible implementation manner of the embodiment of the present disclosure, the calling module 740 is configured to: determine the function path information and the 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.
[0147] The field assigning device of the embodiment of the present disclosure realizes the modification and recompilation of the code adjustment field assignment rule without each time assignment, dynamically processes the field assignment logic of different message types, and realizes the flexible extraction of the field value from the source object according to the source configuration information, the destination configuration information and the configuration information of the conversion function, and the assignment of the field value to the destination object after conversion, thereby improving the field assignment flexibility. In addition, when the message type is increased, only the corresponding configuration item needs to be added in the configuration file, without the modification and expansion of the complex code logic, thereby greatly reducing the error possibility and improving the maintainability and scalability of the system.
[0148] In an example embodiment, an electronic device is also provided.
[0149] The electronic device includes:
[0150] a processor;
[0151] a memory for storing processor-executable instructions;
[0152] The processor is configured to execute the instructions to implement the field assignment method as proposed in any of the foregoing embodiments.
[0153] As an example, Figure 8 is a structural schematic diagram of an electronic device 800 shown in an example embodiment of the present disclosure, as Figure 8 The electronic device 800 can further include:
[0154] The memory 810 and the processor 820 are connected by a bus 830, and the memory 810 stores a computer program, which, when executed by the processor 820, implements the field assignment method described in the embodiments of the present disclosure.
[0155] The bus 830 represents one or more of several types of bus structures, including a memory bus or bus controller, a peripheral bus, a graphics acceleration 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.
[0156] 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 and include both volatile and nonvolatile media, removable and non-removable media.
[0157] The memory 810 can 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 electronic device 800 can further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, a storage system 860 can be provided for reading from and writing to non-removable, non-volatile magnetic media (e.g., a "hard drive"). Figure 8 (not shown) is typically provided as residual storage across the various components of the electronic device 800, such as the memory 810, the storage system 860, and the like. Although the exemplary environment 800 is depicted as a single environment, it should be appreciated that the environment 800 can be comprised of multiple physical computing devices or computing environments connected together through a network. Figure 8 Although not shown in the exemplary environment 800, a disk drive can be provided for reading from and writing to a removable, non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive can be provided for reading from or writing to a removable, non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media). In these instances, each drive can be connected to the bus 830 by one or more data media interfaces. The memory 810 can include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the present disclosure.
[0158] A program / utility 880 having a set (at least one) of program modules 870 can be stored in, for example, memory 810 by way of example, such program modules 870 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or a combination can include implementation of a network environment. The program modules 870 generally carry out the functions and / or methodologies described in the embodiments of the present disclosure.
[0159] The electronic device 800 can also communicate with one or more external devices 890 such as a keyboard or pointing device, a display 891, etc.; one or more devices that enable a user to interact with the electronic device 800; and / or one or more devices (e.g., a networking module, a modem, etc.) that enable the electronic device 800 to communicate with one or more other computing devices. Such communication can occur via an input / output (I / O) interface 892. Still yet, the electronic device 800 can communicate with one or more networks (such as one or more local area networks (LANs), one or more wide area networks (WANs), and / or one or more public networks such as the Internet) via a network adapter 893. As depicted, the network adapter 893 communicates with the other components of the electronic device 800 via the bus 830. It should be appreciated that the electronic device 800 can be a part of one or more networks, such as a cloud computing network, and / or a distributed computing network.
[0160] The processor 820 performs various function applications and data processing by running programs stored in the memory 810.
[0161] It should be noted that the implementation process and technical principles of the electronic device of the present embodiment are described above in the field assignment method of the present disclosure, and will not be repeated here.
[0162] In an exemplary embodiment, a computer readable storage medium including instructions, such as a memory including instructions, is also provided, and the above-mentioned instructions can be executed by the processor of the electronic device to complete the field assignment method proposed in any of the above-mentioned 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, and an optical data storage device, etc.
[0163] In an exemplary embodiment, a computer program product is also provided, including a computer program / instruction, characterized in that the computer program / instruction is executed by the processor to implement the field assignment method proposed in any of the above-mentioned embodiments.
[0164] Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the aspects of the present disclosure disclosed herein. It is intended that the present disclosure cover any and all variations of the present disclosure including combinations or permutations of individual features of the present disclosure. It is intended that the present disclosure cover the features and benefits of the methods, machines, and systems described herein, and the individual features of those methods, machines, and systems. It is intended that the scope of the present disclosure should include all changes and modifications within the scope of the patent claims. It is intended that the description and examples included herein are to be considered as exemplary or illustrative only and not limiting of the disclosure. The disclosure covers all alternatives consistent with the patent claims.
[0165] It should be understood that the present disclosure is not limited to the precise construction that has been described above and shown in the accompanying drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the present disclosure. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A field assignment method, characterized by, The method comprises: obtaining an assignment configuration file and reading configuration items in the assignment configuration file in sequence; parsing a currently read configuration item to obtain source configuration information, destination configuration information and configuration information of a conversion function in the currently read configuration item; wherein a source field indicated by the source configuration information is located in a source object, a 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, comprising: in response to at least one first configuration field name of the source field being included in the source configuration information, 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 matched with the any first configuration field name according to the source path information of the any first configuration field name; and determining the field value to be converted according to the field values matched with the first configuration field names; 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; assigning a destination field in the destination object according to the destination configuration information and the converted field value.
2. The method of claim 1, wherein, The determining the field value to be converted according to the field values matched with the first configuration field names comprises: for any input item in at least one input item of the conversion function, judging whether a value of the any input item is allowed to be empty; in response to the value of the any input item not being allowed to be empty, judging whether a field value of a matched source field is empty; wherein a first configuration field name of the matched source field corresponds to the any input item; in response to the field value of the matched source field not being empty, taking the field value of the matched source field as the field value to be converted.
3. The method of claim 2, wherein, The method further comprises: in response to the value of the any input item 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 value of the any input item not being allowed to be empty and the field value of the matched source field being empty, ending assignment of a destination field corresponding to the any input item.
4. The method of claim 1, wherein, The determining the field value to be converted according to the source configuration information further comprises: in response to configuration field values of at least one source field being included in the source configuration information, obtaining the configuration field values of the at least one source field from the source configuration information; taking the configuration field values of the at least one source field as the field value to be converted.
5. The method of claim 1, wherein, The assigning the destination field in the destination object according to the destination configuration information and the converted field value comprises: in response to at least one second configuration field name of the destination field being included in the destination configuration information, determining a target field value matched with the at least one second configuration field name from the converted field value; According to a target field value matched with the at least one second configuration field name, at least one of the destination fields is assigned a value.
6. The method of claim 5, wherein, The assigning of the at least one destination field according to the target field value matched with the at least one second configuration field name comprises: In response to a second configuration field name of the one destination field, determining a target field value matched with 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, judging whether the target field value matched with the second configuration field name is empty; In response to the target field value matched with the second configuration field name not being empty, assigning the one destination field with the target field value matched with the second configuration field name of the one destination field.
7. The method of claim 5, wherein, The assigning of the at least one destination field according to the target field value matched with the at least one second configuration field name comprises: In response to a second configuration field name of the one destination field, determining a target field value matched with 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, judging whether the target field value matched with the second configuration field name is empty; In response to the target field value matched with the second configuration field name not being empty, assigning the one destination field with the target field value matched with the second configuration field name of the one destination field. The calling of the conversion function according to the configuration information of the conversion function to convert the to-be-converted field value to obtain a converted field value comprises:
8. The method of claim 1, wherein, According to the configuration information of the conversion function, determining function path information and identification information of a to-be-called conversion function; According to the function path information and the identification information, calling the conversion function to convert the to-be-converted field value; Receiving the converted field value output by the conversion function. Comprise:
9. A field assignment apparatus, comprising: A reading module configured to acquire an assignment configuration file and read each configuration item in the assignment configuration file in sequence; A parsing module configured to parse a currently read configuration item to obtain source configuration information, destination configuration information and configuration information of a conversion function in the currently read configuration item; wherein a source field indicated by the source configuration information is located in a source object, a 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 packet, and the destination object is the other of the business form and the business packet; The determining module is configured to: in response to the first configuration field name of at least one of the source fields being included in the source configuration information, determine, from the source configuration information, source path information of at least one of the first configuration field name; for any first configuration field name, acquire a field value matched with the any first configuration field name according to the source path information of the any first configuration field name; and determine a to-be-converted field value according to the field values matched with the first configuration field names. The calling module is configured to: call the conversion function according to the configuration information of the conversion function, so as to convert the to-be-converted field value and obtain a converted field value. The assignment module is configured to: assign 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