Commit cbcd31bb authored by 黄伟铭's avatar 黄伟铭

国产化修改

parent 73675fa9
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
WHERE WHERE
1=1 1=1
<if test="startTime != null and endTime != ''"> <if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime} and dt >= CAST(#{startTime} AS INT4) and dt &lt;= CAST(#{endTime} AS INT4)
</if> </if>
<if test="crossId != null and crossId != ''"> <if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId} and t1.cross_id = #{crossId}
...@@ -202,8 +202,8 @@ ...@@ -202,8 +202,8 @@
dir, dir,
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 , TO_CHAR(t1.window_start_time,'HH24:MI') AS hours_window_start_time ,
DATE_FORMAT(t1.window_start_time, '%Y-%m-%d %H:%i:%s') AS winStartTime, TO_CHAR(t1.window_start_time, 'YYYY-MM-DD HH24:MI:SS') 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
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
and t1.event_type = #{eventType} and t1.event_type = #{eventType}
</if> </if>
GROUP BY GROUP BY
DATE_FORMAT(t1.window_start_time,'%H:%i') TO_CHAR(t1.window_start_time,'HH24:MI')
ORDER BY event_number desc ORDER BY event_number desc
limit 1 limit 1
</select> </select>
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
dir, dir,
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, TO_CHAR(t1.window_start_time,'HH24:MI') AS hours_window_start_time,
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
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
WHERE WHERE
1=1 1=1
<if test="startTime != null and endTime != ''"> <if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime} and dt >= CAST(#{startTime} AS INT4) and dt &lt;= CAST(#{endTime} AS INT4)
</if> </if>
<if test="crossId != null and crossId != ''"> <if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId} and t1.cross_id = #{crossId}
...@@ -301,7 +301,7 @@ ...@@ -301,7 +301,7 @@
and t1.cross_id = #{nextCrossid} and t1.cross_id = #{nextCrossid}
</if> </if>
<if test="startTimeAll != null and endTimeALL !=null "> <if test="startTimeAll != null and endTimeALL !=null ">
and start_time >= #{startTimeAll} AND start_time &lt;= #{endTimeALL} and start_time >= TO_TIMESTAMP(#{startTimeAll},'YYYY-MM-DD HH24:MI:SS') AND start_time &lt;= TO_TIMESTAMP(#{endTimeALL},'YYYY-MM-DD HH24:MI:SS')
</if> </if>
</select> </select>
<select id="getCrossTurnInfo" parameterType="map" resultType="CrossTurnInfo"> <select id="getCrossTurnInfo" parameterType="map" resultType="CrossTurnInfo">
...@@ -326,7 +326,7 @@ ...@@ -326,7 +326,7 @@
and b.cross_id = #{crossId} and b.cross_id = #{crossId}
</if> </if>
<if test="startTimeAll!=null and endTimeALL!=null "> <if test="startTimeAll!=null and endTimeALL!=null ">
AND b.start_time >= #{startTimeAll} and b.start_time &lt;= #{endTimeALL} AND b.start_time >= TO_TIMESTAMP(#{startTimeAll},'YYYY-MM-DD HH24:MI:SS') AND b.start_time &lt;= TO_TIMESTAMP(#{endTimeALL},'YYYY-MM-DD HH24:MI:SS')
</if> </if>
AND (in_dir,turn_type) in ( AND (in_dir,turn_type) in (
<foreach collection="crossTurnInfo" item="pair" open="(" separator="),(" close=")"> <foreach collection="crossTurnInfo" item="pair" open="(" separator="),(" close=")">
...@@ -341,7 +341,7 @@ ...@@ -341,7 +341,7 @@
VALUES VALUES
<foreach collection="crossHourOverFlowList" item="item" separator=","> <foreach collection="crossHourOverFlowList" item="item" separator=",">
(#{item.crossId},#{item.overflowDir},#{item.outFlowSum},#{item.outFlowAvg},#{item.nextCrossLaneNum},#{item.nextCrossCapacity}, (#{item.crossId},#{item.overflowDir},#{item.outFlowSum},#{item.outFlowAvg},#{item.nextCrossLaneNum},#{item.nextCrossCapacity},
#{item.lengthToNextCross}, #{item.overflowStartTime}, #{item.overflowEndTime}, #{item.overflowNum}, #{item.dt}) #{item.lengthToNextCross}, TO_TIMESTAMP(#{item.overflowStartTime},'YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP(#{item.overflowEndTime},'YYYY-MM-DD HH24:MI:SS'), #{item.overflowNum}, #{item.dt})
</foreach> </foreach>
</select> </select>
......
...@@ -167,61 +167,55 @@ ...@@ -167,61 +167,55 @@
<!-- 新增表t_analysis_problem_green_day信息 --> <!-- 新增表t_analysis_problem_green_day信息 -->
<insert id="insertAnalysisProblemGreenDay"> <insert id="insertAnalysisProblemGreenDay">
insert into t_analysis_problem_green_day (id,green_id,area_id,event_category,event_type,event_number,event_total_time,dt,insert_time) insert into t_analysis_problem_green_day (id,green_id,area_id,event_category,event_type,event_number,event_total_time,dt,insert_time)
select UUID(), a.green_id, b.area_id,a.category,a.type,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, a.start_time , a.end_time) ) as duration , select uuid_generate_v4(), a.green_id, b.area_id,a.category,a.type,count(1) as event_number ,
sum( extract(epoch from (a.end_time - a.start_time)) ) as duration ,
dt , now() dt , now()
from t_event_info a from t_event_info a
left join t_greenwave_info b on a.green_id = b.id left join t_greenwave_info b on a.green_id = b.id
where dt = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d') and a.type in (705,706) and a.green_id != '' where dt = CAST(TO_CHAR(DATE_SUB(now(),INTERVAL 1 DAY),'YYYYMMDD') AS INT4) and a.type in ('705','706') and a.green_id != ''
group by a.green_id, b.area_id,a.category,a.type group by a.green_id, b.area_id,a.category,a.type
ON DUPLICATE KEY UPDATE ON CONFLICT (green_id,event_type,dt)
id=VALUES(id), DO UPDATE SET
green_id=VALUES(green_id), id=excluded.id,
area_id=VALUES(area_id), area_id=excluded.area_id,
event_category=VALUES(event_category), event_category=excluded.event_category,
event_type=VALUES(event_type), event_number=excluded.event_number,
event_number=VALUES(event_number), event_total_time=excluded.event_total_time,
event_total_time=VALUES(event_total_time), window_start_time=excluded.window_start_time,
window_start_time=VALUES(window_start_time), window_end_time=excluded.window_end_time,
window_end_time=VALUES(window_end_time), insert_time=excluded.insert_time
dt=VALUES(dt),
insert_time=VALUES(insert_time)
</insert> </insert>
<!-- 新增表t_analysis_problem_green_hour信息 --> <!-- 新增表t_analysis_problem_green_hour信息 -->
<insert id="insertAnalysisProblemGreenHour"> <insert id="insertAnalysisProblemGreenHour">
insert into t_analysis_problem_green_hour (id,green_id,area_id,event_category,event_type,dir,event_number,event_total_time,window_start_time,window_end_time,dt,insert_time) insert into t_analysis_problem_green_hour (id,green_id,area_id,event_category,event_type,dir,event_number,event_total_time,window_start_time,window_end_time,dt,insert_time)
select uuid(), d.green_id, e.area_id,d.category,d.type,d.dir,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, d.start_time , d.end_time) ) as duration , select uuid_generate_v4(), d.green_id, e.area_id,d.category,d.type,d.dir,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, d.start_time , d.end_time) ) as duration ,
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00') as dh1, DATE_FORMAT(now(),'%Y-%m-%d %H:00:00') as dh2, DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'YYYY-MM-DD HH24:00:00') as dh1, DATE_FORMAT(now(),'YYYY-MM-DD HH24:00:00') as dh2,
DATE_FORMAT(now(),'%Y%m%d') as dt , now() DATE_FORMAT(now(),'YYYYMMDD') as dt , now()
from from
(select DISTINCT b.green_id,b.category,b.type,b.start_time,b.end_time, SUBSTRING_INDEX( SUBSTRING_INDEX( b.dir, ',', c.help_topic_id + 1 ), ',', -1 ) AS dir (select DISTINCT b.green_id,b.category,b.type,b.start_time,b.end_time, unnest(string_to_array(dir, ',')) AS dir
from from
(select a.green_id,a.category,a.type,a.start_time,a.end_time,SUBSTR(a.dir,2,LENGTH(a.dir)-2) as dir (select a.green_id,a.category,a.type,a.start_time,a.end_time,SUBSTR(a.dir,2,LENGTH(a.dir)-2) as dir
from t_event_info a from t_event_info a
where DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00') where a.start_time >= TO_TIMESTAMP(CAST(DATE_SUB(now(),INTERVAL 1 HOUR) AS VARCHAR),'YYYY-MM-DD HH24:00:00')
and DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ < ]]> DATE_FORMAT(now(),'%Y-%m-%d %H:00:00') and a.start_time <![CDATA[ < ]]> TO_TIMESTAMP(CAST(now() AS VARCHAR),'YYYY-MM-DD HH24:00:00')
and a.type in (705,706) and a.green_id != '' and a.type in ('705','706') and a.green_id != ''
and a.dir is not null and a.dir is not null
and length(a.dir)>2 and length(a.dir)>2
) b ) b
INNER JOIN mysql.help_topic c ON c.help_topic_id <![CDATA[ < ]]> ( ) d
LENGTH( b.dir ) - LENGTH( REPLACE(b.dir,',','') ) + 1
)) d
left join t_greenwave_info e on d.green_id = e.id left join t_greenwave_info e on d.green_id = e.id
group by d.green_id, e.area_id,d.category,d.type,d.dir group by d.green_id, e.area_id,d.category,d.type,d.dir
ON DUPLICATE KEY UPDATE ON CONFLICT (dir,green_id,dt,event_type,window_start_time)
id=VALUES(id), DO UPDATE SET
green_id=VALUES(green_id), id=excluded.id,
area_id=VALUES(area_id), area_id=excluded.area_id,
event_category=VALUES(event_category), event_category=excluded.event_category,
event_type=VALUES(event_type), dir=excluded.dir,
dir=VALUES(dir), event_number=excluded.event_number,
event_number=VALUES(event_number), event_total_time=excluded.event_total_time,
event_total_time=VALUES(event_total_time), window_end_time=excluded.window_end_time,
window_start_time=VALUES(window_start_time), insert_time=excluded.insert_time
window_end_time=VALUES(window_end_time),
dt=VALUES(dt),
insert_time=VALUES(insert_time)
; ;
</insert> </insert>
...@@ -229,7 +223,7 @@ ...@@ -229,7 +223,7 @@
<select id="checkData" resultMap="AnalysisProblemGreenDayMap"> <select id="checkData" resultMap="AnalysisProblemGreenDayMap">
SELECT dt SELECT dt
FROM t_analysis_problem_green_day FROM t_analysis_problem_green_day
WHERE dt = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d') WHERE dt = cast(to_char(DATE_SUB(now(),INTERVAL 1 DAY),'YYYYMMDD') as int4)
</select> </select>
<select id="getListGreenByProblemSum" parameterType="map" resultMap="AnalysisProblemGreenDayMap"> <select id="getListGreenByProblemSum" parameterType="map" resultMap="AnalysisProblemGreenDayMap">
...@@ -244,7 +238,7 @@ ...@@ -244,7 +238,7 @@
1=1 1=1
<if test="startTime!=null and endTime!=''"> <if test="startTime!=null and endTime!=''">
<![CDATA[ <![CDATA[
AND dt>=#{startTime} AND dt<=#{endTime} AND dt >= CAST(#{startTime} AS INT4) and dt &lt;= CAST(#{endTime} AS INT4)
]]> ]]>
</if> </if>
<if test="greenId!=null and greenId!=''"> <if test="greenId!=null and greenId!=''">
...@@ -266,7 +260,7 @@ ...@@ -266,7 +260,7 @@
WHERE WHERE
1 = 1 1 = 1
<if test="startTime != null and endTime != ''"> <if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime} and dt >= CAST(#{startTime} AS INT4) and dt &lt;= CAST(#{endTime} AS INT4)
</if> </if>
<if test="greenId != null and greenId != ''"> <if test="greenId != null and greenId != ''">
and t1.green_id = #{greenId} and t1.green_id = #{greenId}
......
...@@ -165,12 +165,12 @@ ...@@ -165,12 +165,12 @@
,#{eventType} ,#{eventType}
,#{eventNumber} ,#{eventNumber}
,#{eventTotalTime} ,#{eventTotalTime}
,#{windowStartTime} ,to_timestamp(#{windowStartTime},'YYYY-MM-DD HH24:MI:SS')
,#{windowEndTime} ,to_timestamp(#{windowEndTime},'YYYY-MM-DD HH24:MI:SS')
,#{greenId} ,#{greenId}
,#{dir} ,#{dir}
,#{dt} ,#{dt}
,#{insertTime} ,o_timestamp(#{insertTime},'YYYY-MM-DD HH24:MI:SS')
) )
</insert> </insert>
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
SELECT SELECT
t1.green_id, t1.green_id,
t2.cross_id, t2.cross_id,
t3.`name` as crossname, t3.name as crossname,
t2.event_type, t2.event_type,
t4.label typeName, t4.label typeName,
dt, dt,
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
WHERE WHERE
1=1 1=1
<if test="startTime!=null and endTime!=''"> <if test="startTime!=null and endTime!=''">
AND dt>= #{startTime} and dt &lt;= #{endTime} AND dt >= CAST(#{startTime} AS INT4) and dt &lt;= CAST(#{endTime} AS INT4)
</if> </if>
<if test="greenId!=null and greenId!=''"> <if test="greenId!=null and greenId!=''">
AND t1.green_id= #{greenId} AND t1.green_id= #{greenId}
...@@ -207,7 +207,7 @@ ...@@ -207,7 +207,7 @@
dt, dt,
dir, dir,
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 , to_char(t1.window_start_time,'HH24:MI') AS hours_window_start_time ,
t1.event_type, t1.event_type,
t2.label AS typeName t2.label AS typeName
FROM t_analysis_problem_green_hour t1 FROM t_analysis_problem_green_hour t1
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
WHERE WHERE
1=1 1=1
<if test="startTime!=null and endTime!=''"> <if test="startTime!=null and endTime!=''">
AND dt>= #{startTime} and dt &lt;= #{endTime} AND dt >= CAST(#{startTime} AS INT4) and dt &lt;= CAST(#{endTime} AS INT4)
</if> </if>
<if test="greenId!=null and greenId!=''"> <if test="greenId!=null and greenId!=''">
AND t1.green_id= #{greenId} AND t1.green_id= #{greenId}
...@@ -275,7 +275,7 @@ ...@@ -275,7 +275,7 @@
WHERE WHERE
1=1 1=1
<if test="startTime!=null and endTime!=null"> <if test="startTime!=null and endTime!=null">
AND dt>= #{startTime} and dt &lt;= #{endTime} AND dt >= CAST(#{startTime} AS INT4) and dt &lt;= CAST(#{endTime} AS INT4)
</if> </if>
GROUP BY GROUP BY
cross_id, cross_id,
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
</select> </select>
<select id="getSpecialDate" resultType="java.util.Map"> <select id="getSpecialDate" resultType="java.util.Map">
SELECT DATE_FORMAT(special_date, '%Y-%m-%d %H:%i:%s') AS special_date, plan_id SELECT to_char(special_date, 'YYYY-MM-DD HH24:MI:SS') AS special_date, plan_id
FROM t_base_cross_schedules_plan FROM t_base_cross_schedules_plan
WHERE cross_id = #{crossId} WHERE cross_id = #{crossId}
<if test="endTime != null and endTime != '' and startTime != null and startTime !='' "> <if test="endTime != null and endTime != '' and startTime != null and startTime !='' ">
and special_date between #{startTime} and #{endTime} and special_date between to_timestamp(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') and to_timestamp(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
</if> </if>
AND week = 0 AND week = 0
</select> </select>
......
...@@ -256,9 +256,9 @@ ...@@ -256,9 +256,9 @@
,#{travelTime} ,#{travelTime}
,#{speed} ,#{speed}
,#{yearWeek} ,#{yearWeek}
,#{weekStartTime} ,to_timestamp(#{weekStartTime}, 'YYYY-MM-DD HH24:MI:SS')
,#{weekEndTime} ,to_timestamp(#{weekEndTime}, 'YYYY-MM-DD HH24:MI:SS')
,#{insertTime} ,to_timestamp(#{insertTime}, 'YYYY-MM-DD HH24:MI:SS')
,#{congestIndex} ,#{congestIndex}
,#{lastWeekCongestIndex},#{lastWeekCapacity},#{lastWeekStopTimes},#{lastWeekDelayTime},#{lastWeekTravelTime},#{lastWeekSpeed} ,#{lastWeekCongestIndex},#{lastWeekCapacity},#{lastWeekStopTimes},#{lastWeekDelayTime},#{lastWeekTravelTime},#{lastWeekSpeed}
) )
...@@ -297,8 +297,8 @@ ...@@ -297,8 +297,8 @@
#{entity.greenId} #{entity.greenId}
,#{entity.roadDirection} ,#{entity.roadDirection}
,#{entity.weekDay} ,#{entity.weekDay}
,#{entity.optimizeStartTime} ,to_timestamp(#{entity.optimizeStartTime}, 'YYYY-MM-DD HH24:MI:SS')
,#{entity.optimizeEndTime} ,to_timestamp(#{entity.optimizeEndTime}, 'YYYY-MM-DD HH24:MI:SS')
,#{entity.stragetyId} ,#{entity.stragetyId}
,#{entity.optimizeCount} ,#{entity.optimizeCount}
,#{entity.optimizeDuration} ,#{entity.optimizeDuration}
...@@ -308,9 +308,9 @@ ...@@ -308,9 +308,9 @@
,#{entity.travelTime} ,#{entity.travelTime}
,#{entity.speed} ,#{entity.speed}
,#{entity.yearWeek} ,#{entity.yearWeek}
,#{entity.weekStartTime} ,to_timestamp(#{entity.weekStartTime}, 'YYYY-MM-DD HH24:MI:SS')
,#{entity.weekEndTime} ,#{entity.weekEndTime}
,#{entity.insertTime} ,to_timestamp(#{entity.insertTime}, 'YYYY-MM-DD HH24:MI:SS')
,#{entity.congestIndex} ,#{entity.congestIndex}
,#{entity.lastWeekCongestIndex} ,#{entity.lastWeekCongestIndex}
,#{entity.lastWeekCapacity} ,#{entity.lastWeekCapacity}
...@@ -320,32 +320,29 @@ ...@@ -320,32 +320,29 @@
,#{entity.lastWeekSpeed} ,#{entity.lastWeekSpeed}
) )
</foreach> </foreach>
ON DUPLICATE KEY UPDATE ON CONFLICT (year_week,green_id,road_direction,week_day,optimize_start_time)
green_id = VALUES(green_id), DO UPDATE SET
road_direction = VALUES(road_direction), optimize_end_time = excluded.optimize_end_time,
week_day = VALUES(week_day), stragety_id = excluded.stragety_id,
optimize_start_time = VALUES(optimize_start_time), optimize_count = excluded.optimize_count,
optimize_end_time = VALUES(optimize_end_time), optimize_duration = excluded.optimize_duration,
stragety_id = VALUES(stragety_id), capacity = excluded.capacity,
optimize_count = VALUES(optimize_count), stop_times = excluded.stop_times,
optimize_duration = VALUES(optimize_duration), delay_time = excluded.delay_time,
capacity = VALUES(capacity), delay_time = excluded.delay_time,
stop_times = VALUES(stop_times), travel_time = excluded.travel_time,
delay_time = VALUES(delay_time), speed = excluded.speed,
delay_time = VALUES(delay_time), year_week = excluded.year_week,
travel_time = VALUES(travel_time), week_start_time = excluded.week_start_time,
speed = VALUES(speed), week_end_time = excluded.week_end_time,
year_week = VALUES(year_week), insert_time = excluded.insert_time,
week_start_time = VALUES(week_start_time), congest_index = excluded.congest_index,
week_end_time = VALUES(week_end_time), last_week_congest_index = excluded.last_week_congest_index,
insert_time = VALUES(insert_time), last_week_capacity = excluded.last_week_capacity,
congest_index = VALUES(congest_index), last_week_stop_times = excluded.last_week_stop_times,
last_week_congest_index = VALUES(last_week_congest_index), last_week_delay_time = excluded.last_week_delay_time,
last_week_capacity = VALUES(last_week_capacity), last_week_travel_time = excluded.last_week_travel_time,
last_week_stop_times = VALUES(last_week_stop_times), last_week_speed = excluded.last_week_speed
last_week_delay_time = VALUES(last_week_delay_time),
last_week_travel_time = VALUES(last_week_travel_time),
last_week_speed = VALUES(last_week_speed)
</insert> </insert>
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
from t_analysis_green_wave_congest_time_span from t_analysis_green_wave_congest_time_span
where where
year_week=#{yearWeek} and green_id=#{greenId} year_week=#{yearWeek} and green_id=#{greenId}
and congest_start_time > #{peakStartTime} and congest_end_time &lt; #{peakEndTime} and congest_start_time > to_timestamp(#{peakStartTime},'YYYY-MM-DD HH24:00:00') and congest_end_time &lt; to_timestamp(#{peakEndTime},'YYYY-MM-DD HH24:00:00')
<!-- and status=3 --> <!-- and status=3 -->
</select> </select>
...@@ -51,8 +51,8 @@ ...@@ -51,8 +51,8 @@
#{greenId} #{greenId}
,#{roadDirection} ,#{roadDirection}
,#{weekDay} ,#{weekDay}
,#{peakStartTime} ,to_timestamp(#{peakStartTime},'YYYY-MM-DD HH24:00:00')
,#{peakEndTime} ,to_timestamp(#{peakEndTime},'YYYY-MM-DD HH24:00:00')
,#{trafficIndex} ,#{trafficIndex}
,#{status} ,#{status}
,#{travelTime} ,#{travelTime}
...@@ -60,9 +60,9 @@ ...@@ -60,9 +60,9 @@
,#{flow} ,#{flow}
,#{peakType} ,#{peakType}
,#{yearWeek} ,#{yearWeek}
,#{weekStartTime} ,to_timestamp(#{weekStartTime} ,'YYYY-MM-DD HH24:00:00')
,#{weekEndTime} ,to_timestamp(#{weekEndTime},'YYYY-MM-DD HH24:00:00')
,#{insertTime} ,to_timestamp(#{insertTime},'YYYY-MM-DD HH24:00:00')
) )
</insert> </insert>
......
...@@ -240,8 +240,8 @@ ...@@ -240,8 +240,8 @@
) VALUES ( ) VALUES (
#{crossId} #{crossId}
,#{weekDay} ,#{weekDay}
,#{optimizeStartTime} ,to_timestamp(#{optimizeStartTime},'YYYY-MM-DD HH24:00:00')
,#{optimizeEndTime} ,to_timestamp(#{optimizeEndTime},'YYYY-MM-DD HH24:00:00')
,#{stragetyId} ,#{stragetyId}
,#{optimizeCount} ,#{optimizeCount}
,#{optimizeDuration} ,#{optimizeDuration}
...@@ -250,9 +250,9 @@ ...@@ -250,9 +250,9 @@
,#{delayTime} ,#{delayTime}
,#{maxQueueLength} ,#{maxQueueLength}
,#{yearWeek} ,#{yearWeek}
,#{weekStartTime} ,to_timestamp(#{weekStartTime},'YYYY-MM-DD HH24:00:00')
,#{weekEndTime} ,to_timestamp(#{weekEndTime},'YYYY-MM-DD HH24:00:00')
,#{insertTime} ,to_timestamp(#{insertTime},'YYYY-MM-DD HH24:00:00')
,#{lastWeekCapacity} ,#{lastWeekCapacity}
,#{lastWeekStopTimes} ,#{lastWeekStopTimes}
,#{lastWeekDelayTime} ,#{lastWeekDelayTime}
...@@ -296,8 +296,8 @@ ...@@ -296,8 +296,8 @@
( (
#{entity.crossId} #{entity.crossId}
,#{entity.weekDay} ,#{entity.weekDay}
,#{entity.optimizeStartTime} ,to_timestamp(#{entity.optimizeStartTime},'YYYY-MM-DD HH24:00:00')
,#{entity.optimizeEndTime} ,to_timestamp(#{entity.optimizeEndTime},'YYYY-MM-DD HH24:00:00')
,#{entity.stragetyId} ,#{entity.stragetyId}
,#{entity.optimizeCount} ,#{entity.optimizeCount}
,#{entity.optimizeDuration} ,#{entity.optimizeDuration}
...@@ -306,9 +306,9 @@ ...@@ -306,9 +306,9 @@
,#{entity.delayTime} ,#{entity.delayTime}
,#{entity.maxQueueLength} ,#{entity.maxQueueLength}
,#{entity.yearWeek} ,#{entity.yearWeek}
,#{entity.weekStartTime} ,to_timestamp(#{entity.weekStartTime},'YYYY-MM-DD HH24:00:00')
,#{entity.weekEndTime} ,to_timestamp(#{entity.weekEndTime},'YYYY-MM-DD HH24:00:00')
,#{entity.insertTime} ,to_timestamp(#{entity.insertTime},'YYYY-MM-DD HH24:00:00')
,#{entity.lastWeekCapacity} ,#{entity.lastWeekCapacity}
,#{entity.lastWeekStopTimes} ,#{entity.lastWeekStopTimes}
,#{entity.lastWeekDelayTime} ,#{entity.lastWeekDelayTime}
...@@ -322,32 +322,28 @@ ...@@ -322,32 +322,28 @@
,#{entity.lastWeekProblemCount} ,#{entity.lastWeekProblemCount}
) )
</foreach> </foreach>
ON DUPLICATE KEY UPDATE ON CONFLICT (cross_id,year_week,week_day,optimize_start_time,stragety_id)
cross_id = VALUES(cross_id), DO UPDATE SET
week_day = VALUES(week_day), optimize_end_time = excluded.optimize_end_time,
optimize_start_time = VALUES(optimize_start_time), optimize_count = excluded.optimize_count,
optimize_end_time = VALUES(optimize_end_time), optimize_duration = excluded.optimize_duration,
stragety_id = VALUES(stragety_id), capacity = excluded.capacity,
optimize_count = VALUES(optimize_count), stop_times = excluded.stop_times,
optimize_duration = VALUES(optimize_duration), delay_time = excluded.delay_time,
capacity = VALUES(capacity), max_queue_length = excluded.max_queue_length,
stop_times = VALUES(stop_times), week_start_time = excluded.week_start_time,
delay_time = VALUES(delay_time), week_end_time = excluded.week_end_time,
max_queue_length = VALUES(max_queue_length), insert_time = excluded.insert_time,
year_week = VALUES(year_week), last_week_capacity = excluded.last_week_capacity,
week_start_time = VALUES(week_start_time), last_week_stop_times = excluded.last_week_stop_times,
week_end_time = VALUES(week_end_time), last_week_delay_time = excluded.last_week_delay_time,
insert_time = VALUES(insert_time), last_week_max_queue_length = excluded.last_week_max_queue_length,
last_week_capacity = VALUES(last_week_capacity), last_week_speed = excluded.last_week_speed,
last_week_stop_times = VALUES(last_week_stop_times), last_week_congest_index = excluded.last_week_congest_index,
last_week_delay_time = VALUES(last_week_delay_time), dirs = excluded.dirs,
last_week_max_queue_length = VALUES(last_week_max_queue_length), problem_count = excluded.problem_count,
last_week_speed = VALUES(last_week_speed), last_week_optimize_count = excluded.last_week_optimize_count,
last_week_congest_index = VALUES(last_week_congest_index), last_week_optimize_duration = excluded.last_week_optimize_duration,
dirs = VALUES(dirs), last_week_problem_count = excluded.last_week_problem_count
problem_count = VALUES(problem_count),
last_week_optimize_count = VALUES(last_week_optimize_count),
last_week_optimize_duration = VALUES(last_week_optimize_duration),
last_week_problem_count = VALUES(last_week_problem_count)
</insert> </insert>
</mapper> </mapper>
...@@ -26,26 +26,27 @@ ...@@ -26,26 +26,27 @@
#{item.maxCongestionPeriod}, #{item.maxCongestionPeriod},
#{item.secondCongestionPeriod}, #{item.secondCongestionPeriod},
#{item.dayType}, #{item.dayType},
#{item.startTime}, to_timestamp(#{item.startTime},'YYYY-MM-DD HH24:00:00'),
#{item.endTime}, to_timestamp(#{item.endTime},'YYYY-MM-DD HH24:00:00'),
#{item.yearWeek}, #{item.yearWeek},
#{item.insertTime} to_timestamp(#{item.insertTime},'YYYY-MM-DD HH24:00:00')
) )
</foreach> </foreach>
ON DUPLICATE KEY UPDATE ON CONFLICT (green_id,peak_type,day_type,year_week,road_direction)
congest_index = VALUES(congest_index), DO UPDATE SET
max_congest_index = VALUES(max_congest_index), congest_index = excluded.congest_index,
congest_count = VALUES(congest_count), max_congest_index = excluded.max_congest_index,
congest_duration = VALUES(congest_duration), congest_count = excluded.congest_count,
max_congest_duration = VALUES(max_congest_duration), congest_duration = excluded.congest_duration,
flow = VALUES(flow), max_congest_duration = excluded.max_congest_duration,
travel_time = VALUES(travel_time), flow = excluded.flow,
speed = VALUES(speed), travel_time = excluded.travel_time,
max_congestion_period = VALUES(max_congestion_period), speed = excluded.speed,
second_congestion_period = VALUES(second_congestion_period), max_congestion_period = excluded.max_congestion_period,
start_time = VALUES(start_time), second_congestion_period = excluded.second_congestion_period,
end_time = VALUES(end_time), start_time = excluded.start_time,
insert_time = VALUES(insert_time); end_time = excluded.end_time,
insert_time = excluded.insert_time;
</insert> </insert>
<!-- 基本的 CRUD 方法由 MyBatis-Plus 自动生成,无需手动编写 --> <!-- 基本的 CRUD 方法由 MyBatis-Plus 自动生成,无需手动编写 -->
...@@ -54,19 +55,27 @@ ...@@ -54,19 +55,27 @@
select * from t_config_peak_hours; select * from t_config_peak_hours;
</select> </select>
<select id="selectGreenWaveWeekDataByTime" resultType="net.wanji.opt.entity.report.GreenWaveWeekData"> <select id="selectGreenWaveWeekDataByTime" resultType="net.wanji.opt.entity.report.GreenWaveWeekData">
SELECT green_id,road_direction,max(traffic_index) max_congest_index,avg(traffic_index) congest_index,sum(status>=3 and status &lt;=4)*60*5 congest_duration,avg(speed) speed,avg(trval_time) travel_time SELECT green_id,road_direction,max(traffic_index) max_congest_index,avg(traffic_index) congest_index,
from t_greenwave_hist where start_time BETWEEN #{startDate} AND #{endDate} AND TIME( start_time ) BETWEEN #{startTime} AND #{endTime} GROUP BY green_id,road_direction sum(status>=3 and status &lt;=4)*60*5 congest_duration,avg(speed) speed,avg(trval_time) travel_time
from t_greenwave_hist
where to_timestamp(start_time,'YYYY-MM-DD') BETWEEN to_timestamp(#{startDate},'YYYY-MM-DD') AND to_timestamp(#{endDate},'YYYY-MM-DD')
AND to_timestamp( start_time,'HH24:MI:SS' ) BETWEEN to_timestamp(#{startTime},'HH24:MI:SS' ) AND to_timestamp(#{endTime} ,'HH24:MI:SS' )
GROUP BY green_id,road_direction
</select> </select>
<select id="selectGreenWaveWeekData" resultType="net.wanji.opt.entity.report.GreenWaveWeekData"> <select id="selectGreenWaveWeekData" resultType="net.wanji.opt.entity.report.GreenWaveWeekData">
SELECT green_id,road_direction,max(traffic_index) max_congest_index,avg(traffic_index) congest_index,sum(status>=3 and status&lt;=4)*60*5 congest_duration,avg(speed) speed,avg(trval_time) travel_time SELECT green_id,road_direction,max(traffic_index) max_congest_index,avg(traffic_index) congest_index,
from t_greenwave_hist where start_time BETWEEN #{startDate} AND #{endDate} GROUP BY green_id,road_direction sum(status>=3 and status&lt;=4)*60*5 congest_duration,avg(speed) speed,avg(trval_time) travel_time
from t_greenwave_hist where start_time BETWEEN to_timestamp(#{startDate},'YYYY-MM-DD HH24:MI:SS') AND to_timestamp(#{endDate} ,'YYYY-MM-DD HH24:MI:SS')
GROUP BY green_id,road_direction
</select> </select>
<select id="getFlow" resultType="java.lang.Integer"> <select id="getFlow" resultType="java.lang.Integer">
SELECT COALESCE(flow, 0) from SELECT COALESCE(flow, 0) from
(select cross_id from t_greenwave_cross where green_id = #{greenId} and is_key_route = 1 limit 1) cross_data (select cross_id from t_greenwave_cross where green_id = #{greenId} and is_key_route = 1 limit 1) cross_data
left join left join
(SELECT sum(flow) as flow,cross_id from t_cross_dir_data_hist where start_time BETWEEN #{startDate} AND #{endDate} and dir_type = #{dir} GROUP BY cross_id) cross_flow on cross_data.cross_id = cross_flow.cross_id (SELECT sum(flow) as flow,cross_id from t_cross_dir_data_hist
where start_time BETWEEN to_timestamp(#{startDate},'YYYY-MM-DD HH24:MI:SS') AND to_timestamp(#{endDate} ,'YYYY-MM-DD HH24:MI:SS')
and dir_type = #{dir} GROUP BY cross_id) cross_flow on cross_data.cross_id = cross_flow.cross_id
</select> </select>
<select id="getFlowByTime" resultType="java.lang.Integer"> <select id="getFlowByTime" resultType="java.lang.Integer">
...@@ -78,7 +87,7 @@ ...@@ -78,7 +87,7 @@
<select id="selectAllByTime" resultType="net.wanji.databus.dao.entity.GreenwaveHistPO"> <select id="selectAllByTime" resultType="net.wanji.databus.dao.entity.GreenwaveHistPO">
select * from t_greenwave_hist where start_time BETWEEN #{startDate} AND #{endDate} select * from t_greenwave_hist where start_time BETWEEN #{startDate} AND #{endDate}
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
and TIME( start_time ) BETWEEN #{startTime} AND #{endTime} and to_timestamp( start_time,'HH24:MI:SS' ) BETWEEN to_timestamp(#{startTime},'HH24:MI:SS' ) AND to_timestamp(#{endTime} ,'HH24:MI:SS' )
</if> </if>
and green_id = #{greenId} and green_id = #{greenId}
and status >= 3 and status &lt;= 4 and road_direction = #{roadDirection} order by start_time and status >= 3 and status &lt;= 4 and road_direction = #{roadDirection} order by start_time
......
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
DISTINCT DISTINCT
t4.`name` as waveName, t3.`name` as crossName, t4.`name` as waveName, t3.`name` as crossName,
t3.id as crossId, t3.id as crossId,
GROUP_CONCAT(t2.daily_plan_details SEPARATOR ', ') AS dailyPlanDetails STRING_AGG(t2.daily_plan_details , ', ') AS dailyPlanDetails
FROM FROM
t_base_cross_info t3 t_base_cross_info t3
LEFT JOIN t_strategy_priority_daily_info t2 on t3.id = t2.cross_id LEFT JOIN t_strategy_priority_daily_info t2 on t3.id = t2.cross_id
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
select select
id,event_id,event_desc,type,start_time,end_time,source,wkt,image_url,gmt_create,gmt_modified id,event_id,event_desc,type,start_time,end_time,source,wkt,image_url,gmt_create,gmt_modified
from t_event_data from t_event_data
where to_days(#{todayTime}) = to_days(start_time) where TO_CHAR(#{todayTime},'YYYY-MM-DD') = TO_CHAR(start_time,'YYYY-MM-DD')
order by start_time desc; order by start_time desc;
</select> </select>
......
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