|
@@ -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());
|
|
|
}
|
|
|
}
|