| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -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.constant.DimAgencyConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.ProjectConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.voice.ArticleGridPublishedSummaryDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.voice.ArticleViewedSummaryDTO; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -121,15 +122,15 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									for (String customerId : customerIdList) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										Date finalStatsDate = statsDate; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
												//key:所在机关Id
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
												Map<String, ArticleGridPublishedSummaryDTO> agencySummaryMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
												statsPublishedGridDaily(finalStatsDate, dimIdBean, customerId, agencySummaryMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
												statsPublishedDepartmentDaily(finalStatsDate, dimIdBean, customerId, agencySummaryMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
												statsPublishedAgencyDaily(finalStatsDate, dimIdBean, customerId, agencySummaryMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											} catch (Exception e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
												log.error("articlePublishedCountDayStats exception", e); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											//key:所在机关Id
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											Map<String, ArticleGridPublishedSummaryDTO> agencySummaryMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											statsPublishedGridDaily(finalStatsDate, dimIdBean, customerId, agencySummaryMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											statsPublishedDepartmentDaily(finalStatsDate, dimIdBean, customerId, agencySummaryMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											statsPublishedAgencyDaily(finalStatsDate, dimIdBean, customerId, agencySummaryMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										} catch (Exception e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											log.error("articlePublishedCountDayStats exception", e); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -340,7 +341,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								log.warn("publicitySummary getDepartmentListByCustomerId return empty,customerId:{}", customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							executorService.submit(()->{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							executorService.submit(() -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//转换为 需要插入的Entity
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								Map<String, FactArticlePublishedDepartmentDailyEntity> departmentDailyEntityMap = convertDepartmentDailyEntity(departmentDTOList, dimIdBean); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//获取当天的业务数据
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -402,7 +403,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								log.warn("publicitySummary getGridListByCustomerId return empty,customerId:{}", customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							executorService.submit(()->{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							executorService.submit(() -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//转换为 需要插入的Entity
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								Map<String, FactArticlePublishedGridDailyEntity> gridDailyEntityMap = convertGridDailyEntity(gridDTOList, dimIdBean); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//获取当天的业务数据
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -432,12 +433,13 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								log.warn("publicitySummary getAgencyListByCustomerId return empty,customerId:{}", customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							executorService.submit(()->{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							executorService.submit(() -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//转换为 需要插入的Entity
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								Map<String, FactArticlePublishedAgencyDailyEntity> agencyDailyEntityMap = convertAgencyDailyEntity(agencyDTOList, dimIdBean); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//获取当天的业务数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								List<ArticleGridPublishedSummaryDTO> publishedArticleCount = articleService.getAllAgencyPublishedCount(customerId, statsDate); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								Map<String, FactArticlePublishedAgencyDailyEntity> haveDataAgencyDailyMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								Map<String, FactArticlePublishedAgencyDailyEntity> haveDataAgencyDailySelfMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								if (!CollectionUtils.isEmpty(publishedArticleCount)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									for (ArticleGridPublishedSummaryDTO summaryDTO : publishedArticleCount) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										FactArticlePublishedAgencyDailyEntity gridDailyEntities = agencyDailyEntityMap.get(summaryDTO.getPublisherId()); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -447,9 +449,17 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										gridDailyEntities.setArticleTotalCount(summaryDTO.getArticleTotalCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										gridDailyEntities.setArticlePublishedCount(summaryDTO.getArticlePublishedCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										//同一个机关下数据累加
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										buildAgencySummaryData(agencySummaryMap, summaryDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										haveDataAgencyDailyMap.put(summaryDTO.getAgencyId(), gridDailyEntities); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										//同一个机关下数据累加
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										//buildAgencySummaryData(agencySummaryMap, summaryDTO);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										//构建机关自己的数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										FactArticlePublishedAgencyDailyEntity selfDaily = ConvertUtils.sourceToTarget(dimIdBean, FactArticlePublishedAgencyDailyEntity.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										selfDaily.setCustomerId(gridDailyEntities.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										selfDaily.setPid(gridDailyEntities.getPid()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										selfDaily.setAgencyId(summaryDTO.getAgencyId().concat(DimAgencyConstant.TYPE_SELF_ID_SUFFIX)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										selfDaily.setArticleTotalCount(summaryDTO.getArticleTotalCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										selfDaily.setArticlePublishedCount(summaryDTO.getArticlePublishedCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										haveDataAgencyDailySelfMap.put(selfDaily.getAgencyId(), selfDaily); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//数据向上级机关添加
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -465,7 +475,10 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										setPublishedData2ParentAgency(agencyDailyEntityMap, summary, dailyEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//将机关本身的数据插入
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								if (!CollectionUtils.isEmpty(haveDataAgencyDailySelfMap)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									agencyDailyEntityMap.putAll(haveDataAgencyDailySelfMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								boolean b = factArticlePublishedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), agencyDailyEntityMap.values()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							}); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -495,6 +508,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Map<String, FactTagUsedGridDailyEntity> tagUsedGridDailyMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Map<String, FactTagUsedDepartmentDailyEntity> tagUsedDeptDailyMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Map<String, FactTagUsedAgencyDailyEntity> tagUsedAgencyDailyMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Map<String, FactTagUsedAgencyDailyEntity> tagUsedAgencyDailySelfMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//获取当天的业务数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//1获取文章及机关id,网格Id
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							List<ArticleEntity> publishedArticleList = articleService.getPublishedArticleByPublishTime(customerId, statsDate); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -528,7 +542,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										convertTagUsedDepartmentDailyEntity(tagUsedDeptDailyMap, articleEntity, tagEntity, dimIdBean); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									case ProjectConstant.PUBLISHER_TYPE_AGENCY: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										convertTagUsedAgencyDailyEntity(dimAgencyEntity.getPid(), tagUsedAgencyDailyMap, articleEntity, tagEntity, dimIdBean); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										convertTagUsedAgencyDailySelfEntity(dimAgencyEntity.getPid(), tagUsedAgencyDailySelfMap, articleEntity, tagEntity, dimIdBean); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -581,6 +595,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//转换为 需要插入的Entity key gridId_tagId
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Map<String, FactTagViewedGridDailyEntity> tagViewedGridDailyMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Map<String, FactTagViewedAgencyDailyEntity> tagViewedAgencyDailyMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Map<String, FactTagViewedAgencyDailyEntity> tagViewedAgencyDailySelfMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//获取当天的业务数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//1获取今天文章的阅读记录数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Date startTime = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -595,6 +610,14 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								if (CollectionUtils.isEmpty(articleTagsList)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								ArticleEntity articleEntity = articleService.selectById(viewedSummaryDTO.getArticleId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								if (articleEntity == null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								boolean isAgencyPublished = false; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								if (ProjectConstant.PUBLISHER_TYPE_AGENCY.equals(articleEntity.getPublisherType())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									isAgencyPublished = true; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								String gridId = viewedSummaryDTO.getGridId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								DimGridEntity dimGridEntity = dimGridEntityMap.get(gridId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -603,10 +626,13 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(dimGridEntity.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								articleTagsList.forEach(articleTag -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								for (ArticleTagsEntity articleTag : articleTagsList) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									convertTagViewedGridDailyEntity(dimAgencyEntity, tagViewedGridDailyMap, articleTag, viewedSummaryDTO, dimIdBean); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									convertTagViewedAgencyDailyEntity(dimAgencyEntity, tagViewedAgencyDailyMap, articleTag, viewedSummaryDTO, dimIdBean); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								}); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									if (isAgencyPublished) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										convertTagViewedAgencyDailySelfEntity(dimAgencyEntity, tagViewedAgencyDailySelfMap, articleTag, viewedSummaryDTO, dimIdBean); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							factTagViewedGridDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), tagViewedGridDailyMap.values()); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -619,11 +645,15 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								FactTagViewedAgencyDailyEntity currentEntity = entry.getValue(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(currentEntity.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								if (dimAgencyEntity == null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									log.error("dimAgencyEntityMap bizData agencyId:{} not exist in dimAgency", agencyId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								setTagViewedData2ParentAgency(dimAgencyEntityMap, finalTagUsedAgencyDailyMap, currentEntity, dimIdBean); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!CollectionUtils.isEmpty(tagViewedAgencyDailySelfMap)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								finalTagUsedAgencyDailyMap.putAll(tagViewedAgencyDailySelfMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							factTagViewedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), finalTagUsedAgencyDailyMap.values()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -969,6 +999,25 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private void convertTagUsedAgencyDailySelfEntity(String pid, Map<String, FactTagUsedAgencyDailyEntity> result, ArticleEntity articleEntity, ArticleTagsEntity tagEntity, DimIdGenerator.DimIdBean dimIdBean) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							String agencyId = articleEntity.getOrgId().concat(DimAgencyConstant.TYPE_SELF_ID_SUFFIX); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							String tagId = tagEntity.getTagId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							String key = agencyId.concat(StrConstant.UNDER_LINE).concat(tagId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							FactTagUsedAgencyDailyEntity entity = result.get(key); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (entity == null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagUsedAgencyDailyEntity.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setPid(pid); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setCustomerId(articleEntity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setAgencyId(agencyId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setTagId(tagId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setTagName(tagEntity.getTagName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setUsedCount(1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								result.put(key, entity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setUsedCount(entity.getUsedCount() + 1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private void convertTagViewedGridDailyEntity(DimAgencyEntity dimAgencyEntity, Map<String, FactTagViewedGridDailyEntity> result, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						                                             ArticleTagsEntity tagEntity, ArticleViewedSummaryDTO viewedSummaryDTO, DimIdGenerator.DimIdBean dimIdBean) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							String gridId = viewedSummaryDTO.getGridId(); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -1010,4 +1059,25 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setTagReadCount(entity.getTagReadCount() + viewedCount); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private void convertTagViewedAgencyDailySelfEntity(DimAgencyEntity dimAgencyEntity, Map<String, FactTagViewedAgencyDailyEntity> result, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						                                                   ArticleTagsEntity tagEntity, ArticleViewedSummaryDTO viewedSummaryDTO, DimIdGenerator.DimIdBean dimIdBean) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							String agencyId = dimAgencyEntity.getId().concat(DimAgencyConstant.TYPE_SELF_ID_SUFFIX); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							String tagId = tagEntity.getTagId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							String key = agencyId.concat(StrConstant.UNDER_LINE).concat(tagId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Integer viewedCount = viewedSummaryDTO.getViewedCount() == null ? 0 : viewedSummaryDTO.getViewedCount(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							FactTagViewedAgencyDailyEntity entity = result.get(key); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (entity == null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedAgencyDailyEntity.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setPid(dimAgencyEntity.getPid()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setCustomerId(tagEntity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setAgencyId(agencyId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setTagId(tagId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setTagName(tagEntity.getTagName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setTagReadCount(viewedCount); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								result.put(key, entity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setTagReadCount(entity.getTagReadCount() + viewedCount); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					
  |