CN116244371A - Data synchronization method, device, computer equipment and storage medium - Google Patents

Data synchronization method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN116244371A
CN116244371A CN202211640780.7A CN202211640780A CN116244371A CN 116244371 A CN116244371 A CN 116244371A CN 202211640780 A CN202211640780 A CN 202211640780A CN 116244371 A CN116244371 A CN 116244371A
Authority
CN
China
Prior art keywords
interface
field
document
interface frame
frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211640780.7A
Other languages
Chinese (zh)
Inventor
李伶俐
彭建豪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yundy Intelligent Technology Co ltd
Original Assignee
Yundy Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yundy Intelligent Technology Co ltd filed Critical Yundy Intelligent Technology Co ltd
Priority to CN202211640780.7A priority Critical patent/CN116244371A/en
Publication of CN116244371A publication Critical patent/CN116244371A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a data synchronization method, a data synchronization device, computer equipment and a storage medium. The method comprises the following steps: acquiring a mapping relation between related fields of a first interface frame and a second interface frame; the first interface frame corresponds to a field frame of a target bill in a target system; the second interface frame corresponds to a field frame of a source document in the source system related to at least one field in the target document; acquiring data to be synchronized corresponding to the second interface frame from the source system; and synchronizing the data to be synchronized to a target bill in the target system according to the mapping relation. By adopting the technical scheme provided by the embodiment of the application, the data synchronization can be accurately and efficiently performed.

Description

