hby100japp功能,语音音量增加
This commit is contained in:
@ -68,6 +68,13 @@ public interface ISysOssService {
|
||||
*/
|
||||
SysOssVo updateHash(MultipartFile file, String hash);
|
||||
|
||||
/**
|
||||
* 更新文件 hash 值
|
||||
*
|
||||
* @param file 文件对象
|
||||
* @return 匹配的 SysOssVo 列表
|
||||
*/
|
||||
SysOssVo updateHash(File file, String hash);
|
||||
/**
|
||||
* 上传 MultipartFile 到对象存储服务,并保存文件信息到数据库
|
||||
*
|
||||
|
||||
@ -226,6 +226,22 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), uploadResult, hash);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysOssVo updateHash(File file, String hash) {
|
||||
// 2. 先根据 hash 查库(秒传)
|
||||
SysOssVo exist = baseMapper.selectByHash(hash);
|
||||
if (exist != null) {
|
||||
return exist;
|
||||
}
|
||||
|
||||
String originalfileName = file.getName();
|
||||
String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length());
|
||||
OssClient storage = OssFactory.instance();
|
||||
UploadResult uploadResult = storage.uploadSuffix(file, suffix);
|
||||
// 保存文件信息
|
||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), uploadResult, hash);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传 MultipartFile 到对象存储服务,并保存文件信息到数据库
|
||||
|
||||
Reference in New Issue
Block a user