mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-10-14 06:00:23 +00:00
update 优化 oss远程接口增加扩展字段存储
This commit is contained in:
@@ -41,4 +41,9 @@ public class RemoteFile implements Serializable {
|
||||
*/
|
||||
private String fileSuffix;
|
||||
|
||||
/**
|
||||
* 扩展字段
|
||||
*/
|
||||
private String ext1;
|
||||
|
||||
}
|
||||
|
@@ -7,11 +7,13 @@ import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.json.utils.JsonUtils;
|
||||
import org.dromara.common.oss.core.OssClient;
|
||||
import org.dromara.common.oss.entity.UploadResult;
|
||||
import org.dromara.common.oss.factory.OssFactory;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.resource.api.domain.RemoteFile;
|
||||
import org.dromara.resource.domain.SysOssExt;
|
||||
import org.dromara.resource.domain.bo.SysOssBo;
|
||||
import org.dromara.resource.domain.vo.SysOssVo;
|
||||
import org.dromara.resource.service.ISysOssService;
|
||||
@@ -50,6 +52,10 @@ public class RemoteFileServiceImpl implements RemoteFileService {
|
||||
oss.setFileName(uploadResult.getFilename());
|
||||
oss.setOriginalName(originalFilename);
|
||||
oss.setService(storage.getConfigKey());
|
||||
SysOssExt ext1 = new SysOssExt();
|
||||
ext1.setFileSize((long) file.length);
|
||||
String extStr = JsonUtils.toJsonString(ext1);
|
||||
oss.setExt1(extStr);
|
||||
sysOssService.insertByBo(oss);
|
||||
RemoteFile sysFile = new RemoteFile();
|
||||
sysFile.setOssId(oss.getOssId());
|
||||
@@ -57,6 +63,7 @@ public class RemoteFileServiceImpl implements RemoteFileService {
|
||||
sysFile.setUrl(uploadResult.getUrl());
|
||||
sysFile.setOriginalName(originalFilename);
|
||||
sysFile.setFileSuffix(suffix);
|
||||
sysFile.setExt1(extStr);
|
||||
return sysFile;
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件失败", e);
|
||||
|
Reference in New Issue
Block a user