Commit 6eb53761 authored by duanruiming's avatar duanruiming

[update] 微观大数据平台-excel导出名称优化2

parent 436066bd
...@@ -2051,7 +2051,8 @@ public class TrendServiceImpl implements TrendService { ...@@ -2051,7 +2051,8 @@ public class TrendServiceImpl implements TrendService {
List<TableQueryVO.CycleDataElement> cycleDataElements = buildCycleData(crossId, poExtList); List<TableQueryVO.CycleDataElement> cycleDataElements = buildCycleData(crossId, poExtList);
String sheet = "车道周期数据"; String sheet = "车道周期数据";
String fileName = sheet.concat(startStr).concat("-").concat(endStr).replaceAll(" ", "").concat(".xls"); String fileName = sheet.concat(startStr).concat("~").concat(endStr)
.replaceAll(":", " ").replaceAll(" ", "-").concat(".xls");
//String utf2GbkString = new String(fileName.getBytes(StandardCharsets.UTF_8),"GBK"); //String utf2GbkString = new String(fileName.getBytes(StandardCharsets.UTF_8),"GBK");
//String utf2Gbk2UtfString = new String(utf2GbkString.getBytes("GBK"), StandardCharsets.UTF_8); //String utf2Gbk2UtfString = new String(utf2GbkString.getBytes("GBK"), StandardCharsets.UTF_8);
////response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); ////response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
...@@ -2066,6 +2067,7 @@ public class TrendServiceImpl implements TrendService { ...@@ -2066,6 +2067,7 @@ public class TrendServiceImpl implements TrendService {
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20")); response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20"));
EasyExcel.write(response.getOutputStream(), TableQueryVO.CycleDataElement.class) EasyExcel.write(response.getOutputStream(), TableQueryVO.CycleDataElement.class)
.useDefaultStyle(false)
.sheet(sheet) .sheet(sheet)
.doWrite(cycleDataElements); .doWrite(cycleDataElements);
} catch (Exception e) { } catch (Exception 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