Offline data storage synchronization method and system

By realizing the sharded download and upload of data and files on smart devices, the problem of not being able to effectively store and synchronize large data volumes and complex data structures in the prior art is solved, and efficient and stable offline data storage and synchronization are achieved.

CN119557277APending Publication Date: 2025-03-04SHANDONG LUNENG SOFTWARE TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411602210.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

Existing offline data storage technology cannot effectively support the storage of large data volumes and complex data structures, especially in scenarios with limited network coverage, resulting in low data transmission efficiency, high risk of data loss and lag in query operations.

Method used

An offline data storage synchronization method and system is adopted to realize the shard download and upload of data and files through the interaction between the front-end and the back-end. The specific steps include the front-end sending a download request to the back-end through the interface, the back-end locking the data and downloading it in pieces to ensure the exclusiveness and efficient transmission of the data.

Benefits of technology

It realizes efficient storage and synchronization of large data volumes and complex data structures in offline mode, improves data transmission efficiency, reduces the risk of data loss, and supports fast offline query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557277A_ABST
    Figure CN119557277A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data storage and synchronization of intelligent equipment, and provides an off-line data storage synchronization method and system, comprising a data and file downloading storage method in an off-line mode, a data synchronous uploading method in an on-line mode, and a data and file downloading storage method in the off-line mode. Comprising the following steps: a front end sends a downloading request for acquiring data, files and a file-data relation table to a rear end through a calling interface: the rear end locks the data requested to be downloaded according to the downloading request, and then downloads the data so as to realize exclusive downloading of the front end; and the back end determines the number of files downloaded at a single time according to the sizes of the files aiming at the corresponding files in the file-data relation table, and performs fragmented downloading on the files. Storage and synchronization of complex data structures are effectively achieved, and the method is particularly suitable for storage and offline query of large data volumes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field related to data storage and synchronization of smart devices, and in particular to an offline data storage synchronization method and system. Background Art

[0002] The statements in this section merely provide background information related to the present disclosure and do not necessarily constitute prior art.

[0003] In existing power generation companies or other environments with insufficient network coverage, smart devices (such as PADs, mobile phones, etc.) are usually unable to effectively record or upload data without a network.

[0004] Among the current solutions, common offline data storage methods mainly include localStorage and some lightweight storage solutions based on cache. These technologies can play a certain role in processing a small amount of simple data records, but in practical applications, especially in scenarios such as power generation companies with limited network coverage, huge data volumes and complex data types, they have obvious shortcomings:

[0005] Traditional browser cache technologies such as localStorage are usually limited to 5MB-10MB of storage capacity, which cannot meet the storage needs of large amounts of data or files. In localStorage or other lightweight cache solutions, the data reading speed and retrieval capabilities are limited. Especially when large amounts of data or multiple types of data coexist, offline query operations often experience freezes or unresponsiveness, making it difficult to meet the fast query needs of on-site staff. This is extremely unsuitable for equipment that needs to record data for a long time or in large quantities, such as detection equipment and recording tools for power generation companies. And once the network connection is interrupted or the transmission is blocked, the entire data transmission process needs to start from scratch, which seriously affects the efficiency of data transmission and increases the risk of data loss or incomplete transmission. Summary of the invention

[0006] In order to solve the above problems, the present disclosure proposes an offline data storage and synchronization method and system, which is suitable for power generation enterprises or similar scenarios with limited network coverage, and solves the limitation that existing offline storage technology cannot support the storage of large amounts of data and complex data structures. It provides offline data recording and network synchronization functions for PADs, mobile phones and other devices, supports local storage, breakpoint resumption and segmented upload of complex data structures and large amounts of data files, and realizes stable data synchronization.

[0007] In order to achieve the above objectives, the present disclosure adopts the following technical solutions:

[0008] One or more embodiments provide an offline data storage and synchronization method, including a data and file download and storage method in an offline mode and a data synchronization upload method in an online mode. The data and file download and storage method in an offline mode includes the following steps:

[0009] The front end sends a request to the back end to obtain data and files, as well as download the file-data relationship table, by calling the interface:

