From 5c7515cf8c74450a885e39c28fb6853f60a8cb5b Mon Sep 17 00:00:00 2001 From: lenboo Date: Fri, 5 Jul 2019 11:11:43 +0800 Subject: [PATCH] fix sub process worker group id is 0 --- .../escheduler/api/service/ProcessInstanceService.java | 10 ++++++++-- .../src/main/java/cn/escheduler/dao/ProcessDao.java | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/escheduler-api/src/main/java/cn/escheduler/api/service/ProcessInstanceService.java b/escheduler-api/src/main/java/cn/escheduler/api/service/ProcessInstanceService.java index 9ba29e0555..f5f05a74d6 100644 --- a/escheduler-api/src/main/java/cn/escheduler/api/service/ProcessInstanceService.java +++ b/escheduler-api/src/main/java/cn/escheduler/api/service/ProcessInstanceService.java @@ -115,12 +115,18 @@ public class ProcessInstanceService extends BaseDAGService { return checkResult; } ProcessInstance processInstance = processDao.findProcessInstanceDetailById(processId); + String workerGroupName = ""; if(processInstance.getWorkerGroupId() == -1){ - processInstance.setWorkerGroupName(DEFAULT); + workerGroupName = DEFAULT; }else{ WorkerGroup workerGroup = workerGroupMapper.queryById(processInstance.getWorkerGroupId()); - processInstance.setWorkerGroupName(workerGroup.getName()); + if(workerGroup != null){ + workerGroupName = DEFAULT; + }else{ + workerGroupName = workerGroup.getName(); + } } + processInstance.setWorkerGroupName(workerGroupName); ProcessDefinition processDefinition = processDao.findProcessDefineById(processInstance.getProcessDefinitionId()); processInstance.setReceivers(processDefinition.getReceivers()); processInstance.setReceiversCc(processDefinition.getReceiversCc()); diff --git a/escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java b/escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java index 8ba0f47960..d393339a5e 100644 --- a/escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java +++ b/escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java @@ -493,7 +493,8 @@ public class ProcessDao extends AbstractBaseDao { processInstance.setProcessInstanceJson(processDefinition.getProcessDefinitionJson()); // set process instance priority processInstance.setProcessInstancePriority(command.getProcessInstancePriority()); - processInstance.setWorkerGroupId(command.getWorkerGroupId()); + int workerGroupId = command.getWorkerGroupId() == 0 ? -1 : command.getWorkerGroupId(); + processInstance.setWorkerGroupId(workerGroupId); processInstance.setTimeout(processDefinition.getTimeout()); processInstance.setTenantId(processDefinition.getTenantId()); return processInstance;