|
@@ -3,12 +3,12 @@ package com.boman.file.service;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.boman.common.core.utils.obj.ObjectUtils;
|
|
|
import com.boman.common.core.utils.poi.ExcelUtil;
|
|
|
-import com.boman.domain.dto.*;
|
|
|
import com.boman.common.redis.RedisKey;
|
|
|
import com.boman.common.redis.service.RedisService;
|
|
|
import com.boman.domain.GenTable;
|
|
|
import com.boman.domain.GenTableColumn;
|
|
|
import com.boman.domain.constant.MaskConstant;
|
|
|
+import com.boman.domain.dto.*;
|
|
|
import com.boman.file.utils.FileUploadUtils;
|
|
|
import com.boman.web.core.api.RemoteObjService;
|
|
|
import com.google.common.collect.Lists;
|
|
@@ -26,6 +26,8 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.*;
|
|
|
import java.net.URL;
|
|
|
+import java.net.URLEncoder;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.util.*;
|
|
|
|
|
|
import static com.boman.common.core.utils.obj.ObjectUtils.map;
|
|
@@ -199,16 +201,17 @@ public class LocalSysFileServiceImpl implements ISysFileService
|
|
|
}
|
|
|
|
|
|
response.reset();
|
|
|
+ response.setCharacterEncoding("utf-8");
|
|
|
+ String filename = URLEncoder.encode(dto.getFilename(), "UTF-8");
|
|
|
if (BooleanUtils.isTrue(dto.getPreview())) {
|
|
|
// 查看
|
|
|
URL url = new URL("file:///" + filePath);
|
|
|
- String contentType = url.openConnection().getContentType();
|
|
|
- response.setContentType(contentType);
|
|
|
- response.setHeader("Content-Disposition", "inline;filename=test.pdf");
|
|
|
+ response.setContentType(url.openConnection().getContentType() + ";charset=utf-8");
|
|
|
+ response.setHeader("content-disposition", "attachment;filename=" + filename);
|
|
|
} else {
|
|
|
// 下载
|
|
|
response.setContentType("application/x-msdownload");
|
|
|
- response.setHeader("Content-Disposition", "attachment;filename=test.pdf");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=" + filename);
|
|
|
}
|
|
|
|
|
|
int len;
|