Commit 79c7bdcc authored by zhoushiguang's avatar zhoushiguang

路口、绿波干线问题按小时计算更新

parent 7178ce17
......@@ -30,9 +30,14 @@ public class AnalysisProblemHourTask {
@PostConstruct
public void task(){
analysisProblemCrossDayMapper.insertAnalysisProblemCrossHour();
try {
analysisProblemGreenDayMapper.insertAnalysisProblemGreenHour();
analysisProblemCrossDayMapper.insertAnalysisProblemCrossHour();
analysisProblemGreenDayMapper.insertAnalysisProblemGreenHour();
}catch (Exception e){
log.error("计算路口方向、绿波方向问题异常",e);
}
}
}
......@@ -210,6 +210,18 @@
left join t_base_cross_info b on a.cross_id = b.id
where DATE_FORMAT(a.start_time,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y-%m-%d') and a.type in (701,702,703,707)
group by a.cross_id, b.area_id,a.category,a.type
ON DUPLICATE KEY UPDATE
id=VALUES(id),
cross_id=VALUES(cross_id),
area_id=VALUES(area_id),
event_category=VALUES(event_category),
event_type=VALUES(event_type),
event_number=VALUES(event_number),
event_total_time=VALUES(event_total_time),
window_start_time=VALUES(window_start_time),
window_end_time=VALUES(window_end_time),
dt=VALUES(dt),
insert_time=VALUES(insert_time)
</insert>
<!-- 新增表t_analysis_problem_cross_dir_hour信息 -->
......@@ -225,12 +237,29 @@
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')
and DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ < ]]> DATE_FORMAT(now(),'%Y-%m-%d %H:00:00')
and a.type in (701,702,703,707) ) b
and a.type in (701,702,703,707)
and a.dir is not null
and length(a.dir)>2
) b
INNER JOIN mysql.help_topic c ON c.help_topic_id <![CDATA[ < ]]> (
LENGTH( b.dir ) - LENGTH( REPLACE(b.dir,',','') ) + 1
)) d
left join t_base_cross_info e on d.cross_id = e.id
group by d.cross_id, e.area_id,d.category,d.type,d.dir
ON DUPLICATE KEY UPDATE
id=VALUES(id),
cross_id=VALUES(cross_id),
area_id=VALUES(area_id),
event_category=VALUES(event_category),
event_type=VALUES(event_type),
dir=VALUES(dir),
event_number=VALUES(event_number),
event_total_time=VALUES(event_total_time),
window_start_time=VALUES(window_start_time),
window_end_time=VALUES(window_end_time),
dt=VALUES(dt),
insert_time=VALUES(insert_time)
;
</insert>
<!-- 根据条件查询表t_analysis_problem_cross_day信息 -->
......
......@@ -173,6 +173,18 @@
left join t_greenwave_info b on a.green_id = b.id
where DATE_FORMAT(a.start_time,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y-%m-%d') and a.type in (705,706) and a.green_id != ''
group by a.cross_id, b.area_id,a.category,a.type
ON DUPLICATE KEY UPDATE
id=VALUES(id),
green_id=VALUES(green_id),
area_id=VALUES(area_id),
event_category=VALUES(event_category),
event_type=VALUES(event_type),
event_number=VALUES(event_number),
event_total_time=VALUES(event_total_time),
window_start_time=VALUES(window_start_time),
window_end_time=VALUES(window_end_time),
dt=VALUES(dt),
insert_time=VALUES(insert_time)
</insert>
<!-- 新增表t_analysis_problem_green_hour信息 -->
......@@ -188,12 +200,29 @@
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')
and DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ < ]]> DATE_FORMAT(now(),'%Y-%m-%d %H:00:00')
and a.type in (705,706) and a.green_id != '') b
and a.type in (705,706) and a.green_id != ''
and a.dir is not null
and length(a.dir)>2
) b
INNER JOIN mysql.help_topic c ON c.help_topic_id <![CDATA[ < ]]> (
LENGTH( b.dir ) - LENGTH( REPLACE(b.dir,',','') ) + 1
)) d
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
ON DUPLICATE KEY UPDATE
id=VALUES(id),
green_id=VALUES(green_id),
area_id=VALUES(area_id),
event_category=VALUES(event_category),
event_type=VALUES(event_type),
dir=VALUES(dir),
event_number=VALUES(event_number),
event_total_time=VALUES(event_total_time),
window_start_time=VALUES(window_start_time),
window_end_time=VALUES(window_end_time),
dt=VALUES(dt),
insert_time=VALUES(insert_time)
;
</insert>
<!-- 根据条件查询表t_analysis_problem_green_day信息 -->
......
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