|
@ -38,7 +38,7 @@ public class StatisticsService { |
|
|
@PostConstruct |
|
|
@PostConstruct |
|
|
public void init() { |
|
|
public void init() { |
|
|
// 注册数据查询来源 |
|
|
// 注册数据查询来源 |
|
|
EsUtils.registerCluster(config.esNormalClusterName(), config.esNormalAddress());// 配置文件中的 es-source |
|
|
|
|
|
|
|
|
// EsUtils.registerCluster(config.esNormalClusterName(), config.esNormalAddress());// 配置文件中的 es-source |
|
|
EsUtils.registerCluster(config.esMiniClusterName(), config.esMiniAddress()); // 配置文件中的 es-target |
|
|
EsUtils.registerCluster(config.esMiniClusterName(), config.esMiniAddress()); // 配置文件中的 es-target |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -49,14 +49,14 @@ public class StatisticsService { |
|
|
LOGGER.info("------------------------------------------------------------------ StatisticsService ------------------------------------------------------"); |
|
|
LOGGER.info("------------------------------------------------------------------ StatisticsService ------------------------------------------------------"); |
|
|
long start = System.currentTimeMillis(); |
|
|
long start = System.currentTimeMillis(); |
|
|
//-------统计134上的总量------------------------------------------------------------------------------------ |
|
|
//-------统计134上的总量------------------------------------------------------------------------------------ |
|
|
String clusterName = config.esNormalClusterName(); // 获得 134 的 clusterName |
|
|
|
|
|
statisticsTotal(clusterName); |
|
|
|
|
|
|
|
|
// String clusterName = config.esNormalClusterName(); // 获得 134 的 clusterName |
|
|
|
|
|
//statisticsTotal(clusterName); |
|
|
long end = System.currentTimeMillis(); |
|
|
long end = System.currentTimeMillis(); |
|
|
LOGGER.info("Statistics Total, took:{} ms.",(end - start)); |
|
|
LOGGER.info("Statistics Total, took:{} ms.",(end - start)); |
|
|
|
|
|
|
|
|
//-------统计147上的 每个任务的总量------------------------------------------------------------------------- |
|
|
//-------统计147上的 每个任务的总量------------------------------------------------------------------------- |
|
|
start = System.currentTimeMillis(); |
|
|
start = System.currentTimeMillis(); |
|
|
clusterName = config.esMiniClusterName(); // 获得 147 的 clusterName |
|
|
|
|
|
|
|
|
String clusterName = config.esMiniClusterName(); // 获得 147 的 clusterName |
|
|
statisticsTask(clusterName); |
|
|
statisticsTask(clusterName); |
|
|
end = System.currentTimeMillis(); |
|
|
end = System.currentTimeMillis(); |
|
|
LOGGER.info("Statistics Task, took:{} ms.",(end - start)); |
|
|
LOGGER.info("Statistics Task, took:{} ms.",(end - start)); |
|
@ -71,13 +71,13 @@ public class StatisticsService { |
|
|
end = System.currentTimeMillis(); |
|
|
end = System.currentTimeMillis(); |
|
|
LOGGER.info("Statistics Subject Normal, took:{} ms.",(end - start)); |
|
|
LOGGER.info("Statistics Subject Normal, took:{} ms.",(end - start)); |
|
|
// 如果是【欧莱雅】任务的,得用这个方式统计呀 |
|
|
// 如果是【欧莱雅】任务的,得用这个方式统计呀 |
|
|
start = System.currentTimeMillis(); |
|
|
|
|
|
List<BigInteger> subjectIds1 = subjectRepository.findAllOlySubjectIds(); |
|
|
|
|
|
for (BigInteger subjectId: subjectIds1) { |
|
|
|
|
|
statisticsSubject(subjectId,clusterName); |
|
|
|
|
|
} |
|
|
|
|
|
end = System.currentTimeMillis(); |
|
|
|
|
|
LOGGER.info("Statistics Subject OLY, took:{} ms.",(end - start)); |
|
|
|
|
|
|
|
|
// start = System.currentTimeMillis(); |
|
|
|
|
|
// List<BigInteger> subjectIds1 = subjectRepository.findAllOlySubjectIds(); |
|
|
|
|
|
// for (BigInteger subjectId: subjectIds1) { |
|
|
|
|
|
// statisticsSubject(subjectId,clusterName); |
|
|
|
|
|
// } |
|
|
|
|
|
// end = System.currentTimeMillis(); |
|
|
|
|
|
// LOGGER.info("Statistics Subject OLY, took:{} ms.",(end - start)); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -151,7 +151,7 @@ public class StatisticsService { |
|
|
}else{ |
|
|
}else{ |
|
|
siteTodayCount = 0; |
|
|
siteTodayCount = 0; |
|
|
} |
|
|
} |
|
|
switch (i) { |
|
|
|
|
|
|
|
|
switch (i) { // |
|
|
case 0: |
|
|
case 0: |
|
|
subjectCrawlDatFlagMap.put("keyword", siteCount); |
|
|
subjectCrawlDatFlagMap.put("keyword", siteCount); |
|
|
subjectCrawlDataFlagTodayMap.put("keyword", siteTodayCount); |
|
|
subjectCrawlDataFlagTodayMap.put("keyword", siteTodayCount); |
|
@ -238,6 +238,7 @@ public class StatisticsService { |
|
|
List<Task> taskList = taskRepository.findAllBydel0(); |
|
|
List<Task> taskList = taskRepository.findAllBydel0(); |
|
|
// 遍历任务List ,根据条件组装ES查询语句去对应的索引下查结果,然后回写到任务表中 |
|
|
// 遍历任务List ,根据条件组装ES查询语句去对应的索引下查结果,然后回写到任务表中 |
|
|
for (Task task: taskList) { |
|
|
for (Task task: taskList) { |
|
|
|
|
|
System.out.println(" 任务ID ===== " + task); |
|
|
Long taskId = task.getId().longValue(); |
|
|
Long taskId = task.getId().longValue(); |
|
|
String crawlDataFlag = task.getCrawlDataFlag(); |
|
|
String crawlDataFlag = task.getCrawlDataFlag(); |
|
|
String indexNamePre = config.getIndexNamePre(); |
|
|
String indexNamePre = config.getIndexNamePre(); |
|
|