Browse Source

Merge branch 'dev' of https://gitlink.org.cn/ci4s/ci4sManagement-cloud into dev

pull/7/head
fanshuai 1 year ago
parent
commit
bd52e64cb3
5 changed files with 26 additions and 18 deletions
  1. +1
    -2
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/dataset/DatasetVersionController.java
  2. +3
    -6
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/ModelsVersionController.java
  3. +21
    -8
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetServiceImpl.java
  4. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetVersionServiceImpl.java
  5. +0
    -1
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/WorkflowDaoMapper.xml

+ 1
- 2
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/dataset/DatasetVersionController.java View File

@@ -87,14 +87,13 @@ public class DatasetVersionController {
* @param datasetVersions 实体 * @param datasetVersions 实体
* @return 新增结果 * @return 新增结果
*/ */
@PostMapping(("/addDatasetVersions"))
@PostMapping("/addDatasetVersions")
@ApiOperation("添加数据集版本") @ApiOperation("添加数据集版本")
public AjaxResult addDatasetVersions(@RequestBody List<DatasetVersion> datasetVersions) throws Exception { public AjaxResult addDatasetVersions(@RequestBody List<DatasetVersion> datasetVersions) throws Exception {
return AjaxResult.success(this.datasetVersionService.addDatasetVersions(datasetVersions)); return AjaxResult.success(this.datasetVersionService.addDatasetVersions(datasetVersions));
} }





/** /**
* 编辑数据 * 编辑数据
* *


+ 3
- 6
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/ModelsVersionController.java View File

@@ -67,9 +67,6 @@ public class ModelsVersionController {
} }







/** /**
* 新增数据 * 新增数据
* *
@@ -84,11 +81,11 @@ public class ModelsVersionController {
/** /**
* 批量新增模型版本 * 批量新增模型版本
* *
* @param datasetVersions 实体
* @param modelsVersions 实体
* @return 新增结果 * @return 新增结果
*/ */
@PostMapping(("/addDatasetVersions"))
@ApiOperation("添加数据集版本")
@PostMapping("/addModelVersions")
@ApiOperation("添加模型版本")
public AjaxResult addModelVersions(@RequestBody List<ModelsVersion> modelsVersions) throws Exception { public AjaxResult addModelVersions(@RequestBody List<ModelsVersion> modelsVersions) throws Exception {
return AjaxResult.success(this.modelsVersionService.addModelVersions(modelsVersions)); return AjaxResult.success(this.modelsVersionService.addModelVersions(modelsVersions));
} }


+ 21
- 8
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetServiceImpl.java View File

@@ -184,16 +184,16 @@ public class DatasetServiceImpl implements DatasetService {
*/ */


@Override @Override
public ResponseEntity<InputStreamResource> downloadDataset(Integer id) {
public ResponseEntity<InputStreamResource> downloadDataset(Integer id) throws Exception {
DatasetVersion datasetVersion = this.datasetVersionDao.queryById(id); DatasetVersion datasetVersion = this.datasetVersionDao.queryById(id);
if (datasetVersion == null) { if (datasetVersion == null) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
throw new Exception("未找到该版本下数据集");
} }


// 从数据库中获取存储路径(即MinIO中的对象名称) // 从数据库中获取存储路径(即MinIO中的对象名称)
String objectName = datasetVersion.getUrl(); String objectName = datasetVersion.getUrl();
if(objectName == null || objectName.isEmpty() ){ if(objectName == null || objectName.isEmpty() ){
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
throw new Exception("未找到该版本数据集文件");
} }


try { try {
@@ -210,7 +210,7 @@ public class DatasetServiceImpl implements DatasetService {


} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
throw new Exception("下载数据集文件错误");
} }
} }


@@ -362,15 +362,28 @@ public class DatasetServiceImpl implements DatasetService {




public void checkDeclaredName(Dataset insert) throws Exception { public void checkDeclaredName(Dataset insert) throws Exception {
Dataset dataset = datasetDao.findByName(insert.getName());
if (dataset != null) {
Dataset existingDataset = datasetDao.findByName(insert.getName());
if (existingDataset != null) {
// Check if the found dataset is not the same as the one being inserted
// This is important if you are using this method for both insert and update operations
// You may need an identifier check here, e.g., if 'insert' has an ID and it's the same as 'existingDataset'
if (insert.getId() != null && insert.getId().equals(existingDataset.getId())) {
// This is the same dataset, no duplicate name issue for update operation
return;
}

// Now we know there's another dataset with the same name
Field[] fields = Dataset.class.getDeclaredFields(); Field[] fields = Dataset.class.getDeclaredFields();
for (Field field : fields) { for (Field field : fields) {
if (field.isAnnotationPresent(CheckDuplicate.class)) {
field.setAccessible(true); // Make private fields accessible

if ("name".equals(field.getName()) && field.isAnnotationPresent(CheckDuplicate.class)) {
// If the field is 'name' and is marked with CheckDuplicate annotation
CheckDuplicate annotation = field.getAnnotation(CheckDuplicate.class); CheckDuplicate annotation = field.getAnnotation(CheckDuplicate.class);
throw new Exception(field.getName()+ annotation.message());
throw new Exception("重复的数据集名称: " + insert.getName() + ". " + annotation.message());
} }
} }
} }
} }

} }

+ 1
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetVersionServiceImpl.java View File

@@ -181,7 +181,7 @@ public class DatasetVersionServiceImpl implements DatasetVersionService {
} }


private void insertPrepare(DatasetVersion datasetVersion) throws Exception { private void insertPrepare(DatasetVersion datasetVersion) throws Exception {
checkDeclaredVersion(datasetVersion);
//checkDeclaredVersion(datasetVersion);
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
datasetVersion.setCreateBy(loginUser.getUsername()); datasetVersion.setCreateBy(loginUser.getUsername());
datasetVersion.setUpdateBy(loginUser.getUsername()); datasetVersion.setUpdateBy(loginUser.getUsername());


+ 0
- 1
ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/WorkflowDaoMapper.xml View File

@@ -171,7 +171,6 @@
<where> <where>
state = 1 state = 1
<if test="workflow.name != null and workflow.name != ''"> <if test="workflow.name != null and workflow.name != ''">

and name like "%"#{workflow.name}"%" and name like "%"#{workflow.name}"%"
</if> </if>
</where> </where>


Loading…
Cancel
Save