Data synchronization method, device and equipment for retail terminal and cloud and storage medium
By comparing, analyzing and synchronizing data between retail terminals and clouds, the data accuracy and consistency of retail terminals and clouds in offline states is solved, and the stability and efficiency of retail systems are improved.
Patent Information
- Application Number
- CN202411925718.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-18
AI Technical Summary
The accuracy of price and inventory data in the existing retail terminals and clouds cannot be guaranteed when offline, and the data consistency is poor. Forcibly unifying the price and inventory data of all products will lead to a decrease in consistency between retail terminals and clouds, affecting retail efficiency.
By obtaining the local data of retail transactions to be synchronized at the terminal and the cloud data on the cloud, performing comparison and analysis, obtaining comparative analysis results, and synchronizing data when there are different data to ensure data consistency between retail terminals and clouds.
Ensure the availability of retail terminals, improve the data consistency and overall stability of retail systems in different network environments, ensure the continuity and flexibility of data synchronization, and improve the speed and efficiency of data synchronization between retail terminals and the cloud.
Smart Images

Figure CN119848135A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of online and offline price calculation linkage, and in particular to a method, device, equipment and storage medium for synchronizing data between a retail terminal and a cloud. Background Art
[0002] Existing retail terminals are connected to the cloud via the Internet to achieve real-time data synchronization, ensuring the timeliness and accuracy of commodity sales prices and inventory data.
[0003] However, if the Internet is disconnected, although the availability of the retail terminal is maintained, the accuracy of price and inventory data cannot be guaranteed, which may cause the actual amount of each sale to deviate from the expected amount;
[0004] On the contrary, if a high degree of consistency between price and inventory data is pursued, it may affect the immediate use of retail terminals and thus reduce the number of sales orders. Summary of the invention
[0005] The main purpose of the present invention is to provide a method, device, equipment and storage medium for data synchronization between a retail terminal and a cloud, aiming to solve the technical problems in the prior art that the accuracy of price and inventory data of existing retail terminals and the cloud in an offline state cannot be guaranteed, the data consistency is poor, and the forced unification of the price and inventory data of all commodities will lead to a decrease in the consistency between the retail terminal and the cloud, thereby affecting retail efficiency.
[0006] In a first aspect, the present invention provides a method for synchronizing data between a retail terminal and a cloud, the method comprising the following steps:
[0007] Obtain the local data of the retail transactions to be synchronized in the terminal and the cloud data in the cloud;
[0008] Comparing and analyzing the local data and the cloud data to obtain a comparative analysis result;
[0009] When the comparison and analysis result shows that there is difference data, data synchronization is performed according to the difference data.
[0010] Optionally, obtaining the local data of the retail transaction to be synchronized in the terminal and the cloud data in the cloud includes:
[0011] Retrieving, through the retail system, a local database and a local log file corresponding to the retail transaction to be synchronized from the terminal, and generating local data according to the local database and the local log file;
[0012] Retrieving, through the retail system, from the cloud a cloud database and a cloud log file corresponding to the retail transaction to be synchronized;
[0013] The cloud log file and the file data in the cloud database corresponding to the cloud log file are used as cloud data.
[0014] Optionally, the retrieving a local database and a local log file corresponding to the retail transaction to be synchronized from the terminal through the retail system, and generating local data according to the local database and the local log file, includes:
[0015] Retrieving the local database and local log files corresponding to the retail transactions to be synchronized from the terminal through the retail system;
[0016] The local log file and the file data in the local database corresponding to the local log file are used as local data.
[0017] Optionally, the comparing and analyzing the local data and the cloud data to obtain a comparison and analysis result includes:
[0018] Obtaining the current connection status between the terminal and the cloud;
[0019] The local data and the cloud data are compared and analyzed according to the current connection status to obtain a comparison and analysis result.
[0020] Optionally, the obtaining the current connection status between the terminal and the cloud includes:
[0021] Acquire the terminal monitoring state of the terminal, and obtain the current connection state of the terminal according to the terminal monitoring state;
[0022] Performing heartbeat detection on the cloud, and comparing the number of heartbeat detections with a preset number;
[0023] When the number comparison result is that the number of heartbeat detections exceeds the preset number of times, determining that the current connection state of the cloud is an offline state;
[0024] When the comparison result of the number is that the number of heartbeat detections does not exceed the preset number, it is determined that the current connection state of the cloud is an online state.
[0025] Optionally, performing comparative analysis on the local data and the cloud data according to the current connection state to obtain a comparative analysis result includes:
[0026] When the current connection state is that both the terminal and the cloud are online, comparing the local online data version number of the local log file in the local data with the cloud online data version number of the cloud log file of the cloud data to obtain an online data version number analysis result;
[0027] When the current connection state is that the terminal and / or the cloud is in an offline state, the local offline data version number of the local log file is compared with the cloud offline data version number of the cloud log file to obtain an offline data version number analysis result.
[0028] Optionally, when the comparison and analysis result shows that there is difference data, performing data synchronization according to the difference data includes:
[0029] When the comparison and analysis result shows that there is difference data, selecting the data with the latest version number according to the data synchronization component and the difference data to synchronize the data between the terminal and the cloud;
[0030] After the data synchronization is completed, the offline state of the terminal or the cloud is switched to the online state according to the state switching component.
[0031] In a second aspect, to achieve the above-mentioned purpose, the present invention further provides a data synchronization device between a retail terminal and a cloud, the data synchronization device between a retail terminal and a cloud comprising:
[0032] A data acquisition module, used to acquire local data of retail transactions to be synchronized in the terminal and cloud data in the cloud;
[0033] A comparison and analysis module, used to compare and analyze the local data with the cloud data to obtain a comparison and analysis result;
[0034] The data synchronization module is used to perform data synchronization according to the difference data when the comparison and analysis result shows that there is difference data.
[0035] In a third aspect, to achieve the above-mentioned purpose, the present invention further proposes a data synchronization device between a retail terminal and the cloud, the data synchronization device between the retail terminal and the cloud comprising: a memory, a processor, and a data synchronization program between the retail terminal and the cloud stored in the memory and executable on the processor, the data synchronization program between the retail terminal and the cloud being configured to implement the steps of the data synchronization method between the retail terminal and the cloud as described above.
[0036] In a fourth aspect, to achieve the above-mentioned purpose, the present invention further proposes a storage medium, on which a data synchronization program between a retail terminal and a cloud is stored, and when the data synchronization program between the retail terminal and the cloud is executed by a processor, the steps of the data synchronization method between the retail terminal and the cloud as described above are implemented.
[0037] The method for synchronizing data between a retail terminal and the cloud proposed in the present invention obtains local data of the retail transaction to be synchronized at the terminal and cloud data at the cloud; compares and analyzes the local data and the cloud data to obtain a comparison analysis result; and when the comparison analysis result shows that there is difference data, synchronizes the data according to the difference data, thereby ensuring the availability of the retail terminal, improving the data consistency and overall stability of the retail system in different network environments, ensuring the continuity and flexibility of data synchronization, and improving the speed and efficiency of data synchronization between the retail terminal and the cloud. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 A schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention;
[0039] Figure 2 A schematic diagram of a flow chart of a first embodiment of a method for synchronizing data between a retail terminal and the cloud in accordance with the present invention;
[0040] Figure 3 A schematic diagram of a flow chart of a second embodiment of a method for synchronizing data between a retail terminal and the cloud in accordance with the present invention;
[0041] Figure 4 A schematic diagram of a flow chart of a third embodiment of a method for synchronizing data between a retail terminal and the cloud in accordance with the present invention;
[0042] Figure 5 A schematic diagram of a flow chart of a fourth embodiment of a method for synchronizing data between a retail terminal and the cloud in accordance with the present invention;
[0043] Figure 6 A schematic diagram of a retail system in a method for synchronizing data between a retail terminal and the cloud in accordance with the present invention;
[0044] Figure 7 A schematic diagram of log difference analysis in the data synchronization method between a retail terminal and the cloud of the present invention;
[0045] Figure 8 It is a functional module diagram of a first embodiment of a data synchronization device between a retail terminal and a cloud according to the present invention.
[0046] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0047] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0048] The solution of the embodiment of the present invention is mainly: by obtaining the local data of the retail transaction to be synchronized at the terminal and the cloud data in the cloud; comparing and analyzing the local data and the cloud data to obtain the comparison analysis result; when the comparison analysis result shows that there is difference data, synchronizing the data according to the difference data, which can ensure the availability of the retail terminal, improve the data consistency and overall stability of the retail system in different network environments, ensure the continuity and flexibility of data synchronization, and improve the speed and efficiency of data synchronization between the retail terminal and the cloud, and solve the technical problems in the prior art that the accuracy of the price and inventory data of the existing retail terminal and the cloud in the offline state cannot be guaranteed, the data consistency is poor, and the forced unification of the price and inventory data of all commodities will lead to reduced consistency between the retail terminal and the cloud, affecting the retail efficiency.
[0049] Reference Figure 1 , Figure 1 The figure is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention.
[0050] like Figure 1 As shown, the device may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a Wi-Fi interface). The memory 1005 may be a high-speed RAM memory, or it may be a stable memory (Non-Volatile Memory), such as a disk memory. The memory 1005 may optionally be a storage device independent of the aforementioned processor 1001.
[0051] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation of the device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0052] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating device, a network communication module, a user interface module, and a data synchronization program between the retail terminal and the cloud.
[0053] The device of the present invention calls the data synchronization program between the retail terminal and the cloud stored in the memory 1005 through the processor 1001, and performs the following operations:
[0054] Obtain the local data of the retail transactions to be synchronized in the terminal and the cloud data in the cloud;
[0055] Comparing and analyzing the local data and the cloud data to obtain a comparative analysis result;
[0056] When the comparison and analysis result shows that there is difference data, data synchronization is performed according to the difference data.
[0057] The device of the present invention calls the data synchronization program between the retail terminal and the cloud stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0058] Retrieving, through the retail system, a local database and a local log file corresponding to the retail transaction to be synchronized from the terminal, and generating local data according to the local database and the local log file;
[0059] Retrieving, through the retail system, from the cloud a cloud database and a cloud log file corresponding to the retail transaction to be synchronized;
[0060] The cloud log file and the file data in the cloud database corresponding to the cloud log file are used as cloud data.
[0061] The device of the present invention calls the data synchronization program between the retail terminal and the cloud stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0062] Retrieving the local database and local log files corresponding to the retail transactions to be synchronized from the terminal through the retail system;
[0063] The local log file and the file data in the local database corresponding to the local log file are used as local data.
[0064] The device of the present invention calls the data synchronization program between the retail terminal and the cloud stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0065] Obtaining the current connection status between the terminal and the cloud;
[0066] The local data and the cloud data are compared and analyzed according to the current connection status to obtain a comparison and analysis result.
[0067] The device of the present invention calls the data synchronization program between the retail terminal and the cloud stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0068] Acquire the terminal monitoring state of the terminal, and obtain the current connection state of the terminal according to the terminal monitoring state;
[0069] Performing heartbeat detection on the cloud, and comparing the number of heartbeat detections with a preset number;
[0070] When the number comparison result is that the number of heartbeat detections exceeds the preset number of times, determining that the current connection state of the cloud is an offline state;
[0071] When the comparison result of the number is that the number of heartbeat detections does not exceed the preset number, it is determined that the current connection state of the cloud is an online state.
[0072] The device of the present invention calls the data synchronization program between the retail terminal and the cloud stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0073] When the current connection state is that both the terminal and the cloud are online, comparing the local online data version number of the local log file in the local data with the cloud online data version number of the cloud log file of the cloud data to obtain an online data version number analysis result;
[0074] When the current connection state is that the terminal and / or the cloud is in an offline state, the local offline data version number of the local log file is compared with the cloud offline data version number of the cloud log file to obtain an offline data version number analysis result.
[0075] The device of the present invention calls the data synchronization program between the retail terminal and the cloud stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0076] When the comparison and analysis result shows that there is difference data, selecting the data with the latest version number according to the data synchronization component and the difference data to synchronize the data between the terminal and the cloud;
[0077] After the data synchronization is completed, the offline state of the terminal or the cloud is switched to the online state according to the state switching component.
[0078] Through the above scheme, this embodiment obtains the local data of the retail transaction to be synchronized in the terminal and the cloud data in the cloud; compares and analyzes the local data and the cloud data to obtain a comparison analysis result; when the comparison analysis result shows that there is difference data, synchronizes the data according to the difference data, thereby ensuring the availability of the retail terminal, improving the data consistency and overall stability of the retail system in different network environments, ensuring the continuity and flexibility of data synchronization, and improving the speed and efficiency of data synchronization between the retail terminal and the cloud.
[0079] Based on the above hardware structure, an embodiment of a method for synchronizing data between a retail terminal and a cloud is proposed.
[0080] Reference Figure 2 , Figure 2 Schematic diagram of the flow of the first embodiment of the data synchronization method between a retail terminal and the cloud of the present invention.
[0081] In a first embodiment, the data synchronization method between the retail terminal and the cloud comprises the following steps:
[0082] Step S10: Acquire the local data of the retail transaction to be synchronized in the terminal and the cloud data in the cloud.
[0083] It should be noted that the retail transactions to be synchronized are retail transactions that require data synchronization. The retail transactions to be synchronized have corresponding local data on the terminal, and the retail transactions to be synchronized have corresponding cloud data on the cloud.
[0084] Step S20: Compare and analyze the local data and the cloud data to obtain a comparison and analysis result.
[0085] It should be understood that by comparing and analyzing the local data and the cloud data, corresponding comparative analysis results can be obtained.
[0086] Step S30: When the comparison and analysis result shows that there is difference data, data synchronization is performed according to the difference data.
[0087] It is understandable that when there are difference data in the comparison file analysis result, data synchronization can be performed based on the difference data.
[0088] Through the above scheme, this embodiment obtains the local data of the retail transaction to be synchronized in the terminal and the cloud data in the cloud; compares and analyzes the local data and the cloud data to obtain a comparison analysis result; when the comparison analysis result shows that there is difference data, synchronizes the data according to the difference data, thereby ensuring the availability of the retail terminal, improving the data consistency and overall stability of the retail system in different network environments, ensuring the continuity and flexibility of data synchronization, and improving the speed and efficiency of data synchronization between the retail terminal and the cloud.
[0089] Further, Figure 3 FIG. 2 is a flow chart of a second embodiment of a method for synchronizing data between a retail terminal and a cloud in accordance with the present invention. Figure 3 As shown, a second embodiment of the data synchronization method between a retail terminal and a cloud of the present invention is proposed based on the first embodiment. In this embodiment, the step S10 specifically includes the following steps:
[0090] Step S11: retrieve the local database and local log file corresponding to the retail transaction to be synchronized from the terminal through the retail system, and generate local data according to the local database and the local log file.
[0091] It should be noted that the retail system can retrieve the local database and local log files corresponding to the retail transactions to be synchronized from the terminal, and then generate local data according to the local database and the local log files.
[0092] Furthermore, the step S11 specifically includes the following steps:
[0093] Retrieving the local database and local log files corresponding to the retail transactions to be synchronized from the terminal through the retail system;
[0094] The local log file and the file data in the local database corresponding to the local log file are used as local data.
[0095] It should be understood that the retail system can retrieve the local database and local log file of the corresponding retail transaction to be synchronized from the terminal, and then the local log file and the file data corresponding to the local log file in the local database can be used as local data.
[0096] Step S12: Retrieving the cloud database and cloud log file corresponding to the retail transaction to be synchronized from the cloud through the retail system.
[0097] It is understandable that the cloud database corresponding to the retail transaction to be synchronized is retrieved from the cloud by the retail system.
[0098] Step S13: Use the cloud log file and the file data in the cloud database corresponding to the cloud log file as cloud data.
[0099] It should be understood that the cloud log file and the file data in the cloud database corresponding to the cloud log file are regarded as cloud data.
[0100] Through the above scheme, this embodiment uses the retail system to retrieve the local database and local log files corresponding to the retail transactions to be synchronized from the terminal, and generate local data according to the local database and the local log files; retrieve the cloud database and cloud log files corresponding to the retail transactions to be synchronized from the cloud through the retail system; use the cloud log files and the file data corresponding to the cloud log files in the cloud database as cloud data; ensure the availability of the retail terminal, improve the data consistency and overall stability of the retail system in different network environments, and ensure the continuity and flexibility of data synchronization.
[0101] Further, Figure 4 FIG. 1 is a flow chart of a third embodiment of a method for synchronizing data between a retail terminal and a cloud in accordance with the present invention. Figure 4As shown, a third embodiment of the data synchronization method between a retail terminal and a cloud of the present invention is proposed based on the first embodiment. In this embodiment, the step S20 specifically includes the following steps:
[0102] Step S21, obtaining the current connection status between the terminal and the cloud.
[0103] It should be noted that the current connection state between the terminal and the cloud is obtained, and the current connection state machine terminal or the current connection state of the cloud includes the connection and disconnection states.
[0104] Furthermore, the step S21 specifically includes the following steps:
[0105] Acquire the terminal monitoring state of the terminal, and obtain the current connection state of the terminal according to the terminal monitoring state;
[0106] Performing heartbeat detection on the cloud, and comparing the number of heartbeat detections with a preset number;
[0107] When the number comparison result is that the number of heartbeat detections exceeds the preset number of times, determining that the current connection state of the cloud is an offline state;
[0108] When the comparison result of the number is that the number of heartbeat detections does not exceed the preset number, it is determined that the current connection state of the cloud is an online state.
[0109] It should be understood that after obtaining the terminal monitoring status of the terminal, the current connection status of the terminal can be obtained based on the terminal monitoring status; by performing heartbeat detection on the cloud, the current status of the cloud can be determined based on the heartbeat detection result.
[0110] In the specific implementation, when the connection with the cloud is disconnected, it will automatically switch to this mode, and all data changes will be recorded only in the local database; once the cloud connection is restored, the system will automatically return to online mode after data synchronization is completed; the cloud connection status is determined by the heartbeat detection mechanism, and it will be considered disconnected if the preset timeout number is exceeded.
[0111] Step S22: Compare and analyze the local data and the cloud data according to the current connection status to obtain a comparison and analysis result.
[0112] It is understandable that the local data and the cloud data may be compared and analyzed according to the current connection status to obtain corresponding comparative analysis results.
[0113] Furthermore, the step S22 specifically includes the following steps:
[0114] When the current connection state is that both the terminal and the cloud are online, comparing the local online data version number of the local log file in the local data with the cloud online data version number of the cloud log file of the cloud data to obtain an online data version number analysis result;
[0115] When the current connection state is that the terminal and / or the cloud is in an offline state, the local offline data version number of the local log file is compared with the cloud offline data version number of the cloud log file to obtain an offline data version number analysis result.
[0116] It should be noted that when the terminal and the cloud are both online, the local data version number can be compared with the cloud data version number to obtain the online data version number analysis result; the local offline data version number can be compared with the cloud offline data version number to obtain the offline data version number analysis result.
[0117] Through the above scheme, this embodiment obtains the current connection status between the terminal and the cloud; compares and analyzes the local data and the cloud data according to the current connection status to obtain the comparison and analysis results, thereby ensuring the availability of the retail terminal and improving the data consistency and overall stability of the retail system in different network environments.
[0118] Further, Figure 5 FIG. 4 is a flow chart of a fourth embodiment of a method for synchronizing data between a retail terminal and a cloud in accordance with the present invention. Figure 5 As shown, a fourth embodiment of the data synchronization method between a retail terminal and a cloud of the present invention is proposed based on the first embodiment. In this embodiment, the step S30 specifically includes the following steps:
[0119] Step S31: When the comparison and analysis result shows that there is difference data, the data with the latest version number is selected according to the data synchronization component and the difference data to synchronize the data between the terminal and the cloud.
[0120] It should be noted that when the comparison and analysis result shows that there is difference data, the data with the latest version number can be selected according to the data synchronization component and the difference data to synchronize the data between the terminal and the cloud.
[0121] Step S32: After the data synchronization is completed, the offline state of the terminal or the cloud is switched to the online state according to the state switching component.
[0122] It is understandable that after the data synchronization is completed, the offline state of the terminal or the cloud can be switched to the online state according to the state switching component.
[0123] In the specific implementation, see Figure 6 , Figure 6 Schematic diagram of a retail system in the data synchronization method between a retail terminal and a cloud in the present invention, Figure 6 As shown, the mode switching component is responsible for intelligently switching the system's online and offline modes to ensure the continuity and flexibility of operation;
[0124] Online mode: All data changes will be synchronized to the cloud database and local database in real time to ensure the real-time and accuracy of the data.
[0125] Offline mode: When the connection with the cloud is disconnected, it will automatically switch to this mode, and all data changes will be recorded only in the local database; once the cloud connection is restored, the system will automatically return to online mode after data synchronization is completed; the cloud connection status is determined by a heartbeat detection mechanism, and it will be considered disconnected if the preset timeout number is exceeded.
[0126] The data synchronization component focuses on maintaining the consistency of data between the cloud and the terminal, and tracks data changes by recording data log files.
[0127] See also Figure 7 , Figure 7 Schematic diagram of log difference analysis in the data synchronization method between the retail terminal and the cloud of the present invention. Figure 7 As shown, log comparison and difference analysis: after the connection is restored in the cloud, first compare the data version numbers in the cloud and local log files; if the version numbers are the same, no synchronization is required; if they are different, further analyze the data differences.
[0128] The difference data processing process is:
[0129] If the local version number is newer, the local modification record will be uploaded to the cloud, and the cloud will synchronize the data; if the cloud version number is newer, the updated data will be pulled from the cloud and applied to the local database.
[0130] The synchronization completion notification process is as follows: after the data synchronization operation is completed, the status switching component is notified to proceed to the next step.
[0131] The online mode recovery process is as follows: after the state switching component confirms that the cloud connection is stable, it completes the switch of the system to online mode, ensuring that the system fully resumes normal operation, effectively improving the data consistency and overall stability of the system under different network environments.
[0132] Through the above scheme, this embodiment obtains the local data of the retail transaction to be synchronized in the terminal and the cloud data in the cloud; compares and analyzes the local data and the cloud data to obtain a comparison analysis result; when the comparison analysis result shows that there is difference data, synchronizes the data according to the difference data, thereby ensuring the availability of the retail terminal and improving the data consistency and overall stability of the retail system in different network environments.
[0133] Accordingly, the present invention further provides a data synchronization device between a retail terminal and a cloud.
[0134] Reference Figure 8 , Figure 8 It is a functional module diagram of a first embodiment of a data synchronization device between a retail terminal and a cloud according to the present invention.
[0135] In a first embodiment of the data synchronization device between a retail terminal and a cloud of the present invention, the data synchronization device between the retail terminal and the cloud comprises:
[0136] The data acquisition module 10 is used to acquire the local data of the retail transaction to be synchronized in the terminal and the cloud data in the cloud.
[0137] The comparison and analysis module 20 is used to compare and analyze the local data and the cloud data to obtain a comparison and analysis result.
[0138] The data synchronization module 30 is used to perform data synchronization according to the difference data when the comparison and analysis result shows that there is difference data.
[0139] The data acquisition module 10 is also used to retrieve the local database and local log files corresponding to the retail transactions to be synchronized from the terminal through the retail system, and generate local data according to the local database and the local log files; retrieve the cloud database and cloud log files corresponding to the retail transactions to be synchronized from the cloud through the retail system; and use the cloud log files and the file data corresponding to the cloud log files in the cloud database as cloud data.
[0140] The data acquisition module 10 is further used to retrieve the local database and local log file corresponding to the retail transaction to be synchronized from the terminal through the retail system; and use the local log file and the file data corresponding to the local log file in the local database as local data.
[0141] The comparison and analysis module 20 is further used to obtain the current connection status between the terminal and the cloud; compare and analyze the local data and the cloud data according to the current connection status to obtain a comparison and analysis result.
[0142] The comparison and analysis module 20 is also used to obtain the terminal monitoring status of the terminal, and obtain the current connection status of the terminal according to the terminal monitoring status; perform heartbeat detection on the cloud, and compare the number of heartbeat detections with a preset number; when the number comparison result is that the number of heartbeat detections exceeds the preset number, determine that the current connection status of the cloud is an offline state; when the number comparison result is that the number of heartbeat detections does not exceed the preset number, determine that the current connection status of the cloud is an online state.
[0143] The comparison and analysis module 20 is further used to compare the local online data version number of the local log file in the local data with the cloud online data version number of the cloud log file of the cloud data to obtain an online data version number analysis result when the current connection state is that both the terminal and the cloud are online, and to compare the local offline data version number of the local log file with the cloud offline data version number of the cloud log file to obtain an offline data version number analysis result when the current connection state is that the terminal and / or the cloud are offline.
[0144] The data synchronization module 30 is also used to select the data with the latest version number to synchronize the data between the terminal and the cloud according to the data synchronization component and the difference data when the comparison and analysis result shows that there is difference data; after the data synchronization is completed, switch the offline state of the terminal or the cloud to the online state according to the state switching component.
[0145] The steps implemented by each functional module of the data synchronization device between the retail terminal and the cloud can refer to the various embodiments of the data synchronization method between the retail terminal and the cloud of the present invention, and will not be repeated here.
[0146] In addition, an embodiment of the present invention further provides a storage medium, on which a data synchronization program between a retail terminal and a cloud is stored. When the data synchronization program between the retail terminal and the cloud is executed by a processor, the following operations are implemented:
[0147] Obtain the local data of the retail transactions to be synchronized in the terminal and the cloud data in the cloud;
[0148] Comparing and analyzing the local data and the cloud data to obtain a comparative analysis result;
[0149] When the comparison and analysis result shows that there is difference data, data synchronization is performed according to the difference data.
[0150] Furthermore, when the data synchronization program between the retail terminal and the cloud is executed by the processor, the following operations are also implemented:
[0151] Retrieving, through the retail system, a local database and a local log file corresponding to the retail transaction to be synchronized from the terminal, and generating local data according to the local database and the local log file;
[0152] Retrieving, through the retail system, from the cloud a cloud database and a cloud log file corresponding to the retail transaction to be synchronized;
[0153] The cloud log file and the file data in the cloud database corresponding to the cloud log file are used as cloud data.
[0154] Furthermore, when the data synchronization program between the retail terminal and the cloud is executed by the processor, the following operations are also implemented:
[0155] Retrieving the local database and local log files corresponding to the retail transactions to be synchronized from the terminal through the retail system;
[0156] The local log file and the file data in the local database corresponding to the local log file are used as local data.
[0157] Furthermore, when the data synchronization program between the retail terminal and the cloud is executed by the processor, the following operations are also implemented:
[0158] Obtaining the current connection status between the terminal and the cloud;
[0159] The local data and the cloud data are compared and analyzed according to the current connection status to obtain a comparison and analysis result.
[0160] Furthermore, when the data synchronization program between the retail terminal and the cloud is executed by the processor, the following operations are also implemented:
[0161] Acquire the terminal monitoring state of the terminal, and obtain the current connection state of the terminal according to the terminal monitoring state;
[0162] Performing heartbeat detection on the cloud, and comparing the number of heartbeat detections with a preset number;
[0163] When the number comparison result is that the number of heartbeat detections exceeds the preset number of times, determining that the current connection state of the cloud is an offline state;
[0164] When the comparison result of the number is that the number of heartbeat detections does not exceed the preset number, it is determined that the current connection state of the cloud is an online state.
[0165] Furthermore, when the data synchronization program between the retail terminal and the cloud is executed by the processor, the following operations are also implemented:
[0166] When the current connection state is that both the terminal and the cloud are online, comparing the local online data version number of the local log file in the local data with the cloud online data version number of the cloud log file of the cloud data to obtain an online data version number analysis result;
[0167] When the current connection state is that the terminal and / or the cloud is in an offline state, the local offline data version number of the local log file is compared with the cloud offline data version number of the cloud log file to obtain an offline data version number analysis result.
[0168] Furthermore, when the data synchronization program between the retail terminal and the cloud is executed by the processor, the following operations are also implemented:
[0169] When the comparison and analysis result shows that there is difference data, selecting the data with the latest version number according to the data synchronization component and the difference data to synchronize the data between the terminal and the cloud;
[0170] After the data synchronization is completed, the offline state of the terminal or the cloud is switched to the online state according to the state switching component.
[0171] Those skilled in the art will appreciate that all or part of the steps in the above-mentioned implementation method can be accomplished by instructing related hardware through a program, and the program is stored in a storage medium, including a number of instructions for enabling a device (which may be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each implementation method of the present application; and the aforementioned storage medium is a computer-readable storage medium, including: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes.
[0172] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0173] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0174] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for synchronizing data between a retail terminal and a cloud, characterized in that: The data synchronization method between the retail terminal and the cloud includes: Obtain the local data of the retail transactions to be synchronized in the terminal and the cloud data in the cloud; Comparing and analyzing the local data and the cloud data to obtain a comparative analysis result; When the comparison and analysis result shows that there is difference data, data synchronization is performed according to the difference data.
2. The method for synchronizing data between a retail terminal and a cloud as claimed in claim 1, characterized in that: The step of obtaining the local data of the retail transaction to be synchronized in the terminal and the cloud data in the cloud includes: Retrieving, through the retail system, a local database and a local log file corresponding to the retail transaction to be synchronized from the terminal, and generating local data according to the local database and the local log file; Retrieving, through the retail system, from the cloud a cloud database and a cloud log file corresponding to the retail transaction to be synchronized; The cloud log file and the file data in the cloud database corresponding to the cloud log file are used as cloud data.
3. The method for synchronizing data between a retail terminal and a cloud as claimed in claim 2, characterized in that: The method of retrieving a local database and a local log file corresponding to the retail transaction to be synchronized from the terminal through the retail system, and generating local data according to the local database and the local log file, includes: Retrieving the local database and local log files corresponding to the retail transactions to be synchronized from the terminal through the retail system; The local log file and the file data in the local database corresponding to the local log file are used as local data.
4. The method for synchronizing data between a retail terminal and a cloud as claimed in claim 1, characterized in that: The comparing and analyzing the local data and the cloud data to obtain a comparison and analysis result includes: Obtaining the current connection status between the terminal and the cloud; The local data and the cloud data are compared and analyzed according to the current connection status to obtain a comparison and analysis result.
5. The method for synchronizing data between a retail terminal and a cloud as claimed in claim 4, characterized in that: The obtaining of the current connection status between the terminal and the cloud comprises: Acquire the terminal monitoring state of the terminal, and obtain the current connection state of the terminal according to the terminal monitoring state; Performing heartbeat detection on the cloud, and comparing the number of heartbeat detections with a preset number; When the number comparison result is that the number of heartbeat detections exceeds the preset number of times, determining that the current connection state of the cloud is an offline state; When the comparison result of the number is that the number of heartbeat detections does not exceed the preset number, it is determined that the current connection state of the cloud is an online state.
6. The method for synchronizing data between a retail terminal and a cloud as claimed in claim 4, characterized in that: The comparing and analyzing the local data and the cloud data according to the current connection state to obtain a comparison and analysis result includes: When the current connection state is that both the terminal and the cloud are online, comparing the local online data version number of the local log file in the local data with the cloud online data version number of the cloud log file of the cloud data to obtain an online data version number analysis result; When the current connection state is that the terminal and / or the cloud is in an offline state, the local offline data version number of the local log file is compared with the cloud offline data version number of the cloud log file to obtain an offline data version number analysis result.
7. The method for synchronizing data between a retail terminal and a cloud as claimed in claim 1, characterized in that: When the comparison and analysis result shows that there is difference data, performing data synchronization according to the difference data includes: When the comparison and analysis result shows that there is difference data, selecting the data with the latest version number according to the data synchronization component and the difference data to synchronize the data between the terminal and the cloud; After the data synchronization is completed, the offline state of the terminal or the cloud is switched to the online state according to the state switching component.
8. A data synchronization device between a retail terminal and a cloud, characterized in that: The data synchronization device between the retail terminal and the cloud includes: A data acquisition module, used to acquire local data of retail transactions to be synchronized in the terminal and cloud data in the cloud; A comparison and analysis module, used to compare and analyze the local data with the cloud data to obtain a comparison and analysis result; The data synchronization module is used to perform data synchronization according to the difference data when the comparison and analysis result shows that there is difference data.
9. A data synchronization device between a retail terminal and a cloud, characterized in that: The data synchronization device between the retail terminal and the cloud includes: a memory, a processor, and a data synchronization program between the retail terminal and the cloud stored in the memory and executable on the processor. The data synchronization program between the retail terminal and the cloud is configured to implement the steps of the data synchronization method between the retail terminal and the cloud as described in any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores a data synchronization program between the retail terminal and the cloud, and when the data synchronization program between the retail terminal and the cloud is executed by the processor, the steps of the data synchronization method between the retail terminal and the cloud are implemented as described in any one of claims 1 to 7.