wps保存回调
This commit is contained in:
@ -35,6 +35,7 @@ import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -198,7 +199,7 @@ public class WpsController {
|
||||
*/
|
||||
@ApiOperation("(金山)沃文档回调-查询文档")
|
||||
@GetMapping("/kingSoft/file2")
|
||||
public boolean getKSFile2(HttpServletRequest request,HttpServletResponse response, @RequestParam("key") String key) {
|
||||
public boolean getKSFile2(HttpServletRequest request,HttpServletResponse response, @RequestParam("key") String key) {
|
||||
String fileId = this.wpsService.downloadDecrypt(key);
|
||||
|
||||
List<String> businessIdList = new ArrayList<>();
|
||||
@ -213,12 +214,13 @@ public class WpsController {
|
||||
|
||||
Optional<byte[]> optional1 = attachmentClient.downloadFileByObjectId(entityList.get(0).getId());
|
||||
|
||||
// 设置响应的头信息,告诉浏览器文件的大小和下载方式
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Length", String.valueOf(optional1.get().length));
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + ""+entityList.get(0).getFilename() + "\"");
|
||||
|
||||
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")));
|
||||
|
||||
InputStream word = new ByteArrayInputStream(optional1.get());
|
||||
// 创建输入输出流
|
||||
BufferedInputStream inStream = new BufferedInputStream(word);
|
||||
@ -234,6 +236,9 @@ public class WpsController {
|
||||
// 关闭输入输出流
|
||||
inStream.close();
|
||||
outStream.close();
|
||||
}catch (UnsupportedEncodingException ue){
|
||||
log.error("转码失败",ue);
|
||||
WpsExceptionEnum.FRAME_EXCEPTION_NO.customValidName("转码失败", true);
|
||||
}catch (Exception e){
|
||||
log.error("下载失败",e);
|
||||
WpsExceptionEnum.FRAME_EXCEPTION_NO.customValidName("下载失败", true);
|
||||
|
Reference in New Issue
Block a user