Search

CN-120634747-B - Bill data difference comparing method, device, equipment and storage medium

CN120634747BCN 120634747 BCN120634747 BCN 120634747BCN-120634747-B

Abstract

The application discloses a bill data difference comparison method, a device, equipment and a storage medium, and relates to the technical field of data processing, wherein the method comprises the steps of creating a first multi-dimensional hash table and a second multi-dimensional hash table according to bill group data to be compared, wherein the multi-dimensional hash table comprises a plurality of outer keys and corresponding field mapping tables; the method comprises the steps of judging whether each outer key in a first multi-dimensional hash table has a matching item in a second multi-dimensional hash table, deleting the matching item in the first multi-dimensional hash table and the second multi-dimensional hash table, simplifying the outer keys of the updated first multi-dimensional hash table and the updated second multi-dimensional hash table, judging whether each simplified outer key of the updated first multi-dimensional hash table has the matching item in the updated second multi-dimensional hash table, and generating a bill data comparison result according to a judgment result. According to the application, the complex and huge bill data are constructed into the multidimensional hash table for comparison, so that the time complexity of comparing the bill data is greatly reduced.

Inventors

  • ZHOU XIAOLIANG
  • MA YUANMING

Assignees

  • 七牛(深圳)云计算有限公司

Dates

Publication Date
20260512
Application Date
20250506

Claims (7)

  1. 1. A billing data discrepancy comparison method, the method comprising: creating a first multi-dimensional hash table and a second multi-dimensional hash table according to bill group data to be compared, wherein the first multi-dimensional hash table and the second multi-dimensional hash table both comprise a plurality of outer keys and corresponding field mapping tables; Judging whether each outer key in the first multi-dimensional hash table has a matching item in the second multi-dimensional hash table, deleting the matching item in the first multi-dimensional hash table and the second multi-dimensional hash table, and obtaining an updated first multi-dimensional hash table and an updated second multi-dimensional hash table; The method comprises the steps of obtaining a preset simplifying template, and simplifying and expressing outer keys in the updated first multi-dimensional hash table and the updated second multi-dimensional hash table according to the preset simplifying template to obtain simplified outer keys; judging whether each simplified outer layer key of the updated first multi-dimensional hash table has a matching item in the updated second multi-dimensional hash table, and generating a bill data comparison result according to a judgment result; The step of creating a first multidimensional hash table and a second multidimensional hash table according to bill group data to be compared comprises the following steps: acquiring a first set of billing data and a second set of billing data; Performing field level splitting on each piece of account data in the first group of bill data/the second group of bill data, and performing character string splicing based on the split field names and field values to obtain a plurality of character strings; Determining each character string as an outer layer key, and creating a field mapping table corresponding to the outer layer key according to the field name and the field value; generating a first multidimensional hash table/a second multidimensional hash table according to each outer layer key and the corresponding field mapping table; the step of generating the bill data comparison result according to the judgment result comprises the following steps: Determining a matching outer layer key in the updated first multi-dimensional hash table based on a judging result, and correspondingly acquiring a first field mapping table and a second field mapping table of the matching outer layer key in the updated first multi-dimensional hash table and the updated second multi-dimensional hash table; And performing differential comparison on the first field mapping table and the second field mapping table to obtain a difference field, and recording the difference field to the bill data comparison result table.
  2. 2. The method of claim 1, wherein the step of determining whether each of the outer keys in the first multi-dimensional hash table has a matching entry in the second multi-dimensional hash table, and deleting the matching entry in the first multi-dimensional hash table and the second multi-dimensional hash table, to obtain an updated first multi-dimensional hash table and an updated second multi-dimensional hash table, comprises: Traversing each outer key in the first multi-dimensional hash table, and inquiring whether the same outer key exists in the second multi-dimensional hash table; and deleting the same outer keys and the corresponding field mapping tables from the first multidimensional hash table and the second multidimensional hash table to obtain an updated first multidimensional hash table and an updated second multidimensional hash table.
  3. 3. The method of claim 1, wherein the step of generating a billing data comparison result based on the determination result further comprises: And determining a difference outer key in the updated first multi-dimensional hash table based on the judging result, and adding each difference outer key and a corresponding field mapping table to a bill data comparison result table.
  4. 4. The method of claim 1, wherein after the step of recording the difference field to the billing data comparison result table, further comprising: Deleting the matched outer keys from the updated second multi-dimensional hash table, and judging whether residual simplified outer keys exist in the updated second multi-dimensional hash table when all the simplified outer keys in the updated first multi-dimensional hash table are traversed; If yes, the remaining simplified outer keys and the corresponding field mapping table are added to the bill data comparison result table.
  5. 5. A billing data discrepancy comparing apparatus, the apparatus comprising: The hash mapping module is used for creating a first multi-dimensional hash table and a second multi-dimensional hash table according to bill group data to be compared, wherein the first multi-dimensional hash table and the second multi-dimensional hash table both comprise a plurality of outer keys and corresponding field mapping tables; the hash comparison module is used for judging whether each outer key in the first multi-dimensional hash table has a matching item in the second multi-dimensional hash table, deleting the matching item in the first multi-dimensional hash table and the second multi-dimensional hash table, and obtaining an updated first multi-dimensional hash table and an updated second multi-dimensional hash table; The primary key simplification module is used for carrying out outer key simplification on the updated first multi-dimensional hash table and the updated second multi-dimensional hash table; The result generation module is used for judging whether the matching items exist in the updated second multi-dimensional hash table of each simplified outer layer key of the updated first multi-dimensional hash table, and generating a bill data comparison result according to the judgment result; The hash mapping module is also used for acquiring a first group of bill data and a second group of bill data, splitting each piece of account data in the first group of bill data/the second group of bill data at a field level, and splicing character strings based on split field names and field values to obtain a plurality of character strings; The primary key simplification module is further configured to obtain a preset simplification template, and simplify the expression of the outer keys in the updated first multi-dimensional hash table and the updated second multi-dimensional hash table according to the preset simplification template to obtain each simplified outer key; The result generation module is further configured to determine a matching outer key in the updated first multi-dimensional hash table based on a determination result, correspondingly obtain a first field mapping table and a second field mapping table of the matching outer key in the updated first multi-dimensional hash table and the updated second multi-dimensional hash table, differentially compare the first field mapping table and the second field mapping table to obtain a difference field, and record the difference field to the bill data comparison result table.
  6. 6. A bill data difference comparing apparatus, characterized in that the apparatus comprises a memory, a processor and a bill data difference comparing program stored on the memory and executable on the processor, which when executed by the processor implements the steps of the bill data difference comparing method according to any one of claims 1 to 4.
  7. 7. A storage medium having stored thereon a billing data variance comparison program which when executed by a processor performs the steps of the billing data variance comparison method of any of claims 1 to 4.

Description

Bill data difference comparing method, device, equipment and storage medium Technical Field The present application relates to the field of data processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for comparing bill data differences. Background Along with the improvement of enterprise informatization degree, the automatic comparison of bill data in a financial management system becomes a core link for guaranteeing the transaction accounting accuracy. In a cross-version system upgrade or parallel test scenario, developers need to frequently compare billing data generated by new and old systems to verify whether business logic changes cause financial record anomalies. However, the conventional technical scheme generally adopts a nested circulation traversal comparison method, which has high time complexity, and takes a long time for single comparison in the face of daily millions of transaction amount bill data, thereby influencing system software development and lead time. Disclosure of Invention The application mainly aims to provide a bill data difference comparison method, device, equipment and storage medium, and aims to solve the technical problem that the existing bill data difference comparison time is long. In order to achieve the above object, the present application provides a bill data difference comparing method, which includes: creating a first multi-dimensional hash table and a second multi-dimensional hash table according to bill group data to be compared, wherein the first multi-dimensional hash table and the second multi-dimensional hash table both comprise a plurality of outer keys and corresponding field mapping tables; Judging whether each outer key in the first multi-dimensional hash table has a matching item in the second multi-dimensional hash table, deleting the matching item in the first multi-dimensional hash table and the second multi-dimensional hash table, and obtaining an updated first multi-dimensional hash table and an updated second multi-dimensional hash table; performing outer-layer key simplification on the updated first multi-dimensional hash table and the updated second multi-dimensional hash table; Judging whether each simplified outer layer key of the updated first multi-dimensional hash table has a matching item in the updated second multi-dimensional hash table, and generating a bill data comparison result according to a judgment result. In an embodiment, the step of creating the first multidimensional hash table and the second multidimensional hash table according to the bill group data to be compared includes: acquiring a first set of billing data and a second set of billing data; Performing field level splitting on each piece of account data in the first group of bill data/the second group of bill data, and performing character string splicing based on the split field names and field values to obtain a plurality of character strings; Determining each character string as an outer layer key, and creating a field mapping table corresponding to the outer layer key according to the field name and the field value; And generating a first multidimensional hash table/a second multidimensional hash table according to each outer layer key and the corresponding field mapping table. In an embodiment, the step of determining whether each outer key in the first multi-dimensional hash table has a matching entry in the second multi-dimensional hash table, and deleting the matching entry in the first multi-dimensional hash table and the second multi-dimensional hash table to obtain an updated first multi-dimensional hash table and an updated second multi-dimensional hash table includes: Traversing each outer key in the first multi-dimensional hash table, and inquiring whether the same outer key exists in the second multi-dimensional hash table; and deleting the same outer keys and the corresponding field mapping tables from the first multidimensional hash table and the second multidimensional hash table to obtain an updated first multidimensional hash table and an updated second multidimensional hash table. In an embodiment, the step of performing outer-layer key simplification on the updated first multi-dimensional hash table and the updated second multi-dimensional hash table includes: and obtaining a preset simplified template, and carrying out simplified expression on the outer keys in the updated first multi-dimensional hash table and the updated second multi-dimensional hash table according to the preset simplified template to obtain simplified outer keys. In an embodiment, the step of generating the bill data comparison result according to the determination result includes: And determining a difference outer key in the updated first multi-dimensional hash table based on the judging result, and adding each difference outer key and a corresponding field mapping table to a bill data comparison result table. In an embodiment, the