Commit e4e40836 authored by duanruiming's avatar duanruiming

[update] 微观大数据平台-周期转向,车道快照数据导出

parent 5a2028bd
......@@ -351,4 +351,22 @@ public class TrendController {
trendService.periodExcel(crossIdDateTimeVO, response);
}
@ApiOperation(value = "周期转向数据导出功能", notes = "周期转向数据导出功能")
@PostMapping(value = "/periodTurnExcel")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = HttpServletResponse.class),
})
public void periodTurnExcel(@RequestBody LanePeriodTurnVO lanePeriodTurnVO, HttpServletResponse response) throws Exception {
trendService.periodTurnExcel(lanePeriodTurnVO, response);
}
@ApiOperation(value = "车道快照数据导出功能", notes = "车道快照数据导出功能")
@PostMapping(value = "/laneSnapshotExcel")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = HttpServletResponse.class),
})
public void laneSnapshotExcel(@RequestBody LaneSnapshotIndexVO laneSnapshotIndexVO, HttpServletResponse response) throws Exception {
trendService.laneSnapshotExcel(laneSnapshotIndexVO, response);
}
}
\ No newline at end of file
package net.wanji.opt.po.trend;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
......@@ -22,65 +23,85 @@ public class AnalysisRidTurnIndicators implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键", hidden = true)
@ExcelProperty("唯一ID")
private Integer oid;
@ApiModelProperty(value = "路口id")
@ExcelProperty("路口编号")
private String crossId;
@ApiModelProperty(name = "fRid", value = "进口rid")
@JsonProperty("fRid")
@ExcelProperty("进口编号")
private String fRid;
@ApiModelProperty(name = "fRidDir", value = "进口道方向 1北;2东北;3东;4东南;5南;6西南;7西;8西北")
@JsonProperty("fRidDir")
@ExcelProperty("进口方向")
private Integer fRidDir;
@ApiModelProperty(value = "出口rid", hidden = true)
@JsonProperty("tRid")
@ExcelProperty("出口编号")
private String tRid;
@ApiModelProperty(value = "转向类型 根据进入、出口路段转向计算 1 左转 2 直行3右转 4 掉头")
@ExcelProperty("转向类型")
private Integer turnDirNo;
@ApiModelProperty(value = "交通流量")
@ExcelProperty("交通流量")
private Integer flow;
@ApiModelProperty(value = "平均速度")
@ExcelProperty("平均速度")
private BigDecimal speed;
@ApiModelProperty(value = "排队长度")
@ExcelProperty("排队长度")
private Integer queueLength;
@ApiModelProperty(value = "绿灯有效利用率")
@ExcelProperty("绿灯有效利用率")
private BigDecimal greenUsageRate;
@ApiModelProperty(value = "平均停车次数")
@ExcelProperty("平均停车次数")
private BigDecimal stopNum;
@ApiModelProperty(value = "一次停车率")
@ExcelProperty("一次停车率")
private BigDecimal onceStopRate;
@ApiModelProperty(value = "二次停车率")
@ExcelProperty("二次停车率")
private BigDecimal secondStopRate;
@ApiModelProperty(value = "三次停车率")
@ExcelProperty("三次停车率")
private BigDecimal threeStopRate;
@ApiModelProperty(value = "不停车通过率")
@ExcelProperty("不停车通过率")
private BigDecimal noStopRate;
@ApiModelProperty(value = "交通状态")
@ExcelProperty("交通状态")
private String trafficState;
@ApiModelProperty(value = "分析粒度【5m:五分钟 10m:10分钟 30m:30分钟 1h:一小时】", hidden = true)
@ExcelProperty("时间粒度")
private String granularity;
@JSONField(format = "yyyy-MM-dd HH:mm:ss.SSS")
@ExcelProperty("开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
private Date windowStartTime;
@JSONField(format = "yyyy-MM-dd HH:mm:ss.SSS")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
@ExcelProperty("结束时间")
private Date windowEndTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
@ExcelProperty("结束时间")
private Date ruksj;
}
\ No newline at end of file
......@@ -72,4 +72,8 @@ public interface TrendService {
List<LaneIdAliasNameVO> laneIdList(CommonCrossIdVO commonCrossIdVO) throws Exception;
void periodExcel(CommonCrossIdDateTimeVO crossIdDateTimeVO, HttpServletResponse response) throws Exception;
void periodTurnExcel(LanePeriodTurnVO lanePeriodTurnVO, HttpServletResponse response) throws Exception;
void laneSnapshotExcel(LaneSnapshotIndexVO laneSnapshotIndexVO, HttpServletResponse response) throws Exception;
}
......@@ -61,10 +61,16 @@ public class LaneSnapshotDataQueryService implements LaneSnapshotService {
boolQuery.must(termsQuery);
}
if (pageNum == -1) {
searchSourceBuilder
.query(boolQuery)
.size(50000);
} else {
searchSourceBuilder
.query(boolQuery)
.from(pageNum * 500)
.size((pageNum + 1) * 500);
}
searchRequest.source(searchSourceBuilder);
SearchResponse response = client.search(searchRequest, RequestOptions.DEFAULT);
......
......@@ -2040,7 +2040,7 @@ public class TrendServiceImpl implements TrendService {
Date startDate = crossIdDateTimeVO.getStart();
Date endDate = crossIdDateTimeVO.getEnd();
String startStr = DateUtil.format(startDate, DateStyle.YYYY_MM_DD_HH_MM.getValue());
String endStr = DateUtil.format(startDate, DateStyle.MM_DD_HH_MM.getValue());
String endStr = DateUtil.format(endDate, DateStyle.MM_DD_HH_MM.getValue());
int start = (int) (startDate.getTime() / 1000);
int end = (int) (endDate.getTime() / 1000);
......@@ -2050,4 +2050,44 @@ public class TrendServiceImpl implements TrendService {
ExcelExportUtils.exportExcel(response, startStr, endStr, dataList, "车道周期数据", TableQueryVO.CycleDataElement.class);
}
@Override
public void periodTurnExcel(LanePeriodTurnVO lanePeriodTurnVO, HttpServletResponse response) throws Exception {
String crossId = lanePeriodTurnVO.getCrossId();
Date startDate = lanePeriodTurnVO.getStart();
Date endDate = lanePeriodTurnVO.getEnd();
String startStr = DateUtil.format(startDate, DateStyle.YYYY_MM_DD_HH_MM.getValue());
String endStr = DateUtil.format(endDate, DateStyle.MM_DD_HH_MM.getValue());
LambdaQueryWrapper<AnalysisRidTurnIndicators> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AnalysisRidTurnIndicators::getCrossId, crossId);
queryWrapper.between(AnalysisRidTurnIndicators::getWindowStartTime, startDate, endDate);
queryWrapper.orderByDesc(AnalysisRidTurnIndicators::getWindowStartTime);
List<AnalysisRidTurnIndicators> dataList = ridTurnIndicatorsMapper.selectList(queryWrapper);
ExcelExportUtils.exportExcel(response, startStr, endStr, dataList, "周期转向数据", AnalysisRidTurnIndicators.class);
}
@Override
public void laneSnapshotExcel(LaneSnapshotIndexVO laneSnapshotIndexVO, HttpServletResponse response) throws Exception {
String crossId = laneSnapshotIndexVO.getCrossId();
Date startDate = laneSnapshotIndexVO.getStart();
Date endDate = laneSnapshotIndexVO.getEnd();
String startStr = DateUtil.format(startDate, DateStyle.YYYY_MM_DD_HH_MM.getValue());
String endStr = DateUtil.format(endDate, DateStyle.MM_DD_HH_MM.getValue());
int start = (int) (startDate.getTime() / 1000);
int end = (int) (endDate.getTime() / 1000);
String laneId = laneSnapshotIndexVO.getLaneId();
// 查询秒级数据
List<CrossLaneSnapshotDataDTO> dtoList =
laneSnapshotDataQueryService.queryByCrossIdAndTimeSpan(crossId, start, end, -1, laneId);
List<TableQueryVO.RealTimeDataElement> result = buildRealTimeList(dtoList);
List<TableQueryVO.RealTimeDataElement> dataList = new ArrayList<>();
if (!CollectionUtils.isEmpty(result)) {
dataList = result.stream().sorted(Comparator.comparing(TableQueryVO.RealTimeDataElement::getTime).reversed()).collect(Collectors.toList());
}
ExcelExportUtils.exportExcel(response, startStr, endStr, dataList, "车道快照数据", TableQueryVO.RealTimeDataElement.class);
}
}
......@@ -30,54 +30,71 @@ public class TableQueryVO {
public static class RealTimeDataElement {
@ApiModelProperty(value = "时间 格式 yyyy-MM-dd HH:mm:ss")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ExcelProperty("时间")
private Date time;
@ApiModelProperty(value = "方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北")
@ExcelProperty("方向")
private Integer dir;
@ApiModelProperty(value = "车道,从左车道开始编号11、12、13...")
@ExcelProperty("车道号")
private String laneSort;
@ApiModelProperty(value = "车道编号")
@ExcelProperty("车道编号")
private String laneId;
@ApiModelProperty(value = "排队长度")
@ExcelProperty("排队长度")
private Integer queueLength;
@ApiModelProperty(value = "头车位置")
@ExcelProperty("透彻位置")
private Integer firstCarPosition;
@ApiModelProperty(value = "末车位置")
@ExcelProperty("末车位置")
private Integer endCarPosition;
@ApiModelProperty(value = "排队车辆数")
@ExcelProperty("排队车辆数")
private int queueNums;
@ApiModelProperty(value = "车道内车辆数")
@ExcelProperty("车道内车辆数")
private int carNums;
@ApiModelProperty(value = "空间密度车辆负荷比")
@ExcelProperty("空间密度负荷比")
private double vehicleNumsRatio;
@ApiModelProperty(value = "空间密度(长度占比)")
@ExcelProperty("空间密度长度占比")
private double vehicleLengthRatio;
@ApiModelProperty(value = "平均速度")
@ExcelProperty("平均速度")
private double speed;
@ApiModelProperty(value = "头车速度")
@ExcelProperty("头车速度")
private double headSpeed;
@ApiModelProperty(value = "尾车速度")
@ExcelProperty("尾车速度")
private double mailSpeed;
@ApiModelProperty(value = "队收距离(米)")
@ApiModelProperty(value = "队首距离(米)")
@ExcelProperty("队首距离")
private double teamHeadDistance;
@ApiModelProperty(value = "队尾距离(米)")
@ExcelProperty("队尾距离")
private double teamTailDistance;
@ApiModelProperty(value = "车头间距方差>车道内空间占有率")
@ExcelProperty("车道内空间占有率")
private double stdSpaceHeadway;
}
......
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