|
|
|
@@ -107,7 +107,7 @@ public class WorkflowServiceImpl implements WorkflowService { |
|
|
|
return this.workflowDao.deleteById(id) > 0; |
|
|
|
} |
|
|
|
@Override |
|
|
|
public String removeById(Long id) { |
|
|
|
public String removeById(Long id) throws Exception { |
|
|
|
//先根据id提取出对应的流水线 |
|
|
|
Workflow workflow = workflowDao.queryById(id); |
|
|
|
|
|
|
|
@@ -116,16 +116,16 @@ public class WorkflowServiceImpl implements WorkflowService { |
|
|
|
String username = loginUser.getUsername(); |
|
|
|
String createdBy = workflow.getCreateBy(); |
|
|
|
if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ |
|
|
|
return "无权限删除该流水线"; |
|
|
|
throw new Exception("无权限删除该流水线"); |
|
|
|
} |
|
|
|
|
|
|
|
if (workflow == null){ |
|
|
|
return "流水线不存在"; |
|
|
|
throw new Exception("流水线不存在"); |
|
|
|
} |
|
|
|
//判断这个流水线是否有相关实验存在 |
|
|
|
List<Experiment> experimentList = experimentService.queryByWorkflowId(id); |
|
|
|
if (experimentList!=null&&experimentList.size()>0){ |
|
|
|
return "该流水线存在实验,无法删除"; |
|
|
|
throw new Exception("该流水线存在实验,无法删除"); |
|
|
|
} |
|
|
|
workflow.setState(0); |
|
|
|
return this.workflowDao.update(workflow)>0?"删除成功":"删除失败"; |
|
|
|
@@ -143,7 +143,7 @@ public class WorkflowServiceImpl implements WorkflowService { |
|
|
|
Workflow workflow = this.queryById(id); |
|
|
|
if (workflow!= null) { |
|
|
|
Workflow duplicateWorkflow = new Workflow(); |
|
|
|
duplicateWorkflow.setName(workflow.getName()); |
|
|
|
duplicateWorkflow.setName(workflow.getName()+"-copy"); |
|
|
|
duplicateWorkflow.setDag(workflow.getDag()); |
|
|
|
duplicateWorkflow.setDescription(workflow.getDescription()); |
|
|
|
return this.insert(duplicateWorkflow); |
|
|
|
|