模型新增加密后新名字
parent
7cf4de3530
commit
e5e70950ae
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,4 +206,7 @@ public class ModelVersion extends BaseEntity {
|
|||
@ApiModelProperty(value = "文件hash")
|
||||
private String fileHash;
|
||||
|
||||
@ApiModelProperty(value = "加密后文件新名字")
|
||||
private String encryptFileName;
|
||||
|
||||
}
|
||||
|
|
|
@ -49,4 +49,9 @@ public class RequestFile {
|
|||
*/
|
||||
private String encryptFileSize;
|
||||
|
||||
/**
|
||||
* 加密后新文件名字
|
||||
*/
|
||||
private String encryptFileName;
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
</update>
|
||||
|
||||
<select id="selectByFileName" resultType="com.mcwl.resource.domain.ModelVersion">
|
||||
select key_rate,is_encrypt from model_version where file_name = #{name}
|
||||
select key_rate,is_encrypt from model_version where encrypt_file_name = #{name}
|
||||
</select>
|
||||
<select id="selectByHash" resultType="com.mcwl.resource.domain.ModelVersion">
|
||||
select * from model_version where file_hash = #{hashCode}
|
||||
|
|
Loading…
Reference in New Issue