|
|
@ -5,6 +5,7 @@ import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
|
import com.epmet.constant.DimAgencyConstant; |
|
|
|
import com.epmet.constant.ProjectConstant; |
|
|
|
import com.epmet.dto.voice.ArticleGridPublishedSummaryDTO; |
|
|
@ -218,10 +219,8 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
if (!CollectionUtils.isEmpty(customerIdList)) { |
|
|
|
for (String customerId : customerIdList) { |
|
|
|
Date finalStatsDate = statsDate; |
|
|
|
//executorService.submit(() -> {
|
|
|
|
//统计
|
|
|
|
statsTagViewedDaily(finalStatsDate, dimIdBean, customerId); |
|
|
|
//});
|
|
|
|
} |
|
|
|
} |
|
|
|
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); |
|
|
@ -245,13 +244,11 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); |
|
|
|
if (!CollectionUtils.isEmpty(customerIdList)) { |
|
|
|
for (String customerId : customerIdList) { |
|
|
|
executorService.submit(() -> { |
|
|
|
try { |
|
|
|
statsTagViewedMonthly(dimIdBean.getMonthId(), customerId); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("statsTagViewedMonthly exception", e); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); |
|
|
@ -343,7 +340,8 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
log.warn("publicitySummary getDepartmentListByCustomerId return empty,customerId:{}", customerId); |
|
|
|
return; |
|
|
|
} |
|
|
|
executorService.submit(() -> { |
|
|
|
|
|
|
|
try { |
|
|
|
//转换为 需要插入的Entity
|
|
|
|
Map<String, FactArticlePublishedDepartmentDailyEntity> departmentDailyEntityMap = convertDepartmentDailyEntity(departmentDTOList, dimIdBean); |
|
|
|
//获取当天的业务数据
|
|
|
@ -364,7 +362,15 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
} |
|
|
|
} |
|
|
|
boolean b = factArticlePublishedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), departmentDailyEntityMap.values()); |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
try { |
|
|
|
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按日统计部门纬度文章总数", customerId, statsDate, e.getMessage()); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg(content); |
|
|
|
} catch (Exception ex) { |
|
|
|
log.error("sendAlarmMsg exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -394,7 +400,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:按日统计 网格纬度的 文章总数数据 |
|
|
|
* desc:按日统计 文章总数数据 |
|
|
|
* |
|
|
|
* @param statsDate |
|
|
|
* @param dimIdBean |
|
|
@ -408,7 +414,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
log.warn("publicitySummary getGridListByCustomerId return empty,customerId:{}", customerId); |
|
|
|
return; |
|
|
|
} |
|
|
|
executorService.submit(() -> { |
|
|
|
|
|
|
|
try { |
|
|
|
//转换为 需要插入的Entity
|
|
|
|
Map<String, FactArticlePublishedGridDailyEntity> gridDailyEntityMap = convertGridDailyEntity(gridDTOList, dimIdBean); |
|
|
@ -431,8 +437,14 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
boolean b = factArticlePublishedGridDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), gridDailyEntityMap.values()); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("statsPublishedGridDaily exception customerId:{},statsDate:{}", customerId, statsDate); |
|
|
|
try { |
|
|
|
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按日统计网格纬度文章总数", customerId, statsDate, e.getMessage()); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg(content); |
|
|
|
} catch (Exception ex) { |
|
|
|
log.error("sendAlarmMsg exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -443,7 +455,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
log.warn("publicitySummary getAgencyListByCustomerId return empty,customerId:{}", customerId); |
|
|
|
return; |
|
|
|
} |
|
|
|
executorService.submit(() -> { |
|
|
|
try { |
|
|
|
//转换为 需要插入的Entity
|
|
|
|
Map<String, FactArticlePublishedAgencyDailyEntity> agencyDailyEntityMap = convertAgencyDailyEntity(agencyDTOList, dimIdBean); |
|
|
@ -497,13 +508,17 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
log.error("statsPublishedAgencyDaily exception,customer:{}", customerId); |
|
|
|
try { |
|
|
|
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按日统计部门纬度文章总数", customerId, statsDate, e.getMessage()); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg(content); |
|
|
|
} catch (Exception ex) { |
|
|
|
log.error("sendAlarmMsg exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:按日统计 网格纬度的 标签被使用的次数 |
|
|
|
* desc:按日统计 标签被使用的次数 |
|
|
|
* |
|
|
|
* @param statsDate |
|
|
|
* @param dimIdBean |
|
|
@ -586,8 +601,12 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
} |
|
|
|
factTagUsedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), finalTagUsedAgencyDailyMap.values()); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
//log.error();
|
|
|
|
try { |
|
|
|
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按日统计标签被使用次数", customerId, statsDate, e.getMessage()); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg(content); |
|
|
|
} catch (Exception ex) { |
|
|
|
log.error("sendAlarmMsg exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -599,6 +618,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
* @param customerId |
|
|
|
*/ |
|
|
|
private void statsTagViewedDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId) { |
|
|
|
try { |
|
|
|
//1.业务数据来源 发布时间为统计时间的
|
|
|
|
// 因为一个客户的发布文章数在同一天不会特别的多,所以以客户为单位查询今天发布的所有带有标签的文章 根据发布单位类型进行拆分
|
|
|
|
// 1.1查出今天所有的文章标签 根据网格Id
|
|
|
@ -681,6 +701,15 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
finalTagUsedAgencyDailyMap.putAll(tagViewedAgencyDailySelfMap); |
|
|
|
} |
|
|
|
factTagViewedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), finalTagUsedAgencyDailyMap.values()); |
|
|
|
} catch (Exception e) { |
|
|
|
try { |
|
|
|
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按日统计标签被查看次数", customerId, statsDate, e.getMessage()); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg(content); |
|
|
|
} catch (Exception ex) { |
|
|
|
log.error("sendAlarmMsg exception", e); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -690,6 +719,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
* @param customerId |
|
|
|
*/ |
|
|
|
private void statsTagUsedMonthly(String monthId, String customerId) { |
|
|
|
try { |
|
|
|
List<FactTagUsedGridDailyEntity> gridDailyList = factTagUsedGridDailyService.getTagUsedCountByMonth(customerId, monthId); |
|
|
|
if (!CollectionUtils.isEmpty(gridDailyList)) { |
|
|
|
List<FactTagUsedGridMonthlyEntity> gridMonthlyList = ConvertUtils.sourceToTarget(gridDailyList, FactTagUsedGridMonthlyEntity.class); |
|
|
@ -705,6 +735,14 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
List<FactTagUsedAgencyMonthlyEntity> agencyMonthlyList = ConvertUtils.sourceToTarget(agencyDailyList, FactTagUsedAgencyMonthlyEntity.class); |
|
|
|
factTagUsedAgencyMonthlyService.deleteAndInsertByMonthId(customerId, monthId, (agencyMonthlyList)); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
try { |
|
|
|
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按月统计标签被使用次数", customerId, monthId, e.getMessage()); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg(content); |
|
|
|
} catch (Exception ex) { |
|
|
|
log.error("sendAlarmMsg exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -714,6 +752,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
* @param customerId |
|
|
|
*/ |
|
|
|
private void statsTagViewedMonthly(String monthId, String customerId) { |
|
|
|
try { |
|
|
|
List<FactTagViewedGridDailyEntity> gridDailyList = factTagViewedGridDailyService.getTagViewedCountByMonth(customerId, monthId); |
|
|
|
if (!CollectionUtils.isEmpty(gridDailyList)) { |
|
|
|
List<FactTagViewedGridMonthlyEntity> gridMonthlyList = ConvertUtils.sourceToTarget(gridDailyList, FactTagViewedGridMonthlyEntity.class); |
|
|
@ -725,6 +764,14 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
List<FactTagViewedAgencyMonthlyEntity> agencyMonthlyList = ConvertUtils.sourceToTarget(agencyDailyList, FactTagViewedAgencyMonthlyEntity.class); |
|
|
|
factTagViewedAgencyMonthlyService.deleteAndInsertByMonthId(customerId, monthId, (agencyMonthlyList)); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
try { |
|
|
|
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按月统计标签被查看次数", customerId, monthId, e.getMessage()); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg(content); |
|
|
|
} catch (Exception ex) { |
|
|
|
log.error("sendAlarmMsg exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -734,6 +781,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
* @param customerId |
|
|
|
*/ |
|
|
|
private void statsTagUsedQuarterly(String quarterId, String customerId) { |
|
|
|
try { |
|
|
|
List<FactTagUsedGridMonthlyEntity> gridMonthlyList = factTagUsedGridMonthlyService.getTagUsedCountByQuarterId(customerId, quarterId); |
|
|
|
if (!CollectionUtils.isEmpty(gridMonthlyList)) { |
|
|
|
List<FactTagUsedGridQuarterlyEntity> gridQuarterlyList = ConvertUtils.sourceToTarget(gridMonthlyList, FactTagUsedGridQuarterlyEntity.class); |
|
|
@ -749,6 +797,14 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
List<FactTagUsedAgencyQuarterlyEntity> agencyQuarterlyList = ConvertUtils.sourceToTarget(agencyMonthlyList, FactTagUsedAgencyQuarterlyEntity.class); |
|
|
|
factTagUsedAgencyQuarterlyService.deleteAndInsertByQuarterId(customerId, quarterId, agencyQuarterlyList); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
try { |
|
|
|
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按季统计标签被使用次数", customerId, quarterId, e.getMessage()); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg(content); |
|
|
|
} catch (Exception ex) { |
|
|
|
log.error("sendAlarmMsg exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -758,6 +814,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
* @param customerId |
|
|
|
*/ |
|
|
|
private void statsTagViewedQuarterly(String quarterId, String customerId) { |
|
|
|
try { |
|
|
|
List<FactTagViewedGridMonthlyEntity> gridMonthlyList = factTagViewedGridMonthlyService.getTagViewedCountByQuarterId(customerId, quarterId); |
|
|
|
if (!CollectionUtils.isEmpty(gridMonthlyList)) { |
|
|
|
List<FactTagViewedGridQuarterlyEntity> gridQuarterlyList = ConvertUtils.sourceToTarget(gridMonthlyList, FactTagViewedGridQuarterlyEntity.class); |
|
|
@ -769,6 +826,14 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
List<FactTagViewedAgencyQuarterlyEntity> agencyQuarterlyList = ConvertUtils.sourceToTarget(agencyMonthlyList, FactTagViewedAgencyQuarterlyEntity.class); |
|
|
|
factTagViewedAgencyQuarterlyService.deleteAndInsertByQuarterId(customerId, quarterId, agencyQuarterlyList); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
try { |
|
|
|
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按季统计标签被查看次数", customerId, quarterId, e.getMessage()); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg(content); |
|
|
|
} catch (Exception ex) { |
|
|
|
log.error("sendAlarmMsg exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -778,6 +843,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
* @param customerId |
|
|
|
*/ |
|
|
|
private void statsTagUsedYearly(String yearId, String customerId) { |
|
|
|
try { |
|
|
|
List<FactTagUsedGridMonthlyEntity> gridMonthlyList = factTagUsedGridMonthlyService.getTagUsedCountByYearId(customerId, yearId); |
|
|
|
if (!CollectionUtils.isEmpty(gridMonthlyList)) { |
|
|
|
List<FactTagUsedGridYearlyEntity> gridYearlyList = ConvertUtils.sourceToTarget(gridMonthlyList, FactTagUsedGridYearlyEntity.class); |
|
|
@ -793,6 +859,14 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
List<FactTagUsedAgencyYearlyEntity> agencyYearlyList = ConvertUtils.sourceToTarget(agencyMonthlyList, FactTagUsedAgencyYearlyEntity.class); |
|
|
|
factTagUsedAgencyYearlyService.deleteAndInsertByYearId(customerId, yearId, agencyYearlyList); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
try { |
|
|
|
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按年统计标签被使用次数", customerId, yearId, e.getMessage()); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg(content); |
|
|
|
} catch (Exception ex) { |
|
|
|
log.error("sendAlarmMsg exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -802,6 +876,8 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
* @param customerId |
|
|
|
*/ |
|
|
|
private void statsTagViewedYearly(String yearId, String customerId) { |
|
|
|
|
|
|
|
try { |
|
|
|
List<FactTagViewedGridMonthlyEntity> gridMonthlyList = factTagViewedGridMonthlyService.getTagViewedCountByYearId(customerId, yearId); |
|
|
|
if (!CollectionUtils.isEmpty(gridMonthlyList)) { |
|
|
|
List<FactTagViewedGridYearlyEntity> gridYearlyList = ConvertUtils.sourceToTarget(gridMonthlyList, FactTagViewedGridYearlyEntity.class); |
|
|
@ -812,6 +888,14 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { |
|
|
|
List<FactTagViewedAgencyYearlyEntity> agencyYearlyList = ConvertUtils.sourceToTarget(agencyMonthlyList, FactTagViewedAgencyYearlyEntity.class); |
|
|
|
factTagViewedAgencyYearlyService.deleteAndInsertByYearId(customerId, yearId, agencyYearlyList); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
try { |
|
|
|
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按年统计标签被查看次数", customerId, yearId, e.getMessage()); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg(content); |
|
|
|
} catch (Exception ex) { |
|
|
|
log.error("sendAlarmMsg exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void setTagUsedData2ParentAgency(Map<String, DimAgencyEntity> dimAgencyEntityMap, Map<String, FactTagUsedAgencyDailyEntity> agencyDailyEntityMap, FactTagUsedAgencyDailyEntity currentEntity, DimIdGenerator.DimIdBean dimIdBean) { |
|
|
|