Objectives:
You can imagine that the company has already deployed information technology, and many office processes have been moved to the online operating system to solve the problem. This brings great convenience to employees and saves office time, improve office efficiency, but we put all the processes and data on the company's servers. Once we leave the company, we are equivalent to breaking away from all our office environments, you can no longer view operation data on the company's system, or add or delete operations. If you have a lot of work recently and you cannot finish it within a limited period of normal office time, what should you do? The office life begins when you fight in the office.
Offline applications are born to solve such problems. In view of the situations listed above, you do not need to fight in the office. All you have to do is
1. synchronize data from a list (or storage structure) of an online system to a local device as needed
2. Go home and use your leisure time to open offline applications and operate data.
3. Return to the company the next day and synchronize data to the company server
After talking about this, we have only one goal: To achieve offline office work.
Implementation Scheme:
We divide the entire Offline Application into two parts:
1. Synchronize business data locally
2. submit the application locally to the Business System
How to support users to operate data in the middle is not the focus of our discussion here. This is also changed with the business logic. Generally, the functions are the same as those of online systems.
1. Synchronize business data locally
It is not difficult to synchronize the business data on the cloud to the local on demand, but it cannot be underestimated here.
Technical Implementation points:
- The ability to select data synchronization to local as needed. In order to prevent users from spending a lot of time waiting for data synchronization to local, we can adopt the data synchronization mechanism selected by users, if you have the option to synchronize data that is actually useful to users to a local device, you canCodeIn the logic, you also need to remember the user's choices and make them persistent to provide the processing Foundation for the user to return to the company for data submission.
- Offline client data storage can realize data persistence
In addition to the above, we must also solve the problem of differential synchronization when synchronizing business data to the local machine.
Although you can select as needed when synchronizing business data to a local machine, if you have selected data that already has local copies, what should we do? The implementation of differential synchronization is unknown. Do you have any good solutions? I will provide some suggestions here.
- The most stupid way is to traverse and judge in turn whether the attributes are equal. If a local copy is found, the system will jump to the next business data entry and continue running,
- The version method is used to add a version to each business data entry. Any changes to the business data entry will cause version ++. In this way, we can determine the version by judging the version, in addition, we can use interception events to avoid any changes in the business logic caused by version.
2. submit data to the Business System
After an employee returns to the company, the system submits the changes that the employee has made online to the business system.
Technical Implementation points:
- Find the data that has been changed. Here we plan to use the "changed data" storage module to identify the data entries that have been changed by the user, so as to get a faster speed, we can find the data that has been changed in the shortest time.
- Submit to the server, find the changed data entries on the server, and apply the user's latest processing results. If the user is offline, other users make some changes to the online data, what should we do? Our tentative principle is to change the user to the latest data. Of course, there is something wrong with this. I don't know if you have any better solutions.