Ver Fonte

智慧选址和合规性分析,分析结果报文显示

LAPTOP-BJJ3IV5R\SIWEI há 8 meses atrás
pai
commit
37a2e74698

+ 11 - 1
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/controller/FzssController.java

@@ -18,7 +18,9 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+import java.io.File;
 import java.io.IOException;
+import java.net.URLEncoder;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
@@ -113,6 +115,14 @@ public class FzssController extends BaseController {
     @GetMapping("/DownloadReport")
     public void fileDownload(String filePath, HttpServletResponse response) throws IOException {
         String realFileName = temp + filePath;
-        DownloadUtils.download(response, realFileName, null);
+        File file = new File(realFileName);
+        // 取得文件名。
+        String downloadName = file.getName();
+        response.setCharacterEncoding("utf-8");
+        response.setContentType("multipart/form-data");
+        response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
+//        response.setHeader("Content-Disposition", "attachment;fileName=\"" + downloadName + "\"");
+        response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(downloadName, "UTF-8"));
+        FileUtils.writeBytes(realFileName, response.getOutputStream());
     }
 }