[0010] The backend locks the data requested for download according to the download request, and then downloads it to achieve exclusive downloading for the frontend;

[0011] The backend determines the number of files to be downloaded at a time based on the file size corresponding to the files in the file-data relationship table, and performs segmented downloading on the files.

[0012] One or more embodiments provide an offline data storage synchronization system, including: a front end and a back end, the front end is a local terminal, connected with a local folder and an IndexedDB server, respectively used to store files and data; the back end is a server, connected with a file library and a server database;

[0013] During the offline mode data and file download and storage process, the data interaction process between the front-end and back-end includes the following steps:

[0014] The front end sends a request to the back end to obtain data and files, as well as download the file-data relationship table, by calling the interface:

[0015] The backend locks the data requested for download according to the download request, and then downloads it to achieve exclusive downloading for the frontend;

[0016] The backend determines the number of files to be downloaded at a time based on the file size corresponding to the files in the file-data relationship table, and performs segmented downloading on the files.

[0017] Compared with the prior art, the present invention has the following beneficial effects:

[0018] The present disclosure realizes efficient data storage and synchronization through the interaction between the front-end and the back-end. First, the front-end sends a download request to the back-end through an interface call to ensure that the data and files are updated in a timely manner in offline mode. In order to ensure the exclusivity of the front-end download, the back-end locks the requested data to avoid interference from other processes and improve data integrity and security. In addition, the back-end performs fragmented downloading according to the size of the file, improves the transmission efficiency by splitting large files, reduces the pressure of a single download, and makes the download operation more stable. This method can effectively support the storage and synchronization of complex data structures, and is particularly suitable for the storage and offline query of large amounts of data.

[0019] The advantages of the present disclosure and the advantages of additional aspects will be described in detail in the following specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings constituting a part of the present disclosure are used to provide a further understanding of the present disclosure. The exemplary embodiments of the present disclosure and the description thereof are used to explain the present disclosure but do not constitute a limitation of the present disclosure.

[0021] Figure 1 is a flow chart of a method for downloading and storing data and files in an offline mode in Embodiment 1 of the present disclosure;

[0022] Figure 2 is a flow chart of a method for synchronously uploading data in an online mode according to Embodiment 1 of the present disclosure;

[0023] Figure 3 This is an online execution interface diagram in an example of a maintenance procedure arrangement and execution system according to Embodiment 1 of the present disclosure;

[0024] Figure 4 This is an offline execution interface diagram in an example of a maintenance procedure arrangement and execution system according to Embodiment 1 of the present disclosure;

[0025] Figure 5 It is a partial schematic diagram of an offline storage interface in an example of a maintenance procedure arrangement and execution system according to Embodiment 1 of the present disclosure;

[0026] Figure 6 It is a cross-sectional view showing an offline work order list in the maintenance procedure arrangement and execution system example of the first embodiment of the present disclosure. DETAILED DESCRIPTION

[0027] The present disclosure is further described below in conjunction with the accompanying drawings and embodiments.

[0028] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present disclosure. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present disclosure belongs.

[0029] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present disclosure. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof. It should be noted that, in the absence of conflict, the various embodiments in the present disclosure and the features in the embodiments can be combined with each other. The embodiments will be described in detail below in conjunction with the accompanying drawings.

[0030] Example 1

[0031] In the technical solutions disclosed in one or more embodiments, Figures 1 to 4 As shown, an offline data storage and synchronization method includes a data and file download and storage method in an offline mode and a data synchronization upload method in an online mode;

[0032] The method of downloading and storing data and files in offline mode, the downloaded data and files are stored in IndexedDB and local folders locally (such as PAD or mobile phone), realizing offline access, such as Figure 1 As shown, the following steps are included:

[0033] Step A1: The front end sends a request to the back end to obtain data and files, as well as download the file-data relationship table, by calling the interface:

[0034] When the user manually switches to offline mode, the front end first obtains relevant data and the relationship table corresponding to the file and data through an interface, such as an API interface. The purpose of obtaining data and relationship tables is to manage and match the stored files and data in offline mode so that users can view and use complete relevant information;

