Commit 4780005e authored by wangyecheng's avatar wangyecheng

研判路口原因分析

parent 3628c3d9
package net.wanji.opt.entity.judgeanalysis; package net.wanji.opt.entity.judgeanalysis;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
...@@ -79,12 +78,16 @@ public class AnalysisProblemCrossDirHour implements Serializable { ...@@ -79,12 +78,16 @@ public class AnalysisProblemCrossDirHour implements Serializable {
/***非数据库字段****/ /***非数据库字段****/
//类型名称 //类型名称
@TableField(exist = false)
private String typeName; private String typeName;
//数量统计 //数量统计
@TableField(exist = false)
private String countNumber; private String countNumber;
//按小时开始时间 //按小时开始时间
@TableField(exist = false)
private String hours_window_start_time; private String hours_window_start_time;
//开始时间 年月日时分秒 //开始时间 年月日时分秒
@TableField(exist = false)
private String winStartTime; private String winStartTime;
} }
package net.wanji.opt.dao.mapper.judgeanalysis; package net.wanji.opt.dao.mapper.judgeanalysis;
import net.wanji.databus.po.CrossDirDataHistPO;
import net.wanji.databus.po.CrossLaneDataHistPO;
import net.wanji.databus.po.CrossTurnDataHistPO;
import net.wanji.opt.entity.judgeanalysis.AnalysisCrossHourOverFlowTask;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDirHour; import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDirHour;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.wanji.opt.entity.judgeanalysis.CrossCongestionLaneReasonInfo;
import net.wanji.opt.entity.report.ConfigPeakHours;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -50,5 +56,19 @@ public interface AnalysisProblemCrossDirHourMapper extends BaseMapper<AnalysisPr ...@@ -50,5 +56,19 @@ public interface AnalysisProblemCrossDirHourMapper extends BaseMapper<AnalysisPr
List<AnalysisProblemCrossDirHour> selectDirectByProblemTrend(Map<String, Object> Map); List<AnalysisProblemCrossDirHour> selectDirectByProblemTrend(Map<String, Object> Map);
List<AnalysisCrossHourOverFlowTask> getOverFolowInfo(@Param("crossId") String crossId, @Param("startTime") Integer startTime, @Param("endTime") Integer endTime);
List<CrossTurnDataHistPO> getEmptyCrossTurnInfo(@Param("dir") Integer dir,@Param("turn") Integer turn, @Param("startTimeAll") String startTimeAll,@Param("endTimeALL") String endTimeALL);
List<ConfigPeakHours> getpeakHours();
List<AnalysisProblemCrossDirHour> getunBalanceProblem(Map<String, Object> happyParamMap);
List<CrossDirDataHistPO> getunBalancePeakFlow(@Param("dir1") Integer dir1, @Param("crossId") String crossId, @Param("moningPeakStartAll") String moningPeakStartAll, @Param("moningPeakEndAll") String moningPeakEndAll);
List<AnalysisProblemCrossDirHour> getCongestionProblem(Map<String, Object> happyParamMap);
List<CrossCongestionLaneReasonInfo> getCongestionReasoninfo(@Param("crossId") String crossId, @Param("dir") Integer dir, @Param("startTimeAll") String startTimeAll, @Param("endTimeALL") String endTimeALL);
} }
package net.wanji.opt.entity.judgeanalysis;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("t_analysis_cross_overflow_reason")
public class AnalysisCrossHourOverFlowTask {
private static final long serialVersionUID = 1L;
// 路口ID
private String crossId;
// 主要溢出方向
private int overflowDir;
// 出口道总流量
private Integer outFlowSum;
// 平均流量/5min
private Integer outFlowAvg;
// 出口道方向下一个路口进口车道数量
private Integer nextCrossLaneNum;
// 下个路口通行能力
private Integer nextCrossCapacity;
// 到下一个路口之间间距,单位米
private Integer lengthToNextCross;
// 主要溢出时段开始时间
private String overflowStartTime;
// 主要溢出时段截止时间
private String overflowEndTime;
// 主要溢出时段内溢出事件数量
private Integer overflowNum;
// 日期,格式yyyyMMdd
private int dt;
// 数据插入时间
private Date insertTime;
/*
非数据库字段
* */
//溢出开始时间小时
private String overflowStartTimeHours;
//溢出结束时间小时
private String overflowEndTimeHours;
}
package net.wanji.opt.entity.judgeanalysis; package net.wanji.opt.entity.judgeanalysis;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
...@@ -77,11 +76,22 @@ public class AnalysisProblemCrossDirHour implements Serializable { ...@@ -77,11 +76,22 @@ public class AnalysisProblemCrossDirHour implements Serializable {
*/ */
private LocalDateTime insertTime; private LocalDateTime insertTime;
/*
* 问题发生的转向
* */
private Integer turn;
/***非数据库字段****/ /***非数据库字段****/
//类型名称 //类型名称
@TableField(exist = false)
private String typeName; private String typeName;
//数量统计 //数量统计
@TableField(exist = false)
private String countNumber; private String countNumber;
//按小时开始时间 //按小时开始时间
@TableField(exist = false)
private String hours_window_start_time; private String hours_window_start_time;
//开始时间 年月日时分秒
@TableField(exist = false)
private String winStartTime;
} }
package net.wanji.opt.entity.judgeanalysis;
import lombok.Data;
/*
路口拥堵原因返回
* */
@Data
public class CrossCongestionLaneReasonInfo {
private String crossId; // 对应 cross_id
private Integer dir; // 对应 dir
private String id; // 对应 id
private Double sturation; // 对应 avg(sturation)
}
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
<result column="dir" property="dir"/> <result column="dir" property="dir"/>
<result column="dt" property="dt"/> <result column="dt" property="dt"/>
<result column="insert_time" property="insertTime"/> <result column="insert_time" property="insertTime"/>
<result column="turn" property="turn"/>
<result column="hours_window_start_time" property="hours_window_start_time"/> <!-- 添加此行 --> <result column="hours_window_start_time" property="hours_window_start_time"/> <!-- 添加此行 -->
</resultMap> </resultMap>
...@@ -200,9 +201,11 @@ ...@@ -200,9 +201,11 @@
SELECT SELECT
dt, dt,
dir, dir,
turn,
t1.cross_id, t1.cross_id,
sum(event_number)AS event_number , sum(event_number)AS event_number ,
DATE_FORMAT(t1.window_start_time,'%H:%i') AS hours_window_start_time , DATE_FORMAT(t1.window_start_time,'%H:%i') AS hours_window_start_time ,
DATE_FORMAT(t1.window_start_time, '%Y-%m-%d %H:%i:%s') AS winStartTime,
t1.event_type, t1.event_type,
t2.label AS typeName t2.label AS typeName
FROM t_analysis_problem_cross_dir_hour t1 FROM t_analysis_problem_cross_dir_hour t1
...@@ -221,7 +224,7 @@ ...@@ -221,7 +224,7 @@
GROUP BY GROUP BY
DATE_FORMAT(t1.window_start_time,'%H:%i') DATE_FORMAT(t1.window_start_time,'%H:%i')
ORDER BY event_number desc ORDER BY event_number desc
limit 2 limit 1
</select> </select>
<select id="selectDirectByProblemTrend" parameterType="map" resultMap="AnalysisProblemCrossDirHourMap"> <select id="selectDirectByProblemTrend" parameterType="map" resultMap="AnalysisProblemCrossDirHourMap">
...@@ -249,7 +252,154 @@ ...@@ -249,7 +252,154 @@
GROUP BY GROUP BY
dir dir
ORDER BY event_number desc ORDER BY event_number desc
limit 1
</select>
<select id="getOverFolowInfo" parameterType="map" resultType="net.wanji.opt.entity.judgeanalysis.AnalysisCrossHourOverFlowTask">
select
cross_id,overflow_dir,out_flow_sum,out_flow_avg,next_cross_lane_num,
next_cross_capacity,length_to_next_cross,overflow_num,
dt,
DATE_FORMAT(t1.overflow_start_time,'%H:%i') as overflowStartTimeHours,
DATE_FORMAT(t1.overflow_end_time,'%H:%i') as overflowEndTimeHours
FROM t_analysis_cross_overflow_reason t1
WHERE
1=1
<if test="startTime != null and endTime != ''">
and t1.dt >= #{startTime} AND t1.dt &lt;= #{endTime}
</if>
<if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId}
</if>
ORDER BY overflow_num desc
limit 1
</select>
<select id="getEmptyCrossTurnInfo" parameterType="map" resultType="net.wanji.databus.po.CrossTurnDataHistPO">
SELECT
id,turn_type,in_dir,cross_id,
avg(flow) as flow
FROM
t_cross_turn_data_hist t1
WHERE
1=1
<if test="dir != null and dir != ''">
and t1.in_dir = #{dir}
</if>
<if test="turn != null and turn != ''">
and t1.turn_type = #{turn}
</if>
<if test="startTimeAll != null and endTimeALL != ''">
and t1.start_time >= #{startTimeAll} AND t1.start_time &lt;= #{endTimeALL}
</if>
</select>
<select id="getpeakHours" resultType="net.wanji.opt.entity.report.ConfigPeakHours">
select
id,city_code,peak_type,day_type,start_time,end_time
from t_config_peak_hours
</select>
<select id="getunBalanceProblem" parameterType="map" resultMap="AnalysisProblemCrossDirHourMap">
SELECT
dt,
dir,
turn,
t1.cross_id,
event_number,
DATE_FORMAT(t1.window_start_time,'%H:%i') AS hours_window_start_time ,
DATE_FORMAT(t1.window_start_time, '%Y-%m-%d %H:%i:%s') AS winStartTime,
t1.event_type,
t2.label AS typeName
FROM t_analysis_problem_cross_dir_hour t1
JOIN t_config_event_category t2 ON t1.event_type = t2.event_type
WHERE
1=1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
</if>
<if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId}
</if>
<if test="eventType != null and eventType != ''">
and t1.event_type = #{eventType}
</if>
ORDER BY event_number desc
limit 2 limit 2
</select> </select>
<select id="getunBalancePeakFlow" parameterType="map" resultType="net.wanji.databus.po.CrossDirDataHistPO">
SELECT
avg(flow) as flow,
cross_id,
dir_type
FROM
t_cross_dir_data_hist t1
WHERE
1=1
<if test="dir1 != null and dir1 != ''">
and t1.dir_type = #{dir1}
</if>
<if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId}
</if>
<if test="moningPeakStartAll != null and moningPeakEndAll != null ">
and t1.start_time >= #{moningPeakStartAll} AND t1.start_time &lt;= #{moningPeakEndAll}
</if>
</select>
<select id="getCongestionProblem" parameterType="map" resultMap="AnalysisProblemCrossDirHourMap">
SELECT
dt,
dir,
turn,
t1.cross_id,
event_number,
DATE_FORMAT(t1.window_start_time,'%H:%i') AS hours_window_start_time ,
DATE_FORMAT(t1.window_start_time, '%Y-%m-%d %H:%i:%s') AS winStartTime,
t1.event_type,
t2.label AS typeName
FROM t_analysis_problem_cross_dir_hour t1
JOIN t_config_event_category t2 ON t1.event_type = t2.event_type
WHERE
1=1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
</if>
<if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId}
</if>
<if test="eventType != null and eventType != ''">
and t1.event_type = #{eventType}
</if>
ORDER BY event_number desc
limit 1
</select>
<select id="getCongestionReasoninfo" parameterType="map" resultType="CrossCongestionLaneReasonInfo">
SELECT a.cross_id,a.dir,a.id,avg(b.sturation) sturation
from t_base_lane_info a
LEFT JOIN
(
SELECT id,sturation
from t_lane_data_hist
where
1=1
<if test="crossId != null and crossId != ''">
and cross_id = #{crossId}
</if>
<if test="startTimeAll != null and endTimeALL != ''">
and start_time BETWEEN #{startTimeAll} AND #{endTimeALL}
</if>
) b
on a.id=b.id
where
1=1
and a.type=2
<if test="crossId != null and crossId != ''">
and a.cross_id = #{crossId}
</if>
<if test="dir != null and dir != ''">
and t1.dir = #{dir}
</if>
GROUP BY a.cross_id,a.dir,a.id
</select>
</mapper> </mapper>
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