feat:(REQ-3540) 获取上传地址,如果入参中有fileKey
This commit is contained in:
parent
5d03e66a00
commit
8329be13ef
@ -65,4 +65,9 @@ public class ApiSignUrlUploadRequest {
|
||||
* 桶key
|
||||
*/
|
||||
private String bucketKey;
|
||||
|
||||
/**
|
||||
* 文件key
|
||||
*/
|
||||
private String fileKey;
|
||||
}
|
||||
|
||||
@ -67,4 +67,9 @@ public class SignUrlUploadDto {
|
||||
* 桶key
|
||||
*/
|
||||
private String bucketKey;
|
||||
|
||||
/**
|
||||
* 文件key
|
||||
*/
|
||||
private String fileKey;
|
||||
}
|
||||
|
||||
@ -37,6 +37,10 @@ public class HandleFileService extends WithFileService{
|
||||
|
||||
public SignUrlUploadResponse doSaveFile(SignUrlUploadDto dto, FileUploadConfig fileUploadConfig, FileBusinessScene scene, AppChannelBucket appChannelBucket, String fileFormat) {
|
||||
String uuid = Utility.getUUID();
|
||||
//如果fileKey不为空,则以fileKey为准
|
||||
if (StringUtils.isNotBlank(dto.getFileKey())) {
|
||||
uuid = dto.getFileKey();
|
||||
}
|
||||
// 生成上传文件的唯一key
|
||||
String tgtFileKey = Utility.generateFileKey(fileUploadConfig.getDirectory(), uuid, fileFormat);
|
||||
// 失效时间
|
||||
@ -68,6 +72,8 @@ public class HandleFileService extends WithFileService{
|
||||
|
||||
private File saveOssFile(FileUploadConfig fileUploadConfig, String fileName, String fileConform, String uuid,
|
||||
String fileUrl, String fileMd5, Long expiration) {
|
||||
File byFileUuid = this.fileDao.getByFileUuid(uuid);
|
||||
if (Objects.isNull(byFileUuid) || Objects.isNull(byFileUuid.getId())) {
|
||||
File ossFile = new File();
|
||||
ossFile.setAppChannelBucketNo(fileUploadConfig.getAppChannelBucketNo());
|
||||
ossFile.setAppCode(fileUploadConfig.getAppCode());
|
||||
@ -87,6 +93,8 @@ public class HandleFileService extends WithFileService{
|
||||
fileDao.save(ossFile);
|
||||
return ossFile;
|
||||
}
|
||||
return byFileUuid;
|
||||
}
|
||||
|
||||
|
||||
// @Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user