Data synchronization method, device, computer equipment and storage medium
Technical Field
The present invention relates to the field of computer application technologies, and in particular, to a data synchronization method, apparatus, computer device, and storage medium.
Background
In performing enterprise management, data forms in different enterprise management systems sometimes have dependencies, e.g., at least one field of one data form in one of the enterprise management systems may be related to at least one field of at least one data form in at least one other enterprise management system.
In the traditional technology, different enterprise management systems are independent, and data synchronization cannot be directly performed.
In order to realize data synchronization among related data forms of different management systems, a manual input mode is generally adopted at present, and the data synchronization method has low processing efficiency and is easy to make mistakes.
In another method, data packets are transmitted between different enterprise management systems, data to be synchronized is packaged and then sent to a target enterprise management system, and the target enterprise management system receives the data packets and then imports the total data of the data packets into relevant fields.
Therefore, how to accurately and efficiently synchronize data by different enterprise management systems is a technical problem to be solved.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a data synchronization method, apparatus, computer device, and storage medium.
In a first aspect, the present application provides a data synchronization method for performing data synchronization between a target system and a source system, where the method includes:
acquiring a mapping relation between related fields of a first interface frame and a second interface frame; the first interface frame corresponds to a field frame of a target bill in a target system; the second interface frame corresponds to a field frame of a source document in the source system related to at least one field in the target document;
Acquiring data to be synchronized corresponding to the second interface frame from the source system;
and synchronizing the data to be synchronized into the data records of the relevant fields in the first interface frame according to the mapping relation, and pushing the data records to target documents in the target system.
In one embodiment, before the obtaining the mapping relationship between the first interface frame and the second interface frame related field, the method further includes:
acquiring a first interface document corresponding to the target document from the target system; the first interface document is example code in the target system describing a field name and a field type in the target document;
and analyzing the first interface document to obtain the first interface frame corresponding to the first interface document.
In one embodiment, before the obtaining the mapping relationship between the first interface frame and the second interface frame related field, the method further includes:
acquiring a second interface document corresponding to the source document from the source system; the second interface document is example code in the source system describing field names and field types in the source document;
And analyzing the second interface document to obtain the second interface frame.
In one embodiment, before the obtaining the mapping relationship between the first interface frame and the second interface frame related field, the method further includes:
and acquiring the first interface frame, wherein the first interface frame is obtained by analyzing a first interface document by the target system, and the first interface document is an example code for describing field names and field types in the target document in the target system.
In one embodiment, before the obtaining the mapping relationship between the first interface frame and the second interface frame related field, the method further includes:
and acquiring the second interface framework, wherein the second interface framework is obtained by analyzing a second interface document by the source system, and the second interface document is an example code for describing field names and field types in the source document in the source system.
In one embodiment, before the obtaining the mapping relationship between the first interface frame and the second interface frame related field, the method further includes:
reading any record including fields in any interface document; the arbitrary interface document includes: a first interface document corresponding to the first interface frame or a second interface document corresponding to the second interface frame;
Obtaining a field name of a field included in any one record according to the any one record;
identifying a field type identifier in the any one record, wherein the field type identifier is related to a field included in the any one record;
determining the field type of the field included in any record according to the field type identifier;
and obtaining the interface frame corresponding to any interface document according to all the fields included in the any interface document and the field types respectively corresponding to the fields.
In one embodiment, when the field type of the field corresponding to the any record is an object type or an array type, determining the field corresponding to the subelement included in the field, and determining the hierarchical relationship between the field corresponding to each subelement corresponding to the any record and the any record.
In one embodiment, before parsing any interface document to obtain a corresponding interface frame, the method further includes:
determining whether the interface document has errors according to a preset check rule;
when the interface document is determined to have errors, the errors are positioned and/or the existing error information is displayed.
In one embodiment, before the obtaining the mapping relationship between the preset first interface frame and the second interface frame related field, the method further includes: and establishing a mapping relation between the relevant fields of the first interface frame and the second interface frame.
In a second aspect, the present application further provides a data synchronization apparatus for synchronizing data between a target system and a source system, the apparatus including:
the first acquisition module is used for acquiring the mapping relation between the relevant fields of the first interface frame and the second interface frame; the first interface frame corresponds to a field frame of a target bill in a target system; the second interface frame corresponds to a field frame of a source document in the source system related to at least one field in the target document;
the second acquisition module is used for acquiring data to be synchronized corresponding to the second interface frame from the source system;
and the synchronization module is used for synchronizing the data to be synchronized into the data records of the relevant fields in the first interface frame according to the mapping relation and pushing the data records to target documents in the target system.
In one embodiment, the system further includes an parsing module, and the second obtaining module is further configured to obtain, from the target system, a first interface document corresponding to the target document before the first obtaining module obtains a mapping relationship between related fields of the first interface frame and the second interface frame; the first interface document is example code in the target system describing a field name and a field type in the target document; the analysis module is used for analyzing the first interface document to obtain the first interface frame corresponding to the first interface document.
In one embodiment, the system further includes an parsing module, and the second obtaining module is further configured to obtain, from the source system, a second interface document corresponding to the source document before the first obtaining module obtains a mapping relationship between related fields of the first interface frame and the second interface frame; the second interface document is example code in the source system describing field names and field types in the source document; and the analysis module is used for analyzing the second interface document to obtain the second interface frame.
In one embodiment, the second obtaining module is further configured to obtain, before the mapping relationship between the first interface frame and the fields related to the second interface frame, the first interface frame obtained after the first interface frame is parsed by the target system, where the first interface document is an example code in the target system that describes a field name and a field type in the target document.
In one embodiment, the second obtaining module is further configured to obtain, before the mapping relationship between the first interface frame and the fields related to the second interface frame in the first obtaining module, the second interface frame obtained after the parsing of the second interface document by the source system, where the second interface document is an example code describing, in the source system, a field name and a field type in the source document.
In one embodiment, the method further comprises: the analysis module is used for reading any record including fields in any interface document; the arbitrary interface document includes: a first interface document corresponding to the first interface frame or a second interface document corresponding to the second interface frame; obtaining a field name of a field included in any one record according to the any one record; identifying a field type identifier in the any one record, wherein the field type identifier is related to a field included in the any one record; determining the field type of the field included in any record according to the field type identifier; and obtaining the interface frame corresponding to any interface document according to all the fields included in the any interface document and the field types respectively corresponding to the fields.
In one embodiment, when the field type of the field corresponding to the any record is an object type or an array type, the parsing module is further configured to determine a field corresponding to a subelement included in the field, and determine a hierarchical relationship between the any record and the field corresponding to each subelement corresponding to the any record.
In one embodiment, before any interface document is parsed to obtain a corresponding interface frame, the parsing module is further configured to determine whether an error exists in the interface document according to a preset verification rule; when the interface document is determined to have errors, the errors are positioned and/or the existing error information is displayed.
In one embodiment, the data synchronization device further includes: and the processing module is used for establishing a mapping relation between the relevant fields of the first interface frame and the second interface frame.
In a third aspect, the present application also provides a computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
acquiring a mapping relation between related fields of a first interface frame and a second interface frame; the first interface frame corresponds to a field frame of a target bill in a target system; the second interface frame corresponds to a field frame of a source document in the source system related to at least one field in the target document;
acquiring data to be synchronized corresponding to the second interface frame from the source system;
and synchronizing the data to be synchronized into the data records of the relevant fields in the first interface frame according to the mapping relation, and pushing the data records to target documents in the target system.
In a fourth aspect, the present application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
Acquiring a mapping relation between related fields of a first interface frame and a second interface frame; the first interface frame corresponds to a field frame of a target bill in a target system; the second interface frame corresponds to a field frame of a source document in the source system related to at least one field in the target document;
acquiring data to be synchronized corresponding to the second interface frame from the source system;
and synchronizing the data to be synchronized into the data records of the relevant fields in the first interface frame according to the mapping relation, and pushing the data records to target documents in the target system.
In a fifth aspect, the present application also provides a computer program product, the time program product comprising a computer program which, when executed by a processor, performs the steps of:
acquiring a mapping relation between related fields of a first interface frame and a second interface frame; the first interface frame corresponds to a field frame of a target bill in a target system; the second interface frame corresponds to a field frame of a source document in the source system related to at least one field in the target document;
Acquiring data to be synchronized corresponding to the second interface frame from the source system;
and synchronizing the data to be synchronized into the data records of the relevant fields in the first interface frame according to the mapping relation, and pushing the data records to target documents in the target system.
The data synchronization method, the data synchronization device, the computer equipment and the storage medium are characterized in that when data synchronization is carried out, the mapping relation between relevant fields of the first interface frame and the second interface frame is firstly obtained, then data to be synchronized corresponding to the second interface frame is obtained from a source system, and finally the data to be synchronized is synchronized to a target bill in a target system according to the mapping relation. By adopting the technical scheme provided by the embodiment of the application, the data synchronization can be accurately and efficiently performed.
Drawings
FIG. 1A is a schematic diagram of an application scenario of a data synchronization method in one embodiment;
FIG. 1B is a schematic diagram of an application scenario of a data synchronization method in another embodiment;
FIG. 2 is a flow chart of a data synchronization method in one embodiment;
FIG. 3 is a flow chart of a data synchronization method according to another embodiment;
FIG. 4 is a flow chart of a data synchronization method in another embodiment;
FIG. 5 is a schematic block diagram of a data synchronization device according to an embodiment;
FIG. 6 is a schematic diagram of the internal structure of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
Please refer to fig. 1A and fig. 1B, which correspond to an application scenario schematic diagram of a data synchronization method provided in the present application, respectively. As shown in fig. 1A, when data synchronization is performed, an application scenario may include a first terminal 101, a second terminal 102, and a third terminal 103. When data synchronization is required, the target system and the source system may be selected by the first terminal 101. The target system may be one terminal and the source system may be one or more terminals. As shown in fig. 1A, the second terminal 102 is a target system, the third terminal 103 is a source system, and the source system has one terminal. As shown in fig. 1B, the source system 103 may include a plurality of terminals. In performing data synchronization, the process flows of fig. 1A and 1B are similar, and for simplicity, embodiments of the present application are described in the context of fig. 1A. It should be noted that one or more fields in the target document of the target system are associated with one or more fields in the original document of the source system. It should be noted that, the source bill may include one bill or a plurality of bills, and when the source bill is a plurality of source bills, the source bill may come from one source system or may come from different source systems; for simplicity, embodiments of the present application are described in terms of multiple documents from one source system. It should be noted that, in the target document, the field requiring the synchronization data, for example, field 1 may be from field 2 of the source system, and the value of field 1 may be the same as the value of field 2; in some possible embodiments, the value of field 1 may also be obtained by a functional transformation using the value of field 2, for example, the value of field 1 may be twice the value of field 2. In some possible embodiments, the value of the field 1 may be related to more than one field 2, may be related to multiple fields, for example, the value of the field 1 in the target document may be determined by the values of three fields in the source document, such as the sum of the values of three fields of field 2, field 3, and field 4, or may be an average value of the sum of the values of three fields of field 2, field 3, and field 4, etc., which is not limited in this application. For simplicity, in the description of the following embodiments, the value of field 1 in the target form is equal to the value of field 2 in the source form. In the data synchronization, the first terminal 101 establishes a mapping relationship between the field 1 in the target document of the second terminal 102 as the target terminal and the field 2 in the source document of the third terminal 103 as the source terminal, and specifically, may establish a mapping through an interface frame corresponding to the target document of the second terminal 102 and an interface frame corresponding to the source document of the third terminal 103. Then, the first terminal 101 may acquire a record of the source document from the third terminal 103, where a value corresponding to the field 2 in the record of the source document is data to be synchronized; the first terminal 101 may synchronize the value of the field 2 in the original document record to the value corresponding to the field 1 in the target document of the second terminal 102 according to the mapping relationship. In some possible embodiments, the data synchronization may be performed in real time, or may be performed once at preset time intervals, for example, data synchronization is performed once every 5 minutes, and after the mapping relationship is established, the data synchronization scheme provided in this embodiment may implement automatic data synchronization, where the efficiency of data synchronization is high and errors are not easy to occur.
Fig. 2 is a schematic flow chart of data synchronization according to an embodiment of the present application. As shown in fig. 2, the data synchronization method includes steps 201 to 203, in which:
201. and obtaining the mapping relation between the relevant fields of the first interface frame and the second interface frame.
The first interface frame corresponds to a field frame of a target bill in the target system; the second interface frame corresponds to a field frame of a source document in the source system that is associated with at least one field in the target document.
The first interface frame can be obtained by analyzing an interface document corresponding to a target document in the target system. The interface document may record the field name of the target document, the hierarchical relationship between the fields, the data type corresponding to the fields, and the like.
In some embodiments, the interface frame may be obtained by parsing the interface document obtained by the data synchronizer, and in other embodiments, the interface frame may be transferred to the data synchronizer after parsing the respective interface document by the source system or the target system.
In some possible embodiments, before the obtaining the mapping relationship between the first interface frame and the second interface frame related field, the method further includes: reading any record including fields in any interface document; the arbitrary interface document includes: a first interface document corresponding to the first interface frame or a second interface document corresponding to the second interface frame; obtaining the field name of the field included in any record according to any record; identifying a field type identifier in any one record associated with a field included in any one record; determining the field type of the field included in any record according to the field type identifier; and obtaining the interface frame corresponding to any interface document according to all the fields included in any interface document and the field types respectively corresponding to the fields. For example, when a colon is followed by an adjacent symbol, and a numerical value is followed by a colon, it is determined that the field corresponding to the field name is a numerical value type field. When a colon is followed by an adjacent symbol, and a bracket is followed by the colon, it is determined that the field corresponding to the field name is the field of the object type. When a colon is followed by an adjacent symbol after a field name and a bracket is followed by a colon, it is determined that the field corresponding to the field name is an array type field. It should be noted that, the setting and the judging rule of the field type may be set according to the specific situation, and are not limited to the foregoing examples, and the field type and the judging rule of the field type are not limited in this application.
In some possible embodiments, when the field type of the field corresponding to any record is an object type or an array type, determining a field corresponding to a subelement included in the field, and determining a hierarchical relationship between the field corresponding to each subelement corresponding to any record and any record. For example, if a field with a field name of data is followed by a colon and a bracket in the interface document, it may be determined that data is an object type, if three fields with field names of data1, data2, and data3 separated by commas are included in the bracket, it may be determined that the fields with field names of data1, data2, and data3 are sub-elements of the data field, respectively, and the data1 field, the data2 field, and the data3 field are all next-level fields of the data field.
In some possible embodiments, before parsing any interface document to obtain a corresponding interface frame, the method may further include: determining whether an interface document has errors according to a preset check rule; when it is determined that an error exists in the interface document, the error is located and/or the error information that exists is displayed. For example, if a colon follows the data field, a bracket follows the colon, it may be determined that the data field is of the object type, if the preset check rule includes: the brackets include the left symbol "{" and the right symbol "}", both symbols being used in pairs, between which is the next level field of the object type field. If in some embodiments, the brackets behind the colon have only left symbols "{" no right symbols "}", then it may be determined that an error exists in the interface document according to a preset verification rule, the left symbols "{" may be displayed with a preset background color, for example, yellow may be used as the background color of the left characters "{" and a display interface may also indicate that a right symbol "}" corresponding to the left symbols "{" is absent. Yellow can be used as a background color of the left character "{" and the display interface can prompt the lack of the right symbol "}" corresponding to the left symbol "{". It should be noted that, the preset calibration rule may be set according to a specific situation, and the specific content of the preset calibration rule is not limited in the present application.
Before obtaining the mapping relation between the first interface frame and the second interface frame related field, the method may further include: and establishing a mapping relation between the relevant fields of the first interface frame and the second interface frame.
202. And acquiring data to be synchronized corresponding to the second interface frame from the source system.
For example, the data to be synchronized may be obtained in real time, or may be obtained once at preset time intervals.
203. And synchronizing the data to be synchronized into the data records of the relevant fields in the first interface frame according to the mapping relation, and pushing the data records to target documents in the target system.
And the target system completes data synchronization after receiving the data record.
By adopting the technical scheme provided by the embodiment, when data synchronization is performed, the mapping relation between the relevant fields of the first interface frame and the second interface frame is firstly obtained, then the data to be synchronized corresponding to the second interface frame is obtained from the source system, and finally the data to be synchronized is synchronized to the target bill in the target system according to the mapping relation. By adopting the technical scheme provided by the embodiment, the data synchronization can be accurately and efficiently performed.
Fig. 3 is a schematic flow chart of data synchronization according to an embodiment of the present application. As shown in fig. 3, the data synchronization method includes steps 301 to 307, wherein:
301. And acquiring a first interface document corresponding to the target document from the target system.
In some possible implementations, the interface document corresponding to the target document of the target system may be copied and pasted in the resolution panel. For example, as shown below, is part of an interface document for a target system. The interface document comprises a field name and a field value in the target document, and the data type corresponding to each field can be identified according to the field value.
Figure BDA0004008916210000101
302. And analyzing the first interface document to obtain a first interface frame corresponding to the first interface document.
For the example illustrated in step 301, the interface frame corresponding to the interface document may be obtained by parsing based on the information displayed in the code corresponding to the interface document. When parsing is performed, any record including fields in the interface document is traversed; obtaining the field name of the field included in any record according to any record; identifying a field type identifier in any one record associated with a field included in any one record; the field type of the field included in any record can be determined according to the field type identifier; and obtaining the interface frame corresponding to any interface document according to all the fields included in any interface document and the field types respectively corresponding to the fields. For example, when a colon is followed by an adjacent symbol, and a numerical value is followed by a colon, it is determined that the field corresponding to the field name is a numerical value type field, such as a FitemID field. When a colon is followed by an adjacent symbol, and a bracket is followed by a colon, it is determined that the field corresponding to the field name is a field of the object type, such as a Data field. When a colon is followed by an adjacent symbol, and a bracket is followed by a colon, it is determined that the field corresponding to the field name is an array type field, such as a List field. When a colon is given when a symbol is adjacent to the field name, and a true is given after the colon, it is determined that the field corresponding to the field name is a field of the Boolean type. It should be noted that, the setting and the judging rule of the field type may be set according to the specific situation, and are not limited to the foregoing examples, and the field type and the judging rule of the field type are not limited in this application.
As shown in table one below, is part of an interface framework that corresponds to an interface document in one embodiment.
The fields with field names data, list, FItemID, FItemClassID, FParentID, FLevel, FDetail, FNane, FFullNumber, FShortNumber, FFullame, VVID, FModifyTime and the like can be obtained by analyzing the interface document, and the types of the fields are identified. Such as data field is Object type data, list is Array type data, FItemID is Number value type data, FItemClassID is Number value type data, fpartentid is Number value type data, flex is Number value type data, FDetail is Boolean type data, etc.
When the field type of the field corresponding to any record is the object type or the array type, determining the field corresponding to the subelement included in the field, and determining the hierarchical relationship between the field corresponding to each subelement corresponding to any record and any record. For example, as shown in table one, the Data field is object type Data, the List field is array type Data, and the List field is a next-level field of the Data field. For another example, the List field is array type data, including a plurality of elements, the first element being object type data, the object type including the following elements: FItemID, FItemClassID, FParentID, FLevel, FDetail, FNane, FFullNumber, FShortNumber, FFullame, UUID, FModifyTime. The hierarchical relationship between fields can be represented by a vertically-oriented indented style of field names in table 1, and the corresponding hierarchical relationship from left to right in the starting position is from high to low, for example, the Data field is the higher-level Data of the List field. The FItemID field is the same as the FItemClassID field by the same distance to the left of the table to the left of the position of the hint in the table, and is the same level field as the FItemClassID field.
List one
Figure BDA0004008916210000121
303. And acquiring a second interface document corresponding to the source document from the source system.
304. And analyzing the second interface document to obtain a second interface frame corresponding to the second interface document.
305. And establishing a mapping relation between the relevant fields of the first interface frame and the second interface frame.
The first interface frame corresponds to a field frame of a target bill in the target system; the second interface frame corresponds to a field frame of a source document in the source system that is associated with at least one field in the target document.
The first interface frame can be obtained by analyzing an interface document corresponding to a target document in the target system. The interface document may record the field name of the target document, the hierarchical relationship between the fields, the data type corresponding to the fields, and the like.
In some embodiments, the interface frame may be obtained by parsing the interface document obtained by the data synchronizer, and in other embodiments, the interface frame may be transferred to the data synchronizer after parsing the respective interface document by the source system or the target system.
306. And obtaining the mapping relation between the relevant fields of the first interface frame and the second interface frame.
307. And acquiring data to be synchronized corresponding to the second interface frame from the source system.
For example, the data to be synchronized may be acquired, or may be acquired at intervals of a predetermined time.
308. And synchronizing the data to be synchronized into the data records of the relevant fields in the first interface frame according to the mapping relation, and pushing the data records to target documents in the target system.
When the technical scheme provided by the embodiment is adopted for data synchronization, an interface document is firstly obtained, then the interface document is analyzed and analyzed to obtain an interface frame, then a mapping relation between a first interface frame of a target system and related fields of a second interface frame of a source system is established, then data to be synchronized corresponding to the second interface frame is obtained from the source system, and finally the data to be synchronized is synchronized to a target document in the target system according to the mapping relation. By adopting the technical scheme provided by the application, the data synchronization can be accurately and efficiently performed.
Fig. 4 is a schematic flow chart of data synchronization according to an embodiment of the present application. As shown in fig. 4, the data synchronization method includes steps 401 to 405, wherein:
401. a first interface frame is acquired.
In this embodiment, the first interface framework is obtained by parsing a first interface document by the target system, where the first interface document is an example code describing a field name and a field type in the target document in the target system.
402. A second interface frame is acquired.
In this embodiment, the second interface framework is obtained by parsing a second interface document by the source system, where the second interface document is an example code describing a field name and a field type in the source document in the source system.
403. And establishing a mapping relation between the relevant fields of the first interface frame and the second interface frame.
The first interface frame corresponds to a field frame of a target bill in the target system; the second interface frame corresponds to a field frame of a source document in the source system that is associated with at least one field in the target document.
The first interface frame can be obtained by analyzing an interface document corresponding to a target document in the target system. The interface document may record the field name of the target document, the hierarchical relationship between the fields, the data type corresponding to the fields, and the like.
In some embodiments, manual configuration information of a user may be received, the manual configuration information indicating a mapping relationship between the first interface frame and the second interface frame related field, and the mapping relationship of the first interface frame and the second interface frame related field is established according to the manual configuration information. The interface frame may be obtained by parsing the interface document obtained by the data synchronizer, and in other embodiments, the interface frame may be transferred to the data synchronizer after parsing the respective interface document by the source system or the target system.
404. And obtaining the mapping relation between the relevant fields of the first interface frame and the second interface frame.
405. And acquiring data to be synchronized corresponding to the second interface frame from the source system.
For example, the data to be synchronized may be acquired, or may be acquired at intervals of a predetermined time.
406. And synchronizing the data to be synchronized into the data records of the relevant fields in the first interface frame according to the mapping relation, and pushing the data records to target documents in the target system.
When the technical scheme provided by the embodiment is adopted for data synchronization, the first interface frame and the second interface frame are firstly obtained, then the mapping relation between the first interface frame of the target system and the relevant fields of the second interface frame of the source system is established, then the data to be synchronized corresponding to the second interface frame is obtained from the source system, and finally the data to be synchronized is synchronized to the target bill in the target system according to the mapping relation. By adopting the technical scheme provided by the application, the data synchronization can be accurately and efficiently performed.
It should be understood that, although the steps in the flowcharts as related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least a part of the steps or stages in other steps or other steps.
Based on the same inventive concept, the embodiment of the application also provides a data synchronization device for realizing the above related data synchronization method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in one or more embodiments of the data synchronization device provided below may refer to the limitation of the data synchronization method hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 5, there is provided a data synchronization apparatus 500 comprising: a first acquisition module 501, a second acquisition module 502, and a synchronization module 503. Wherein: a first obtaining module 501, configured to obtain a mapping relationship between related fields of the first interface frame and the second interface frame; the first interface frame corresponds to a field frame of a target bill in the target system; the second interface frame corresponds to a field frame of a source document related to at least one field in the target document in the source system; a second obtaining module 502, configured to obtain data to be synchronized corresponding to the second interface frame from the source system; and the synchronization module 503 is configured to synchronize the data to be synchronized to the data records of the relevant fields in the first interface frame according to the mapping relationship, and push the data records to the target document in the target system.
In one embodiment, the system further comprises an analysis module, and the second acquisition module is further configured to acquire a first interface document corresponding to the target document from the target system before the first acquisition module acquires the mapping relationship between the first interface frame and the related field of the second interface frame; the first interface document is example code in the target system describing field names and field types in the target document; the analysis module is used for analyzing the first interface document to obtain a first interface frame corresponding to the first interface document.
In one embodiment, the system further comprises an analyzing module, and the acquiring module is further configured to acquire a second interface document corresponding to the source document from the source system before the processing module establishes a mapping relationship between relevant fields of the first interface frame and the second interface frame; the second interface document is example code in the source system describing field names and field types in the source document; the analysis module is used for analyzing the second interface document to obtain a second interface frame.
In one embodiment, the second obtaining module is further configured to obtain, before the mapping relationship between the first interface frame and the fields related to the second interface frame in the first obtaining module, the first interface frame obtained after the target system parses the first interface document, where the first interface document is an example code describing, in the target system, a field name and a field type in the target document.
In one embodiment, the second obtaining module is further configured to obtain, before the mapping relationship between the first interface frame and the fields related to the second interface frame in the first obtaining module, the second interface frame obtained after the source system parses the second interface document, where the second interface document is an example code describing, in the source system, a field name and a field type in the source document.
In one embodiment, the data synchronization device further includes: and a processing module. The processing module is used for establishing a mapping relation between relevant fields of the first interface frame and the second interface frame.
The modules in the data synchronization device may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 6. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer equipment is used for storing stock quantity prediction models corresponding to different ex-warehouse types. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a data synchronization method. The display unit of the computer device is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 6 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of: acquiring a mapping relation between related fields of a first interface frame and a second interface frame; the first interface frame corresponds to a field frame of a target bill in the target system; the second interface frame corresponds to a field frame of a source document related to at least one field in the target document in the source system; acquiring data to be synchronized corresponding to a second interface frame from a source system; and synchronizing the data to be synchronized into the data records of the relevant fields in the first interface frame according to the mapping relation, and pushing the data records to target documents in the target system.
In one embodiment, before obtaining the mapping relationship between the first interface frame and the second interface frame related fields, the processor when executing the computer program further implements the steps of: acquiring a first interface document corresponding to a target document from a target system; the first interface document is example code in the target system describing field names and field types in the target document; and analyzing the first interface document to obtain a first interface frame corresponding to the first interface document.
In one embodiment, before obtaining the mapping relationship between the first interface frame and the second interface frame related fields, the processor when executing the computer program further implements the steps of: acquiring a second interface document corresponding to the source bill from the source system; the second interface document is example code in the source system describing field names and field types in the source document; and analyzing the second interface document to obtain a second interface frame.
In one embodiment, before obtaining the mapping relationship between the first interface frame and the second interface frame related field, the processor further implements the following steps when executing the computer program: and acquiring a first interface frame, wherein the first interface frame is obtained after the target system analyzes a first interface document, and the first interface document is an example code for describing field names and field types in the target document in the target system.
In one embodiment, before obtaining the mapping relationship between the first interface frame and the second interface frame related fields, the processor when executing the computer program further implements the steps of: and acquiring a second interface frame, wherein the second interface frame is obtained after the source system analyzes a second interface document, and the second interface document is an example code for describing field names and field types in the source document in the source system.
In one embodiment, before acquiring the preset mapping relationship between the relevant fields of the first interface frame and the second interface frame, the processor executes the computer program to further implement the following steps: and establishing a mapping relation between the relevant fields of the first interface frame and the second interface frame.
In one embodiment, the data to be synchronized is synchronized to a target document in a target system according to a mapping relationship, and the processor executes a computer program to concretely implement the following steps: and synchronizing the data to be synchronized into the data records of the relevant fields in the first interface frame according to the mapping relation, and pushing the data records to the target system.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of: acquiring a mapping relation between related fields of a first interface frame and a second interface frame; the first interface frame corresponds to a field frame of a target bill in the target system; the second interface frame corresponds to a field frame of a source document related to at least one field in the target document in the source system; acquiring data to be synchronized corresponding to a second interface frame from a source system; and synchronizing the data to be synchronized into the data records of the relevant fields in the first interface frame according to the mapping relation, and pushing the data records to target documents in the target system.
In one embodiment, before obtaining the mapping relationship between the first interface frame and the second interface frame related fields, the computer program when executed by the processor further implements the steps of: acquiring a first interface document corresponding to a target document from a target system; the first interface document is example code in the target system describing field names and field types in the target document; and analyzing the first interface document to obtain a first interface frame corresponding to the first interface document.
In one embodiment, before obtaining the mapping relationship between the first interface frame and the second interface frame related fields, the computer program when executed by the processor further implements the steps of: acquiring a second interface document corresponding to the source bill from the source system; the second interface document is example code in the source system describing field names and field types in the source document; and analyzing the second interface document to obtain a second interface frame.
In one embodiment, before obtaining the mapping relationship between the first interface frame and the second interface frame related fields, the computer program when executed by the processor further implements the steps of: and acquiring a first interface frame, wherein the first interface frame is obtained after the target system analyzes a first interface document, and the first interface document is an example code for describing field names and field types in the target document in the target system.
In one embodiment, before obtaining the mapping relationship between the first interface frame and the second interface frame related fields, the computer program when executed by the processor further implements the steps of: and acquiring a second interface frame, wherein the second interface frame is obtained after the source system analyzes a second interface document, and the second interface document is an example code for describing field names and field types in the source document in the source system.
In one embodiment, before obtaining the preset mapping relationship between the relevant fields of the first interface frame and the second interface frame, the computer program when executed by the processor further implements the following steps: and establishing a mapping relation between the relevant fields of the first interface frame and the second interface frame.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of: acquiring a mapping relation between related fields of a first interface frame and a second interface frame; the first interface frame corresponds to a field frame of a target bill in the target system; the second interface frame corresponds to a field frame of a source document related to at least one field in the target document in the source system; acquiring data to be synchronized corresponding to a second interface frame from a source system; and synchronizing the data to be synchronized into the data records of the relevant fields in the first interface frame according to the mapping relation, and pushing the data records to target documents in the target system.
In one embodiment, before obtaining the mapping relationship between the first interface frame and the second interface frame related fields, the computer program when executed by the processor further implements the steps of: acquiring a first interface document corresponding to a target document from a target system; the first interface document is example code in the target system describing field names and field types in the target document; and analyzing the first interface document to obtain a first interface frame corresponding to the first interface document.
In one embodiment, before obtaining the mapping relationship between the first interface frame and the second interface frame related fields, the computer program when executed by the processor further implements the steps of: acquiring a second interface document corresponding to the source bill from the source system; the second interface document is example code in the source system describing field names and field types in the source document; and analyzing the second interface document to obtain a second interface frame.
In one embodiment, before obtaining the mapping relationship between the first interface frame and the second interface frame related fields, the computer program when executed by the processor further implements the steps of: and acquiring a first interface frame, wherein the first interface frame is obtained after the target system analyzes a first interface document, and the first interface document is an example code for describing field names and field types in the target document in the target system.
In one embodiment, before obtaining the mapping relationship between the first interface frame and the second interface frame related fields, the computer program when executed by the processor further implements the steps of: and acquiring a second interface frame, wherein the second interface frame is obtained after the source system analyzes a second interface document, and the second interface document is an example code for describing field names and field types in the source document in the source system.
In one embodiment, before obtaining the preset mapping relationship between the relevant fields of the first interface frame and the second interface frame, the computer program when executed by the processor further implements the following steps: and establishing a mapping relation between the relevant fields of the first interface frame and the second interface frame.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description. The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (10)

