Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AppTag
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
dataplatform
AppTag
Commits
d693442f
Commit
d693442f
authored
Mar 17, 2020
by
jinfeng.wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
44e0c7b3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
JoypacMain.java
src/main/java/com/mobvista/apptag/main/JoypacMain.java
+63
-0
No files found.
src/main/java/com/mobvista/apptag/main/JoypacMain.java
0 → 100644
View file @
d693442f
package
com
.
mobvista
.
apptag
.
main
;
import
java.sql.*
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.Set
;
import
java.util.regex.Pattern
;
/**
* @package: com.mobvista.apptag.main
* @author: wangjf
* @date: 2020/3/17
* @time: 11:52 上午
* @email: jinfeng.wang@mobvista.com
* @phone: 152-1062-7698
*/
public
class
JoypacMain
{
public
static
void
main
(
String
[]
args
)
{
insertDmp
(
readJoypac
());
}
static
void
insertDmp
(
Set
<
String
>
set
)
{
final
String
CONNECTION_URL
=
"jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/dmp?useUnicode=true&characterEncoding=utf8&useSSL=false"
;
final
String
DRIVER
=
"com.mysql.jdbc.Driver"
;
final
String
USER
=
"apptag_rw"
;
final
String
PASSWORD
=
"7gyLEVtkER3u8c9"
;
try
{
Class
.
forName
(
DRIVER
);
Connection
con
=
DriverManager
.
getConnection
(
CONNECTION_URL
,
USER
,
PASSWORD
);
String
insertSql
=
"INSERT INTO package_list(package_name) VALUES @VALUES ON DUPLICATE KEY UPDATE 1 = 1"
;
StringBuilder
stringBuilder
=
new
StringBuilder
();
for
(
String
packageName
:
set
)
{
stringBuilder
.
append
(
"('"
).
append
(
packageName
).
append
(
"'),"
);
}
PreparedStatement
stmt
=
con
.
prepareStatement
(
insertSql
.
replace
(
"@VALUES"
,
stringBuilder
.
substring
(
0
,
stringBuilder
.
length
()
-
1
)));
stmt
.
execute
();
con
.
close
();
}
catch
(
SQLException
|
ClassNotFoundException
e
)
{
e
.
printStackTrace
();
}
}
static
Set
<
String
>
readJoypac
()
{
final
String
CONNECTION_URL
=
"jdbc:mysql://rm-j6c26ox9wdgghld77fo.mysql.rds.aliyuncs.com:3306/jpac_base?useUnicode=true&characterEncoding=utf8&useSSL=false"
;
final
String
DRIVER
=
"com.mysql.jdbc.Driver"
;
final
String
USER
=
"jpbase_fordmp"
;
final
String
PASSWORD
=
"3Pi6bWj9cja3vjs"
;
Set
<
String
>
set
=
new
HashSet
<>();
try
{
Class
.
forName
(
DRIVER
);
Connection
con
=
DriverManager
.
getConnection
(
CONNECTION_URL
,
USER
,
PASSWORD
);
String
sql
=
"SELECT DISTINCT package FROM app"
;
PreparedStatement
preparedStatement
=
con
.
prepareStatement
(
sql
);
ResultSet
resultSet
=
preparedStatement
.
executeQuery
();
while
(
resultSet
.
next
())
{
set
.
add
(
resultSet
.
getString
(
"package"
));
}
}
catch
(
SQLException
|
ClassNotFoundException
e
)
{
e
.
printStackTrace
();
}
return
set
;
}
}
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