anderx лет назад: 4
Родитель
Сommit
9fd3b88dda

+ 2 - 2
src/main/java/com/goafanti/common/controller/PublicController.java

@@ -700,7 +700,7 @@ public class PublicController extends CertifyApiController {
            * @param delete 是否删除
            */
           @RequestMapping("/download")
-          public void fileDownload(String fileName, Boolean delete,String aftName,
+          public void fileDownload(String fileName, Boolean delete,String attName,
 								   HttpServletResponse response, HttpServletRequest request)
           {
               try
@@ -713,7 +713,7 @@ public class PublicController extends CertifyApiController {
                   String filePath = uploadPath +"/"+ fileName;
 
                   response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
-                  FileUtils.setAttachmentResponseHeader(response, realFileName,aftName);
+                  FileUtils.setAttachmentResponseHeader(response, realFileName,attName);
                   FileUtils.writeBytes(filePath, response.getOutputStream());
                   if(delete==null)delete=true;
                   if (delete)

+ 2 - 2
src/main/java/com/goafanti/common/utils/excel/FileUtils.java

@@ -185,12 +185,12 @@ public class FileUtils extends org.apache.commons.io.FileUtils
      * @param realFileName 真实文件名
      * @return
      */
-    public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName,String attFile) throws UnsupportedEncodingException
+    public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName,String afttName) throws UnsupportedEncodingException
     {
         String percentEncodedFileName = percentEncode(realFileName);
 
         StringBuilder contentDispositionValue = new StringBuilder();
-        if(attFile!= null)contentDispositionValue.append("attachment; filename=");
+        if(afttName!= null)contentDispositionValue.append("attachment; filename="+afttName);
         else contentDispositionValue.append("attachment; filename=");
         contentDispositionValue.append(percentEncodedFileName)
                 .append(";")