update - 测试用户任务节点,多实例和单实例两种情况,切能正常运行.不过如果是单实例业务返回了多个审核人,则选第一人作为该任务审核人
This commit is contained in:
parent
70753de459
commit
b58b3b2914
@ -17,19 +17,20 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 在这里设置审批人
|
||||
* */
|
||||
*/
|
||||
@Component
|
||||
public class EngineExecutionStartListener implements ExecutionListener {
|
||||
@Resource
|
||||
private RepositoryService repositoryService;
|
||||
@Resource
|
||||
private BpmTaskDelegate bpmTaskDelegate;
|
||||
|
||||
@Override
|
||||
public void notify(DelegateExecution execution) {
|
||||
String currentActivityId = execution.getCurrentActivityId();
|
||||
String variable=currentActivityId+"assigneeList";
|
||||
String variable = currentActivityId + "assigneeList";
|
||||
List usersValue = (List) execution.getVariable(variable);
|
||||
if(usersValue==null){
|
||||
if (usersValue == null) {
|
||||
Process mainProcess = repositoryService.getBpmnModel(execution.getProcessDefinitionId()).getMainProcess();
|
||||
UserTask userTask = (UserTask) mainProcess.getFlowElement(currentActivityId);
|
||||
|
||||
@ -48,8 +49,14 @@ public class EngineExecutionStartListener implements ExecutionListener {
|
||||
for (BpmTaskDelegateAssigner user : assigners) {
|
||||
assigneeIdList.add(user.getAssignerId());
|
||||
}
|
||||
|
||||
if (userTask.hasMultiInstanceLoopCharacteristics()) {
|
||||
execution.setVariable(variable, assigneeIdList);
|
||||
} else {
|
||||
userTask.setAssignee("${assigneeUserId}");
|
||||
execution.setVariable("assigneeUserId", assigneeIdList.get(0));
|
||||
}
|
||||
}
|
||||
execution.setVariable(variable, assigneeIdList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package cn.axzo.server.controller.listener;
|
||||
|
||||
import cn.axzo.workflow.core.listener.BpmProcessEventListener;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent;
|
||||
import org.flowable.engine.delegate.event.FlowableCancelledEvent;
|
||||
import org.flowable.engine.delegate.event.FlowableProcessStartedEvent;
|
||||
@ -14,25 +16,26 @@ import org.springframework.stereotype.Component;
|
||||
* @since 2023/7/10 18:22
|
||||
*/
|
||||
@Profile("local")
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CustomBpmProcessEventListener implements BpmProcessEventListener {
|
||||
@Override
|
||||
public void onCreated(FlowableEngineEntityEvent event) {
|
||||
|
||||
log.info("onCreated: ClassName: {}, event: {}", event.getClass().getName(), JSON.toJSONString(event));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStarted(FlowableProcessStartedEvent event) {
|
||||
|
||||
log.info("onStarted: ClassName: {}, event: {}", event.getClass().getName(), JSON.toJSONString(event));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(FlowableCancelledEvent event) {
|
||||
|
||||
log.info("onCancelled: ClassName: {}, event: {}", event.getClass().getName(), JSON.toJSONString(event));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted(FlowableEngineEntityEvent event) {
|
||||
|
||||
log.info("onCompleted: ClassName: {}, event: {}", event.getClass().getName(), JSON.toJSONString(event));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user