File comparison method and device, equipment and storage medium

CN117669534BActive Publication Date: 2026-10-16PEOPLE'S INSURANCE COMPANY OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311714000.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-13
Publication Date
2026-10-16
Estimated Expiration
2043-12-13

AI Technical Summary

Technical Problem

[0005]本申请提供一种文件对比方法、装置、设备及存储介质,用以解决当前数据对比的方式资源占用较多的问题

Benefits of technology

[0016] The file comparison method, apparatus, device, and storage medium provided in this application obtain the current time after the file comparison process begins, read the file group attributes of the target file group, obtain the verification duration threshold corresponding to the file group attributes, and if the time difference between the file generation time and the current time is greater than the verification duration threshold, then read the comparison file group corresponding to the target file group and compare whether the two file groups are the same. This realizes the determination of whether to perform comparison based on the file attributes and generation time, reducing the workload of file comparison and reducing the resource consumption of file comparison.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117669534B_ABST
    Figure CN117669534B_ABST
Patent Text Reader

Abstract

The application provides a file comparison method and device, equipment and storage medium, and belongs to the technical field of big data and data processing. The method comprises the following steps: in response to the start of a file comparison process, obtaining a current time; reading file group attributes of a target file group, wherein the file group attributes comprise a file generation time, and the target file group is any file group; determining a verification duration threshold according to the file group attributes; calculating a time difference between the current time and the file generation time; if the time difference is greater than the verification duration threshold, reading a control file group corresponding to the target file group; and comparing whether the target file group and the control file group are the same. The method solves the problem of high resource occupation in the current data comparison mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data and data processing technology, and in particular to a document comparison method, apparatus, device and storage medium. Background Technology

[0002] Currently, a large amount of data is stored in cloud servers. When accessing data, it is necessary to ensure that the data has not been tampered with.

[0003] Currently, existing technologies typically use two data storage locations to store the same data, and compare the data in the two storage locations when retrieving the data to verify the correctness of the data.

[0004] However, the inventors have discovered that the existing technology has at least the following technical problems: the current data comparison method consumes a lot of resources. Summary of the Invention

[0005] This application provides a document comparison method, apparatus, device, and storage medium to solve the problem of excessive resource consumption in current data comparison methods.

[0006] In a first aspect, this application provides a file comparison method, comprising: in response to the start of the file comparison process, obtaining the current time; reading the file group attributes of the target file group, wherein the file group attributes include the file generation time, and the target file group is any file group; determining a verification duration threshold based on the file group attributes; calculating the time difference between the current time and the file generation time; if the time difference is greater than the verification duration threshold, reading the control file group corresponding to the target file group; and comparing whether the target file group and the control file group are the same.

[0007] In one possible implementation, the target file group includes at least one table to be compared, and the reference file group includes at least one standard table. Accordingly, comparing whether the target file group and the reference file group are the same includes: obtaining a first length of the table to be compared and a second length of the target table, wherein the target table is any table in the standard table; if the first length is different from the second length corresponding to each standard table, then the identifier of the table to be compared is written into an error message; if the first length and the second length are the same, then the target table is determined as the reference table; reading the first data in the table to be compared and the second data in the reference table; if both the first data and the second data include at least one field content and a corresponding field number, then the field content in the first data and the second data is compared according to the field number; if both the first data and the second data include at least one field content but do not include the corresponding field number, then the field content of the first data and the second data is directly compared; if the field content of the first data and the second data are different, then the first data is written into an error message; and the error message is sent to a prompting terminal.

[0008] In one possible implementation, comparing the field contents of the first data and the second data includes: reading the target field content of the first data, where the target field content is any field content; identifying the field content in the second data whose first character is the same as the first character of the target field content as the field content to be compared; if the second character of the target field content to be compared is the same as the second character of the target field content, then the target field content to be compared is identified as a new field content to be compared, and the process of comparing characters is performed again, until all characters of the target field content are traversed, or until the Nth character of the target field content to be compared is no longer the same as the Nth character of the target field content, where the target field content to be compared is any field content to be compared, and N is a positive integer; if the Nth character of the target field content to be compared is no longer the same as the Nth character of the target field content, then it is determined that the first data and each of the second data are different.

[0009] In one possible implementation, the file group attributes also include the number of modifications, file level, and file type; accordingly, based on the file group attributes, the verification duration threshold is determined, including: finding a preset type-to-type value correspondence based on the file type to obtain the target type value; inputting the number of modifications, file level, and target type value into a preset threshold calculation formula to obtain the verification duration threshold.

[0010] In one possible implementation, the file group attributes also include modification records, file level, and file type; accordingly, based on the file group attributes, the verification duration threshold is determined, including: looking up a preset duration correspondence table to obtain the verification duration thresholds corresponding to the modification records, file level, and file type, wherein the duration correspondence table stores the correspondence between modification records, file level, file type, and verification duration thresholds.

[0011] In one possible implementation, the file group attributes also include modification history, file level, and file type; accordingly, based on the file group attributes, the verification duration threshold is determined, including: if the modification history is not empty, then the preset modified threshold is determined as the verification duration threshold; if the modification history is empty, then based on the file level and file type, the preset correspondence between the file level, file type, and threshold is found to obtain the verification duration threshold.

[0012] Secondly, this application provides a file comparison device, comprising: a time acquisition module for acquiring the current time in response to the start of the file comparison process; an attribute reading module for reading the file group attributes of a target file group, wherein the file group attributes include the file generation time, and the target file group is any file group; a threshold determination module for determining a verification duration threshold based on the file group attributes; a time difference calculation module for calculating the time difference between the current time and the file generation time; a file group reading module for reading the corresponding control file group of the target file group if the time difference is greater than the verification duration threshold; and a file group comparison module for comparing whether the target file group and the control file group are the same.

[0013] Thirdly, this application provides an electronic device, including: a processor and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, causing the processor to perform the file comparison method as described in the first aspect.

[0014] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the file comparison method as described in the first aspect.

[0015] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the file comparison method as described in the first aspect.

[0016] The file comparison method, apparatus, device, and storage medium provided in this application obtain the current time after the file comparison process begins, read the file group attributes of the target file group, obtain the verification duration threshold corresponding to the file group attributes, and if the time difference between the file generation time and the current time is greater than the verification duration threshold, then read the comparison file group corresponding to the target file group and compare whether the two file groups are the same. This realizes the determination of whether to perform comparison based on the file attributes and generation time, reducing the workload of file comparison and reducing the resource consumption of file comparison. Attached Figure Description

[0017] 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.

[0018] Figure 1 This is a schematic diagram illustrating an application scenario of the document comparison method provided in the embodiments of this application;

[0019] Figure 2 A flowchart illustrating the document comparison method provided in this application embodiment;

[0020] Figure 3A schematic diagram of the document comparison device provided in the embodiments of this application;

[0021] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0022] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0023] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0024] With the continuous development of information technology, a large amount of data is stored in the cloud. In order to ensure the security of cloud data, data is usually backed up and stored.

[0025] When data needs to be read, the data in different storage locations is compared first to ensure the correctness of the data and prevent the data from being tampered with. The current comparison of data usually involves a full comparison of the data, which consumes a lot of resources.

[0026] To address the aforementioned technical problems, the inventors propose the following technical concept: By combining the attributes and generation time of the file group, it is determined whether the file group needs to be compared, and the files are compared only if comparison is required.

[0027] This application is used in scenarios involving document comparison. It should be noted that the data involved in this application (including but not limited to data used for analysis, stored data, and displayed data) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0028] Figure 1 This is a schematic diagram illustrating an application scenario of the document comparison method provided in this application embodiment. For example... Figure 1 In this scenario, the following components are included: terminal device 101 and server 102.

[0029] In the specific implementation process, the terminal device 101 may include a computer, server, tablet, mobile phone, PDA (Personal Digital Assistant), and laptop, etc., which can input data.

[0030] Server 102 can be implemented using a single server or a cluster of multiple servers with more powerful processing capabilities and higher security. Where possible, it can also be replaced by a computer or laptop with strong computing power.

[0031] The connection between server 102 and terminal device 101 can be either wired or wireless.

[0032] Server 102 is used to receive instructions or information sent by terminal device 101, perform file comparison process, obtain the time of execution of file comparison process, read the attributes of file group, determine the verification time threshold based on file group attributes, calculate the time difference between the current time and the file generation time in file group attributes, and perform file group comparison if the time difference is greater than the verification time threshold.

[0033] It is understood that the structure illustrated in the embodiments of this application does not constitute a specific limitation on the document comparison method. In other feasible embodiments of this application, the above architecture may include more or fewer components than illustrated, or combine some components, or split some components, or arrange different components, which can be determined according to the actual application scenario and is not limited here. Figure 1 The components shown can be implemented by hardware, software, or a combination of both.

[0034] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0035] Figure 2 This is a flowchart illustrating the document comparison method provided in an embodiment of this application. The execution entity of this embodiment may be... Figure 1 The server 102 in this embodiment can also be a computer and / or a mobile phone, etc., and this embodiment does not impose any special restrictions on it. Figure 2 As shown, the method includes:

[0036] S201: In response to the start of the file comparison process, obtain the current time.

[0037] In this step, the file comparison process can begin upon receiving instructions or information from the terminal device. The file comparison process can correspond to at least one file group or a data storage location. The current time can be the start time of the file comparison process. The current time can be obtained by using a timestamp or by using a preset command or interface.

[0038] S202: Read the filegroup attributes of the target filegroup, where the filegroup attributes include the file creation time, and the target filegroup is any filegroup.

[0039] In this step, the filegroup attributes of the target filegroup can be read from the files in the filegroup; alternatively, the filegroup attributes can be obtained by finding the correspondence between the filegroup name and the filegroup attributes; or the attributes of each file in the target filegroup can be read, and the attributes of the filegroup can be determined together based on the attributes of each file.

[0040] In this process, the attributes of a file group are determined based on the attributes of each file. For example, the number of modifications to all files in the file group is determined as the number of modifications to the file group, the average or maximum value of the file levels in the file group is taken as the file level corresponding to the file group, and the type of the files in the file group is taken as the type of the file group.

[0041] S203: Determine the verification duration threshold based on the file group attributes.

[0042] This step may include looking up a preset table or key-value pair to obtain the verification duration threshold corresponding to the file group attribute.

[0043] S204: Calculate the time difference between the current time and the file creation time.

[0044] This step may include subtracting the file generation time from the current time to obtain the time difference.

[0045] S205: If the time difference is greater than the verification duration threshold, then read the control file group corresponding to the target file group.

[0046] This step may include reading the corresponding control file group based on the identifier of the target file group when the time difference is greater than the verification duration threshold; or it may include using the file group with the same identifier as the target file group as the control file group. In this case, the identifier corresponding to the target file group can be used to find the control file group.

[0047] S206: Compare whether the target file group and the control file group are the same.

[0048] This step may include using a preset program or script to compare whether the target file group and the control file group are the same; it may also include calculating the file digests of the target file group and the control file group, and if the two file digests are the same, then the target file group and the control file group are the same.

[0049] As can be seen from the description of the above embodiments, the embodiments of this application obtain the current time after the file comparison process starts, read the file group attributes of the target file group, obtain the verification time threshold corresponding to the file group attributes, and if the time difference between the file generation time and the current time is greater than the verification time threshold, then read the comparison file group corresponding to the target file group and compare whether the two file groups are the same. This realizes the determination of whether to perform comparison based on the file attributes and generation time, reducing the workload of file comparison and reducing the resource consumption of file comparison.

[0050] In one possible implementation, the target file group includes at least one table to be compared, and the comparison file group includes at least one standard table.

[0051] Both the comparison table and the standard table can be stored in formats such as tables or strings.

[0052] Accordingly, in step S206 above, comparing whether the target file group and the control file group are the same includes:

[0053] S2061: Obtain the first length of the table to be compared and the second length of the target table, wherein the target table is any table in the standard table.

[0054] In this step, a preset program or script can be used to read the first length of the table to be compared and the second length of the target table. The lengths of these two tables can include the number of characters, memory usage, etc.

[0055] S2062: If the first length is different from the second length corresponding to each standard table, then write the identifier of the table to be compared into the error message.

[0056] In this step, for example, if the first length of the table to be compared is 2763 characters, the second length of the first standard table is 2777 characters, the second length of the second standard table is 2563 characters, and the second length of the third standard table is 2653 characters, then the second length of the table to be compared is different from that of each standard table, and the identifier of the table to be compared is written into the error message.

[0057] S2063: If the first length is the same as the second length, then the target table is determined as the reference table.

[0058] In this step, for example, if the length of the table to be compared is 2565 characters, the length of standard table A is 1723 characters, and the length of standard table B is 2565 characters, then standard table B is determined as the reference table. As another example, if the length of the table to be compared is 2331 characters, the length of standard table A is 2264 characters, the length of standard table B is 2387 characters, and the length of standard table C is 2331 characters, then standard table C is determined as the reference table.

[0059] S2064: Read the first data in the comparison table and the second data in the reference table.

[0060] In this step, preset commands or programs can be used to read the first data in the comparison table and the second data in the reference table.

[0061] S2065: If both the first data and the second data include at least one field content and the field number corresponding to the field content, then compare the field content in the first data and the second data according to the field number.

[0062] In this step, the field content can be a field, a dictionary, key-value pairs, etc. The field content can be written on separate lines or in text format. Different field contents can correspond to different field numbers; therefore, comparing the field contents in the first and second data based on the field numbers can include comparing field contents with the same corresponding field number.

[0063] S2066: If both the first data and the second data include at least one field content, but do not include the field number corresponding to the field content, then directly compare the field content of the first data and the second data.

[0064] In this step, without field numbers, any field content in the first data is compared with the field content in the second data until a field content in the second data that is the same as this field content is found, or if no field content in the second data is found to be the same as this field content, then the first data and the second data are determined to be different.

[0065] S2067: If the field contents of the first data and the second data are different, write the first data into the error message.

[0066] This step may include writing the first data to a preset data writing position in the error message if the field content in the first data is different from the field content in the second data.

[0067] S2068: Send the error message to the prompt terminal.

[0068] In this step, error messages can be sent to the prompting terminal in formats such as application information, mini-program messages, interfaces, and messages.

[0069] As can be seen from the description of the above embodiments, the embodiments of this application obtain the length of the comparison table and the length of the target table and compare them to obtain a target table with the same length as the comparison table. Then, the data in the target table with the same length is compared with the data in the comparison table. Data in the comparison table that does not have the same length or the data in the comparison table that does not have the same data is written into error information and the error information is sent to the prompting terminal, thereby reducing the amount of data comparison and reducing the amount of resource consumption.

[0070] In one possible implementation, step S2066 above, comparing the field contents of the first data and the second data, includes:

[0071] S601: Read the content of the target field of the first data, where the content of the target field can be any field content.

[0072] In this step, preset commands and scripts can be used to read the field content of the first data.

[0073] S602: The field content in the second data whose first character is the same as the first character of the target field content is determined as the field content to be compared.

[0074] This step may include determining the first character of the target field content as the target character. If the first character of any field content in the second data is the same as the target character, then that field is determined as the field content to be compared.

[0075] For example, if the target field is "user name", and the second data includes fields "address", "username", and "usage pattern", then "user name" and "usage pattern" will be used as the comparison field because they share the same first character as the target field. The target field can also be other content, in which case the comparison field will be different.

[0076] S603: If the second character of the target field to be compared is the same as the second character of the target field, then the target field to be compared is determined as the new field to be compared, and the process of comparing characters is executed again until all characters of the target field are traversed, or until the Nth character of the target field to be compared is no longer the same as the Nth character of the target field, where the target field to be compared is any field to be compared, and N is a positive integer.

