Commit 2a8df5aa authored by duwei's avatar duwei

导出数据优化

parent 1d458ba7
......@@ -567,7 +567,7 @@ public class TrendController {
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = HttpServletResponse.class),
})
public void crossExcel(@RequestBody PeriodCrossingVO crossingVO, HttpServletResponse response) throws Exception {
public void crossExcel(@RequestBody PeriodCrossingVO crossingVO, HttpServletResponse response) {
trendService.periodCrossExcel(crossingVO, response);
}
......
......@@ -9,10 +9,45 @@ import java.util.Map;
public class CrossMapping {
public static final Map<String, String> CYCLE_DATA_FIELD_MAPPING = new HashMap<>();
/**
* 0
* :
* "flow"
* 1
* :
* "nonMotorFlow"
* 2
* :
* "pedFlow"
* 3
* :
* "speed"
* 4
* :
* "queueLength"
* 5
* :
* "stopTimes"
* 6
* :
* "saturation"
* 7
* :
* "congestionIndex"
* 8
* :
* "overflowIndex"
* 9
* :
* "imbalanceIndex"
* 10
* :
* "noStopPassRate"
*/
static {
// CycleDataElement 字段映射
CYCLE_DATA_FIELD_MAPPING.put("time", "time");
CYCLE_DATA_FIELD_MAPPING.put("allFlow", "allFlow");
CYCLE_DATA_FIELD_MAPPING.put("flow", "flow");
CYCLE_DATA_FIELD_MAPPING.put("pedFlow", "pedFlow");
CYCLE_DATA_FIELD_MAPPING.put("nonMotorFlow", "nonMotorFlow");
CYCLE_DATA_FIELD_MAPPING.put("trafficFlowC", "trafficFlowC");
......
......@@ -12,6 +12,7 @@ public class DirMapping {
static {
// CycleDataElement 字段映射
CYCLE_DATA_FIELD_MAPPING.put("time", "time");
CYCLE_DATA_FIELD_MAPPING.put("flow", "flow");
CYCLE_DATA_FIELD_MAPPING.put("dirName", "dirName");
CYCLE_DATA_FIELD_MAPPING.put("allFlow", "allFlow");
CYCLE_DATA_FIELD_MAPPING.put("pedFlow", "pedFlow");
......
......@@ -12,6 +12,7 @@ public class TurnMapping {
static {
// CycleDataElement 字段映射
CYCLE_DATA_FIELD_MAPPING.put("time", "time");
CYCLE_DATA_FIELD_MAPPING.put("flow", "flow");
CYCLE_DATA_FIELD_MAPPING.put("inDir", "inDir");
CYCLE_DATA_FIELD_MAPPING.put("inDirName", "inDirName");
CYCLE_DATA_FIELD_MAPPING.put("turnType", "turnType");
......
......@@ -3003,6 +3003,9 @@ public class TrendServiceImpl implements TrendService {
}else {
// 动态构建导出数据
List<String> selectedFields = lanePeriodVO.getSelectedFields();
if (!selectedFields.contains("time")){
selectedFields.add(0, "time");
}
List<DynamicExportLaneDataElement> exportDataList = new ArrayList<>();
for (TableQueryVO.CycleDataElement element : dataList) {
exportDataList.add(DynamicExportLaneDataElement.fromCycleDataElement(TableQueryVO.CycleDataElement.class,element, selectedFields, LaneMapping.CYCLE_DATA_FIELD_MAPPING));
......@@ -3165,6 +3168,9 @@ public class TrendServiceImpl implements TrendService {
}else {
// 动态构建导出数据
List<String> selectedFields = turnVO.getSelectedFields();
if (!selectedFields.contains("time")){
selectedFields.add(0, "time");
}
List<DynamicExportLaneDataElement> exportDataList = new ArrayList<>();
for (CrossingTurnQueryVO.CycleDataElement element: result) {
exportDataList.add(DynamicExportLaneDataElement.fromCycleDataElement(CrossingTurnQueryVO.CycleDataElement.class, element, selectedFields, TurnMapping.CYCLE_DATA_FIELD_MAPPING));
......@@ -3222,6 +3228,9 @@ public class TrendServiceImpl implements TrendService {
}else {
// 动态构建导出数据
List<String> selectedFields = directionVO.getSelectedFields();
if (!selectedFields.contains("time")){
selectedFields.add(0, "time");
}
List<DynamicExportLaneDataElement> exportDataList = new ArrayList<>();
for (CrossingDirectionQueryVO.CycleDataElement element: result) {
exportDataList.add(DynamicExportLaneDataElement.fromCycleDataElement(CrossingDirectionQueryVO.CycleDataElement.class, element, selectedFields, DirMapping.CYCLE_DATA_FIELD_MAPPING));
......@@ -3270,7 +3279,11 @@ public class TrendServiceImpl implements TrendService {
ExcelExportUtils.exportExcel(response, startStr, endStr, result, crossName.concat("路口周期数据"), CrossingQueryVO.CycleDataElement.class);
}else {
// 动态构建导出数据
// 添加时间字段,其他字段顺序向后移动
List<String> selectedFields = crossingVO.getSelectedFields();
if (!selectedFields.contains("time")){
selectedFields.add(0, "time");
}
List<DynamicExportLaneDataElement> exportDataList = new ArrayList<>();
for (CrossingQueryVO.CycleDataElement element: result) {
exportDataList.add(DynamicExportLaneDataElement.fromCycleDataElement(CrossingQueryVO.CycleDataElement.class, element, selectedFields, CrossMapping.CYCLE_DATA_FIELD_MAPPING));
......
......@@ -89,7 +89,8 @@ public class CrossingDirectionQueryVO {
private String laneSort;
@ApiModelProperty(value = "流量")
@ExcelIgnore
// @ExcelIgnore
@ExcelProperty("机动车流量")
private Integer flow;
@ApiModelProperty(value = "平均延误")
......
......@@ -89,7 +89,8 @@ public class CrossingQueryVO {
private String laneSort;
@ApiModelProperty(value = "流量")
@ExcelIgnore
// @ExcelIgnore
@ExcelProperty("机动车流量")
private Integer flow;
@ApiModelProperty(value = "平均延误")
......
......@@ -101,7 +101,8 @@ public class CrossingTurnQueryVO {
private String laneSort;
@ApiModelProperty(value = "流量")
@ExcelIgnore
// @ExcelIgnore
@ExcelProperty("机动车流量")
private Integer flow;
@ApiModelProperty(value = "平均延误")
......
......@@ -130,7 +130,8 @@ public class TableQueryVO {
private String laneSort;
@ApiModelProperty(value = "流量")
@ExcelIgnore
// @ExcelIgnore
@ExcelProperty("机动车流量")
private Integer flow;
@ApiModelProperty(value = "最大排队")
......
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