Disclosure of Invention
In view of this, embodiments of the present invention provide a method, an apparatus, a device, and a computer-readable medium for processing a document, which can avoid data collision and ensure that the same document is consistent among different clients.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of processing a document, including:
displaying a document corresponding to the operation document instruction;
determining that other users have processed the document corresponding to the operation document instruction based on the current time and the latest saving time of the document corresponding to the operation document instruction;
locking a document corresponding to the operation document instruction, and acquiring an update document of the document corresponding to the operation document instruction;
and executing the operation document instruction in the update document.
The display operation document instruction corresponds to a document and comprises the following steps:
storing the identification of the document corresponding to the operation document instruction and the storage time of the document corresponding to the display operation document instruction;
and displaying the document corresponding to the operation document instruction according to the storage time.
The storing the identification of the document corresponding to the operation document instruction and the saving time of the document corresponding to the display operation document instruction comprises:
and storing the identification of the document corresponding to the operation document instruction and the storage time of the document corresponding to the display operation document instruction in log data.
Displaying a document corresponding to the operation document instruction according to the storage time, wherein the displaying includes:
and displaying the document corresponding to the operation document instruction according to the latest storage time.
The determining that the other user has processed the document corresponding to the operation document instruction based on the current time and the latest saving time of the document corresponding to the operation document instruction includes:
positioning an operation time period based on the current time and the latest saving time of the document corresponding to the operation document instruction;
and in the operation time period, searching an updated document according to the identification of the document corresponding to the operation document instruction, and determining that other users process the document corresponding to the operation document instruction.
The latest saving time of the document corresponding to the operation document instruction and the identification of the document corresponding to the operation document instruction are parameters transmitted from a log function.
And the latest saving time of the document corresponding to the operation document instruction is the updated time stamp.
The timestamp is obtained after invoking SaveLog refresh in the form PostSave event.
The method further comprises the following steps:
and updating the time stamp by the time of opening the document corresponding to the operation instruction.
The updating the timestamp by the time of opening the document corresponding to the operation instruction comprises:
and updating the time stamp according to the time when the user and/or the network terminal opens the document corresponding to the operation instruction.
If the updated document is searched according to the identifier of the document corresponding to the operation document instruction in the operation time period, determining that the document corresponding to the operation document instruction is processed by other users, including:
and in the operation time period, searching one or more updated documents according to the identification of the document corresponding to the operation document instruction, and determining that other users have processed the document corresponding to the operation document instruction.
The operation document instruction comprises a document editing instruction and a document saving instruction.
The locking the document corresponding to the operation document instruction comprises:
and displaying prompt information, and locking the document corresponding to the operation document instruction.
The locking the document corresponding to the operation document instruction comprises:
and rejecting the operation document instruction, and locking the document corresponding to the operation instruction.
The obtaining of the update document of the document corresponding to the operation document instruction includes:
and acquiring an updated document of the document corresponding to the operation document instruction according to the operation document instruction and the updated latest storage time.
The method further comprises the following steps:
determining that no other user processes the document corresponding to the operation document instruction based on the current time and the latest saving time of the document corresponding to the operation document instruction;
and executing the operation document instruction in the document corresponding to the operation document instruction.
In the update document, executing the operation document instruction includes:
and displaying the updated document information, and executing the operation document instruction in the updated document.
According to a second aspect of the embodiments of the present invention, there is provided an apparatus for processing a document, including:
the display module is used for displaying the document corresponding to the document operation instruction;
the judging module is used for determining that other users have processed the documents corresponding to the operation document instructions based on the current time and the latest saving time of the documents corresponding to the operation document instructions;
the locking module is used for locking the document corresponding to the operation document instruction and acquiring an update document of the document corresponding to the operation document instruction;
and the execution module is used for executing the operation document instruction in the update document.
According to a third aspect of embodiments of the present invention, there is provided an electronic device for processing a document, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method as described above.
According to a fourth aspect of embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which program, when executed by a processor, performs the method as described above.
One embodiment of the above invention has the following advantages or benefits: displaying a document corresponding to the operation document instruction; determining that other users have processed the document corresponding to the operation document instruction based on the current time and the latest saving time of the document corresponding to the operation document instruction; locking a document corresponding to the operation document instruction, and acquiring an update document of the document corresponding to the operation document instruction; and executing the operation document instruction in the updating document. And the document is locked under the condition that the documents are determined to be processed by other users, so that data collision can be avoided, and the consistency of the same document at different clients is ensured.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The client protection mechanism provided by the group working software prevents the client from saving the contents saved by other users during the period of opening the overlay document.
As one example, the group work software is Domino. The Domino application is limited to document database features, and the correlation information between related entities exists in the form of redundant copies. When an entity data is changed, the entity data needs to be synchronously updated to a related document. When updating, a conflict will occur if other users are editing the document through the client.
The document protection mechanism is easy to generate data conflict caused by background updating and delayed editing of the client, and two inconsistent data are generated or the modified content of other people is forcibly covered, so that the same document is inconsistent at different clients.
In order to solve the data conflict, the same document is inconsistent at different clients, and the following technical scheme in the embodiment of the invention can be adopted.
Referring to fig. 1, fig. 1 is a schematic diagram of a main flow of a method for processing a document according to an embodiment of the present invention, and is configured to lock a document when determining that a document has been processed by another user, and execute an operation document instruction after updating the document. As shown in fig. 1, the method specifically comprises the following steps:
s101, displaying the corresponding document of the operation document instruction.
Team work software is typically used among multiple operators. As an example, operators belonging to the same group may share operations for one document. Such as: operator a adds a caption to the document, operator B adds a list to the document, and operator C deletes a segment of text in the document.
And for each operator in the group, sending an operation document instruction to display a document corresponding to the operation document instruction.
In one embodiment of the invention, operating the document instructions includes editing the document instructions and saving the document instructions. That is to say, the technical solution in the embodiment of the present invention is not only suitable for editing a document, but also suitable for saving the document.
Referring to fig. 2, fig. 2 is a schematic flowchart of displaying a document corresponding to an operation document instruction according to an embodiment of the present invention, which specifically includes the following steps:
s201, storing identification of the document corresponding to the operation document instruction and displaying storage time of the document corresponding to the operation document instruction.
The identification of the document is included in the operate document instruction. And obtaining the document from the network terminal according to the identification of the document. It should be noted that the document is stored on the network side. When the operator needs to operate the document, the document can be obtained from the network terminal based on the identification of the document.
Since the document can receive operation instructions from a plurality of operators, the document is written as a plurality of versions of the document according to the storage time.
In one embodiment of the invention, in order to facilitate searching for information, the identification of the document corresponding to the operation document instruction and the storage time of the document corresponding to the display operation document instruction are stored in the log data. As one example, the Log data is a Log data store Log.
The purpose of storing the identification of the document corresponding to the operation document instruction and displaying the saving time of the document corresponding to the operation document instruction is to display the document. This is because even a document having the same identifier has a plurality of versions due to different retention times.
S202, displaying the document corresponding to the operation document instruction according to the storage time.
Documents exist in multiple versions based on the difference in retention time. As an example, the identification of the document is a 001 document, which includes the following three versions, respectively: 1 month, 2 days 13:02, 001 document; 1 month, 2 days 14: 001 document of 00; 1 month, 2 days 15: 00.
And displaying the document corresponding to the operation document instruction according to the storage time. As one example, the identity of the displayed document corresponds to a plurality of retention times. The document is then displayed based on the user selected save time.
In one embodiment of the present invention, in consideration of the fact that the user needs to perform an operation in the current latest version of the document, the operation document instruction corresponding document is displayed according to the latest saving time.
As an example, the identification of the document is a 001 document, which includes the following three versions, respectively: 1 month, 2 days 13:02, 001 document; 1 month, 2 days 14: 001 document of 00; 1 month, 2 days 15: 00. According to the latest preservation time: 1 month, 2 days 15:00, 1 month, 2 days 15: 00.
In the embodiment of fig. 2, the document corresponding to the operation document instruction may be displayed according to the actual requirement of the user, so that the user can operate the document.
S102, determining the documents corresponding to the operation document instructions processed by other users based on the current time and the latest saving time of the documents corresponding to the operation document instructions.
Each operator in the group can operate on the same document, and in order to determine whether the document is updated, the judgment can be carried out based on the current time and the latest saving time of the document corresponding to the operation document instruction.
Referring to fig. 3, fig. 3 is a schematic flowchart of determining a document corresponding to an operation document instruction processed by another user according to an embodiment of the present invention, which specifically includes:
s301, positioning an operation time period based on the current time and the latest saving time of the document corresponding to the operation document instruction.
In the embodiment of the present invention, for a document, the saving time is recorded when the document is saved. As an example, the first save time for saving document 001 is 7 months, 12 days, 11:02. the second save time for saving document 001 is 7 months, 12 days, 15:20.
then, the operational time period may first be located based on the current time and the latest save time of the corresponding document of the operational document instructions.
As an example, the current time is: 7 month, 12 day 16: 7 month, 12 day, 15, then the positioning operation time period is: 7 month 12 day 15.
It should be noted that the current time can be obtained from the client. The latest storage time of the document is obtained when the document is obtained from the network side.
In one embodiment of the invention, the latest saving time of the document corresponding to the operation document instruction and the identification of the document corresponding to the operation document instruction are parameters which are transmitted from the log function. As one example, the log function is SaveLog. SaveLog enters the document object and records the document identification and the latest save time of the document into the log.
In one embodiment of the invention, the latest saving time of the corresponding document of the operation document instruction is the updated time stamp. That is, the latest save time of the document is taken as the updated time stamp.
As an example, saveLog is invoked after any manner of document saving to log the save log. Save is called after the script calls doc. That is, the timestamp is obtained after invoking the SaveLog refresh in the form PostSave event.
In one embodiment of the invention, the time stamp is updated in order to update the time stamp in time to open the time of the document corresponding to the operation instruction. Specifically, the time stamp is updated according to the time when the user and/or the network end opens the corresponding document of the operation instruction. The user opens the document, which explains the user's operation of the document. And the network end opens the document to show that the network end operates the document.
S302, in the operation time period, searching the updated document according to the identification of the document corresponding to the operation document instruction, and then determining that the document corresponding to the operation document instruction is processed by other users.
During the operational time period, it is considered that there may be other users processing the document. And uploading the updated document to the network side under the condition that other users process the document. Therefore, in the operation time period, the updated document is searched according to the identification of the document corresponding to the operation document instruction. Determining documents corresponding to the processed operation document instructions of other users under the condition of searching the updated documents; and under the condition that the updated document is not searched, determining that the document corresponding to the unprocessed operation document instruction of other users corresponds to the document.
In one embodiment of the invention, based on the current time and the latest saving time of the document corresponding to the operation document instruction, determining that no other user processes the document corresponding to the operation document instruction; and executing the operation document instruction in the document corresponding to the operation document instruction.
In one embodiment of the invention, in the operation time period, one or more updated documents are searched according to the identification of the document corresponding to the operation document instruction, and then it is determined that the document corresponding to the operation document instruction is processed by other users.
In specific implementation, conflict judgment is carried out in a QueryModechange before document editing or a QueryS event before editing storage, and whether a storage record of the current document exists from a time stamp to the current time is searched. If the storage record exists, determining that the other users process the documents corresponding to the operation document instructions; and if the storage record does not exist, determining that the document corresponding to the unprocessed operation document instruction of the other users corresponds to the storage record.
In the embodiment of FIG. 2, it can be determined that other users have processed the document based on the current time and the latest save time of the document.
S103, locking the document corresponding to the document operation instruction, and acquiring an updated document of the document corresponding to the document operation instruction.
In the case where the document has been processed by other users, it is stated that the displayed document is not the latest version of the document. In order to avoid document conflict, the corresponding document of the document operation instruction is locked so as to avoid background update or client editing. And acquiring an updated document of the document corresponding to the document instruction. The user edits the document through the client. As one example, the client is a browser.
In one embodiment of the invention, in order to prompt the user, prompt information can be displayed, and the corresponding document is instructed to be locked. As an example, the hint information includes: the document is locked, please operate later.
In one embodiment of the invention, in order to avoid document conflict, the document operation instruction is rejected, and the operation instruction is locked to the corresponding document.
In one embodiment of the present invention, since there is a document processed by another user after the latest save time, the latest save time is updated with the time at which the document was processed by the other user. And acquiring an updated document of the document corresponding to the operation document instruction according to the operation document instruction and the updated latest storage time.
And S104, executing an operation document instruction in the update document.
The update document is the latest version of the document corresponding to the operation document instruction, and further the operation document instruction can be executed in the update document. As one example, update document information is displayed, and in the update document, an operation document instruction is executed.
Because the update document is the latest version of the document corresponding to the operation document instruction, document conflict cannot be generated when the operation is performed in the update document.
In the above embodiment, the display operation document instruction corresponds to a document; determining that other users have processed the document corresponding to the operation document instruction based on the current time and the latest saving time of the document corresponding to the operation document instruction; locking a document corresponding to the operation document instruction, and acquiring an update document of the document corresponding to the operation document instruction; and executing the operation document instruction in the update document. And the document is locked under the condition that the documents are determined to be processed by other users, so that data collision can be avoided, and the consistency of the same document at different clients is ensured.
Referring to fig. 4, fig. 4 is a schematic diagram of a main structure of an apparatus for processing a document according to an embodiment of the present invention, where the apparatus for processing a document may implement a method for processing a document, and as shown in fig. 4, the apparatus for processing a document specifically includes:
thedisplay module 401 is configured to display a document corresponding to the document operation instruction;
a judgingmodule 402, configured to determine that a document corresponding to the operation document instruction has been processed by another user based on the current time and the latest saving time of the document corresponding to the operation document instruction;
alocking module 403, configured to lock a document corresponding to the operation document instruction, and obtain an update document of the document corresponding to the operation document instruction;
an executingmodule 404, configured to execute the operation document instruction in the update document.
In an embodiment of the present invention, thedisplay module 401 is specifically configured to store an identifier of a document corresponding to the operation document instruction and a saving time of the document corresponding to the display operation document instruction;
and displaying the document corresponding to the operation document instruction according to the storage time.
In an embodiment of the present invention, thedisplay module 401 is specifically configured to store, in log data, an identifier of a document corresponding to the operation document instruction and a saving time of the document corresponding to the display operation document instruction.
In an embodiment of the present invention, thedisplay module 401 is specifically configured to display a document corresponding to the operation document instruction according to the latest storage time.
In an embodiment of the present invention, the determiningmodule 402 is specifically configured to locate an operation time period based on a current time and a latest saving time of a document corresponding to the operation document instruction;
and in the operation time period, searching an updated document according to the identification of the document corresponding to the operation document instruction, and determining that other users have processed the document corresponding to the operation document instruction.
In one embodiment of the invention, the latest saving time of the document corresponding to the operation document instruction and the identification of the document corresponding to the operation document instruction are parameters which are transmitted from a log function.
In an embodiment of the present invention, the latest saving time of the operation document instruction corresponding to the document is an updated time stamp.
In one embodiment of the invention, the timestamp is obtained after invoking SaveLog refresh in the form PostSave event.
In an embodiment of the present invention, the determiningmodule 402 is specifically configured to update the timestamp by the time when the document corresponding to the operation instruction is opened.
In an embodiment of the present invention, the determiningmodule 402 is specifically configured to update the timestamp by the time when the user and/or the network opens the document corresponding to the operation instruction.
In an embodiment of the present invention, the determiningmodule 402 is specifically configured to, in the operation time period, search for one or more updated documents according to the identifier of the document corresponding to the operation document instruction, and determine that the document corresponding to the operation document instruction has been processed by another user.
In one embodiment of the invention, the operate document instruction includes an edit document instruction and a save document instruction.
In an embodiment of the present invention, thelocking module 403 is specifically configured to display the prompt information and lock the document corresponding to the operation document instruction.
In an embodiment of the present invention, thelocking module 403 is specifically configured to reject the operation document instruction, and lock a document corresponding to the operation instruction.
In an embodiment of the present invention, thelocking module 403 is specifically configured to obtain, according to the operation document instruction and the updated latest saving time, an update document of a document corresponding to the operation document instruction.
In an embodiment of the present invention, the determiningmodule 402 is further configured to determine that no other user processes the document corresponding to the operation document instruction based on the current time and the latest saving time of the document corresponding to the operation document instruction;
and executing the operation document instruction in the document corresponding to the operation document instruction.
In an embodiment of the present invention, theexecution module 404 is specifically configured to display the update document information, and in the update document, execute the operation document instruction.
Fig. 5 illustrates anexemplary system architecture 500 of a method of processing a document or an apparatus for processing a document to which embodiments of the present invention may be applied.
As shown in fig. 5, thesystem architecture 500 may includeterminal devices 501, 502, 503, anetwork 504, and aserver 505. Thenetwork 504 serves to provide a medium for communication links between theterminal devices 501, 502, 503 and theserver 505.Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use theterminal devices 501, 502, 503 to interact with aserver 505 over anetwork 504 to receive or send messages or the like. Theterminal devices 501, 502, 503 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
Theterminal devices 501, 502, 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
Theserver 505 may be a server providing various services, such as a back-office management server (for example only) that provides support for shopping-like websites browsed by users using theterminal devices 501, 502, 503. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the method for processing a document provided by the embodiment of the present invention is generally executed by theserver 505, and accordingly, an apparatus for processing a document is generally disposed in theserver 505.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, a block diagram of acomputer system 600 suitable for use with a terminal device implementing embodiments of the present invention is shown. The terminal device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 6, thecomputer system 600 includes a Central Processing Unit (CPU) 601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from astorage section 608 into a Random Access Memory (RAM) 603. In theRAM 603, various programs and data necessary for the operation of thesystem 600 are also stored. TheCPU 601,ROM 602, andRAM 603 are connected to each other via abus 604. An input/output (I/O)interface 605 is also connected tobus 604.
The following components are connected to the I/O interface 605: aninput portion 606 including a keyboard, a mouse, and the like; anoutput portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; astorage section 608 including a hard disk and the like; and acommunication section 609 including a network interface card such as a LAN card, a modem, or the like. Thecommunication section 609 performs communication processing via a network such as the internet. Thedriver 610 is also connected to the I/O interface 605 as needed. Aremovable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on thedrive 610 as necessary, so that the computer program read out therefrom is mounted in thestorage section 608 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through thecommunication section 609, and/or installed from theremovable medium 611. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present invention, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a display module, a determination module, a locking module, and an execution module. Here, the names of these modules do not constitute a limitation to the module itself in some cases, and for example, the display module may also be described as "for displaying an operation document instruction correspondence document".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
displaying a document corresponding to the operation document instruction;
determining that other users have processed the document corresponding to the operation document instruction based on the current time and the latest saving time of the document corresponding to the operation document instruction;
locking a document corresponding to the operation document instruction, and acquiring an update document of the document corresponding to the operation document instruction;
and executing the operation document instruction in the update document.
According to the technical scheme of the embodiment of the invention, the document corresponding to the operation document instruction is displayed; determining that other users have processed the document corresponding to the operation document instruction based on the current time and the latest saving time of the document corresponding to the operation document instruction; locking a document corresponding to the operation document instruction, and acquiring an update document of the document corresponding to the operation document instruction; and executing the operation document instruction in the update document. And locking the document under the condition that the document is determined to be processed by other users, so that data conflict can be avoided, and the consistency of the same document in different clients is ensured.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.