Commit 17383879 by jinfeng.wang

fix

parent 55749fe9
...@@ -20,13 +20,13 @@ import java.util.*; ...@@ -20,13 +20,13 @@ import java.util.*;
* @phone: 152-1062-7698 * @phone: 152-1062-7698
*/ */
public class ECStorageTag { public class ECStorageTag {
private static final String CONNECTION_URL = "jdbc:mysql://localhost:3306/app_tag?useUnicode=true&characterEncoding=utf8&useSSL=false"; // private static final String CONNECTION_URL = "jdbc:mysql://localhost:3306/app_tag?useUnicode=true&characterEncoding=utf8&useSSL=false";
// private static final String CONNECTION_URL = "jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/app_tag?useUnicode=true&characterEncoding=utf8&useSSL=false"; private static final String CONNECTION_URL = "jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/app_tag?useUnicode=true&characterEncoding=utf8&useSSL=false";
private static final String DRIVER = "com.mysql.jdbc.Driver"; private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String USER = "root"; // private static final String USER = "root";
// private static final String USER = "apptag_rw"; private static final String USER = "apptag_rw";
private static final String PASSWORD = "19920627"; // private static final String PASSWORD = "19920627";
// private static final String PASSWORD = "7gyLEVtkER3u8c9"; private static final String PASSWORD = "7gyLEVtkER3u8c9";
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static ObjectMapper mapper = new ObjectMapper(); private static ObjectMapper mapper = new ObjectMapper();
......
...@@ -21,7 +21,7 @@ import java.util.*; ...@@ -21,7 +21,7 @@ import java.util.*;
*/ */
public class StorageTag { public class StorageTag {
// private static final String CONNECTION_URL = "jdbc:mysql://localhost:3306/app_tag?useUnicode=true&characterEncoding=utf8&useSSL=false"; // private static final String CONNECTION_URL = "jdbc:mysql://localhost:3306/app_tag?useUnicode=true&characterEncoding=utf8&useSSL=false";
private static final String CONNECTION_URL = "jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/app_tag?useUnicode=true&characterEncoding=utf8&useSSL=false"; private static final String CONNECTION_URL = "jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/app_tag?useSSL=false";
private static final String DRIVER = "com.mysql.jdbc.Driver"; private static final String DRIVER = "com.mysql.jdbc.Driver";
// private static final String USER = "root"; // private static final String USER = "root";
private static final String USER = "apptag_rw"; private static final String USER = "apptag_rw";
...@@ -62,10 +62,14 @@ public class StorageTag { ...@@ -62,10 +62,14 @@ public class StorageTag {
} else { } else {
map.put(key, 1); map.put(key, 1);
} }
if (map.size() == 1000) {
insert(map);
map = new HashMap<>();
}
} }
} }
insert(map); insert(map);
resultSet.close(); resultSet.close();
preparedStatement.close(); preparedStatement.close();
insertAdmin(resultSetAdmin); insertAdmin(resultSetAdmin);
...@@ -194,6 +198,11 @@ public class StorageTag { ...@@ -194,6 +198,11 @@ public class StorageTag {
String[] strs = key.split("#@#"); String[] strs = key.split("#@#");
String packageName = strs[0]; String packageName = strs[0];
String appName = strs[1]; String appName = strs[1];
if (StringUtils.isNotBlank(appName)) {
appName = appName.replace("'", "\\'");
} else {
appName = "";
}
String platform = strs[2]; String platform = strs[2];
String tagId = strs[3]; String tagId = strs[3];
Integer userCount = Integer.parseInt(strs[4]); Integer userCount = Integer.parseInt(strs[4]);
...@@ -235,11 +244,15 @@ public class StorageTag { ...@@ -235,11 +244,15 @@ public class StorageTag {
Statement stmt1 = con.createStatement(); Statement stmt1 = con.createStatement();
String insert_sql1 = "REPLACE INTO storage_result(package_name, app_name, platform, feat_id, update_time, user_count, tag_count, tag_rate) " + String insert_sql1 = "REPLACE INTO storage_result(package_name, app_name, platform, feat_id, update_time, user_count, tag_count, tag_rate) " +
"VALUES"; "VALUES";
String insert_sql2 = "REPLACE INTO storage(package_name, app_name, platform, tag, update_time) " + String insert_sql2 = "REPLACE INTO storage(package_name, app_name, platform, tag, update_time) " +
"VALUES"; "VALUES";
// System.out.println(insert_sql1 + insertSql_1.substring(0, insertSql_1.length() - 1)); // System.out.println(insert_sql1 + insertSql_1.substring(0, insertSql_1.length() - 1));
// System.out.println(insert_sql2 + insertSql_2.substring(0, insertSql_2.length() - 1)); // System.out.println(insert_sql2 + insertSql_2.substring(0, insertSql_2.length() - 1));
if (insertSql_1.length() > 0) { if (insertSql_1.length() > 0) {
System.out.println("insertSql ==>> " + insertSql_1);
System.out.println("insertSql ====>>> " + insert_sql1 + insertSql_1.substring(0, insertSql_1.length() - 1));
stmt.executeQuery(insert_sql1 + insertSql_1.substring(0, insertSql_1.length() - 1)); stmt.executeQuery(insert_sql1 + insertSql_1.substring(0, insertSql_1.length() - 1));
} }
if (insertSql_2.length() > 0) { if (insertSql_2.length() > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment