mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 09:35:29 +08:00
update 优化保存文件的大小,方便前端进行分片下载
This commit is contained in:
parent
5baf342478
commit
26643d9cd5
@ -200,7 +200,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
// 保存文件信息
|
||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), uploadResult);
|
||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), uploadResult, String.valueOf(file.getSize()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -216,17 +216,18 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
OssClient storage = OssFactory.instance();
|
||||
UploadResult uploadResult = storage.uploadSuffix(file, suffix);
|
||||
// 保存文件信息
|
||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), uploadResult);
|
||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), uploadResult, String.valueOf(file.length()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private SysOssVo buildResultEntity(String originalfileName, String suffix, String configKey, UploadResult uploadResult) {
|
||||
private SysOssVo buildResultEntity(String originalfileName, String suffix, String configKey, UploadResult uploadResult, String ext1) {
|
||||
SysOss oss = new SysOss();
|
||||
oss.setUrl(uploadResult.getUrl());
|
||||
oss.setFileSuffix(suffix);
|
||||
oss.setFileName(uploadResult.getFilename());
|
||||
oss.setOriginalName(originalfileName);
|
||||
oss.setService(configKey);
|
||||
oss.setExt1(ext1);
|
||||
baseMapper.insert(oss);
|
||||
SysOssVo sysOssVo = MapstructUtils.convert(oss, SysOssVo.class);
|
||||
return this.matchingUrl(sysOssVo);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user