Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
ZHHT-IRN-BD-ANALYSIS
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
李凯旋
ZHHT-IRN-BD-ANALYSIS
Commits
2b17cfdc
Commit
2b17cfdc
authored
Nov 16, 2022
by
余根龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加阶段绿信比
parent
fd066218
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
GreenRadioJob.java
...reaming/src/main/java/com/zhht/irn/job/GreenRadioJob.java
+4
-0
GreenRadioSink.java
...aming/src/main/java/com/zhht/irn/sink/GreenRadioSink.java
+21
-0
No files found.
realtime/hologram-streaming/src/main/java/com/zhht/irn/job/GreenRadioJob.java
View file @
2b17cfdc
...
...
@@ -50,6 +50,10 @@ public class GreenRadioJob {
// 阶段绿信比 = 阶段有效绿灯时间/周期时长
double
phaseGreenRatio
=
Double
.
valueOf
(
phaseValidGreen
)
/
cycle
.
getDuration
();
//组装阶段绿信比、有效绿灯时间、损失时间
stage
.
setGreenRatio
(
phaseGreenRatio
);
stage
.
setValidGreen
(
phaseValidGreen
);
stage
.
setLossTime
(
phaseLossTime
);
// 周期绿信比 = 阶段绿信比之和
cycleGreenRatioTotal
=
cycleGreenRatioTotal
+
phaseGreenRatio
;
...
...
realtime/hologram-streaming/src/main/java/com/zhht/irn/sink/GreenRadioSink.java
View file @
2b17cfdc
...
...
@@ -34,6 +34,9 @@ public class GreenRadioSink extends RichSinkFunction<Cycle> {
"(id,cross_code,signal_code,begin_time,end_time,duration,cycle_order,green_ratio,loss_time,update_time) "
+
"values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
;
insertCyclePstmt
=
connection
.
prepareStatement
(
cycleSql
);
String
phaseSql
=
"insert into app_phase_green_ratio(cycle_order,cross_code,phase_value,begin_time,end_time,duration,phase_order,green_ratio,valid_green,loss_time,update_time) values (?,?,?,?,?,?,?,?,?,?,?)"
;
insertPhasePstmt
=
connection
.
prepareStatement
(
phaseSql
);
}
@Override
public
void
close
()
throws
Exception
{
...
...
@@ -56,5 +59,23 @@ public class GreenRadioSink extends RichSinkFunction<Cycle> {
insertCyclePstmt
.
setInt
(
9
,
cycle
.
getLossTime
());
insertCyclePstmt
.
setString
(
10
,
DateUtils
.
getTodayTime
());
insertCyclePstmt
.
execute
();
List
<
Stage
>
stageList
=
cycle
.
getStageList
();
for
(
int
i
=
0
;
i
<
stageList
.
size
();
i
++){
Stage
phase
=
stageList
.
get
(
i
);
insertPhasePstmt
.
setLong
(
1
,
cycle
.
getCycleOrder
());
insertPhasePstmt
.
setString
(
2
,
phase
.
getCrossCode
());
insertPhasePstmt
.
setString
(
3
,
phase
.
getPhaseValue
());
insertPhasePstmt
.
setString
(
4
,
cycle
.
getBeginDateTime
());
insertPhasePstmt
.
setString
(
5
,
cycle
.
getEndDateTime
());
insertPhasePstmt
.
setInt
(
6
,
cycle
.
getDuration
());
insertPhasePstmt
.
setInt
(
7
,
phase
.
getPhaseOrder
());
insertPhasePstmt
.
setDouble
(
8
,
phase
.
getGreenRatio
());
insertPhasePstmt
.
setInt
(
9
,
phase
.
getValidGreen
());
insertPhasePstmt
.
setInt
(
10
,
phase
.
getLossTime
());
insertPhasePstmt
.
setString
(
11
,
DateUtils
.
getTodayTime
());
insertPhasePstmt
.
addBatch
();
}
insertPhasePstmt
.
executeBatch
();
insertPhasePstmt
.
clearBatch
();
}
}
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