Browse Source

图片转换成base64码进行显示

tags/v1.1.0
qiujinyang 2 years ago
parent
commit
adfdb513a6
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ReportServiceImpl.java

+ 4
- 4
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ReportServiceImpl.java View File

@@ -227,8 +227,8 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp
ReportInfoVO reportInfoVO = detail(reportId);
//创建word
String fileName = "汤山林场无人机巡检报告【"+ reportInfoVO.getReportNo() + "】.doc";
String filePath = UploadFileConfig.uploadFolder+"/doc/"+fileName;
File fd = new File(UploadFileConfig.uploadFolder+"/doc");
String filePath = UploadFileConfig.uploadFolder+"doc/"+fileName;
File fd = new File(UploadFileConfig.uploadFolder+"doc");
File f = new File(filePath);
if(!fd.exists()){
fd.mkdirs();
@@ -506,11 +506,11 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp
response.reset();
// 定义浏览器响应表头,并定义下载名
//String urlFileName = URLEncoder.encode("汤山林场无人机巡检报告【"+ reportInfoVO.getReportNo() + "】.doc", "UTF-8");
String urlFileName =new String(("汤山林场无人机巡检报告【"+ reportInfoVO.getReportNo() + "】.doc").getBytes(), StandardCharsets.ISO_8859_1);
String urlFileName =new String(("汤山林场无人机巡检报告【"+ reportInfoVO.getReportNo() + "】.doc").getBytes(), StandardCharsets.UTF_8);
response.setHeader("Content-Disposition", "attachment;filename=" + urlFileName);
response.setCharacterEncoding("utf-8");
//定义下载的类型
response.setContentType("application/octet-stream;charset=utf-8");
response.setContentType("application/msword;charset=GBK");

OutputStream out;
//File files = new File(filePath);

Loading…
Cancel
Save