[0077] In this step, continuing with the example in step S602 above, if the second character of both "user name" and "usage pattern" is the same as "user name", then these two fields are identified as new comparison targets. Next, the third character is compared to see if it matches the third character of the target comparison field. The character comparison process includes comparing the same position characters between the target comparison field and the target field, similar to the first half of step S603.

[0078] S604: If the Nth character of the target field to be compared is the same as the Nth character of the target field, then it is determined that the first data and each of the second data are different.

[0079] In this step, if the characters at the same positions in the target field and the target field are different, then the first data and each of the second data are different.

[0080] As can be seen from the description of the above embodiments, the embodiments of this application read the target field content of the first data, compare the field content of the second data with the characters at each position in the target field content, and determine whether there is a field content with the same target field content in the second data. This enables the determination of whether there is corresponding second data in the first data through full comparison without field serial numbers, which facilitates the subsequent generation of error information.

[0081] In one possible implementation, step S203 above, determining the verification duration threshold based on the file group attributes, includes:

[0082] S203N: Based on the file group attributes, find the preset attribute-threshold correspondence to obtain the corresponding verification duration threshold.

[0083] In this step, the correspondence between attributes and thresholds can be pre-set by staff based on experimental data or empirical parameters, and can be stored in tabular or key-value pair format.

[0084] As can be seen from the description of the above embodiments, the embodiments of this application obtain the verification time threshold corresponding to the file group attribute by finding the preset attribute-threshold correspondence relationship, and adopt different verification time thresholds for different file group attributes, so as to facilitate the subsequent use of the verification time threshold to determine whether it is necessary to compare files.

[0085] In one possible implementation, file group attributes also include modification count, file level, and file type;

[0086] Accordingly, in step S203 above, determining the verification duration threshold based on the file group attributes includes:

[0087] S203A1: Based on the file type, find the preset type-to-type value correspondence to obtain the target type value.

[0088] In this step, the correspondence between type and type value can be pre-set by staff based on experimental data and empirical parameters, and stored in formats such as tables and key-value pairs.

[0089] S203A2: Input the number of modifications, file level, and target type value into the preset threshold calculation formula to obtain the verification time threshold.

[0090] In this step, the preset threshold calculation formula is as follows:

[0091] T MAX =T0-alog b (n+1)-cL+dF

[0092] In the formula, T0, a, b, c, and d are constants, n represents the number of modifications, and log b (n+1) represents the logarithm to the base b (n+1), L represents the file level, and F represents the target type value.

[0093] The constants in the threshold calculation formula can be preset by staff based on experimental data or empirical parameters.

[0094] As can be seen from the description of the above embodiments, the embodiments of this application obtain the verification time threshold by finding the file type value corresponding to the file type and inputting the file type value, file level and target type value into the threshold calculation formula. This enables the verification time threshold to decrease as the number of modifications increases and the file level increases. Different initial verification time thresholds are assigned to file groups of different levels, thereby reducing resource consumption and increasing file security.

[0095] In one possible implementation, file group attributes also include modification history, file level, and file type.

[0096] In this step, the modification history can include the modification time, number of modifications, etc. The file level can be the level set when the file was created or modified. The file type can include the file format, file extension, etc.

[0097] Accordingly, step S203 above, determining the verification duration threshold based on the file group attributes, includes:

[0098] S203B: Look up the preset duration correspondence table to obtain the verification duration threshold corresponding to the modification record, file level, and file type. The duration correspondence table stores the correspondence between the modification record, file level, file type, and verification duration threshold.

[0099] In this step, the duration mapping table can be stored in tabular format and can be pre-set by staff.

[0100] In one possible implementation, step S203 includes: reading modification records to obtain the number of modifications, inputting the number of modifications, file level, and file type into a pre-trained neural network model to obtain a verification duration threshold.

[0101] As can be seen from the description of the above embodiments, the embodiments of this application combine modification records, file level and file type to obtain the corresponding verification time threshold, realize detailed verification time thresholds for different attributes of file groups, make the verification time thresholds conform to the attributes of file groups, and reduce the resource consumption generated by comparison files.