[0035] In this embodiment, the front end is a local terminal, PAD or mobile phone; the back end refers to the server end, which connects the file library and the server database; the file library is used to store files, and the server database is used to store data.

[0036] Specifically, the file-data relationship table is a table that describes the association between files and data and is used to clarify the correspondence between specific data records and corresponding files;

[0037] Step A2: The backend locks the data requested for download according to the download request, and then downloads it to the IndexedDB database connected to the frontend to achieve exclusive downloading by the frontend;

[0038] In this embodiment, the backend performs locking processing on the current data to be provided, so as to avoid conflicts caused by multiple users downloading the same data source at the same time.

[0039] Specifically, data is downloaded from the server database, which includes structured data and files, such as task records, checklists, work order information, etc. These data are the core content that users may need to access or operate in offline mode;

[0040] Step A3: The backend determines the number of files to be downloaded at a time according to the file size for the files corresponding to the file-data relationship table, and performs segmented downloading on the files;

[0041] Specifically, according to the size of the file in the corresponding file-data relationship table, the corresponding folder to be downloaded to the app is downloaded in pieces. For small files, the system downloads 5-10 files each time; for large files, 1-2 files are downloaded each time to avoid excessive resource usage.

[0042] Specifically, the files in the file library are downloaded, and the files refer to multimedia or attachment files, such as pictures, videos, audios, PDF documents, signature images, etc. These files exist in binary or media formats and usually cannot be directly stored as structured database fields.

[0043] Step A5: On the back end, delete the identifier of each file to be downloaded after it is downloaded; on the front end, add a new local identifier to the local folder of the app after the download is completed, and add the corresponding local file path address;

[0044] In the above step A5, after the file download is completed, the downloaded file is marked, and its storage path and status are recorded to ensure that the file is successfully stored in the local folder of the app.

[0045] According to a further technical solution, the data downloaded in step A2 is stored in IndexedDB, and structured data (such as a relationship table between task data and files) is stored in an IndexedDB database, which is located in the local environment of the front-end application, allowing fast data retrieval without a network connection.

[0046] Step A3: Local storage of downloaded files: After the files are downloaded, they are stored in the local file system of the device (such as the "app local folder"), and the local path of the files is recorded in IndexedDB so that these files can be called locally in offline mode.

[0047] Further technical solution, the front-end logic of this embodiment supports breakpoint resume. When the user clicks the offline execution button again, the undownloaded files will continue to be downloaded until all files are downloaded. After the download is completed, the breakpoint resume sign will be cancelled, proving that the entire data including the file has been downloaded. The breakpoint resume implementation process is as follows:

[0048] Step A61: If an interruption occurs during the data or file download process, the front end records the current download progress and status;

[0049] Step A62: When the front end starts the offline download again, based on the recorded download progress and status, a breakpoint resume flag is added to continue the unfinished download task until all files and data are downloaded, and the breakpoint resume flag is cancelled;

[0050] Specifically, restarting the offline download can be achieved by obtaining the user's input command, and when the user clicks the "offline execution" button again, the offline download is restarted;

[0051] The above-mentioned data and file download and storage in offline mode actually refers to downloading data from the database or file library on the server to the storage space of the local device (such as PAD or mobile phone); the downloaded files and data allow users to access and operate data and view files in an offline environment; and local storage makes data calls faster and does not rely on network transmission, ensuring the stability of offline access;

[0052] Furthermore, when all files are downloaded, the page directly jumps to the offline execution details page, and the user can operate the offline data.

[0053] Furthermore, in offline mode, all operations, edits and records on the front end are obtained and temporarily saved in the local storage space so that they can be synchronized to the server after the network is restored;

