소스 검색

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

anderx 1 년 전
부모
커밋
8828e38261
1개의 변경된 파일10개의 추가작업 그리고 5개의 파일을 삭제
  1. 10 5
      src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

+ 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;