Commit dded1b8a by kangxiaoshan

1

parent 15d5a916
......@@ -23,10 +23,7 @@ import util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.*;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.text.DecimalFormat;
......@@ -466,7 +463,7 @@ public class ContractController {
}
}
OutputStreamWriter osw = null;
OutputStream os = null;
String fileName = "分摊收入报表(" + new DateTime(startDate).toString("yyyyMMdd")
+ "_" + new DateTime(endDate).toString("yyyyMMdd") + ").csv";
......@@ -476,16 +473,17 @@ public class ContractController {
response.setHeader("content-disposition", "attachment; filename=" + fileName);
response.setHeader("Content-Type", "text/csv");
response.setContentType("APPLICATION/OCTET-STREAM");
osw = new OutputStreamWriter(response.getOutputStream(), "UTF-8");
// osw.write(new String(new byte[]{(byte) 0xEF, (byte) 0xBB, (byte) 0xBF})+"\n");
osw.write(sb.toString());
osw.flush();
response.setCharacterEncoding("UTF-8");
os = response.getOutputStream();
os.write(new byte[]{(byte) 0xEF, (byte) 0xBB, (byte) 0xBF});
os.write(sb.toString().getBytes("UTF-8"));
os.flush();
} catch (Exception e) {
logger.error("导出分摊收入报错", e);
} finally {
if (osw != null) {
if (os != null) {
try {
osw.close();
os.close();
} catch (IOException e) {
logger.error("导出分摊收入关闭流报错", e);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment