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
80cc4f8d
Commit
80cc4f8d
authored
Dec 22, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 优化绿波数据插入逻辑sql
parent
2ca7a1cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
20 deletions
+44
-20
GreenBeltServiceImpl.java
...anji/opt/service/signalopt/impl/GreenBeltServiceImpl.java
+32
-16
GreenwaveHistMapper.xml
wj-databus/src/main/resources/mapper/GreenwaveHistMapper.xml
+7
-2
GreenwaveRealtimeMapper.xml
...bus/src/main/resources/mapper/GreenwaveRealtimeMapper.xml
+5
-2
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/service/signalopt/impl/GreenBeltServiceImpl.java
View file @
80cc4f8d
...
...
@@ -200,8 +200,9 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
LambdaQueryWrapper
<
StrategyGreenOptHistEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
StrategyGreenOptHistEntity:
:
getGreenId
,
greenId
);
queryWrapper
.
ge
(
StrategyGreenOptHistEntity:
:
getControlTime
,
startOfDay
);
queryWrapper
.
ne
(
StrategyGreenOptHistEntity:
:
getControlMethod
,
-
1
);
List
<
StrategyGreenOptHistEntity
>
entities
=
strategyGreenOptHistMapper
.
selectList
(
queryWrapper
);
if
(!
CollectionUtils
.
isEmpty
(
greenwaveHistPOS
)
&&
!
CollectionUtils
.
isEmpty
(
entities
)
)
{
if
(!
CollectionUtils
.
isEmpty
(
greenwaveHistPOS
))
{
for
(
GreenwaveHistPO
histPO
:
greenwaveHistPOS
)
{
Integer
curGreenId
=
histPO
.
getGreenId
();
Date
curStartTime
=
histPO
.
getStartTime
();
...
...
@@ -209,22 +210,37 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
Date
startTimeminuteDate
=
get5MinuteDate
(
curStartTimeStr
);
String
roadDirection
=
histPO
.
getRoadDirection
();
Double
speed
=
histPO
.
getSpeed
();
for
(
StrategyGreenOptHistEntity
entity
:
entities
)
{
Integer
optGreenId
=
entity
.
getGreenId
();
String
controlTime
=
entity
.
getControlTime
();
String
dir
=
entity
.
getDir
();
Date
minuteDate
=
get5MinuteDate
(
controlTime
);
Double
greenWidthTime
=
entity
.
getGreenWidthTime
();
if
(
Objects
.
equals
(
curGreenId
,
optGreenId
)
&&
StringUtils
.
equalsIgnoreCase
(
dir
,
roadDirection
)
&&
minuteDate
.
getTime
()
==
startTimeminuteDate
.
getTime
())
{
GreenBeltSpeedWidthVO
vo
=
new
GreenBeltSpeedWidthVO
();
vo
.
setStartTime
(
curStartTime
);
vo
.
setSpeed
(
speed
);
vo
.
setWidth
(
greenWidthTime
);
vo
.
setDirName
(
GreenBeltDirEnum
.
getDesc
(
dir
));
results
.
add
(
vo
);
if
(
CollectionUtils
.
isEmpty
(
entities
))
{
GreenBeltSpeedWidthVO
vo
=
new
GreenBeltSpeedWidthVO
();
vo
.
setStartTime
(
curStartTime
);
vo
.
setSpeed
(
speed
);
vo
.
setWidth
(
0.0
);
vo
.
setDirName
(
GreenBeltDirEnum
.
getDesc
(
roadDirection
));
results
.
add
(
vo
);
}
else
{
for
(
StrategyGreenOptHistEntity
entity
:
entities
)
{
Integer
optGreenId
=
entity
.
getGreenId
();
String
controlTime
=
entity
.
getControlTime
();
String
dir
=
entity
.
getDir
();
Date
minuteDate
=
get5MinuteDate
(
controlTime
);
Double
greenWidthTime
=
entity
.
getGreenWidthTime
();
if
(
Objects
.
equals
(
curGreenId
,
optGreenId
)
&&
StringUtils
.
equalsIgnoreCase
(
dir
,
roadDirection
)
&&
minuteDate
.
getTime
()
==
startTimeminuteDate
.
getTime
())
{
GreenBeltSpeedWidthVO
vo
=
new
GreenBeltSpeedWidthVO
();
vo
.
setStartTime
(
curStartTime
);
vo
.
setSpeed
(
speed
);
vo
.
setWidth
(
greenWidthTime
);
vo
.
setDirName
(
GreenBeltDirEnum
.
getDesc
(
dir
));
results
.
add
(
vo
);
}
else
{
GreenBeltSpeedWidthVO
vo
=
new
GreenBeltSpeedWidthVO
();
vo
.
setStartTime
(
curStartTime
);
vo
.
setSpeed
(
speed
);
vo
.
setWidth
(
0.0
);
vo
.
setDirName
(
GreenBeltDirEnum
.
getDesc
(
roadDirection
));
results
.
add
(
vo
);
}
}
}
}
}
...
...
wj-databus/src/main/resources/mapper/GreenwaveHistMapper.xml
View file @
80cc4f8d
...
...
@@ -88,10 +88,13 @@
<insert
id=
"insertBatch"
parameterType=
"net.wanji.databus.dao.entity.GreenwaveHistPO"
>
insert into t_greenwave_hist
(
<include
refid=
"Base_Column_List"
/>
)
(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,
strategy, strategy_duration, optimize_count, optimize_seconds,
green_wave_width, direction, plan_cycle, speed_high, speed_down, road_direction, sturation, batch_time)
values
<foreach
collection=
"list"
item=
"entity"
separator=
","
>
(#{entity.
id}, #{entity.
greenId}, #{entity.status}, #{entity.type}, #{entity.trafficIndex},#{entity.speed},
(#{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.startTime}, #{entity.gmtCreate}, #{entity.gmtModified},
...
...
@@ -100,6 +103,8 @@
#{entity.speedDown}, #{entity.roadDirection}, #{entity.sturation}, #{entity.batchTime}
)
</foreach>
ON DUPLICATE KEY UPDATE
gmt_modified = values(gmt_modified)
</insert>
</mapper>
wj-databus/src/main/resources/mapper/GreenwaveRealtimeMapper.xml
View file @
80cc4f8d
...
...
@@ -54,10 +54,13 @@
<insert
id=
"insertBatch"
parameterType=
"net.wanji.databus.dao.entity.GreenwaveRealtimePO"
>
insert into t_greenwave_realtime
(
<include
refid=
"Base_Column_List"
></include>
)
(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,
strategy, strategy_duration, optimize_count, optimize_seconds,
green_wave_width, direction, plan_cycle, speed_high, speed_down, road_direction, sturation, batch_time)
values
<foreach
collection=
"list"
item=
"entity"
separator=
","
>
(#{entity.
id}, #{entity.
greenId}, #{entity.status}, #{entity.type}, #{entity.trafficIndex}, #{entity.speed},
(#{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.startTime}, #{entity.gmtCreate}, #{entity.gmtModified},
...
...
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