[0102] In one possible implementation, file group attributes also include modification history, file level, and file type.

[0103] Accordingly, in step S203 above, determining the verification duration threshold based on the file group attributes includes:

[0104] S203C1: If the modified record is not empty, the preset modified threshold will be set as the verification duration threshold.

[0105] This step may include taking a preset modified threshold as the verification duration threshold if the modified record contains records.

[0106] The modified threshold can be preset by staff based on experimental data or empirical parameters.

[0107] S203C2: If the modification record is empty, then based on the file level and file type, find the correspondence between the preset file level, file type and threshold to obtain the verification time threshold.

[0108] In this step, an empty modification record can include either no content being written to the modification record file or no modification record being made.

[0109] The correspondence between file level, file type and threshold can also be preset by staff based on experimental data or experience parameters and stored in a tabular format.

[0110] As can be seen from the description of the above embodiments, the embodiments of this application determine whether the modification record is empty. If there is a modification record, a preset modified threshold is used as the verification time threshold. If there is no modification record, the corresponding relationship is found to obtain the verification time threshold corresponding to the file level and file type. This realizes the application of different verification time thresholds to modified file groups, reducing the resource consumption of file comparison while ensuring the security of file groups.

[0111] Figure 3 This is a schematic diagram of the document comparison device provided in an embodiment of this application. Figure 3 As shown, the file comparison device 300 includes: a time acquisition module 301, an attribute reading module 302, a threshold determination module 303, a time difference calculation module 304, a file group reading module 305, and a file group comparison module 306.

[0112] The time acquisition module 301 is used to acquire the current time in response to the start of the file comparison process.

[0113] The attribute reading module 302 is used to read the file group attributes of the target file group, where the file group attributes include the file creation time, and the target file group can be any file group.

[0114] The threshold determination module 303 is used to determine the verification duration threshold based on the file group attributes.

[0115] The time difference calculation module 304 is used to calculate the time difference between the current time and the file generation time.

[0116] The file group reading module 305 is used to read the corresponding control file group of the target file group if the time difference is greater than the verification duration threshold.

[0117] The file group comparison module 306 is used to compare whether the target file group and the control file group are the same.

[0118] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0119] In one possible implementation, the target file group includes at least one table to be compared, and the comparison file group includes at least one standard table.

[0120] Accordingly, the file group comparison module 306 is specifically used to obtain the first length of the table to be compared and the second length of the target table, where the target table is any table in the standard tables. If the first length is different from the second length corresponding to each standard table, the identifier of the table to be compared is written into the error message. If the first length and the second length are the same, the target table is determined as the reference table. The first data in the table to be compared and the second data in the reference table are read. If both the first data and the second data include at least one field content and the corresponding field number, the field content in the first data and the second data is compared according to the field number. If both the first data and the second data include at least one field content but do not include the corresponding field number, the field content in the first data and the second data is directly compared. If the field content of the first data and the second data are different, the first data is written into the error message. The error message is sent to the prompt terminal.

[0121] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0122] In one possible implementation, the file group comparison module 306 is specifically used to read the target field content of the first data, where the target field content can be any field content. Field content in the second data whose first character matches the first character of the target field content is determined as the field content to be compared. If the second character of the target field content to be compared matches the second character of the target field content, then the target field content to be compared is determined as a new field content to be compared, and the character comparison process is repeated until all characters of the target field content are traversed, or until the Nth character of the target field content to be compared is no longer the same as the Nth character of the target field content, where the target field content to be compared is any field content to be compared, and N is a positive integer. If the Nth character of the target field content to be compared is no longer the same as the Nth character of the target field content, then it is determined that the first data and each of the second data are different.

[0123] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0124] In one possible implementation, the threshold determination module 303 is specifically used to find the correspondence between preset attributes and thresholds based on the file group attributes, and obtain the corresponding verification duration threshold.

