加上通过url上传文件-构建链接加上注释

This commit is contained in:
xudawei 2024-04-29 20:45:14 +08:00
parent b3f26b9395
commit afbec95fc9

View File

@ -835,13 +835,17 @@ public class FileServiceImpl implements FileService {
if (CollectionUtil.isEmpty(dto.getFileKeys())) {
return Lists.newArrayList();
}
//构建http入参的对象集合
//1 构建普通http入参的对象集合
// 比如https://axzo-public.oss-cn-chengdu.aliyuncs.com/cms/cms/70958a6c0f3948439c7f1a03e4ce6292.png
List<SignUrlDownloadResponse> httpUrlResList = this.buildHttpUrlNotSignResponse(dto);
//2 构建临时授权http入参的对象集合(链接中包含Expires)
// 比如https://xx.myhuaweicloud.com:443/identity/b4148fbee6954c2fa3139471f18a2dcd.jpg?AccessKeyId=xx&Expires=xx&Signature=xx
List<SignUrlDownloadResponse> httpUrlSignResList = this.buildHttpUrlSignResponse(dto);
//构建fileKey入参对象集合
//3 构建fileKey入参对象集合
List<SignUrlDownloadResponse> fileKeyResList = this.buildFileKeyResponse(dto.getFileKeys(), dto.getBizScene());
//4 1/2/3集合累加
httpUrlResList.addAll(fileKeyResList);
httpUrlResList.addAll(httpUrlSignResList);
log.info("signUrl download end result = {}, times:{}", JsonUtil.obj2Str(httpUrlResList), System.currentTimeMillis() - start);
@ -962,6 +966,10 @@ public class FileServiceImpl implements FileService {
}).collect(Collectors.toList());
}
/**
* 从链接中提取fileKey比如如下链接获取fileKey:b4148fbee6954c2fa3139471f18a2dcd
* https://xx/identity/b4148fbee6954c2fa3139471f18a2dcd.jpg?AccessKeyId=xx&Expires=xx&response-content-disposition=xx&Signature=xx
*/
private String signUrlToFileKey(String signUrl) {
if (StringUtils.isBlank(signUrl)) {
return StringUtils.EMPTY;