feat(sis):
- 图像库图片改为通过ossId获取 - SisPersonLibImg 字段 imgUrl 更改为 imgOssId,类型同步更改 - 移除SisDeviceManage 中的 accessControlId 字段
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.dromara.resource.dubbo;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
@@ -18,6 +19,7 @@ import org.dromara.resource.service.ISysOssService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -82,8 +84,18 @@ public class RemoteFileServiceImpl implements RemoteFileService {
|
||||
* @return 列表
|
||||
*/
|
||||
@Override
|
||||
public List<RemoteFile> selectByIds(String ossIds){
|
||||
public List<RemoteFile> selectByIds(String ossIds) {
|
||||
List<SysOssVo> sysOssVos = sysOssService.listByIds(StringUtils.splitTo(ossIds, Convert::toLong));
|
||||
return MapstructUtils.convert(sysOssVos, RemoteFile.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件下载方法,支持一次性下载完整文件
|
||||
*
|
||||
* @param ossId OSS对象ID
|
||||
* @return byte[] 返回下载的字节数组
|
||||
*/
|
||||
public byte[] downloadToByteArray(Long ossId) throws IOException {
|
||||
return sysOssService.downloadToByteArray(ossId);
|
||||
}
|
||||
}
|
||||
|
@@ -92,4 +92,12 @@ public interface ISysOssService {
|
||||
* @return 结果
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 文件下载方法,支持一次性下载完整文件
|
||||
*
|
||||
* @param ossId OSS对象ID
|
||||
* @return byte[] 返回下载的字节数组
|
||||
*/
|
||||
byte[] downloadToByteArray(Long ossId) throws IOException;
|
||||
}
|
||||
|
@@ -159,6 +159,24 @@ public class SysOssServiceImpl implements ISysOssService {
|
||||
storage.download(sysOss.getFileName(), response.getOutputStream(), response::setContentLengthLong);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件下载方法,支持一次性下载完整文件
|
||||
*
|
||||
* @param ossId OSS对象ID
|
||||
* @return byte[] 返回下载的字节数组
|
||||
*/
|
||||
@Override
|
||||
public byte[] downloadToByteArray(Long ossId) throws IOException {
|
||||
SysOssVo sysOss = SpringUtils.getAopProxy(this).getById(ossId);
|
||||
if (ObjectUtil.isNull(sysOss)) {
|
||||
throw new ServiceException("文件数据不存在!");
|
||||
}
|
||||
// FileUtils.setAttachmentResponseHeader(response, sysOss.getOriginalName());
|
||||
// response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8");
|
||||
OssClient storage = OssFactory.instance(sysOss.getService());
|
||||
return storage.downloadToByteArray(sysOss.getFileName());
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传 MultipartFile 到对象存储服务,并保存文件信息到数据库
|
||||
*
|
||||
|
Reference in New Issue
Block a user