Commit ffb125e1 authored by duwei's avatar duwei

优化交通指标

parent fc457a8a
......@@ -61,6 +61,7 @@ public class RunningEvaluateController {
return JsonViewObject.newInstance().success(res);
}
//TODO 拥堵指数
@ApiOperation(value = "拥堵情况", notes = "拥堵情况", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/congestionStatus",
......@@ -73,6 +74,7 @@ public class RunningEvaluateController {
return JsonViewObject.newInstance().success(res);
}
//TODO 失衡指数
@ApiOperation(value = "失衡情况", notes = "失衡情况", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/unbalanceStatus",
......@@ -85,6 +87,7 @@ public class RunningEvaluateController {
return JsonViewObject.newInstance().success(res);
}
//TODO 溢出指数
@ApiOperation(value = "溢出情况", notes = "溢出情况", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/spilloverStatus",
......
......@@ -1536,7 +1536,6 @@ public class TrendServiceImpl implements TrendService {
vo.setSpeed((int) Math.round(speed));
vo.setFlow(po.getFlow());
vo.setAllFlow(po.getFlow() + po.getNonMotorFlow() + po.getFlow());
//----------------------------
// if (po.getId().contains(crossId.concat(Constants.SystemParam.SEPARATOR_MINUS))) {
// pedFlow += po.getFlow();
......@@ -1561,24 +1560,36 @@ public class TrendServiceImpl implements TrendService {
vo.setStopTimes((int) Math.round(stopTimes));
Double vehheadTime = po.getVehheadTime();
vo.setVehheadTime((int) Math.round(vehheadTime));
//饱和度
vo.setSaturation(0.0);//po.getSaturation()
//饱和度 sturation
if (po.getSturation() != null) {
vo.setSaturation(po.getSturation());
}else {
vo.setSaturation(0.0);
}
//拥堵指数
vo.setCongestionIndex(0.0);
//溢出指数
vo.setOverflowIndex(0.0);
vo.setOverflowIndex(po.getEffusionRate());
//失衡指数
vo.setImbalanceIndex(0.0);
//拥堵次数
vo.setCongestionTimes(0);
//溢出次数
vo.setOverflowTimes(0);
if (po.getEffusionRate() != null) {
vo.setOverflowTimes((int) Math.round(po.getEffusionRate()));
}else {
vo.setOverflowTimes(0);
}
//失衡次数
vo.setImbalanceTimes(0);
//空放次数
vo.setFreeFlowTimes(0);
//溢流率
vo.setOverflowRate(0.0);
if (po.getEffusionRate() != null) {
vo.setOverflowRate(po.getEffusionRate());
}else {
vo.setOverflowRate(0.0);
}
//冲突点
vo.setConflictPoint(0);
......@@ -1602,15 +1613,20 @@ public class TrendServiceImpl implements TrendService {
//交通事故数
vo.setTrafficAccidentNum(0);
//不停车通过率
vo.setNoStopPassRate(0);
vo.setNoStopPassRate(po.getNoStopRate());
//一次停车通过率
vo.setOneStopPassRate(0);
vo.setOneStopPassRate(po.getOneStopRate());
//二次停车通过率
vo.setTwoStopPassRate(0);
vo.setTwoStopPassRate(po.getTwoStopRate());
//路口未清空率
vo.setCrossNoClearRate(0);
//平均排队长度
vo.setAvgQueueLength(0.0);
if (po.getQueueLength() != null) {
vo.setAvgQueueLength(po.getQueueLength());
}else{
vo.setAvgQueueLength(0.0);
}
//绿灯有效利用率
vo.setGreenLightEfficiency(0.0);
//行人平均通过时间
......@@ -1667,12 +1683,15 @@ public class TrendServiceImpl implements TrendService {
Double speed = po.getSpeed();
vo.setSpeed((int) Math.round(speed));
vo.setVehheadDist(0d);//车头间距
Double vehheadTime = 0d;
vo.setVehheadTime((int) Math.round(vehheadTime));//车头时距
Double queueLength = po.getQueueLength();
vo.setQueueLength((int) Math.round(queueLength));
Double stopTimes = po.getStopTimes();
vo.setStopTimes((int) Math.round(stopTimes));
if (po.getVehheadTime() != null) {
vo.setVehheadTime((int) Math.round(po.getVehheadTime()));
}else {
vo.setVehheadTime(0);
}
//----------------------------------------------------------------------------------------------
// if (po.getId().contains(crossId.concat(Constants.SystemParam.SEPARATOR_MINUS))) {
......@@ -1691,11 +1710,15 @@ public class TrendServiceImpl implements TrendService {
//效率评价等级
vo.setEfficiencyEvaluateLevel(0.0);
//饱和度
vo.setSaturation(0.0);//po.getSaturation()
vo.setSaturation(po.getSturation());
//拥堵指数
vo.setCongestionIndex(0.0);
//溢出指数
vo.setOverflowIndex(0.0);
if (po.getEffusionRate() != null) {
vo.setOverflowIndex(po.getEffusionRate());
}else {
vo.setOverflowIndex(0.0);
}
//失衡指数
vo.setImbalanceIndex(0.0);
//拥堵次数
......@@ -1711,10 +1734,10 @@ public class TrendServiceImpl implements TrendService {
//冲突点
vo.setConflictPoint(0);
// Double timeOccupancyDouble = po.getTimeOccupancy();
// if (timeOccupancyDouble != null) {
vo.setTimeOccupancy((int) Math.round(0 * 100));
// }
Double timeOccupancyDouble = po.getTimeOccupancy();
if (timeOccupancyDouble != null) {
vo.setTimeOccupancy((int) Math.round(0 * 100));
}
// Double vehicleLengthRatioMean = po.getVehicleLengthRatioMean();
// if (vehicleLengthRatioMean != null) {
......@@ -1731,11 +1754,23 @@ public class TrendServiceImpl implements TrendService {
//交通事故数
vo.setTrafficAccidentNum(0);
//不停车通过率
vo.setNoStopPassRate(0);
if (po.getNoStopRate() != null) {
vo.setNoStopPassRate(po.getNoStopRate());
}else {
vo.setNoStopPassRate(0);
}
//一次停车通过率
vo.setOneStopPassRate(0);
if (po.getOneStopRate() != null) {
vo.setOneStopPassRate(po.getOneStopRate());
}else {
vo.setOneStopPassRate(0);
}
//二次停车通过率
vo.setTwoStopPassRate(0);
if (po.getTwoStopRate() != null) {
vo.setTwoStopPassRate(po.getTwoStopRate());
}else {
vo.setTwoStopPassRate(0);
}
//路口未清空率
vo.setCrossNoClearRate(0);
//平均排队长度
......@@ -1787,7 +1822,11 @@ public class TrendServiceImpl implements TrendService {
//vo.setAllVehiceleFlow(po.getFlow() + po.getNonMotorFlow());
vo.setAllVehiceleFlow(po.getFlow() + 0);//车辆总和
vo.setPedFlow(0);
vo.setNonMotorFlow(0);//非机动车流量
if (po.getNonMotorFlow() != null) {
vo.setNonMotorFlow((int) Math.round(po.getNonMotorFlow()));//非机动车流量
}else {
vo.setNonMotorFlow(0);
}
vo.setTrafficFlowA((int) po.getTrafficFlowA());
vo.setTrafficFlowB((int) po.getTrafficFlowB());
vo.setTrafficFlowC((int) po.getTrafficFlowC());
......@@ -1798,7 +1837,7 @@ public class TrendServiceImpl implements TrendService {
vo.setVehheadTime((int) Math.round(vehheadTime));//车头时距
Double queueLength = po.getQueueLength();
vo.setQueueLength((int) Math.round(queueLength));
Double stopTimes = po.getStopTimes();
Double stopTimes = po.getStopTimes();//停车次数
vo.setStopTimes((int) Math.round(stopTimes));
//----------------------------------------------------------------------------------------------
......@@ -1818,11 +1857,21 @@ public class TrendServiceImpl implements TrendService {
//效率评价等级
vo.setEfficiencyEvaluateLevel(0.0);
//饱和度
vo.setSaturation(0.0);//po.getSaturation()
if(po.getSturation() != null) {
vo.setSaturation(po.getSturation());
}else {
vo.setSaturation(0.0);
}
//拥堵指数
vo.setCongestionIndex(0.0);
if(po.getEffusionRate() != null) {
vo.setCongestionIndex(po.getEffusionRate());
}else {
vo.setCongestionIndex(0.0);
}
//溢出指数
vo.setOverflowIndex(0.0);
if (po.getEffusionRate() != null) {
vo.setOverflowIndex(po.getEffusionRate());
}
//失衡指数
vo.setImbalanceIndex(0.0);
//拥堵次数
......@@ -1834,14 +1883,18 @@ public class TrendServiceImpl implements TrendService {
//空放次数
vo.setFreeFlowTimes(0);
//溢流率
vo.setOverflowRate(0.0);
if (po.getEffusionRate() != null) {
vo.setOverflowRate(po.getEffusionRate());
}
//冲突点
vo.setConflictPoint(0);
// Double timeOccupancyDouble = po.getTimeOccupancy();
// if (timeOccupancyDouble != null) {
vo.setTimeOccupancy((int) Math.round(0 * 100));
// }
Double timeOccupancyDouble = po.getTimeOccupancy();
if (timeOccupancyDouble != null) {
vo.setTimeOccupancy((int) Math.round(timeOccupancyDouble * 100));
}else {
vo.setTimeOccupancy(0);
}
// Double vehicleLengthRatioMean = po.getVehicleLengthRatioMean();
// if (vehicleLengthRatioMean != null) {
......@@ -1858,30 +1911,41 @@ public class TrendServiceImpl implements TrendService {
//交通事故数
vo.setTrafficAccidentNum(0);
//不停车通过率
vo.setNoStopPassRate(0);
if (po.getNoStopRate() != null) {
vo.setNoStopPassRate(po.getNoStopRate());
}else {
vo.setNoStopPassRate(0);
}
//一次停车通过率
vo.setOneStopPassRate(0);
if (po.getOneStopRate() != null) {
vo.setOneStopPassRate(po.getOneStopRate());
}else {
vo.setOneStopPassRate(0);
}
//二次停车通过率
vo.setTwoStopPassRate(0);
if (po.getTwoStopRate() != null) {
vo.setTwoStopPassRate(po.getTwoStopRate());
}else {
vo.setTwoStopPassRate(0);
}
//路口未清空率
vo.setCrossNoClearRate(0);
//平均排队长度
vo.setAvgQueueLength(0.0);
if (po.getQueueLength() != null) {
vo.setAvgQueueLength(po.getQueueLength());
}else {
vo.setAvgQueueLength(0.0);
}
//绿灯有效利用率
vo.setGreenLightEfficiency(0.0);
//行人平均通过时间
vo.setPedAvgPassTime(0.0);
//行人闯红灯率
vo.setPedCrossRedLightRate(0.0);
// vo.setV85(Math.round(po.getV85() * 100) / 100);
// vo.setAllFlow(pedFlow + po.getNonMotorFlow() + po.getFlow());
//
// vo.setTurn(0);
// String dirName = BaseEnum.SignalDirectionEnum.getNameByCode(po.getDir());
// String turnName = TurnConvertEnum.getDescByKey(po.getTurn());
// vo.setLaneSort(String.join("-", dirName, turnName, String.valueOf(po.getSort())));
......@@ -1913,7 +1977,7 @@ public class TrendServiceImpl implements TrendService {
vo.setAllFlow(0 + po.getNonMotorFlow() + po.getFlow());
vo.setAllVehiceleFlow(po.getFlow() + po.getNonMotorFlow());
vo.setPedFlow(0);
vo.setNonMotorFlow(0);//非机动车流量
vo.setNonMotorFlow(po.getNonMotorFlow());
vo.setTrafficFlowA( po.getTrafficFlowA());
vo.setTrafficFlowB( po.getTrafficFlowB());
vo.setTrafficFlowC( po.getTrafficFlowC());
......@@ -1925,7 +1989,11 @@ public class TrendServiceImpl implements TrendService {
Double queueLength = po.getQueueLength();
vo.setQueueLength((int) Math.round(queueLength));
Double stopTimes = po.getStopTimes();
vo.setStopTimes((int) Math.round(stopTimes));
if (stopTimes != null) {
vo.setStopTimes((int) Math.round(stopTimes));
}else {
vo.setStopTimes(0);
}
//----------------------------------------------------------------------------------------------
......@@ -1947,13 +2015,17 @@ public class TrendServiceImpl implements TrendService {
vo.setEfficiencyEvaluateLevel(0.0);
//饱和度
vo.setSaturation(0.0);//po.getSaturation()
if (po.getSturation() != null) {
vo.setSaturation(po.getSturation());
}else {
vo.setSaturation(0.0);
}
//拥堵指数
vo.setCongestionIndex(0.0);
vo.setCongestionIndex(po.getCongestionIndex());
//溢出指数
vo.setOverflowIndex(0.0);
vo.setOverflowIndex(po.getSpilloverIndex());
//失衡指数
vo.setImbalanceIndex(0.0);
vo.setImbalanceIndex(po.getUnbalanceIndex());
//拥堵次数
vo.setCongestionTimes(0);
//溢出次数
......@@ -1970,11 +2042,15 @@ public class TrendServiceImpl implements TrendService {
Double timeOccupancyDouble = po.getTimeOccupancy();
if (timeOccupancyDouble != null) {
vo.setTimeOccupancy((int) Math.round(timeOccupancyDouble * 100));
}else {
vo.setTimeOccupancy(0);
}
Double vehicleLengthRatioMean = po.getVehicleLengthRatioMean();
if (vehicleLengthRatioMean != null) {
vo.setVehicleNumsRatioMean((int) Math.round(vehicleLengthRatioMean * 100));
}else {
vo.setVehicleNumsRatioMean(0);
}
//路口服务水平
vo.setServiceLevel(0);
......@@ -1987,11 +2063,23 @@ public class TrendServiceImpl implements TrendService {
//交通事故数
vo.setTrafficAccidentNum(0);
//不停车通过率
vo.setNoStopPassRate(0);
if (po.getNoStopRate() != null) {
vo.setNoStopPassRate(po.getNoStopRate());
}else {
vo.setNoStopPassRate(0);
}
//一次停车通过率
vo.setOneStopPassRate(0);
if (po.getOneStopRate() != null) {
vo.setOneStopPassRate(po.getOneStopRate());
}else {
vo.setOneStopPassRate(0);
}
//二次停车通过率
vo.setTwoStopPassRate(0);
if (po.getTwoStopRate() != null) {
vo.setTwoStopPassRate(po.getTwoStopRate());
}else {
vo.setTwoStopPassRate(0);
}
//路口未清空率
vo.setCrossNoClearRate(0);
//平均排队长度
......@@ -2004,7 +2092,7 @@ public class TrendServiceImpl implements TrendService {
vo.setPedCrossRedLightRate(0.0);
// vo.setVehheadDist(po.getVehheadDist());
vo.setNonMotorFlow(po.getNonMotorFlow());
vo.setV85(Math.round(po.getV85() * 100) / 100);
// vo.setTurn(po.getTurn());
......
......@@ -167,7 +167,7 @@ public class TableQueryVO {
@ApiModelProperty(value = "溢出指数")
@ExcelProperty("溢出指数")
private Double overflowIndex;
private Double overflowIndex= 0.0d;
@ApiModelProperty(value = "失衡指数")
@ExcelProperty("失衡指数")
......
......@@ -65,4 +65,8 @@ public class CrossDirDataRealtimePO {
public Double effusionRate;
@ApiModelProperty(value = "绿灯有效利用率", notes = "")
public Double greenLightEfficiency;
@ApiModelProperty(value = "时间占用率", notes = "")
public Double timeOccupancy;
@ApiModelProperty(value = "非机动车流量", notes = "")
public Double nonMotorFlow;
}
......@@ -100,4 +100,8 @@ public class CrossTurnDataRealtimePO {
private int trafficFlowB;
@ApiModelProperty(value = "小车流量", notes = "")
private int trafficFlowC;
@ApiModelProperty(value = "时间占有率", notes = "")
private double timeOccupancy;
@ApiModelProperty(value = "空间占有率", notes = "")
private double vehicleLengthRatioMean;
}
......@@ -10,4 +10,9 @@ import net.wanji.databus.po.CrossDataRealtimePO;
@Data
@ApiModel(value = "CrossDataHistVO", description = "路口实时数据历史")
public class CrossDataHistVO extends CrossDataRealtimePO {
//非机动车流量
//行人流量
//平均车头时距
}
......@@ -15,4 +15,16 @@ public class CrossDirDataHistVO extends CrossDirDataRealtimePO {
public double trafficFlowB;
public double trafficFlowA;
//非机动车流量
//行人数量
//平均车头时距
//拥堵指数
//溢出指数
//失衡指数
}
......@@ -15,5 +15,14 @@ public class CrossLaneDataHistVOExt extends CrossLaneDataRealTimePO {
private Integer sort;
// 转向
private Integer turn;
//非机动车流量
//行人数量
//拥堵指数
//溢出指数
//失衡指数
}
......@@ -11,4 +11,13 @@ import net.wanji.databus.po.CrossTurnDataRealtimePO;
@Data
@ApiModel(value = "CrossTurnDataHistVO", description = "路口转向实时数据历史")
public class CrossTurnDataHistVO extends CrossTurnDataRealtimePO {
//非机动车流量
//行人数量
//拥堵指数
//溢出指数
//失衡指数
}
......@@ -118,7 +118,17 @@
COALESCE ( sum( traffic_flow_A ), 0) AS trafficFlowA,
avg( t2.speed ) AS speed,
MAX( t2.queue_length ) AS queueLength,
AVG( t2.stop_times ) AS stopTimes
AVG( t2.stop_times ) AS stopTimes,
avg(t2.time_occupancy) as timeOccupancy,
avg(t2.sturation) as sturation,
avg(t2.congestion_index) as congestionIndex,
avg(t2.spillover_index) as spilloverIndex,
avg(t2.unbalance_index) as unbalanceIndex,
avg(t2.no_stop_rate) as noStopRate,
avg(t2.one_stop_rate) as oneStopRate,
avg(t2.two_stop_rate) as twoStopRate,
avg(t2.three_stop_rate) as threeStopRate,
avg(t2.non_motor_flow) as nonMotorFlow
FROM
t_base_cross_info t1
LEFT JOIN t_cross_data_hist t2 ON t1.id = t2.cross_id
......
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="net.wanji.databus.dao.mapper.CrossDirDataHistMapper"> <resultMap id="BaseResultMap" type="net.wanji.databus.po.CrossDirDataHistPO"> <result column="id" property="id"></result> <result column="dir_type" property="dirType"></result> <result column="in_out_type" property="inOutType"></result> <result column="cross_id" property="crossId"></result> <result column="length" property="length"></result> <result column="status" property="status"></result> <result column="traffic_index" property="trafficIndex"></result> <result column="start_time" property="startTime"></result> <result column="capacity" property="capacity"></result> <result column="duration" property="duration"></result> <result column="flow" property="flow"></result> <result column="speed" property="speed"></result> <result column="queue_length" property="queueLength"></result> <result column="stop_times" property="stopTimes"></result> <result column="delay_time" property="delayTime"></result> <result column="sturation" property="sturation"></result> <result column="batch_time" property="batchTime"></result> <result column="gmt_create" property="gmtCreate"></result> <result column="gmt_modified" property="gmtModified"></result> <result column="effusion_rate" property="effusionRate"></result> <result column="green_light_efficiency" property="greenLightEfficiency"></result> </resultMap> <sql id="Base_Column_List"> id,dir_type,in_out_type,cross_id,length,status,traffic_index,start_time,capacity,duration,flow,speed,queue_length,stop_times, delay_time,sturation,no_stop_rate,one_stop_rate,two_stop_rate,three_stop_rate,batch_time,gmt_create,gmt_modified,effusion_rate, green_light_efficiency </sql> <insert id="insertBatch" parameterType="net.wanji.databus.po.CrossDirDataHistPO"> insert ignore into t_cross_dir_data_hist (<include refid="Base_Column_List"></include>) values <foreach collection="list" item="entity" separator=","> ( #{entity.id}, #{entity.dirType}, #{entity.inOutType}, #{entity.crossId}, #{entity.length}, #{entity.status}, #{entity.trafficIndex}, #{entity.startTime}, #{entity.capacity}, #{entity.duration}, #{entity.flow}, #{entity.speed}, #{entity.queueLength}, #{entity.stopTimes}, #{entity.delayTime}, #{entity.sturation}, #{entity.noStopRate},#{entity.oneStopRate},#{entity.twoStopRate},#{entity.threeStopRate},#{entity.batchTime}, #{entity.gmtCreate}, #{entity.gmtModified},#{entity.effusionRate},#{entity.greenLightEfficiency}) </foreach> </insert> <delete id="deleteBatch" parameterType="String"> delete from t_cross_dir_data_hist where cross_id in <foreach collection="list" item="crossId" separator="," open="(" close=")"> #{crossId} </foreach> </delete> <select id="selectByCrossIdAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and batch_time <![CDATA[ >= ]]> #{preSeconds} order by batch_time </select> <select id="selectByCrossIdDirAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type = #{dir} and batch_time <![CDATA[ >= ]]> #{preSeconds} order by batch_time </select> <select id="selectByCrossIdInOutTimestamp" resultType="net.wanji.databus.bo.CrossDirDataHistAvgBO"> SELECT dir_type as dirType, avg(capacity) as avgCapacity, avg(flow) as avgFlow, avg(queue_length) as avgQueueLength, avg(traffic_index) as avgIndex, avg(effusion_rate) as avgeffusionRate FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND in_out_type = #{inOutType} AND batch_time <![CDATA[ >= ]]> #{preSeconds} AND batch_time <![CDATA[ < ]]> #{endSeconds} GROUP BY dir_type </select> <select id="selectNoPark" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 2 and dir_type = #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectPhaseQueue" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 2 and dir_type != #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectNoParkEnd" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type = #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectPhaseQueueEnd" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type != #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectMetricHistDTO" resultType="net.wanji.databus.dto.MetricHistDTO"> select status, start_time, duration, flow, speed, sturation, capacity, stop_times, delay_time, batch_time, one_stop_rate, queue_length, effusion_rate, no_stop_rate, green_light_efficiency from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type = #{dir} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} order by batch_time </select> <select id="selectByCrossIdAndStartEnd" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <!-- 方向级查询,条件:路口id、时间、方向 --> <select id="selectByCrossIdAndStartEndDir" resultType="net.wanji.databus.vo.CrossDirDataHistVO"> SELECT t1.cross_id AS crossId, t1.dir_type as dirType, <choose> <!-- 小时 --> <when test="granularity==1"> DATE_FORMAT(t2.start_time, '%Y-%m-%d %H:00:00') AS startTime, </when> <!-- 分钟 --> <otherwise> DATE_FORMAT( CONCAT( DATE ( t2.start_time ), ' ', HOUR ( t2.start_time ), ':', FLOOR( MINUTE ( t2.start_time ) / #{granularity} ) * #{granularity} ), '%Y-%m-%d %H:%i:00' ) AS startTime, </otherwise> </choose> SUM( t2.flow ) AS flow, COALESCE ( sum( t2.traffic_flow_C ), 0 ) AS trafficFlowC, COALESCE ( sum( t2.traffic_flow_B ), 0 ) AS trafficFlowB, COALESCE ( sum( t2.traffic_flow_A ), 0 ) AS trafficFlowA, avg( t2.speed ) AS speed, MAX( t2.queue_length ) AS queueLength, AVG( t2.stop_times ) AS stopTimes FROM t_base_cross_dir_info t1 LEFT JOIN t_cross_dir_data_hist t2 ON t1.id = t2.id WHERE 1=1 <if test="crossId != null"> AND t1.cross_id = #{crossId} </if> <if test="dirTypeList != null"> AND t1.dir_type IN <foreach item="dirType" index="index" collection="dirTypeList" open="(" separator="," close=")"> #{dirType} </foreach> </if> and t2.batch_time <![CDATA[ >= ]]> #{startStamp} and t2.batch_time <![CDATA[ <= ]]> #{endStamp} GROUP BY t1.cross_id, t1.dir_type, t2.start_time ORDER BY t2.start_time asc, t1.dir_type </select> <select id="selectMaxDelayTime" resultType="java.lang.Integer"> select max(delay_time) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirType} and in_out_type = #{inOutType} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <select id="selectMaxQueueLength" resultType="java.lang.Double"> select max(queue_length) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirType} and in_out_type = #{inOutType} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <select id="selectMaxSaturation" resultType="java.lang.Double"> select max(sturation) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirType} and in_out_type = #{inOutType} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <select id="selectMaxGreenLightEfficiency" resultType="java.lang.Double"> select max(green_light_efficiency) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirCode} and in_out_type = #{code} and batch_time <![CDATA[ >= ]]> #{startTimeStamp} and batch_time <![CDATA[ <= ]]> #{endTimeStamp} </select> <select id="selectByMetrics" resultType="net.wanji.databus.po.CrossDirDataHistPOExt"> SELECT <include refid="Base_Column_List"/> FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND in_out_type = 1 AND dir_type = #{dirInt} AND batch_time <![CDATA[ <= ]]> #{endTimeStamp} AND batch_time <![CDATA[ >= ]]> #{startTimeStamp} </select> <select id="selectByCrossIdsDirsAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"></include> from t_cross_dir_data_hist where cross_id in <foreach collection="crossIdList" item="crossId" separator="," open="(" close=")"> #{crossId} </foreach> and dir_type in <foreach collection="dirCodeList" item="dirCode" separator="," open="(" close=")"> #{dirCode} </foreach> and in_out_type = 1 and batch_time <![CDATA[ >= ]]> #{startTimeStamp} and batch_time <![CDATA[ <= ]]> #{endTimeStamp} order by batch_time </select> <select id="selectByCrossDirAndTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPO"> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND dir_type = #{dirCode} AND in_out_type = 1 AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%Y-%m-%d') BETWEEN #{boStartDayStr} AND #{boEndDayStr} AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%H:%i') BETWEEN #{startHourMinuteStr} AND #{endHourMinuteStr} </select> <select id="selectByCrossIdDirsAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"></include> from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type in <foreach collection="dirCodeList" item="dirCode" separator="," open="(" close=")"> #{dirCode} </foreach> and in_out_type = 1 and batch_time <![CDATA[ >= ]]> #{startTimeStamp} and batch_time <![CDATA[ <= ]]> #{endTimeStamp} order by batch_time </select> <select id="selectByCrossDirsAndTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPO"> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND dir_type in <foreach collection="dirCodeList" item="dirCode" separator="," open="(" close=")"> #{dirCode} </foreach> AND in_out_type = 1 AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%Y-%m-%d') BETWEEN #{boStartDayStr} AND #{boEndDayStr} AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%H:%i') BETWEEN #{startHourMinuteStr} AND #{endHourMinuteStr} </select> <select id="selectByTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPO"><!-- SELECT <include refid="Base_Column_List"></include>--><!-- FROM t_cross_dir_data_hist--><!-- WHERE in_out_type = 1--><!-- AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%Y-%m-%d') BETWEEN #{boStartDayStr} AND #{boEndDayStr}--><!-- AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%H:%i') BETWEEN #{startHourMinuteStr} AND #{endHourMinuteStr}--> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE batch_time BETWEEN UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boStartDayStr}, #{startHourMinuteStr}), '%Y-%m-%d%H:%i')) AND UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boEndDayStr}, #{endHourMinuteStr}), '%Y-%m-%d%H:%i')) AND in_out_type = 1 </select> <select id="selectExtByTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPOExt"> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE batch_time BETWEEN UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boStartDayStr}, #{startHourMinuteStr}), '%Y-%m-%d%H:%i')) AND UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boEndDayStr}, #{endHourMinuteStr}), '%Y-%m-%d%H:%i')) AND in_out_type = 1 </select> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="net.wanji.databus.dao.mapper.CrossDirDataHistMapper"> <resultMap id="BaseResultMap" type="net.wanji.databus.po.CrossDirDataHistPO"> <result column="id" property="id"></result> <result column="dir_type" property="dirType"></result> <result column="in_out_type" property="inOutType"></result> <result column="cross_id" property="crossId"></result> <result column="length" property="length"></result> <result column="status" property="status"></result> <result column="traffic_index" property="trafficIndex"></result> <result column="start_time" property="startTime"></result> <result column="capacity" property="capacity"></result> <result column="duration" property="duration"></result> <result column="flow" property="flow"></result> <result column="speed" property="speed"></result> <result column="queue_length" property="queueLength"></result> <result column="stop_times" property="stopTimes"></result> <result column="delay_time" property="delayTime"></result> <result column="sturation" property="sturation"></result> <result column="batch_time" property="batchTime"></result> <result column="gmt_create" property="gmtCreate"></result> <result column="gmt_modified" property="gmtModified"></result> <result column="effusion_rate" property="effusionRate"></result> <result column="green_light_efficiency" property="greenLightEfficiency"></result> </resultMap> <sql id="Base_Column_List"> id,dir_type,in_out_type,cross_id,length,status,traffic_index,start_time,capacity,duration,flow,speed,queue_length,stop_times, delay_time,sturation,no_stop_rate,one_stop_rate,two_stop_rate,three_stop_rate,batch_time,gmt_create,gmt_modified,effusion_rate, green_light_efficiency </sql> <insert id="insertBatch" parameterType="net.wanji.databus.po.CrossDirDataHistPO"> insert ignore into t_cross_dir_data_hist (<include refid="Base_Column_List"></include>) values <foreach collection="list" item="entity" separator=","> ( #{entity.id}, #{entity.dirType}, #{entity.inOutType}, #{entity.crossId}, #{entity.length}, #{entity.status}, #{entity.trafficIndex}, #{entity.startTime}, #{entity.capacity}, #{entity.duration}, #{entity.flow}, #{entity.speed}, #{entity.queueLength}, #{entity.stopTimes}, #{entity.delayTime}, #{entity.sturation}, #{entity.noStopRate},#{entity.oneStopRate},#{entity.twoStopRate},#{entity.threeStopRate},#{entity.batchTime}, #{entity.gmtCreate}, #{entity.gmtModified},#{entity.effusionRate},#{entity.greenLightEfficiency}) </foreach> </insert> <delete id="deleteBatch" parameterType="String"> delete from t_cross_dir_data_hist where cross_id in <foreach collection="list" item="crossId" separator="," open="(" close=")"> #{crossId} </foreach> </delete> <select id="selectByCrossIdAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and batch_time <![CDATA[ >= ]]> #{preSeconds} order by batch_time </select> <select id="selectByCrossIdDirAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type = #{dir} and batch_time <![CDATA[ >= ]]> #{preSeconds} order by batch_time </select> <select id="selectByCrossIdInOutTimestamp" resultType="net.wanji.databus.bo.CrossDirDataHistAvgBO"> SELECT dir_type as dirType, avg(capacity) as avgCapacity, avg(flow) as avgFlow, avg(queue_length) as avgQueueLength, avg(traffic_index) as avgIndex, avg(effusion_rate) as avgeffusionRate FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND in_out_type = #{inOutType} AND batch_time <![CDATA[ >= ]]> #{preSeconds} AND batch_time <![CDATA[ < ]]> #{endSeconds} GROUP BY dir_type </select> <select id="selectNoPark" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 2 and dir_type = #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectPhaseQueue" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 2 and dir_type != #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectNoParkEnd" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type = #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectPhaseQueueEnd" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type != #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectMetricHistDTO" resultType="net.wanji.databus.dto.MetricHistDTO"> select status, start_time, duration, flow, speed, sturation, capacity, stop_times, delay_time, batch_time, one_stop_rate, queue_length, effusion_rate, no_stop_rate, green_light_efficiency from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type = #{dir} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} order by batch_time </select> <select id="selectByCrossIdAndStartEnd" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <!-- 方向级查询,条件:路口id、时间、方向 --> <select id="selectByCrossIdAndStartEndDir" resultType="net.wanji.databus.vo.CrossDirDataHistVO"> SELECT t1.cross_id AS crossId, t1.dir_type as dirType, <choose> <!-- 小时 --> <when test="granularity==1"> DATE_FORMAT(t2.start_time, '%Y-%m-%d %H:00:00') AS startTime, </when> <!-- 分钟 --> <otherwise> DATE_FORMAT( CONCAT( DATE ( t2.start_time ), ' ', HOUR ( t2.start_time ), ':', FLOOR( MINUTE ( t2.start_time ) / #{granularity} ) * #{granularity} ), '%Y-%m-%d %H:%i:00' ) AS startTime, </otherwise> </choose> SUM( t2.flow ) AS flow, COALESCE ( sum( t2.traffic_flow_C ), 0 ) AS trafficFlowC, COALESCE ( sum( t2.traffic_flow_B ), 0 ) AS trafficFlowB, COALESCE ( sum( t2.traffic_flow_A ), 0 ) AS trafficFlowA, avg( t2.speed ) AS speed, MAX( t2.queue_length ) AS queueLength, AVG( t2.stop_times ) AS stopTimes, AVG( t2.time_occupancy) as timeOccupancy, AVG( t2.sturation) as sturation, AVG( t2.no_stop_rate) as noStopRate, AVG( t2.one_stop_rate) as oneStopRate, AVG( t2.two_stop_rate) as twoStopRate, AVG( t2.three_stop_rate) as threeStopRate, AVG( t2.non_motor_flow) as nonMotorFlow FROM t_base_cross_dir_info t1 LEFT JOIN t_cross_dir_data_hist t2 ON t1.id = t2.id WHERE 1=1 <if test="crossId != null"> AND t1.cross_id = #{crossId} </if> <if test="dirTypeList != null"> AND t1.dir_type IN <foreach item="dirType" index="index" collection="dirTypeList" open="(" separator="," close=")"> #{dirType} </foreach> </if> and t2.batch_time <![CDATA[ >= ]]> #{startStamp} and t2.batch_time <![CDATA[ <= ]]> #{endStamp} GROUP BY t1.cross_id, t1.dir_type, t2.start_time ORDER BY t2.start_time asc, t1.dir_type </select> <select id="selectMaxDelayTime" resultType="java.lang.Integer"> select max(delay_time) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirType} and in_out_type = #{inOutType} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <select id="selectMaxQueueLength" resultType="java.lang.Double"> select max(queue_length) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirType} and in_out_type = #{inOutType} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <select id="selectMaxSaturation" resultType="java.lang.Double"> select max(sturation) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirType} and in_out_type = #{inOutType} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <select id="selectMaxGreenLightEfficiency" resultType="java.lang.Double"> select max(green_light_efficiency) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirCode} and in_out_type = #{code} and batch_time <![CDATA[ >= ]]> #{startTimeStamp} and batch_time <![CDATA[ <= ]]> #{endTimeStamp} </select> <select id="selectByMetrics" resultType="net.wanji.databus.po.CrossDirDataHistPOExt"> SELECT <include refid="Base_Column_List"/> FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND in_out_type = 1 AND dir_type = #{dirInt} AND batch_time <![CDATA[ <= ]]> #{endTimeStamp} AND batch_time <![CDATA[ >= ]]> #{startTimeStamp} </select> <select id="selectByCrossIdsDirsAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"></include> from t_cross_dir_data_hist where cross_id in <foreach collection="crossIdList" item="crossId" separator="," open="(" close=")"> #{crossId} </foreach> and dir_type in <foreach collection="dirCodeList" item="dirCode" separator="," open="(" close=")"> #{dirCode} </foreach> and in_out_type = 1 and batch_time <![CDATA[ >= ]]> #{startTimeStamp} and batch_time <![CDATA[ <= ]]> #{endTimeStamp} order by batch_time </select> <select id="selectByCrossDirAndTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPO"> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND dir_type = #{dirCode} AND in_out_type = 1 AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%Y-%m-%d') BETWEEN #{boStartDayStr} AND #{boEndDayStr} AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%H:%i') BETWEEN #{startHourMinuteStr} AND #{endHourMinuteStr} </select> <select id="selectByCrossIdDirsAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"></include> from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type in <foreach collection="dirCodeList" item="dirCode" separator="," open="(" close=")"> #{dirCode} </foreach> and in_out_type = 1 and batch_time <![CDATA[ >= ]]> #{startTimeStamp} and batch_time <![CDATA[ <= ]]> #{endTimeStamp} order by batch_time </select> <select id="selectByCrossDirsAndTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPO"> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND dir_type in <foreach collection="dirCodeList" item="dirCode" separator="," open="(" close=")"> #{dirCode} </foreach> AND in_out_type = 1 AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%Y-%m-%d') BETWEEN #{boStartDayStr} AND #{boEndDayStr} AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%H:%i') BETWEEN #{startHourMinuteStr} AND #{endHourMinuteStr} </select> <select id="selectByTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPO"><!-- SELECT <include refid="Base_Column_List"></include>--><!-- FROM t_cross_dir_data_hist--><!-- WHERE in_out_type = 1--><!-- AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%Y-%m-%d') BETWEEN #{boStartDayStr} AND #{boEndDayStr}--><!-- AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%H:%i') BETWEEN #{startHourMinuteStr} AND #{endHourMinuteStr}--> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE batch_time BETWEEN UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boStartDayStr}, #{startHourMinuteStr}), '%Y-%m-%d%H:%i')) AND UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boEndDayStr}, #{endHourMinuteStr}), '%Y-%m-%d%H:%i')) AND in_out_type = 1 </select> <select id="selectExtByTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPOExt"> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE batch_time BETWEEN UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boStartDayStr}, #{startHourMinuteStr}), '%Y-%m-%d%H:%i')) AND UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boEndDayStr}, #{endHourMinuteStr}), '%Y-%m-%d%H:%i')) AND in_out_type = 1 </select> </mapper>
\ No newline at end of file
......
......@@ -142,19 +142,26 @@
avg( t1.speed ) AS speed,
avg( t1.vehhead_dist ) AS vehheadDist,
avg( t1.vehhead_time ) AS vehheadTime,
t1.queue_length,
t1.delay_time,
t1.stop_times,
t1.vehhead_time,
t1.vehhead_dist,
t1.batch_time,
t1.time_occupancy,
t1.vehicle_nums_ratio_mean,
t1.start_time,
t1.v_85,
t1.non_motor_flow,
t1.time_occupancy,
t1.vehicle_length_ratio_mean
avg(t1.queue_length) as queueLength,
avg(t1.delay_time) as delayTime,
avg(t1.stop_times) as stopTimes,
avg(t1.vehhead_time) as vehheadTime,
avg(t1.vehhead_dist) as vehheadDist,
avg(t1.batch_time) as batchTime,
avg(t1.time_occupancy) as timeOccupancy,
avg(t1.vehicle_nums_ratio_mean) as vehicleNumsRatioMean,
avg(t1.start_time) as startTime,
avg(t1.v_85) as v85,
avg(t1.non_motor_flow) as nonMotorFlow,
avg(t1.time_occupancy) as timeOccupancy,
avg(t1.vehicle_length_ratio_mean) as vehicleLengthRatioMean,
avg(t1.sturation) as sturation,
avg(t1.no_stop_rate) as noStopRate,
avg(t1.one_stop_rate) as oneStopRate,
avg(t1.two_stop_rate) as twoStopRate,
avg(t1.three_stop_rate) as threeStopRate,
AVG(t1.non_motor_flow) as nonMotorFlow
FROM
t_base_lane_info t2
LEFT JOIN t_lane_data_hist t1 ON t1.id = t2.id
......
......@@ -104,7 +104,16 @@
COALESCE(sum( t2.traffic_flow_A ), 0) AS trafficFlowA,
avg( t2.speed ) AS speed,
MAX( t2.queue_length ) AS queueLength,
AVG( t2.stop_times ) AS stopTimes
AVG( t2.stop_times ) AS stopTimes,
AVG( t2.time_occupancy) as timeOccupancy,
AVG( t2.vehicle_length_ratio_mean) as vehicleLengthRatioMean,
AVG( t2.vehhead_time) as vehheadTime,
AVG( t2.sturation) as sturation,
AVG( t2.no_stop_rate) as noStopRate,
AVG( t2.one_stop_rate) as oneStopRate,
AVG( t2.two_stop_rate) as twoStopRate,
AVG( t2.three_stop_rate) as threeStopRate,
AVG( t2.non_motor_flow) as nonMotorFlow
FROM
t_base_cross_turn_info t1
LEFT JOIN t_cross_turn_data_hist t2 ON t1.id = t2.id
......
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