Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
signal
traffic-signal-platform
Commits
68c1f78a
Commit
68c1f78a
authored
Nov 08, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 添加开始时间
parent
0af226e5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
38 deletions
+60
-38
GreenwaveRealtimePO.java
...ava/net/wanji/databus/dao/entity/GreenwaveRealtimePO.java
+8
-1
GreenwaveHistMapper.xml
wj-databus/src/main/resources/mapper/GreenwaveHistMapper.xml
+42
-28
GreenwaveRealtimeMapper.xml
...bus/src/main/resources/mapper/GreenwaveRealtimeMapper.xml
+10
-9
No files found.
wj-databus/src/main/java/net/wanji/databus/dao/entity/GreenwaveRealtimePO.java
View file @
68c1f78a
package
net
.
wanji
.
databus
.
dao
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
@@ -8,8 +9,11 @@ import java.util.Date;
@Data
public
class
GreenwaveRealtimePO
{
/** 绿波ID */
@ApiModelProperty
(
name
=
"绿波ID"
,
notes
=
""
)
@ApiModelProperty
(
name
=
"id"
,
notes
=
""
)
@TableId
private
Integer
id
;
@ApiModelProperty
(
name
=
"绿波ID"
,
notes
=
""
)
private
Integer
greenId
;
/** 交通状态:1畅通;2缓行;3拥堵;4严重拥堵;5未知 */
@ApiModelProperty
(
name
=
"交通状态:1畅通;2缓行;3拥堵;4严重拥堵;5未知"
,
notes
=
""
)
private
Integer
status
;
...
...
@@ -51,6 +55,9 @@ public class GreenwaveRealtimePO {
@ApiModelProperty
(
name
=
"非协调相位二次排队"
,
notes
=
""
)
private
Double
uncoordinatePhaseQueue
;
/** 创建时间 */
@ApiModelProperty
(
name
=
"数据时间"
,
notes
=
""
)
private
Date
startTime
;
/** 创建时间 */
@ApiModelProperty
(
name
=
"创建时间"
,
notes
=
""
)
private
Date
gmtCreate
;
/** 修改时间 */
...
...
wj-databus/src/main/resources/mapper/GreenwaveHistMapper.xml
View file @
68c1f78a
...
...
@@ -4,6 +4,7 @@
<resultMap
id=
"BaseResultMap"
type=
"net.wanji.databus.dao.entity.GreenwaveHistPO"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"greenId"
column=
"green_id"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"trafficIndex"
column=
"traffic_index"
/>
...
...
@@ -17,58 +18,71 @@
<result
property=
"cordReliability"
column=
"cord_reliability"
/>
<result
property=
"cordQueueRatio"
column=
"cord_queue_ratio"
/>
<result
property=
"uncoordinatePhaseQueue"
column=
"uncoordinate_phase_queue"
/>
<result
property=
"startTime"
column=
"start_time"
/>
<result
property=
"gmtCreate"
column=
"gmt_create"
/>
<result
property=
"gmtModified"
column=
"gmt_modified"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
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
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,
start_time,
gmt_create,gmt_modified
</sql>
<select
id=
"selectRunMonitor"
resultType=
"net.wanji.databus.dao.entity.GreenwaveHistPOExt"
>
SELECT
DATE_FORMAT(gmt_modified, '%Y-%m-%d %H:00:00') AS hour,
ROUND(AVG(speed)) AS avg_speed,
ROUND(AVG(traffic_index),2) AS congestion_index
FROM
t_greenwave_hist
WHERE
gmt_modified
>
= DATE_SUB(DATE_FORMAT(#{nowTime}, '%Y-%m-%d %H:00:00'), INTERVAL 10 HOUR)
AND
gmt_modified
<
DATE_FORMAT(DATE_ADD(#{nowTime}, INTERVAL 1 HOUR), '%Y-%m-%d %H:00:00')
GROUP BY
hour
ORDER BY
hour
SELECT DATE_FORMAT(gmt_modified, '%Y-%m-%d %H:00:00') AS hour,
ROUND(AVG(speed)) AS avg_speed,
ROUND(AVG(traffic_index), 2) AS congestion_index
FROM t_greenwave_hist
WHERE gmt_modified
>
= DATE_SUB(DATE_FORMAT(#{nowTime}, '%Y-%m-%d %H:00:00'), INTERVAL 10 HOUR)
AND gmt_modified
<
DATE_FORMAT(DATE_ADD(#{nowTime}, INTERVAL 1 HOUR), '%Y-%m-%d %H:00:00')
GROUP BY hour
ORDER BY hour
</select>
<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,
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
select t1.id,
t1.status,
t1.type,
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}
and t1.gmt_modified
<![CDATA[ >= ]]>
#{startTimeStr}
</select>
<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
where id = #{greenwaveId}
and gmt_modified
<![CDATA[ <= ]]>
#{endTimeStr}
and gmt_modified
<![CDATA[ >= ]]>
#{startTimeStr}
and gmt_modified
<![CDATA[ <= ]]>
#{endTimeStr}
and gmt_modified
<![CDATA[ >= ]]>
#{startTimeStr}
</select>
<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,
cord_reliability,cord_queue_ratio,uncoordinate_phase_queue
)
insert into t_greenwave_
hist
(
<include
refid=
"Base_Column_List"
/>
)
values
<foreach
collection=
"list"
item=
"entity"
separator=
","
open=
"("
close=
")"
>
#{entity.status}, #{entity.type}, #{entity.trafficIndex},#{entity.speed},
<foreach
collection=
"list"
item=
"entity"
separator=
","
>
(#{entity.id}, #{entity.greenId},
#{entity.status}, #{entity.type}, #{entity.trafficIndex},#{entity.speed},
#{entity.trvalTime}, #{entity.stopTimes}, #{entity.queueLength}, #{entity.congRate},
#{entity.delayTime}, #{entity.noparkPassRate}, #{entity.cordReliability}, #{entity.cordQueueRatio},
#{entity.uncoordinatePhaseQueue}
#{entity.uncoordinatePhaseQueue}
, #{entity.startTime}, #{entity.gmtCreate}, #{entity.gmtModified})
</foreach>
</insert>
...
...
wj-databus/src/main/resources/mapper/GreenwaveRealtimeMapper.xml
View file @
68c1f78a
...
...
@@ -4,6 +4,7 @@
<resultMap
id=
"BaseResultMap"
type=
"net.wanji.databus.dao.entity.GreenwaveRealtimePO"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"greenId"
column=
"green_id"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"trafficIndex"
column=
"traffic_index"
/>
...
...
@@ -17,32 +18,32 @@
<result
property=
"cordReliability"
column=
"cord_reliability"
/>
<result
property=
"cordQueueRatio"
column=
"cord_queue_ratio"
/>
<result
property=
"uncoordinatePhaseQueue"
column=
"uncoordinate_phase_queue"
/>
<result
property=
"startTime"
column=
"start_time"
/>
<result
property=
"gmtCreate"
column=
"gmt_create"
/>
<result
property=
"gmtModified"
column=
"gmt_modified"
/>
</resultMap>
<sql
id=
"
baseColumn
List"
>
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
<sql
id=
"
Base_Column_
List"
>
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,
start_time,
gmt_create,gmt_modified
</sql>
<select
id=
"selectById"
resultType=
"net.wanji.databus.dao.entity.GreenwaveRealtimePO"
>
select
<include
refid=
"
baseColumn
List"
/>
<include
refid=
"
Base_Column_
List"
/>
from t_greenwave_realtime
where id = #{id}
</select>
<insert
id=
"insertBatch"
parameterType=
"net.wanji.databus.dao.entity.GreenwaveRealtimePO"
>
insert into t_greenwave_realtime
(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)
(
<include
refid=
"Base_Column_List"
></include>
)
values
<foreach
collection=
"list"
item=
"entity"
separator=
","
open=
"("
close=
")"
>
#{entity.status}, #{entity.type}, #{entity.trafficIndex}, #{entity.speed},
<foreach
collection=
"list"
item=
"entity"
separator=
","
>
(#{entity.id}, #{entity.greenId},
#{entity.status}, #{entity.type}, #{entity.trafficIndex}, #{entity.speed},
#{entity.trvalTime}, #{entity.stopTimes}, #{entity.queueLength}, #{entity.congRate},
#{entity.delayTime}, #{entity.noparkPassRate}, #{entity.cordReliability}, #{entity.cordQueueRatio},
#{entity.uncoordinatePhaseQueue}
#{entity.uncoordinatePhaseQueue}
, #{entity.startTime}, #{entity.gmtCreate}, #{entity.gmtModified})
</foreach>
</insert>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment