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
183bdef1
Commit
183bdef1
authored
Jan 08, 2023
by
黄准
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车道指标增加日志级别配置 方便现场调试程序
parent
a2f90c67
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
8 deletions
+24
-8
LaneNormProcessFunction.java
.../java/com/zhht/irn/functions/LaneNormProcessFunction.java
+22
-7
LaneNormSink.java
...reaming/src/main/java/com/zhht/irn/sink/LaneNormSink.java
+1
-0
doris.properties
...me/hologram-streaming/src/main/resources/doris.properties
+1
-1
No files found.
realtime/hologram-streaming/src/main/java/com/zhht/irn/functions/LaneNormProcessFunction.java
View file @
183bdef1
...
...
@@ -16,11 +16,9 @@ import org.apache.flink.table.api.Table;
import
org.apache.flink.util.Collector
;
import
java.math.BigDecimal
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.ResultSetMetaData
;
import
java.sql.Statement
;
import
java.sql.*
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
...
...
@@ -42,7 +40,7 @@ public class LaneNormProcessFunction extends KeyedCoProcessFunction<String, Cycl
//
private
ValueState
<
Boolean
>
processCycle
;
private
Connection
connection
;
Connection
connection
;
//每个路口允许的最大时间数据
private
static
Long
maxTravel
=
50000L
;
//每天的cycleOrder 不允许重复
...
...
@@ -78,6 +76,23 @@ public class LaneNormProcessFunction extends KeyedCoProcessFunction<String, Cycl
}
}
/**
* 判断jdbc 是否失效 失效重新获取连接
* @param con
* @return
*/
public
boolean
isDbConnected
(
Connection
con
)
{
//final String CHECK_SQL_QUERY = "SELECT 1";
try
{
if
(!
con
.
isClosed
()
||
con
!=
null
){
return
true
;
}
}
catch
(
SQLException
e
)
{
return
false
;
}
return
false
;
}
@Override
public
void
processElement1
(
Cycle
cycle
,
KeyedCoProcessFunction
<
String
,
Cycle
,
TravelEvent
,
List
<
LaneNorm
>>.
Context
ctx
,
Collector
<
List
<
LaneNorm
>>
out
)
throws
Exception
{
processCycle
.
update
(
true
);
...
...
@@ -90,10 +105,10 @@ public class LaneNormProcessFunction extends KeyedCoProcessFunction<String, Cycl
}
//初始化字典数据
if
(
dict
.
get
(
"phaseDirection"
)
==
null
||
dict
.
get
(
"laneList"
)
==
null
||
dict
.
get
(
"dictResult"
)
==
null
||
dict
.
get
(
"positionList"
)
==
null
||
dict
.
get
(
"positionNameList"
)
==
null
)
{
if
(
connection
==
null
){
loggerLevel
=
applicationUtils
.
getLoggerLevel
();
if
(
isDbConnected
(
connection
)){
connection
=
DorisUtils
.
getConnection
();
}
loggerLevel
=
applicationUtils
.
getLoggerLevel
();
//查询相位方向信息
dict
.
put
(
"phaseDirection"
,
getDictResult
(
connection
,
"SELECT\n"
+
" a.ID id,\n"
+
...
...
realtime/hologram-streaming/src/main/java/com/zhht/irn/sink/LaneNormSink.java
View file @
183bdef1
...
...
@@ -52,6 +52,7 @@ public class LaneNormSink extends RichSinkFunction<List<LaneNorm>> {
*/
@Override
public
void
invoke
(
List
<
LaneNorm
>
laneNorms
,
SinkFunction
.
Context
context
)
throws
Exception
{
if
(
laneNorms
.
size
()==
0
){
return
;
}
...
...
realtime/hologram-streaming/src/main/resources/doris.properties
View file @
183bdef1
driver
=
com.mysql.jdbc.Driver
host
=
10.243.0.22
host
=
localhost
port
=
9030
username
=
root
password
=
mima
...
...
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