[0054] Specifically, when in use, when the user manually switches to offline mode, the system first calls the interface to obtain a relationship table corresponding to the data and the files and data where the current data exists. At the same time, the backend will lock the current data and download the files to the corresponding folders under the app in pieces according to the size of the files in the corresponding relationship table. The default size is not very large, so 5-10 files are downloaded at a time, and 1-2 files of relatively large size are downloaded at a time. The system will mark each downloaded file, and after the download is completed and stored in the local folder of the app, a new download to local mark will be added, and the corresponding local file path address will be added. When all files are downloaded, it will jump directly to the offline execution details page, and users can operate offline data. If a problem occurs during the download process and the download is interrupted, the offline status will be recorded, and the file downloaded will be recorded. If the user clicks the offline execution button again, the undownloaded files will continue to be downloaded until all files are downloaded. The breakpoint resume mark is canceled to prove that the entire data including the files have been downloaded. Figure 1 shown.

[0055] In some embodiments, before data synchronization is uploaded, a signal detection is first performed: when the user switches to the online mode, the network signal status of the device is detected, and if there is a signal, the online mode is entered to synchronize data upload; when the network signal status is no signal, a prompt message is sent to prompt the user to wait;

[0056] Furthermore, the data synchronization uploading method in online mode, such as Figure 2 As shown, the following steps are included:

[0057] Step B1: After receiving the online upload instruction, the front end transmits the file-data relationship table to the back end;

[0058] Specifically, during the offline operation, the file-data relationship table is updated according to the stored files and data and stored in the IndexedDB database, and the file-data relationship table is uploaded from the IndexedDB database to the server database connected to the back end through the communication connection between the front end and the back end;

[0059] Step B2: Upload the corresponding file data in pieces according to the file-data relationship table, determine the number of files to be uploaded at a time according to the size of the file, and upload in pieces; after each piece is uploaded, the front end records the upload status locally;

[0060] For photos, videos and signature files, this embodiment adopts a piecewise upload method, dividing the files into small batches and uploading them step by step, which can effectively reduce the risk of transmission failure caused by network instability;

[0061] Step B3: After all files are synchronized, the execution data is synchronized from the indexDB database connected to the front end to the back end; and saved to the corresponding server database through the back end;

[0062] Execution data is also called business data, which refers to the core data of a task or operation, such as text information, form content, etc., which is used to describe the task content, status, time record, etc.

[0063] Step B3 also includes the backend processing and storage of the received data: after receiving the execution data and files, the backend performs data verification and processing, and stores the data and files in the corresponding server database and file library respectively. After the verification is passed, the data storage process is completed, ensuring that each shard, file and data uploaded by the front end has been completely saved.

[0064] Furthermore, after the synchronous upload is completed, the deletion control process of the front-end data is also included:

[0065] Step B31: After the backend confirms that all data and files have been successfully stored, it sends a confirmation message of successful storage;

[0066] Step B31: After receiving the confirmation message, the front end deletes the corresponding execution data and relationship table data in IndexedDB, and deletes the uploaded files in the local folder to ensure the rational use of storage space.

[0067] Furthermore, the synchronous upload process also includes the breakpoint resume process:

[0068] Step B41: When a file segment is successfully uploaded, the upload progress and status are recorded;

[0069] Step B42: If an interruption occurs during the data or file download process, the failed file segments are recorded, and the file segments are re-uploaded when the network is stable until all segments are successfully uploaded.

[0070] In this step, if an error occurs during the synchronous upload process and the file synchronization is interrupted, the front end records the synchronized files. When the user clicks upload again, the files that have not been synchronized to the back end can be synchronized.

[0071] Specifically, when the user manually synchronizes data (switch from offline to online), first determine whether the pad or mobile phone has a signal. If there is no signal, prompt the user. If there is a signal, pass the file relationship table to the backend, and then synchronize the photos, videos, signatures and other file data in pieces. When all file data are synchronized, synchronize the data from indexDB to the backend. The backend processes the saved data and saves it to the corresponding database. If an error is reported in the middle and the file synchronization is interrupted, the synchronized file will be recorded. When the user clicks again, the file that has not been synchronized to the backend can be synchronized. The frontend will not prompt the user that the synchronization is complete until all data and files are synchronized and the backend is processed. At the same time, all local files with changed data and related data stored in IndexDB are deleted.

