mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 09:11:52 +08:00
会签-初步搞定
This commit is contained in:
parent
222732f7e0
commit
5c03221967
@ -76,13 +76,21 @@ public class BpmUserTaskActivityBehavior extends UserTaskActivityBehavior {
|
||||
@Override
|
||||
@DataPermission(enable = false) // 不需要处理数据权限, 不然会有问题,查询不到数据
|
||||
protected void handleAssignments(TaskService taskService, String assignee, String owner, List<String> candidateUsers, List<String> candidateGroups, TaskEntity task, ExpressionManager expressionManager, DelegateExecution execution, ProcessEngineConfigurationImpl processEngineConfiguration) {
|
||||
// 第一步,获得任务的规则
|
||||
BpmTaskAssignRuleDO rule = getTaskRule(task);
|
||||
// 第二步,获得任务的候选用户们
|
||||
Set<Long> candidateUserIds = calculateTaskCandidateUsers(task, rule);
|
||||
// 第三步,设置一个作为负责人
|
||||
Long assigneeUserId = chooseTaskAssignee(candidateUserIds);
|
||||
TaskHelper.changeTaskAssignee(task, String.valueOf(assigneeUserId));
|
||||
boolean isMultiInstance = hasMultiInstanceCharacteristics();
|
||||
if(isMultiInstance){
|
||||
//多实例 会签/或签,执行多次每个人 待办人都在execution里面获取
|
||||
Integer assigneeUserId = execution.getVariableLocal("user", Integer.class);
|
||||
TaskHelper.changeTaskAssignee(task, String.valueOf(assigneeUserId));
|
||||
}else {
|
||||
// 第一步,获得任务的规则
|
||||
BpmTaskAssignRuleDO rule = getTaskRule(task);
|
||||
// 第二步,获得任务的候选用户们
|
||||
Set<Long> candidateUserIds = calculateTaskCandidateUsers(task, rule);
|
||||
// 第三步,设置一个作为负责人
|
||||
Long assigneeUserId = chooseTaskAssignee(candidateUserIds);
|
||||
TaskHelper.changeTaskAssignee(task, String.valueOf(assigneeUserId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private BpmTaskAssignRuleDO getTaskRule(TaskEntity task) {
|
||||
|
@ -292,8 +292,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
||||
runtimeService.setProcessInstanceName(instance.getId(), definition.getName());
|
||||
|
||||
// 补全流程实例的拓展表
|
||||
processInstanceExtMapper.updateByProcessInstanceId(new BpmProcessInstanceExtDO().setProcessInstanceId(instance.getId())
|
||||
.setFormVariables(variables));
|
||||
//TODO startProcessInstance流程里面修改了 BpmProcessInstanceExt,没有提交,和下面的更新 锁持有冲突了,异步更新这个表
|
||||
// processInstanceExtMapper.updateByProcessInstanceId(new BpmProcessInstanceExtDO().setProcessInstanceId(instance.getId()).setFormVariables(variables));
|
||||
|
||||
return instance.getId();
|
||||
}
|
||||
|
@ -20,6 +20,9 @@ import static org.junit.Assert.assertNotNull;
|
||||
* @author henryyan
|
||||
* testMultiInstanceForUserTask 会签
|
||||
* cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior.BpmUserTaskActivityBehavior#handleAssignments(org.flowable.task.service.TaskService, java.lang.String, java.lang.String, java.util.List, java.util.List, org.flowable.task.service.impl.persistence.entity.TaskEntity, org.flowable.common.engine.impl.el.ExpressionManager, org.flowable.engine.delegate.DelegateExecution, org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl)
|
||||
*
|
||||
* 发生了死锁
|
||||
* cn.iocoder.yudao.module.bpm.controller.admin.task.BpmProcessInstanceController#createProcessInstance(cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCreateReqVO)
|
||||
* 执行了两次,任务分配到了同一个人
|
||||
*/
|
||||
public class MultiInstancesTest extends AbstractOATest {
|
||||
|
Loading…
Reference in New Issue
Block a user