1. A method of data synchronization for a target system to synchronize data with a source system, the method comprising:
acquiring a mapping relation between related fields of a first interface frame and a second interface frame; the first interface frame corresponds to a field frame of a target bill in a target system; the second interface frame corresponds to a field frame of a source document in the source system related to at least one field in the target document;
Acquiring data to be synchronized corresponding to the second interface frame from the source system;
and synchronizing the data to be synchronized into the data records of the relevant fields in the first interface frame according to the mapping relation, and pushing the data records to target documents in the target system.
2. The method of claim 1, wherein prior to the obtaining the mapping between the first interface frame and the second interface frame related fields, the method further comprises:
acquiring a first interface document corresponding to the target document from the target system; the first interface document is example code in the target system describing a field name and a field type in the target document; analyzing the first interface document to obtain the first interface frame corresponding to the first interface document; acquiring a second interface document corresponding to the source document from the source system; the second interface document is example code in the source system describing field names and field types in the source document; analyzing the second interface document to obtain an implementation second interface frame; or alternatively, the process may be performed,
The method comprises the steps that a first interface frame is obtained, and the first interface frame is obtained after a first interface document is analyzed by the target system, wherein the first interface document is an example code for describing field names and field types in a target document in the target system; and acquiring the second interface framework, wherein the second interface framework is obtained by analyzing a second interface document by the source system, and the second interface document is an example code for describing field names and field types in the source document in the source system.
3. The method of claim 1, wherein prior to the obtaining the mapping between the first interface frame and the second interface frame related fields, the method further comprises:
reading any record including fields in any interface document; the arbitrary interface document includes: a first interface document corresponding to the first interface frame or a second interface document corresponding to the second interface frame;
obtaining a field name of a field included in any one record according to the any one record;
identifying a field type identifier in the any one record, wherein the field type identifier is related to a field included in the any one record;
Determining the field type of the field included in any record according to the field type identifier;
and obtaining the interface frame corresponding to any interface document according to all the fields included in the any interface document and the field types respectively corresponding to the fields.
4. A method according to claim 3, wherein when the field type of the field corresponding to the any one record is an object type or an array type, determining the field corresponding to the subelement included in the field, and determining the hierarchical relationship between the field corresponding to each subelement corresponding to the any one record.
5. A method according to claim 3, further comprising, prior to parsing any interface document to obtain a corresponding interface frame:
determining whether the interface document has errors according to a preset check rule;
when the interface document is determined to have errors, the errors are positioned and/or the existing error information is displayed.
6. The method according to any one of claims 1 to 5, wherein before the obtaining the mapping relationship between the preset first interface frame and the second interface frame related field, the method further comprises:
And establishing a mapping relation between the relevant fields of the first interface frame and the second interface frame.
7. A data synchronization apparatus for synchronizing data between a target system and a source system, the apparatus comprising:
the first acquisition module is used for acquiring the mapping relation between the relevant fields of the first interface frame and the second interface frame; the first interface frame corresponds to a field frame of a target bill in a target system; the second interface frame corresponds to a field frame of a source document in the source system related to at least one field in the target document;
the second acquisition module is used for acquiring data to be synchronized corresponding to the second interface frame from the source system;
and the synchronization module is used for synchronizing the data to be synchronized into the data records of the relevant fields in the first interface frame according to the mapping relation and pushing the data records to target documents in the target system.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202211640780.7A 2022-12-20 2022-12-20 Data synchronization method, device, computer equipment and storage medium Pending CN116244371A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211640780.7A CN116244371A (en) 2022-12-20 2022-12-20 Data synchronization method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211640780.7A CN116244371A (en) 2022-12-20 2022-12-20 Data synchronization method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116244371A true CN116244371A (en) 2023-06-09

