CN114416662A - File comparison method and device, electronic equipment and storage medium - Google Patents

File comparison method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114416662A
CN114416662A CN202210087309.3A CN202210087309A CN114416662A CN 114416662 A CN114416662 A CN 114416662A CN 202210087309 A CN202210087309 A CN 202210087309A CN 114416662 A CN114416662 A CN 114416662A
Authority
CN
China
Prior art keywords
file
compared
comparison
files
list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210087309.3A
Other languages
Chinese (zh)
Inventor
王海林
黄欣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202210087309.3A priority Critical patent/CN114416662A/en
Publication of CN114416662A publication Critical patent/CN114416662A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/168Details of user interfaces specifically adapted to file systems, e.g. browsing and visualisation, 2d or 3d GUIs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/194Calculation of difference between files

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a file comparison method, a file comparison device, electronic equipment and a storage medium, wherein the file comparison method comprises the following steps: acquiring first files to be compared under the first files to be compared, determining second files to be compared corresponding to the first files to be compared from the second files to be compared according to file names, respectively acquiring characteristic information of the first files to be compared and the second files to be compared based on a preset comparison rule, and comparing the characteristic information to generate a first comparison list; when the characteristic information is inconsistent, comparing the file contents of the first file to be compared with the corresponding second file to be compared to generate a second comparison list; and generating and displaying the comparison result display content according to the first comparison list and the second comparison list. According to the embodiment of the invention, the files are automatically compared from two dimensions of the characteristic information and the file content, so that the manual item-by-item execution process is omitted, the files are compared and displayed in batches in a multi-dimensional and hierarchical mode, and the problems of low comparison efficiency and low accuracy of the traditional comparison mode are solved.

Description

