Browse Source

处理LUJ

dev-restore_mount
fanshuai 1 year ago
parent
commit
23c2bb1770
3 changed files with 13 additions and 5 deletions
  1. +8
    -3
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java
  2. +3
    -2
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/DVCUtils.java
  3. +2
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/NewDatasetVo.java

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

@@ -113,7 +113,9 @@ public class NewDatasetServiceImpl implements NewDatasetService {
datasetVo.setIdentifier(repositoryName); datasetVo.setIdentifier(repositoryName);
datasetVo.setId(gitlinIid); datasetVo.setId(gitlinIid);
datasetVo.setOwner((String) userInfo.get("login")); datasetVo.setOwner((String) userInfo.get("login"));

if (StringUtils.isEmpty(datasetVo.getDatasetSource())){
datasetVo.setDatasetSource("用户上传");
}
YamlUtils.generateYamlFile(JsonUtils.objectToMap(datasetVo), localPath, "dataset"); YamlUtils.generateYamlFile(JsonUtils.objectToMap(datasetVo), localPath, "dataset");
// dvc init 初始化 // dvc init 初始化
DVCUtils.dvcInit(localPath); DVCUtils.dvcInit(localPath);
@@ -182,6 +184,9 @@ public class NewDatasetServiceImpl implements NewDatasetService {
datasetVo.setIdentifier(repositoryName); datasetVo.setIdentifier(repositoryName);
datasetVo.setId(datasetVo.getId()); datasetVo.setId(datasetVo.getId());
datasetVo.setOwner((String) userInfo.get("login")); datasetVo.setOwner((String) userInfo.get("login"));
if (StringUtils.isEmpty(datasetVo.getDatasetSource())){
datasetVo.setDatasetSource("用户上传");
}
YamlUtils.generateYamlFile(JsonUtils.objectToMap(datasetVo), localPath, "dataset"); YamlUtils.generateYamlFile(JsonUtils.objectToMap(datasetVo), localPath, "dataset");


// dvc init 初始化 // dvc init 初始化
@@ -269,9 +274,9 @@ public class NewDatasetServiceImpl implements NewDatasetService {
version = (String) versionList.get(0).get("name"); version = (String) versionList.get(0).get("name");
} }


List<Map<String, Object>> fileDetailsAfterGitPull = DVCUtils.getFileDetailsAfterGitPull("E:\\test\\" +id, repositoryName, version, "data",gitLinkUsername, gitLinkPassword);
List<Map<String, Object>> fileDetailsAfterGitPull = DVCUtils.getFileDetailsAfterGitPull(localPathlocal +id, repositoryName, version, "data",gitLinkUsername, gitLinkPassword);
// 在localPathlocal+id+"/"+repositoryName目录下的dataset.yaml中取到元数据 // 在localPathlocal+id+"/"+repositoryName目录下的dataset.yaml中取到元数据
Map<String, Object> stringObjectMap = YamlUtils.loadYamlFile("E:\\test\\" + id + "\\" + repositoryName + "\\" + "dataset.yaml");
Map<String, Object> stringObjectMap = YamlUtils.loadYamlFile(localPathlocal + id + "\\" + repositoryName + "\\" + "dataset.yaml");
NewDatasetVo newDatasetVo = ConvertUtil.convertMapToObject(stringObjectMap, NewDatasetVo.class); NewDatasetVo newDatasetVo = ConvertUtil.convertMapToObject(stringObjectMap, NewDatasetVo.class);
List<VersionVo> versionVos = new ArrayList<VersionVo>(); List<VersionVo> versionVos = new ArrayList<VersionVo>();
if (fileDetailsAfterGitPull!=null&&fileDetailsAfterGitPull.size()>0){ if (fileDetailsAfterGitPull!=null&&fileDetailsAfterGitPull.size()>0){


+ 3
- 2
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/DVCUtils.java View File

@@ -200,14 +200,15 @@ public class DVCUtils {
// 切换到指定目录 // 切换到指定目录
Path repoPath = Paths.get(localPath, repoFolder, branch); Path repoPath = Paths.get(localPath, repoFolder, branch);


//刷新
//刷新 TODO
// gitFetch(localPath, username, password); // gitFetch(localPath, username, password);
// // 切换到指定分支 // // 切换到指定分支
// gitCheckoutBranch(localPath, branch); // gitCheckoutBranch(localPath, branch);
// // 执行git pull // // 执行git pull
// gitPull(localPath, username, password); // gitPull(localPath, username, password);
// 读取data文件夹中的文件列表 // 读取data文件夹中的文件列表
Path dataPath = Paths.get(repoPath.toString(), filePath);
String path = localPath + "\\" + repoFolder + "\\" + filePath;
Path dataPath = Paths.get(path);
File[] files = dataPath.toFile().listFiles(); File[] files = dataPath.toFile().listFiles();


if (files != null) { if (files != null) {


+ 2
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/NewDatasetVo.java View File

@@ -58,5 +58,7 @@ public class NewDatasetVo implements Serializable {
private String processingCode; private String processingCode;
@ApiModelProperty(name = "owner",value = "项目所有者") @ApiModelProperty(name = "owner",value = "项目所有者")
private String owner; private String owner;
@ApiModelProperty(name = "dataset_source",value = "数据集来源")
private String datasetSource;


} }

Loading…
Cancel
Save