Commit 68c1f78a authored by duanruiming's avatar duanruiming

[update] 添加开始时间

parent 0af226e5
package net.wanji.databus.dao.entity; package net.wanji.databus.dao.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -8,8 +9,11 @@ import java.util.Date; ...@@ -8,8 +9,11 @@ import java.util.Date;
@Data @Data
public class GreenwaveRealtimePO { public class GreenwaveRealtimePO {
/** 绿波ID */ /** 绿波ID */
@ApiModelProperty(name = "绿波ID",notes = "") @ApiModelProperty(name = "id",notes = "")
@TableId
private Integer id ; private Integer id ;
@ApiModelProperty(name = "绿波ID",notes = "")
private Integer greenId;
/** 交通状态:1畅通;2缓行;3拥堵;4严重拥堵;5未知 */ /** 交通状态:1畅通;2缓行;3拥堵;4严重拥堵;5未知 */
@ApiModelProperty(name = "交通状态:1畅通;2缓行;3拥堵;4严重拥堵;5未知",notes = "") @ApiModelProperty(name = "交通状态:1畅通;2缓行;3拥堵;4严重拥堵;5未知",notes = "")
private Integer status ; private Integer status ;
...@@ -51,6 +55,9 @@ public class GreenwaveRealtimePO { ...@@ -51,6 +55,9 @@ public class GreenwaveRealtimePO {
@ApiModelProperty(name = "非协调相位二次排队",notes = "") @ApiModelProperty(name = "非协调相位二次排队",notes = "")
private Double uncoordinatePhaseQueue ; private Double uncoordinatePhaseQueue ;
/** 创建时间 */ /** 创建时间 */
@ApiModelProperty(name = "数据时间",notes = "")
private Date startTime ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "") @ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ; private Date gmtCreate ;
/** 修改时间 */ /** 修改时间 */
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="net.wanji.databus.dao.entity.GreenwaveHistPO"> <resultMap id="BaseResultMap" type="net.wanji.databus.dao.entity.GreenwaveHistPO">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="greenId" column="green_id"/>
<result property="status" column="status"/> <result property="status" column="status"/>
<result property="type" column="type"/> <result property="type" column="type"/>
<result property="trafficIndex" column="traffic_index"/> <result property="trafficIndex" column="traffic_index"/>
...@@ -17,58 +18,71 @@ ...@@ -17,58 +18,71 @@
<result property="cordReliability" column="cord_reliability"/> <result property="cordReliability" column="cord_reliability"/>
<result property="cordQueueRatio" column="cord_queue_ratio"/> <result property="cordQueueRatio" column="cord_queue_ratio"/>
<result property="uncoordinatePhaseQueue" column="uncoordinate_phase_queue"/> <result property="uncoordinatePhaseQueue" column="uncoordinate_phase_queue"/>
<result property="startTime" column="start_time"/>
<result property="gmtCreate" column="gmt_create"/> <result property="gmtCreate" column="gmt_create"/>
<result property="gmtModified" column="gmt_modified"/> <result property="gmtModified" column="gmt_modified"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id,status,type,traffic_index,speed,trval_time,stop_times,queue_length,cong_rate,delay_time,nopark_pass_rate, id, green_id, status,type,traffic_index,speed,trval_time,stop_times,queue_length,cong_rate,delay_time,nopark_pass_rate,
cord_reliability,cord_queue_ratio,uncoordinate_phase_queue,gmt_create,gmt_modified cord_reliability,cord_queue_ratio,uncoordinate_phase_queue, start_time, gmt_create,gmt_modified
</sql> </sql>
<select id="selectRunMonitor" resultType="net.wanji.databus.dao.entity.GreenwaveHistPOExt"> <select id="selectRunMonitor" resultType="net.wanji.databus.dao.entity.GreenwaveHistPOExt">
SELECT SELECT DATE_FORMAT(gmt_modified, '%Y-%m-%d %H:00:00') AS hour,
DATE_FORMAT(gmt_modified, '%Y-%m-%d %H:00:00') AS hour, ROUND(AVG(speed)) AS avg_speed,
ROUND(AVG(speed)) AS avg_speed, ROUND(AVG(traffic_index), 2) AS congestion_index
ROUND(AVG(traffic_index),2) AS congestion_index FROM t_greenwave_hist
FROM WHERE gmt_modified &gt;= DATE_SUB(DATE_FORMAT(#{nowTime}, '%Y-%m-%d %H:00:00'), INTERVAL 10 HOUR)
t_greenwave_hist AND gmt_modified &lt; DATE_FORMAT(DATE_ADD(#{nowTime}, INTERVAL 1 HOUR), '%Y-%m-%d %H:00:00')
WHERE GROUP BY hour
gmt_modified &gt;= DATE_SUB(DATE_FORMAT(#{nowTime}, '%Y-%m-%d %H:00:00'), INTERVAL 10 HOUR) ORDER BY hour
AND
gmt_modified &lt; DATE_FORMAT(DATE_ADD(#{nowTime}, INTERVAL 1 HOUR), '%Y-%m-%d %H:00:00')
GROUP BY
hour
ORDER BY
hour
</select> </select>
<select id="selectByTimeSection" resultType="net.wanji.databus.dao.entity.GreenwaveHistPO"> <select id="selectByTimeSection" resultType="net.wanji.databus.dao.entity.GreenwaveHistPO">
select t1.id,t1.status,t1.type,t1.traffic_index,t1.speed,t1.trval_time,t1.stop_times,t1.queue_length, select t1.id,
t1.cong_rate,t1.delay_time,t1.nopark_pass_rate,t1.cord_reliability,t1.cord_queue_ratio, t1.status,
t1.uncoordinate_phase_queue,t1.gmt_create,t1.gmt_modified, t2.name as greenwaveName, t2.dir, t2.section_id t1.type,
from t_greenwave_hist t1 join t_greenwave_info t2 on t1.id = t2.id t1.traffic_index,
t1.speed,
t1.trval_time,
t1.stop_times,
t1.queue_length,
t1.cong_rate,
t1.delay_time,
t1.nopark_pass_rate,
t1.cord_reliability,
t1.cord_queue_ratio,
t1.uncoordinate_phase_queue,
t1.gmt_create,
t1.gmt_modified,
t2.name as greenwaveName,
t2.dir,
t2.section_id
from t_greenwave_hist t1
join t_greenwave_info t2 on t1.id = t2.id
where t1.gmt_modified <![CDATA[ <= ]]> #{endTimeStr} where t1.gmt_modified <![CDATA[ <= ]]> #{endTimeStr}
and t1.gmt_modified <![CDATA[ >= ]]> #{startTimeStr} and t1.gmt_modified <![CDATA[ >= ]]> #{startTimeStr}
</select> </select>
<select id="selectByIdAndTimeSection" resultType="net.wanji.databus.dao.entity.GreenwaveHistPO"> <select id="selectByIdAndTimeSection" resultType="net.wanji.databus.dao.entity.GreenwaveHistPO">
select <include refid="Base_Column_List"/> select
<include refid="Base_Column_List"/>
from t_greenwave_hist from t_greenwave_hist
where id = #{greenwaveId} where id = #{greenwaveId}
and gmt_modified <![CDATA[ <= ]]> #{endTimeStr} and gmt_modified <![CDATA[ <= ]]> #{endTimeStr}
and gmt_modified <![CDATA[ >= ]]> #{startTimeStr} and gmt_modified <![CDATA[ >= ]]> #{startTimeStr}
</select> </select>
<insert id="insertBatch" parameterType="net.wanji.databus.dao.entity.GreenwaveHistPO"> <insert id="insertBatch" parameterType="net.wanji.databus.dao.entity.GreenwaveHistPO">
insert into t_greenwave_realtime (status,type,traffic_index,speed,trval_time,stop_times,queue_length,cong_rate,delay_time,nopark_pass_rate, insert into t_greenwave_hist
cord_reliability,cord_queue_ratio,uncoordinate_phase_queue) (<include refid="Base_Column_List"/>)
values values
<foreach collection="list" item="entity" separator="," open="(" close=")"> <foreach collection="list" item="entity" separator=",">
#{entity.status}, #{entity.type}, #{entity.trafficIndex},#{entity.speed}, (#{entity.id}, #{entity.greenId}, #{entity.status}, #{entity.type}, #{entity.trafficIndex},#{entity.speed},
#{entity.trvalTime}, #{entity.stopTimes}, #{entity.queueLength}, #{entity.congRate}, #{entity.trvalTime}, #{entity.stopTimes}, #{entity.queueLength}, #{entity.congRate},
#{entity.delayTime}, #{entity.noparkPassRate}, #{entity.cordReliability}, #{entity.cordQueueRatio}, #{entity.delayTime}, #{entity.noparkPassRate}, #{entity.cordReliability}, #{entity.cordQueueRatio},
#{entity.uncoordinatePhaseQueue} #{entity.uncoordinatePhaseQueue}, #{entity.startTime}, #{entity.gmtCreate}, #{entity.gmtModified})
</foreach> </foreach>
</insert> </insert>
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="net.wanji.databus.dao.entity.GreenwaveRealtimePO"> <resultMap id="BaseResultMap" type="net.wanji.databus.dao.entity.GreenwaveRealtimePO">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="greenId" column="green_id"/>
<result property="status" column="status"/> <result property="status" column="status"/>
<result property="type" column="type"/> <result property="type" column="type"/>
<result property="trafficIndex" column="traffic_index"/> <result property="trafficIndex" column="traffic_index"/>
...@@ -17,32 +18,32 @@ ...@@ -17,32 +18,32 @@
<result property="cordReliability" column="cord_reliability"/> <result property="cordReliability" column="cord_reliability"/>
<result property="cordQueueRatio" column="cord_queue_ratio"/> <result property="cordQueueRatio" column="cord_queue_ratio"/>
<result property="uncoordinatePhaseQueue" column="uncoordinate_phase_queue"/> <result property="uncoordinatePhaseQueue" column="uncoordinate_phase_queue"/>
<result property="startTime" column="start_time"/>
<result property="gmtCreate" column="gmt_create"/> <result property="gmtCreate" column="gmt_create"/>
<result property="gmtModified" column="gmt_modified"/> <result property="gmtModified" column="gmt_modified"/>
</resultMap> </resultMap>
<sql id="baseColumnList"> <sql id="Base_Column_List">
id,status,type,traffic_index,speed,trval_time,stop_times,queue_length,cong_rate,delay_time,nopark_pass_rate, id, green_id, status,type,traffic_index,speed,trval_time,stop_times,queue_length,cong_rate,delay_time,nopark_pass_rate,
cord_reliability, cord_queue_ratio, uncoordinate_phase_queue,gmt_create,gmt_modified cord_reliability, cord_queue_ratio, uncoordinate_phase_queue, start_time, gmt_create,gmt_modified
</sql> </sql>
<select id="selectById" resultType="net.wanji.databus.dao.entity.GreenwaveRealtimePO"> <select id="selectById" resultType="net.wanji.databus.dao.entity.GreenwaveRealtimePO">
select select
<include refid="baseColumnList"/> <include refid="Base_Column_List"/>
from t_greenwave_realtime from t_greenwave_realtime
where id = #{id} where id = #{id}
</select> </select>
<insert id="insertBatch" parameterType="net.wanji.databus.dao.entity.GreenwaveRealtimePO"> <insert id="insertBatch" parameterType="net.wanji.databus.dao.entity.GreenwaveRealtimePO">
insert into t_greenwave_realtime insert into t_greenwave_realtime
(status,type,traffic_index,speed,trval_time,stop_times,queue_length,cong_rate,delay_time,nopark_pass_rate, (<include refid="Base_Column_List"></include>)
cord_reliability, cord_queue_ratio, uncoordinate_phase_queue)
values values
<foreach collection="list" item="entity" separator="," open="(" close=")"> <foreach collection="list" item="entity" separator=",">
#{entity.status}, #{entity.type}, #{entity.trafficIndex}, #{entity.speed}, (#{entity.id}, #{entity.greenId}, #{entity.status}, #{entity.type}, #{entity.trafficIndex}, #{entity.speed},
#{entity.trvalTime}, #{entity.stopTimes}, #{entity.queueLength}, #{entity.congRate}, #{entity.trvalTime}, #{entity.stopTimes}, #{entity.queueLength}, #{entity.congRate},
#{entity.delayTime}, #{entity.noparkPassRate}, #{entity.cordReliability}, #{entity.cordQueueRatio}, #{entity.delayTime}, #{entity.noparkPassRate}, #{entity.cordReliability}, #{entity.cordQueueRatio},
#{entity.uncoordinatePhaseQueue} #{entity.uncoordinatePhaseQueue}, #{entity.startTime}, #{entity.gmtCreate}, #{entity.gmtModified})
</foreach> </foreach>
</insert> </insert>
......
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