Commit 7afbcd94 authored by 杜伟's avatar 杜伟

转向级统计查询

parent f74c43eb
...@@ -296,7 +296,7 @@ public class TrendController { ...@@ -296,7 +296,7 @@ public class TrendController {
} }
/** /**
* 车道交通指标 - 车道周期转向数据 * 车道交通指标 - 转向级数据
* @param lanePeriodTurnVO * @param lanePeriodTurnVO
* @return * @return
* @throws Exception * @throws Exception
...@@ -309,7 +309,7 @@ public class TrendController { ...@@ -309,7 +309,7 @@ public class TrendController {
@ApiResponse(code = 200, message = "OK", response = AnalysisRidTurnIndicators.class), @ApiResponse(code = 200, message = "OK", response = AnalysisRidTurnIndicators.class),
}) })
public JsonViewObject lanePeriodTurnData(@RequestBody LanePeriodTurnVO lanePeriodTurnVO) throws Exception { public JsonViewObject lanePeriodTurnData(@RequestBody LanePeriodTurnVO lanePeriodTurnVO) throws Exception {
List<AnalysisRidTurnIndicators> result = trendService.lanePeriodTurnData(lanePeriodTurnVO); List<CrossingTurnQueryVO.CycleDataElement> result = trendService.lanePeriodTurnData(lanePeriodTurnVO);
return JsonViewObject.newInstance().success(result); return JsonViewObject.newInstance().success(result);
} }
......
...@@ -65,7 +65,7 @@ public interface TrendService { ...@@ -65,7 +65,7 @@ public interface TrendService {
List<TableQueryVO.RealTimeDataElement> laneSnapshotIndex(LaneSnapshotIndexVO laneSnapshotIndexVO) throws Exception; List<TableQueryVO.RealTimeDataElement> laneSnapshotIndex(LaneSnapshotIndexVO laneSnapshotIndexVO) throws Exception;
List<OverflowEvent> overFlowEvent(LaneSnapshotIndexVO laneSnapshotIndexVO) throws Exception; List<OverflowEvent> overFlowEvent(LaneSnapshotIndexVO laneSnapshotIndexVO) throws Exception;
List<AnalysisRidTurnIndicators> lanePeriodTurnData(LanePeriodTurnVO lanePeriodTurnVO) throws Exception; List<CrossingTurnQueryVO.CycleDataElement> lanePeriodTurnData(LanePeriodTurnVO lanePeriodTurnVO) throws Exception;
/** /**
* 获取时段方向级数据 * 获取时段方向级数据
......
package net.wanji.opt.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* 路口转向级VO
*/
@Data
@NoArgsConstructor
@ApiModel(value = "CrossingTurnQueryVO", description = "表格分时段查询")
public class CrossingTurnQueryVO {
@ApiModelProperty(value = "周期数据")
private List<CycleDataElement> cycleData;
@NoArgsConstructor
@Data
public static class CycleDataElement {
@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;
/** 驶入方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北 */
@ApiModelProperty(name = "驶入方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
@ExcelProperty("驶入方向")
public Integer inDir ;
@ExcelProperty("驶入方向名称")
@ApiModelProperty(name = "驶入方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
private String inDirName;
/** 转向类型:u掉头;l左转;s直行;r右转; */
@ApiModelProperty(name = "转向类型:u掉头;l左转;s直行;r右转;",notes = "")
@ExcelProperty("转向类型")
public String turnType ;
@ApiModelProperty(name = "转向类型名称:u掉头;l左转;s直行;r右转;",notes = "")
@ExcelProperty("转向类型名称")
private String turnTypeName;
// @ApiModelProperty(value = "总流量")
// @ExcelProperty("总流量")
// private int allFlow;
@ApiModelProperty(value = "行人流量")
@ExcelProperty("行人流量")
private int pedFlow;
@ApiModelProperty(value = "非机动车流量")
@ExcelProperty("非机动车流量")
private int nonMotorFlow;
@ExcelProperty("小车流量")
private Integer trafficFlowC;
@ExcelProperty("中车流量")
private Integer trafficFlowB;
@ExcelProperty("大车流量")
private Integer trafficFlowA;
@ApiModelProperty(value = "平均速度")
@ExcelProperty("平均速度")
private Integer speed;
@ApiModelProperty(value = "平均车头间距")
@ExcelProperty("平均车头间距")
private Double vehheadDist;
@ApiModelProperty(value = "平均车头时距")
@ExcelProperty("平均车头时距")
private Integer vehheadTime;
@ApiModelProperty(value = "最大排队")
@ExcelProperty("最大排队")
private Integer queueLength;
@ApiModelProperty(value = "平均停车次数")
@ExcelProperty("平均停车次数")
private Integer stopTimes;
//-----------------------------
@ApiModelProperty(value = "车道转向:1左转;2直行;3右转;4掉头;5直左;6直右;7左直右;8左右;9左转掉头;10直行掉头;11右转掉头;12左直掉头;13直右掉头;14左直右掉头;15左右掉头',\n")
@ExcelIgnore
private Integer turn;
@ApiModelProperty(value = "车道,从左车道开始编号11、12、13...")
@ExcelProperty("车道号")
private String laneSort;
@ApiModelProperty(value = "流量")
@ExcelIgnore
private Integer flow;
@ApiModelProperty(value = "平均延误")
@ExcelProperty("平均延误")
private Integer delayTime ;
@ApiModelProperty(value = "路口效率指数")
@ExcelProperty("路口效率指数")
private Double efficiencyIndex ;
@ApiModelProperty(value = "效率评价等级")
@ExcelProperty("效率评价等级")
private Double efficiencyEvaluateLevel ;
@ApiModelProperty(value = "饱和度")
@ExcelProperty("饱和度")
private Double saturation;
@ApiModelProperty(value = "拥堵指数")
@ExcelProperty("拥堵指数")
private Double congestionIndex;
@ApiModelProperty(value = "溢出指数")
@ExcelProperty("溢出指数")
private Double overflowIndex;
@ApiModelProperty(value = "失衡指数")
@ExcelProperty("失衡指数")
private Double imbalanceIndex;
@ApiModelProperty(value = "时间占有率")
@ExcelProperty("平均时间占有率%")
private Integer timeOccupancy;
@ApiModelProperty(value = "空间占有率")
// 空间长度占比 todo字段名称展示先不改了
@ExcelProperty("平均空间占有率%")
private Integer vehicleNumsRatioMean;
@ExcelProperty("85位速度")
private double v85;
@ApiModelProperty(value = "路口服务水平")
@ExcelProperty("路口服务水平")
private int serviceLevel;
@ApiModelProperty(value = "拥堵次数")
@ExcelProperty("拥堵次数")
private int congestionTimes;
@ApiModelProperty(value = "溢出次数")
@ExcelProperty("溢出次数")
private int overflowTimes;
@ApiModelProperty(value = "失衡次数")
@ExcelProperty("失衡次数")
private int imbalanceTimes;
@ApiModelProperty(value = "空放次数")
@ExcelProperty("空放次数")
private int freeFlowTimes;
@ApiModelProperty(value = "溢流率")
@ExcelProperty("溢流率")
private double overflowRate;
@ApiModelProperty(value = "冲突点")
@ExcelProperty("冲突点")
private int conflictPoint;
@ApiModelProperty(value = "路口安全系数")
@ExcelProperty("路口安全系数")
private double safetyCoefficient;
@ApiModelProperty(value = "安全评价等级")
@ExcelProperty("安全评价等级")
private double safetyEvaluateLevel;
@ApiModelProperty(value = "交通事件数")
@ExcelProperty("交通事件数")
private int trafficEventNum;
@ApiModelProperty(value = "交通事故数")
@ExcelProperty("交通事故数")
private int trafficAccidentNum;
@ApiModelProperty(value = "不停车通过率")
@ExcelProperty("不停车通过率")
private double noStopPassRate;
@ApiModelProperty(value = "一次停车通过率")
@ExcelProperty("一次停车通过率")
private double oneStopPassRate;
@ApiModelProperty(value = "二次停车通过率")
@ExcelProperty("二次停车通过率")
private double twoStopPassRate;
@ApiModelProperty(value = "路口未清空率")
@ExcelProperty("路口未清空率")
private double crossNoClearRate;
@ApiModelProperty(value = "平均排队长度")
@ExcelProperty("平均排队长度")
private double avgQueueLength;
@ApiModelProperty(value = "绿灯有效利用率")
@ExcelProperty("绿灯有效利用率")
private double greenLightEfficiency ;
@ApiModelProperty(value = "行人平均通过时间")
@ExcelProperty("行人平均通过时间")
private double pedAvgPassTime;
@ApiModelProperty(value = "行人闯红灯率")
@ExcelProperty("行人闯红灯率")
private double pedCrossRedLightRate;
// @ApiModelProperty(value = "车辆总和")
// @ExcelProperty("车辆总和")
// private int allVehiceleFlow;
}
}
...@@ -15,4 +15,14 @@ import lombok.NoArgsConstructor; ...@@ -15,4 +15,14 @@ import lombok.NoArgsConstructor;
public class LanePeriodTurnVO extends CommonCrossIdDateTimeVO { public class LanePeriodTurnVO extends CommonCrossIdDateTimeVO {
@ApiModelProperty(value = "分析粒度【5m:五分钟 10m:10分钟 30m:30分钟 1h:一小时】") @ApiModelProperty(value = "分析粒度【5m:五分钟 10m:10分钟 30m:30分钟 1h:一小时】")
private String granularity; private String granularity;
/**
* 用逗号分隔
*/
@ApiModelProperty(value = "转向")
private String turnType;
/**
* 用逗号分隔
*/
@ApiModelProperty(value = "驶入方向")
private String inDir;
} }
...@@ -49,7 +49,7 @@ public interface CrossDirDataHistMapper extends BaseMapper<CrossDirDataHistPO> { ...@@ -49,7 +49,7 @@ public interface CrossDirDataHistMapper extends BaseMapper<CrossDirDataHistPO> {
* @param granularity 时段 * @param granularity 时段
* @return * @return
*/ */
List<CrossDirDataHistVO> selectByCrossIdAndStartEndDir(String crossId, int startStamp, int endStamp, String dirType, String granularity); List<CrossDirDataHistVO> selectByCrossIdAndStartEndDir(String crossId, int startStamp, int endStamp, List<Integer> dirTypeList, String granularity);
Integer selectMaxDelayTime(String crossId, Integer dirType, Integer inOutType, int startStamp, int endStamp); Integer selectMaxDelayTime(String crossId, Integer dirType, Integer inOutType, int startStamp, int endStamp);
......
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.databus.dto.MetricHistDTO; import net.wanji.databus.dto.MetricHistDTO;
import net.wanji.databus.po.CrossTurnDataHistPO; import net.wanji.databus.po.CrossTurnDataHistPO;
import net.wanji.databus.po.CrossTurnDataHistPOExt; import net.wanji.databus.po.CrossTurnDataHistPOExt;
import net.wanji.databus.vo.CrossTurnDataHistVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -23,6 +24,18 @@ public interface CrossTurnDataHistMapper extends BaseMapper<CrossTurnDataHistPO> ...@@ -23,6 +24,18 @@ public interface CrossTurnDataHistMapper extends BaseMapper<CrossTurnDataHistPO>
List<CrossTurnDataHistPO> selectByCrossId(String crossId, long endTimeStamp, long startTimeStamp); List<CrossTurnDataHistPO> selectByCrossId(String crossId, long endTimeStamp, long startTimeStamp);
/**
* 转向级查询
* @param crossId
* @param startStamp
* @param endStamp
* @param granularity
* @param turnType
* @param inDir
* @return
*/
List<CrossTurnDataHistVO> selectByCrossIdTurn(String crossId, long startStamp, long endStamp, String granularity, List<String> turnTypeList , List<Integer> inDirList);
List<MetricHistDTO> selectMetricHistDTO(String crossId, int startStamp, int endStamp, int dir, String turn); List<MetricHistDTO> selectMetricHistDTO(String crossId, int startStamp, int endStamp, int dir, String turn);
List<CrossTurnDataHistPOExt> selectByMetrics(String crossId, int dirInt, String turnType, int startTimeStamp, int endTimeStamp); List<CrossTurnDataHistPOExt> selectByMetrics(String crossId, int dirInt, String turnType, int startTimeStamp, int endTimeStamp);
......
...@@ -93,4 +93,11 @@ public class CrossTurnDataRealtimePO { ...@@ -93,4 +93,11 @@ public class CrossTurnDataRealtimePO {
public Double greenLightEfficiency; public Double greenLightEfficiency;
@ApiModelProperty(name = "溢流率:交叉口间路段车辆排队长度超出可容纳空间的时长与观测总时长的百分比",notes = "") @ApiModelProperty(name = "溢流率:交叉口间路段车辆排队长度超出可容纳空间的时长与观测总时长的百分比",notes = "")
public Double effusionRate; public Double effusionRate;
@ApiModelProperty(value = "大车流量", notes = "")
private int trafficFlowA;
@ApiModelProperty(value = "中车流量", notes = "")
private int trafficFlowB;
@ApiModelProperty(value = "小车流量", notes = "")
private int trafficFlowC;
} }
package net.wanji.databus.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import net.wanji.databus.po.CrossTurnDataRealtimePO;
/**
* @author duanruiming
* @date 2023/03/12 20:54
*/
@Data
@ApiModel(value = "CrossTurnDataHistVO", description = "路口转向实时数据历史")
public class CrossTurnDataHistVO extends CrossTurnDataRealtimePO {
}
...@@ -77,6 +77,67 @@ ...@@ -77,6 +77,67 @@
and batch_time <![CDATA[ <= ]]> #{endTimeStamp} and batch_time <![CDATA[ <= ]]> #{endTimeStamp}
and batch_time <![CDATA[ >= ]]> #{startTimeStamp} and batch_time <![CDATA[ >= ]]> #{startTimeStamp}
</select> </select>
<!-- 交通指标转向级统计查询:条件:路口id、时间、驶入方向、转向 -->
<select id="selectByCrossIdTurn" resultType="net.wanji.databus.vo.CrossTurnDataHistVO">
SELECT
cross_id AS crossId,
in_dir AS inDir,
turn_type AS turnType,
<choose>
<!-- 小时 -->
<when test="granularity==1">
DATE_FORMAT(start_time, '%Y-%m-%d %H:00:00') AS startTime,
</when>
<!-- 分钟 -->
<otherwise>
DATE_FORMAT(
CONCAT( DATE ( start_time ), ' ', HOUR ( start_time ), ':', FLOOR( MINUTE ( start_time ) / #{granularity} ) * #{granularity} ),
'%Y-%m-%d %H:%i:00'
) AS startTime,
</otherwise>
</choose>
SUM( flow ) AS flow,
avg( traffic_flow_C ) AS trafficFlowC,
avg( traffic_flow_B ) AS trafficFlowB,
avg( traffic_flow_A ) AS trafficFlowA,
avg( speed ) AS speed,
MAX( queue_length ) AS queueLength,
AVG( stop_times ) AS stopTimes
FROM
t_cross_turn_data_hist
WHERE
1 = 1
<if test="crossId != null">
AND cross_id = #{crossId}
</if>
<if test="inDirList != null">
AND in_dir IN
<foreach item="inDir" index="index" collection="inDirList"
open="(" separator="," close=")">
#{inDir}
</foreach>
</if>
<if test="turnTypeList != null">
AND turn_type IN
<foreach item="turnType" index="index" collection="turnTypeList"
open="(" separator="," close=")">
#{turnType}
</foreach>
</if>
and batch_time <![CDATA[ >= ]]> #{startStamp}
and batch_time <![CDATA[ <= ]]> #{endStamp}
GROUP BY
cross_id,
in_dir,
turn_type,
startTime
ORDER BY
startTime DESC,
in_dir,
turn_type
</select>
<select id="selectMetricHistDTO" resultType="net.wanji.databus.dto.MetricHistDTO"> <select id="selectMetricHistDTO" resultType="net.wanji.databus.dto.MetricHistDTO">
select status, flow, speed, sturation, stop_times, delay_time, batch_time, one_stop_rate, queue_length, effusion_rate, no_stop_rate, green_light_efficiency select status, flow, speed, sturation, stop_times, delay_time, batch_time, one_stop_rate, queue_length, effusion_rate, no_stop_rate, green_light_efficiency
......
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