| @@ -100,7 +100,7 @@ public class ComponentController { | |||||
| */ | */ | ||||
| @DeleteMapping("{id}") | @DeleteMapping("{id}") | ||||
| @ApiOperation("根据id删除组件") | @ApiOperation("根据id删除组件") | ||||
| public AjaxResult deleteById(@PathVariable("id") Integer id) { | |||||
| public AjaxResult deleteById(@PathVariable("id") Integer id) throws Exception { | |||||
| return AjaxResult.success(this.componentService.removeById(id)); | return AjaxResult.success(this.componentService.removeById(id)); | ||||
| } | } | ||||
| @@ -118,7 +118,7 @@ public class DatasetVersionController extends BaseController { | |||||
| */ | */ | ||||
| @DeleteMapping({"{id}"}) | @DeleteMapping({"{id}"}) | ||||
| @ApiOperation("删除数据集版本") | @ApiOperation("删除数据集版本") | ||||
| public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) { | |||||
| public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) throws Exception { | |||||
| return genericsSuccess(this.datasetVersionService.removeById(id)); | return genericsSuccess(this.datasetVersionService.removeById(id)); | ||||
| } | } | ||||
| @@ -132,7 +132,7 @@ public class DatasetVersionController extends BaseController { | |||||
| @DeleteMapping("/deleteVersion") | @DeleteMapping("/deleteVersion") | ||||
| @ApiOperation(value = "逻辑删除模型版本", notes = "根据数据集ID和版本逻辑删除模型版本记录。") | @ApiOperation(value = "逻辑删除模型版本", notes = "根据数据集ID和版本逻辑删除模型版本记录。") | ||||
| public GenericsAjaxResult<Map<Integer, String>> deleteDatasetVersion(@RequestParam("dataset_id") Integer datasetId, | public GenericsAjaxResult<Map<Integer, String>> deleteDatasetVersion(@RequestParam("dataset_id") Integer datasetId, | ||||
| @RequestParam("version") String version) { | |||||
| @RequestParam("version") String version) throws Exception { | |||||
| return genericsSuccess(this.datasetVersionService.deleteDatasetVersion(datasetId, version)); | return genericsSuccess(this.datasetVersionService.deleteDatasetVersion(datasetId, version)); | ||||
| } | } | ||||
| @@ -114,7 +114,7 @@ public class AssetIconController extends BaseController { | |||||
| */ | */ | ||||
| @DeleteMapping("{id}") | @DeleteMapping("{id}") | ||||
| @ApiOperation("删除图标") | @ApiOperation("删除图标") | ||||
| public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) { | |||||
| public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) throws Exception { | |||||
| return genericsSuccess(this.assetIconService.removeById(id)); | return genericsSuccess(this.assetIconService.removeById(id)); | ||||
| } | } | ||||
| @@ -101,7 +101,7 @@ public class ModelDependencyController extends BaseController { | |||||
| */ | */ | ||||
| @DeleteMapping("{id}") | @DeleteMapping("{id}") | ||||
| @ApiOperation("删除模型依赖") | @ApiOperation("删除模型依赖") | ||||
| public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) { | |||||
| public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) throws Exception { | |||||
| return genericsSuccess(this.modelDependencyService.removeById(id)); | return genericsSuccess(this.modelDependencyService.removeById(id)); | ||||
| } | } | ||||
| @@ -130,7 +130,7 @@ public class ModelsVersionController extends BaseController { | |||||
| @DeleteMapping("/deleteVersion") | @DeleteMapping("/deleteVersion") | ||||
| @ApiOperation(value = "逻辑删除模型版本", notes = "根据模型ID和版本逻辑删除模型版本记录。") | @ApiOperation(value = "逻辑删除模型版本", notes = "根据模型ID和版本逻辑删除模型版本记录。") | ||||
| public GenericsAjaxResult<Map<Integer, String>> deleteModelsVersion(@RequestParam("models_id") Integer modelsId, | public GenericsAjaxResult<Map<Integer, String>> deleteModelsVersion(@RequestParam("models_id") Integer modelsId, | ||||
| @RequestParam("version") String version) throws IOException { | |||||
| @RequestParam("version") String version) throws Exception { | |||||
| return genericsSuccess(this.modelsVersionService.deleteModelsVersion(modelsId, version)); | return genericsSuccess(this.modelsVersionService.deleteModelsVersion(modelsId, version)); | ||||
| } | } | ||||
| @@ -94,7 +94,7 @@ public class ComputingResourceController extends BaseController { | |||||
| */ | */ | ||||
| @DeleteMapping("{id}") | @DeleteMapping("{id}") | ||||
| @ApiOperation("删除计算资源") | @ApiOperation("删除计算资源") | ||||
| public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) { | |||||
| public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) throws Exception { | |||||
| return genericsSuccess(this.computingResourceService.removeById(id)); | return genericsSuccess(this.computingResourceService.removeById(id)); | ||||
| } | } | ||||
| @@ -84,7 +84,7 @@ public class WorkflowParamController extends BaseController { | |||||
| */ | */ | ||||
| @DeleteMapping | @DeleteMapping | ||||
| @ApiOperation("删除流水线参数") | @ApiOperation("删除流水线参数") | ||||
| public GenericsAjaxResult<String> deleteById(Integer id) { | |||||
| public GenericsAjaxResult<String> deleteById(Integer id) throws Exception { | |||||
| return genericsSuccess(this.workflowParamService.removeById(id)); | return genericsSuccess(this.workflowParamService.removeById(id)); | ||||
| } | } | ||||
| @@ -64,7 +64,7 @@ public interface AssetIconService { | |||||
| */ | */ | ||||
| boolean deleteById(Integer id); | boolean deleteById(Integer id); | ||||
| String removeById(Integer id); | |||||
| String removeById(Integer id) throws Exception; | |||||
| List<AssetIcon> queryByName(String name); | List<AssetIcon> queryByName(String name); | ||||
| @@ -57,7 +57,7 @@ public interface ComponentService { | |||||
| */ | */ | ||||
| boolean deleteById(Integer id); | boolean deleteById(Integer id); | ||||
| String removeById(Integer id); | |||||
| String removeById(Integer id) throws Exception; | |||||
| List<Map> queryAllGroupedByCategory() throws Exception; | List<Map> queryAllGroupedByCategory() throws Exception; | ||||
| @@ -54,6 +54,6 @@ public interface ComputingResourceService { | |||||
| */ | */ | ||||
| boolean deleteById(Integer id); | boolean deleteById(Integer id); | ||||
| String removeById(Integer id); | |||||
| String removeById(Integer id) throws Exception; | |||||
| } | } | ||||
| @@ -58,7 +58,7 @@ public interface DatasetVersionService { | |||||
| */ | */ | ||||
| boolean deleteById(Integer id); | boolean deleteById(Integer id); | ||||
| String removeById(Integer id); | |||||
| String removeById(Integer id) throws Exception; | |||||
| List<DatasetVersion> queryByDatasetId(Integer datasetId); | List<DatasetVersion> queryByDatasetId(Integer datasetId); | ||||
| @@ -66,7 +66,7 @@ public interface DatasetVersionService { | |||||
| Map<String,Object> queryByDatasetIdAndVersion(Integer datasetId, String version); | Map<String,Object> queryByDatasetIdAndVersion(Integer datasetId, String version); | ||||
| Map<Integer,String> deleteDatasetVersion(Integer datasetId, String version); | |||||
| Map<Integer,String> deleteDatasetVersion(Integer datasetId, String version) throws Exception; | |||||
| void checkDeclaredVersion(DatasetVersion insert) throws Exception; | void checkDeclaredVersion(DatasetVersion insert) throws Exception; | ||||
| @@ -57,7 +57,7 @@ public interface ModelDependencyService { | |||||
| */ | */ | ||||
| boolean deleteById(Integer id); | boolean deleteById(Integer id); | ||||
| String removeById(Integer id); | |||||
| String removeById(Integer id) throws Exception; | |||||
| List<ModelDependency> queryByModelDependency(ModelDependency modelDependency) throws IOException; | List<ModelDependency> queryByModelDependency(ModelDependency modelDependency) throws IOException; | ||||
| @@ -69,7 +69,7 @@ public interface ModelsVersionService { | |||||
| Map<String,Object> queryByModelsIdAndVersion(Integer modelsId, String version); | Map<String,Object> queryByModelsIdAndVersion(Integer modelsId, String version); | ||||
| Map<Integer, String> deleteModelsVersion(Integer modelsId, String version) throws IOException; | |||||
| Map<Integer, String> deleteModelsVersion(Integer modelsId, String version) throws Exception; | |||||
| String addModelVersions(List<ModelsVersion> modelsVersions) throws Exception; | String addModelVersions(List<ModelsVersion> modelsVersions) throws Exception; | ||||
| @@ -45,7 +45,7 @@ public interface WorkflowParamService { | |||||
| */ | */ | ||||
| WorkflowParam update(WorkflowParam workflowParam); | WorkflowParam update(WorkflowParam workflowParam); | ||||
| String removeById(Integer id); | |||||
| String removeById(Integer id) throws Exception; | |||||
| /** | /** | ||||
| * 通过主键删除数据 | * 通过主键删除数据 | ||||
| @@ -101,10 +101,10 @@ public class AssetIconServiceImpl implements AssetIconService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public String removeById(Integer id) { | |||||
| public String removeById(Integer id) throws Exception { | |||||
| AssetIcon assetIcon = this.assetIconDao.queryById(id); | AssetIcon assetIcon = this.assetIconDao.queryById(id); | ||||
| if (assetIcon == null){ | if (assetIcon == null){ | ||||
| return "图标不存在"; | |||||
| throw new Exception("图标不存在"); | |||||
| } | } | ||||
| //判断权限,只有admin和创建者本身可以删除 | //判断权限,只有admin和创建者本身可以删除 | ||||
| @@ -114,7 +114,7 @@ public class AssetIconServiceImpl implements AssetIconService { | |||||
| String createdBy = assetIcon.getCreateBy(); | String createdBy = assetIcon.getCreateBy(); | ||||
| if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | ||||
| return "无权限删除该图标"; | |||||
| throw new Exception("无权限删除该图标"); | |||||
| } | } | ||||
| assetIcon.setState(0); | assetIcon.setState(0); | ||||
| @@ -121,7 +121,7 @@ public class CodeConfigServiceImpl implements CodeConfigService { | |||||
| String username = loginUser.getUsername(); | String username = loginUser.getUsername(); | ||||
| String createBy = codeConfig.getCreateBy(); | String createBy = codeConfig.getCreateBy(); | ||||
| if (!(StringUtils.equals(username, "admin") || StringUtils.equals(username, createBy))) { | if (!(StringUtils.equals(username, "admin") || StringUtils.equals(username, createBy))) { | ||||
| return "无权限删除该代码配置"; | |||||
| throw new Exception("无权限删除该代码配置"); | |||||
| } | } | ||||
| codeConfig.setState(Constant.State_invalid); | codeConfig.setState(Constant.State_invalid); | ||||
| return this.codeConfigDao.update(codeConfig) > 0 ? "删除成功" : "删除失败"; | return this.codeConfigDao.update(codeConfig) > 0 ? "删除成功" : "删除失败"; | ||||
| @@ -47,7 +47,7 @@ public class ComponentServiceImpl implements ComponentService { | |||||
| @Override | @Override | ||||
| public Component queryById(Integer id) { | public Component queryById(Integer id) { | ||||
| Component component = this.componentDao.queryById(id); | Component component = this.componentDao.queryById(id); | ||||
| if (component == null){ | |||||
| if (component == null) { | |||||
| throw new RuntimeException("组件不存在"); | throw new RuntimeException("组件不存在"); | ||||
| } | } | ||||
| @@ -58,14 +58,14 @@ public class ComponentServiceImpl implements ComponentService { | |||||
| public List<Map> queryAllGroupedByCategory() throws Exception { | public List<Map> queryAllGroupedByCategory() throws Exception { | ||||
| List<Component> componentList = this.componentDao.queryAll(); | List<Component> componentList = this.componentDao.queryAll(); | ||||
| List<Map> result = new ArrayList<>(); | List<Map> result = new ArrayList<>(); | ||||
| if (componentList.isEmpty()){ | |||||
| if (componentList.isEmpty()) { | |||||
| return result; | return result; | ||||
| } | } | ||||
| List<SysDictData> categoryTypeList = DictUtils.getDictCache("category_type"); | List<SysDictData> categoryTypeList = DictUtils.getDictCache("category_type"); | ||||
| Map<Integer,List<Component>> groupedComponent = componentList.stream().collect(Collectors.groupingBy(Component::getCategoryId)); | |||||
| for (Map.Entry <Integer,List<Component>> entry : groupedComponent.entrySet()) { | |||||
| Map<Integer, List<Component>> groupedComponent = componentList.stream().collect(Collectors.groupingBy(Component::getCategoryId)); | |||||
| for (Map.Entry<Integer, List<Component>> entry : groupedComponent.entrySet()) { | |||||
| List<SysDictData> categorys = categoryTypeList.stream().filter(sysDictData -> StringUtils.equals(sysDictData.getDictValue(), String.valueOf(entry.getKey()))).collect(Collectors.toList()); | List<SysDictData> categorys = categoryTypeList.stream().filter(sysDictData -> StringUtils.equals(sysDictData.getDictValue(), String.valueOf(entry.getKey()))).collect(Collectors.toList()); | ||||
| if (categorys.size() ==0){ | |||||
| if (categorys.size() == 0) { | |||||
| throw new Exception("组件类型不存在"); | throw new Exception("组件类型不存在"); | ||||
| } | } | ||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| @@ -80,8 +80,8 @@ public class ComponentServiceImpl implements ComponentService { | |||||
| /** | /** | ||||
| * 分页查询 | * 分页查询 | ||||
| * | * | ||||
| * @param component 筛选条件 | |||||
| * @param pageRequest 分页对象 | |||||
| * @param component 筛选条件 | |||||
| * @param pageRequest 分页对象 | |||||
| * @return 查询结果 | * @return 查询结果 | ||||
| */ | */ | ||||
| @Override | @Override | ||||
| @@ -104,7 +104,7 @@ public class ComponentServiceImpl implements ComponentService { | |||||
| component.setControlStrategy(controlStrategy); | component.setControlStrategy(controlStrategy); | ||||
| //json转换,存数据库 | //json转换,存数据库 | ||||
| String inParameters= gson.toJson(componentVo.getInParameters(), LinkedHashMap.class); | |||||
| String inParameters = gson.toJson(componentVo.getInParameters(), LinkedHashMap.class); | |||||
| String outParameters = gson.toJson(componentVo.getOutParameters(), LinkedHashMap.class); | String outParameters = gson.toJson(componentVo.getOutParameters(), LinkedHashMap.class); | ||||
| String envVariable = gson.toJson(componentVo.getEnvVirables(), LinkedHashMap.class); | String envVariable = gson.toJson(componentVo.getEnvVirables(), LinkedHashMap.class); | ||||
| component.setEnvVirables(envVariable); | component.setEnvVirables(envVariable); | ||||
| @@ -118,9 +118,9 @@ public class ComponentServiceImpl implements ComponentService { | |||||
| component.setState(1); | component.setState(1); | ||||
| // 检查相同category_id下的component_name是否已存在 | // 检查相同category_id下的component_name是否已存在 | ||||
| Integer existingCount = this.componentDao.countByNameAndCategoryId(component.getComponentName(),component.getCategoryId()); | |||||
| Integer existingCount = this.componentDao.countByNameAndCategoryId(component.getComponentName(), component.getCategoryId()); | |||||
| if(existingCount != null && existingCount > 0) { | |||||
| if (existingCount != null && existingCount > 0) { | |||||
| throw new RuntimeException("该类别下已有同名组件"); | throw new RuntimeException("该类别下已有同名组件"); | ||||
| } | } | ||||
| @@ -139,15 +139,15 @@ public class ComponentServiceImpl implements ComponentService { | |||||
| Component component = this.queryById(componentVo.getId()); | Component component = this.queryById(componentVo.getId()); | ||||
| //只能更新当前存在的组件 | //只能更新当前存在的组件 | ||||
| if (component == null){ | |||||
| if (component == null) { | |||||
| throw new RuntimeException("组件不存在,无法更新"); | throw new RuntimeException("组件不存在,无法更新"); | ||||
| } | } | ||||
| //将object转成string类型 | //将object转成string类型 | ||||
| component = ConvertUtil.entityToVo(componentVo,Component.class); | |||||
| component = ConvertUtil.entityToVo(componentVo, Component.class); | |||||
| Gson gson = new Gson(); | Gson gson = new Gson(); | ||||
| String inParameters= gson.toJson(componentVo.getInParameters(), LinkedHashMap.class); | |||||
| String inParameters = gson.toJson(componentVo.getInParameters(), LinkedHashMap.class); | |||||
| String outParameters = gson.toJson(componentVo.getOutParameters(), LinkedHashMap.class); | String outParameters = gson.toJson(componentVo.getOutParameters(), LinkedHashMap.class); | ||||
| String envVariable = gson.toJson(componentVo.getEnvVirables(), LinkedHashMap.class); | String envVariable = gson.toJson(componentVo.getEnvVirables(), LinkedHashMap.class); | ||||
| @@ -174,24 +174,24 @@ public class ComponentServiceImpl implements ComponentService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public String removeById(Integer id) { | |||||
| public String removeById(Integer id) throws Exception { | |||||
| Component component = this.componentDao.queryById(id); | Component component = this.componentDao.queryById(id); | ||||
| //先进行判断 组件是否存在 | //先进行判断 组件是否存在 | ||||
| if (component == null ){ | |||||
| return "组件不存在"; | |||||
| if (component == null) { | |||||
| throw new Exception("组件不存在"); | |||||
| } | } | ||||
| //判断权限,只有admin和创建者本身可以删除该组件 | //判断权限,只有admin和创建者本身可以删除该组件 | ||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| String username = loginUser.getUsername(); | String username = loginUser.getUsername(); | ||||
| String createdBy = component.getCreateBy(); | String createdBy = component.getCreateBy(); | ||||
| if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | |||||
| return "无权限删除该组件"; | |||||
| if (!(StringUtils.equals(username, "admin") || StringUtils.equals(username, createdBy))) { | |||||
| throw new Exception("无权限删除该组件"); | |||||
| } | } | ||||
| component.setState(0); | component.setState(0); | ||||
| return this.componentDao.update(component)>0?"删除成功":"删除失败"; | |||||
| return this.componentDao.update(component) > 0 ? "删除成功" : "删除失败"; | |||||
| } | } | ||||
| @@ -92,10 +92,10 @@ public class ComputingResourceServiceImpl implements ComputingResourceService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public String removeById(Integer id) { | |||||
| public String removeById(Integer id) throws Exception { | |||||
| ComputingResource computingResource = this.computingResourceDao.queryById(id); | ComputingResource computingResource = this.computingResourceDao.queryById(id); | ||||
| if (computingResource == null){ | if (computingResource == null){ | ||||
| return "计算资源不存在"; | |||||
| throw new Exception("计算资源不存在"); | |||||
| } | } | ||||
| //判断权限,只有admin和创建者本身可以删除该数据集 | //判断权限,只有admin和创建者本身可以删除该数据集 | ||||
| @@ -103,7 +103,7 @@ public class ComputingResourceServiceImpl implements ComputingResourceService { | |||||
| String username = loginUser.getUsername(); | String username = loginUser.getUsername(); | ||||
| String createdBy = computingResource.getCreateBy(); | String createdBy = computingResource.getCreateBy(); | ||||
| if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | ||||
| return "无权限删除该计算资源"; | |||||
| throw new Exception("无权限删除该计算资源"); | |||||
| } | } | ||||
| computingResource.setState(0); | computingResource.setState(0); | ||||
| @@ -128,17 +128,17 @@ public class DatasetVersionServiceImpl implements DatasetVersionService { | |||||
| @Override | @Override | ||||
| public String removeById(Integer id) { | |||||
| public String removeById(Integer id) throws Exception { | |||||
| DatasetVersion datasetVersion = this.datasetVersionDao.queryById(id); | DatasetVersion datasetVersion = this.datasetVersionDao.queryById(id); | ||||
| if (datasetVersion == null){ | if (datasetVersion == null){ | ||||
| return "数据集版本信息不存在"; | |||||
| throw new Exception("数据集版本信息不存在"); | |||||
| } | } | ||||
| //判断权限,只有admin和创建者本身可以删除该数据集版本信息 | //判断权限,只有admin和创建者本身可以删除该数据集版本信息 | ||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| String username = loginUser.getUsername(); | String username = loginUser.getUsername(); | ||||
| String createdBy = datasetVersion.getCreateBy(); | String createdBy = datasetVersion.getCreateBy(); | ||||
| if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | ||||
| return "无权限删除该数据集版本"; | |||||
| throw new Exception("无权限删除该数据集版本"); | |||||
| } | } | ||||
| datasetVersion.setState(0); | datasetVersion.setState(0); | ||||
| @@ -175,7 +175,7 @@ public class DatasetVersionServiceImpl implements DatasetVersionService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public Map<Integer, String> deleteDatasetVersion(Integer datasetId, String version) { | |||||
| public Map<Integer, String> deleteDatasetVersion(Integer datasetId, String version) throws Exception { | |||||
| Map<Integer, String> results = new HashMap<Integer,String>(); | Map<Integer, String> results = new HashMap<Integer,String>(); | ||||
| // 根据模型ID和版本查询所有模型版本 | // 根据模型ID和版本查询所有模型版本 | ||||
| List<DatasetVersion> versions = this.datasetVersionDao.queryAllByDatasetVersion(datasetId, version); | List<DatasetVersion> versions = this.datasetVersionDao.queryAllByDatasetVersion(datasetId, version); | ||||
| @@ -154,7 +154,7 @@ public class DevEnvironmentServiceImpl implements DevEnvironmentService { | |||||
| public String removeById(Integer id) throws Exception { | public String removeById(Integer id) throws Exception { | ||||
| DevEnvironment devEnvironment = this.devEnvironmentDao.queryById(id); | DevEnvironment devEnvironment = this.devEnvironmentDao.queryById(id); | ||||
| if (devEnvironment == null) { | if (devEnvironment == null) { | ||||
| return "开发环境信息不存在"; | |||||
| throw new RuntimeException("开发环境信息不存在"); | |||||
| } | } | ||||
| //判断权限,只有admin和创建者本身可以删除该数据集 | //判断权限,只有admin和创建者本身可以删除该数据集 | ||||
| @@ -162,7 +162,7 @@ public class DevEnvironmentServiceImpl implements DevEnvironmentService { | |||||
| String username = loginUser.getUsername(); | String username = loginUser.getUsername(); | ||||
| String createdBy = devEnvironment.getCreateBy(); | String createdBy = devEnvironment.getCreateBy(); | ||||
| if (!(StringUtils.equals(username, "admin") || StringUtils.equals(username, createdBy))) { | if (!(StringUtils.equals(username, "admin") || StringUtils.equals(username, createdBy))) { | ||||
| return "无权限删除该开发环境"; | |||||
| throw new RuntimeException("无权限删除该开发环境"); | |||||
| } | } | ||||
| jupyterService.stopJupyterService(id); | jupyterService.stopJupyterService(id); | ||||
| @@ -213,7 +213,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||||
| public String removeById(Integer id) { | public String removeById(Integer id) { | ||||
| ExperimentIns experimentIns = experimentInsDao.queryById(id); | ExperimentIns experimentIns = experimentInsDao.queryById(id); | ||||
| if (experimentIns == null) { | if (experimentIns == null) { | ||||
| return "实验实例不存在"; | |||||
| throw new RuntimeException("实验实例不存在"); | |||||
| } | } | ||||
| //判断权限,只有admin和创建者本身可以删除该实验实例 | //判断权限,只有admin和创建者本身可以删除该实验实例 | ||||
| @@ -221,14 +221,14 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||||
| String username = loginUser.getUsername(); | String username = loginUser.getUsername(); | ||||
| String createdBy = experimentIns.getCreateBy(); | String createdBy = experimentIns.getCreateBy(); | ||||
| if (!(StringUtils.equals(username, "admin") || StringUtils.equals(username, createdBy))) { | if (!(StringUtils.equals(username, "admin") || StringUtils.equals(username, createdBy))) { | ||||
| return "无权限删除该流水线"; | |||||
| throw new RuntimeException("无权限删除该流水线"); | |||||
| } | } | ||||
| if (StringUtils.isEmpty(experimentIns.getStatus())) { | if (StringUtils.isEmpty(experimentIns.getStatus())) { | ||||
| experimentIns = queryStatusFromArgo(experimentIns); | experimentIns = queryStatusFromArgo(experimentIns); | ||||
| } | } | ||||
| if (StringUtils.equals(experimentIns.getStatus(), "Running")) { | |||||
| return "实验实例正在运行,不可删除"; | |||||
| if (StringUtils.equals(experimentIns.getStatus(), Constant.Running)) { | |||||
| throw new RuntimeException("实验实例正在运行,不可删除"); | |||||
| } | } | ||||
| experimentIns.setState(0); | experimentIns.setState(0); | ||||
| int update = this.experimentInsDao.update(experimentIns); | int update = this.experimentInsDao.update(experimentIns); | ||||
| @@ -245,7 +245,7 @@ public class ModelDependencyServiceImpl implements ModelDependencyService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public String removeById(Integer id) { | |||||
| public String removeById(Integer id) throws Exception { | |||||
| ModelDependency modelDependency = this.modelDependencyDao.queryById(id); | ModelDependency modelDependency = this.modelDependencyDao.queryById(id); | ||||
| if (modelDependency == null){ | if (modelDependency == null){ | ||||
| return "模型依赖信息不存在"; | return "模型依赖信息不存在"; | ||||
| @@ -256,7 +256,7 @@ public class ModelDependencyServiceImpl implements ModelDependencyService { | |||||
| String username = loginUser.getUsername(); | String username = loginUser.getUsername(); | ||||
| String createdBy = modelDependency.getCreateBy(); | String createdBy = modelDependency.getCreateBy(); | ||||
| if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | ||||
| return "无权限删除"; | |||||
| throw new Exception("无权限删除"); | |||||
| } | } | ||||
| modelDependency.setState(0); | modelDependency.setState(0); | ||||
| @@ -194,7 +194,7 @@ public class ModelsVersionServiceImpl implements ModelsVersionService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public Map<Integer, String> deleteModelsVersion(Integer modelsId, String version) throws IOException { | |||||
| public Map<Integer, String> deleteModelsVersion(Integer modelsId, String version) throws Exception { | |||||
| Map<Integer, String> results = new HashMap<Integer,String>(); | Map<Integer, String> results = new HashMap<Integer,String>(); | ||||
| // 根据模型ID和版本查询所有模型版本 | // 根据模型ID和版本查询所有模型版本 | ||||
| List<ModelsVersion> versions = this.modelsVersionDao.queryAllByModelsVersion(modelsId, version); | List<ModelsVersion> versions = this.modelsVersionDao.queryAllByModelsVersion(modelsId, version); | ||||
| @@ -80,10 +80,10 @@ public class WorkflowParamServiceImpl implements WorkflowParamService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public String removeById(Integer id) { | |||||
| public String removeById(Integer id) throws Exception { | |||||
| WorkflowParam workflowParam = this.workflowParamDao.queryById(id); | WorkflowParam workflowParam = this.workflowParamDao.queryById(id); | ||||
| if (workflowParam == null){ | if (workflowParam == null){ | ||||
| return "流水线参数不存在"; | |||||
| throw new Exception("流水线参数不存在"); | |||||
| } | } | ||||
| //判断权限,只有admin和创建者本身可以删除 | //判断权限,只有admin和创建者本身可以删除 | ||||
| @@ -93,7 +93,7 @@ public class WorkflowParamServiceImpl implements WorkflowParamService { | |||||
| String createdBy = workflowParam.getCreateBy(); | String createdBy = workflowParam.getCreateBy(); | ||||
| if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | ||||
| return "无权限删除该流水线参数"; | |||||
| throw new Exception("无权限删除该流水线参数"); | |||||
| } | } | ||||
| workflowParam.setState(0); | workflowParam.setState(0); | ||||