Commit 914b8387 by manxiaoqiang

app排序

parent af967d85
...@@ -146,22 +146,25 @@ public class SyncAppDataTask ...@@ -146,22 +146,25 @@ public class SyncAppDataTask
}*/ }*/
public void syncAppDeviceNum() { public void syncAppDeviceNum() {
String ds = DateUtil.getBeforeDays(2); for(int j =4; j < 9; j++){
//ds = "2017-12-22"; String ds = DateUtil.getBeforeDays(j);
System.out.println(ds); //ds = "2018-02-20";
String skey = "export/pkg_dev_stats/ds=" + ds + "/"; System.out.println(ds);
String skey = "export/pkg_dev_stats/ds=" + ds + "/";
final AwsS3Util s3Util = AwsS3Util.getInstance(); final AwsS3Util s3Util = AwsS3Util.getInstance();
List itemList = AwsS3Util.getInstance().getS3Keys("reyunbpu", skey); List itemList = AwsS3Util.getInstance().getS3Keys("reyunbpu", skey);
if (itemList == null || itemList.size() == 0) { if (itemList == null || itemList.size() == 0) {
System.out.println("pkg_dev_stats null"); System.out.println("pkg_dev_stats null");
return; return;
} }
for (int i = 0; i < itemList.size(); i++) { for (int i = 0; i < itemList.size(); i++) {
String s3key = String.valueOf(itemList.get(i)); String s3key = String.valueOf(itemList.get(i));
readS3File(s3Util, s3key, "deviceNum"); readS3File(s3Util, s3key, "deviceNum");
}
} }
System.out.println("pkg_dev_stats end"); System.out.println("pkg_dev_stats end");
} }
...@@ -233,7 +236,7 @@ public class SyncAppDataTask ...@@ -233,7 +236,7 @@ public class SyncAppDataTask
List<OtPkgDevStats> resultList = new ArrayList<>(); List<OtPkgDevStats> resultList = new ArrayList<>();
List<AppInfo> appResultList = new ArrayList<>(); List<AppInfo> appResultList = new ArrayList<>();
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
// System.out.println(line); System.out.println(line);
Object[] array = Splitter.on("\t").trimResults().splitToList(line).toArray(); Object[] array = Splitter.on("\t").trimResults().splitToList(line).toArray();
if (array.length == 3) { if (array.length == 3) {
OtPkgDevStats opds = new OtPkgDevStats(); OtPkgDevStats opds = new OtPkgDevStats();
...@@ -242,7 +245,7 @@ public class SyncAppDataTask ...@@ -242,7 +245,7 @@ public class SyncAppDataTask
opds.setDs(array[2].toString()); opds.setDs(array[2].toString());
resultList.add(opds); resultList.add(opds);
if (resultList.size() >= 2000) { if (resultList.size() >= 2000) {
//System.out.println(resultList); System.out.println(resultList);
otPkgDevStatsRepository.save(resultList); otPkgDevStatsRepository.save(resultList);
resultList = new ArrayList<>(); resultList = new ArrayList<>();
} }
...@@ -263,7 +266,7 @@ public class SyncAppDataTask ...@@ -263,7 +266,7 @@ public class SyncAppDataTask
appInfoRepository.save(appResultList); appInfoRepository.save(appResultList);
} }
//System.out.println(newCategorys); System.out.println(newCategorys);
if (newCategorys.size() > 0) { if (newCategorys.size() > 0) {
appCategoryRepository.save(newCategorys); appCategoryRepository.save(newCategorys);
} }
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<task:scheduled-tasks> <task:scheduled-tasks>
<!--//定时同步短链数据(每5分钟执行一次)--> <!--//定时同步短链数据(每5分钟执行一次)-->
<task:scheduled ref="SyncAppDataTask" method="syncAppInfo" cron="0 31 0 * * ?"/> <task:scheduled ref="SyncAppDataTask" method="syncAppInfo" cron="0 31 0 * * ?"/>
<task:scheduled ref="SyncAppDataTask" method="syncAppDeviceNum" cron="0 11 0 * * ?"/> <task:scheduled ref="SyncAppDataTask" method="syncAppDeviceNum" cron="0 43 14 * * ?"/>
</task:scheduled-tasks> </task:scheduled-tasks>
......
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