Browse Source

输出操作系统名称

gushoubang 9 months ago
parent
commit
b397f0b8df

+ 5 - 3
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/controller/FzssController.java

@@ -105,20 +105,22 @@ public class FzssController extends BaseController {
     }
 
     @GetMapping("/DownloadReport")
-    public void fileDownload(String fileName, HttpServletResponse response, HttpServletRequest request) {
+    public void fileDownload(String filePath, HttpServletResponse response, HttpServletRequest request) {
         try {
             String path = tempWin;
             // windows 使用 tempWin, linux 使用 tempLinux
+            System.out.println("####获取操作系统名称####");
+            System.out.println("os.name: " + System.getProperty("os.name").toLowerCase());
             if (System.getProperty("os.name").toLowerCase().contains("linux")) {
                 path = tempLinux;
             }
 
-            String realFileName = path + fileName;
+            String realFileName = path + filePath;
             response.setCharacterEncoding("utf-8");
             response.setContentType("multipart/form-data");
             response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
 
-            String fileType = fileName.substring(fileName.lastIndexOf(".") + 1);
+            String fileType = filePath.substring(filePath.lastIndexOf(".") + 1);
             String time = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
             String downloadName = time + "." + fileType;