Explorar el Código

公共客户查询新增签单标记

anderx hace 1 año
padre
commit
8828e38261

+ 10 - 5
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -35,6 +35,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.lang.reflect.InvocationTargetException;
+import java.nio.charset.StandardCharsets;
 import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -198,16 +199,20 @@ public class AdminCustomerApiController extends BaseApiController{
 		} catch (IOException e) {
 			e.printStackTrace();
 		}
-		 response.addHeader("Content-Disposition", "attachment;filename="  + new String(fileName.getBytes(),"iso-8859-1"));
+		 response.addHeader("Content-Disposition", "attachment;filename="  + new String(fileName.getBytes(), StandardCharsets.ISO_8859_1));
          response.setContentType("application/octet-stream;charset=utf-8");
 		try {
 			// 返回数据流
 			wb.write(out);
-			out.flush();
-			out.close();
+            if (out != null) {
+                out.flush();
+            	out.close();
+            }
 		} finally {
-			out.flush();
-			out.close();
+            if (out != null) {
+                out.flush();
+            	out.close();
+            }
 		}
 
 		return res;