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
2beb31d3
Commit
2beb31d3
authored
Nov 23, 2022
by
余根龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加fast
parent
10f8b792
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
23 deletions
+26
-23
GreenRadioSink.java
...aming/src/main/java/com/zhht/irn/sink/GreenRadioSink.java
+25
-22
DateUtils.java
...streaming/src/main/java/com/zhht/irn/utils/DateUtils.java
+1
-1
No files found.
realtime/hologram-streaming/src/main/java/com/zhht/irn/sink/GreenRadioSink.java
View file @
2beb31d3
...
...
@@ -31,12 +31,12 @@ public class GreenRadioSink extends RichSinkFunction<Cycle> {
//String path = ".\\realtime\\hologram-streaming\\src\\main\\resources\\mysql.properties";
connection
=
MySQLUtils
.
getConnection
();
String
cycleSql
=
"insert into app_cycle_green_ratio"
+
"(id,cross_
code,signal_code,begin_time,end_time,duration,cycle_order,green_ratio,loss_time,update_time
) "
+
"values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
;
"(id,cross_
id,signal_code,begin_time,end_time,duration,cycle_order,green_ratio,loss_time,statistic_time,record_date,p_month
) "
+
"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
);
//
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
{
...
...
@@ -57,24 +57,27 @@ public class GreenRadioSink extends RichSinkFunction<Cycle> {
insertCyclePstmt
.
setDouble
(
8
,
cycle
.
getGreenRatio
());
insertCyclePstmt
.
setInt
(
9
,
cycle
.
getLossTime
());
insertCyclePstmt
.
setString
(
10
,
DateUtils
.
getTodayTime
());
insertCyclePstmt
.
setString
(
11
,
DateUtils
.
getTodayDate
());
insertCyclePstmt
.
setString
(
12
,
DateUtils
.
getCurrentMonth
());
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
,
cycle
.
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
();
//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,cycle.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();
}
}
realtime/hologram-streaming/src/main/java/com/zhht/irn/utils/DateUtils.java
View file @
2beb31d3
...
...
@@ -1058,7 +1058,7 @@ public class DateUtils {
* 例如 202211
* @return
*/
public
static
String
getCurrentMonth
Partition
()
{
public
static
String
getCurrentMonth
()
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMM"
);
simpleDateFormat
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"UTC"
));
return
simpleDateFormat
.
format
(
new
Date
());
...
...
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