公告结构化
This commit is contained in:
@ -210,20 +210,28 @@ public class WpsController {
|
||||
|
||||
Optional<AttachmentDetail> optional = attachmentClient.findByBusinessId(businessIdList);
|
||||
|
||||
AttachmentDetail detail = optional.get();
|
||||
String fileLength = "10";
|
||||
String fileName = fileId;
|
||||
byte buf[] = new byte[0];
|
||||
|
||||
List<AttachmentEntity> entityList = detail.get(fileId);
|
||||
if(optional!=null&&optional.get()!=null){
|
||||
AttachmentDetail detail = optional.get();
|
||||
|
||||
Optional<byte[]> optional1 = attachmentClient.downloadFileByObjectId(entityList.get(0).getId());
|
||||
List<AttachmentEntity> entityList = detail.get(fileId);
|
||||
|
||||
Optional<byte[]> optional1 = attachmentClient.downloadFileByObjectId(entityList.get(0).getId());
|
||||
fileLength = String.valueOf(optional1.get().length);
|
||||
fileName = entityList.get(0).getFilename();
|
||||
buf = optional1.get();
|
||||
}
|
||||
|
||||
try{
|
||||
// 设置响应的头信息,告诉浏览器文件的大小和下载方式
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Length", String.valueOf(optional1.get().length));
|
||||
response.setHeader("Content-Disposition", "attachment; filename=".concat(new String(entityList.get(0).getFilename().getBytes(StandardCharsets.UTF_8), "ISO8859-1")));
|
||||
response.setHeader("Content-Length", fileLength);
|
||||
response.setHeader("Content-Disposition", "attachment; filename=".concat(new String(fileName.getBytes(StandardCharsets.UTF_8), "ISO8859-1")));
|
||||
|
||||
InputStream word = new ByteArrayInputStream(optional1.get());
|
||||
InputStream word = new ByteArrayInputStream(buf);
|
||||
// 创建输入输出流
|
||||
BufferedInputStream inStream = new BufferedInputStream(word);
|
||||
BufferedOutputStream outStream = new BufferedOutputStream(response.getOutputStream());
|
||||
|
@ -630,12 +630,16 @@ public class WpsServiceImpl implements WpsService {
|
||||
|
||||
Optional<AttachmentDetail> optional = attachmentClient.findByBusinessId(businessIdList);
|
||||
|
||||
AttachmentDetail detail = optional.get();
|
||||
if(optional!=null&&optional.get()!=null) {
|
||||
|
||||
List<AttachmentEntity> entityList = detail.get(id);
|
||||
AttachmentDetail detail = optional.get();
|
||||
|
||||
Optional<byte[]> optional1 = attachmentClient.downloadFileByObjectId(entityList.get(0).getId());
|
||||
return optional1.get();
|
||||
List<AttachmentEntity> entityList = detail.get(id);
|
||||
|
||||
Optional<byte[]> optional1 = attachmentClient.downloadFileByObjectId(entityList.get(0).getId());
|
||||
return optional1.get();
|
||||
}
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user