Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
ctr-estimate
Project
Project
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
赵建伟
ctr-estimate
Commits
9fb0bfe0
Commit
9fb0bfe0
authored
Apr 11, 2020
by
赵建伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update codes
parent
921af55b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
48 deletions
+50
-48
CtrEstimatePfrMysqlSink.java
.../java/com/gmei/data/ctr/sink/CtrEstimatePfrMysqlSink.java
+50
-48
No files found.
src/main/java/com/gmei/data/ctr/sink/CtrEstimatePfrMysqlSink.java
View file @
9fb0bfe0
...
...
@@ -72,54 +72,56 @@ public class CtrEstimatePfrMysqlSink extends RichSinkFunction<DeviceCurrentEstim
private
void
insertAndDel
(
DeviceCurrentEstimatePfrTmp
deviceCurrentEstimatePfrTmp
)
{
Statement
statement
=
null
;
Date
date
=
new
Date
();
try
{
statement
=
connection
.
createStatement
();
statement
.
executeUpdate
(
String
.
format
(
"insert into device_recently_estimate_view_pfr("
+
"device_id,"
+
"statistics_type,"
+
"statistics_type_id,"
+
"project_pfr,"
+
"first_demands_pfr,"
+
"first_positions_pfr,"
+
"first_solutions_pfr,"
+
"second_demands_pfr,"
+
"second_positions_pfr,"
+
"second_solutions_pfr,"
+
"partition_date,"
+
"last_update_time"
+
") values ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')"
,
deviceCurrentEstimatePfrTmp
.
getDeviceId
(),
deviceCurrentEstimatePfrTmp
.
getStatisticsType
(),
deviceCurrentEstimatePfrTmp
.
getStatisticsTypeId
(),
deviceCurrentEstimatePfrTmp
.
getProjectPfr
(),
deviceCurrentEstimatePfrTmp
.
getFirstDemandsPfr
(),
deviceCurrentEstimatePfrTmp
.
getFirstPositionsPfr
(),
deviceCurrentEstimatePfrTmp
.
getFirstSolutionsPfr
(),
deviceCurrentEstimatePfrTmp
.
getSecondDemandsPfr
(),
deviceCurrentEstimatePfrTmp
.
getSecondPositionsPfr
(),
deviceCurrentEstimatePfrTmp
.
getSecondSolutionsPfr
(),
DateUtils
.
getDateStr
(
date
),
DateUtils
.
getTimeStr
(
date
)
)
);
statement
.
executeUpdate
(
String
.
format
(
"delete from device_recently_estimate_view_pfr where "
+
"device_id = '%s' and "
+
"statistics_type = '%s' and "
+
"statistics_type_id = '%s' and "
+
"last_update_time <= '%s'"
,
deviceCurrentEstimatePfrTmp
.
getDeviceId
(),
deviceCurrentEstimatePfrTmp
.
getStatisticsType
(),
deviceCurrentEstimatePfrTmp
.
getStatisticsTypeId
(),
DateUtils
.
getSevenDaysAgoTimeStr
(
date
)
)
);
JDBCUtils
.
close
(
null
,
statement
,
null
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
if
(
null
!=
deviceCurrentEstimatePfrTmp
){
try
{
statement
=
connection
.
createStatement
();
statement
.
executeUpdate
(
String
.
format
(
"insert into device_recently_estimate_view_pfr("
+
"device_id,"
+
"statistics_type,"
+
"statistics_type_id,"
+
"project_pfr,"
+
"first_demands_pfr,"
+
"first_positions_pfr,"
+
"first_solutions_pfr,"
+
"second_demands_pfr,"
+
"second_positions_pfr,"
+
"second_solutions_pfr,"
+
"partition_date,"
+
"last_update_time"
+
") values ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')"
,
deviceCurrentEstimatePfrTmp
.
getDeviceId
(),
deviceCurrentEstimatePfrTmp
.
getStatisticsType
(),
deviceCurrentEstimatePfrTmp
.
getStatisticsTypeId
(),
deviceCurrentEstimatePfrTmp
.
getProjectPfr
(),
deviceCurrentEstimatePfrTmp
.
getFirstDemandsPfr
(),
deviceCurrentEstimatePfrTmp
.
getFirstPositionsPfr
(),
deviceCurrentEstimatePfrTmp
.
getFirstSolutionsPfr
(),
deviceCurrentEstimatePfrTmp
.
getSecondDemandsPfr
(),
deviceCurrentEstimatePfrTmp
.
getSecondPositionsPfr
(),
deviceCurrentEstimatePfrTmp
.
getSecondSolutionsPfr
(),
DateUtils
.
getDateStr
(
date
),
DateUtils
.
getTimeStr
(
date
)
)
);
statement
.
executeUpdate
(
String
.
format
(
"delete from device_recently_estimate_view_pfr where "
+
"device_id = '%s' and "
+
"statistics_type = '%s' and "
+
"statistics_type_id = '%s' and "
+
"last_update_time <= '%s'"
,
deviceCurrentEstimatePfrTmp
.
getDeviceId
(),
deviceCurrentEstimatePfrTmp
.
getStatisticsType
(),
deviceCurrentEstimatePfrTmp
.
getStatisticsTypeId
(),
DateUtils
.
getSevenDaysAgoTimeStr
(
date
)
)
);
JDBCUtils
.
close
(
null
,
statement
,
null
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}
}
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