[0058] In order to enable those skilled in the art to better understand the solutions of the embodiments of the present invention, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings and implementation manners.
[0059] Such as figure 1 Shown is a schematic structural diagram of a workflow system according to an embodiment of the present invention.
[0060] In this embodiment, the system includes:
[0061] The interface unit 101 is configured to obtain a mapping relationship between participants and tasks, where the mapping relationship includes: a group, a step, a work pool, and a participant, and the group is an independent decision-making unit;
[0062] The task allocation unit 102 is configured to allocate tasks to each participant according to the mapping relationship;
[0063] The task execution unit 103 is configured to execute the task;
[0064] The judging unit 104 is configured to determine whether the next task needs to be created according to the mapping relationship after the task execution unit completes the current task; if so, notify the task allocation unit; otherwise, notify the group status setting unit;
[0065] The group status setting unit 105 is configured to set the status of the group to which the current task belongs to the completed status according to the notification from the judgment unit 104. .
[0066] Such as figure 2 What is shown is a schematic diagram of the mapping relationship between participants and tasks in an embodiment of the present invention.
[0067] The mapping relationship includes: group, step, work pool, participant, among them:
[0068] The group is an independent decision-making unit. As long as the tasks included in each group are completed, this business link is completed.
[0069] The group contains at least one step, and whether a group is completed depends on whether the steps in the group are completed in sequence.
[0070] The step contains at least one work pool. The work pools are parallel. When all the work pools in the step are completed, the step is completed.
[0071] A work pool corresponds to a task. The work pool first contains at least one participant. The participant can be a person or a role. All participants in the work pool can handle the task corresponding to the work pool, and one person completes the processing and submits the task. That is complete, the work pool is complete.
[0072] The work pool may also contain multiple steps. When the steps in the work pool are completed in sequence, the tasks corresponding to the work pool can be processed.
[0073] It should be noted that if there is only one step in a group, there can only be one work pool in that step.
[0074] In practical applications, the mapping relationship between participants and tasks can be established according to actual business needs. The workflow system obtains the mapping relationship through the interface unit 101.
[0075] A preferred structure of the interface unit 101 includes the following parts:
[0076] The group obtaining subunit is used to obtain each group in the mapping relationship respectively;
[0077] The step acquisition subunit is used to acquire the steps in each group;
[0078] The work pool obtaining subunit is used to obtain the work pool included in the step;
[0079] The participant acquisition subunit is used to acquire participants in each work pool.
[0080] The workflow system can store the above-mentioned parts of data in different areas, of course, they can also be stored in the same area.
[0081] In specific applications, the above-mentioned sub-units can obtain corresponding information by providing different interface methods. such as:
[0082] The group acquisition subunit provides an interface method createGroup, receives and inputs a number such as 3, then creates 3 group objects for the business link, and stores the object information in the corresponding data source;
[0083] The step acquisition subunit provides the interface method createGroupStep, receives the input group ID and a number such as 3, creates 3 step objects for the group, and stores the object information in the corresponding data source;
[0084] The work pool acquisition subunit provides the interface method createSwimlane, receives the input step ID and a number such as 2, creates two work pool objects for this step, and stores the object information in the corresponding data source; and provides the interface method createSwimlaneStep , Receive the input work pool ID and a number such as 1, create 1 step for the work pool.
[0085] The participant acquisition sub-unit provides the interface method assignTask, receives the input work pool ID and personnel ID such as Zhang San, designates Zhang San as a participant in the work pool, and stores this information in the corresponding data source.
[0086] In this way, the task allocating unit 102 can generate corresponding tasks for the work pool based on the information obtained by the above-mentioned interface methods, and allocate the tasks to participants in the work pool.
[0087] Specifically, you can first find the group information associated with it from the data source through the business ID, and then find the information of the first step associated with it from the data source through the ID of these groups, and then retrieve the data from the data through the ID of these steps. Find the work pool information associated with it in the source, and finally create tasks corresponding to each work pool and persist the task information, so that the corresponding relationship between the work pool and its participants can be established, that is, the task assignment is completed.
[0088] In the embodiment of the present invention, the task execution unit 103 may be further configured to set the state of the work pool corresponding to the current task to the completed state after the current task is completed.
[0089] Such as image 3 What is shown is a preferred structure of the judgment unit in the workflow system in the embodiment of the present invention, including:
[0090] The associated work pool search subunit 301 is configured to search for other work pools in the step to which the work pool corresponding to the task belongs after the task execution unit 103 finishes executing the current task;
[0091] The first check subunit 302 is used to check whether the other work pools are in the completed state, and if not, continue to check whether the other work pools are in the completed state after the task execution unit 103 finishes executing the current task;
[0092] The second check subunit 303 is used to check whether the step of the work pool corresponding to the task belongs to the last step in the group to which the task belongs after the first check subunit 133 checks that the other work pools are in the completed state A step; if not, notify the task allocation unit to generate a corresponding task for the next step of the work pool in the group to which it belongs, and if so, notify the group status setting unit so that the group status setting unit will The state of the group to which the current task belongs is set to a completed state.
[0093] In another embodiment of the system of the present invention, the system may further include: a group status checking unit and a service notification unit. among them:
[0094] The group status checking unit is configured to check whether the other groups are all in the completed state after the group status setting subunit 135 sets the status of the group to which it belongs to the completed state;
[0095] The service notification unit is configured to send a service completion notification after the group status checking unit detects that the other groups are in the completed state.
[0096] The workflow system of the embodiment of the present invention can close the internal structural logic of the engine and support dynamic assignment and completion of tasks. By acquiring the mapping relationship between participants and tasks, and using this mapping relationship, operations such as task assignment and completion can be compared with various problems. The determined business rules are isolated to ensure the stability of the process engine's assignment and completion of the task logic, thereby ensuring the stability of the process engine core, and improving the reusability and scalability of the process engine.
[0097] In order to meet the requirement that the workflow system of the embodiment of the present invention can dynamically allocate tasks and complete tasks according to business rules during the process runtime, it is not necessary to modify the code of the process engine core during secondary development, and only need to call the interface provided by the system to establish participants and The task mapping relationship greatly reduces the difficulty and cost of secondary development.
[0098] The following uses examples to further illustrate the process of using the workflow system of the embodiment of the present invention to perform secondary development applications.
[0099] For example, in a business link, eight persons A, B, C, D, E, F, G, and H are required to process in sequence, and A, B, C, and D are required to process in sequence (B and C will start to process after A is processed. After B and C are processed, D starts to handle it), C and E communicate and handle (C creates a task for E, and decides how to handle its own task according to the result of E), F and G to handle it together (F and G can handle both This task, but only one of them can handle it), H handles it alone.
[0100] In view of this business rule, when the workflow system of the embodiment of the present invention is adopted, the secondary development only needs to establish the mapping relationship between tasks and participants according to actual business requirements, as follows:
[0101] Divide the tasks into three groups:
[0102] 1. The first component has three steps, of which:
[0103] In the first step, there is a work pool, and the participant of the work pool is A;
[0104] In the second step, there are two work pools: the participant of the first work pool is B; the participant of the second work pool is C, and the second work pool contains a step, which includes a work pool, a work pool The participant is E;
[0105] In the third step, there is a work pool, and the participant of the work pool is D.
[0106] 2. The second component is a step, in which there is a work pool, and the participants in the work pool are F and G;
[0107] 3. The third component is a step in which there is a work pool, and the participant in the work pool is H.
[0108] When the secondary development establishes the mapping relationship between tasks and participants, there is no need to write or modify the engine code, just call the interface method provided by the workflow system. An example of the process of calling the interface method is as follows:
[0109] Call createGroup, enter 3, and create three groups: Group1, Group2, and Group3.
[0110] Call createGroupStep, enter Group1 and 3, and create 3 steps for Group1 as Step01, Step02, Step03;
[0111] Call createSwimlane, enter Step01 and 1, create a work pool Swimlane001 for Step01, then call assginTask, enter Swimlane001 and A. Designated participant;
[0112] Call createSwimlane, enter Step02 and 2, create two work pools Swimlane011 and Swimlane012. Then call assignTask, enter Swimlane012 and C; call createSwimlaneStep, enter Swimlane012 and 1, to create a step for the work pool Swimlane012.
[0113] It can be seen that, in practical applications, the workflow system of the embodiment of the present invention can support the needs of dynamically assigning tasks and completing tasks through secondary development. There is no need to modify the core code of the engine and logical relationships, and only the interface provided by the workflow system can be called. , Thereby improving the reusability and scalability of the process engine, reducing the difficulty and cost of secondary development.
[0114] Based on the above workflow system, the embodiment of the present invention also provides a method for the workflow system to implement tasks during the process running period.
[0115] Such as Figure 4 Shown is a flow chart of the method, including the following steps:
[0116] Step 401: Obtain a mapping relationship between participants and tasks. The mapping relationship includes a group, a step, a work pool, and a participant, and the group is an independent decision-making unit.
[0117] Each group contains at least one step, and each step contains at least one work pool. When a group has only one step, only one work pool is allowed in the step; tasks corresponding to different work pools are processed in parallel.
[0118] Specifically, each group in the mapping relationship, the steps in each group, and the work pool included in the steps can be obtained separately. For example, various interface methods provided by the workflow system can be used to obtain the above-mentioned information and its association relationship, and to store the obtained information in the corresponding database.
[0119] Step 402: Assign tasks to participants according to the mapping relationship.
[0120] That is to say, a corresponding task is generated for the work pool, and the task is allocated to the participants in the work pool.
[0121] Step 403, execute the task.
[0122] Step 404: After the current task is completed, determine whether the next task needs to be created according to the mapping relationship; if so, return to step 402 to create the next task according to the mapping relationship; otherwise, go to step 405;
[0123] Step 405: Set the status of the group to which the current task belongs to a completed status.
[0124] In the above process, it can further include the following steps: After all the steps in each group are completed, set the status of the group to the completed status, and check whether the other groups are in the completed status; if so, send the service to complete Notify; otherwise, wait for other groups to enter the completion state.
[0125] After the above step 403, the method further includes the following step: after the task is completed, the state of the work pool corresponding to the task is set to a completed state.
[0126] In this way, in step 404, determining whether to create the next task according to the mapping relationship can be performed according to the following steps:
[0127] First, search for other work pools in the step to which the work pool corresponding to the task belongs. Specifically, the work pool ID can be used to find the step ID to which the work pool belongs, and other work pools contained in the step can be found through the step ID. Work pool information.
[0128] Check whether the other work pools are in the completed state;
[0129] If not, continue to check whether the other work pools are in the completed state after the next task is completed;
[0130] If yes, check whether the step to which the work pool corresponding to the current task belongs is the last step in the group to which it belongs, and if not, determine whether the next task needs to be created.
[0131] The creation of the next task according to the mapping relationship specifically includes: generating a corresponding task for the work pool included in the next step in the group to which the current task belongs. Specifically, the step ID to which it belongs can be obtained through the current work pool ID, and then the work pool information contained in the next step can be further searched through the step ID.
[0132] It can be seen that the method for realizing tasks during the process operation period of the embodiment of the present invention can close the internal structural logic of the engine and support dynamic task assignment and task completion. By obtaining the mapping relationship between participants and tasks, and using this mapping relationship to assign tasks, The completion and other operations are isolated from various uncertain business rules, thereby ensuring the stability of the process engine's assignment of tasks and completing the task logic, thereby ensuring the stability of the process engine core, and improving the reusability and scalability of the process engine.
[0133] In order to meet the requirement of dynamically assigning tasks and completing tasks according to business rules during the process running period, the embodiment of the present invention does not need to modify the code of the process engine kernel during secondary development, and only needs to call the system provided The interface establishes the mapping relationship between participants and tasks, which greatly reduces the difficulty and cost of secondary development.
[0134] A person of ordinary skill in the art can understand that all or part of the steps in the method of the foregoing embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer readable storage medium. Media, such as: ROM/RAM, floppy disk, optical disk, etc.
[0135] The embodiments of the present invention are described in detail above, and specific implementations are used to illustrate the present invention. The descriptions of the above embodiments are only used to help understand the method and equipment of the present invention; at the same time, for those of ordinary skill in the art, According to the idea of the present invention, there will be changes in the specific implementation and the scope of application. In summary, the content of this specification should not be construed as limiting the present invention.