[0072] The following is a specific example to illustrate the above process. The maintenance procedure arrangement and execution system is executed offline: click the offline execution button in the procedure list to enter the second confirmation. After confirmation, call the interface to obtain the procedure data and the procedure file mapping data to store in the indexDB database, such as Figure 5 As shown, the procedure data is stored in the indexDB database, which is a non-relational database (NOSQL) that stores data in key-value pairs.

[0073] The user's front-end device obtains the file in pieces according to the procedure file mapping table and stores it in the app's local folder. When all the data is completed, the data flag will be updated to indicate that the procedure has entered the offline execution mode;

[0074] like Figure 3 and Figure 4 As shown in the figure, the difference between the offline execution and online execution operation interface is that the offline execution user only has a confirmation button, and the user can confirm the offline data. When the user needs to synchronize data, such as Figure 6 As shown, the user can click the synchronize data button in the list to synchronize offline execution data. Only when all data is synchronized, the front-end app will delete the files stored in the app folder and the data source stored in indexDB.

[0075] Example 2

[0076] Based on Example 1, this embodiment provides an offline data storage synchronization system, including: a front end and a back end, the front end is a local terminal, connected with a local folder and an IndexedDB server, respectively used to store files and data; the back end is a server, connected with a file library and a server database;

[0077] During the offline mode data and file download and storage process, the data interaction process between the front-end and back-end includes the following steps:

[0078] Step A1: The front end sends a request to the back end to obtain data and files, as well as download the file-data relationship table, by calling the interface:

[0079] Step A2: The backend locks the data requested for download according to the download request, and then downloads it to achieve exclusive downloading by the frontend;

[0080] Step A3: The backend determines the number of files to be downloaded at a time according to the file size for the files corresponding to the file-data relationship table, and performs segmented downloading on the files.

[0081] This embodiment achieves efficient data storage and synchronization through the interaction between the front-end and the back-end. First, the front-end sends a download request to the back-end through an interface call to ensure that data and files are updated in a timely manner in offline mode. In order to ensure the exclusivity of the front-end download, the back-end locks the requested data to avoid interference from other processes and improve data integrity and security. In addition, the back-end performs fragmented downloads based on the size of the file, improves transmission efficiency by splitting large files, reduces the pressure of a single download, and makes the download operation more stable. This method can effectively support the storage and synchronization of complex data structures, and is particularly suitable for the storage and offline query of large amounts of data.

[0082] Furthermore, the data synchronization upload process in the online mode and the data interaction process between the front-end and the back-end include the following steps:

[0083] Step B1: The front end receives the online upload instruction and transmits the file-data relationship table to the back end;

[0084] Step B2: The front end uploads the corresponding file data in pieces according to the file-data relationship table, determines the number of files to be uploaded at a time according to the size of the files, and uploads them;

[0085] Step B3: When all files are synchronized, the front end synchronizes the execution data in the connected indexDB database to the back end.

[0086] During the data synchronization upload process in online mode, efficient data synchronization is achieved through the transmission of the file-data relationship table and the fragmented upload strategy. First, after receiving the online upload instruction, the front-end transmits the file-data relationship table to the back-end. This relationship table is used to identify and match the association information of the front-end files and data to ensure that the data and files are accurate during the synchronization process. Then, according to the file size in the relationship table, the files are uploaded in batches and fragments to avoid a large amount of data uploaded in a single time occupying bandwidth or causing system delays. The fragmented upload method splits large files into multiple small fragments and uploads them one by one, which improves the flexibility and efficiency of transmission. Finally, when the file synchronization is completed, the front-end synchronizes the execution data in the indexDB database with the back-end to ensure the consistency of data and operation records, and provide support for subsequent data processing and use.

[0087] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. For those skilled in the art, the present disclosure may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

[0088] Although the above describes the specific implementation methods of the present disclosure in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present disclosure. Technical personnel in the relevant field should understand that on the basis of the technical solution of the present disclosure, various modifications or variations that can be made by those skilled in the art without creative work are still within the scope of protection of the present disclosure.

Claims

