1.自动工单非重复任务保存优化

main
yitonglei 3 years ago
parent f6ff5d459f
commit 2b64bc4b8a
  1. 10
      lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/listener/ProcessEndListener.java

@ -11,6 +11,7 @@ import org.springblade.plugin.workbench.service.IAutoStartModelService;
import org.springblade.plugin.workbench.service.impl.AutoStartModelServiceImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
@ -28,19 +29,20 @@ public class ProcessEndListener implements ExecutionListener {
String event = delegateExecution.getEventName();
String processInstanceId = delegateExecution.getProcessInstanceId();
Map<String,Object> variables = delegateExecution.getVariables();
Map<String,Object> variablesMap = new HashMap<>();
variablesMap.putAll(variables);
switch (event) {
case "start" :
IAutoStartModelService autoStartModelService = (IAutoStartModelService)SpringContextHolder.getBean(AutoStartModelServiceImpl.class);
System.out.println("ProcessEndListener-start event-------------------");
//判断工作流的的重复模式
if(Func.isNotEmpty(variables.get("chongfumoshi")) && !StringUtils.equals(RepeatEnum.不重复.getCode(),variables.get("chongfumoshi").toString())){
if(Func.isNotEmpty(variablesMap.get("chongfumoshi")) && !StringUtils.equals(RepeatEnum.不重复.getCode(),variablesMap.get("chongfumoshi").toString())){
//保存任务信息使任务工单可以被自动创建
autoStartModelService.saveStartProcess(processInstanceId,variables);
autoStartModelService.saveStartProcess(processInstanceId,variablesMap);
//使任务可以自动开启,这里不用新建工单,因为TaskConfig会自动创建
// autoStartModelService.updateAutoStartModel(processInstanceId,variables);
}else{//不重复任务
autoStartModelService.newWorkOrder(processInstanceId,variables);
autoStartModelService.newWorkOrder(processInstanceId,variablesMap);
}
break;

Loading…
Cancel
Save