Browse Source

修改模型路径

dev-DXTZYK
chenzhihang 1 year ago
parent
commit
296c791671
3 changed files with 24 additions and 6 deletions
  1. +20
    -2
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java
  2. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java
  3. +3
    -3
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java

+ 20
- 2
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java View File

@@ -2,9 +2,11 @@ package com.ruoyi.platform.controller.model;


import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.platform.service.ModelsService; import com.ruoyi.platform.service.ModelsService;
import com.ruoyi.platform.utils.DVCUtils;
import com.ruoyi.platform.vo.ModelsVo; import com.ruoyi.platform.vo.ModelsVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.springframework.core.io.InputStreamResource; import org.springframework.core.io.InputStreamResource;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
@@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;


import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;


@@ -23,6 +26,9 @@ public class NewModelFromGitController {
@Resource @Resource
private ModelsService modelsService; private ModelsService modelsService;


@Resource
private DVCUtils dvcUtils;

@PostMapping("/addModel") @PostMapping("/addModel")
@ApiOperation("添加模型") @ApiOperation("添加模型")
public AjaxResult addModelAndVersion(@RequestBody ModelsVo modelsVo) throws Exception { public AjaxResult addModelAndVersion(@RequestBody ModelsVo modelsVo) throws Exception {
@@ -83,8 +89,8 @@ public class NewModelFromGitController {


@GetMapping("/getModelDetail") @GetMapping("/getModelDetail")
@ApiOperation(value = "获取模型详细信息") @ApiOperation(value = "获取模型详细信息")
public AjaxResult getModelDetail(@RequestParam("id") Integer id, @RequestParam("name") String name, @RequestParam("identifier") String identifier, @RequestParam("owner") String owner, @RequestParam("version") String version) throws Exception {
return AjaxResult.success(this.modelsService.getModelDetail(id, name, identifier, owner, version));
public AjaxResult getModelDetail(@RequestParam("id") Integer id, @RequestParam("identifier") String identifier, @RequestParam("owner") String owner, @RequestParam("version") String version) throws Exception {
return AjaxResult.success(this.modelsService.getModelDetail(id, identifier, owner, version));
} }


@GetMapping("/getModelDependencyTree") @GetMapping("/getModelDependencyTree")
@@ -112,4 +118,16 @@ public class NewModelFromGitController {
this.modelsService.deleteVersion(id, identifier, owner, version, relativePaths); this.modelsService.deleteVersion(id, identifier, owner, version, relativePaths);
return AjaxResult.success(); return AjaxResult.success();
} }

// @GetMapping("/test")
// public AjaxResult test() {
// try {
// dvcUtils.gitPush("E:\\test\\admin\\model\\1451938\\object-model", "fanshuai", "h1n2x3j4y5@");
// } catch (IOException e) {
// throw new RuntimeException(e);
// } catch (GitAPIException e) {
// throw new RuntimeException(e);
// }
// return AjaxResult.success();
// }
} }

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

@@ -101,7 +101,7 @@ public interface ModelsService {


List<Map<String, Object>> getVersionList(String identifier, String owner) throws Exception; List<Map<String, Object>> getVersionList(String identifier, String owner) throws Exception;


ModelsVo getModelDetail(Integer id, String name, String identifier, String owner, String version) throws Exception;
ModelsVo getModelDetail(Integer id, String identifier, String owner, String version) throws Exception;


ModelDependency1TreeVo getModelDependencyTree(Integer repoId, String identifier, String version) throws Exception; ModelDependency1TreeVo getModelDependencyTree(Integer repoId, String identifier, String version) throws Exception;




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

@@ -882,7 +882,7 @@ public class ModelsServiceImpl implements ModelsService {
} }


@Override @Override
public ModelsVo getModelDetail(Integer id, String name, String identifier, String owner, String version) throws Exception {
public ModelsVo getModelDetail(Integer id, String identifier, String owner, String version) throws Exception {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
String ci4sUsername = loginUser.getUsername(); String ci4sUsername = loginUser.getUsername();
String gitLinkUsername = loginUser.getSysUser().getGitLinkUsername(); String gitLinkUsername = loginUser.getSysUser().getGitLinkUsername();
@@ -897,9 +897,9 @@ public class ModelsServiceImpl implements ModelsService {
} }


// git pull操作,然后读取里面的文件列表,列出每个文件的大小和名称,封装成MAP // git pull操作,然后读取里面的文件列表,列出每个文件的大小和名称,封装成MAP
List<Map<String, Object>> fileDetailsAfterGitPull = dvcUtils.getFileDetailsAfterGitPull(localPath + ci4sUsername + "/model/" + id, name, version, "model", gitLinkUsername, gitLinkPassword);
List<Map<String, Object>> fileDetailsAfterGitPull = dvcUtils.getFileDetailsAfterGitPull(localPath + ci4sUsername + "/model/" + id, identifier, version, "model", gitLinkUsername, gitLinkPassword);


Map<String, Object> stringObjectMap = YamlUtils.loadYamlFile(localPath + ci4sUsername + "/model/" + id + "/" + name + "/metadata/metadata.yaml");
Map<String, Object> stringObjectMap = YamlUtils.loadYamlFile(localPath + ci4sUsername + "/model/" + id + "/" + identifier + "/metadata/metadata.yaml");


String jsonString = JSON.toJSONString(stringObjectMap); String jsonString = JSON.toJSONString(stringObjectMap);
ModelsVo modelsVo = JSON.parseObject(jsonString, ModelsVo.class); ModelsVo modelsVo = JSON.parseObject(jsonString, ModelsVo.class);


Loading…
Cancel
Save