|
|
@ -44,7 +44,6 @@ import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -128,7 +127,8 @@ public class SysOssServiceImpl implements ISysOssService, OssService { |
|
|
|
throw new ServiceException("文件数据不存在!"); |
|
|
|
} |
|
|
|
this.downloadLocal(sysOss.getFileName(),sysOss.getOriginalName(),response,false); |
|
|
|
/* FileUtils.setAttachmentResponseHeader(response, sysOss.getOriginalName()); |
|
|
|
|
|
|
|
/*FileUtils.setAttachmentResponseHeader(response, sysOss.getOriginalName()); |
|
|
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8"); |
|
|
|
OssClient storage = OssFactory.instance(sysOss.getService()); |
|
|
|
try(InputStream inputStream = storage.getObjectContent(sysOss.getUrl())) { |
|
|
@ -140,6 +140,8 @@ public class SysOssServiceImpl implements ISysOssService, OssService { |
|
|
|
}*/ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void downloadWithCreateBy(Long ossId, String CreateBy, HttpServletResponse response) throws IOException { |
|
|
|
SysOssVo sysOss = baseMapper.selectVoOne(new LambdaQueryWrapper<SysOss>() |
|
|
@ -157,8 +159,8 @@ public class SysOssServiceImpl implements ISysOssService, OssService { |
|
|
|
throw new RuntimeException(StrUtil.format("文件名称({})非法,不允许下载。 ", fileName)); |
|
|
|
} |
|
|
|
String filePath = ProjectConfig.getUploadPath() + fileName; |
|
|
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
|
|
|
FileUtils.setAttachmentResponseHeader(response, originalName); |
|
|
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8"); |
|
|
|
if(isDecrypt){ |
|
|
|
DocumentEncryptionUtil.decryptFile4Download(filePath,response.getOutputStream()); |
|
|
|
}else { |
|
|
|