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
a70ede27
Commit
a70ede27
authored
Oct 28, 2022
by
黄准
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxb
parent
5d4665ab
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
PhaseGreenRatioJob.scala
...ming/src/main/scala/com/zhht/irn/PhaseGreenRatioJob.scala
+7
-6
No files found.
realtime/hologram-streaming/src/main/scala/com/zhht/irn/PhaseGreenRatioJob.scala
View file @
a70ede27
...
@@ -50,7 +50,7 @@ object phaseGreenRatioJob {
...
@@ -50,7 +50,7 @@ object phaseGreenRatioJob {
//查看获取到得topic数据
//查看获取到得topic数据
//valueTopic.map(t => t.toString).print()
//valueTopic.map(t => t.toString).print()
val
dataStream
:
DataStream
Sink
[((
String
,
String
,
String
,
String
)
,
Int
)
]
=
valueTopic
.
map
(
line
=>
{
val
dataStream
:
DataStream
[
Map
]
=
valueTopic
.
map
(
line
=>
{
//启动损失时间 = 2 ,从配置文件读取,正常情况下都是2,不排除个别城市有差异
//启动损失时间 = 2 ,从配置文件读取,正常情况下都是2,不排除个别城市有差异
//清场损失时间 = 黄灯时长 + 全红时长 - 2
//清场损失时间 = 黄灯时长 + 全红时长 - 2
//绿信比 = 每个相位的绿灯时长累加 - 启动损失时间 - 清场损失时间
//绿信比 = 每个相位的绿灯时长累加 - 启动损失时间 - 清场损失时间
...
@@ -75,14 +75,15 @@ object phaseGreenRatioJob {
...
@@ -75,14 +75,15 @@ object phaseGreenRatioJob {
allVolidGreen
=
allVolidGreen
+
green
-
startLossTime
-
clearLossTime
;
allVolidGreen
=
allVolidGreen
+
green
-
startLossTime
-
clearLossTime
;
}
}
var
lxb
=
allVolidGreen
/
duration
;
var
lxb
=
allVolidGreen
/
duration
;
}).
addSink
(
new
MysqlSink
);
val
map1
=
Map
(
"id"
->
0
,
"lxb"
->
lxb
)
return
map1
})
dataStream
.
addSink
(
new
MysqlSink
())
//提交flink任务job
//提交flink任务job
environment
.
execute
()
environment
.
execute
()
}
}
case
class
LXB
(
id
:
String
,
timestamp
:
Long
,
temp
:
Double
)
class
MysqlSink
extends
RichSinkFunction
[((
String
,
String
,
String
,
String
)
,
Int
)]
{
class
MysqlSink
extends
RichSinkFunction
[((
String
,
String
,
String
,
String
)
,
Int
)]
{
//获取配置文件
//获取配置文件
val
driver
=
ConfigUtil
.
getString
(
"mysql-driver"
)
val
driver
=
ConfigUtil
.
getString
(
"mysql-driver"
)
val
url
=
ConfigUtil
.
getString
(
"mysql-url"
)
val
url
=
ConfigUtil
.
getString
(
"mysql-url"
)
...
...
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