优化文件下载
This commit is contained in:
parent
68d09fa06d
commit
93d9ef8c93
|
@ -132,8 +132,8 @@ public class NewDatasetFromGitController {
|
|||
*/
|
||||
@GetMapping("/downloadAllFiles")
|
||||
@ApiOperation(value = "下载同一版本下所有数据集,并打包")
|
||||
public ResponseEntity<InputStreamResource> downloadAllDatasetFiles(@RequestParam("name") String name, @RequestParam("id") Integer id, @RequestParam("version") String version) throws Exception {
|
||||
return newDatasetService.downloadAllDatasetFilesNew(name, id, version);
|
||||
public ResponseEntity<InputStreamResource> downloadAllDatasetFiles(@RequestParam("name") String name, @RequestParam("identifier") String identifier, @RequestParam("id") Integer id, @RequestParam("version") String version) throws Exception {
|
||||
return newDatasetService.downloadAllDatasetFilesNew(name, identifier, id, version);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,8 +50,8 @@ public class NewModelFromGitController {
|
|||
|
||||
@GetMapping("/downloadAllFiles")
|
||||
@ApiOperation(value = "下载同一版本下所有模型,并打包")
|
||||
public ResponseEntity<InputStreamResource> downloadAllDatasetFiles(@RequestParam("name") String name, @RequestParam("id") Integer id, @RequestParam("version") String version) throws Exception {
|
||||
return modelsService.downloadAllModelFilesNew(name, id, version);
|
||||
public ResponseEntity<InputStreamResource> downloadAllDatasetFiles(@RequestParam("name") String name, @RequestParam("identifier") String identifier, @RequestParam("id") Integer id, @RequestParam("version") String version) throws Exception {
|
||||
return modelsService.downloadAllModelFilesNew(name, identifier, id, version);
|
||||
}
|
||||
|
||||
@GetMapping("/downloadSingleFile")
|
||||
|
|
|
@ -93,7 +93,7 @@ public interface ModelsService {
|
|||
|
||||
List<Map<String, String>> uploadModelLocal(MultipartFile[] files, String uuid) throws Exception;
|
||||
|
||||
ResponseEntity<InputStreamResource> downloadAllModelFilesNew(String identifier, Integer id, String version) throws IOException, Exception;
|
||||
ResponseEntity<InputStreamResource> downloadAllModelFilesNew(String name, String identifier, Integer id, String version) throws IOException, Exception;
|
||||
|
||||
Page<ModelsVo> newPubilcQueryByPage(ModelsVo modelsVo, PageRequest pageRequest) throws Exception;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ public interface NewDatasetService {
|
|||
String newCreateVersion(NewDatasetVo datasetVo) throws Exception;
|
||||
List<Map<String, String>> uploadDatasetlocal(MultipartFile[] files, String uuid) throws Exception;
|
||||
ResponseEntity<InputStreamResource> downloadDatasetlocal(String filePath) throws Exception;
|
||||
ResponseEntity<InputStreamResource> downloadAllDatasetFilesNew(String name,Integer id, String version) throws IOException, Exception;
|
||||
ResponseEntity<InputStreamResource> downloadAllDatasetFilesNew(String name, String identifier, Integer id, String version) throws IOException, Exception;
|
||||
Page<NewDatasetVo> newPersonalQueryByPage(Dataset dataset, PageRequest pageRequest) throws Exception;
|
||||
Page<NewDatasetVo> newPubilcQueryByPage(Dataset dataset, PageRequest pageRequest) throws Exception;
|
||||
|
||||
|
|
|
@ -789,7 +789,7 @@ public class ModelsServiceImpl implements ModelsService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<InputStreamResource> downloadAllModelFilesNew(String identifier, Integer id, String version) throws Exception {
|
||||
public ResponseEntity<InputStreamResource> downloadAllModelFilesNew(String name, String identifier, Integer id, String version) throws Exception {
|
||||
// 命令行操作 git clone 项目地址
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
String ci4sUsername = loginUser.getUsername();
|
||||
|
@ -820,7 +820,7 @@ public class ModelsServiceImpl implements ModelsService {
|
|||
InputStreamResource resource = new InputStreamResource(new FileInputStream(zipFile));
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + identifier + "_" + version + "_model.zip")
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + name + "_" + version + "_model.zip")
|
||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.contentLength(zipFile.length())
|
||||
.body(resource);
|
||||
|
|
|
@ -394,14 +394,10 @@ public class NewDatasetServiceImpl implements NewDatasetService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<InputStreamResource> downloadAllDatasetFilesNew(String name, Integer id, String version) throws Exception {
|
||||
public ResponseEntity<InputStreamResource> downloadAllDatasetFilesNew(String name, String identifier, Integer id, String version) throws Exception {
|
||||
// 命令行操作 git clone 项目地址
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
String ci4sUsername = loginUser.getUsername();
|
||||
Jedis jedis = new Jedis(redisHost, redisPort);
|
||||
String userReq = jedis.get(ci4sUsername + "_gitUserInfo");
|
||||
Map<String, Object> userInfo = JsonUtils.jsonToMap(userReq);
|
||||
String localPath = localPathlocal + loginUser.getUsername() + "/datasets/" + id + "/" + name;
|
||||
String localPath = localPathlocal + loginUser.getUsername() + "/datasets/" + id + "/" + identifier;
|
||||
|
||||
// 打包 data 文件夹
|
||||
String dataFolderPath = localPath + "/data";
|
||||
|
|
Loading…
Reference in New Issue