| @@ -38,6 +38,12 @@ public class NewModelFromGitController extends BaseController { | |||||
| return AjaxResult.success(this.modelsService.newCreateVersion(modelsVo)); | return AjaxResult.success(this.modelsService.newCreateVersion(modelsVo)); | ||||
| } | } | ||||
| @PutMapping("/updateVersionDesc") | |||||
| @ApiOperation("修改版本描述") | |||||
| public AjaxResult updateVersionDesc(@RequestBody ModelsVo modelsVo) throws Exception { | |||||
| return AjaxResult.success(this.modelsService.updateVersionDesc(modelsVo)); | |||||
| } | |||||
| @CrossOrigin(origins = "*", allowedHeaders = "*") | @CrossOrigin(origins = "*", allowedHeaders = "*") | ||||
| @PostMapping("/upload") | @PostMapping("/upload") | ||||
| @ApiOperation(value = "上传模型", notes = "根据模型id上传模型文件,并将信息存入数据库。") | @ApiOperation(value = "上传模型", notes = "根据模型id上传模型文件,并将信息存入数据库。") | ||||
| @@ -93,6 +93,8 @@ public interface ModelsService { | |||||
| String newCreateVersion(ModelsVo modelsVo) throws Exception; | String newCreateVersion(ModelsVo modelsVo) throws Exception; | ||||
| String updateVersionDesc(ModelsVo modelsVo) throws Exception; | |||||
| List<Map<String, String>> uploadModelLocal(MultipartFile[] files, String uuid) throws Exception; | List<Map<String, String>> uploadModelLocal(MultipartFile[] files, String uuid) throws Exception; | ||||
| ResponseEntity<InputStreamResource> downloadAllModelFilesNew(String name, String identifier, Integer id, String version, Boolean isPublic) throws IOException, Exception; | ResponseEntity<InputStreamResource> downloadAllModelFilesNew(String name, String identifier, Integer id, String version, Boolean isPublic) throws IOException, Exception; | ||||
| @@ -859,6 +859,21 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| return "新增模型版本成功"; | return "新增模型版本成功"; | ||||
| } | } | ||||
| @Override | |||||
| public String updateVersionDesc(ModelsVo modelsVo) throws Exception { | |||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | |||||
| String ci4sUsername = Boolean.TRUE.equals(modelsVo.getIsPublic()) ? Constant.Item_Public : loginUser.getUsername(); | |||||
| String gitLinkUsername = loginUser.getSysUser().getUserName(); | |||||
| String gitLinkPassword = decrypt(loginUser.getSysUser().getOriginPassword()); | |||||
| String repositoryName = modelsVo.getIdentifier(); | |||||
| String branchName = modelsVo.getVersion(); | |||||
| String relatePath = ci4sUsername + "/datasets/" + modelsVo.getId() + "/" + repositoryName + "/" + branchName; | |||||
| String rootPath = localPath + relatePath; | |||||
| YamlUtils.generateYamlFile(JsonUtils.objectToMap(modelsVo), rootPath, "dataset"); | |||||
| dvcUtils.pushNewBranchToRemote(rootPath, gitLinkUsername, gitLinkPassword, branchName); | |||||
| return "更新模型版本成功"; | |||||
| } | |||||
| @Override | @Override | ||||
| public List<Map<String, String>> uploadModelLocal(MultipartFile[] files, String uuid) throws Exception { | public List<Map<String, String>> uploadModelLocal(MultipartFile[] files, String uuid) throws Exception { | ||||