@@ -226,7 +226,6 @@ public Map<String, Long> getCodeAndVersion(String projectName, String processDef
226226 * @param timeout timeout for workflow working, if running time longer than timeout,
227227 * task will mark as fail
228228 * @param workerGroup run task in which worker group
229- * @param tenantCode tenantCode
230229 * @param taskRelationJson relation json for nodes
231230 * @param taskDefinitionJson taskDefinitionJson
232231 * @param otherParamsJson otherParamsJson handle other params
@@ -242,13 +241,16 @@ public Long createOrUpdateWorkflow(String userName,
242241 int warningGroupId ,
243242 int timeout ,
244243 String workerGroup ,
245- String tenantCode ,
246244 int releaseState ,
247245 String taskRelationJson ,
248246 String taskDefinitionJson ,
249247 String otherParamsJson ,
250248 String executionType ) {
251249 User user = usersService .queryUser (userName );
250+ if (user .getTenantCode () == null ) {
251+ throw new RuntimeException ("Can not create or update workflow for user who not related to any tenant." );
252+ }
253+
252254 Project project = projectMapper .queryByName (projectName );
253255 long projectCode = project .getCode ();
254256
@@ -263,12 +265,12 @@ public Long createOrUpdateWorkflow(String userName,
263265 ReleaseState .OFFLINE );
264266 processDefinitionService .updateProcessDefinition (user , projectCode , name ,
265267 processDefinitionCode , description , globalParams ,
266- null , timeout , tenantCode , taskRelationJson , taskDefinitionJson , otherParamsJson ,
268+ null , timeout , user . getTenantCode () , taskRelationJson , taskDefinitionJson , otherParamsJson ,
267269 executionTypeEnum );
268270 } else {
269271 Map <String , Object > result = processDefinitionService .createProcessDefinition (user , projectCode , name ,
270272 description , globalParams ,
271- null , timeout , tenantCode , taskRelationJson , taskDefinitionJson , otherParamsJson ,
273+ null , timeout , user . getTenantCode () , taskRelationJson , taskDefinitionJson , otherParamsJson ,
272274 executionTypeEnum );
273275 processDefinition = (ProcessDefinition ) result .get (Constants .DATA_LIST );
274276 processDefinitionCode = processDefinition .getCode ();
0 commit comments