Browse Source

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

dev-DXTZYK
fanshuai 1 year ago
parent
commit
6f8e2eea1a
3 changed files with 17 additions and 5 deletions
  1. +15
    -4
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java
  2. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/DVCUtils.java
  3. +1
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/FileUtil.java

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

@@ -596,7 +596,7 @@ public class ModelsServiceImpl implements ModelsService {
String rootPath = localPath + ci4sUsername + "/model/" + gitlinIid + "/" + repositoryName;
String modelPath = rootPath + "/model";
String metaPath = rootPath + "/metadata";
String relatePath = ci4sUsername + "/model/" + gitlinIid + "/" + repositoryName+ "/model";
String relatePath = ci4sUsername + "/model/" + gitlinIid + "/" + repositoryName + "/model";

dvcUtils.gitClone(rootPath, projectUrl, branchName, gitLinkUsername, gitLinkPassword);
//干掉目标文件夹
@@ -675,6 +675,10 @@ public class ModelsServiceImpl implements ModelsService {
String gitLinkUsername = loginUser.getSysUser().getGitLinkUsername();
String gitLinkPassword = loginUser.getSysUser().getGitLinkPassword();

// String ci4sUsername = "admin";
// String gitLinkUsername = "fanshuai";
// String gitLinkPassword = "h1n2x3j4y5@";

Map<String, Object> userInfo = getUserInfo(ci4sUsername, gitLinkUsername, gitLinkPassword);

String repositoryName = modelsVo.getIdentifier() == null ? ci4sUsername + "_model_" + DateUtils.dateTimeNow() : modelsVo.getIdentifier();
@@ -690,7 +694,6 @@ public class ModelsServiceImpl implements ModelsService {
String owner = (String) userInfo.get("login");

String projectUrl = gitendpoint + "/" + owner + "/" + repositoryName + ".git";
String sourcePath = modelsVo.getModelVersionVos().get(0).getUrl();
String rootPath = localPath + ci4sUsername + "/model/" + modelsVo.getId() + "/" + repositoryName;
String modelPath = rootPath + "/model";
String metaPath = rootPath + "/metadata";
@@ -709,7 +712,15 @@ public class ModelsServiceImpl implements ModelsService {
dvcUtils.dvcCheckout(rootPath);
//干掉目标文件夹
dvcUtils.deleteDirectory(modelPath);
dvcUtils.moveFiles(sourcePath, modelPath);
if (modelsVo.getModelVersionVos().size() != 0) {
String sourcePath = modelsVo.getModelVersionVos().get(0).getUrl();
dvcUtils.moveFiles(sourcePath, modelPath);
}

if (modelsVo.getModelVersionVos().size() != 0) {
String sourcePath = modelsVo.getModelVersionVos().get(0).getUrl();
dvcUtils.moveFiles(sourcePath, modelPath);
}

//拼接生产的元数据后写入yaml文件
ModelMetaVo modelMetaVo = new ModelMetaVo();
@@ -779,7 +790,7 @@ public class ModelsServiceImpl implements ModelsService {
// 构建objectName
String username = SecurityUtils.getLoginUser().getUsername();
String fileName = file.getOriginalFilename();
String path = localPath + "/temp/" + username + "/models/" + uuid;
String path = localPath + "temp/" + username + "/models/" + uuid;
long sizeInBytes = file.getSize();
String formattedSize = FileUtil.formatFileSize(sizeInBytes);
File targetFile = new File(path, file.getOriginalFilename());


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

@@ -635,6 +635,6 @@ public class DVCUtils {
} catch (Exception e) {
log.error("Error occurred while getting file details after git pull", e);
}
return null;
return new ArrayList<>();
}
}

+ 1
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/FileUtil.java View File

@@ -101,4 +101,5 @@ public class FileUtil {
}
return fileInfoList;
}

}

Loading…
Cancel
Save