diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/FileController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/FileController.java index 76b707c..7b2cc69 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/FileController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/FileController.java @@ -7,7 +7,6 @@ import com.mcwl.resource.domain.request.RequestFile; import com.mcwl.resource.service.impl.FileServiceImpl; import com.mcwl.web.controller.common.OssUtil; import com.obs.services.ObsClient; -import com.obs.services.exception.ObsException; import com.obs.services.model.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -294,44 +293,4 @@ public class FileController { } - @GetMapping("/test") - public R test(@RequestParam String filePath,String objectkey){ - - try { - - UploadFileRequest request = new UploadFileRequest(bucketName, objectkey); - // 设置待上传的本地文件,localfile为待上传的本地文件路径,需要指定到具体带文件后缀的文件名 - request.setUploadFile(filePath); - // 设置分段上传时的最大并发数 - request.setTaskNum(5); - // 设置分段大小为10MB - request.setPartSize(10 * 1024 * 1024); - // 开启断点续传模式 - request.setEnableCheckpoint(true); - // 进行断点续传上传 - CompleteMultipartUploadResult result = obsClient.uploadFile(request); - - log.info("上传完成:{}",result); - System.out.println("UploadFile successfully"); - } catch (ObsException e) { - // 发生异常时可再次调用断点续传上传接口进行重新上传 - System.out.println("UploadFile failed"); - // 请求失败,打印http状态码 - System.out.println("HTTP Code:" + e.getResponseCode()); - // 请求失败,打印服务端错误码 - System.out.println("Error Code:" + e.getErrorCode()); - // 请求失败,打印详细错误信息 - System.out.println("Error Message:" + e.getErrorMessage()); - // 请求失败,打印请求id - System.out.println("Request ID:" + e.getErrorRequestId()); - System.out.println("Host ID:" + e.getErrorHostId()); - e.printStackTrace(); - } catch (Exception e) { - System.out.println("UploadFile failed"); - // 其他异常信息打印 - e.printStackTrace(); - } - - return R.ok(); - } } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java index c1b09b2..d64a17f 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java @@ -206,4 +206,7 @@ public class ModelVersion extends BaseEntity { @ApiModelProperty(value = "文件hash") private String fileHash; + @ApiModelProperty(value = "加密后文件新名字") + private String encryptFileName; + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestFile.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestFile.java index 0093962..dcce50c 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestFile.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestFile.java @@ -49,4 +49,9 @@ public class RequestFile { */ private String encryptFileSize; + /** + * 加密后新文件名字 + */ + private String encryptFileName; + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/FileServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/FileServiceImpl.java index ecff1f7..ac65431 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/FileServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/FileServiceImpl.java @@ -121,7 +121,8 @@ public class FileServiceImpl implements FileService { ModelVersion modelVersion = ModelVersion.builder().id(requestFile.getId()) .keyRate(requestFile.getKeyRate()) .encryptionFilePath(requestFile.getEncryptionFilePath()) - .encryptionObjectKey(requestFile.getEncryptionObjectKey()).build(); + .encryptionObjectKey(requestFile.getEncryptionObjectKey()) + .encryptFileName(requestFile.getEncryptFileName()).build(); versionMapper.updateById(modelVersion); diff --git a/mcwl-resource/src/main/resources/mapper/resource/ModelVersionMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/ModelVersionMapper.xml index 23b74ee..a848edd 100644 --- a/mcwl-resource/src/main/resources/mapper/resource/ModelVersionMapper.xml +++ b/mcwl-resource/src/main/resources/mapper/resource/ModelVersionMapper.xml @@ -49,7 +49,7 @@