Family

ID=86628610

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211640780.7A Pending CN116244371A (en) 2022-12-20 2022-12-20 Data synchronization method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116244371A (en)

Similar Documents

Publication Publication Date Title
CN115544183B (en) Data visualization method, device, computer equipment and storage medium
CN112052157B (en) Method, device and system for constructing test message
CN116244371A (en) Data synchronization method, device, computer equipment and storage medium
CN109358919A (en) Dynamic Configuration, device, computer equipment and the storage medium of Universal page
CN114860699A (en) Data quality detection method, device, equipment and storage medium
CN117522296A (en) Auditing flow generation method, auditing flow generation device, computer equipment and storage medium
CN116187286A (en) Method, device, platform, storage medium and product for generating potential perception report
CN116431260A (en) Interface rendering method and device based on data model driving and computer equipment
CN116719892A (en) Data display method, device, computer equipment and storage medium
CN117331812A (en) Service code verification method, device, computer equipment, storage medium and product
CN113741892A (en) Page generation method and device, electronic equipment and storage medium
CN117435651A (en) Test data processing method, device, computer equipment and storage medium
CN117033518A (en) Data synchronization method, device, computer equipment and storage medium
CN117555955A (en) Data conversion method, data conversion device, computer device, and storage medium
CN117389605A (en) Service interface configuration method, device, equipment, storage medium and program product
CN117350256A (en) Form data processing method, device, equipment and storage medium
CN117435589A (en) Data transfer method, device, computer equipment and storage medium
CN116432229A (en) Browser screen capture prevention method, device, computer equipment, medium and program product
CN117172720A (en) Audit and doubt point tracking and checking method, system, computer equipment and storage medium
CN116932347A (en) Link tracking method, device and computer readable medium
CN117519543A (en) Document data input method, device, computer equipment and storage medium
CN116881245A (en) Service data splicing method, device, computer equipment and storage medium
CN116661921A (en) Method, device and equipment for determining information display page of financial service system
CN114462362A (en) Report file generation method and device, computer equipment and storage medium
CN116881594A (en) View updating method, device, computer equipment and storage medium

Legal Events

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