Bill data difference comparison method and device, equipment and storage medium
By using multidimensional hash table technology, the problem of time-consuming comparison of traditional billing data discrepancies is solved, enabling fast and accurate comparison of large-scale billing data and ensuring the consistency and integrity of financial data.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- QINIU (SHENZHEN) CLOUD COMPUTING CO LTD
- Filing Date
- 2025-05-06
- Publication Date
- 2026-05-12
AI Technical Summary
Traditional methods for comparing discrepancies in billing data are time-consuming, especially when dealing with large-scale data, which impacts system development and delivery cycles.
By employing multidimensional hash table technology, a first multidimensional hash table and a second multidimensional hash table are created. After deleting matching items, the outer key is simplified, and the bill data comparison result is generated based on the judgment result, reducing the time complexity to O(n).
This greatly improves the efficiency of billing data comparison, ensures the accuracy and reliability of comparison results, and guarantees the consistency and integrity of financial data.
Smart Images

Figure CN120634747B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, device and storage medium for comparing billing data differences. Background Technology
[0002] As enterprises increase their level of informatization, automated comparison of billing data in financial management systems has become a core element in ensuring the accuracy of transaction accounting. In cross-version system upgrades or parallel testing scenarios, developers need to frequently compare billing data generated by the old and new systems to verify whether changes in business logic have caused anomalies in financial records. However, traditional technical solutions typically use nested loops for comparison, which has high time complexity. When dealing with billing data with millions of transactions per day, a single comparison takes a long time, thus affecting the system software development and delivery cycle. Summary of the Invention
[0003] The main objective of this application is to provide a method, apparatus, device, and storage medium for comparing billing data discrepancies, aiming to solve the technical problem that existing billing data discrepancy comparisons are time-consuming.
[0004] To achieve the above objectives, this application proposes a method for comparing discrepancies in billing data, the method comprising:
[0005] A first multidimensional hash table and a second multidimensional hash table are created based on the bill group data to be compared. Both the first multidimensional hash table and the second multidimensional hash table contain several outer keys and corresponding field mapping tables.
[0006] Determine whether each outer key in the first multidimensional hash table has a matching entry in the second multidimensional hash table, and delete the matching entry in both the first and second multidimensional hash tables to obtain an updated first multidimensional hash table and an updated second multidimensional hash table.
[0007] The outer key is simplified for the updated first multidimensional hash table and the updated second multidimensional hash table;
[0008] Determine whether each of the simplified outer keys of the updated first multidimensional hash table has a matching item in the updated second multidimensional hash table, and generate a billing data comparison result based on the determination result.
[0009] In one embodiment, the step of creating a first multidimensional hash table and a second multidimensional hash table based on the bill group data to be compared includes:
[0010] Retrieve the first set of bill data and the second set of bill data;
[0011] Each account data in the first group of bill data / second group of bill data is split into fields, and the strings are concatenated based on the split field names and field values to obtain several strings;
[0012] Each of the strings is determined as an outer key, and a field mapping table corresponding to the outer key is created based on the field name and the field value;
[0013] Generate a first multidimensional hash table / second multidimensional hash table based on each outer key and the corresponding field mapping table.
[0014] In one embodiment, the step of determining whether each outer key in the first multidimensional hash table has a matching entry in the second multidimensional hash table, and deleting the matching entries in both the first and second multidimensional hash tables to obtain an updated first multidimensional hash table and an updated second multidimensional hash table includes:
[0015] Iterate through each of the outer keys in the first multidimensional hash table and check in the second multidimensional hash table whether there is a common outer key;
[0016] Delete the same outer key and the corresponding field mapping table from the first multidimensional hash table and the second multidimensional hash table to obtain the updated first multidimensional hash table and the updated second multidimensional hash table.
[0017] In one embodiment, the step of simplifying the outer key of the updated first multidimensional hash table and the updated second multidimensional hash table includes:
[0018] Obtain a preset simplification template, and simplify the outer keys of the updated first multidimensional hash table and the updated second multidimensional hash table according to the preset simplification template to obtain the simplified outer key.
[0019] In one embodiment, the step of generating a bill data comparison result based on the judgment result includes:
[0020] Based on the judgment result, the difference outer key is determined in the updated first multidimensional hash table, and each difference outer key and the corresponding field mapping table are added to the bill data comparison result table.
[0021] In one embodiment, the step of generating a bill data comparison result based on the judgment result includes:
[0022] Based on the judgment result, the matching outer key is determined in the updated first multidimensional hash table, and the first field mapping table and the second field mapping table of the matching outer primary key are obtained in the updated first multidimensional hash table and the updated second multidimensional hash table respectively.
[0023] Perform a difference comparison between the first field mapping table and the second field mapping table to obtain the difference fields, and record the difference fields in the bill data comparison result table.
[0024] In one embodiment, after the step of recording the difference field to the bill data comparison result table, the method further includes:
[0025] The matching outer key is deleted from the updated second multidimensional hash table, and when all the simplified outer keys in the updated first multidimensional hash table have been traversed, it is determined whether there are any remaining simplified outer keys in the updated second multidimensional hash table.
[0026] If so, add the remaining simplified outer key and the corresponding field mapping table to the bill data comparison result table.
[0027] Furthermore, to achieve the above objectives, this application also proposes a billing data difference comparison device, the device comprising:
[0028] The hash mapping module is used to create a first multidimensional hash table and a second multidimensional hash table based on the bill group data to be compared. Both the first multidimensional hash table and the second multidimensional hash table contain several outer keys and corresponding field mapping tables.
[0029] The hash comparison module is used to determine whether each outer key in the first multidimensional hash table has a matching item in the second multidimensional hash table, and to delete the matching item in the first multidimensional hash table and the second multidimensional hash table to obtain the updated first multidimensional hash table and the updated second multidimensional hash table.
[0030] The primary key simplification module is used to simplify the outer key of the updated first multidimensional hash table and the updated second multidimensional hash table;
[0031] The result generation module is used to determine whether each of the simplified outer keys of the updated first multidimensional hash table has a matching item in the updated second multidimensional hash table, and to generate a billing data comparison result based on the determination result.
[0032] In addition, to achieve the above objectives, this application also proposes a billing data difference comparison device, the device comprising: a memory, a processor, and a billing data difference comparison program stored in the memory and executable on the processor, the billing data difference comparison program being configured to implement the steps of the billing data difference comparison method as described above.
[0033] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, storing a billing data difference comparison program, which, when executed by a processor, implements the steps of the billing data difference comparison method described above.
[0034] This application proposes a method for comparing discrepancies in billing data. It involves creating a first multidimensional hash table and a second multidimensional hash table based on the billing data to be compared. Each multidimensional hash table contains several outer keys and corresponding field mapping tables. The method determines whether each outer key in the first multidimensional hash table has a matching entry in the second multidimensional hash table, and deletes the matching entries in both tables, resulting in updated first and second multidimensional hash tables. The outer keys in the updated first and second multidimensional hash tables are then simplified. Finally, the method determines whether each simplified outer key in the updated first multidimensional hash table has a matching entry in the updated second multidimensional hash table, and generates a billing data comparison result based on the result. This application, through the use of multidimensional hash tables, reduces the time complexity of billing data comparison from the traditional O(n^2)... 2 The computation time is reduced to O(n), greatly improving comparison efficiency, especially suitable for rapid comparison of large-scale billing data. At the same time, through the concatenation and simplification of outer keys, differences between bills can be comprehensively and accurately identified, ensuring the accuracy and reliability of comparison results and effectively guaranteeing the consistency and integrity of financial data. Attached Figure Description
[0035] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0036] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1 This is a flowchart illustrating the first embodiment of the billing data difference comparison method of this application;
[0038] Figure 2 This is a flowchart illustrating the second embodiment of the billing data difference comparison method of this application;
[0039] Figure 3 This is a flowchart illustrating the third embodiment of the billing data difference comparison method of this application;
[0040] Figure 4This is a schematic diagram illustrating the entire process of the method for comparing invoice data differences in this application;
[0041] Figure 5 This is a schematic diagram of the module structure of the first embodiment of the billing data difference comparison device of this application;
[0042] Figure 6 This is a schematic diagram of the device structure of the hardware operating environment involved in the billing data difference comparison method in this application embodiment.
[0043] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0044] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0045] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0046] This application provides a method for comparing differences in billing data, referencing... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the billing data difference comparison method of this application. In this embodiment, the method includes: steps S10 to S40:
[0047] Step S10: Create a first multidimensional hash table and a second multidimensional hash table based on the bill group data to be compared. Both the first multidimensional hash table and the second multidimensional hash table contain several outer keys and corresponding field mapping tables.
[0048] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, mobile phone, data management server, etc., or other electronic devices capable of performing the above functions, such as a bill data difference comparison device. The following description uses a bill data difference comparison device (hereinafter referred to as "comparison device") as an example to illustrate this embodiment and the following embodiments.
[0049] It is understood that the set of billing data to be compared can be billing data generated separately by the system during cross-version system upgrades or parallel testing. For example, bill A can be generated in the system without the addition of new features, and bill B can be generated in the system with the addition of new features.
[0050] Since a bill can consist of multiple entries, the bill data in bill A and bill B can be composed of several entries.
[0051] It's important to note that a multidimensional hash table is a data structure that allows data to be stored and retrieved in key-value pairs. It uses a hash function to map keys to locations within the table, thus speeding up data retrieval. Each multidimensional hash table contains multiple outer keys and a corresponding field mapping table (values) for each outer key.
[0052] In each multidimensional hash table, each outer key can correspond to a single record, meaning the number of outer keys can be the same as the number of records. The outer key is constructed from field-level record data and uniquely identifies the record; the field mapping table (value) is a collection of key-value pairs that map each field name in the record to its corresponding value.
[0053] In practice, two multidimensional hash tables (the first multidimensional hash table and the second multidimensional hash table) can be created for the two sets of bill data (Bill A data and Bill B data) that need to be compared.
[0054] Step S20: Determine whether each outer key in the first multidimensional hash table has a matching entry in the second multidimensional hash table, and delete the matching entry in both the first and second multidimensional hash tables to obtain the updated first and second multidimensional hash tables.
[0055] It should be understood that it is possible to traverse each outer key in the first multidimensional hash table and determine whether these outer keys also exist in the second multidimensional hash table.
[0056] If there is no matching outer key, it means that the account data corresponding to the outer key in the first multidimensional hash table does not exist in the second multidimensional hash table. Therefore, the account data is retained in the first multidimensional hash table.
[0057] If an outer key has a matching entry, it means that the corresponding account data is the same in both bills. Therefore, these matching account data can be deleted from both multidimensional hash tables, resulting in an updated first and second multidimensional hash table. These updated multidimensional hash tables only retain the inconsistent account data from the two sets of bill data.
[0058] Step S30: Simplify the outer key of the updated first multidimensional hash table and the updated second multidimensional hash table.
[0059] It should be noted that an outer key simplification template can be pre-configured, which can pre-configure the key fields that need to be retained. These key fields are combinations of fields that can be used to uniquely identify a record of accounting data, including the key field names and the order in which the key fields are combined.
[0060] For example, the key field may include the billing date, billing period, and bill body.
[0061] It should be understood that by pruning the fields of the updated hash table outer key and retaining the key fields to obtain a simplified outer key, non-key fields that are prone to change, such as addresses and remarks, can be filtered out. This avoids the core comparison results being affected by minor differences (such as decimal precision), ensuring that the difference detection focuses on the key fields of each account's data.
[0062] Step S40: Determine whether each of the simplified outer keys of the updated first multidimensional hash table has a matching item in the updated second multidimensional hash table, and generate a bill data comparison result based on the determination result.
[0063] It should be understood that after the multidimensional hash table is updated, each simplified outer key in the updated first multidimensional hash table can be traversed again to determine whether these simplified outer keys exist in the updated second multidimensional hash table.
[0064] Similarly, for a simplified outer key that has no matching item, it means that the account data corresponding to the simplified outer key in the first multidimensional hash table still does not exist in the second multidimensional hash table. Therefore, the account data is the difference data between the two bills and can be recorded.
[0065] If a simplified outer key has a matching item, it means that the corresponding account data in the two bills are the same in the core fields. In this case, you can differentiate them based on the company's required precision for comparison.
[0066] When the accuracy requirement for comparison is low, the account data corresponding to the simplified outer key in the two bills can be directly regarded as the same, and these account data can be deleted from the two multidimensional hash tables.
[0067] When high precision is required, the mapping tables of the two fields corresponding to the outer key can be further compared and simplified, and the changes in values, additions or missing fields can be identified and recorded field by field.
[0068] In addition, after matching each simplified outer key in the first multidimensional hash table, if there are any remaining simplified outer keys in the second hash table, it indicates that these are newly added bill entries, and they are recorded in the comparison results.
[0069] It should be understood that, based on the above comparison process, the final comparison results may include: deleted records, newly added records, and modified records. Deleted records are account data that exists only in the first multidimensional hash table; newly added records are account data that exists only in the second multidimensional hash table; and modified records are records with the same key fields but some inconsistent field values.
[0070] This embodiment reduces the time complexity of comparing billing data from the traditional O(n) by using a multidimensional hash table. 2 The computation time is reduced to O(n), greatly improving comparison efficiency, especially suitable for rapid comparison of large-scale billing data. At the same time, through the concatenation and simplification of outer keys, differences between bills can be comprehensively and accurately identified, ensuring the accuracy and reliability of comparison results and effectively guaranteeing the consistency and integrity of financial data.
[0071] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 2 , Figure 2 This is a flowchart illustrating the second embodiment of the billing data difference comparison method of this application.
[0072] In this embodiment, to specifically illustrate the creation process of the multidimensional hash table, step S10 specifically includes: steps S101 to S104:
[0073] Step S101: Obtain the first set of bill data and the second set of bill data.
[0074] It should be understood that the first set of billing data can be bill A generated before the system change, and the second set of billing data can be bill B generated after the system change. Bill A and bill B can each include several accounting entries.
[0075] After obtaining bill A and bill B, you can use the `make(map[string]map[string]string)` function in Go to create the corresponding multidimensional hash mapping structures, denoted as Am and Bm respectively.
[0076] Step S102: Split each account data in the first group of bill data / second group of bill data into fields, and concatenate the split field names and field values to obtain several strings.
[0077] Step S103: Determine each of the strings as the outer key, and create a field mapping table corresponding to the outer key based on the field name and the field value.
[0078] Step S104: Generate a first multidimensional hash table / second multidimensional hash table based on each outer key and the corresponding field mapping table.
[0079] It should be understood that the above multidimensional hash mapping allows all fields of each bill to be concatenated into a unique identifier as the outer key, while each field and its value are stored as the inner mapping.
[0080] First, the data from all fields of each account entry in Bill A can be concatenated to form a long string, which will serve as a key for Am. The number of account entries in Bill A is the number of keys for Am.
[0081] Next, each record of accounting data is split at the field level. This record contains several fields, each consisting of a field name and a field value. A new mapping table, the field mapping table, can then be constructed based on this record, and this field mapping table will be used as the value of Am.
[0082] For example, if a record in Bill A is "Date: 2025-02-02, Account Period: 2025-03-02, Amount: 100000, Bill Entity: Company A, Income and Expense: Revenue".
[0083] The corresponding key can be: "Date 20250205_Amount 1000_Account Period 20250302_Bill Entity Company A_Income and Expenditure".
[0084] The corresponding value can be: ["Date": "2025-02-02"; "Accounting Period": "2025-03-02"; "Amount": "100000"; "Bill Entity": "Company A"; "Income and Expenditure": "Revenue"]
[0085] It should be understood that, for different account data, when concatenating strings to obtain the key, the concatenation order of each field can be pre-set based on the field name; at the same time, when generating the value, the row and column order of the mapping relationship of each field in the field mapping table can also be pre-set based on the field name.
[0086] Finally, repeat the above process to generate an outer key and field mapping table corresponding to each account record in bill A, thus determining the key and value of Am and obtaining the first multidimensional hash table. Similarly, the key and value of Bm can be determined to obtain the second multidimensional hash table.
[0087] In this implementation, the global uniqueness of the outer key is ensured by concatenating all fields, thereby avoiding misjudgments caused by field order or selective comparison.
[0088] Furthermore, to illustrate in detail how to perform fast matching based on the outer key, step S20 specifically includes: steps S201 to S202:
[0089] Step S201: Traverse each of the outer keys in the first multidimensional hash table and query the second multidimensional hash table to see if there is a common outer key.
[0090] It should be understood that a for loop can be used to iterate through each outer key in the first multidimensional hash table and determine whether the same outer key exists in the second multidimensional hash table.
[0091] It should be noted that since the time complexity of searching for a key in a hash table is O(1), based on the fast lookup characteristic of hash tables, iterating through and comparing all (n) outer keys in the first multidimensional hash table takes O(n). Therefore, compared to the traditional for loop retrieving each record in bill A and then looping through each record in bill B (O(n) time complexity), this is significantly faster. 2 This greatly reduces the time required to compare bills.
[0092] Step S202: Delete the same outer key and the corresponding field mapping table in the first multidimensional hash table and the second multidimensional hash table to obtain the updated first multidimensional hash table and the updated second multidimensional hash table.
[0093] In the specific implementation, the same outer key and the corresponding character mapping table are deleted from the first multidimensional hash table and the second multidimensional hash table at the same time. The initial comparison is completed to ensure that the first multidimensional hash table and the second multidimensional hash table after deletion store the difference between the two bills.
[0094] Furthermore, after simplifying the outer keys based on the updated first multidimensional hash table and the updated second multidimensional hash table, several simplified outer keys corresponding to the first multidimensional hash table and the second multidimensional hash table are obtained respectively.
[0095] Compared to the aforementioned outer key, the simplified outer key has a shorter string length, and it retains only the key fields used to uniquely identify a single account record.
[0096] For example, if the outer key "Date 20250205_Amount 1000_Account Period 20250302_Billing Entity Company A_Income and Expenditure" in the aforementioned example is still retained in the updated first multidimensional hash table.
[0097] Set the outer key simplified template to retain only the fields of account date, account period, and bill body, and generate simplified outer keys according to the combined order of "account date_account period_billing body".
[0098] The simplified outer key obtained is "Date 20250205_Account Period 20250302_Billing Entity Company A".
[0099] This allows us to iterate through each simplified outer key in the updated first multidimensional hash table again, determining whether these simplified outer keys exist in the updated second multidimensional hash table, and obtaining the final difference comparison result.
[0100] This embodiment iterates through the outer keys of the first multidimensional hash table and checks their existence in the second multidimensional hash table. If a match is found, the corresponding primary key and associated field mapping tables in both hash tables are simultaneously deleted. This completes the initial deduplication in the two bills, reducing the subsequent comparison scope to only the differing data. Furthermore, after deleting identical redundant data, the memory usage of the comparison device is significantly reduced, thus avoiding the performance loss caused by storing all data.
[0101] Based on the first and second embodiments of this application, in the third embodiment of this application, the content that is the same as or similar to that in embodiments one and two above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 3 , Figure 3 This is a flowchart illustrating the third embodiment of the billing data difference comparison method of this application.
[0102] In this embodiment, to specifically illustrate how to obtain comparison results for different categories, step S40 specifically includes: steps S401 to S405:
[0103] Step S401: Based on the judgment result, determine the difference outer key in the updated first multidimensional hash table, and add each difference outer key and the corresponding field mapping table to the bill data comparison result table.
[0104] It should be noted that the differencing outer key is the simplified outer key among the simplified outer keys in the first multidimensional hash table that has no matching entry in the second multidimensional hash table. That is, the differencing outer key exists only in the first multidimensional hash table and not in the second multidimensional hash table.
[0105] If the account data associated with the outer key of the difference has been deleted in bill B, then the outer key of the difference and the corresponding field mapping table can be added to the bill data comparison result table as a deleted record.
[0106] Step S402: Based on the judgment result, determine the matching outer key in the updated first multidimensional hash table, and obtain the first field mapping table and the second field mapping table of the matching outer primary key in the updated first multidimensional hash table and the updated second multidimensional hash table respectively.
[0107] Step S403: Perform a differential comparison between the first field mapping table and the second field mapping table to obtain the differential fields, and record the differential fields in the bill data comparison result table.
[0108] It should be understood that, for simplified outer keys with matching entries, in order to further determine their data consistency, the field mapping tables corresponding to the simplified outer key in the two multidimensional hash tables can be compared.
[0109] In the specific implementation, for any simplified outer key with a matching item, the first field mapping table and the second field mapping table are compared one by one to see if there are field-level differences. For example, the field values corresponding to the same field name are different, the field name exists only in the first field mapping table and the field name exists only in the second field mapping table. The difference field is then determined and the difference field data is added to the bill data comparison result table as a change record.
[0110] Step S404: Delete the matching outer key in the updated second multidimensional hash table, and when all the simplified outer keys in the updated first multidimensional hash table have been traversed, determine whether there are any remaining simplified outer keys in the updated second multidimensional hash table.
[0111] Step S405: If yes, add the remaining simplified outer key and the corresponding field mapping table to the bill data comparison result table.
[0112] It should be noted that duplicate entries with the simplified outer keys of the first multidimensional hash table can be deleted one by one from the second multidimensional hash table, ensuring that the second multidimensional hash table only retains the parts that differ from the first multidimensional hash table. This process continues until all simplified outer keys in the first multidimensional hash table have been traversed, at which point the second multidimensional hash table will no longer contain any duplicate entries with the simplified outer keys from the first multidimensional hash table. At this point, it can be determined whether the second multidimensional hash table is empty, i.e., whether there are any remaining simplified outer keys and their corresponding field mapping tables.
[0113] If so, the remaining simplified outer key exists only in the second multidimensional hash table, and not in the first multidimensional hash table.
[0114] The remaining simplified outer key belongs to the account data that is newly added in bill B. Therefore, the remaining simplified outer key and the corresponding field mapping table can be added to the bill data comparison result table as a new record.
[0115] In practice, the bill data comparison results can be represented in tabular form. Based on the above process, a bill data comparison result table containing deleted records, added records, and changed records can be obtained.
[0116] In addition, you can refer to this place. Figure 4 This document explains the entire process of comparing the differences in the invoice data in this application. Figure 4 This is a schematic diagram illustrating the entire process of the method for comparing invoice data differences in this application.
[0117] based on Figure 4 It can be seen that, firstly, bill A and bill B are generated based on the original system and the system with added new functions, respectively; then, the data of the two bills are read and processed in sequence to generate multidimensional hash map-Am (first multidimensional hash table) and multidimensional hash map-Bm (second multidimensional hash table).
[0118] Next, iterate through each key in Am and check if it exists in Bm. If it exists, delete the key and its corresponding value in Am and Bm; if it does not exist, keep it in Am and Bm.
[0119] After traversing all the keys in Am, the remaining Am and Bm contain the differences between the two bills.
[0120] Then, based on the remaining Am and Bm, a simplified key is regenerated, which retains only the key fields that can uniquely identify a single account record.
[0121] Then, iterate through each simplified key in Am and check if it exists in Bm;
[0122] If it does not exist, it means that the account data to which the simplified key belongs does not exist in Bm, and it is considered a deleted record and added to the comparison results;
[0123] If a difference exists, a deep comparison is performed on the field mapping tables in the two-dimensional hash tables to determine if there are field-level differences. The difference field data is recorded as a change record and added to the comparison results. After being added to the comparison results, the difference field data is deleted in Bm.
[0124] Furthermore, after traversing all simplified keys in Am, if Bm is still not empty, the remaining simplified keys in Bm and their corresponding account data can be considered as new records and added to the comparison results.
[0125] In this embodiment, since the multidimensional hash table retains all field data of the bill through a field mapping table, field-level comparison of all account data can be performed when comparing bills, ensuring the comprehensiveness of the bill data comparison.
[0126] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the method for comparing differences in billing data in this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0127] In addition, this application also provides a device for comparing billing data differences, referring to Figure 5 , Figure 5 This is a structural block diagram of the first embodiment of the billing data difference comparison device of this application; as shown... Figure 5As shown, the device includes:
[0128] The hash mapping module 501 is used to create a first multidimensional hash table and a second multidimensional hash table based on the bill group data to be compared. Both the first multidimensional hash table and the second multidimensional hash table contain several outer keys and corresponding field mapping tables.
[0129] The hash comparison module 502 is used to determine whether each outer key in the first multidimensional hash table has a matching item in the second multidimensional hash table, and to delete the matching item in the first multidimensional hash table and the second multidimensional hash table to obtain the updated first multidimensional hash table and the updated second multidimensional hash table.
[0130] The primary key simplification module 503 is used to simplify the outer key of the updated first multidimensional hash table and the updated second multidimensional hash table;
[0131] The result generation module 504 is used to determine whether each of the simplified outer keys of the updated first multidimensional hash table has a matching item in the updated second multidimensional hash table, and to generate a bill data comparison result based on the determination result.
[0132] Further, the hash mapping module 501 is used to obtain a first set of bill data and a second set of bill data; to split each account data in the first set of bill data / second set of bill data into fields, and to concatenate strings based on the split field names and field values to obtain several strings; to determine each string as an outer key, and to create a field mapping table corresponding to the outer key according to the field name and the field value; and to generate a first multidimensional hash table / second multidimensional hash table according to each outer key and the corresponding field mapping table.
[0133] Furthermore, the hash comparison module 502 is also used to traverse each of the outer keys in the first multidimensional hash table and query whether there is a common outer key in the second multidimensional hash table; delete the common outer key and the corresponding field mapping table in the first multidimensional hash table and the second multidimensional hash table to obtain the updated first multidimensional hash table and the updated second multidimensional hash table.
[0134] Furthermore, the primary key simplification module 503 is also used to obtain a preset simplification template, and to simplify the outer keys of the updated first multidimensional hash table and the updated second multidimensional hash table according to the preset simplification template to obtain a simplified outer key.
[0135] Furthermore, the result generation module 504 is also used to determine the difference outer key based on the judgment result in the updated first multidimensional hash table, and add each difference outer key and the corresponding field mapping table to the bill data comparison result table.
[0136] Furthermore, the result generation module 504 is also used to determine the matching outer key in the updated first multidimensional hash table based on the judgment result, and to obtain the first field mapping table and the second field mapping table of the matching outer primary key in the updated first multidimensional hash table and the updated second multidimensional hash table respectively; to perform a differential comparison on the first field mapping table and the second field mapping table to obtain the difference field, and to record the difference field in the bill data comparison result table.
[0137] Furthermore, the result generation module 504 is also used to delete the matching outer key in the updated second multidimensional hash table, and when traversing all the simplified outer keys in the updated first multidimensional hash table, to determine whether there are any remaining simplified outer keys in the updated second multidimensional hash table; if so, the remaining simplified outer keys and the corresponding field mapping table are added to the bill data comparison result table.
[0138] This embodiment reduces the time complexity of comparing billing data from the traditional O(n) by using a multidimensional hash table. 2 The computation time is reduced to O(n), greatly improving comparison efficiency, especially suitable for rapid comparison of large-scale billing data. At the same time, through the concatenation and simplification of outer keys, differences between bills can be comprehensively and accurately identified, ensuring the accuracy and reliability of comparison results and effectively guaranteeing the consistency and integrity of financial data.
[0139] Other embodiments or specific implementations of the bill data difference comparison device described in this application can be found in the above-described method embodiments, and will not be repeated here.
[0140] This application also provides a billing data difference comparison device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the billing data difference comparison method in the first embodiment described above.
[0141] The following is for reference. Figure 6 , Figure 6This is a schematic diagram of the billing data difference comparison device of this application. The billing data difference comparison device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), etc., as well as fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The billing data difference comparison device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0142] like Figure 6 As shown, the bill data discrepancy comparison device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the bill data discrepancy comparison device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the billing data discrepancy comparison device to communicate wirelessly or wiredly with other devices to exchange data. While the figures show billing data discrepancy comparison devices with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0143] The billing data difference comparison device provided in this application, employing the billing data difference comparison method in the above embodiments, can solve the technical problem of billing data difference comparison. Compared with the prior art, the beneficial effects of the billing data difference comparison device provided in this application are the same as the beneficial effects of the billing data difference comparison method provided in the above embodiments, and other technical features in this billing data difference comparison device are the same as the features disclosed in the method of the previous embodiment, and will not be repeated here.
[0144] This application also provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the billing data difference comparison method in the above embodiments.
[0145] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0146] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described bill data difference comparison method, thereby solving the technical problem of bill data difference comparison. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the bill data difference comparison method provided in the above embodiments, and will not be repeated here.
[0147] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other elements in the process, method, article, or system that includes that element.
[0148] The sequence numbers of the above embodiments of the present invention are merely for description and do not represent the superiority or inferiority of the embodiments. They are only some embodiments of this application and do not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the content of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included within the patent protection scope of this application.
Claims
1. A method for comparing discrepancies in billing data, characterized in that, The method includes: A first multidimensional hash table and a second multidimensional hash table are created based on the bill group data to be compared. Both the first multidimensional hash table and the second multidimensional hash table contain several outer keys and corresponding field mapping tables. Determine whether each outer key in the first multidimensional hash table has a matching entry in the second multidimensional hash table, and delete the matching entry in both the first and second multidimensional hash tables to obtain an updated first multidimensional hash table and an updated second multidimensional hash table. Simplifying the outer keys of the updated first multidimensional hash table and the updated second multidimensional hash table includes: obtaining a preset simplification template, and simplifying the outer keys of the updated first multidimensional hash table and the updated second multidimensional hash table according to the preset simplification template to obtain simplified outer keys; Determine whether each of the simplified outer keys of the updated first multidimensional hash table has a matching item in the updated second multidimensional hash table, and generate a billing data comparison result based on the determination result; The step of creating a first multidimensional hash table and a second multidimensional hash table based on the data of the bill group to be compared includes: Retrieve the first set of bill data and the second set of bill data; Each account data in the first group of bill data / second group of bill data is split into fields, and the strings are concatenated based on the split field names and field values to obtain several strings; Each of the strings is determined as an outer key, and a field mapping table corresponding to the outer key is created based on the field name and the field value; Generate a first multidimensional hash table / second multidimensional hash table based on each outer key and the corresponding field mapping table; The step of generating a bill data comparison result based on the judgment result includes: Based on the judgment result, the matching outer key is determined in the updated first multidimensional hash table, and the first field mapping table and the second field mapping table of the matching outer key are obtained in the updated first multidimensional hash table and the updated second multidimensional hash table respectively. Perform a difference comparison between the first field mapping table and the second field mapping table to obtain the difference fields, and record the difference fields in the bill data comparison result table.
2. The method as described in claim 1, characterized in that, The step of determining whether each outer key in the first multidimensional hash table has a matching entry in the second multidimensional hash table, and deleting the matching entries in both the first and second multidimensional hash tables to obtain an updated first and second multidimensional hash table includes: Iterate through each of the outer keys in the first multidimensional hash table and check in the second multidimensional hash table whether there is a common outer key; Delete the same outer key and the corresponding field mapping table from the first multidimensional hash table and the second multidimensional hash table to obtain the updated first multidimensional hash table and the updated second multidimensional hash table.
3. The method as described in claim 1, characterized in that, The step of generating a bill data comparison result based on the judgment result further includes: Based on the judgment result, the difference outer key is determined in the updated first multidimensional hash table, and each difference outer key and the corresponding field mapping table are added to the bill data comparison result table.
4. The method as described in claim 1, characterized in that, After the step of recording the difference field to the bill data comparison result table, the method further includes: The matching outer key is deleted from the updated second multidimensional hash table, and when all the simplified outer keys in the updated first multidimensional hash table have been traversed, it is determined whether there are any remaining simplified outer keys in the updated second multidimensional hash table. If so, the remaining simplified outer key and the corresponding field mapping table are added to the bill data comparison result table.
5. A device for comparing discrepancies in billing data, characterized in that, The device includes: The hash mapping module is used to create a first multidimensional hash table and a second multidimensional hash table based on the bill group data to be compared. Both the first multidimensional hash table and the second multidimensional hash table contain several outer keys and corresponding field mapping tables. The hash comparison module is used to determine whether each outer key in the first multidimensional hash table has a matching item in the second multidimensional hash table, and to delete the matching item in the first multidimensional hash table and the second multidimensional hash table to obtain the updated first multidimensional hash table and the updated second multidimensional hash table. The primary key simplification module is used to simplify the outer key of the updated first multidimensional hash table and the updated second multidimensional hash table; The result generation module is used to determine whether each simplified outer key of the updated first multidimensional hash table has a matching item in the updated second multidimensional hash table, and to generate a bill data comparison result based on the determination result. The hash mapping module is further configured to: acquire a first set of bill data and a second set of bill data; split each item in the first set of bill data / second set of bill data into fields, and concatenate strings based on the split field names and field values to obtain several strings; determine each string as an outer key, and create a field mapping table corresponding to the outer key based on the field name and field value; and generate a first multidimensional hash table / second multidimensional hash table based on each outer key and the corresponding field mapping table. The primary key simplification module is further configured to obtain a preset simplification template, and to simplify the outer keys of the updated first multidimensional hash table and the updated second multidimensional hash table according to the preset simplification template to obtain each of the simplified outer keys; The result generation module is further configured to determine the matching outer key in the updated first multidimensional hash table based on the judgment result, and obtain the first field mapping table and the second field mapping table of the matching outer key in the updated first multidimensional hash table and the updated second multidimensional hash table respectively; perform a difference comparison on the first field mapping table and the second field mapping table to obtain the difference field, and record the difference field in the bill data comparison result table.
6. A device for comparing discrepancies in billing data, characterized in that, The device includes a memory, a processor, and a billing data difference comparison program stored in the memory and executable on the processor, wherein the billing data difference comparison program, when executed by the processor, implements the steps of the billing data difference comparison method as described in any one of claims 1 to 4.
7. A storage medium, characterized in that, The storage medium stores a billing data difference comparison program, which, when executed by a processor, implements the steps of the billing data difference comparison method as described in any one of claims 1 to 4.