1. An offline data storage and synchronization method, including a data and file download and storage method in an offline mode and a data synchronization and upload method in an online mode, characterized in that: The method for downloading and storing data and files in offline mode includes the following steps: The front end sends a request to the back end to obtain data and files, as well as download the file-data relationship table, by calling the interface: The backend locks the data requested for download according to the download request, and then downloads it to achieve exclusive downloading for the frontend; The backend determines the number of files to be downloaded at a time based on the file size corresponding to the files in the file-data relationship table, and performs segmented downloading on the files.

2. An offline data storage and synchronization method as claimed in claim 1, characterized in that: During the data and file download process in offline mode, on the back end, the pending download mark is deleted for each downloaded file; on the front end, a new local mark is added to the app local folder after the download is completed, and the corresponding local file path address is added.

3. The offline data storage and synchronization method according to claim 1, characterized in that: During the data and file download process in offline mode, the front-end performs breakpoint resume as follows: If an interruption occurs during data or file download, the front end records the current download progress and status; When the front end starts offline downloading again, based on the recorded download progress and status, a breakpoint resume flag is added to continue the unfinished download task until all files and data are downloaded, and the breakpoint resume flag is canceled.

4. The offline data storage and synchronization method according to claim 1, characterized in that: In offline mode, all operations, edits, and records performed on the front end are obtained and temporarily saved in the local storage space.

5. The offline data storage and synchronization method according to claim 1, characterized in that: The method for synchronously uploading data in online mode includes the following steps: After receiving the online upload instruction, the front end transfers the file-data relationship table to the back end; According to the file-data relationship table, the corresponding file data is uploaded in pieces, and the number of files to be uploaded at a time is determined according to the size of the file, and then uploaded; When all files are synchronized, the frontend synchronizes the execution data in the connected indexDB database to the backend.

6. An offline data storage and synchronization method as claimed in claim 5, characterized in that: Before uploading data synchronously, signal detection is performed first: when the user switches to online mode, the network signal status of the device is detected, and if there is a signal, the online mode is entered to upload data synchronously; when the network signal status is no signal, a prompt message is sent to prompt the user to wait.

7. An offline data storage and synchronization method as claimed in claim 5, characterized in that: The data synchronization process in online mode also includes the back-end processing and storage of received data: after the back-end receives the execution data and files, it performs data verification and processing, and stores the data and files in the corresponding server database and file library respectively.

8. The offline data storage and synchronization method according to claim 5, characterized in that: After the data synchronization upload is completed in the online mode, the front-end data will be deleted; Alternatively, the synchronous upload process also includes the breakpoint resume process: When a file segment is uploaded successfully, the upload progress and status are recorded; If an interruption occurs during the data or file download process, the failed file segments are recorded and re-uploaded when the network is stable until all file segments are successfully uploaded.

9. An offline data storage and synchronization system, characterized in that: include: Front-end and back-end, the front-end is a local terminal, connected with a local folder and IndexedDB server, which are used to store files and data respectively; The backend is the server side, which is connected with the file library and server database; During the offline mode data and file download and storage process, the data interaction process between the front-end and back-end includes the following steps: The front end sends a request to the back end to obtain data and files, as well as download the file-data relationship table, by calling the interface: The backend locks the data requested for download according to the download request, and then downloads it to achieve exclusive downloading for the frontend; The backend determines the number of files to be downloaded at a time based on the file size corresponding to the files in the file-data relationship table, and performs segmented downloading on the files.

10. An offline data storage and synchronization system as claimed in claim 9, characterized in that: include: The data synchronization upload process in online mode and the data interaction process between the front-end and the back-end include the following steps: The front end receives the online upload instruction and transmits the file-data relationship table to the back end; The front end uploads the corresponding file data in pieces according to the file-data relationship table, determines the number of files to be uploaded at a time according to the file size, and uploads them; When all files are synchronized, the frontend synchronizes the execution data in the connected indexDB database to the backend.

Citation Information

Cited By

  • Intelligent synchronization method for foreground and background state information in project management

    CN120881087A