Commit 436066bd authored by duanruiming's avatar duanruiming

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

parent 7dfdf164
...@@ -2050,7 +2050,8 @@ public class TrendServiceImpl implements TrendService { ...@@ -2050,7 +2050,8 @@ public class TrendServiceImpl implements TrendService {
List<CrossLaneDataHistPOExt> poExtList = crossLaneDataHistMapper.selectByCrossIdAndTimeSpan(crossId, start, end); List<CrossLaneDataHistPOExt> poExtList = crossLaneDataHistMapper.selectByCrossIdAndTimeSpan(crossId, start, end);
List<TableQueryVO.CycleDataElement> cycleDataElements = buildCycleData(crossId, poExtList); List<TableQueryVO.CycleDataElement> cycleDataElements = buildCycleData(crossId, poExtList);
String fileName = "车道周期数据".concat(startStr).concat("-").concat(endStr).replaceAll(" ", "").concat(".xls"); String sheet = "车道周期数据";
String fileName = sheet.concat(startStr).concat("-").concat(endStr).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");
...@@ -2061,11 +2062,11 @@ public class TrendServiceImpl implements TrendService { ...@@ -2061,11 +2062,11 @@ public class TrendServiceImpl implements TrendService {
// 设置响应头 // 设置响应头
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel;chartset=utf-8"); response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "UTF-8")); 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)
.sheet("车道周期数据") .sheet(sheet)
.doWrite(cycleDataElements); .doWrite(cycleDataElements);
} catch (Exception e) { } catch (Exception e) {
log.error("车道周期数据导出excel异常:", e); log.error("车道周期数据导出excel异常:", 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