File comparison method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a file comparison method and apparatus, an electronic device, and a storage medium.
Background
With the change of information technology innovation, digitization, networking and intellectualization are deeply developed. Banking financial business modes relying on technologies such as big data and cloud computing are continuously showing up new. In order to ensure the safe and stable operation of the commercial bank information system and support the new business development requirements, the original system and architecture need to be optimized and modified.
However, the function modification of such a system is often complex, and the regression test needs to be performed on the whole function of the system, and the consistency of data and files before and after modification is maintained. For the consistency verification of files, the traditional method is to know the requirements, analyze rules, make a scheme, manually compare and summarize and analyze. Due to the fact that the commercial bank system is large in transaction amount, complex in business logic, large in the number of documents compared in the front-back mode and high in accuracy requirement, the traditional manual comparison method is large in workload and low in efficiency, and meanwhile risks of error omission exist.
Disclosure of Invention
The embodiment of the invention provides a file comparison method, a file comparison device, electronic equipment and a storage medium, and aims to solve the problems of low comparison efficiency, low comparison accuracy and comparison omission of a traditional comparison mode.
According to an aspect of the embodiments of the present invention, there is provided a file comparison method, including: acquiring a first file to be compared under a first file to be compared, and determining a second file to be compared corresponding to each first file to be compared from second files to be compared according to file names, wherein the first file to be compared and the second file to be compared are respectively a file before and after the bank system is optimized;
respectively acquiring the characteristic information of the first file to be compared and the second file to be compared based on a preset comparison rule, and comparing the characteristic information to generate a first comparison list;
when the characteristic information is inconsistent, comparing the file contents of the first file to be compared with the corresponding second file to be compared to generate a second comparison list;
and generating and displaying comparison result display contents according to the first comparison list and the second comparison list.
According to another aspect of the embodiments of the present invention, there is provided a file comparison apparatus, including: the system comprises an acquisition module, a comparison module and a comparison module, wherein the acquisition module is used for acquiring a first file to be compared under a first file to be compared, and determining a second file to be compared corresponding to each first file to be compared from a second file to be compared according to file names, wherein the first file to be compared and the second file to be compared are respectively a file before and after the bank system is optimized;
the first generation module is used for respectively acquiring the feature information of the first file to be compared and the second file to be compared based on a preset comparison rule, and comparing the feature information to generate a first comparison list;
the second generation module is used for comparing the file contents of the first file to be compared with the corresponding second file to be compared when the characteristic information is inconsistent, and generating a second comparison list;
and the display module is used for generating and displaying the display content of the comparison result according to the first comparison list and the second comparison list.
According to another aspect of the embodiments of the present invention, there is provided an electronic apparatus, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the file comparison method according to any embodiment of the present invention.
According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, where computer instructions are stored, and the computer instructions are used for enabling a processor to implement the file comparison method according to any embodiment of the present invention when executed.
According to the technical scheme of the embodiment of the invention, the files before and after the bank system is optimized are automatically compared from two dimensions of the characteristic information and the file content, so that the process of manual item-by-item execution is omitted, the files are compared and displayed in batches in a multi-dimensional and layered mode, and the problems of low comparison efficiency, low comparison accuracy and missing comparison in the traditional comparison mode are solved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a file comparison method according to an embodiment of the present invention;
FIG. 2 is a flowchart of a file comparison method according to a second embodiment of the present invention;
FIG. 3 is a diagram illustrating a comparison result of a document according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a file comparison apparatus according to a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device implementing a file comparison method according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example one
Fig. 1 is a flowchart of a file comparison method according to an embodiment of the present invention, where the present embodiment is applicable to a file comparison situation, the method may be executed by a file comparison method apparatus, the file comparison apparatus may be implemented in a hardware and/or software manner, and the file comparison apparatus may be integrally configured in an electronic device. As shown in fig. 1, the method includes:
s110, obtaining first files to be compared under the first files to be compared, and determining second files to be compared corresponding to the first files to be compared from the second files to be compared according to file names, wherein the first files to be compared and the second files to be compared are respectively the files before and after the bank system is optimized.
The folder in this embodiment may be a set used to assist a user in managing related files generated in banking system services. The file is an information set stored on a computer by taking a computer hard disk as a carrier, the type of the file can be a text document, a picture, a program and the like, and the document file is taken as an example in the embodiment. The file name is an identifier carried by a file, and the name of the file usually consists of a main name and an extension, wherein the extension refers to a letter sequence after the last point (.) in the file name. For example, HTML (HyperText Markup Language) files are identified by the. htm or. HTML extension; a GIF (Graphics exchange Format) file is identified with a GIF extension. The purpose is to distinguish between files of different formats, with different information having different storage formats. After the bank system is optimized, some inconsistency occurs in the files, so that the first file to be compared and the second file to be compared may not be completely identical.
Illustratively, S110 may include: acquiring a first file to be compared under a first folder to be compared according to the file comparison list; and for each first file to be compared, determining a second file to be compared corresponding to the current file to be compared from the second folder to be compared according to the similarity of the file names.
The file comparison list may be a list recording file names of the first files to be compared. And reading a first file to be compared in the first comparison folder into the table according to the file comparison list. The similarity may be a similarity between the file names of the first file to be compared and the second file to be compared. It will be appreciated that the file names are largely the same when the bank system is optimised, and some may be suffixed, for example, the file name may be followed by a modified version. And determining a second file to be compared corresponding to the first file to be compared in the second folder to be compared according to the similarity of the file names.
S120, respectively obtaining the feature information of the first file to be compared and the second file to be compared based on a preset comparison rule, and comparing the feature information to generate a first comparison list.
The characteristic information may include, but is not limited to, a file name, a file size, a file format, a file authority, a file generation time, a file code, a file content, and other information. The preset comparison rule may be a rule preset according to different service scenarios and used for selectively or customizing the feature information. For example, for service scenarios such as application program upgrade and database migration, the comparison rule may be set to select other feature information for comparison except for the file generation time and the file modification time.
The first comparison list may be a list of comparison results generated by comparing the first file to be compared with the second file to be compared according to the preset comparison rule.
In this embodiment, the feature information of the first file to be compared in the file comparison list may be obtained one by one, the obtained feature information of the first file to be compared is used as one column in the table, the feature information corresponding to the second file to be compared is used as another column in the table, the feature information in the two columns in the table is compared one by one, a comparison result is obtained, and the comparison result is recorded in a column different from the two columns in the table. And after the first files to be compared in the file comparison list are compared with the characteristic information, generating a first comparison detailed list according to the list. Specifically, the first comparison list may include the file names, the folders, the comparison results, and the like of the first file to be compared and the second file to be compared. If the comparison result in the first comparison list is that the feature information of the first file to be compared is consistent with the feature information of the second file to be compared, S130-S140 may not be executed.
Exemplarily, S120 may include: inquiring a file directory table of a first file to be compared based on a preset comparison rule to acquire first characteristic information of the first file to be compared, wherein the comparison rule comprises a characteristic information field to be compared; inquiring a file target table of a second file to be compared based on the comparison rule to obtain second characteristic information of the second file to be compared; and generating a first comparison list according to the first characteristic information and the second characteristic information.
The file directory table may be used to store characteristic information of the file. The characteristic information field is a field for identifying file attributes, such as file name, file size, file format, file authority, file generation time, file coding, file content and the like. In this embodiment, the characteristic information fields to be compared may be obtained according to the service requirement, or all the fields may be selected for comparison, or a part of the fields may be selected for comparison, for example, when the characteristic information comparison between the file format and the file authority is to be performed, only two fields of "file format" and "file authority" need to be selected.
Illustratively, the first characteristic information and the second characteristic each contain one or more items of a file name, a file size, a file format, a file authority, a file generation time, and a file content; generating a first comparison list according to the first characteristic information and the second characteristic information, wherein the first comparison list comprises: generating characteristic values according to one or more items of file names, file sizes, file formats, file permissions, file generation time and file contents, and comparing the first characteristic information with the second characteristic information based on the characteristic values to obtain characteristic comparison results; and generating a first comparison list based on the feature comparison result, the first file name to be compared and the second file name to be compared.
The characteristic value may refer to a specific characteristic value of the characteristic information of the file. For example, the feature value may be a hash value. The setting Algorithm may be MD5(Message-Digest Algorithm, widely used cryptographic Hash function) Algorithm, SHA1(Secure Hash Algorithm), CRC32(Cyclic Redundancy Check) Algorithm, and the like. In this embodiment, the feature value calculation for the file content is performed by using the MD5 hash algorithm.
If the comparison rule is set according to the service scene as a characteristic value corresponding to the file content, the first file to be compared and the second file to be compared are compared, the file content of the first file to be compared in the file comparison list is obtained, and the characteristic value of the file content is calculated by adopting a hash algorithm. And acquiring the file content of a second file to be compared corresponding to the first file to be compared, and calculating the characteristic value of the file content by adopting a Hash algorithm. And comparing the two characteristic values to obtain a characteristic comparison result. And if the deviation of the characteristic values does not exceed the set threshold value, determining that the file contents of the first file to be compared and the second file to be compared are the same.
Assuming that the comparison rule is set according to the service scenario to be based on respective characteristic values of the file size, the file format and the file content, and the first file to be compared and the second file to be compared are compared, the file size, the file format and the file content of the first file to be compared are obtained, and respective characteristic values are generated according to the file size, the file format and the file content. Similarly, respective characteristic values are generated according to the file size, the file format and the file content of the second file to be compared. And comparing the characteristic values one by one to obtain a characteristic comparison result. Alternatively, the characteristic value is generated according to the file size, the file format and the file content. And generating a characteristic value according to the file size, the file format and the file content of the second file to be compared. And comparing the two characteristic values to obtain a characteristic comparison result.
And if the deviation of each characteristic value does not exceed the set threshold value, determining that the file size, the file format and the file content of the first file to be compared and the second file to be compared are the same. And if the deviation exceeds the characteristic value of the set threshold, determining that the characteristic information corresponding to the characteristic values of the first file to be compared and the second file to be compared is different.
And comparing the characteristic values of the characteristic information of the first files to be compared in the file list one by one until all the first files to be compared in the file list are compared with the characteristic values of the characteristic information. And generating a first comparison list according to the feature comparison result of each file, the first file name to be compared and the second file name to be compared.
S130, when the characteristic information is inconsistent, comparing the file contents of the first file to be compared with the corresponding second file to be compared to generate a second comparison list.
The second comparison list may be a list of comparison results generated by comparing the contents of the first file to be compared with the contents of the second file to be compared. Optionally, after the second comparison list is generated, the comparison list may be output to a pre-specified folder, so that a user can conveniently check a place where the first to-be-compared file is inconsistent with the second to-be-compared file in a subsequent process. When the feature information of the two files is inconsistent, the file contents of the two files need to be compared. Specifically, the information recorded in the two files to be compared can be compared by using the EXCEL table, so as to obtain a content comparison result. And generating a second comparison list according to the content comparison result of each file, the first file name to be compared and the second file name to be compared.
And S140, generating and displaying comparison result display contents according to the first comparison list and the second comparison list.
The embodiment can divide the display comparison result according to the first comparison list and the second comparison list.
For example, a feature comparison summary is generated according to the first comparison list, and the feature comparison summary is displayed to display the comparison result from the first hierarchy. The characteristic comparison summary is a form of showing a characteristic comparison result of the file through a file comparison brief report. Specifically, the summary of feature comparison may show the feature comparison result of the file from the aspects of the total number of the comparison files, the comparison result, the file occupation ratio, the comparison time consumption, and the like. And for files which are different in the first comparison list, displaying the content comparison result of the files according to the second comparison list so as to display the comparison result from a second layer. Furthermore, for files with different file contents in the second comparison list, different rows are positioned, and the specific differences of the files with different file contents are displayed from the third layer.
The embodiment of the invention determines second files to be compared corresponding to all the first files to be compared from second folders to be compared by acquiring the first files to be compared under the first folders to be compared according to file names, respectively acquires the characteristic information of the first files to be compared and the second files to be compared based on a preset comparison rule, and compares the characteristic information to generate a first comparison list; when the characteristic information is inconsistent, comparing the file contents of the first file to be compared with the corresponding second file to be compared to generate a second comparison list; and generating and displaying the comparison result display content according to the first comparison list and the second comparison list. The files before and after the bank system is optimized are automatically compared from two dimensions of the characteristic information and the file content, the manual item-by-item execution process is omitted, the files are compared and displayed in batches in a multi-dimensional and layered mode, and the problems that the comparison efficiency is low, the comparison accuracy is low and the comparison is missed in the traditional comparison mode are solved.
Example two
Fig. 2 is a flowchart of a file comparison method according to a second embodiment of the present invention, which is based on the foregoing embodiments. And further optimizing the file contents of the first file to be compared and the corresponding second file to be compared when the characteristic information is inconsistent, and generating a second comparison detailed table. Wherein explanations of the same or corresponding terms as those of the above embodiments are omitted. Referring to fig. 2, the file comparison method provided in this embodiment specifically includes the following steps:
s210, obtaining first files to be compared under the first files to be compared, and determining second files to be compared corresponding to the first files to be compared from the second files to be compared according to file names, wherein the first files to be compared and the second files to be compared are respectively the files before and after the bank system is optimized.
S220, respectively obtaining the feature information of the first file to be compared and the second file to be compared based on a preset comparison rule, and comparing the feature information to generate a first comparison list.
Specifically, the comparison of the feature information is executed once when one file is read into the EXCEL, and then the comparison of all files in the file list corresponding to the folder to be compared is read again until the comparison of all files in the file list corresponding to the folder to be compared is completed, so that the first target file to be compared and the corresponding second target file to be compared, of which the feature information is inconsistent, are determined.
And S230, traversing the first comparison list, and determining the first target file to be compared and the corresponding second target file to be compared, wherein the characteristic information of the first target file to be compared is inconsistent with the characteristic information of the second target file to be compared.
In this embodiment, the comparison result is determined in a form of a traversal table as a first target file to be compared and a corresponding second target file to be compared, where the first target file and the corresponding second target file are inconsistent in feature information, specifically, comparison of feature information is performed once every time one file is read into the EXCEL, and then the file is read again until comparison of all files in a file list corresponding to the folder to be compared is completed, so that the first target file to be compared and the corresponding second target file to be compared, where the feature information is inconsistent, are determined.
S240, judging whether the file coding formats of the first target file to be compared and the corresponding second target file to be compared are the same.
The file code is used for indicating the number of bytes occupied by each character in the file content. For example, file encoding formats include ANSI encoding, UTF-8 encoding, UTF-16 encoding, GB2312, and the like. In this embodiment, the encoding format of the first file to be compared is obtained, and the encoding format of the second file to be compared is obtained, and whether the encoding formats of the two files are the same or not is compared. And S250, if the file coding formats are different, adjusting the file coding formats to be the same through a preset transcoding mode.
In one case, the preset transcoding mode is to convert the encoding format of the first file to be compared into the same encoding format as the second file to be compared. In a special case, the preset transcoding mode is to convert the encoding format of the second file to be compared into the same encoding format as the first file to be compared.
Suppose that the first file to be compared is a file encoded by using the UTF-8 encoding format, and the second file to be compared is a file encoded by using the GB2312 encoding format. The preset transcoding mode is to convert the coding format of the first file to be compared into the coding format which is the same as that of the second file to be compared. Then, the encoding format of the first file to be compared may be restored to the Unicode encoding, and then the Unicode encoding may be converted into the GB2312 encoding, so as to convert the encoding format of the first file to be compared into the GB 2312.
S260, reading the first target file to be compared and the corresponding second target file to be compared with the same file coding format into two columns of the EXCEL file respectively, and performing line feed processing on the file content of each column by adopting a preset separation rule.
The preset separation rule is used for dividing the file content of each target file to be compared. It should be noted that the preset separation rule may be flexibly configured according to an actual service scenario, and a specific implementation manner of the preset separation rule is not limited in the embodiment of the present invention. For example, the preset separation rule may be automatic line feed according to the number of characters, and the like.
After the line feed processing is performed on the file content of each column by using the preset separation rule, the line number of each line may be displayed in the EXCEL file, or the line number may not be displayed.
S270, comparing the first target files to be compared and the corresponding second target files to be compared with each other in the same file coding format line by line to obtain content comparison results, wherein the content comparison results comprise file content comparison results, line numbers and line comparison results.
Illustratively, a row in the file contents of the two target files to be compared is read respectively according to the row number for comparison, so as to obtain a row comparison result corresponding to the row number. And repeating the steps, reading the file contents corresponding to the line numbers in sequence, and comparing until the file contents of the last line are compared. And determining a file content comparison result according to the row comparison result corresponding to each row number.
Specifically, when the row comparison results corresponding to the row numbers are the same, it is determined that the file content comparison results are the same. And when the row comparison results corresponding to at least one row number are different, determining that the comparison results of the file contents are different.
S280, generating a second comparison list according to the content comparison result, the first target file name to be compared and the second target file name to be compared.
Illustratively, a second comparison list containing comparison details of the first target file name to be compared, the second target file name to be compared, the content comparison result and the like is generated. And saving the second comparison list to a preset folder. Specifically, comparison details with different file contents can be screened from the second comparison detail table according to the content comparison result and stored in the first folder, and comparison details with the same remaining content can be stored in the second folder. And when a query request for the comparison details of the files with different file contents is detected, acquiring the corresponding comparison details in the first folder and displaying the comparison details. Because the comparison details with different file contents are separately stored, the data amount required to be processed by the query request can be reduced, and the query speed of the query request is improved.
And S290, generating and displaying comparison result display contents according to the first comparison list and the second comparison list.
Illustratively, generating a first-layer comparison result display content according to the total number of comparison files, the number of inconsistent files, the proportion of inconsistent files and the comparison time consumption contained in the first comparison list, and displaying the first-layer comparison result. And acquiring a comparison detail checking request, generating a second layer of comparison result display content according to the file existence information and the file content comparison result contained in the second comparison detail table, and displaying the second layer of comparison result display content. And acquiring a viewing request for the file with inconsistent file content, generating a third layer of comparison result display content according to the row number and the row comparison result of the file with inconsistent file content, and displaying the third layer of comparison result display content.
For example, as shown in fig. 3, the TXT file is taken as an example in fig. 3 to show the result of the first alignment. The information of the total number of comparison files, the number of files with different comparison results, the ratio of different numbers of files, the time consumption of comparison and the like in the first comparison can be obtained.
Table 1 shows a second comparison list generated when the contents of the documents are compared with each other for different documents.
Table 1 second layer comparison result display content
Figure BDA0003487465830000121
Table 2 shows the display result of inconsistent comparison between the file contents generated by the first comparison list and the second comparison list of the file 1. Optionally, a column with inconsistent results can be marked with colors, so that the user can conveniently check the results.
Table 2 third-layer comparison result display content
Figure BDA0003487465830000122
Figure BDA0003487465830000131
According to the embodiment of the invention, through comparison of the file characteristic information and the file text content and other dimension information, whether the files are consistent or not can be automatically compared, the dimension of file comparison is enriched, and the comparison accuracy, the comparison efficiency and the comparison coverage rate are improved. The comparison results are displayed in a layered mode, the display granularity of each display layer is different, multi-dimensional collection analysis can be conveniently conducted on the comparison results, different viewing requirements can be met, and files with inconsistent comparison results and specific differences of the files can be rapidly located.
EXAMPLE III
Fig. 4 is a schematic structural diagram of a file comparison device according to a third embodiment of the present invention. As shown in fig. 4, the apparatus includes: an acquisition module 410, a first generation module 420, a second generation module 430, and a presentation module 440.
The obtaining module 410 is configured to perform obtaining of a first to-be-compared file in a first to-be-compared folder, and determine a second to-be-compared file corresponding to each first to-be-compared file from second to-be-compared folders according to file names, where the first to-be-compared folder and the second to-be-compared folder are folders before and after the bank system is optimized.
The first generating module 420 is configured to execute obtaining feature information of the first file to be compared and the second file to be compared respectively based on a preset comparison rule, and comparing the feature information to generate a first comparison list.
The second generating module 430 is configured to compare the file contents of the first file to be compared with the file contents of the corresponding second file to be compared when the feature information is inconsistent, and generate a second comparison list.
The display module 440 is configured to generate and display a comparison result display content according to the first comparison list and the second comparison list.
Optionally, the first generating module 420 includes:
the first to-be-compared file acquisition unit is used for acquiring a first to-be-compared file under the first to-be-compared folder according to the file comparison list;
and the second file to be compared determining unit is used for determining a second file to be compared corresponding to the current file to be compared from the second folder to be compared according to the similarity of the file names for each first file to be compared.
Optionally, the first generating module 420 includes:
the first characteristic information acquisition unit is used for inquiring a file directory table of a first file to be compared based on a preset comparison rule and acquiring first characteristic information of the first file to be compared, wherein the comparison rule comprises a characteristic information field to be compared;
the second characteristic information acquisition unit is used for inquiring the file target table of the second file to be compared based on the comparison rule and acquiring second characteristic information of the second file to be compared;
and a first comparison list generation unit configured to generate a first comparison list based on the first feature information and the second feature information.
The first characteristic information and the second characteristic information respectively comprise one or more items of file names, file sizes, file formats, file authorities, file generation time and file contents;
optionally, the first comparison list generating unit includes:
the characteristic comparison result acquisition subunit is used for generating a characteristic value according to one or more items of the file name, the file size, the file format, the file authority, the file generation time and the file content, and comparing the first characteristic information with the second characteristic information based on the characteristic value to obtain a characteristic comparison result;
and the first comparison detail table generating subunit is used for generating a first comparison detail table based on the feature comparison result, the first file name to be compared and the second file name to be compared.
Optionally, the second generating module 430 includes:
the first comparison list traversing unit is used for traversing the first comparison list and determining a first target file to be compared and a corresponding second target file to be compared, wherein the first target file to be compared and the second target file are inconsistent in characteristic information;
the file coding format judging unit is used for judging whether the file coding formats of the first target file to be compared and the corresponding second target file to be compared are the same or not;
the file coding format adjusting unit is used for adjusting the file coding formats to be the same through a preset transcoding mode if the file coding formats are different;
the content comparison result acquisition unit is used for comparing a first target file to be compared with a corresponding second target file to be compared with the same file coding format line by line to obtain a content comparison result, wherein the content comparison result comprises a file content comparison result, a line number and a line comparison result;
and the second comparison list generating unit is used for generating a second comparison list according to the content comparison result, the first target file name to be compared and the second target file name to be compared.
Optionally, before the content comparison result obtaining unit, the method further includes:
the EXCEL file reading unit is used for respectively reading a first target file to be compared and a corresponding second target file to be compared, which have the same file coding format, into two columns of the EXCEL file;
and the line feed unit is used for carrying out line feed processing on the file content of each column by adopting a preset separation rule.
Optionally, the second comparison list generating unit includes:
the first layer of comparison result display subunit is used for generating first layer of comparison result display contents according to the total number of comparison files, the number of inconsistent files, the proportion of the inconsistent files and the comparison time consumption contained in the first comparison list, and displaying the first layer of comparison results;
the second-layer comparison result display subunit is used for generating second-layer comparison result display contents according to the file existence information and the file content comparison result contained in the second comparison list and displaying the second-layer comparison result display contents;
and the third layer comparison result display subunit is used for acquiring a viewing request of the file with inconsistent file content, generating third layer comparison result display content according to the row number and the row comparison result of the file with inconsistent file content, and displaying the third layer comparison result display content.
The file comparison device provided by the embodiment of the invention can execute the file comparison method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example four
FIG. 5 illustrates a schematic diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 5, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM)12, a Random Access Memory (RAM)13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 can perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM)12 or the computer program loaded from a storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, or the like. Processor 11 performs the various methods and processes described above, such as methods 1-7.
In some embodiments, methods 1-7 may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more of the steps of methods 1-7 described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the methods 1-7 by any other suitable means (e.g., by way of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on a machine, as a stand-alone software package partly on a machine and partly on a remote machine or entirely on a remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A file comparison method is characterized by comprising the following steps:
acquiring a first file to be compared under a first file to be compared, and determining a second file to be compared corresponding to each first file to be compared from second files to be compared according to file names, wherein the first file to be compared and the second file to be compared are respectively a file before and after the bank system is optimized;
respectively acquiring the characteristic information of the first file to be compared and the second file to be compared based on a preset comparison rule, and comparing the characteristic information to generate a first comparison list;
when the characteristic information is inconsistent, comparing the file contents of the first file to be compared with the corresponding second file to be compared to generate a second comparison list;
and generating and displaying comparison result display contents according to the first comparison list and the second comparison list.
2. The method according to claim 1, wherein the obtaining of the first files to be compared under the first folders to be compared and the determining of the second files to be compared corresponding to each of the first files to be compared from the second folders to be compared according to the file names comprises:
acquiring a first file to be compared under a first folder to be compared according to the file comparison list;
and for each first file to be compared, determining a second file to be compared corresponding to the current file to be compared from the second folder to be compared according to the similarity of the file names.
3. The method according to claim 1, wherein the obtaining feature information of the first file to be compared and the second file to be compared based on a preset comparison rule, and comparing the feature information to generate a first comparison list comprises:
inquiring a file directory table of the first file to be compared based on a preset comparison rule to acquire first characteristic information of the first file to be compared, wherein the comparison rule comprises a characteristic information field to be compared;
inquiring a file target table of the second file to be compared based on the comparison rule to obtain second characteristic information of the second file to be compared;
and generating a first comparison list according to the first characteristic information and the second characteristic information.
4. The method according to claim 3, wherein the first characteristic information and the second characteristic each include one or more of a file name, a file size, a file format, a file authority, a file generation time, and a file content;
generating a first comparison list according to the first characteristic information and the second characteristic information includes:
generating characteristic values according to one or more items of the file name, the file size, the file format, the file authority, the file generation time and the file content, and comparing the first characteristic information with the second characteristic information based on the characteristic values to obtain a characteristic comparison result;
and generating a first comparison list based on the feature comparison result, the first file name to be compared and the second file name to be compared.
5. The method according to claim 1, wherein when the feature information is inconsistent, comparing the file contents of the first file to be compared with the corresponding second file to be compared to generate a second comparison list, comprising:
traversing the first comparison list, and determining a first target file to be compared and a corresponding second target file to be compared, wherein the characteristic information of the first target file is inconsistent with the characteristic information of the second target file to be compared;
judging whether the file coding formats of the first target file to be compared and the corresponding second target file to be compared are the same;
if not, adjusting the file coding formats to be the same through a preset transcoding mode;
comparing the first target files to be compared and the corresponding second target files to be compared with each other in the same file coding format line by line to obtain content comparison results, wherein the content comparison results comprise file content comparison results, line numbers and line comparison results;
and generating a second comparison list according to the content comparison result, the first target file name to be compared and the second target file name to be compared.
6. The method according to claim 5, wherein before comparing the first target file to be compared and the corresponding second target file to be compared with each other in the same file encoding format row by row, the method further comprises:
respectively reading a first target file to be compared and a corresponding second target file to be compared, which have the same file coding format, into two columns of the EXCEL file;
and performing line feed processing on the content of each column of files by adopting a preset separation rule.
7. The method according to claim 5, wherein the generating and displaying comparison result display contents according to the first comparison list and the second comparison list comprises:
generating a first layer of comparison result display content according to the total number of comparison files, the number of inconsistent files, the proportion of inconsistent files and the comparison time consumption contained in the first comparison list, and displaying the first layer of comparison results;
acquiring a comparison detail checking request, generating second-layer comparison result display content according to the file existence information and the file content comparison result contained in the second comparison detail table, and displaying the second-layer comparison result display content;
acquiring a viewing request for files with inconsistent file contents, generating a third layer of comparison result display contents according to the row number and the row comparison result of the files with inconsistent file contents, and displaying the third layer of comparison result display contents.
8. A file comparison device, comprising:
the system comprises an acquisition module, a comparison module and a comparison module, wherein the acquisition module is used for acquiring a first file to be compared under a first file to be compared, and determining a second file to be compared corresponding to each first file to be compared from a second file to be compared according to file names, wherein the first file to be compared and the second file to be compared are respectively a file before and after the bank system is optimized;
the first generation module is used for respectively acquiring the feature information of the first file to be compared and the second file to be compared based on a preset comparison rule, and comparing the feature information to generate a first comparison list;
the second generation module is used for comparing the file contents of the first file to be compared with the corresponding second file to be compared when the characteristic information is inconsistent, and generating a second comparison list;
and the display module is used for generating and displaying the display content of the comparison result according to the first comparison list and the second comparison list.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the file alignment method of any one of claims 1-7.
10. A computer-readable storage medium storing computer instructions for causing a processor to implement the file comparison method according to any one of claims 1 to 7 when executed.
CN202210087309.3A 2022-01-25 2022-01-25 File comparison method and device, electronic equipment and storage medium Pending CN114416662A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210087309.3A CN114416662A (en) 2022-01-25 2022-01-25 File comparison method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210087309.3A CN114416662A (en) 2022-01-25 2022-01-25 File comparison method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114416662A true CN114416662A (en) 2022-04-29

Family

ID=81277717

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210087309.3A Pending CN114416662A (en) 2022-01-25 2022-01-25 File comparison method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114416662A (en)

Similar Documents

Publication Publication Date Title
US20210200939A1 (en) Document conversion, annotation, and data capturing system
CN112052138A (en) Service data quality detection method and device, computer equipment and storage medium
US11042529B2 (en) System of migration and validation
CN112636957A (en) Early warning method and device based on log, server and storage medium
CN112084179B (en) Data processing method, device, equipment and storage medium
CN110955801B (en) Knowledge graph analysis method and system for cognos report indexes
CN115617888A (en) Data import method, device, equipment, storage medium and product
CN113869014A (en) Extraction method and device of table data, storage medium and electronic equipment
US10956659B1 (en) System for generating templates from webpages
CN114416662A (en) File comparison method and device, electronic equipment and storage medium
CN115328898A (en) Data processing method and device, electronic equipment and medium
CN115048352A (en) Log field extraction method, device, equipment and storage medium
CN112507677A (en) Method and device for inputting and displaying electronic form
CN113742321A (en) Data updating method and device
CN114611155B (en) Data management node verification method, device, equipment and medium
CN114492413B (en) Text proofreading method and device and electronic equipment
CN113722642B (en) Webpage conversion method and device, electronic equipment and storage medium
CN110134691B (en) Data verification method, device, equipment and medium
CN113254826A (en) Dump file processing method and device
CN115756575A (en) Submission record acquisition method, device, equipment and storage medium
CN115063109A (en) Data processing method, device, equipment and medium
CN114581680A (en) Table information extraction method and device, electronic equipment and storage medium
CN117762903A (en) Audit method and device, medium and equipment of database
CN113110873A (en) Method and apparatus for unifying system coding specifications
CN115981657A (en) Code generation method and device, electronic equipment and readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination