Browse Source

add tenant id in process definition

pull/2/head
lenboo 5 years ago
parent
commit
ec7406ddab
  1. 6
      escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java
  2. 9
      escheduler-dao/src/main/java/cn/escheduler/dao/model/ProcessInstance.java
  3. 12
      escheduler-server/src/main/java/cn/escheduler/server/worker/runner/FetchTaskThread.java

6
escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java

@ -494,11 +494,7 @@ public class ProcessDao extends AbstractBaseDao {
processInstance.setProcessInstancePriority(command.getProcessInstancePriority());
processInstance.setWorkerGroupId(command.getWorkerGroupId());
processInstance.setTimeout(processDefinition.getTimeout());
Tenant tenant = getTenantForProcess(processDefinition.getTenantId(),
processDefinition.getUserId());
if(tenant!= null){
processInstance.setTenantCode(tenant.getTenantCode());
}
processInstance.setTenantId(processDefinition.getTenantId());
return processInstance;
}

9
escheduler-dao/src/main/java/cn/escheduler/dao/model/ProcessInstance.java

@ -192,7 +192,7 @@ public class ProcessInstance {
/**
* tenant id
*/
private String tenantId;
private int tenantId;
public ProcessInstance(){
@ -553,4 +553,11 @@ public class ProcessInstance {
'}';
}
public void setTenantId(int tenantId) {
this.tenantId = tenantId;
}
public int getTenantId() {
return this.tenantId ;
}
}

12
escheduler-server/src/main/java/cn/escheduler/server/worker/runner/FetchTaskThread.java

@ -23,10 +23,7 @@ import cn.escheduler.common.thread.ThreadUtils;
import cn.escheduler.common.utils.FileUtils;
import cn.escheduler.common.utils.OSUtils;
import cn.escheduler.dao.ProcessDao;
import cn.escheduler.dao.model.ProcessDefinition;
import cn.escheduler.dao.model.ProcessInstance;
import cn.escheduler.dao.model.TaskInstance;
import cn.escheduler.dao.model.WorkerGroup;
import cn.escheduler.dao.model.*;
import cn.escheduler.server.zk.ZKWorkerClient;
import com.cronutils.utils.StringUtils;
import org.apache.commons.configuration.Configuration;
@ -194,9 +191,16 @@ public class FetchTaskThread implements Runnable{
// get process instance
ProcessInstance processInstance = processDao.findProcessInstanceDetailById(taskInstance.getProcessInstanceId());
// get process define
ProcessDefinition processDefine = processDao.findProcessDefineById(taskInstance.getProcessDefinitionId());
Tenant tenant = processDao.getTenantForProcess(processInstance.getTenantId(),
processDefine.getUserId());
if(tenant != null){
processInstance.setTenantCode(tenant.getTenantCode());
}
taskInstance.setProcessInstance(processInstance);
taskInstance.setProcessDefine(processDefine);

Loading…
Cancel
Save