[0125] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0126] In one possible implementation, the file group attributes also include the number of modifications, file level, and file type; correspondingly, the threshold determination module 303 is specifically used to find the preset type-to-type value correspondence based on the file type to obtain the target type value; and input the number of modifications, file level, and target type value into the preset threshold calculation formula to obtain the verification duration threshold.

[0127] The preset threshold calculation formula is as follows:

[0128] T MAX =T0-alog b (n+1)-cL+dF

[0129] In the formula, T0, a, b, c, and d are constants, n represents the number of modifications, and log b(n+1) represents the logarithm to the base b (n+1), L represents the file level, and F represents the target type value.

[0130] In one possible implementation, the file group attributes also include modification history, file level, and file type. Correspondingly, the threshold determination module 303 is specifically used to look up a preset duration correspondence table to obtain the verification duration thresholds corresponding to the modification history, file level, and file type, wherein the duration correspondence table stores the correspondence between modification history, file level, file type, and verification duration thresholds.

[0131] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0132] In one possible implementation, the file group attributes also include modification history, file level, and file type. Accordingly, the threshold determination module 303 is specifically used to determine the preset modified threshold as the verification duration threshold if the modification history is not empty. If the modification history is empty, it searches for the preset correspondence between the file level, file type, and threshold based on the file level and file type to obtain the verification duration threshold.

[0133] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0134] To implement the above embodiments, this application also provides an electronic device.

[0135] refer to Figure 4 The diagram illustrates a structural schematic of an electronic device 400 suitable for implementing embodiments of this application. The electronic device 400 can be a terminal device or a server. The terminal device can include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, personal digital assistants (PDAs), portable Android devices (PADs), portable media players (PMPs), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 4 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0136] like Figure 4As shown, the electronic device 400 may include a processor (e.g., a central processing unit, a graphics processing unit, etc.) 401 and a memory 402 communicatively connected to the processor. The processor can perform various appropriate actions and processes based on programs stored in the memory 402, computer-executed instructions, or programs loaded from storage device 408 into random access memory (RAM) 403, to implement the file comparison method in any of the above embodiments. The memory may be a read-only memory (ROM). The RAM 403 also stores various programs and data required for the operation of the electronic device 400. The processing device 401, the memory 402, and the RAM 403 are interconnected via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0137] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic device 400 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 An electronic device 400 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0138] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 409, or installed from storage device 408, or installed from memory 402. When the computer program is executed by processing device 401, it performs the functions defined in the methods of embodiments of this application.

[0139] It should be noted that the computer-readable storage medium described above in this application can be a computer-readable signal medium or a computer storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, 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 device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable storage medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0140] The aforementioned computer-readable storage medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0141] The aforementioned computer-readable storage medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the method shown in the above embodiments.

[0142] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include object-oriented programming languages—such as Java, Smalltalk, and C++—and conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0143] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0144] The modules described in the embodiments of this application can be implemented in software or in hardware. The names of the units are not necessarily limiting of the module itself; for example, an attribute reading module can also be described as a "file group attribute reading module".

[0145] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0146] This application also provides a computer-readable storage medium storing computer-executable instructions. When a processor executes the computer-executable instructions, it implements the technical solution of the file comparison method in any of the above embodiments. Its implementation principle and beneficial effects are similar to those of the file comparison method. Please refer to the implementation principle and beneficial effects of the file comparison method, which will not be repeated here.

[0147] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on 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 fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0148] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the technical solution of the file comparison method in any of the above embodiments. Its implementation principle and beneficial effects are similar to those of the file comparison method, and can be found in the implementation principle and beneficial effects of the file comparison method, which will not be repeated here.

[0149] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of disclosure in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

