| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -67,8 +67,12 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public Boolean publicitySummary(Date statsDate) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (statsDate == null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								statsDate = DateUtils.addDateDays(new Date(), -1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//当天的凌晨时间 即为今天之前的数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								statsDate = DateUtils.integrate(new Date(),DateUtils.DATE_PATTERN); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							}else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								statsDate = DateUtils.integrate(DateUtils.addDateDays(statsDate,1),DateUtils.DATE_PATTERN); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							int pageNo = 1; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -190,7 +194,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//转换为 需要插入的Entity
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Map<String, FactArticlePublishedAgencyDailyEntity> agencyDailyEntityMap = convertAgencyDailyEntity(agencyDTOList, dimIdBean); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//获取当天的业务数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							List<ArticleGridPublishedSummaryDTO> publishedArticleCount = articleService.getAllAgencyPublishedCount(customerId,DateUtils.integrate(statsDate,DateUtils.DATE_PATTERN)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							List<ArticleGridPublishedSummaryDTO> publishedArticleCount = articleService.getAllAgencyPublishedCount(customerId,statsDate); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!CollectionUtils.isEmpty(publishedArticleCount)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								for (ArticleGridPublishedSummaryDTO summaryDTO : publishedArticleCount) { | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -215,21 +219,24 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										log.error("publicitySummary bizData agencyId:{} not exist in dimAgency", agencyId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									setData2ParentAgency(agencySummaryMap, summary); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									setData2ParentAgency(agencyDailyEntityMap,summary, dailyEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							boolean b = factArticlePublishedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), agencyDailyEntityMap.values()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private void setData2ParentAgency(Map<String, ArticleGridPublishedSummaryDTO> agencySummaryMap, ArticleGridPublishedSummaryDTO summary) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private void setData2ParentAgency(Map<String, FactArticlePublishedAgencyDailyEntity> agencyDailyEntityMap, ArticleGridPublishedSummaryDTO agencySummary, FactArticlePublishedAgencyDailyEntity summary) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							String pid = summary.getPid(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							ArticleGridPublishedSummaryDTO parentAgency = agencySummaryMap.get(pid); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							parentAgency.setArticleTotalCount(parentAgency.getArticleTotalCount()+summary.getArticleTotalCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							parentAgency.setArticlePublishedCount(parentAgency.getArticlePublishedCount()+summary.getArticlePublishedCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							FactArticlePublishedAgencyDailyEntity parentAgency = agencyDailyEntityMap.get(pid); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (parentAgency == null){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							parentAgency.setArticleTotalCount(parentAgency.getArticleTotalCount()+agencySummary.getArticleTotalCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							parentAgency.setArticlePublishedCount(parentAgency.getArticlePublishedCount()+agencySummary.getArticlePublishedCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							pid = parentAgency.getPid(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!NumConstant.ZERO_STR.equals(pid)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								setData2ParentAgency(agencySummaryMap,parentAgency); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								setData2ParentAgency(agencyDailyEntityMap, agencySummary,parentAgency); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |