Data clearing method, device, equipment, storage medium and program product
By adopting a data clearing method based on configuration information, the problems of poor code reusability and scattered verification logic in multi-scenario payment clearing business are solved, and efficient and accurate data clearing processing is achieved.
Patent Information
- Application Number
- CN202611033271.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-13
- Publication Date
- 2026-11-27
AI Technical Summary
In multi-scenario payment and settlement business, existing technologies suffer from poor code reusability, high development and maintenance costs, and a lack of unified verification and control mechanisms, resulting in low settlement efficiency and high error rates.
By acquiring the target string of the target data, concatenating and parsing it based on preset configuration information, establishing field format rules and validation rules, realizing fixed-length processing and mapping relationships of multiple field values, ensuring the consistency of concatenation and parsing operations, and uniformly managing business dependencies through configuration information.
It reduces development and maintenance costs in multiple scenarios, improves the accuracy and efficiency of liquidation processing, and avoids liquidation errors caused by human error.
Smart Images

Figure CN123178393A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of big data technology, and more specifically to a data clearing method, apparatus, device, storage medium, and program product. Background Technology
[0002] In multi-scenario payment and settlement operations, the concatenation and parsing of settlement elements are crucial steps in the data settlement process. As the scope of business continues to expand, the differences in data settlement across different scenarios are widening, making efficient and accurate data settlement a pressing technical challenge. To meet the data settlement needs of multiple scenarios, relevant technologies have independently developed front-end field display and back-end string concatenation and parsing code for each scenario, improving data settlement efficiency to some extent.
[0003] However, the above methods have poor code reusability. When the existing clearing rules change, it is necessary to rewrite the concatenation and parsing code for the corresponding scenarios, resulting in high code duplication and a sharp increase in development and maintenance costs. At the same time, the business dependency verification logic between clearing fields is scattered in the independent code of each scenario, lacking a unified verification control mechanism, which further increases the complexity of system maintenance and error rate. Summary of the Invention
[0004] In view of the above problems, embodiments of this application provide a data clearing method, apparatus, device, medium, and program product.
[0005] According to a first aspect of this application, a data clearing method is provided, comprising: obtaining a target string of target data, wherein the target string is pre-concatenated with multiple first field values of the target data based on preset configuration information of the target data, the configuration information including at least multiple field identifiers, and field format rules and field validation rules corresponding to the multiple field identifiers, and the target data including multiple first field values corresponding to the multiple field identifiers; parsing the target string to obtain multiple second field values based on the field format rules and field validation rules; and establishing a mapping relationship between the multiple second field values and the multiple field identifiers to obtain the clearing result of the target data.
[0006] According to an embodiment of this application, based on the target character length of multiple fields in the field format rules, the character padding position for fixed-length processing, and the character type for fixed-length processing, fixed-length processing is performed on multiple first field values to obtain multiple substrings. The fixed-length processing includes the operation of padding the actual character length of multiple fields to the target character length. Based on the arrangement order of multiple fields in the field format rules, multiple substrings are combined to obtain the target string.
[0007] According to an embodiment of this application, in response to the fact that the number of valid characters contained in multiple first field values is less than the number of target characters, the difference between the number of target characters and the number of valid characters is calculated to obtain the number of padding characters; based on the character padding position and the number of padding characters, the first field values are padded with characters corresponding to the character type to obtain a substring.
[0008] According to an embodiment of this application, a first validation rule based on field validation rules is used to validate multiple first field values, wherein the first validation rule is used to validate whether a key field value is null, and the key field value is a non-null field value; in response to detecting that the key field value among the multiple first field values is not null, a second validation rule based on field validation rules is used to validate the multiple first field values, wherein the second validation rule is used to validate the dependency relationship between the multiple fields; in response to detecting that the multiple fields satisfy the dependency relationship, fixed-length processing is performed on the multiple first field values.
[0009] According to an embodiment of this application, multiple substrings are extracted from the target string based on the number of characters in the target string and their arrangement order; based on the character padding position, characters corresponding to the character type are deleted from the multiple substrings to obtain multiple second field values.
[0010] According to an embodiment of this application, the target string is validated based on a third validation rule of the field validation rules, wherein the third validation rule is used to verify whether the number of characters in the target string is equal to the sum of the number of characters in the target string; in response to the fact that the number of characters in the target string is equal to the sum of the number of characters in the target string, a truncation operation on the target string is triggered.
[0011] According to an embodiment of this application, based on the arrangement order, multiple second field values are sequentially associated with multiple field identifiers to obtain multiple target fields; the multiple target fields are converted into a preset data exchange format to obtain the clearing result of the target data.
[0012] According to an embodiment of this application, in response to a request to update and / or restore configuration information, target configuration information is obtained; based on the target configuration information, the configuration information is replaced, and the target configuration information is used for splicing and parsing processing in data clearing.
[0013] According to a second aspect of this application, a data clearing apparatus is provided, comprising: an acquisition module for acquiring a target string of target data, wherein the target string is pre-concatenated with multiple first field values of the target data based on preset configuration information of the target data, the configuration information including at least multiple field identifiers, and field format rules and field validation rules corresponding to the multiple field identifiers, and the target data including multiple first field values corresponding to the multiple field identifiers; a parsing module for parsing the target string to obtain multiple second field values based on the field format rules and field validation rules; and a mapping module for establishing a mapping relationship between the multiple second field values and the multiple field identifiers to obtain the clearing result of the target data.
[0014] According to a third aspect of this application, an electronic device is provided, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method described above.
[0015] According to a fourth aspect of this application, a computer-readable storage medium is also provided, on which a computer program or instructions are stored, wherein the computer program or instructions, when executed by a processor, implement the steps of the above-described method.
[0016] According to a fifth aspect of this application, a computer program product is also provided, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method. Attached Figure Description
[0017] The above-mentioned contents, other objects, features and advantages of this application will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0018] Figure 1 The illustrations depict application scenarios of data clearing methods, apparatus, devices, media, and program products according to embodiments of this application.
[0019] Figure 2 A flowchart illustrating a data clearing method according to an embodiment of this application is shown schematically.
[0020] Figure 3 The illustration shows a schematic diagram of obtaining the target string according to an embodiment of this application;
[0021] Figure 4 The illustration shows a schematic diagram of obtaining a substring according to an embodiment of this application;
[0022] Figure 5 This illustration shows a schematic diagram of field validation according to an embodiment of the present application;
[0023] Figure 6 This illustration schematically shows a diagram of obtaining the value of the second field according to an embodiment of this application;
[0024] Figure 7 The diagram illustrates the establishment of mapping relationships according to an embodiment of this application.
[0025] Figure 8 This illustration shows a schematic diagram of configuration information changes according to an embodiment of this application;
[0026] Figure 9 This schematic diagram illustrates a structural block diagram of a data clearing apparatus according to an embodiment of the present application;
[0027] Figure 10 A block diagram schematically illustrates an electronic device suitable for implementing a data clearing method according to an embodiment of this application. Detailed Implementation
[0028] The embodiments of this application will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of this application. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of this application for ease of explanation. However, it will be apparent that one or more embodiments may be implemented without these specific details. Furthermore, descriptions of well-known structures and technologies are omitted in the following description to avoid unnecessarily obscuring the concepts of this application.
[0029] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0030] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0031] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).
[0032] As used in this paper, the term "model" refers to a model that learns the relationship between inputs and outputs from training data, enabling it to generate corresponding outputs for a given input after training. Model generation can be based on machine learning techniques. Deep learning is a machine learning algorithm that processes inputs and provides corresponding outputs using multiple layers of processing units. A neural network model is an example of a deep learning-based model. In this paper, "model" may also be referred to as a "machine learning model," "learning model," "machine learning network," or "learning network," and these terms are used interchangeably.
[0033] This application provides a data clearing method, apparatus, device, storage medium, and program product. The method includes: obtaining a target string of target data, wherein the target string is pre-concatenated with multiple first field values of the target data based on preset configuration information of the target data, the configuration information including at least multiple field identifiers, and field format rules and field validation rules corresponding to the multiple field identifiers, and the target data including multiple first field values corresponding to the multiple field identifiers; parsing the target string to obtain multiple second field values based on the field format rules and field validation rules; and establishing a mapping relationship between the multiple second field values and the multiple field identifiers to obtain the clearing result of the target data.
[0034] According to embodiments of this application, a target string is obtained by concatenating multiple first field values of target data based on preset configuration information. This target string is then parsed using field format rules and field validation rules within the same configuration information to obtain multiple second field values. This ensures that both the concatenation and parsing operations in data clearing are driven by the same set of configuration information. This overcomes the problems of poor code reusability and high maintenance costs associated with traditional solutions that require writing independent concatenation and parsing code for each scenario. When adding new scenarios or adjusting clearing elements, only the corresponding configuration information needs to be modified or added; there is no need to redevelop the concatenation and parsing logic, significantly reducing development and maintenance costs across multiple scenarios. Furthermore, by validating field values based on field validation rules in the configuration information and establishing a mapping relationship between second field values and field identifiers to obtain clearing results, cross-field business dependencies are stored in the configuration information and executed by the validation engine. This overcomes the limitations of traditional methods where validation logic is scattered across different scenario codes, making unified management and maintenance difficult. It also avoids clearing errors caused by human error, thereby improving the accuracy and efficiency of multi-scenario clearing processing.
[0035] Figure 1 The diagram illustrates an application scenario of the data clearing method according to an embodiment of this application. For example... Figure 1As shown, application scenario 100 according to an embodiment of this application may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables. For example, a user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send information, etc.
[0036] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be electronic devices such as smartphones, wearable devices, personal computers, intelligent voice interaction devices, smart home appliances, intelligent vehicles, in-vehicle terminals, aircraft, unmanned vending terminals, and extended reality devices. Extended reality devices can include virtual reality devices, augmented reality devices, and mixed reality devices. A client application for the target application can be installed and run on the terminal devices. This target application can include, but is not limited to, financial transaction applications, payment applications, shopping applications, web browser applications, search applications, instant messaging tools, email clients, and social media platform software (these are just examples). Furthermore, this application embodiment does not limit the form of the target application, and it can include, but is not limited to, applications, mini-programs, etc., installed on the terminal devices, and can also be in the form of web pages.
[0037] Server 105 can be a server providing various services, such as a backend management server supporting websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process received user requests and other data, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services such as cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks, and basic cloud computing services such as big data. The server can be the backend server of the aforementioned target application, used to provide backend services to the clients of the target application.
[0038] It should be noted that the data clearing method provided in this application embodiment can generally be executed by server 105 and / or terminal devices 101-103. Accordingly, the data clearing device provided in this application embodiment can generally be installed in server 105 and / or terminal devices 101-103.
[0039] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0040] Figure 2 A flowchart illustrating a data clearing method according to an embodiment of this application is shown schematically. Figure 2 As shown, the data clearing method according to the embodiments of this application may include steps S210 to S230.
[0041] In step S210, the target string of the target data is obtained.
[0042] According to an embodiment of this application, the target data is business data to be cleared and processed. The target data includes multiple field names corresponding to multiple field identifiers and multiple first field values. For example, in a payroll transaction in region X, the target data includes multiple first field values corresponding to multiple field names such as payee ID type, payee ID number, payroll type, and payment month. The target string is pre-constructed by concatenating the multiple first field values of the target data based on preset configuration information. The target string serves as the carrier for clearing data transmission and storage.
[0043] According to embodiments of this application, the configuration information can be structured data containing clearing and processing rules. The configuration information includes multiple field identifiers, as well as field format rules and field validation rules corresponding to these field identifiers. Specifically, the field identifier can be a unique name code for each clearing field, with a one-to-one correspondence between the field identifier and the field name. For example, the field identifier corresponding to the field name "Payee ID Type" can be "payeeIdNumber," and the field identifier corresponding to the field name "Payment Month" can be "paymentMonth." The field format rules are the format characteristics of each clearing field, including the target number of characters, field arrangement order, character padding position, character type, and field data type. For example, the field format rules for "Payment Month" include: a target number of characters of 2, a field arrangement order of 4, character padding position on the left, character type of 0, and field data type of numeric. The field validation rules are the validation standards for each clearing field. For example, "Payee ID Number" cannot be empty, and "Payment Month" cannot be empty if the "Payee ID Type" field is not empty.
[0044] In some embodiments, the configuration information may also include basic information, which includes attribute information such as scenario code, scenario name, version number and description information. The scenario code adopts standardized encoding for matching with target data. For example, the scenario code "X" corresponds to the liquidation configuration information of region X.
[0045] According to embodiments of this application, a scenario code is extracted from the target data. This scenario code is then matched with the basic information of the configuration information to load the configuration information corresponding to the target data. Based on the field format rules and field validation rules of the configuration information, multiple first field values from the target data are concatenated to obtain the target string. For example, for target data of a payroll processing transaction in region X, the system extracts the scenario code "X," matches and loads the configuration information for data clearing in region X. The configuration includes m field identifiers, the corresponding field format rules and field validation rules for each of the m field identifiers, and basic information. Based on this configuration information, the m first field values are concatenated to generate the target string, where m is an integer greater than or equal to 1.
[0046] According to the embodiments of this application, the concatenation of the target string is performed based on the configuration information. When adding a new scenario or business scenario, only the corresponding configuration information needs to be added, without the need to repeatedly develop the concatenation logic, which greatly reduces the redundancy of the concatenation code. At the same time, the configuration information can be matched with the target data through the scenario code in the basic information, and support the differentiated clearing rules of different business scenarios under a single concatenation framework, so as to realize the unified management of multi-scenario configurations.
[0047] In step S220, based on field format rules and field validation rules, the target string is parsed to obtain multiple second field values.
[0048] According to an embodiment of this application, the second field value is a field value obtained by parsing the target string. The parsed second field value may differ from the first field value in data type, but they are consistent in data semantics. During the data clearing process, the parsing process and the concatenation process share the same configuration information and perform parsing operations based on the same field format rules and field validation rules. This ensures that the rules of the concatenation process and the parsing process are consistent, avoiding data restoration errors caused by inconsistent rules.
[0049] According to embodiments of this application, a scenario code is extracted from the target data. This scenario code is then matched with the basic information of the configuration information to load the configuration information corresponding to the target string in the target data. Based on the field format rules and field validation rules of the configuration information, the target string is parsed to obtain multiple second field values. For example, for target data of a payroll payment transaction in region X, the system extracts the scenario code "X", matches and loads the configuration information for data clearing in region X, and, according to the field format rules and field validation rules corresponding to the m field identifiers in the configuration information, sequentially parses out m second field values, such as payee ID type, payee ID number, payroll type, and payment month, where m is an integer greater than or equal to 1.
[0050] According to embodiments of this application, the parsing and concatenation processes are performed based on the same configuration information, eliminating the need to write separate field splitting logic for the parsing process, thus reducing maintenance costs and improving code reusability. When the configuration information is updated, the parsing and concatenation processes can be updated synchronously, avoiding data misalignment or clearing failures caused by inconsistencies between the parsing and concatenation logic.
[0051] In step S230, a mapping relationship is established between multiple second field values and multiple field identifiers to obtain the clearing result of the target data.
[0052] According to embodiments of this application, the mapping relationship includes a one-to-one correspondence between the second field value and the field identifier. By establishing the mapping relationship, discrete field value results are converted into structured data that can be retrieved by the field identifier, facilitating subsequent system identification and retrieval. The settlement result consists of multiple sets of mapping relationships, each set corresponding to a specific settlement data item. The settlement result can use the field identifier as a retrieval index to locate and extract the value of any settlement data item for front-end page display, downstream business system processing, or cross-system data exchange. For example, in the settlement scenario of payroll disbursement in region X, m second field values are parsed and associated one-to-one with m field identifiers such as "payeeIdNumber" and "paymentMonth", forming a settlement result containing m sets of mapping relationships. The second field value of each item can be uniquely indexed by the corresponding field identifier, where m is an integer greater than or equal to 1.
[0053] According to the embodiments of this application, by establishing a mapping relationship between the field identifier and the second field value, the uniqueness and accuracy of field positioning within the clearing system can be guaranteed, avoiding data matching errors caused by differences in field name descriptions. At the same time, the structured output format has good versatility and can flexibly adapt to different business needs.
[0054] Figure 3 A schematic diagram illustrating the process of obtaining a target string according to an embodiment of this application is shown. Figure 3 As shown, obtaining the target string according to the embodiments of this application may include steps S310 to S320.
[0055] In step S310, based on the target character length of multiple fields in the field format rules, the character padding position for fixed-length processing, and the character type for fixed-length processing, fixed-length processing is performed on multiple first field values to obtain multiple substrings.
[0056] According to an embodiment of this application, fixed-length processing includes the operation of supplementing the actual number of characters in multiple fields to the target number of characters. The target number of characters is the number of characters in each field as predefined in the field format rules. The character padding position is the position of the characters supplemented in the fixed-length processing, including two types: left padding and right padding. The character type is the type of characters supplemented in the fixed-length processing, including 0 characters, space characters, etc.
[0057] According to embodiments of this application, fixed-length processing can be performed by the formatting module in the concatenation engine. The formatting module traverses the field formatting rules in the configuration information, sequentially reads the target character length, character padding position, and character type for each field, and performs character padding operations on multiple first field values. In some embodiments, before performing fixed-length processing on multiple first field values, a validation engine can be called to validate the first field values based on field validation rules. Fixed-length processing is then performed on the validated first field values to obtain multiple substrings.
[0058] According to the embodiments of this application, fixed-length processing based on configuration information allows the same set of formatting modules to uniformly perform character padding operations for different scenarios and different fields, eliminating the code redundancy and maintenance burden caused by writing formatting code separately for each scenario in the traditional method.
[0059] In step S320, based on the order of multiple fields in the field formatting rules, multiple substrings are combined to obtain the target string.
[0060] According to embodiments of this application, the arrangement order is the pre-defined order of multiple fields in the target string according to the field format rules. The concatenation engine concatenates multiple substrings obtained by fixed-length processing of the fields sequentially according to the arrangement order of the fields in the field format rules to obtain the target string. In some embodiments, after obtaining the target string, a validation engine can be called to validate the target string based on field validation rules. If the validation fails, it is determined to be a concatenation anomaly, and an error message is returned. The validated target string can be directly used for subsequent operations such as transmission, storage, or parsing.
[0061] According to the embodiments of this application, multiple substrings are combined based on the arrangement order, so that the structure of the target string is determined by the configuration information. When it is necessary to add new application scenarios or adjust the field order, only the arrangement order in the configuration information needs to be modified, without modifying the code logic of the concatenation engine, which significantly improves the efficiency of field concatenation.
[0062] Figure 4 A schematic diagram illustrating the process of obtaining a substring according to an embodiment of this application is shown. Figure 4 As shown, obtaining the substring according to the embodiments of this application may include steps S410 to S420.
[0063] In step S410, in response to the fact that the number of valid characters contained in multiple first field values is less than the number of target characters, the difference between the number of target characters and the number of valid characters is calculated to obtain the number of padding characters.
[0064] According to embodiments of this application, the effective character count refers to the actual number of characters contained in the first field value, and the padding character count refers to the number of characters needed to make the effective character count reach the target character count. When processing each field, the formatting module of the splicing engine can obtain the effective character count of the first field value and compare it with the corresponding target character count in the field formatting rules. If the effective character count is less than the target character count, the difference between the effective character count and the target character count is calculated to obtain the padding character count; if the effective character count is equal to the target character count, no padding characters are needed; if the effective character count is greater than the target character count, an error message is returned. For example, if the target character count for "Payment Month" is 2 digits and the first field value is 5, then the effective character count is 1 digit, and the padding character count is 1 digit.
[0065] In step S420, based on the character padding position and the number of padding characters, the first field value is padded with characters corresponding to the character type to obtain a substring.
[0066] According to an embodiment of this application, the formatting module of the concatenation engine supplements the first field value with characters corresponding to the character type at the character padding position based on the number of padding characters, thus obtaining a substring. For example, the character padding position for the "Payment Month" field is left-side padding, the character type is 0, and the number of padding characters is 1. Adding one 0 to the left of the first field value 5 results in the substring 05. By incorporating the character padding position and character type as configurable information, there is no need to write independent padding logic for different fields in the code. When the padding strategy changes, only the configuration information attributes need to be adjusted, improving the flexibility and maintainability of field formatting.
[0067] Figure 5 A schematic diagram illustrating field validation according to an embodiment of this application is provided. Figure 5 As shown, field verification according to an embodiment of this application may include steps S510 to S530.
[0068] In step S510, multiple first field values are validated based on the first validation rule of the field validation rules.
[0069] According to an embodiment of this application, a first verification rule is used to verify whether a key field value is null, where the key field value is a non-null field value. Before performing fixed-length processing on multiple first field values, a verification engine can be invoked. The verification engine iterates through each first field value, checking whether the key field value is null. If the key field value is null, an error message for the field identifier corresponding to the key field value is returned. If the key field value is not null, subsequent verification is performed based on the second verification rule of the field verification rule. For example, the field values corresponding to "Payee ID Type", "Payee ID Number", and "Message Type" are all key field values. The verification engine checks whether the field values are null in turn. If any key field value is null, an error message for the key field value is returned. For example, if "Payee ID Number" is null, an error message for the field identifier "payeeIdNumber" is returned.
[0070] In some embodiments, for fields whose data type is numeric, before performing the validation based on the first validation rule, it can be additionally validated whether the corresponding first field value contains only numeric characters. If the first field value contains non-numeric characters, a data type error message is returned.
[0071] In step S520, in response to detecting that the key field value among the multiple first field values is not empty, the multiple first field values are validated based on the second validation rule of the field validation rules.
[0072] According to embodiments of this application, a second validation rule is used to validate the dependencies between multiple fields. The second validation rule can define logical constraints between field values in the form of a conditional expression. In response to detecting that a key field value among multiple first field values is not null, the validation engine reads the composite validation rule array in the configuration information and executes each validation rule sequentially. Each validation rule can include a rule name, a conditional expression, and an error message. In some embodiments, the validation engine can parse the conditional expression, extract all referenced field identifiers, obtain the corresponding first field value based on the field identifier, replace all placeholders in the replacement expression with the first field value, use an expression evaluator to solve the Boolean value, and if the evaluation result is true, collect the corresponding error information and interrupt the execution of subsequent rules. The error information is uniformly returned to the front end with a highlighted prompt to guide the user to correct the input. For example, when the salary type is not 0 and the payment month is null, the error message "When the salary type is not 0, the payment month cannot be null" is triggered.
[0073] In step S530, in response to the detection that multiple fields satisfy a dependency relationship, fixed-length processing is performed on the values of multiple first fields.
[0074] According to embodiments of this application, the validation engine can use an expression evaluator to solve Boolean values. If the evaluation result is false, it is determined that multiple fields satisfy a dependency relationship. The validation engine can then return a validation pass signal to the concatenation engine, which performs fixed-length processing on the multiple first field values. For example, validation passes when the payroll type is not 0 and the payment month is not null.
[0075] According to embodiments of this application, the verification engine can be independent of the splicing engine and the parsing engine, serving as a pluggable verification component. The verification engine can be invoked during both splicing and parsing processes to ensure that the data meets business rules at each stage of clearing. At the same time, the field verification rules are separated from the execution logic of the verification engine. The second verification rule can be included in the configuration information in the form of a conditional expression. When adding or adjusting business dependencies, the conditional expression can be modified or added in the configuration information, which significantly reduces the maintenance cost of the verification rules and the risk of introducing human error.
[0076] Figure 6 A schematic diagram illustrating the obtaining of the second field value according to an embodiment of this application is shown. Figure 6 As shown, obtaining the second field value according to the embodiments of this application may include steps S610 to S620.
[0077] In step S610, multiple substrings are extracted from the target string based on the number of characters in the target string and their arrangement order.
[0078] According to embodiments of this application, the parsing engine traverses the multiple fields in the configuration information according to their order, sequentially reading the target character length of each field, and extracting multiple substrings from the corresponding positions of the target string. Since the order of the multiple fields is consistent with the order of the multiple fields during concatenation, the order of the extracted substrings is consistent with the order of the substrings obtained after the first field value is processed to a fixed length. In some embodiments, before extracting the target string, the parsing engine can call the verification engine to perform verification on the target string. If the verification fails, it indicates that the target string may be corrupted or have a version error; if the verification passes, the extraction operation is performed on the target string.
[0079] In step S620, based on the character padding position, characters corresponding to the character type are deleted from multiple substrings to obtain multiple second field values.
[0080] According to the embodiments of this application, the parsing engine deletes the character corresponding to the character type at the corresponding character padding position in each substring according to the character padding position and character type configured for each field. That is, for fields that are padded on the left, the character corresponding to the character type is deleted starting from the left end of the substring, and the valid content on the right is retained; for fields that are padded on the right, the character corresponding to the character type is deleted starting from the right end of the substring, and the valid content on the left is retained.
[0081] According to embodiments of this application, after deleting characters corresponding to character types from multiple substrings, a format conversion can be performed based on the field data type. For example, numeric fields are converted to integer or decimal numeric types, while string fields retain their text format. The parsing engine outputs a second field value that is semantically identical to the first field value. For instance, if the substring corresponding to the payee's document type is 001, with left padding and a character type of 0, deleting the left padding character 0 restores the second field value to 1.
[0082] According to the embodiments of this application, the parsing and splicing processes are driven by the same configuration information, which ensures the consistency of the second field value obtained by parsing with the first field value before splicing in terms of numerical semantics. This avoids data distortion caused by inconsistent splicing and parsing logic rules. When the configuration is updated, the splicing and parsing behaviors change synchronously, eliminating the need to maintain two separate sets of data processing logic and reducing data maintenance costs.
[0083] Furthermore, before truncating the target string, the parsing engine can call the validation engine to perform validation on the target string, including:
[0084] First, the target string is validated based on the third validation rule of the field validation rules.
[0085] According to an embodiment of this application, the third verification rule is used to verify whether the number of characters in the target string is equal to the sum of the number of target characters. The sum of the number of target characters is the preset number of characters in the target string, used to verify whether data loss or truncation has occurred in the target string during transmission or storage. After obtaining the target string, the parsing engine can call the verification engine to execute the third verification rule before performing the truncation operation. The verification engine reads the actual number of characters in the target string and compares it with the sum of the number of target characters in multiple fields.
[0086] Secondly, in response to the fact that the number of characters in the target string is equal to the sum of the number of characters in the target string, a truncation operation on the target string is triggered.
[0087] According to an embodiment of this application, if the number of characters in the target string equals the sum of the number of characters in the target string, the target string is complete and subsequent truncation operations can be triggered. If the number of characters in the target string does not equal the sum of the number of characters in the target string, the target string may have problems such as data corruption, transmission loss, or mismatched configuration information versions. The verification engine records an error log and returns an error message, terminating the current parsing process. For example, if the sum of the number of characters in the target string for region X is p, and the actual number of characters in the target string obtained by the verification engine is p, the verification passes and the truncation operation continues. If the actual number of characters in the target string is less than p, the verification fails and a length mismatch error message is returned, where p is an integer greater than or equal to 1.
[0088] According to the embodiments of this application, the verification of the target string based on the third verification rule is a pre-verification in the parsing stage, which can effectively intercept abnormal data, avoid errors such as field misalignment or out-of-bounds truncation that may be caused by length mismatch, and ensure the reliability of the parsing process.
[0089] Figure 7 A schematic diagram illustrating the establishment of mapping relationships according to an embodiment of this application is shown. Figure 7 As shown, establishing a mapping relationship according to an embodiment of this application may include steps S710 to S720.
[0090] In step S710, based on the arrangement order, multiple second field values are sequentially associated with multiple field identifiers to obtain multiple target fields.
[0091] According to embodiments of this application, the target field is used to characterize a structured key-value pair composed of a field identifier and a second field value. At least one target field can constitute a data clearing result. Since the parsing engine sequentially truncates and restores the target string based on the order of multiple fields in the field format rules, the resulting multiple second field values are in the same order as the multiple field identifiers. The second field values can be sequentially associated with the field identifiers one by one, using the field identifier of each field as the key and the corresponding second field value as the value to construct the target field. For example, the target data for region X contains the key-value pair "paymentMonth": 5.
[0092] In step S720, multiple target fields are converted into a preset data exchange format to obtain the clearing result of the target data.
[0093] According to embodiments of this application, a preset data exchange format is used to characterize a standardized data representation format agreed upon with the caller, used to transmit clearing results between front-end interfaces, back-end services, or different systems. The clearing result can be a standardized data set organized in a structured form, containing field identifiers and corresponding second field values. For example, the clearing result for region X contains m target fields, such as key-value pairs "payeeIdNumber": 1, "payrollType": 1, and "paymentMonth": 5, where m is an integer greater than or equal to 1.
[0094] According to an embodiment of this application, the parsing engine can return multiple target fields to the interface, and the interface can convert the multiple target fields into a response body in a preset format and return it to the caller as the result of data clearing. After receiving the response, the front end can fill the value of the second field into the corresponding input area of the user interface according to the field identifier in the configuration information to complete the visualization of the clearing result.
[0095] According to the embodiments of this application, the arrangement order in the configuration information is used as the basis for the association between the field identifier and the second field value. The parsing engine does not need to maintain an additional field mapping table or hard-coded correspondence, and can automatically complete the establishment of the mapping relationship, avoiding the risk of mapping misalignment caused by changes in field order. At the same time, the clearing result is converted into a preset data exchange format for output, which improves the usability of the clearing result.
[0096] Figure 8 This diagram illustrates a change in configuration information according to an embodiment of this application. Figure 8 As shown, the configuration information change according to the embodiments of this application may include steps S810 to S820.
[0097] In step S810, in response to a request to update and / or restore configuration information, the target configuration information is obtained.
[0098] According to embodiments of this application, requests for updating and / or restoring configuration information can be triggered automatically, with the system running a timed scanning task in the background to periodically detect the last modification time of the configuration information. If a change in the last modification time is detected, it is determined that the configuration information has been changed. Alternatively, configuration information changes can be triggered manually by submitting updates and / or restoration requests for configuration information through the management interface.
[0099] According to an embodiment of this application, upon detecting a change in configuration information, the system reads the target configuration information from the configuration information storage medium based on the version number of the basic information. For example, a system scheduled task scans the configuration information directory every 60 seconds. If it detects an update to the last modification time of the liquidation configuration information for region X, it retrieves the target configuration information, where the version number of this configuration is n.
[0100] In some embodiments, when parsing a target string, if the number of characters in the target string is inconsistent with the sum of the number of characters in the target string in the current configuration information, the parsing can be reverted to the corresponding historical version configuration based on the version number in the configuration information.
[0101] In step S820, the configuration information is replaced based on the target configuration information, which is used for splicing and parsing in data clearing.
[0102] According to embodiments of this application, the acquired target configuration information is used to update the original configuration information in the memory cache, thereby completing the replacement of the configuration information. The target configuration information is used for splicing and parsing processing in data clearing. The replacement of configuration information can adopt a smooth gray-scale switching mechanism, that is, business requests received before the configuration replacement continue to use the old version of the configuration information to perform splicing and parsing processing; business requests received after the configuration replacement uniformly use the target configuration information to perform splicing and parsing processing, thereby ensuring that the business process will not be abnormally interrupted due to configuration information replacement.
[0103] According to the embodiments of this application, by replacing the original configuration information with the changed configuration information, the splicing engine and the parsing engine automatically obtain the new configuration information in subsequent processing, ensuring the consistency of splicing rules and parsing rules after the configuration information is changed, avoiding version inconsistency caused by loading configuration information separately. At the same time, based on the version number of the basic information, historical version configuration can be rolled back, ensuring forward compatibility of configuration information when parsing existing data.
[0104] Figure 9 A schematic block diagram of a data clearing apparatus according to an embodiment of this application is shown.
[0105] like Figure 9 As shown, the data clearing device 900 of this embodiment includes an acquisition module 910, a parsing module 920, and a mapping module 930.
[0106] The acquisition module 910 is used to acquire the target string of the target data. The target string is obtained by concatenating multiple first field values of the target data based on preset configuration information of the target data. The configuration information includes at least multiple field identifiers, as well as field format rules and field validation rules corresponding to the multiple field identifiers. The target data includes multiple first field values corresponding to the multiple field identifiers. In one embodiment, the acquisition module 910 can be used to execute step S210 described above, which will not be repeated here.
[0107] The parsing module 920 is used to parse the target string to obtain multiple second field values based on field format rules and field validation rules. In one embodiment, the parsing module 920 can be used to perform step S220 described above, which will not be repeated here.
[0108] The mapping module 930 is used to establish a mapping relationship between multiple second field values and multiple field identifiers to obtain the clearing result of the target data. In one embodiment, the mapping module 930 can be used to perform step S230 described above, which will not be repeated here.
[0109] According to an embodiment of this application, the acquisition module 910 includes a concatenation module, which is used to calculate the difference between the target character length and the effective character length in response to the fact that the effective character length contained in multiple first field values is less than the target character length, to obtain the padding character length; and to supplement the first field values with the character length based on the character padding position and the padding character length using the character corresponding to the character type, to obtain a substring.
[0110] According to an embodiment of this application, the splicing module includes a fixed-length module, which is used to calculate the difference between the target character length and the effective character length in response to the fact that the effective character length contained in multiple first field values is less than the target character length, to obtain the padding character length; and to supplement the first field values with the character length based on the character padding position and the padding character length using the character corresponding to the character type, to obtain a substring.
[0111] According to an embodiment of this application, the splicing module further includes a first verification module, used to verify multiple first field values based on a first verification rule of field verification rules, wherein the first verification rule is used to verify whether a key field value is empty, and the key field value is a non-empty field value; in response to detecting that the key field value among the multiple first field values is not empty, the module verifies the multiple first field values based on a second verification rule of field verification rules, wherein the second verification rule is used to verify the dependency relationship between the multiple fields.
[0112] According to an embodiment of this application, the parsing module 920 includes a restoration module, which is used to extract multiple substrings from the target string based on the number of characters in the target string and their arrangement order; and to delete characters corresponding to the character type from the multiple substrings based on the character padding position to obtain multiple second field values.
[0113] According to an embodiment of this application, the restoration module includes a second verification module, which is used to verify the target string based on a third verification rule of the field verification rules, wherein the third verification rule is used to verify whether the number of characters in the target string is equal to the sum of the number of characters in the target string; in response to the fact that the number of characters in the target string is equal to the sum of the number of characters in the target string, a truncation operation on the target string is triggered.
[0114] According to an embodiment of this application, the mapping module 930 includes a target field module, which is used to sequentially associate multiple second field values with multiple field identifiers based on the arrangement order to obtain multiple target fields; and convert the multiple target fields into a preset data exchange format to obtain the clearing result of the target data.
[0115] According to an embodiment of this application, the data clearing apparatus 900 further includes a configuration change module, which is used to obtain target configuration information in response to a request to update and / or restore configuration information; and to replace the configuration information based on the target configuration information, wherein the target configuration information is used for splicing and parsing processing in data clearing.
[0116] According to embodiments of this application, any multiple modules among the acquisition module 910, parsing module 920, and mapping module 930 can be combined into one module, or any one of these modules can be split into multiple modules. Alternatively, at least some of the functions of one or more of these modules can be combined with at least some of the functions of other modules and implemented in one module. According to embodiments of this application, at least one of the acquisition module 910, parsing module 920, and mapping module 930 can be at least partially implemented as a hardware circuit, such as a field-programmable gate array, a programmable logic array, a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit, or implemented by any other reasonable means of integrating or packaging the circuit, or implemented in any one of the three methods of software, hardware, and firmware, or in a suitable combination of any of them. Alternatively, at least one of the acquisition module 910, parsing module 920, and mapping module 930 can be at least partially implemented as a computer program module, which can perform corresponding functions when the computer program module is run.
[0117] Figure 10 A block diagram schematically illustrates an electronic device suitable for implementing a data clearing method according to an embodiment of this application.
[0118] like Figure 10 As shown, an electronic device 1000 according to an embodiment of this application includes a processor 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory 1002 or a program loaded from a storage portion 1008 into a random access memory 1003. The processor 1001 may include, for example, a general-purpose microprocessor, an instruction set processor and / or an associated chipset and / or a dedicated microprocessor. The processor 1001 may also include onboard memory for caching purposes. The processor 1001 may include a single processing unit or multiple processing units for executing different steps of the method flow according to an embodiment of this application.
[0119] Random access memory 1003 stores various programs and data required for the operation of electronic device 1000. Processor 1001, read-only memory 1002, and random access memory 1003 are interconnected via bus 1004. Processor 1001 executes various steps of the method flow according to embodiments of this application by executing programs in read-only memory 1002 and / or random access memory 1003. It should be noted that the programs may also be stored in one or more memories other than read-only memory 1002 and random access memory 1003. Processor 1001 may also execute various steps of the method flow according to embodiments of this application by executing programs stored in said one or more memories.
[0120] According to embodiments of this application, the electronic device 1000 may further include an input / output interface 1005, which is also connected to a bus 1004. The electronic device 1000 may also include one or more of the following components connected to the input / output interface 1005: an input section 1006 including a keyboard, mouse, etc.; an output section 1007 including a cathode ray tube, liquid crystal display, etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card, such as a local area network card, modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the input / output interface 1005 as needed. A removable medium 1011, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 1010 as needed so that computer programs read from it can be installed into the storage section 1008 as needed.
[0121] Embodiments of this application also provide a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of this application.
[0122] According to embodiments of this application, the computer-readable storage medium can be a non-volatile computer-readable storage medium, such as including but not limited to: portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory, portable compact disk read-only memory, optical storage devices, magnetic storage devices, or any suitable combination thereof. In embodiments of this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this application, the computer-readable storage medium may include the read-only memory 1002, and / or random access memory 1003, and / or one or more memories other than read-only memory 1002 and random access memory 1003 described above.
[0123] Embodiments of this application also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the methods provided in the embodiments of this application.
[0124] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 1009, and / or installed from a removable medium 1011. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0125] In embodiments of this application, the computer program can be downloaded and installed from a network via communication section 1009, and / or installed from removable medium 1011. When the computer program is executed by processor 1001, it performs the functions defined in the system of this application embodiment. According to embodiments of this application, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0126] According to embodiments of this application, program code for executing the computer programs provided in the embodiments of this application can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0127] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0128] Those skilled in the art will understand that the features described in the various embodiments of this application can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this application. In particular, the features described in the various embodiments of this application can be combined and / or combined in various ways without departing from the spirit and teachings of this application. All such combinations and / or combinations fall within the scope of this application.
Claims
1. A data clearing method, characterized in that, The method includes: Obtain the target string of the target data. The target string is obtained by concatenating multiple first field values of the target data based on the preset configuration information of the target data. The configuration information includes at least multiple field identifiers, as well as field format rules and field validation rules corresponding to the multiple field identifiers. The target data includes multiple first field values corresponding to the multiple field identifiers. Based on the field format rules and the field validation rules, the target string is parsed to obtain multiple second field values; Establish a mapping relationship between the multiple second field values and the multiple field identifiers to obtain the clearing result of the target data.
2. The data clearing method according to claim 1, characterized in that, The target string for obtaining the target data includes: Based on the target character length of the multiple fields in the field format rules, the character padding position of the fixed-length processing and the character type of the fixed-length processing, the fixed-length processing is performed on the multiple first field values to obtain multiple substrings. The fixed-length processing includes the operation of padding the actual character length of the multiple fields to the target character length. Based on the order of the fields in the field formatting rules, the multiple substrings are combined to obtain the target string.
3. The data clearing method according to claim 2, characterized in that, Based on the target character length, character padding position, and character type of the multiple fields in the field format rules, fixed-length processing is performed on the multiple first field values to obtain multiple substrings, including: In response to the fact that the number of valid characters contained in the plurality of first field values is less than the target number of characters, the difference between the target number of characters and the number of valid characters is calculated to obtain the number of padding characters; Based on the character padding position and the number of padding characters, the first field value is padded with characters corresponding to the character type to obtain the substring.
4. The data clearing method according to claim 2, characterized in that, Before performing fixed-length processing on the multiple first field values based on the target character length, character padding position for fixed-length processing, and character type for fixed-length processing in the field format rules to obtain multiple substrings, the method further includes: Based on the first verification rule of the field verification rule, the multiple first field values are verified, wherein the first verification rule is used to verify whether the key field value is empty, and the key field value is a non-empty field value; In response to detecting that the key field value among the plurality of first field values is not empty, the plurality of first field values are validated based on the second validation rule of the field validation rule, wherein the second validation rule is used to validate the dependency relationship between the plurality of fields; In response to the detection that the dependency relationship is satisfied among the plurality of fields, the fixed-length processing is performed on the plurality of first field values.
5. The data clearing method according to claim 2, characterized in that, The process of parsing the target string based on the field format rules and the field validation rules yields multiple second field values, including: Based on the target character length and the arrangement order, extract the multiple substrings from the target string; Based on the character padding position, the character corresponding to the character type is deleted from the plurality of substrings to obtain the plurality of second field values.
6. The data clearing method according to claim 5, characterized in that, The step of extracting the plurality of substrings from the target string based on the number of target characters and the arrangement order includes: The target string is validated based on the third validation rule of the field validation rules, wherein the third validation rule is used to verify whether the number of characters in the target string is equal to the sum of the number of characters in the target string; In response to the fact that the number of characters in the target string is equal to the sum of the number of characters in the target string, a truncation operation on the target string is triggered.
7. The data clearing method according to claim 2, characterized in that, The step of establishing a mapping relationship between the multiple second field values and the multiple field identifiers to obtain the clearing result of the target data includes: Based on the arrangement order, the multiple second field values are sequentially associated with the multiple field identifiers to obtain multiple target fields; The multiple target fields are converted into a preset data exchange format to obtain the clearing result of the target data.
8. The data clearing method according to claim 1, characterized in that, Before obtaining the target string of the target data, the following is also included: In response to a request to update and / or restore the configuration information, the target configuration information is obtained; Based on the target configuration information, the configuration information is replaced. The target configuration information is used for splicing and parsing in data clearing.
9. A data clearing device, characterized in that, The device includes: The acquisition module is used to acquire the target string of the target data. The target string is obtained by concatenating multiple first field values of the target data based on the preset configuration information of the target data. The configuration information includes at least multiple field identifiers, as well as field format rules and field validation rules corresponding to the multiple field identifiers. The target data includes multiple first field values corresponding to the multiple field identifiers. The parsing module is used to parse the target string to obtain multiple second field values based on the field format rules and the field validation rules; The mapping module is used to establish a mapping relationship between the multiple second field values and the multiple field identifiers to obtain the clearing result of the target data.
10. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 8.
12. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 8.
