A data synchronization method and device, storage medium, and computing device
By creating a data management interface and defining data unit identifiers, comparing and synchronizing different versions of Excel configuration files, the problem that cannot be directly compared and synchronized in the existing technology is solved, and the function of intuitively displaying and operating different data is realized, and data management is improved. Efficiency and user experience.
Patent Information
- Application Number
- CN202011189293.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-30
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2040-10-30
AI Technical Summary
It is difficult for the prior art to directly compare and synchronize data in different versions of Excel configuration files, and it is impossible to visually display differences and perform data operations.
By creating a data management interface, select data files in the same file format, read and load data, define data unit identification, compare different data, and render and synchronize different data in the visual interface.
It realizes direct comparison and synchronization of Excel configuration files, can intuitively display different data and perform data operations, improving the efficiency and user experience of data management.
Smart Images

Figure CN112287028B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a data synchronization method and device, a storage medium, and a computing device. Background Art
[0002] Configuration files are the basis for initializing parameters and loading data when the program is running, and they are constantly adjusted according to the program version update. Managers sometimes need to compare different configuration files to determine whether the current adjustments meet the product performance requirements, whether they bring additional costs, errors, etc. For different versions of configuration files, in general, when two files are compared, such as files in Excel format, the data in the Excel file will be converted into a text file for comparison, and then modified in the first file. Alternatively, after comparing the two versions of Excel files, a third Excel file is generated, and then the data in the third Excel file is operated.
[0003] The above two solutions not only fail to directly compare the same cells and synchronize data, but also fail to intuitively display the differences between the two files and perform data operations at the same time. Summary of the invention
[0004] In view of the above problems, the present invention is proposed to provide a data synchronization method and apparatus, storage medium, and computing device that overcome the above problems or at least partially solve the above problems.
[0005] According to one aspect of the present invention, there is provided a data synchronization method, comprising:
[0006] Creating a data management interface, wherein the data management interface includes a first display area and a second display area;
[0007] Selecting a first data file and a second data file of the same file format;
[0008] Reading first data of the first data file and second data of the second data file, and loading the first data and the second data into the first display area and the second display area respectively;
[0009] Comparing the first data with the second data to obtain difference data between the first data and the second data;
[0010] In response to a data synchronization operation on the difference data, the difference data in the first display area is synchronously updated using the second data.
[0011] Optionally, the creating a data management interface includes:
[0012] When the data comparison program is detected to be started, a data management interface is created;
[0013] The selecting of the first data file and the second data file having the same file format comprises:
[0014] A new first file selection interface is created in the data management interface, and a first file path and a second file path of the same file format are determined based on the first file selection interface; and a first data file and a second data file are acquired according to the first file path and the second file path, respectively.
[0015] Optionally, the creating a data management interface includes:
[0016] When it is detected that any file is triggered by a preset startup operation, a data management interface is created;
[0017] The selecting of the first data file and the second data file having the same file format comprises:
[0018] A new second file selection interface is created in the data management interface, and a third file path having the same file format as the file is determined based on the second file selection interface; the file is used as the first data file, and a second data file is obtained according to the third file path.
[0019] Optionally, comparing the first data and the second data to obtain difference data between the first data and the second data includes:
[0020] Determine a plurality of data units respectively included in the first data and the second data;
[0021] respectively defining a unit identifier of each of the data units in the first data and the second data, and comparing data units having the same unit identifier in the first data and the second data;
[0022] A difference data unit having different data contents between the first data and the second data is obtained.
[0023] Optionally, the file format includes Excel file format;
[0024] The respectively defining the unit identifier of each of the data units in the first data and the second data, and comparing the data units having the same unit identifier in the first data and the second data, comprises:
[0025] Respectively define row identifiers and column identifiers of the first data and the second data;
[0026] Acquire a first row of data and a second row of data having the same row identifier from the first data file and the second data file;
[0027] The data units having the same column identifier in the first row of data and the second row of data are compared in sequence.
[0028] Optionally, after comparing the first data and the second data to obtain difference data between the first data and the second data, the method further includes:
[0029] A display area of the difference data is rendered in the first display area and / or the second display area.
[0030] Optionally, in response to the data synchronization operation on the difference data, after synchronously updating the difference data using the second data, the method further includes:
[0031] The display area of the difference data after the data synchronization operation is updated and rendered for the first time.
[0032] Optionally, in response to the data synchronization operation on the difference data, after synchronously updating the difference data using the second data, the method further includes:
[0033] In response to a synchronization withdrawal operation on the differential data, canceling a data synchronization operation on the differential data in the first data file;
[0034] The display area of the difference data after the undo synchronization operation is updated and rendered for the second time.
[0035] Optionally, after comparing the first data and the second data, the method further includes:
[0036] Acquire the same data of the first data and the second data;
[0037] The same data in the first display area and / or the second display area is hidden.
[0038] Optionally, after reading the first data of the first data file and the second data of the second data file and loading the first data and the second data into the first display area and the second display area respectively, the method further includes:
[0039] When a preset switching operation is detected, the first data is loaded into the second display area, and the second data is loaded into the first display area.
[0040] According to another aspect of the present invention, there is also provided a data comparison device, comprising:
[0041] An interface creation module, adapted to create a data management interface, wherein the data management interface includes a first display area and a second display area;
[0042] A file selection module, adapted to select a first data file and a second data file of the same file format;
[0043] a data loading module, adapted to read first data of the first data file and second data of the second data file, and load the first data and the second data into the first display area and the second display area respectively;
[0044] A comparison module, adapted to compare the first data and the second data, and obtain difference data between the first data and the second data;
[0045] The synchronization module is adapted to respond to a data synchronization operation on the difference data and synchronously update the difference data in the first display area using the second data.
[0046] Optionally, the interface creation module is further adapted to: create a data management interface when it is detected that the data comparison program is started;
[0047] The file selection module is also suitable for creating a new first file selection interface in the data management interface, determining a first file path and a second file path of the same file format based on the first file selection interface; and obtaining a first data file and a second data file according to the first file path and the second file path respectively.
[0048] Optionally, the interface creation module is further adapted to: create a data management interface when it is detected that any file is triggered by a preset startup operation;
[0049] The file selection module is also suitable for creating a new second file selection interface in the data management interface, determining a third file path with the same file format as the file based on the second file selection interface; using the file as the first data file, and obtaining the second data file according to the third file path.
[0050] Optionally, the comparison module includes:
[0051] a data unit determining unit, adapted to determine a plurality of data units respectively included in the first data and the second data;
[0052] a data comparison unit, adapted to respectively define a unit identifier of each of the data units in the first data and the second data, and compare data units having the same unit identifier in the first data and the second data;
[0053] A result acquisition unit is configured to acquire a difference data unit having different data contents between the first data and the second data.
[0054] Optionally, the file format includes Excel file format;
[0055] The data comparison unit is further adapted to define row identifiers and column identifiers of the first data and the second data respectively;
[0056] Acquire a first row of data and a second row of data having the same row identifier from the first data file and the second data file;
[0057] The data units having the same column identifier in the first row of data and the second row of data are compared in sequence.
[0058] Optionally, the device further comprises:
[0059] A rendering module is adapted to render a display area of the difference data in the first display area and / or the second display area.
[0060] Optionally, the rendering module is further adapted to respond to a data synchronization operation on the difference data, after synchronously updating the difference data using the second data, and then performing a first update rendering on a display area of the difference data after the data synchronization operation.
[0061] Optionally, the device further comprises:
[0062] a synchronization cancellation module, adapted to cancel a data synchronization operation on the differential data in the first data file in response to a synchronization withdrawal operation on the differential data;
[0063] The rendering module is further adapted to perform a second update rendering on the display area of the difference data after the undo synchronization operation.
[0064] Optionally, the device further comprises:
[0065] A hidden module, adapted to obtain the same data of the first data and the second data;
[0066] The same data in the first display area and / or the second display area is hidden.
[0067] Optionally, the device further comprises:
[0068] The switching module is adapted to load the first data into the second display area and the second data into the first display area when a preset switching operation is detected.
[0069] According to yet another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium is used to store program codes, and the program codes are used to execute any of the above-mentioned data synchronization methods.
[0070] According to another aspect of the present invention, a computing device is provided, the computing device comprising a processor and a memory:
[0071] The memory is used to store program codes and transmit the program codes to the processor;
[0072] The processor is used to execute any of the above-mentioned data synchronization methods according to the instructions in the program code.
[0073] An embodiment of the present invention provides a data synchronization method and apparatus, a storage medium, and a computing device. In the data synchronization method provided by the present invention, the first data and the second data corresponding to the first data file and the second data file, respectively, are selected and displayed through a visual data management interface, and after comparing the first data and the second data, a data synchronization operation can be performed on the difference data between the first data and the second data. Based on the method provided by the present invention, not only can the difference data between the first data file and the second data file be intuitively displayed, but also a visual synchronization operation of the difference data can be performed while displaying the difference data.
[0074] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below.
[0075] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0077] Figure 1 A schematic diagram of a data synchronization method flow chart according to an embodiment of the present invention is shown;
[0078] Figure 2 A schematic diagram of a data management interface according to an embodiment of the present invention is shown;
[0079] Figure 3 A schematic diagram of a data synchronization method flow according to another embodiment of the present invention is shown;
[0080] Figure 4 A schematic diagram of a data management interface according to another embodiment of the present invention is shown;
[0081] Figure 5 A schematic diagram of the structure of a data synchronization device according to an embodiment of the present invention is shown;
[0082] Figure 6 A schematic structural diagram of a data synchronization device according to another embodiment of the present invention is shown. DETAILED DESCRIPTION
[0083] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0084] The embodiment of the present invention provides a data synchronization method, see Figure 1 It can be known that the data synchronization method provided by the embodiment of the present invention may at least include the following steps 102 to S110.
[0085] Step S102: Create a data management interface.
[0086] The data management interface in the embodiment of the present invention is an interface for displaying and editing data, similar to text editing interfaces in different formats such as Word files and Excel files. Optionally, when creating a data management interface, the following two methods can be used:
[0087] First, when the data comparison program is detected to be started, a data management interface is created. The data comparison program is a program file set in the electronic device as a separate application program, which can realize the data comparison function. The data comparison program can be started directly by double-clicking, and when the data comparison program is detected to be started, a data management interface can be created.
[0088] Second, when it is detected that any file is triggered by a preset startup operation, a data management interface is created. In an optional embodiment of the present invention, the data comparison program can also be a plug-in or control with data comparison function embedded in the engineering file / system or Excel in the form of a plug-in / component, and the preset startup operation can be a selection operation for the opening method of any file, for example, the preset startup operation can be an operation of selecting to open from the right-click list when the mouse is hovering over any file, or a startup operation in other ways.
[0089] In an embodiment of the present invention, the data management interface includes a first display area for displaying source data and a second display area for displaying target data. Figure 2As shown, the data management interface may include a first display area and a second display area displayed in parallel, which can be used to display source data and target data respectively. The source data is the data to be edited during the data comparison process, and the target data is the reference data for synchronizing the source data.
[0090] Step S104: selecting a first data file and a second data file in the same file format.
[0091] The above introduces two ways to create a data management interface. When the data comparison program is started and detected by the first method, after the data management interface is created, when the first data file and the second data file are selected in the above step S104, a new first file selection interface can be created in the data management interface, and the first file path and the second file path of the same file format are determined based on the first file selection interface; the first data file and the second data file are obtained according to the first file path and the second file path, respectively. Among them, the first data file and the second data file can be configuration files for different program versions, and the data corresponding to the first data file and the second data file can be configured in an Excel file and converted into text data loaded when the game is running through self-developed tools.
[0092] Among them, Figure 2 As shown, two file selection windows may be provided in the first file selection interface, through which the storage paths of the first data file and the second data file may be selected or input respectively, and then the first data file and the second data file may be acquired based on the above storage paths. Optionally, in the path selection process, the selection order of the first data file and the second data file is not limited, and when any of the data files is selected for the first time, only files having the same format as the data file selected for the first time are presented in the other file selection window.
[0093] For example, assuming that the first data file as the source file is selected first, such as an Excel file, when selecting the second data file as the target file, only the Excel file can be presented and files of other formats can be hidden, that is, if the first data file is obtained based on the first file selection interface, the target file format of the first data file is detected, and when the second data file is selected, after the storage directory of the second data file is determined, only the relevant files of the target file format are presented in the first file selection interface. Similarly, if the second data file is obtained on the first file selection interface, the target file format of the second data file is detected, and when the first data file is selected, after the storage directory of the first data file is determined, only the relevant files of the target file format are presented in the first file selection interface.
[0094] The above embodiment mentioned that after detecting that any file is triggered by a preset startup operation to create a data management interface, when the above step S104 selects the first data file and the second data file, a new second file selection interface can be created in the data management interface, and a third file path having the same file format as the file is determined based on the second file selection interface; the file is used as the first data file, and the second data file is obtained according to the third file path.
[0095] That is to say, if you open it by triggering the right button on any file icon, you can choose the current file as the first data file, that is, the source file; at the same time, you can create a second file selection interface to determine the third file path through a file selection interface given in the second file selection interface, and then obtain the second data file based on the third file path.
[0096] In this embodiment, since the preset start operation is triggered by directly selecting a file, when the second data file is selected based on the second file selection interface, only related files having the same format as the triggered file may be presented in the second file selection interface.
[0097] Step S106 , reading the first data of the first data file and the second data of the second data file, and loading the first data and the second data into the first display area and the second display area respectively.
[0098] After obtaining the first data of the first data file and the second data of the second data file, the first data and the second data can be loaded into the first display area and the second display area for display respectively. As mentioned above, the first display area and the second display area can be used to display the source data and the target data respectively. In actual application, the display positions of the source data and the target data may be incorrect due to operational errors. In an optional embodiment of the present invention, when a preset switching operation is detected, the first data can be loaded into the second display area and the second data can be loaded into the first display area to achieve the role exchange of the source data and the target data.
[0099] For example, Figure 2 As shown, a "swap" button or option can be set in the data management interface. When the button or option is triggered, the first data is loaded into the second display area, and the second data is loaded into the first display area, so as to facilitate correction after selecting an error at startup. In addition, the sizes of the first display area and the second display area in the data management interface can be adjusted according to different needs, and the present invention does not limit this.
[0100] Step S108: comparing the first data and the second data to obtain difference data between the first data and the second data.
[0101] After the first data and the second data are acquired and loaded into the first display area and the second display area respectively, the first data and the second data can be compared to obtain the difference data of the first data file and the second data file. Specifically, when the first data of the first data file and the second data of the second data file are compared in the above step S108, the following method can be used:
[0102] S1, determining a plurality of data units respectively included in the first data and the second data.
[0103] S2, respectively define a unit identifier of each data unit in the first data and the second data, and compare data units having the same unit identifier in the first data and the second data.
[0104] S3, obtaining difference data units of the first data and the second data having different data contents.
[0105] In actual applications, for files of different formats, the methods for determining data units are also different. Taking the first data file and the second data file as word files as an example, when obtaining the data units of each file, each line in the file can be used as a data unit, and the unit identifier of each line (such as the line number) can be defined. It is also possible to use a segment as a data unit, define the unit identifier of each segment (such as the segment number), and the unit identifier of each data unit can be the segment number. When the above steps S2 to S3 perform data comparison based on the unit identifier and obtain the difference data unit, the first data file and the second data file can be compared line by line and word by word for each line or each segment.
[0106] For Excel files, since they are displayed in table form, their data units can be individual cells in the table. Since an Excel file may contain multiple sheets, when comparing data, a sheet in the first data file and a sheet in the second data file can be selected for comparison.
[0107] When performing data comparison in the above step S2, the row identifiers and column identifiers of the first data and the second data can be defined respectively; the first row of data and the second row of data with the same row identifier are obtained from the first data file and the second data file; and the data units with the same column identifier in the first row of data and the second row of data are compared in turn.
[0108] That is to say, for the first data file and the second data file belonging to the same file format, the row identifier and column identifier of each recorded data can be defined respectively. Optionally, when defining the row identifier and column identifier, taking Excel file as an example, the default row serial number of the Excel file can be used as the row identifier, and the column serial number can be used as the column identifier, such as the row identifiers of the 1st to the nth row are x1~xn, and the column identifiers of the first to the nth column are y1~yn respectively. The content in the cell can also be defined as the row identifier and column identifier corresponding to the cell. Of course, the row identifiers of the 1st to the nth row can also be x1~xn, and the column identifier can be defined according to the cell content, or the row identifier can be defined according to the cell content, and the column identifiers of the first to the nth column are y1~yn respectively. It can be set specifically according to different needs.
[0109] When performing data comparison, the first row of data in the first data file and the second row of data in the second data file with the same row identifier can be obtained respectively. For example, when the row number is used as the row identifier and the column number is used as the column identifier, the data of the first row in the first data file can be obtained as the first row of data and the data of the first row in the second data file can be obtained as the second row of data. After obtaining the first row of data and the second row of data, the data units with the same column identifier are compared in sequence, that is, the 1st to nth columns in the first row of data and the second row of data are compared one by one, thereby realizing data comparison of the first data and the second data. The embodiment of the present invention can quickly compare the first data file and the second data file by using the default row number and column number as the row identifier and the column identifier respectively.
[0110] In addition, in the case where the row identifier and column identifier are defined by the cell content, taking the row identifier as "name x" as an example, when performing data comparison, the data of the row to which "name x" belongs in the first data file can be first determined as the first row of data, and the data of the row to which "name x" belongs in the second data file can be used as the second row of data. After obtaining the first row of data and the second row of data, the data unit to be compared is determined according to the column identifier, and then the data comparison is performed. The method provided based on the embodiment of the present invention can realize accurate and complete comparison of the data in the first data file and the second data file.
[0111] Based on the method provided in the embodiment of the present invention, by determining the data units of the first data and the second data and defining the unit identifier of each data unit, the data units with the same unit identifier in the first data and the second data are compared, and the data comparison efficiency of the first data and the second data can be improved while fully realizing the data comparison of the first data and the second data.
[0112] In an optional embodiment of the present invention, after the above step S108, a display area of the difference data may be rendered in the first display area and / or the second display area.
[0113] After obtaining the difference data between the first data and the second data, the display area of the difference data can be rendered in the first display area and / or the second display area, respectively. As described above, the difference data unit of the first data and the second data can be obtained, so the display area of the difference data unit in the first display area and / or the second display area can be determined and rendered, such as rendering the display area of each word in Word, or rendering the data cells with differences in an Excel table. When rendering the display area of the difference data, the background color of the display area or the display color of the difference data can be set to a color that is different from other data. Among them, the display area of the difference data can be a cell in an Excel table, or the entire row to which the cell belongs. When rendering the display area of the difference data, the background of the row with difference data in the first display area and / or the second display area can be rendered light red, and the background of the cell with difference data can be dark red.
[0114] Step S110 , in response to the data synchronization operation on the difference data, synchronously updating the difference data in the first display area using the second data.
[0115] The above embodiment mentioned that the second data of the second file loaded in the second display area can be used as the target data to synchronize the first data in the first display area. Therefore, after obtaining the difference data between the first data and the second data, the difference data in the first display area can be updated synchronously using the second data in response to the data synchronization operation for the difference data, and the difference parts are selected and overwritten, so that the first data is synchronized to be the same as the second data. In the embodiment of the present invention, the data synchronization operation can be performed on all the difference data at the same time, or on part of the difference data, for example, the data synchronization operation can be performed independently on each cell in an Excel table, and the data synchronization can also be performed on the entire row of difference data, and the present invention does not limit this.
[0116] Furthermore, before data synchronization is performed, since the display area of the difference data may be rendered separately, after executing the above step S110 in response to the data synchronization operation for the difference data using the second data to synchronously update the difference data, the difference data originally existing in the first data and the second data may no longer exist. At this time, the display area of the difference data after the data synchronization operation can be updated and rendered for the first time. For example, the background color of the display area of the difference data after the synchronous update is made consistent with the background color of other areas, so as to highlight the difference data that has not been synchronized; or the background color of the display area corresponding to the difference data after the data synchronization operation is rendered into a color that is different from the display area of other data.
[0117] In an optional embodiment of the present invention, the above step S110 responds to the data synchronization operation for the difference data, and after the difference data is updated by the second data synchronization, it can also respond to the synchronization withdrawal operation for the difference data, and cancel the data synchronization operation for the difference data in the first data file. That is to say, in the embodiment of the present invention, for the difference data that has been subjected to the data synchronization operation, the synchronization can also be revoked to restore the difference data. Similarly, when restoring data synchronization, the synchronization withdrawal operation can be performed on all the difference data after the data synchronization is performed at the same time, and the synchronization withdrawal operation can also be performed on part of the synchronized difference data, and the synchronization withdrawal operation can also be performed on the whole row of the difference data after the data synchronization, and the present invention does not limit this. When performing a data synchronization operation or a synchronization withdrawal operation on all the difference data, the difference data of the whole row, or the data of a separate data unit, it can be performed through a preset operation button or option. Taking a single data unit as an example, the operation options can be displayed by right-clicking the data unit, and the synchronization or cancellation of the synchronization of the difference data can be achieved by triggering different operation options.
[0118] Furthermore, assuming that a synchronization undo operation is performed on the difference data, the display area of the difference data after the synchronization undo operation can be updated and rendered for the second time. For example, when the difference data is restored, the display area of the difference data is restored to the rendering state before the data synchronization is performed, or the display area of the difference data for which the synchronization undo operation is performed is re-rendered to distinguish it from other data.
[0119] In an optional embodiment of the present invention, in addition to obtaining the difference data between the first data and the second data, the same data between the first data and the second data can also be obtained, and the same data in the first display area and / or the second display area can be hidden. That is, the data in the rows or data cells with the same unique identifier and the same data in each cell can be hidden, and only the difference data in the first display area and the second display area can be displayed, so that the difference data between the first data and the second data can be displayed concisely and completely in the first display area and the second display area.
[0120] In actual applications, multiple operations may be performed on the difference data, such as data synchronization operations or undoing synchronization operations. Optionally, an operation record can be generated based on the operation process of the difference data, that is, a record describing the current comparison and synchronization operation is generated. For actions that need to be restored after synchronization, the previous data synchronization operations can be filtered out, and only the effective adjustments when the file is closed are displayed.
[0121] Figure 3 FIG. 4 shows a flow chart of a data synchronization method according to another embodiment of the present invention. Figure 3 As shown, the data synchronization method provided by the embodiment of the present invention may include:
[0122] Step S302: When the data comparison program is detected to be started, a data management interface is created; the data management interface can be as follows: Figure 2 As shown, it may include two display areas on the left and the right that are displayed in parallel. By default, the source data of the first display area on the left is synchronized with the target data of the second display area on the right, or it may be customized by the user.
[0123] Step S304, create a selection interface, select the file storage path of the source file and the storage path of the target file of the same file format based on the selection interface; in the path selection process, assuming that the storage path of the source file is selected first, and the A data file is obtained based on the storage path, then when selecting the target file, only files with the same format as the A data file are presented in the target file options. In this embodiment, the A data file is an Excel file, and when the folder is opened in the subsequent path, only the Excel file is presented and other files are hidden, and the B data file is selected from it.
[0124] Step S306, read the data of data file A and data file B and load them into the left and right display areas of the data management interface respectively. Figure 4 As shown, Figure 4 The data corresponding to the A data file in the left display area is the source data, and the data corresponding to the B data file in the right display area is the target data;
[0125] Optionally, a button / option for exchanging the roles of the source file and the target file can also be set in the data management interface, so as to facilitate correction after selecting an error at startup; in addition, the sizes of the left and right interfaces used to present the data of the two files can be freely adjusted to facilitate the user to focus on a certain file. In this embodiment, the example of A data file and B data file each having a sheet. In addition, for an Excel file with multiple sheets, after loading all the sheets of the source file and the target file, a sheet of the source file and a sheet of the target file can be selected for comparison.
[0126] Step S308, respectively define the unique identifier of a row in the A data file and the B data file, namely, the row identifier; and the unique identifier of a column in the data file, namely, the column identifier.
[0127] In the embodiment of the present invention, the row identifier and column identifier are defined by the content in the cell as an example. Figure 4 In the display interface shown, "number", "blood volume", "magic value", "life value", "attack ability" and the like can be used as column identifiers, and "monster 1", "monster 2", "monster 3", "monster 4" and the like can be used as cell column identifiers. In practical applications, it can be set according to the file attributes of the data file, or defined by the attributes of the file format, which is not limited in the implementation of the present invention.
[0128] Step S310, comparing the data in the A data file with the data in the B data file to obtain the difference data and the same data between the two.
[0129] According to the order of row identifiers in the A data file on the left ("Monster 1", "Monster 2", "Monster 3", "Monster 4"), search for row data with the same identifier on the right. After finding it, locate the specific cell according to the column identifier on the left ("Name", "Number", "Health", "Magic Value", "Health Value") and compare the data in the cells one by one.
[0130] For example, when comparing data, you can first use "Monster 1" as the row identifier to obtain row data 1 in the left data file A, that is, the data of the first row in the A data file: "001, 90, 50, 45, medium"; use "Monster 1" as the row identifier to obtain row data 2 in the right data file B, that is, the data of the second row in the left data file: "001, 90, 50, medium, 90". After obtaining row data 1 and row data 2, determine the data with the same column identifier, such as "health", and obtain the data corresponding to the column identifier "health" in row data 1 is "90", and the data corresponding to the column identifier "health" in row data 2 is "90". At this time, it can be determined that the data of the cell "Monster 1, health" in the A data file and the cell "Monster 1, health" in the B data file are the same data.
[0131] For example, it is determined that the data in the column labeled "magic value" in row data 1 is "50", and the data in the column labeled "magic value" in row data 2 is "90". At this time, it can be determined that the data in the cell "Monster 1, magic value" in data file A and the data in the cell "Monster 1, magic value" in data file B are difference data.
[0132] For the same data obtained, the display effect can be hidden or not superimposed. For the different data, the row where the different data is located is filled with light red, and the cells with different data are filled with dark red. In actual applications, different colors (default or user-defined) can be displayed according to the difference between the two, such as green for new additions, red for deletions, blue for different values, etc.
[0133] Step S312, performing a data synchronization operation on the difference data. In this embodiment, the target data on the right is synchronized with the source data on the left.
[0134] Taking the two cells "Monster 1, magic value" and "Magic value in Monster 1 and B data files" in the A data file of the above embodiment as examples, the data of "Monster 1, magic value" in the A data file on the left can be modified to "90".
[0135] Specifically, you can select the row or cell that needs to be synchronized in the first display area on the left, right-click and select "Synchronize" to synchronize the entire row of data and the individual cell data (the mouse position is different to determine whether row or cell synchronization is required). After the synchronization is completed, the cell where the difference data is located turns dark green, and after all data in the row where the difference data is located is synchronized, the cell where the difference data is located turns dark green, and the row where the cell is located turns light green.
[0136] Step S314: performing an undo synchronization operation on the difference data on which the data synchronization operation has been performed.
[0137] Select the row or cell to be restored in the first display area (the data previously synchronized from the right sheet), and right-click to restore the entire row of data or individual cell data. The restored synchronized data will turn red again as in the comparison.
[0138] Step S316, generating an operation record according to the data operation process.
[0139] An embodiment of the present invention provides a data synchronization method. After selecting and displaying data corresponding to two data files of the same format and comparing them through a visual data management interface, a data synchronization operation can be performed on the difference data between the two. In particular, for data in Excel files, not only can the data in the same cell with the same identifier be directly compared to obtain and display the difference data, but also a visual synchronization operation of the difference data can be performed while displaying the difference data, or a synchronization undo operation can be performed, thereby meeting the need to modify the data in the source file.
[0140] In addition, based on the method provided by the embodiment of the present invention, after obtaining the difference data of two data files, the display area of the difference data, such as the cell or the row where the cell is located, can also be displayed differently to highlight the location of the difference. Moreover, after performing a data synchronization operation on the difference data or canceling a data synchronization operation, the display area of the difference data on which different operations are performed can also be re-rendered, so as to make the type of operation performed on the difference data clearer from a visual perspective, thereby improving the user's operating experience.
[0141] Based on the same inventive concept, the embodiment of the present invention also provides a data synchronization device, such as Figure 5 As shown, the device may include:
[0142] An interface creation module 510 is adapted to create a data management interface, wherein the data management interface includes a first display area and a second display area;
[0143] A file selection module 520, adapted to select a first data file and a second data file of the same file format;
[0144] A data loading module 530, adapted to read first data of a first data file and second data of a second data file, and load the first data and the second data into a first display area and a second display area respectively;
[0145] A comparison module 540, adapted to compare the first data and the second data, and obtain difference data between the first data and the second data;
[0146] The synchronization module 550 is adapted to synchronously update the difference data in the first display area using the second data in response to a data synchronization operation on the difference data.
[0147] In an optional embodiment of the present invention, the interface creation module 510 is further adapted to: create a data management interface when it is detected that the data comparison program is started;
[0148] The file selection module 520 is also suitable for creating a new first file selection interface in the data management interface, determining a first file path and a second file path of the same file format based on the first file selection interface; and obtaining a first data file and a second data file according to the first file path and the second file path, respectively.
[0149] In an optional embodiment of the present invention, the interface creation module 510 is further adapted to: create a data management interface when it is detected that any file is triggered by a preset startup operation;
[0150] The file selection module 520 is also suitable for creating a new second file selection interface in the data management interface, determining a third file path with the same file format as the file based on the second file selection interface; taking the file as the first data file, and obtaining the second data file according to the third file path.
[0151] In an optional embodiment of the present invention, Figure 6 As shown, the comparison module 550 may include:
[0152] A data determination unit 541, adapted to determine a plurality of data units respectively included in the first data and the second data;
[0153] A data comparison unit 542, adapted to respectively define a unit identifier of each data unit in the first data and the second data, and compare data units having the same unit identifier in the first data and the second data;
[0154] The result acquisition unit 543 is adapted to acquire difference data units having different data contents from the first data file and the second data file.
[0155] In an optional embodiment of the present invention, the file format includes an Excel file format;
[0156] The data comparison unit 542 is further adapted to define row identifiers and column identifiers of the first data and the second data, respectively;
[0157] Acquire a first row of data and a second row of data having the same row identifier from the first data file and the second data file;
[0158] The data units with the same column identifier in the first row of data and the second row of data are compared in sequence.
[0159] In an optional embodiment of the present invention, Figure 6 As shown, the above device may also include:
[0160] The rendering module 560 is adapted to render a display area of the difference data in the first display area and / or the second display area.
[0161] In an optional embodiment of the present invention, the rendering module 560 is further adapted to respond to a data synchronization operation on the difference data, and after the difference data is updated using the second data synchronization, perform a first update rendering on the display area of the difference data after the data synchronization operation.
[0162] In an optional embodiment of the present invention, Figure 6 As shown, the above device may also include:
[0163] The undo synchronization module 570 is adapted to undo the data synchronization operation on the differential data in the first data file in response to the synchronization undo operation on the differential data;
[0164] The rendering module 560 is further adapted to perform a second update rendering on the display area of the difference data after the synchronization operation is canceled.
[0165] In an optional embodiment of the present invention, Figure 6 As shown, the above device may also include:
[0166] Hidden module 580, adapted to obtain the same data of the first data file and the second data file;
[0167] The same data in the first display area and / or the second display area is hidden.
[0168] In an optional embodiment of the present invention, Figure 6 As shown, the above device also includes:
[0169] The switching module 590 is adapted to load the first data into the second display area and the second data into the first display area when a preset switching operation is detected.
[0170] According to yet another aspect of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium is used to store program codes, and the program codes are used to execute the data synchronization method of the above embodiment.
[0171] According to another aspect of the present invention, a computing device is provided, the computing device comprising a processor and a memory:
[0172] The memory is used to store the program code and transmit the program code to the processor;
[0173] The processor is used to execute the data synchronization method of the above embodiment according to the instructions in the program code.
[0174] Those skilled in the art can clearly understand that the specific working processes of the systems, devices, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and for the sake of brevity, they are not further described here.
[0175] In addition, the functional units in various embodiments of the present invention may be physically independent of each other, or two or more functional units may be integrated together, or all functional units may be integrated into one processing unit. The above integrated functional units may be implemented in the form of hardware, or in the form of software or firmware.
[0176] Those skilled in the art can understand that if the integrated functional unit is implemented in the form of software and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention can essentially or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, which includes a number of instructions to enable a computing device (such as a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention when running the instructions. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes.
[0177] Alternatively, all or part of the steps of implementing the aforementioned method embodiments may be accomplished by hardware associated with program instructions (such as a computing device such as a personal computer, a server, or a network device), and the program instructions may be stored in a computer-readable storage medium. When the program instructions are executed by a processor of a computing device, the computing device executes all or part of the steps of the methods described in the embodiments of the present invention.
[0178] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that within the spirit and principles of the present invention, the technical solutions described in the aforementioned embodiments can still be modified, or some or all of the technical features therein can be replaced by equivalents. However, these modifications or replacements do not deviate from the protection scope of the present invention.
Claims
1. A data synchronization method, It is characterized in that include: Creating a data management interface, wherein the data management interface includes a first display area and a second display area; Selecting a first data file and a second data file of the same file format; Reading first data of the first data file and second data of the second data file, and loading the first data and the second data into the first display area and the second display area respectively; Comparing the first data with the second data to obtain difference data between the first data and the second data, wherein the difference data is determined by comparing data units having the same unit identifier in the first data and the second data, and the unit identifier is defined according to a file format attribute of the first data file and the second data file; Rendering display areas of the difference data of different difference types in different colors in the first display area and / or the second display area; In response to a data synchronization operation on the difference data, synchronously updating the difference data in the first display area using the second data; The step of creating a data management interface includes: When it is detected that any file is triggered by a preset startup operation, a data management interface is created; The selecting of the first data file and the second data file having the same file format comprises: Creating a new second file selection interface in the data management interface, and displaying a third file path having the same file format as the any file based on the second file selection interface; Any of the files is used as a first data file, and a second data file is obtained according to the third file path.
2. The method according to claim 1, It is characterized in that The step of creating a data management interface includes: When the data comparison program is detected to be started, a data management interface is created; The selecting of the first data file and the second data file having the same file format comprises: Creating a new first file selection interface in the data management interface, and determining a first file path and a second file path of the same file format based on the first file selection interface; A first data file and a second data file are acquired according to the first file path and the second file path respectively.
3. The method according to claim 1, It is characterized in that The comparing the first data and the second data to obtain difference data between the first data and the second data includes: Determine a plurality of data units respectively included in the first data and the second data; respectively defining a unit identifier of each of the data units in the first data and the second data, and comparing data units having the same unit identifier in the first data and the second data; A difference data unit having different data contents between the first data and the second data is obtained.
4. The method according to claim 3, It is characterized in that The file format includes Excel file format; The respectively defining the unit identifier of each of the data units in the first data and the second data, and comparing the data units having the same unit identifier in the first data and the second data, comprises: Respectively define row identifiers and column identifiers of the first data and the second data; Acquire a first row of data and a second row of data having the same row identifier from the first data file and the second data file; The data units having the same column identifier in the first row of data and the second row of data are compared in sequence.
5. The method according to any one of claims 1 to 4, It is characterized in that After the step of synchronously updating the difference data using the second data in response to the data synchronization operation on the difference data, the method further comprises: The display area of the difference data after the data synchronization operation is updated and rendered for the first time.
6. The method according to any one of claims 1 to 4, It is characterized in that After the step of synchronously updating the difference data using the second data in response to the data synchronization operation on the difference data, the method further comprises: In response to a synchronization withdrawal operation on the differential data, canceling a data synchronization operation on the differential data in the first data file; The display area of the difference data after the undo synchronization operation is updated and rendered for the second time.
7. The method according to any one of claims 1 to 4, It is characterized in that After comparing the first data with the second data, the method further includes: Acquire the same data of the first data and the second data; The same data in the first display area and / or the second display area is hidden.
8. The method according to claim 1, It is characterized in that After reading the first data of the first data file and the second data of the second data file, and loading the first data and the second data into the first display area and the second display area respectively, the method further includes: When a preset switching operation is detected, the first data is loaded into the second display area, and the second data is loaded into the first display area.
9. A data comparison device, It is characterized in that include: An interface creation module, adapted to create a data management interface, wherein the data management interface includes a first display area and a second display area; A file selection module, adapted to select a first data file and a second data file of the same file format; a data loading module, adapted to read first data of the first data file and second data of the second data file, and load the first data and the second data into the first display area and the second display area respectively; a comparison module, adapted to compare the first data and the second data, and obtain difference data between the first data and the second data, wherein the difference data is determined by comparing data units having the same unit identifier in the first data and the second data, and the unit identifier is defined according to a file format attribute of the first data file and the second data file; a rendering module, adapted to render display areas of the difference data of different difference types in different colors in the first display area and / or the second display area; A synchronization module, adapted to synchronously update the difference data in the first display area using the second data in response to a data synchronization operation on the difference data; The interface creation module is also adapted to: create a data management interface when it is detected that any file is triggered by a preset startup operation; The file selection module is also suitable for creating a new second file selection interface in the data management interface, and displaying a third file path with the same file format as any of the files based on the second file selection interface; taking any of the files as the first data file, and obtaining the second data file according to the third file path.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium is used to store program code, and the program code is used to execute the data synchronization method according to any one of claims 1-8.
11. A computing device, It is characterized in that The computing device comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the data synchronization method according to any one of claims 1-8 according to the instructions in the program code.
