A multi-system universal data change method based on asynchronous interface
By building an interface table in a multi-system environment with asynchronous interfaces and performing data integrity and consistency judgment, the problem of difficulty in ensuring integrity and consistency during data changes is solved, the integrity and consistency of data updates are achieved, and development time is shortened.
Patent Information
- Application Number
- CN202210405198.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-18
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-04-18
AI Technical Summary
In a multi-system environment, it is difficult to ensure data integrity and consistency during data changes in asynchronous interfaces.
By building the interface tables of the sending and receiving ends, adding data field information (such as PK_ID, PK_ID_D, MTC_STS, MTC_NO, QTY, FLAG, DATE), and performing data integrity and consistency judgment between the interface tables, ensure that the data update is complete before updating the main database table.
In a multi-system environment, it ensures the integrity and consistency of data updates, reduces software development and delivery cycles, and improves development efficiency.
Smart Images

Figure CN114817252B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data interaction in a multi-system environment, and in particular to a multi-system universal data modification method using an asynchronous interface. Background Art
[0002] With the prevalence of intelligent technology, different business requirements arise in different use cases. Customized development based on these business characteristics requires interoperability with multiple systems. Developers often choose to use asynchronous interfaces for data exchange when there's no strict time sequence, the main thread logic isn't affected, or the required operations are relatively time-consuming.
[0003] In the system development process in actual scenarios, there are many ways to connect multiple systems, such as ESB, web service, etc. However, during the information transmission process between multiple systems, when data changes, the processing of old data and the entry of new data make it difficult to ensure the integrity and consistency of the changed data.
[0004] Therefore, there is an urgent need for a multi-system universal data change method suitable for asynchronous interfaces. Summary of the Invention
[0005] The present application provides a method for changing multi-system universal data of an asynchronous interface to solve the problem in the prior art that it is difficult to ensure the integrity and consistency of data verification when changing multi-system universal data of an asynchronous interface.
[0006] This application provides a multi-system universal data modification method for an asynchronous interface, including:
[0007] According to the data change request, the data of the sending end main library table is updated, and the updated sending end main library table is sent to the sending end interface table, so that the sending end interface table is updated and the data field information is added to the sending end interface table;
[0008] Check whether the data transmission time of the receiving end system and the sending end system overlaps. If the time overlaps, determine whether the data update of the sending end interface table is complete based on the field information of the sending end interface table; if the time does not overlap, go directly to the next step;
[0009] The updated sending-end interface table is sent to the receiving-end interface table through the middleware of the asynchronous interface, so that the receiving-end interface table and the sending-end interface table are updated synchronously, and data field information is added to the receiving-end interface table;
[0010] According to the data field information of the receiving end interface table, determine whether the data update of the receiving end interface table is complete;
[0011] If the data update of the receiving end interface table is complete, the data of the receiving end main library table is updated.
[0012] In some embodiments, the multi-system universal data change method of the asynchronous interface includes:
[0013] Constructing a transmitter interface table and a receiver interface table, wherein data field information is added to both the transmitter interface table and the receiver interface table, wherein the data field information includes PK_ID, PK_ID_D, MTC_STS, MTC_NO, QTY, FLAG, and DATE;
[0014] Among them, PK_ID is the unique identifier of the data;
[0015] PK_ID_D is used to store the PK_ID before the change when the PK_ID is changed.
[0016] MTC_NO is the data number, that is, the number of the data received in the table;
[0017] QTY is the number of data sent, that is, the actual maximum number recorded in MTC_NO in the main database table of the sender;
[0018] MTC_STS is the data change operation field, which is used to provide a basis for judging data changes;
[0019] FLAG is a flag bit, which indicates whether the updated data has been transferred to the next data table;
[0020] DATE is the data editing time, including the time when the data was sent / created / modified.
[0021] In some embodiments, whether the data update of the receiving-end interface table is complete is determined based on the data field information of the receiving-end interface table. The specific determination process includes:
[0022] Determine whether the QTY value in the receiving end interface table is the same as the actual maximum number recorded in MTC_NO;
[0023] If they are not the same, it is determined that the data update of the receiving end interface table is incomplete;
[0024] If they are the same, then determine whether each piece of data is empty. If at least one piece of data is empty, then determine that the data update of the receiving end interface table is incomplete;
[0025] If all data are not empty, it is determined that the data update of the receiving end interface table is complete.
[0026] In some embodiments, whether the data update of the sender interface table is complete is determined based on the data field information of the sender interface table. The specific determination process includes:
[0027] The data field information of the sending end interface table includes the data number MTC_NO and the number of data items QTY;
[0028] Determine whether the QTY in the sender interface table is the same as the actual maximum number recorded in MTC_NO;
[0029] If they are not the same, it is determined that the data update of the sending end interface table is incomplete;
[0030] If they are the same, then determine whether each piece of data is empty. If at least one piece of data is empty, then determine that the data update of the sender interface table is incomplete;
[0031] If all data are not empty, it is determined that the data update of the sending end interface table is complete.
[0032] In some embodiments, the multi-system universal data modification method of the asynchronous interface further includes:
[0033] If the data update of the receiving-end interface table is complete, the updated receiving-end interface table will be sent to the receiving-end main library table, and the FLAG in the receiving-end interface table will be changed from "0" to "1". If the FLAG is 0, it means that the receiving-end interface table has not transmitted the updated data to the lower receiving-end main library table; if the FLAG is 1, it means that the receiving-end interface table has transmitted the updated data to the lower receiving-end main library table.
[0034] In some embodiments, the data update process of the sending end master database table, the sending end interface table, the receiving end interface table, or the receiving end master database table includes:
[0035] Based on the data change request, determine whether the PK_ID has been modified. If not, use the data change operation MTC_STS of the receiving interface table to add / delete / modify the data in the table. Specifically, when MTC_STS is C, perform a data insert operation; when MTC_STS is U, perform a data update operation; when MTC_STS is D, perform a data delete operation;
[0036] If modification occurs, the data insertion operation when MTC_STS is C is performed first, that is, PK_ID is the newer data unique identifier, and PK_ID_D saves the PK_ID in the deleted data; then the data deletion operation when MTC_STS is D is performed.
[0037] In some embodiments, before executing the data deletion operation, the process further includes checking whether the main logical structure of the data meets the deletion conditions.
[0038] In some embodiments, sending the updated sending end main library table to the sending end interface table specifically includes sending the updated sending end main library table to the sending end interface table through a trigger or a scheduled task.
[0039] In some embodiments, the multi-system universal data modification method of the asynchronous interface further includes sending the updated receiving-end interface table to the receiving-end main library table through a scheduled task and a trigger.
[0040] This application provides a multi-system universal data change method with an asynchronous interface. Based on data interaction in a multi-system environment, it is particularly suitable for universal data changes under an asynchronous interface. The method of this application uses multi-system data transmission under an asynchronous interface. Only when the data update is complete is the data update performed on the receiving end master database table, ensuring the consistency and integrity of data changes between multiple systems, reducing software development and delivery cycles, and improving development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0042] Figure 1 This is a structural block diagram of multiple systems applicable to this application. DETAILED DESCRIPTION
[0043] In the docking of multiple systems, interactions caused by data changes between systems are inevitable. When receiving changed data, how to effectively ensure the integrity and consistency of the received data? Especially when the primary key used as the unique identifier of the receiving data also changes, how to effectively avoid time overlap and data confusion and duplication caused by repeated data operations.
[0044] In order to solve the above problems and verify data integrity and consistency, this patent discloses a multi-system general data change method using an asynchronous interface. This method meets the needs of changing general data in a multi-system environment using an asynchronous interface, reduces the architecture time and code development workload of program developers, and shortens the time required for development.
[0045] The universal data modification method for multiple systems using asynchronous interfaces of the present application is applicable to systems using relational databases under asynchronous interfaces. Figure 1 This is a structural diagram of the multi-system applicable to this application, combined with Figure 1 As shown, the system includes three parts: the sending end, the middleware and the receiving end. The database sending end main library table creates the interface table, the database receiving end interface table creates the main library table, and the middle is an interface based on asynchronous mode.
[0046] The general data modification method of the present application applied to multiple systems using asynchronous interfaces includes the following steps:
[0047] Step S100: Construct a sender interface table and a receiver interface table. Both the sender interface table and the receiver interface table are supplemented with data field information, including PK_ID, PK_ID_D, MTC_STS, MTC_NO, QTY, FLAG, and DATE. PK_ID is the unique identifier for the data; PK_ID_D is the PK_ID before the change, when the PK_ID changes; MTC_NO is the data number, i.e., the number of data received in the table; QTY is the number of sent data items, i.e., the actual maximum number recorded by MTC_NO in the sender master database table; MTC_STS is the data change operation field, used to provide a basis for determining data changes; FLAG is a flag bit, i.e., indicating whether the updated data has been transferred to the next data table; DATE is the data editing time, including the data sending / creation / correction time. Of course, other times can be established depending on the situation.
[0048] In this example, a main database table is established on both the sending and receiving sides of the database: the sending-side main database table and the receiving-side main database table, respectively. Furthermore, an interface table is established on both the sending and receiving sides: the sending-side interface table and the receiving-side interface table, respectively. Sequences and read / write rules are established in the receiving-side interface table to ensure data consistency between the sending and receiving sides. Data field information is added to both the sending-side interface table and the receiving-side interface table. To facilitate explanation of the database fields, these fields are defined in detail. Table 1 shows the database field definitions.
[0049] To address this issue, in a multi-system interconnected environment, the main database tables on the sender and receiver sides specifically represent the tables that store the complete information for that system. The interface tables on the sender and receiver sides, in addition to the fields required by this method, only contain the fields required for the interconnected system. In other words, the sender's main database table extracts the corresponding content based on the desired transmission content of the receiving system, and this extracted content constitutes the sender's interface table. Furthermore, when data is sent by multiple different sender systems, the receiving systems each use multiple receiving interface tables, each corresponding to their own sender system. After being transmitted to the receiving main database table, the receiving main database table is then composed of its own data.
[0050] Table 1 Definition table of database fields
[0051]
[0052]
[0053] Step S200: receiving a data change request, wherein the data change request includes the number of data to be changed and change attribute information of each data to be changed, wherein the change attribute information includes the content of the data to be changed and the operation of the data to be changed.
[0054] Step S300: Update the data on the sending end master database table according to the data change request, and send the updated sending end master database table to the sending end interface table, so that the sending end interface table is updated.
[0055] In the present application, the data update process of the sending end main library table, the sending end interface table, the receiving end receiving table or the receiving end main library table includes: according to the data change request, determining whether the PK_ID has been modified, if not, using the data change operation MTC_STS of the receiving end interface table to add / delete / modify the data in the table, specifically including, when MTC_STS is C, performing a data insert operation; when MTC_STS is U, performing a data update operation; when MTC_STS is D, performing a data deletion operation. If a modification occurs, first perform the data insertion operation when MTC_STS is C, that is, PK_ID is a newer data unique identifier, and PK_ID_D stores the PK_ID in the deleted data; then perform the data deletion operation when MTC_STS is D. In the present application, before performing the data deletion operation, it also includes checking whether the main logical structure of the data meets the deletion conditions. It should be noted that the data update processes of other databases described below are similar to the implementation process here, and will not be repeated in the following text.
[0056] The following code example illustrates the data update process.
[0057]
[0058] In the present application, the updated sending end main library table is sent to the sending end interface table, specifically including sending the updated sending end main library table to the sending end interface table through a trigger or a timed task.
[0059] In step S400, whether the data transmission time of the receiving end system and the transmitting end system overlaps, that is, whether the data is received and sent at the same time.
[0060] If the time coincides, the process determines whether the sender interface table data update is complete based on the sender interface table field information; if the time does not coincide, the process proceeds directly to the next step.
[0061] For multiple systems, each system generally has its own data sending time. When using scheduled task synchronization or transmitting through middleware, if there is time overlap, verification is required at the end where the data is received.
[0062] To facilitate understanding of the above steps, let's use an example. The transmission time for sending system A might be 10 minutes, while that for sending system B might be 5 minutes. After the sending interface tables of systems A and B are sent to the middleware, if the middleware synchronizes data every 10 minutes, the receiving interface table will also transmit data to the receiving master database table every 10 minutes (this will coincide with the transmission time intervals between systems A and B). If the middleware is transmitting data to the receiving interface table at this time and the receiving interface is not verified, the receiving master database table might be transmitted to the receiving master database table just as two of four data entries have been transmitted, resulting in the receiving master database table receiving only two data entries.
[0063] In this application, based on the data field information of the sending end interface table, it is judged whether the data update of the sending end interface table is complete. The specific judgment process includes: the data field information of the sending end interface table includes the data number MTC_NO and the number of data items QTY; it is determined whether the QTY of the sending end interface table is the same as the actual maximum number recorded by MTC_NO; if they are not the same, it is determined that the data update of the sending end interface table is incomplete; if they are the same, it is determined whether each data is empty. If at least one data is empty, it is determined that the data update of the sending end interface table is incomplete; if all data are not empty, it is determined that the data update of the sending end interface table is complete.
[0064] In the case of multiple systems, the data sent by each sending system and the non-empty fields required by each receiving system are different. The above determination of whether each piece of data is empty usually refers to the non-empty data fields required by the receiving system.
[0065] To facilitate understanding of the process of determining whether a data update is complete, the following code example illustrates the process of determining whether a data update is complete.
[0066]
[0067] In addition to the methods described above, you can also use the date to determine if data updates are complete. Using the date as a verification reference, you can establish either the send time or the synchronization time. Generally, the send time is used, but except in some special cases, using the date as the primary verification criterion is not recommended. If the system requires time comparison, due to time delays in asynchronous interfaces, there will be slight differences in the time when data is sent. This can lead to inconsistent times within the same batch of data IDs. While using the date as a verification criterion may result in errors, it can be used as a reference. For example, if the difference between the received date and the send time recorded by the sender is greater than 48 hours, an alarm will be issued, indicating a possible problem with data transmission.
[0068] In step S500, the updated sending-end interface table is sent to the receiving-end interface table through the asynchronous interface middleware, so that the receiving-end interface table and the sending-end interface table are updated synchronously, and data field information is added to the receiving-end interface table.
[0069] Step S600: Determine whether the data update of the receiving-end interface table is complete based on the data field information of the receiving-end interface table.
[0070] In this application, based on the data field information of the receiving end interface table, it is determined whether the data update of the receiving end interface table is complete. The specific judgment process includes: determining whether the QTY of the receiving end interface table is the same as the actual maximum number recorded by MTC_NO; if they are not the same, it is determined that the data update of the receiving end interface table is incomplete; if they are the same, it is determined whether each data is empty. If at least one data is empty, it is determined that the data update of the receiving end interface table is incomplete; if all data are not empty, it is determined that the data update of the receiving end interface table is complete.
[0071] Step S700: If the data update of the receiving-end interface table is complete, the receiving-end main database table is updated.
[0072] If the data update integrity of the receiving end interface table is complete, the updated receiving end interface table is sent to the receiving end main library table, and the receiving end main library table performs data update. In this application, the updated receiving end interface table is sent to the receiving end main library table through a timed task and a trigger. At the same time, the FLAG in the receiving end interface table is changed from "0" to "1", where FLAG is 0, indicating that the receiving end interface table has not transmitted the updated data to the lower receiving end main library table; if FLAG is 1, it indicates that the receiving end interface table has transmitted the updated data to the lower receiving end main library table.
[0073] The present application provides a multi-system general data change method with an asynchronous interface, which is based on data interaction in a multi-system environment and is particularly suitable for general data changes under an asynchronous interface. The method of the present application uses a method based on multi-system data transmission under an asynchronous interface. Only when the data update is complete is the data update of the main library table on the receiving end performed, thereby ensuring the consistency and integrity of data changes between multiple systems, reducing software development and delivery cycles, and improving development efficiency. The method of the present application satisfies the requirement that data is changed only when the data update is complete in a multi-system environment using an asynchronous interface, reducing the architecture time and code development amount of program developers, and shortening the time required for development.
[0074] The above is an example of the best mode of implementation of this application. Any part not described in detail is common knowledge of those skilled in the art. The scope of protection of this application is based on the content of the claims. Any equivalent transformation based on the technical teachings of this application is also within the scope of protection of this application.
Claims
1. A multi-system universal data change method for an asynchronous interface, characterized in that: include: According to the data change request, the data of the sending end main library table is updated, and the updated sending end main library table is sent to the sending end interface table, so that the sending end interface table is updated and the data field information is added to the sending end interface table; Check whether the data transmission time of the receiving end system and the sending end system overlaps. If the time overlaps, determine whether the data update of the sending end interface table is complete based on the field information of the sending end interface table; if the time does not overlap, go directly to the next step; The updated sending-end interface table is sent to the receiving-end interface table through the middleware of the asynchronous interface, so that the receiving-end interface table and the sending-end interface table are updated synchronously, and data field information is added to the receiving-end interface table; According to the data field information of the receiving end interface table, determine whether the data update of the receiving end interface table is complete. The specific judgment process includes: The data field information of the sending end interface table includes the data number MTC_NO and the number of data items QTY; Determine whether the QTY in the sender interface table is the same as the actual maximum number recorded in MTC_NO; If they are not the same, it is determined that the data update of the sending end interface table is incomplete; If they are the same, then determine whether each piece of data is empty. If at least one piece of data is empty, then determine that the data update of the sender interface table is incomplete; If all data are not empty, it is determined that the data update of the sender interface table is complete; If the data update of the receiving end interface table is complete, the data of the receiving end main library table is updated.
2. The multi-system universal data changing method of the asynchronous interface according to claim 1, characterized in that: The multi-system universal data changing method of the asynchronous interface includes: Constructing a transmitter interface table and a receiver interface table, wherein data field information is added to both the transmitter interface table and the receiver interface table, wherein the data field information includes PK_ID, PK_ID_D, MTC_STS, MTC_NO, QTY, FLAG, and DATE; Among them, PK_ID is the unique identifier of the data; PK_ID_D is used to store the PK_ID before the change when the PK_ID is changed. MTC_NO is the data number, that is, the number of the data received in the table; QTY is the number of data sent, that is, the actual maximum number recorded in MTC_NO in the main database table of the sender; MTC_STS is the data change operation field, which is used to provide a basis for judging data changes; FLAG is a flag bit, which indicates whether the updated data has been transferred to the next data table; DATE is the data editing time, including the time when the data was sent / created / modified.
3. The multi-system universal data changing method of the asynchronous interface according to claim 2, characterized in that: Based on the data field information of the receiving-end interface table, determine whether the data update of the receiving-end interface table is complete. The specific judgment process includes: Determine whether the QTY value in the receiving end interface table is the same as the actual maximum number recorded in MTC_NO; If they are not the same, it is determined that the data update of the receiving end interface table is incomplete; If they are the same, then determine whether each piece of data is empty. If at least one piece of data is empty, then determine that the data update of the receiving end interface table is incomplete; If all data are not empty, it is determined that the data update of the receiving end interface table is complete.
4. The multi-system universal data changing method of the asynchronous interface according to claim 2, characterized in that: The multi-system universal data changing method of the asynchronous interface further includes: If the data update of the receiving-end interface table is complete, the updated receiving-end interface table will be sent to the receiving-end master library table, and the FLAG in the receiving-end interface table will be changed from "0" to "1". If the FLAG is 0, it means that the receiving-end interface table has not transmitted the updated data to the lower receiving-end master library table; if the FLAG is 1, it means that the receiving-end interface table has transmitted the updated data to the lower receiving-end master library table.
5. The multi-system universal data changing method of the asynchronous interface according to claim 2, characterized in that: The data update process of the sending end main database table, the sending end interface table, the receiving end interface table, or the receiving end main database table includes: Based on the data change request, determine whether the PK_ID has been modified. If not, use the data change operation MTC_STS of the receiving interface table to add / delete / modify the data in the table. Specifically, when MTC_STS is C, perform a data insert operation; when MTC_STS is U, perform a data update operation; when MTC_STS is D, perform a data delete operation; If modification occurs, the data insertion operation when MTC_STS is C is performed first, that is, PK_ID is the newer data unique identifier, and PK_ID_D saves the PK_ID in the deleted data; then the data deletion operation when MTC_STS is D is performed.
6. The multi-system universal data changing method of the asynchronous interface according to claim 5, characterized in that: Before executing the data deletion operation, it also includes checking whether the main logical structure of the data meets the deletion conditions.
7. The multi-system universal data changing method of the asynchronous interface according to claim 1, characterized in that: The updated sending end main library table is sent to the sending end interface table, specifically including sending the updated sending end main library table to the sending end interface table through a trigger or a timed task.
8. The multi-system universal data changing method of the asynchronous interface according to claim 1, characterized in that: The multi-system universal data changing method of the asynchronous interface further includes sending the updated receiving end interface table to the receiving end main library table through a timed task and a trigger.
Citation Information
Patent Citations
Receiving and sending device and method and synchronizing system for achieving shipping industry data synchronization
CN105677885A
File synchronization method, file synchronization server and storage medium
CN111654522A