A multi-user cooperative document editing method, device, equipment and storage medium
Patent Information
- Application Number
- CN202610642863.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-11
- Publication Date
- 2026-09-22
AI Technical Summary
随着项目参与人员增多、协作流程复杂化,传统文档协作方式仅支持简单共享与基础权限管控,无法与项目阶段、成员角色深度关联,难以满足多角色、分阶段的精细化协作管理需求,文档协作秩序与编辑安全性难以保障
本申请实施例提供了一种多用户协作的文档编辑方法、装置、设备及存储介质,与现有技术相比具有如下优点:
Smart Images

Figure CN122797490A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of collaborative work, and in particular to a method, apparatus, device and storage medium for multi-user collaborative document editing. Background Technology
[0002] In project collaboration platforms, collaborative document editing is a crucial step in project information synchronization, content creation, and deliverables. As the number of project participants increases and collaboration processes become more complex, traditional document collaboration methods, which only support simple sharing and basic permission control, cannot be deeply integrated with project phases and member roles. This makes it difficult to meet the needs of refined collaboration management across multiple roles and phases, and complicates the guarantee of document collaboration order and editing security.
[0003] Existing multi-user document collaboration mostly adopts a real-time concurrent editing mode. Although it offers high editing flexibility, multiple people editing the same document at the same time can easily lead to problems such as content conflicts, version inconsistencies, and data overwriting, interfering with normal editing operations and reducing the smoothness and accuracy of document editing. At the same time, existing solutions lack stage and role permission verification in project scenarios, making it impossible to control editing behavior of unauthorized members or at unauthorized stages, resulting in significant risks of unauthorized editing and invalid modifications.
[0004] Furthermore, existing technologies lack standardized mechanisms for allocating and automatically transferring editing permissions. When multiple members edit the same document sequentially, the absence of an orderly queuing system for requesting permissions easily leads to disputes over access rights. Moreover, permission transfer relies on manual operation and lacks automatic transfer logic, which can result in permission stagnation and delayed handover, thus hindering the document editing process and reducing project collaboration efficiency. Therefore, there is an urgent need for a multi-user collaborative document editing method that can avoid concurrent editing conflicts, support role and stage control, and achieve orderly queuing and automatic transfer of editing permissions. Summary of the Invention
[0005] This application provides a method, apparatus, device, and storage medium for multi-user collaborative document editing, which can effectively avoid conflicts caused by multiple concurrent editing, realize orderly queuing of document editing and automatic transfer of permissions, and improve the standardization, security, and editing efficiency of multi-user document collaboration.
[0006] In a first aspect, this application provides a multi-user collaborative document editing method, comprising: when a collaboration start instruction initiated by a document permission holder is detected, constructing a document collaboration task containing a set of invited collaboration members, and setting the document permission holder as the editing permission holder; during the document collaboration task, only responding to the editing operation of the editing permission holder on the target document; when any member in the set of invited collaboration members initiates an editing request, if the editing permission holder currently exists, adding the member initiating the editing request to the editing queue; when the editing queue is not empty and a preset permission transfer condition is met, changing the editing permission holder to the first member in the editing queue, and updating the editing queue.
[0007] In one possible implementation, when a collaboration initiation command initiated by a document permission holder is detected, a document collaboration task containing a set of invited collaboration members is constructed, and the document permission holder is set as the editing permission holder. Specifically, this includes: verifying whether the document permission holder meets preset collaboration initiation conditions based on the current project's stage information and document status; if the verification passes, obtaining the original project member set, removing the document permission holder and members in the original project member set who do not have document editing permissions to obtain a candidate member set, and determining the members specified by the document permission holder in the candidate member set as the invited collaboration member set; updating the document collaboration task based on the invited collaboration member set, setting the document collaboration task's status to "on," setting the editing permission holder as the document permission holder, and clearing the existing editing queue in the document collaboration task; and sending collaboration initiation notifications to members in the invited collaboration member set.
[0008] In one possible implementation, the step of responding only to the editing operation of the target document by the person holding the editing rights during the document collaboration task includes: receiving a document editing request sent by a client during the document collaboration task, wherein the document editing request carries the user identifier of the current operator; obtaining the editing rights holder identifier of the current editing rights holder based on the document collaboration task; and if the user identifier matches the editing rights holder identifier, then responding to the document editing request and performing the editing operation on the target document.
[0009] In one possible implementation, when an editing request is detected from any member in the invited collaboration member set, if an editing permission holder already exists, the member who initiated the editing request is added to the editing queue. Specifically, this includes: upon receiving an editing request, determining whether the current operator initiating the editing request is a member of the invited collaboration member set; if so, confirming that an editing request initiated by a member of the invited collaboration member set has been detected; determining whether an editing permission holder exists in the current document collaboration task; if an editing permission holder exists, and the current number of people in the editing queue is less than a preset queue length threshold, adding the member who initiated the editing request to the editing queue; if the current number of people in the editing queue reaches the preset queue length threshold, rejecting the editing request from the member who initiated the editing request and returning a message indicating that the editing queue is full.
[0010] In one possible implementation, the step of changing the editing permission holder to the first member of the editing queue when the editing queue is not empty and a preset permission transfer condition is met specifically includes: when it is detected that the editing permission holder initiates an exit editing command, or when it is detected that the editing timer corresponding to the editing permission holder triggers a timeout event, determining that the preset permission transfer condition is currently met; determining whether the editing queue is empty; if the editing queue is not empty, then changing the editing permission holder to the first member of the editing queue.
[0011] In one possible implementation, the multi-user collaborative document editing method provided in this application further includes: when any member in the editing queue initiates a cancellation request, verifying whether the current document collaboration task is in a cancelable editing state and whether the member initiating the cancellation request exists in the editing queue; if the verification is successful, removing the member initiating the cancellation request from the editing queue; if the removed member is the first member in the editing queue, and a second member exists in the editing queue after removal, updating the second member to the first member; if the removed member is the first member in the editing queue, and a second member does not exist in the editing queue after removal, clearing the editing queue; if the removed member is not the first member in the editing queue, setting the position identifier of the removed member in the editing queue to null.
[0012] In one possible implementation, the document editing method for multi-user collaboration provided in this application further includes: when a collaboration closure instruction initiated by any user is detected, verifying whether the user initiating the collaboration closure instruction is the document permission holder; if so, setting the status of the document collaboration task to closed, clearing the editing permission holder, clearing the editing queue, and clearing the set of invited collaboration members; otherwise, refusing to execute the collaboration closure instruction.
[0013] Secondly, this application provides a multi-user collaborative document editing device, including: a document collaboration task construction module, an editing operation response module, an editing queue entry module, and an editing permission holder change module; wherein, the document collaboration task construction module is used to construct a document collaboration task containing a set of invited collaboration members when a collaboration start instruction initiated by a document permission holder is detected, and set the document permission holder as the editing permission holder; the editing operation response module is used to respond only to the editing operation of the editing permission holder on the target document during the document collaboration task; the editing queue entry module is used to add the member initiating the editing request to the editing queue if the editing permission holder currently exists when any member in the set of invited collaboration members initiates an editing request; the editing permission holder change module is used to change the editing permission holder to the first member in the editing queue and update the editing queue when the editing queue is not empty and a preset permission transfer condition is met.
[0014] Thirdly, embodiments of this application also provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described method.
[0015] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the above-described method. This application provides a method, apparatus, device, and storage medium for multi-user collaborative document editing, which has the following advantages compared with the prior art: The technical solution of this application enables unified management of access control and editing permissions for collaborative members by having the document permission holder initiate a document collaboration task that includes a set of invited collaborators. This designates the document permission holder as the initial owner of editing permissions. During the collaboration task, only the person with the editing permissions is allowed to perform document editing operations, eliminating the need for real-time concurrent editing by multiple users. This fundamentally avoids content conflicts, version inconsistencies, and data overwrite issues caused by simultaneous editing by multiple users, ensuring the smoothness of the editing process and the accuracy of the document content. Editing requests from other collaborators are processed using a queuing system, adding the requesting member to the editing queue to form a standardized sequential editing order and prevent disputes over editing permissions. Simultaneously, when the permission transfer conditions are met, editing permissions are automatically rotated to the first member of the editing queue and the queue is updated synchronously. This eliminates the need for manual permission handover, achieving automatic and orderly transfer of editing permissions and avoiding process blockages caused by permission stagnation or untimely handover. This significantly improves the overall management level and work efficiency of multi-user document collaboration in project scenarios. Attached Figure Description
[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0019] Figure 1 This is a flowchart illustrating one embodiment of a multi-user collaborative document editing method provided in this application; Figure 2 This is a schematic diagram of the structure of one embodiment of a multi-user collaborative document editing device provided in this application; Figure 3 This is a schematic diagram of the structure of a computer device provided in this application. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0021] The following disclosure provides numerous different embodiments or examples for implementing various structures of this application. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of this application. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.
[0022] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0023] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0024] It should also be further understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0025] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]." Example 1, see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of a multi-user collaborative document editing method provided in this application, as shown below. Figure 1As shown, the method includes steps 101-104, as detailed below: Step 101: When a collaboration start command initiated by a document permission holder is detected, a document collaboration task containing a set of invited collaboration members is constructed, and the document permission holder is set as the owner of the editing permissions.
[0026] In one embodiment, based on the current project's stage information and document status, it is verified whether the document permission holder meets the preset collaboration activation conditions.
[0027] Specifically, the project phase includes at least the project change negotiation phase and the project execution phase; wherein, the project change negotiation phase corresponds to the sub-phase of the project as the submission and preparation phase by Party B; the project execution phase corresponds to the sub-phases of the project as the document preparation phase, the submittable phase, the modification and resubmission phase, the review and rejection phase, and the document review phase.
[0028] Specifically, the document status includes at least the submittable status, the deliverable status, the document collaboration status, and the identifier of the person who owns the editing permissions.
[0029] Specifically, before starting document collaboration, the current project's stage information and document status are first obtained. Based on the stage information and document status, and combined with the role of the document permission holder who initiated the collaboration start command in the current project, it is determined whether the preset collaboration start conditions are met.
[0030] Specifically, when the current project is in the project change negotiation stage, several prerequisites must be met simultaneously. These prerequisites include: the document authority holder's role in the project is the contractor's responsible person, and the document authority holder is the document owner; the project corresponding to the project change negotiation stage is in the contractor's submission and preparation stage, and the document status is submitable; based on this, collaboration is only allowed to start in two compliant situations: one is that the document collaboration status is not enabled, and the other is that the document collaboration status is enabled and the editing permission belongs to the document authority holder. If any condition is not met, it is determined that the preset collaboration start conditions are not met, and the collaboration start process is terminated.
[0031] Specifically, when the current project is in the project in progress phase, the role type of the document owner is first distinguished, and then the phase information and document status are matched for verification; wherein, the role type includes the person in charge of the vendor, the client, and the project team member.
[0032] Specifically, if the document owner is the person in charge of Party B, the document permission holder is the person in charge of Party B and the document owner, the project is in the Party B's submission and preparation stage, the document status is submittable, and the document collaboration status is either not enabled or the document collaboration status is enabled and the editing permission belongs to the person in charge of the document. If any one of these conditions is not met, it is determined that the preset collaboration start conditions are not met, and the collaboration start process is terminated.
[0033] Specifically, if the document owner is a project team member, the project must be in any of the following stages: document preparation stage, submittable stage, modification and resubmission stage, review and rejection stage, or document review stage. The document status must be deliverable. This is then combined with the task document takeover rules for verification. For example, if task document takeover is enabled, the document permission holder must be the person in charge of the vendor; if takeover is not enabled, the document permission holder must be the corresponding project team member. If any condition is not met, the preset collaboration start conditions are not met, and the collaboration start process is terminated.
[0034] Specifically, if the document owner is Party A, then the document status will be verified to show that the editing permission belongs to Party A. Only if the document meets the conditions for enabling collaboration, otherwise, it will be determined that the preset conditions for enabling collaboration are not met, and the collaboration enabling process will be terminated.
[0035] In one embodiment, if the verification passes, the original project member set is obtained, the document authority holder and members in the original project member set who do not have document editing permissions are removed to obtain a candidate member set, and the members in the candidate member set specified by the document authority holder are determined as the invited collaboration member set.
[0036] Specifically, the project member table is called to query the data and obtain the original project member set corresponding to the current project; the original project member set is iterated through one by one, and a member elimination and filtering operation is performed according to preset rules, and the remaining members after filtering are used as a candidate member set. The preset rules include, but are not limited to, directly eliminating document permission holders in the set, eliminating members whose role is a project team member but who have not enabled project takeover permissions when the current project is in the project change stage or the project is in progress, and obtaining the document body editing permission identifier of each member by querying the project document permission table and eliminating members who do not have document body editing permissions.
[0037] Specifically, the process involves obtaining the invited members specified by the document authority, comparing them with members in the candidate member set, and terminating the collaboration process if none of the invited members specified by the document authority are in the candidate member set. If all the invited members specified by the document authority are in the candidate member set, other members not specified by the document authority are removed from the candidate member set, and only the invited members specified by the document authority are retained. The final retained members are then used as the set of invited collaboration members to initiate document collaboration.
[0038] In one embodiment, the document collaboration task is updated based on the set of invited collaborators, the status of the document collaboration task is set to the enabled state, the person who owns the editing permissions is set to the person who owns the document permissions, and the existing editing queue in the document collaboration task is cleared.
[0039] Specifically, after determining the set of invited collaborators, the data overwrite and update operation of the document collaboration editing invitation member table is first performed. Since repeated document collaborations are supported, historical document collaboration data must be cleared first, and the old set of invited collaborators in the document collaboration editing invitation member table must be deleted. Then, based on the current set of invited collaborators, a new set of invited members corresponding to this collaboration is created, and the user ID of the person with document permissions who initiated the collaboration and the member IDs of each invited project member are written into the document collaboration editing invitation member table to complete data persistence. At the same time, the old set of invited collaborators is traversed, and previously unprocessed to-do items are batch-hung based on the member IDs in the historical set of invited collaborators to avoid interference from historical to-do items and ensure that only a unique and valid business status is retained for each document collaboration.
[0040] Specifically, the document collaboration table is queried to obtain the document collaboration tasks for the current project. If it is detected that the document collaboration task has been started and there are project members in the editing queue, the created application document editing timer task is first canceled and deleted. The application document editing timer task is the corresponding editing timer set for the person who has the editing permission. The background scheduling of the editing queue is terminated, and the overall configuration of the document collaboration task is updated based on this.
[0041] Preferably, the length of the edit queue is 2, and when the length of the edit queue is 2, the first requesting edit user identifier and the second requesting edit user identifier are set in the edit queue.
[0042] Specifically, the document collaboration task is updated and configured as a whole, including: setting the collaboration status of the document collaboration task to the enabled state, setting the initial editing permission holder to the document permission holder who initiated the document collaboration; at the same time, clearing the original editing queue in the document collaboration task, adjusting the request editing status in the editing queue to disabled, and clearing the queuing identifier fields such as the first requesting editor user identifier and the second requesting editor user identifier in the editing queue, so as to achieve a complete reset of historical queuing data.
[0043] Specifically, after modifying and persisting the data in the document collaboration table, a new document collaboration task object is created, and the updated task attributes of the document collaboration task are written into the document collaboration task object. The attributes of the document party's conclusion are set to be uneditable, the set of member IDs of the invited project members is set, and the user ID of the person who initiated the invitation is set. The document collaboration task object is then returned to the client in real time so that the front end can refresh the current project member document permission data, thus completing the initialization and status synchronization of this document collaboration task.
[0044] In one embodiment, a collaboration activation notification is sent to members in the set of invited collaboration members.
[0045] Specifically, after completing the document collaboration task data update, persistence, and state initialization, the system obtains the confirmed set of invited collaboration members; it iterates through each project member in the set of invited collaboration members and pushes two types of collaboration start notifications to each member: one is to generate and send the corresponding to-do link, and the other is to push the collaboration start message notification in real time via WebSocket communication.
[0046] Specifically, invited collaborators can detect and respond to the document collaboration initiation event in two ways: members can actively click the to-do link to trigger a page request and refresh the relevant permissions and content data of the project document; or, after receiving a real-time WebSocket notification on the client side, the system will automatically refresh and load the project document data, enabling invited members to promptly know that document collaboration has started and to synchronously update their own document operation permissions and page display information, achieving instant delivery of collaboration initiation messages and real-time synchronization of front-end data.
[0047] Step 102: During the document collaboration task, only respond to the editing operation of the target document by the person who owns the editing permission.
[0048] In one embodiment, during the document collaboration task, a document editing request sent by a client is received, wherein the document editing request carries the user identifier of the current operator; based on the document collaboration task, the editing permission holder identifier of the current editing permission holder is obtained; if the user identifier matches the editing permission holder identifier, the document editing request is responded to, and the editing operation on the target document is performed.
[0049] Specifically, it receives document editing requests sent by the client in real time and obtains the user identifier of the current operator carried in the document editing request; based on the currently established document collaboration task, it reads and obtains the editing permission holder identifier corresponding to the current editing permission holder from the document collaboration table.
[0050] Specifically, if the identifier of the person holding the editing permission is not empty, the user identifier of the current operator carried in the document editing request is compared with the identifier of the person holding the editing permission. If the two are completely consistent, the current operator is determined to be a legitimate holder of the document editing permission, and the document editing request is responded to normally, allowing the execution of the editing operation on the target document. If the two are inconsistent, the current operator is determined not to have real-time editing permission for the target document, and the execution of the editing-related operation corresponding to the document editing request is refused, so as to ensure that only the person holding the editing permission can edit the target document at any given time, maintaining the collaborative order and data security.
[0051] Step 103: When any member in the set of invited collaborators initiates an edit request, if there is currently an owner of the edit permission, the member who initiated the edit request will be added to the edit queue.
[0052] In one embodiment, when an edit request is received, it is determined whether the current operator initiating the edit request is a member of the invited collaboration member set. If so, it is determined that an edit request initiated by a member of the invited collaboration member set has been detected. It is then determined whether there is an editor with editing permissions in the current document collaboration task. If there is an editor with editing permissions, and the current number of people in the editing queue is less than a preset queue length threshold, the member initiating the edit request is added to the editing queue. If the current number of people in the editing queue reaches the preset queue length threshold, the edit request of the member initiating the edit request is rejected, and a prompt indicating that the editing queue is full is returned.
[0053] Specifically, during the document collaboration task, when receiving an editing request from the client, the system first obtains the user ID of the current operator who initiated the editing request and determines whether the current operator belongs to the invited collaboration member set. If the current operator is a member of the invited collaboration member set, the system confirms that it has detected an editing request initiated by a member of the invited collaboration member set.
[0054] Specifically, if it is determined that the current operator does not belong to the set of invited collaborators, the document editing request will be rejected directly, and a message will be returned to the client indicating that the page information has been updated and to refresh the browser page.
[0055] Specifically, when any member in the invited collaboration member set initiates an editing request, based on the current document collaboration task, it is further determined whether there is a valid person with editing permissions. If there is a person with editing permissions, the current number of people in the editing queue is counted and compared with a preset queue length threshold. If the current number of people in the queue is less than the preset queue length threshold, the members who initiated the editing request are added to the editing queue in order, and the corresponding queue identification information is updated. If the current number of people in the queue has reached the preset queue length threshold, the editing request of the member who initiated the editing request is rejected, and a prompt message indicating that the editing queue is full is returned to the client, and no new queuing requests are accepted.
[0056] Specifically, when adding members who initiated edit requests to the edit queue in sequence, if there are no members in the edit queue, the member who initiated the edit request is set as the first member in the edit queue, and the first user ID of the user requesting edit in the edit queue is set as the member ID of the member who initiated the edit request; if there is a first member in the edit queue, the member who initiated the edit request is set as the second member in the edit queue, and the second user ID of the user requesting edit in the edit queue is set as the member ID of the member who initiated the edit request.
[0057] Preferably, if it is determined that there is no current owner of editing permissions, the member who initiated the editing request is directly set as the owner of editing permissions, and the identifier of the current owner of editing permissions is set as the member ID of the member who initiated the editing request.
[0058] Step 104: When the edit queue is not empty and the preset permission transfer conditions are met, change the owner of the editing permission to the first member in the edit queue and update the edit queue.
[0059] In one embodiment, when it is detected that the person who holds the editing rights initiates an exit editing command, or when it is detected that the editing timer corresponding to the person who holds the editing rights triggers a timeout event, it is determined that the current preset permission transfer conditions are met; it is then determined whether the editing queue is empty. If the editing queue is not empty, the person who holds the editing rights is changed to the first position in the editing queue.
[0060] Specifically, during the document collaboration task, two types of triggering events are continuously monitored to determine whether the preset permission transfer conditions are met: one is detecting an exit editing command initiated by the person holding the editing permissions, and the other is detecting a preset timeout event triggered by the editing timer corresponding to the person holding the editing permissions. When either of these events occurs, the system immediately determines that the preset permission transfer conditions have been met and enters the editing permission handover process.
[0061] Preferably, a preset timeout event is triggered for the editing timer corresponding to the person holding the editing permission: after any member in the invited collaboration member set initiates an editing request and enters the editing queue, the system will immediately start an editing timer with a configurable duration for the person currently holding the editing permission. When the editing timer expires, a timeout event will be triggered; preferably, the duration of the editing timer is 30 minutes.
[0062] Preferably, when the request queue is not empty, the system will display a configurable editing timer on the document's main page for the current user of the editing permissions. The page dynamically updates the remaining time of the editing timer's countdown via a front-end timer, displaying it intuitively in minutes and seconds. A title bar flashes as a reminder at each integer minute mark within the last 10 minutes of the countdown. When the countdown ends, it automatically stops and refreshes the document collaboration status, completing the automatic transfer of editing permissions.
[0063] Specifically, if the preset permission transfer conditions are met, the system reads and determines whether the current editing queue is empty; if the editing queue is not empty, the system performs an editing permission transfer operation, changes the current editing permission holder to the first member in the editing queue, and updates the queue status of the editing queue, thereby achieving automatic transfer and orderly rotation of editing permissions.
[0064] Specifically, when updating the queue status of the edit queue, the original number of people in the edit queue is first determined. If the number of people in the queue is 1, the original first member in the edit queue is set as the person who owns the editing permission, and then the member is removed from the edit queue. The value of the first user requesting editing in the edit queue is set to null, the editing request status is set to closed, and the editing timer configured for the person who owns the editing permission is deleted. If the number of people in the queue is greater than 1, the original first member in the edit queue is set as the person who owns the editing permission, and then the member is removed from the edit queue. The value of the first user requesting editing in the edit queue is set to the value corresponding to the second member in the edit queue, and the value of the second user requesting editing in the edit queue is set to null.
[0065] Specifically, after completing the change of editing permission holder and updating the queue status of the editing queue, if the updated editing queue is still not empty, the corresponding editing timer for the new editing permission holder will be reset and the timing will start again to achieve automatic rotation management of editing permissions and ensure the continuous and orderly execution of multi-user collaborative editing processes.
[0066] Specifically, after the editing queue is updated, the various attribute values modified in the document collaboration table during the editing permission rotation process are synchronously persisted to the database, ensuring reliable data preservation in the background. For example, a real-time return object is created based on the updated document collaboration task, encapsulating core attributes such as the person who holds the editing permission, the request editing status, the first requesting user, the second requesting user, and the member IDs of the invited collaboration members and the document permission holders into the created real-time return object, and pushing it to the client in real time for the front-end to synchronously refresh the document operation permissions and interface status of each project member.
[0067] In one embodiment, when any member in the editing queue initiates a cancel editing request, it is verified whether the current document collaboration task is in a cancelable editing state and whether the member initiating the cancel editing request exists in the editing queue. If the verification passes, the member initiating the cancel editing request is removed from the editing queue. If the removed member is the first member in the editing queue, and a second member exists in the editing queue after removal, the second member is updated to the first member. If the removed member is the first member in the editing queue, and a second member does not exist in the editing queue after removal, the editing queue is cleared. If the removed member is not the first member in the editing queue, the position identifier of the removed member in the editing queue is set to null.
[0068] Specifically, determine whether the document collaboration editing status in the current document collaboration task is open, and whether the request editing status is open. If the document collaboration editing status is open, and the request editing status is open, then determine that the current document collaboration task is in a state where editing can be cancelled.
[0069] Specifically, during the document collaboration task, when the system detects that any member in the editing queue has initiated a cancellation request, it first verifies the legitimacy of the current cancellation operation: on the one hand, it verifies whether the current document collaboration task is in a state where editing can be cancelled; on the other hand, it verifies whether the member initiating the cancellation request actually exists in the current editing queue, that is, whether they are the first or second requesting user. If both of the above verifications are satisfied, the verification passes and the cancellation operation is allowed; if either condition is not satisfied, the cancellation request is rejected and a prompt message is returned to the client.
[0070] Specifically, if the verification is successful, the update operation of the edit queue is executed, the member who initiated the cancellation of the edit request is removed from the edit queue, and different queue adjustment logic is executed according to the position of the removed member in the edit queue.
[0071] Specifically, the queue adjustment logic is as follows: If the removed member is the first member of the edit queue, and a second member still exists in the queue adjustment logic after removal, then the second member is updated to the new first member, maintaining the queuing order. That is, the value of the second requesting user in the edit queue is set to the value of the first requesting user, and the value of the second requesting user is set to empty. If the removed member is the first member of the edit queue, and no second member exists in the queue after removal, then the entire edit queue is cleared directly, and the corresponding request for editing status is set to closed. Since the edit queue is empty, the editing timer set for the person with editing permissions is also closed. If the removed member is not the first member of the edit queue, then only the position identifier corresponding to that member in the edit queue is set to empty, that is, the value of the second requesting user in the edit queue is set to empty, maintaining the queuing order of other members in the queue, and completing the queue maintenance after canceling the edit request.
[0072] Specifically, after the queue change is completed, the system persists the updated attribute values to the document collaboration table and encapsulates an object containing the latest permissions and queue information, returning it to the client in real time for front-end permission and interface status updates. If members still exist in the edit queue after the change, the page of the current editor with the permissions will continue to display a configurable edit timer countdown, and will perform time refresh and end-of-count reminders according to the rules. After the countdown ends, the document collaboration status will be automatically refreshed.
[0073] In one embodiment, when a user with the current editing permission initiates an exit editing command, the current user with the editing permission is cleared. If an editing timer associated with the current user with the editing permission exists, the editing timer is stopped, and it is determined whether the editing queue is not empty. If the editing queue is not empty and there is a second member, the first member in the editing queue is set as the user with the editing permission, the second member in the editing queue is set as the new first member, and the editing timer associated with the new user with the editing permission is started. If the editing queue is not empty but there is no second member, the first member in the editing queue is set as the user with the editing permission, and then the editing queue is cleared. A collaboration status update notification is sent to the members in the invited collaboration member set.
[0074] Specifically, when the system detects that the current user initiates an exit editing command, it first checks whether the current user is the current owner of the editing permissions by querying the document collaboration table. If the current user is the current owner of the editing permissions, the exit editing command is allowed; if the current user is not the current owner of the editing permissions, the system returns a message to the client saying "Page information has been updated, please refresh the browser page" and refuses to execute the exit editing command.
[0075] Specifically, once it is confirmed that the current user is the owner of the editing permissions, the current owner of the editing permissions is set to empty to revoke the current user's document editing permissions and stop the editing timer associated with that owner.
[0076] Specifically, the system reads and determines whether the current editing queue is not empty. If the editing queue is not empty and has a second member, the first member in the editing queue is set as the new owner of editing permissions, the second member is updated to the new first member, and the position identifier of the original second member is cleared. That is, the value of the first user requesting editing in the editing queue is set to the value of the second user requesting editing, and the value of the second user requesting editing is set to null. Since the editing queue is still not empty at this time, the associated editing timer is started for the new owner of editing permissions. If the editing queue is not empty but has no second member, the first member in the editing queue is first set as the new owner of editing permissions, then the entire editing queue is cleared and the request editing state is closed. That is, the value of the first user requesting editing in the editing queue is set to null.
[0077] Specifically, after completing the change of editing permission holder and the adjustment of the editing queue, the system persists the updated document collaboration task data to the database and sends a collaboration status update notification to all members in the invited collaboration member set, so that each client can synchronously refresh the document permissions and interface display status.
[0078] In one embodiment, when a collaboration closure command initiated by any user is detected, it is verified whether the user who initiated the collaboration closure command is the document permission holder; if so, the status of the document collaboration task is set to closed, the editing permission holder is cleared, the editing queue is cleared, and the set of invited collaboration members is cleared; otherwise, the collaboration closure command is refused to be executed.
[0079] Specifically, when any user initiates a collaboration closure command, the system first queries the document collaboration table to verify the user's permissions, determining whether the user initiating the collaboration closure command is the document's authorized user. If the user is not the authorized user, the system refuses to execute the collaboration closure command and returns the corresponding prompt message to the client: "You can adjust collaborators or end the current document collaboration while editing." Only users who are the document's authorized users are allowed to close document collaboration.
[0080] Specifically, once it is confirmed that the user who initiated the close command is the document permission holder, the status of the document collaboration task is set to closed, the current editing permission holder is cleared, and the editing queue is cleared. That is, the values of the first and second requesting editing users in the editing queue are set to empty, and the request editing status is closed. The system will also delete the relevant data in the document collaboration editing invitation member table, clear the invited collaboration member set, and hide the unprocessed to-do items of each member in the invited collaboration member set according to the member IDs in the invited collaboration member set. If there is an editing timer running for the current editing permission holder, it will also be deleted.
[0081] Specifically, after completing the above status cleanup and data clearing, the system persists the updated document collaboration task information to the database, creates an object containing the latest task attributes, and writes attributes such as whether the document's conclusion can be edited, the set of member IDs in the invited collaboration member set, and the member ID of the document permission holder into the object. The system then returns the object to the client to synchronously refresh the document permissions and interface status of each project member. At the same time, it sends a document collaboration closed status update notification to all relevant members according to preset rules.
[0082] Example 2, see Figure 2 , Figure 2 This is a schematic diagram of an embodiment of a multi-user collaborative document editing device provided in this application. Corresponding to the above-described multi-user collaborative document editing method, this application also provides a multi-user collaborative document editing device. This multi-user collaborative document editing device includes modules for executing the above-described multi-user collaborative document editing method, and can be configured in a desktop computer, tablet computer, laptop computer, or other terminal. Specifically, the multi-user collaborative document editing device includes a document collaboration task construction module 201, an editing operation response module 202, an editing queue entry module 203, and an editing permission owner change module 204.
[0083] The document collaboration task construction module 201 is used to construct a document collaboration task containing a set of invited collaboration members when a collaboration start instruction initiated by a document permission holder is detected, and to set the document permission holder as the owner of the editing permissions.
[0084] The editing operation response module 202 is used to respond only to the editing operation of the target document by the person who owns the editing permission during the document collaboration task.
[0085] The editing queue entry module 203 is used to add the member who initiated the editing request to the editing queue if there is an existing person who owns the editing permission when any member in the set of invited collaborators initiates an editing request.
[0086] The editing permission holder change module 204 is used to change the editing permission holder to the first member in the editing queue and update the editing queue when the editing queue is not empty and the preset permission transfer conditions are met.
[0087] In one embodiment, the document collaboration task construction module 201 is used to construct a document collaboration task containing a set of invited collaboration members when a collaboration start instruction initiated by a document permission holder is detected, and to set the document permission holder as the editing permission owner. Specifically, this includes: verifying whether the document permission holder meets the preset collaboration start conditions based on the current project stage information and document status; if the verification is successful, obtaining the original project member set, removing the document permission holder and members in the original project member set who do not have document editing permissions to obtain a candidate member set, and determining the members specified by the document permission holder in the candidate member set as the invited collaboration member set; updating the document collaboration task based on the invited collaboration member set, setting the status of the document collaboration task to the start state, setting the editing permission owner as the document permission holder, and clearing the existing editing queue in the document collaboration task; and sending a collaboration start notification to the members in the invited collaboration member set.
[0088] In one embodiment, the editing operation response module 202 is configured to respond only to editing operations on the target document by the person holding the editing permissions during the document collaboration task. Specifically, this includes: receiving a document editing request sent by a client during the document collaboration task, wherein the document editing request carries a user identifier of the current operator; obtaining the editing permission holder identifier of the current person holding the editing permissions based on the document collaboration task; and responding to the document editing request and performing an editing operation on the target document if the user identifier matches the editing permission holder identifier.
[0089] In one embodiment, the editing queue entry module 203 is used to add the member initiating the editing request to the editing queue when any member in the invited collaboration member set initiates an editing request, if there is currently an editor with editing permissions. Specifically, it includes: when receiving an editing request, determining whether the current operator initiating the editing request is a member in the invited collaboration member set; if so, determining that an editing request initiated by a member in the invited collaboration member set has been detected; determining whether there is an editor with editing permissions in the current document collaboration task; if there is an editor with editing permissions, and the current number of people in the editing queue is less than a preset queue length threshold, then adding the member initiating the editing request to the editing queue; if the current number of people in the editing queue reaches the preset queue length threshold, then rejecting the editing request of the member initiating the editing request and returning a prompt that the editing queue is full.
[0090] In one embodiment, the editing permission holder change module 204 is used to change the editing permission holder to the first member of the editing queue when the editing queue is not empty and a preset permission transfer condition is met. Specifically, it includes: when it is detected that the editing permission holder initiates an exit editing command, or when it is detected that the editing timer corresponding to the editing permission holder triggers a timeout event, determining that the preset permission transfer condition is met; determining whether the editing queue is empty; if the editing queue is not empty, then changing the editing permission holder to the first member of the editing queue.
[0091] In one embodiment, the multi-user collaborative document editing device provided in this application further includes an editing request cancellation module.
[0092] In one embodiment, the edit request cancellation module is used to verify whether the current document collaboration task is in a cancelable editing state and whether the member initiating the edit cancellation request exists in the edit queue when any member in the edit queue initiates a cancel edit request; if the verification is successful, the member initiating the cancel edit request is removed from the edit queue; if the removed member is the first member in the edit queue and a second member exists in the edit queue after removal, the second member is updated to the first member; if the removed member is the first member in the edit queue and no second member exists in the edit queue after removal, the edit queue is cleared; if the removed member is not the first member in the edit queue, the position identifier of the removed member in the edit queue is set to null.
[0093] In one embodiment, the multi-user collaborative document editing device provided in this application further includes a collaboration shutdown module.
[0094] In one embodiment, the collaboration closure module is used to verify whether the user who initiated the collaboration closure instruction is the document permission holder when a collaboration closure instruction initiated by any user is detected; if so, the status of the document collaboration task is set to closed, the editing permission holder is cleared, the editing queue is cleared, and the set of invited collaboration members is cleared; otherwise, the collaboration closure instruction is refused to be executed.
[0095] The multi-user collaborative document editing device described above can implement the multi-user collaborative document editing method of the above method embodiments. The options in the above method embodiments are also applicable to this embodiment, and will not be detailed here.
[0096] like Figure 3 As shown, Figure 3 This is a schematic diagram of the structure of a computer device provided in this application; it includes a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112 and the memory 113 communicate with each other through the communication bus 114, and the memory 113 is used to store computer programs.
[0097] In one embodiment of this application, the processor 111, when executing the program stored in the memory 113, implements the multi-user collaborative document editing method provided in any of the foregoing method embodiments.
[0098] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program may be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.
[0099] Therefore, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the multi-user collaborative document editing method provided in any of the foregoing method embodiments.
[0100] The storage medium is a physical, non-transient storage medium, such as a USB flash drive, external hard drive, read-only memory (ROM), magnetic disk, or optical disk, or any other physical storage medium capable of storing program code. The computer-readable storage medium can be non-volatile or volatile.
[0101] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.
[0102] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0103] The steps in the methods of this application embodiment can be adjusted, merged, or deleted according to actual needs. The units in the apparatus of this application embodiment can be merged, divided, or deleted according to actual needs. Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0104] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0105] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0106] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Since these modifications and variations fall within the scope of the claims and their equivalents, this application also intends to include these modifications and variations.
[0107] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A multi-user collaborative document editing method, characterized in that, include: When a collaboration start instruction initiated by a document permission holder is detected, a document collaboration task containing a set of invited collaboration members is constructed, and the document permission holder is set as the owner of the editing permissions; During the document collaboration task, only the editing operation of the target document by the person who owns the editing permission will be responded to; When it is detected that any member in the set of invited collaborators initiates an edit request, if there is currently an owner of the edit permission, the member who initiated the edit request will be added to the edit queue. When the edit queue is not empty and the preset permission transfer conditions are met, the person who owns the editing permission is changed to the first member in the edit queue, and the edit queue is updated.
2. The method according to claim 1, characterized in that, When a collaboration initiation command initiated by a document permission holder is detected, a document collaboration task containing a set of invited collaboration members is constructed, and the document permission holder is set as the owner of the editing permissions. Specifically, this includes: Based on the current project stage information and document status, verify whether the document permission holder meets the preset collaboration activation conditions; If the verification is successful, the original project member set is obtained, and the document permission holder and members in the original project member set who do not have document editing permissions are removed to obtain a candidate member set. The members in the candidate member set specified by the document permission holder are determined as the invited collaboration member set. The document collaboration task is updated based on the set of invited collaborators, and the status of the document collaboration task is set to the open state. The person who owns the editing permission is set to the person who owns the document permission, and the existing editing queue in the document collaboration task is cleared. Send a collaboration activation notification to members in the invited collaboration member set.
3. The method according to claim 2, characterized in that, The provision that during the document collaboration task is initiated, only the editing permission holder's editing operation on the target document is responded to, specifically including: During the document collaboration task, a document editing request sent by the client is received, wherein the document editing request carries the user identifier of the current operator; Based on the document collaboration task, obtain the identifier of the person who currently holds the editing permissions; If the user identifier matches the identifier of the person who holds the editing permission, then the document editing request is responded to, and the editing operation on the target document is performed.
4. The method according to claim 3, characterized in that, When it is detected that any member in the invited collaboration member set initiates an edit request, if there is currently an owner of the edit permission, the member who initiated the edit request is added to the edit queue, specifically including: When an edit request is received, it is determined whether the current operator who initiated the edit request is a member of the invited collaboration member set. If so, it is determined that an edit request initiated by a member of the invited collaboration member set has been detected. Determine if the current document collaboration task has an owner with editing permissions; If there is an owner of the editing permission, and the current number of people in the editing queue is less than a preset queue length threshold, then the member who initiated the editing request will be added to the editing queue. If the number of people currently queuing in the edit queue reaches the preset queue length threshold, the edit request of the member who initiated the edit request will be rejected, and a message indicating that the edit queue is full will be returned.
5. The method according to claim 1, characterized in that, When the editing queue is not empty and the preset permission transfer conditions are met, the person who owns the editing permission is changed to the first member of the editing queue, specifically including: When it is detected that the person who holds the editing rights initiates an exit editing command, or when it is detected that the editing timer corresponding to the person who holds the editing rights triggers a timeout event, it is determined that the preset permission transfer conditions are met. Determine whether the editing queue is empty. If the editing queue is not empty, change the owner of the editing permission to the first member in the editing queue.
6. The method according to claim 1, characterized in that, Also includes: When it is detected that any member in the editing queue initiates a cancel editing request, verify whether the current document collaboration task is in a state where editing can be canceled, and whether the member who initiated the cancel editing request exists in the editing queue; If the verification passes, the member who initiated the cancellation edit request will be removed from the edit queue. If the removed member is the first member in the edit queue, and there is a second member in the edit queue after the removal, then the second member is updated to the first member; If the member to be removed is the first member in the edit queue, and there is no second member in the edit queue after removal, then the edit queue is cleared. If the removed member is not the first member in the edit queue, then the position identifier of the removed member in the edit queue is set to null.
7. The method according to claim 1, characterized in that, Also includes: When a collaboration closure command initiated by any user is detected, verify whether the user who initiated the collaboration closure command is the person with the document permissions. If so, set the status of the document collaboration task to closed, clear the owner of the editing permissions, clear the editing queue, and remove the set of invited collaboration members; otherwise, refuse to execute the collaboration closure command.
8. A multi-user collaborative document editing device, characterized in that, include: The document collaboration task building module, the editing operation response module, the editing queue entry module, and the editing permission owner change module are all included. The document collaboration task construction module is used to construct a document collaboration task containing a set of invited collaboration members when a collaboration start instruction initiated by a document permission holder is detected, and to set the document permission holder as the owner of the editing permissions. The editing operation response module is used to respond only to the editing operation of the person who owns the editing permission on the target document during the document collaboration task. The edit queue entry module is used to add the member who initiated the edit request to the edit queue if there is an existing person who owns the editing permission when any member in the invited collaboration member set initiates an edit request. The editing permission holder change module is used to change the editing permission holder to the first member of the editing queue and update the editing queue when the editing queue is not empty and the preset permission transfer conditions are met.
9. A computer device, characterized in that, The computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, can implement the method as described in any one of claims 1-7.