[0150] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0151] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A document comparison method, characterized in that, include: In response to the start of the file comparison process, obtain the current time; Read the filegroup attributes of the target filegroup, wherein the filegroup attributes include the file creation time, and the target filegroup is any filegroup; wherein the filegroup attributes are determined jointly based on the attributes of each file in the target filegroup; Based on the file group attributes, a preset table or key-value pair is searched to determine the verification time threshold; Calculate the time difference between the current time and the file generation time; If the time difference is greater than the verification duration threshold, then the control file group corresponding to the target file group is read; Compare whether the target file group and the control file group are the same; wherein, the target file group includes at least one table to be compared, and the control file group includes at least one standard table; Accordingly, comparing whether the target file group and the control file group are the same includes: Obtain the first length of the table to be compared and the second length of the target table, wherein the target table is any table in the standard table; if the first length is different from the second length corresponding to each standard table, then write the identifier of the table to be compared into the error message; if the first length and the second length are the same, then determine the target table as the reference table. Read the first data in the comparison table and the second data in the reference table; if both the first data and the second data include at least one field content and the corresponding field number, compare the field content in the first data and the second data according to the field number; if both the first data and the second data include at least one field content but do not include the corresponding field number, directly compare the field content in the first data and the second data; if the field content of the first data and the second data are different, write the first data into the error message; send the error message to the prompting terminal; The file group attributes also include the number of modifications, file level, and file type; Accordingly, the step of determining the verification duration threshold by searching a preset table or key-value pair based on the file group attributes includes: Based on the file type, a preset correspondence between type and type value is found to obtain the target type value; the number of modifications, the file level, and the target type value are input into a preset threshold calculation formula to obtain the verification time threshold.

2. The method according to claim 1, characterized in that, The field content comparison between the first data and the second data includes: Read the content of the target field of the first data, wherein the content of the target field is any field content; The field content in the second data whose first character is the same as the first character of the target field content is determined as the field content to be compared; If the second character of the target field content to be compared is the same as the second character of the target field content, then the target field content to be compared is determined as the new field content to be compared. The process of determining the field content to be compared where the next character of the current field content to be compared is the same as the next character of the target field content is executed, until all characters of the target field content are traversed, or until the Nth character of the target field content to be compared is no longer the same as the Nth character of the target field content, where the target field content to be compared is any field content to be compared, and N is a positive integer; If the Nth character of the target field to be compared is the same as the Nth character of the target field, then it is determined that the first data and each of the second data are different.

3. A document comparison device, characterized in that, include: The time acquisition module is used to obtain the current time in response to the start of the file comparison process; The attribute reading module is used to read the file group attributes of the target file group, wherein the file group attributes include the file creation time, and the target file group can be any file group; wherein the file group attributes are determined jointly based on the attributes of each file in the target file group; The threshold determination module is used to determine the verification duration threshold by searching a preset table or key-value pair based on the file group attributes. The time difference calculation module is used to calculate the time difference between the current time and the file generation time; The file group reading module is used to read the control file group corresponding to the target file group if the time difference is greater than the verification duration threshold. A file group comparison module is used to compare whether the target file group and the reference file group are the same; wherein, the target file group includes at least one table to be compared, and the reference file group includes at least one standard table; accordingly, the file group comparison module is specifically used to: obtain the first length of the table to be compared and the second length of the target table, wherein the target table is any table in the standard table; if the first length is different from the second length corresponding to each standard table, then write the identifier of the table to be compared into an error message; if the first length and the second length are the same, then determine the target table as a reference table; read the first data in the table to be compared and the second data in the reference table; if both the first data and the second data include at least one field content and the field number corresponding to the field content, then compare the field content in the first data and the second data according to the field number; if both the first data and the second data include at least one field content, but do not include the field number corresponding to the field content, then directly compare the field content in the first data and the second data; if the field content of the first data and the second data are different, then write the first data into the error message; and send the error message to the prompt terminal. The file group attributes also include the number of modifications, file level, and file type; Accordingly, the threshold determination module is specifically used to find a preset correspondence between type and type value based on the file type to obtain the target type value; and input the number of modifications, the file level and the target type value into a preset threshold calculation formula to obtain the verification time threshold.

4. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the file comparison method as described in claim 1 or 2.

5. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the file comparison method as described in claim 1 or 2.

6. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the document comparison method as described in claim 1 or 2.

Citation Information

Patent Citations

  • Data renewing method and device

    CN104750740A

  • Database table comparison method and device, storage medium and electronic equipment

    CN116756584A