Object data comparison method, apparatus, and electronic device
By automatically comparing historical and new object data, the inefficiency caused by manual comparison during data migration is solved, achieving efficient and accurate data processing and storage, and improving the efficiency of data processing.
Patent Information
- Application Number
- CN202311126541.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-01
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2043-09-01
AI Technical Summary
In existing technologies, data migration or upgrades require manual data comparison, resulting in low data processing efficiency.
This paper provides a method for comparing object data. By acquiring historical object data and new object data, it automatically compares them to determine object attributes and stores the comparison results in different storage media based on the use cases and user needs of the web system.
It enables automatic and accurate comparison of historical and new object data, improves the efficiency of data processing, and solves problems such as data migration comparison and user permission approval.
Smart Images

Figure CN117149791B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of terminal software, and in particular to an object data comparison method and device and electronic equipment. BACKGROUND
[0002] At present, in the big data development process, data migration or upgrading work is often encountered, or different business parties process data according to requirements, but it is believed that the data on both sides is the same, so in the existing scheme, the situation of manually comparing data often occurs, resulting in low work efficiency of data processing. SUMMARY
[0003] The purpose of the present application is to provide an object data comparison method and device and electronic equipment to alleviate the technical problem of low work efficiency of data processing.
[0004] In a first aspect, the present application provides an object data comparison method, which comprises:
[0005] Respectively acquiring historical object data and new object data; wherein the new object data is used to represent data of a new operation of a web system;
[0006] Comparing the historical object data and the new object data to obtain a comparison result, and determining an object attribute of the new object data according to the comparison result;
[0007] Based on different use scenarios and / or different user requirements of the web system, the comparison result and the object attribute are stored in different storage media.
[0008] In one possible implementation, before the step of comparing the historical object data and the new object data to obtain a comparison result, the method further comprises:
[0009] Determining a comparison field condition, wherein the comparison field condition includes comparing all attribute fields in the historical object data and the new object data, or comparing selected part of the attribute fields in the historical object data and the new object data according to user requirements.
[0010] In one possible implementation, the object attribute includes any one or more of the following: new data, modified data, and deleted data.
[0011] The step of determining the object attribute of the new object data according to the comparison result comprises:
[0012] According to the comparison result, it is determined that the operation content of the new operation corresponding to the new object data is new data, modified data, or deleted data.
[0013] In a possible implementation, the historical object data is historical structured data, and the new object data is new structured data; the step of comparing the historical object data and the new object data to obtain a comparison result comprises the following steps.
[0014] Attribute values of the new structured data and the historical structured data are obtained through a reflection mechanism, and a spatial comparison of memory addresses is performed on each attribute value.
[0015] If the memory addresses are the same, it is determined that the comparison result is that the attribute values are the same.
[0016] If the memory addresses are different, it is determined that the comparison result is that the attribute values are different, and the different attribute values are stored in a Map.
[0017] In a possible implementation, after the step of comparing the historical object data and the new object data to obtain a comparison result, the method further comprises the following steps.
[0018] According to the comparison result between the historical structured data and the new structured data, data that is added, modified, or deleted is distinguished, and data that has changed is highlighted in a graphical user interface of a web system; when a cursor moves to field data, the field data corresponding historical structured data is displayed in a hovering manner.
[0019] In a possible implementation, the historical object data is historical rich text data, and the new object data is new rich text data; the step of comparing the historical object data and the new object data to obtain a comparison result comprises the following steps.
[0020] Data objects of target data corresponding to the new rich text data and data objects of source data corresponding to the historical object data are loaded, and different points of the target data and the source data are obtained by calling diff, and difference format data is calculated based on the different points.
[0021] In a possible implementation, after the step of comparing the historical object data and the new object data to obtain a comparison result, the method further comprises the following steps.
[0022] Based on the comparison result between the historical rich text data and the new rich text data, in a graphical user interface of a web system, content that is unchanged in the comparison result is displayed through a first preset font, content that is deleted in the comparison result is displayed through the first preset font, and content that is added in the comparison result is displayed through the first preset font.
[0023] In a second aspect, an object data comparison device is provided, comprising:
[0024] an acquisition module configured to acquire historical object data and new object data respectively, wherein the new object data is used to represent data of a new operation on a web system;
[0025] a comparison module configured to compare the historical object data and the new object data to obtain a comparison result, and determine an object attribute of the new object data according to the comparison result;
[0026] a storage module configured to store the comparison result and the object attribute into different storage media based on different use scenarios and / or different user requirements of the web system.
[0027] In a third aspect, an electronic device is provided, comprising a memory and a processor, the memory storing a computer program executable on the processor, and the processor executes the computer program to implement the method of the first aspect.
[0028] In a fourth aspect, a computer readable storage medium is provided, the computer readable storage medium storing computer executable instructions, and the computer executable instructions, when invoked and executed by a processor, cause the processor to execute the method of the first aspect.
[0029] The embodiments of the present application bring the following beneficial effects:
[0030] The object data comparison method, device and electronic equipment provided by the embodiment of the application can respectively acquire historical object data and new object data, wherein the new object data is used to represent data of a new operation on a web system; the historical object data and the new object data are compared to obtain a comparison result, and an object attribute of the new object data is determined according to the comparison result; and the comparison result and the object attribute are stored in different storage media based on different use scenarios and / or different user requirements of the web system. In the scheme, the historical object data and the new object data used to represent data of a new operation on a web system are compared, the object attribute of the new object data is determined according to the comparison result, and the comparison result and the object attribute are stored in different storage media based on different use scenarios and / or different user requirements of the web system, so that automatic and accurate comparison of the historical object data before the new operation and the new object data after the new operation is realized, and intelligent storage of the comparison result is realized. After data migration or upgrading or different business parties process data according to requirements, the difference between the two sides of the data can be efficiently and accurately determined, the problems in data migration comparison, user permission approval assistance and the like are solved, and the method has been applied in actual projects, thereby improving the work efficiency of data processing.
[0031] In order to make the above objectives, characteristics and advantages of the application more apparent, the following will describe a preferred embodiment in detail, and the accompanying drawings will be described as follows. BRIEF DESCRIPTION OF DRAWINGS
[0032] In order to more clearly illustrate the specific embodiments of the application or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the specific embodiments or the prior art description. Obviously, the drawings in the following description are some embodiments of the application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.
[0033] Figure 1 Flowchart of the object data comparison method provided by the embodiment of the application;
[0034] Figure 2 Another flowchart of the object data comparison method provided by the embodiment of the application;
[0035] Figure 3 Structured data effect diagram of the object data comparison provided by the embodiment of the application;
[0036] Figure 4 Rich text data effect diagram of the object data comparison provided by the embodiment of the application
[0037] Figure 5A structural schematic diagram of an object data comparison device provided by an embodiment of the present application is provided.
[0038] Figure 6 A structural schematic diagram of an electronic device provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0039] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of the present application will be described below in detail with reference to the accompanying drawings. Obviously, the described embodiments are only some but not all of the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts should fall within the scope of the present application.
[0040] The terms “comprise” and “have” and any variations thereof mentioned in the embodiments of the present application are intended to cover the inclusions without being exclusive. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but optionally further includes other steps or units not listed or optionally further includes other steps or units inherent to the process, method, product or device.
[0041] At present, in most web application systems, there will be a user role with approval authority. Due to the complexity of data, each piece of data will have many attribute fields. In order for the approver to approve the data, he needs to quickly find out which fields have been modified, so as to decide whether the approval can pass. At present, the user needs to check each field to make a decision, which seriously affects the work efficiency. Moreover, in the existing scheme, the data needs to be manually compared, which leads to low data processing efficiency.
[0042] Based on this, the embodiments of the present application provide an object data comparison method and device and an electronic device. Through the method, the technical problem of low data processing efficiency can be alleviated.
[0043] The embodiments of the present application will be further described below with reference to the accompanying drawings.
[0044] Figure 1 A flowchart of an object data comparison method provided by an embodiment of the present application is shown. The object data comparison method can be applied to an electronic terminal. As shown in the figure, the method comprises the following steps. Figure 1
[0045] In step S110, historical object data and new object data are respectively acquired.
[0046] The new object data is used to represent data of a new operation of the web system. For a user of the web system, each operation of adding, deleting, or modifying the system is a comparison process of data. The data of the new operation needs to be compared with historical data in the database, and the comparison data source needs to be obtained before comparison.
[0047] In actual applications, as shown in Figure 2 , for a big data developer, the new data and the historical data can be obtained from different databases, local system files, cache databases, message middleware, and the like.
[0048] As a possible implementation, the first data source obtains structured data or rich text data from the historical data, and the second data source obtains new structured data or rich text data.
[0049] In step S120, the historical object data and the new object data are compared to obtain a comparison result, and the object attribute of the new object data is determined according to the comparison result.
[0050] In this step, the data object comparison method is called to compare the two object data, as shown in Figure 2 , the object attribute is distinguished as new data, modified data, or deleted data. For example, each operation of adding, deleting, or modifying the web system is a comparison process of data, and the data of the new operation is compared with the historical data in the database.
[0051] In step S130, the comparison result and the object attribute are stored in different storage media based on different use scenarios and / or different user requirements of the web system.
[0052] For the storage of the comparison result, as shown in Figure 2 , the result calculated by the comparison method can be stored in different storage media according to requirements or use scenarios, for example, local files (excel, csv), relational databases (mysql, oracle), cache databases (redis, memcached), message middleware (Kafka, ActiveMQ), and the like, and the storage is convenient and flexible.
[0053] For example, as shown in Figure 2 , the data compared by the method can be stored in different storage schemes according to different users and use scenarios. For example, a developer can export the comparison data to a file (excel, csv) for data migration comparison; and a web application system can save the comparison result data in a cache database for web page differential display, so that the storage scheme is more flexible.
[0054] In the embodiments of the present application, by comparing the historical object data and the new object data representing the data of the new operation of the web system, and determining the object attribute of the new object data according to the comparison result, and then storing the comparison result and the object attribute into different storage media based on different use scenarios and / or different user needs of the web system, automatic and accurate comparison of the historical object data before the new operation and the new object data after the new operation is realized, and intelligent storage of the comparison result is realized. After data migration or upgrading or different business parties process data according to needs, the differences between the two sides of the data can be efficiently and accurately determined, the problems of data migration comparison, assisting user permission approval and the like are solved, and the method has been applied in actual projects, and the work efficiency of data processing is improved.
[0055] The above steps will be described in detail below.
[0056] In some embodiments, before step S120, the method can further include the following steps:
[0057] Step a), determining a comparison field condition.
[0058] The comparison field condition includes: comparing all attribute fields in the historical object data and the new object data, or comparing selected part of the attribute fields in the historical object data and the new object data according to user needs.
[0059] Before comparing the historical object data and the new object data, as shown in Figure 2 , the comparison field condition is determined first. For the user of the web system, the compared field is all the attribute fields of the current module record by default. For the big data development worker, the selection of the compared field is flexible, and different comparison can be obtained according to needs.
[0060] In the embodiments of the present application, after the comparison field condition is selected, the historical object data and the new object data are compared according to the selected comparison field condition, and then the comparison efficiency is improved.
[0061] In some embodiments, the object attribute includes any one or more of the following: new data, modified data, and deleted data. The process of determining the object attribute of the new object data according to the comparison result in step S120 can include the following steps:
[0062] Step b), determining the operation content of the new object data corresponding to the new operation as new data, modified data or deleted data according to the comparison result.
[0063] As a possible implementation, as shown in Figure 2As shown, in each operation of adding, deleting or modifying the system, it is a comparison process of data, the new operation data is compared with the historical data in the database, so that the new object data corresponding to the new operation is more efficiently and accurately determined as new data, modified data or deleted data.
[0064] In some embodiments, the historical object data is historical structured data, and the new object data is new structured data; the process of comparing the historical object data and the new object data to obtain the comparison result in the step S120 can include the following steps:
[0065] Step c), obtaining the attribute values of the new structured data and the historical structured data through the reflection mechanism, and comparing the memory addresses of each attribute value;
[0066] Step d), if the memory addresses are the same, it is determined that the comparison result is that the attribute values are the same;
[0067] Step e), if the memory addresses are different, it is determined that the comparison result is that the attribute values are different, and the different attribute values are stored in the Map.
[0068] For the structured data comparison method, for example, through the reflection mechanism of java, the attribute values of the new data object and the historical object are obtained, and the memory address space of each attribute value is compared. If the memory addresses are the same, it means the same value, and if the memory addresses are different, it means different values. The different attribute values are stored in the Map, the key is the attribute field, and the value is the stored new value and historical value. In this way, the differences between the historical structured data and the new structured data are more efficiently and accurately compared.
[0069] Based on the above steps c), d) and e), the process of comparing the historical object data and the new object data to obtain the comparison result in the step S120 further includes:
[0070] Step f), according to the comparison result between the historical structured data and the new structured data, the new data, the modified data or the deleted data are distinguished, and the changed data are highlighted in the corresponding graphical user interface of the web system. When the cursor moves to the field data, the corresponding historical structured data of the field data is displayed in a suspended manner.
[0071] In the embodiments of the present application, the comparison result data can be displayed in the system interface in real time, for example, Figure 2The object data comparison structured data effect picture is provided. For the structured data, exemplary comparison is performed according to the structured data of two objects, the newly added data, the modified data or the deleted data is distinguished, the data with changes is highlighted in the web application, and when the mouse is moved to the field data, the historical data can be displayed in suspension, which can effectively assist the user to quickly perform data research and judgment.
[0072] In some embodiments, the historical object data is historical rich text data, and the new object data is new rich text data; the process of comparing the historical object data and the new object data to obtain the comparison result in the step S120 can include the following steps:
[0073] Step g), loading the data object of the target data corresponding to the new rich text data and the data object of the source data corresponding to the historical object data, and obtaining the data of the difference between the target data and the source data by calling diff, and calculating the difference format data based on the data of the difference.
[0074] For the rich text data comparison method, exemplary implementation is achieved by using java-diff-util dependent library, the diff is the difference between the target data and the source data, that is, the operation required to change the source data into the target data, and the underlying is based on Myers algorithm. Usually, the target data and the source data two data objects are first loaded, the data of the difference between the two objects is obtained by calling the diff method, the unified difference format data is calculated and produced, and is output to the storage medium. In this way, the difference data between the historical rich text data and the new rich text data can be more efficiently and accurately compared.
[0075] Based on the above step g), the process of comparing the historical object data and the new object data to obtain the comparison result in the step S120 further includes:
[0076] Step h), based on the comparison result between the historical rich text data and the new rich text data, in the graphical user interface corresponding to the web system, the unchanged content in the comparison result is displayed by using the first preset font, the deleted content in the comparison result is displayed by using the first preset font, and the newly added content in the comparison result is displayed by using the first preset font.
[0077] In actual application, the comparison result data can be displayed in the system interface in real time, for example, Figure 3 The object data comparison rich text data effect picture is provided. For the rich text data, exemplary comparison is performed according to the contents of two rich text objects, the unchanged content is displayed by using black font, the deleted content is displayed by using red font, and the newly added content is displayed by using green font. Therefore, the user can quickly and efficiently observe whether the rich text content is modified.
[0078] Figure 5 A structural diagram of an object data comparison device is provided. As shown in Figure 5 The object data comparison device 500 includes:
[0079] An acquisition module 501 is configured to acquire historical object data and new object data respectively; the new object data is used to represent data of a new operation on a web system;
[0080] A comparison module 502 is configured to compare the historical object data and the new object data to obtain a comparison result, and determine an object attribute of the new object data according to the comparison result;
[0081] A storage module 503 is configured to store the comparison result and the object attribute into different storage media based on different use scenarios and / or different user requirements of the web system.
[0082] In some embodiments, the device further includes:
[0083] A determination module is configured to determine a comparison field condition, wherein the comparison field condition includes: comparing all attribute fields in the historical object data and the new object data, or comparing selected partial attribute fields in the historical object data and the new object data according to user requirements.
[0084] In some embodiments, the object attribute includes any one or more of the following: new data, modified data, deleted data; the comparison module is specifically configured to:
[0085] determine, according to the comparison result, that operation content of the new operation corresponding to the new object data is new data, modified data, or deleted data.
[0086] In some embodiments, the historical object data is historical structured data, and the new object data is new structured data; the comparison module is specifically configured to:
[0087] obtain attribute values of the new structured data and the historical structured data through a reflection mechanism, and compare memory addresses of each of the attribute values;
[0088] if the memory addresses are the same, determine that the comparison result is that the attribute values are the same;
[0089] if the memory addresses are different, determine that the comparison result is that the attribute values are different, and store the different attribute values in a Map.
[0090] In some embodiments, the device further includes:
[0091] The first display module is configured to distinguish added data, modified data or deleted data according to a comparison result between the historical structured data and the new structured data, and highlight the changed data in a graphical user interface of the web system, and display the historical structured data corresponding to the field data in a suspended manner when the cursor moves to the field data.
[0092] In some embodiments, the historical object data is historical rich text data, and the new object data is new rich text data; and the comparison module is specifically configured to:
[0093] load a data object of target data corresponding to the new rich text data and a data object of source data corresponding to the historical object data, and obtain data of different points of the target data and the source data by calling diff, and calculate difference format data based on the data of the different points.
[0094] In some embodiments, the apparatus further includes:
[0095] The second display module is configured to display unchanged content in the comparison result through a first preset font, display deleted content in the comparison result through the first preset font, and display added content in the comparison result through the first preset font in a graphical user interface of the web system based on a comparison result between the historical rich text data and the new rich text data.
[0096] The object data comparison apparatus provided by the embodiments of the present application has the same technical features as the object data comparison method provided by the above embodiments, and can solve the same technical problems and achieve the same technical effects.
[0097] The electronic device provided by the embodiments of the present application, as shown in Figure 6 The electronic device 600 includes a processor 602 and a memory 601, and the memory stores a computer program executable on the processor, and the processor executes the computer program to implement the steps of the method provided by the above embodiments.
[0098] Referring to Figure 6 , the electronic device further includes a bus 603 and a communication interface 604, and the processor 602, the communication interface 604 and the memory 601 are connected through the bus 603; and the processor 602 is configured to execute the executable modules stored in the memory 601, such as a computer program.
[0099] The memory 601 can include a high-speed random access memory (RAM) and can also include a non-volatile memory such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 604 (which can be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used.
[0100] The bus 603 can be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the figure to represent the bus, but it does not mean that there is only one bus or only one type of bus.
[0101] The memory 601 is used to store programs, and the processor 602 executes the programs after receiving execution instructions. The method executed by the device defined by the process disclosed in any embodiment of the present application can be applied to the processor 602 or implemented by the processor 602.
[0102] The processor 602 can be an integrated circuit chip having a processing capability for signals. In implementation, each step of the above method can be completed by integrated logic circuits of hardware or instructions in the form of software in the processor 602. The processor 602 described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. Each method, step and logic block diagram disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium in the art. The storage medium is located in the memory 601, and the processor 602 reads the information in the memory 601, and combines the hardware to complete the steps of the above method.
[0103] Corresponding to the above object data comparison method, the embodiments of the present application also provide a computer readable storage medium, the computer readable storage medium stores computer executable instructions, when the processor calls and runs the computer executable instructions, the computer executable instructions make the processor run the steps of the above object data comparison method.
[0104] The object data comparison device provided by the embodiments of the present application can be specific hardware on the device or software or firmware installed on the device. The device provided by the embodiments of the present application has the same implementation principle and technical effects as the foregoing method embodiments. For the sake of brevity, the part not mentioned in the device embodiment part can be referred to the corresponding content in the foregoing method embodiment. Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above can be referred to the corresponding process in the above method embodiment, which will not be repeated here.
[0105] In the embodiments of the present application, it should be understood that the disclosed apparatus and method can be implemented in other manners. The embodiments described above are merely specific implementation manners of the present application, and for example, the division of the units is only a logical function division, and there can be another division manner in actual implementation; for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different units, or the among different units, can be indirect couplings or communication connections through some interfaces, communication interfaces, or a combination of other forms, which can be electric, mechanical, or in other forms.
[0106] For another example, the flowcharts and block diagrams in the drawings show the possible implementation architectures, functions and operations of the apparatuses, methods and computer program products according to the embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different orders from that shown in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can 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 the combination of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0107] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., they can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments of the present application.
[0108] In addition, each functional unit in the embodiments of the present application can be integrated in one processing unit, or each unit can exist physically as a separate unit, or two or more units can be integrated in one unit.
[0109] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the parts of the present application that essentially contribute to the prior art or the parts of the technical solutions of the present application can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the object data comparison method described in the embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0110] It should be noted that similar reference numbers and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings, in addition, the terms "first", "second", "third" and the like are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0111] Finally, it should be noted that the above-described embodiments are only specific implementations of the present application, which are used to illustrate the technical solutions of the present application, but not to limit the present application, the protection scope of the present application is not limited to this, although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art within the technical scope disclosed by the present application can still modify or easily think of changes to the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part of the technical features, and these modifications, changes or replacements do not make the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application. All should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. An object data comparison method, characterized by, The method comprises: respectively acquiring historical object data and new object data; wherein the new object data is used to represent data of a new operation of a web system; comparing the historical object data and the new object data to obtain a comparison result, and determining an object attribute of the new object data according to the comparison result; storing the comparison result and the object attribute into different storage media based on different use scenarios and / or different user requirements of the web system; the historical object data is historical structured data, and the new object data is new structured data; the step of comparing the historical object data and the new object data to obtain a comparison result comprises: obtaining attribute values of the new structured data and the historical structured data through a reflection mechanism, and performing spatial comparison of memory addresses for each attribute value; if the memory addresses are the same, it is determined that the attribute values are the same; if the memory addresses are different, it is determined that the attribute values are different, and the different attribute values are stored in a Map.
2. The method of claim 1, wherein, Before the step of comparing the historical object data and the new object data to obtain a comparison result, the method further comprises: determining a comparison field condition, wherein the comparison field condition comprises: comparing all attribute fields in the historical object data and the new object data, or comparing selected attribute fields in the historical object data and the new object data according to user requirements.
3. The method of claim 1, wherein, The object attribute comprises any one or more of the following: new data, modified data, and deleted data; The step of determining the object attribute of the new object data according to the comparison result comprises: determining, according to the comparison result, that operation content corresponding to the new operation of the new object data is new data, modified data, or deleted data.
4. The method of claim 1, wherein, After the step of comparing the historical object data and the new object data to obtain a comparison result, the method further comprises: distinguishing new data, modified data, or deleted data according to the comparison result between the historical structured data and the new structured data, and highlighting the changed data in a graphical user interface of the web system; when a cursor moves to field data, the historical structured data corresponding to the field data is displayed in a suspended manner.
5. The method of claim 1, wherein, The historical object data is historical rich text data, and the new object data is new rich text data; the step of comparing the historical object data and the new object data to obtain a comparison result comprises: loading a data object of target data corresponding to the new rich text data and a data object of source data corresponding to the historical object data, and obtaining data of different points of the target data and the source data by calling diff, and calculating difference format data based on the data of different points.
6. The method of claim 5, wherein, After the step of comparing the historical object data and the new object data to obtain a comparison result, the method further comprises: Based on a comparison result between the historical rich text data and the new rich text data, in a graphical user interface corresponding to the web system, content unchanged in the comparison result is displayed by a first preset font, content deleted in the comparison result is displayed by a second preset font, and content added in the comparison result is displayed by a third preset font.
7. An object data comparison apparatus, characterized by comprising: Comprise: An acquisition module, configured to acquire historical object data and new object data respectively; wherein the new object data is used to represent data of a new operation on a web system; A comparison module, configured to compare the historical object data and the new object data to obtain a comparison result, and determine an object attribute of the new object data according to the comparison result; A storage module, configured to store the comparison result and the object attribute into different storage media based on different use scenarios and / or different user demands of the web system; The historical object data is historical structured data, and the new object data is new structured data; the comparison module is specifically configured to obtain attribute values of the new structured data and the historical structured data through a reflection mechanism, and compare spaces of memory addresses of each attribute value; if the memory addresses are the same, it is determined that the attribute values are the same; if the memory addresses are different, it is determined that the attribute values are different, and the different attribute values are stored in a Map.
8. An electronic device comprising a memory, a processor, the memory having stored therein a computer program executable on the processor, characterized in that, The processor executes the computer program to realize the steps of the method of any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer executable instructions, and when the computer executable instructions are called and run by the processor, the computer executable instructions cause the processor to run the method of any one of claims 1 to 6.
Citation Information
Patent Citations
Structured data comparison method and device, electronic equipment and storage medium
CN115357625A