diff --git a/bonus-modules/bonus-ai/pom.xml b/bonus-modules/bonus-ai/pom.xml
index 3adb592..228b4a6 100644
--- a/bonus-modules/bonus-ai/pom.xml
+++ b/bonus-modules/bonus-ai/pom.xml
@@ -5,7 +5,7 @@
com.bonus
bonus-modules
- 24.7.1
+ 24.9.0-SNAPSHOT
4.0.0
diff --git a/bonus-modules/bonus-ai/src/main/java/com/bonus/ai/controller/DataSetController.java b/bonus-modules/bonus-ai/src/main/java/com/bonus/ai/controller/DataSetController.java
index 4e090ae..6cb39db 100644
--- a/bonus-modules/bonus-ai/src/main/java/com/bonus/ai/controller/DataSetController.java
+++ b/bonus-modules/bonus-ai/src/main/java/com/bonus/ai/controller/DataSetController.java
@@ -2,15 +2,19 @@ package com.bonus.ai.controller;
import com.bonus.ai.domain.*;
import com.bonus.ai.service.DataSetService;
+import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
-import com.bonus.common.security.utils.SecurityUtils;
+import com.bonus.common.core.web.page.TableDataInfo;
+import com.bonus.system.api.RemoteFileService;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
/**
* @author bonus
@@ -18,20 +22,23 @@ import java.util.List;
@RestController
@RequestMapping("/dataSet")
@Slf4j
-public class DataSetController {
+public class DataSetController extends BaseController {
@Resource
private DataSetService dataSetService;
+ @Resource
+ private RemoteFileService remoteFileService;
+
/**
* 根据数据集 ID 查询对应的数据集信息。
*
* @param datasetId 数据集的唯一标识符
* @return 返回指定数据集 ID 对应的 DataSetEntity 对象
*/
- @PostMapping("/getDatasetById")
- public AjaxResult getDatasetById(Long datasetId) {
- return null;
+ @GetMapping("/getDatasetById/{datasetId}")
+ public AjaxResult getDatasetById(@PathVariable Long datasetId) {
+ return dataSetService.getDatasetById(datasetId);
}
/**
@@ -40,9 +47,26 @@ public class DataSetController {
* @param entity 包含查询条件的 DataSetEntity 对象
* @return 返回所有符合条件的数据集的集合
*/
- @PostMapping("/getAllDatasets")
- public AjaxResult getAllDatasets(DataSetEntity entity) {
- return null;
+ @GetMapping("/getAllDatasets")
+ public TableDataInfo getAllDatasets(DataSetEntity entity) {
+ try {
+ startPage();
+ List allDatasets = dataSetService.getAllDatasets(entity);
+ return getDataTable(allDatasets);
+ } catch (Exception e) {
+ log.error(e.toString(), e);
+ }
+ return getDataTableError(new ArrayList<>());
+ }
+
+ /**
+ * 查询所有的数据集信息。
+ *
+ * @return 返回所有符合条件的数据集的集合
+ */
+ @GetMapping("/getDatasets")
+ public AjaxResult getDatasets() {
+ return AjaxResult.success(dataSetService.getAllDatasets(null));
}
/**
@@ -52,8 +76,8 @@ public class DataSetController {
* @return 返回插入操作影响的行数(成功插入的记录数,通常为 1)
*/
@PostMapping("/insertDataset")
- public AjaxResult insertDataset(DataSetEntity entity) {
- return null;
+ public AjaxResult insertDataset(@RequestBody DataSetEntity entity) {
+ return dataSetService.insertDataset(entity);
}
/**
@@ -63,8 +87,8 @@ public class DataSetController {
* @return 返回更新操作影响的行数(成功更新的记录数,通常为 1)
*/
@PostMapping("/updateDataset")
- public AjaxResult updateDataset(DataSetEntity entity) {
- return null;
+ public AjaxResult updateDataset(@RequestBody DataSetEntity entity) {
+ return dataSetService.updateDataset(entity);
}
/**
@@ -73,9 +97,9 @@ public class DataSetController {
* @param datasetId 数据集的唯一标识符
* @return 返回删除操作影响的行数(成功删除的记录数,通常为 1)
*/
- @PostMapping("/deleteDataset")
- public AjaxResult deleteDataset(Long datasetId) {
- return null;
+ @DeleteMapping("/deleteDataset/{datasetId}")
+ public AjaxResult deleteDataset(@PathVariable Long datasetId) {
+ return dataSetService.deleteDataset(datasetId);
}
/**
@@ -84,9 +108,9 @@ public class DataSetController {
* @param categoryId 类别的唯一标识符
* @return 返回指定类别 ID 对应的 DataSetCategoryEntity 对象
*/
- @PostMapping("/getCategoryById")
- public AjaxResult getCategoryById(Long categoryId) {
- return null;
+ @GetMapping("/getCategoryById/{categoryId}")
+ public AjaxResult getCategoryById(@PathVariable Long categoryId) {
+ return dataSetService.getCategoryById(categoryId);
}
/**
@@ -96,7 +120,7 @@ public class DataSetController {
* @return 返回所有符合条件的类别的列表
*/
@PostMapping("/getCategories")
- public AjaxResult getCategories(DataSetCategoryEntity entity) {
+ public AjaxResult getCategories(@RequestBody DataSetCategoryEntity entity) {
return dataSetService.getCategories(entity);
}
@@ -107,8 +131,8 @@ public class DataSetController {
* @return 返回插入操作影响的行数(成功插入的记录数,通常为 1)
*/
@PostMapping("/insertCategory")
- public AjaxResult insertCategory(DataSetCategoryEntity entity) {
- return null;
+ public AjaxResult insertCategory(@RequestBody DataSetCategoryEntity entity) {
+ return dataSetService.insertCategory(entity);
}
/**
@@ -118,8 +142,8 @@ public class DataSetController {
* @return 返回更新操作影响的行数(成功更新的记录数,通常为 1)
*/
@PostMapping("/updateCategory")
- public AjaxResult updateCategory(DataSetCategoryEntity entity) {
- return null;
+ public AjaxResult updateCategory(@RequestBody DataSetCategoryEntity entity) {
+ return dataSetService.updateCategory(entity);
}
/**
@@ -128,9 +152,9 @@ public class DataSetController {
* @param categoryId 要删除的类别的唯一标识符
* @return 返回删除操作影响的行数(成功删除的记录数,通常为 1)
*/
- @PostMapping("/deleteCategory")
- public AjaxResult deleteCategory(Long categoryId) {
- return null;
+ @DeleteMapping("/deleteCategory/{categoryId}")
+ public AjaxResult deleteCategory(@PathVariable Long categoryId) {
+ return dataSetService.deleteCategory(categoryId);
}
/**
@@ -150,9 +174,16 @@ public class DataSetController {
* @param entity 查询条件
* @return 数据集文件列表
*/
- @PostMapping("/getAllFiles")
- public AjaxResult getAllFiles(DataSetFileEntity entity) {
- return null;
+ @GetMapping("/getAllFiles")
+ public TableDataInfo getAllFiles(DataSetFileEntity entity) {
+ try {
+ startPage();
+ List allFiles = dataSetService.getAllFiles(entity);
+ return getDataTable(allFiles);
+ } catch (Exception e) {
+ log.error(e.toString(), e);
+ }
+ return getDataTableError(new ArrayList<>());
}
/**
@@ -162,8 +193,8 @@ public class DataSetController {
* @return 影响的行数
*/
@PostMapping("/insertFile")
- public AjaxResult insertFile(DataSetFileEntity entity) {
- return null;
+ public AjaxResult insertFile(@RequestBody DataSetFileEntity entity) {
+ return dataSetService.insertFile(entity);
}
/**
@@ -173,19 +204,19 @@ public class DataSetController {
* @return 影响的行数
*/
@PostMapping("/updateFile")
- public AjaxResult updateFile(DataSetFileEntity datasetFile) {
- return null;
+ public AjaxResult updateFile(@RequestBody DataSetFileEntity datasetFile) {
+ return dataSetService.updateFile(datasetFile);
}
/**
* 根据 ID 删除数据集文件(逻辑删除)
*
- * @param fileId 文件 ID
+ * @param fileIds 文件 ID
* @return 影响的行数
*/
- @PostMapping("/deleteFile")
- public AjaxResult deleteFile(Long fileId) {
- return null;
+ @DeleteMapping("/deleteFile/{fileIds}")
+ public AjaxResult deleteFile(@PathVariable Long[] fileIds) {
+ return dataSetService.deleteFile(fileIds);
}
/**
@@ -194,8 +225,8 @@ public class DataSetController {
* @param taskId 任务 ID
* @return 数据集任务实体
*/
- @PostMapping("/getTaskById")
- public AjaxResult getTaskById(Long taskId) {
+ @GetMapping("/getTaskById/{taskId}")
+ public AjaxResult getTaskById(@PathVariable Long taskId) {
return null;
}
@@ -205,9 +236,16 @@ public class DataSetController {
* @param entity 查询条件
* @return 数据集任务列表
*/
- @PostMapping("/getAllTasks")
- public AjaxResult getAllTasks(DataSetTaskEntity entity) {
- return null;
+ @GetMapping("/getAllTasks")
+ public TableDataInfo getAllTasks(DataSetTaskEntity entity) {
+ try {
+ startPage();
+ List list = dataSetService.getAllTasks(entity);
+ return getDataTable(list);
+ } catch (Exception e) {
+ log.error(e.toString(), e);
+ }
+ return getDataTableError(new ArrayList<>());
}
/**
@@ -217,8 +255,8 @@ public class DataSetController {
* @return 影响的行数
*/
@PostMapping("/insertTask")
- public AjaxResult insertTask(DataSetTaskEntity entity) {
- return null;
+ public AjaxResult insertTask(@RequestBody DataSetTaskEntity entity) {
+ return dataSetService.insertTask(entity);
}
/**
@@ -228,8 +266,8 @@ public class DataSetController {
* @return 影响的行数
*/
@PostMapping("/updateTask")
- public AjaxResult updateTask(DataSetTaskEntity datasetTask) {
- return null;
+ public AjaxResult updateTask(@RequestBody DataSetTaskEntity datasetTask) {
+ return dataSetService.updateTask(datasetTask);
}
/**
@@ -238,9 +276,9 @@ public class DataSetController {
* @param taskId 任务 ID
* @return 影响的行数
*/
- @PostMapping("/deleteTask")
- public AjaxResult deleteTask(Long taskId) {
- return null;
+ @DeleteMapping("/deleteTask/{taskId}")
+ public AjaxResult deleteTask(@PathVariable Long taskId) {
+ return dataSetService.deleteTask(taskId);
}
/**
@@ -249,9 +287,9 @@ public class DataSetController {
* @param logId 日志 ID
* @return 数据集日志实体
*/
- @PostMapping("/getLogById")
- public AjaxResult getLogById(Long logId) {
- return null;
+ @PostMapping("/getLogById/{logId}")
+ public AjaxResult getLogById(@PathVariable Long logId) {
+ return dataSetService.getLogById(logId);
}
/**
@@ -260,42 +298,179 @@ public class DataSetController {
* @param entity 查询条件
* @return 数据集日志列表
*/
- @PostMapping("/getAllLogs")
- public AjaxResult getAllLogs(DataSetLogEntity entity) {
- return null;
+ @GetMapping("/getAllLogs")
+ public TableDataInfo getAllLogs(DataSetLogEntity entity) {
+ try {
+ startPage();
+ List list = dataSetService.getAllLogs(entity);
+ return getDataTable(list);
+ } catch (Exception e) {
+ log.error(e.toString(), e);
+ }
+ return getDataTableError(new ArrayList<>());
+ }
+
+
+ /**
+ * 根据 ID 查询模型
+ *
+ * @param modelId 模型管理 ID
+ * @return 模型管理实体
+ */
+ @GetMapping("/getModelsById/{modelId}")
+ public AjaxResult getModelsById(@PathVariable Long modelId) {
+ return dataSetService.getModelsById(modelId);
}
/**
- * 插入新的日志
+ * 查询所有模型
*
- * @param log 数据集日志实体
- * @return 影响的行数
+ * @param entity 查询条件
+ * @return 模型管理列表
*/
- @PostMapping("/insertLog")
- public AjaxResult insertLog(DataSetLogEntity log) {
- return null;
+ @GetMapping("/getAllModels")
+ public TableDataInfo getAllModels(AiModelEntity entity) {
+ try {
+ startPage();
+ List list = dataSetService.getAllModels(entity);
+ return getDataTable(list);
+ } catch (Exception e) {
+ log.error(e.toString(), e);
+ }
+ return getDataTableError(new ArrayList<>());
}
/**
- * 更新日志信息
+ * 查询所有模型
*
- * @param log 数据集日志实体
- * @return 影响的行数
+ * @return 模型管理列表
*/
- @PostMapping("/updateLog")
- public AjaxResult updateLog(DataSetLogEntity log) {
- return null;
+ @GetMapping("/getModelsList")
+ public AjaxResult getModelsList() {
+ return AjaxResult.success(dataSetService.getAllModels(null));
}
/**
- * 根据 ID 删除日志
+ * 插入新的模型
*
- * @param logId 日志 ID
+ * @param entity 模型实体
* @return 影响的行数
*/
- @PostMapping("/deleteLog")
- public AjaxResult deleteLog(Long logId) {
- return null;
+ @PostMapping("/insertModel")
+ public AjaxResult insertModel(@RequestBody AiModelEntity entity) {
+ return dataSetService.insertModel(entity);
+ }
+
+ /**
+ * 更新模型实体
+ *
+ * @param entity 模型实体
+ * @return 影响的行数
+ */
+ @PostMapping("/updateModel")
+ public AjaxResult updateModel(@RequestBody AiModelEntity entity) {
+ return dataSetService.updateModel(entity);
+ }
+
+ /**
+ * 根据 ID 删除模型
+ *
+ * @param modelIds 模型 ID
+ * @return 影响的行数
+ */
+ @DeleteMapping("/deleteModel/{modelIds}")
+ public AjaxResult deleteModel(@PathVariable Long[] modelIds) {
+ return dataSetService.deleteModel(modelIds);
+ }
+
+ /**
+ * 根据 ID 查询算法评价
+ *
+ * @param algorithmId 算法评价 ID
+ * @return 算法评价实体
+ */
+ @GetMapping("/getAlgorithmById/{algorithmId}")
+ public AjaxResult getAlgorithmById(@PathVariable Long algorithmId) {
+ return dataSetService.getAlgorithmById(algorithmId);
+ }
+
+ /**
+ * 查询所有算法评价
+ *
+ * @param entity 查询条件
+ * @return 算法评价列表
+ */
+ @GetMapping("/getAllAlgorithms")
+ public TableDataInfo getAllAlgorithms(DataSetAlgorithm entity) {
+ try {
+ startPage();
+ List list = dataSetService.getAllAlgorithms(entity);
+ return getDataTable(list);
+ } catch (Exception e) {
+ log.error(e.toString(), e);
+ }
+ return getDataTableError(new ArrayList<>());
+ }
+
+ /**
+ * 插入新的算法评价
+ *
+ * @param entity 算法评价实体
+ * @return 影响的行数
+ */
+ @PostMapping("/insertAlgorithm")
+ public AjaxResult insertAlgorithm(@RequestBody DataSetAlgorithm entity) {
+ return dataSetService.insertAlgorithm(entity);
+ }
+
+ /**
+ * 更新算法评价
+ *
+ * @param entity 算法评价实体
+ * @return 影响的行数
+ */
+ @PostMapping("/updateAlgorithm")
+ public AjaxResult updateAlgorithm(@RequestBody DataSetAlgorithm entity) {
+ return dataSetService.updateAlgorithm(entity);
+ }
+
+ /**
+ * 根据 ID 删除算法评价
+ *
+ * @param algorithmIds 算法评价 ID
+ * @return 影响的行数
+ */
+ @DeleteMapping("/deleteAlgorithm/{algorithmIds}")
+ public AjaxResult deleteAlgorithm(@PathVariable Long[] algorithmIds) {
+ return dataSetService.deleteAlgorithm(algorithmIds);
+ }
+
+
+ // 处理多个文件上传
+ @PostMapping("/uploadImgFiles")
+ public AjaxResult uploadImgFiles(@RequestParam("files") MultipartFile[] files, @RequestParam("datasetId") Long datasetId) {
+ if (ObjectUtils.isEmpty(files)) {
+ return AjaxResult.error("请选择文件");
+ }
+ try {
+ AjaxResult ajaxResult = remoteFileService.uploadFile(files);
+ if (ajaxResult.isSuccess()) {
+ List