| 
						
						
							
								
							
						
						
					 | 
					@ -2,6 +2,7 @@ package com.epmet.service.impl; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.constant.ProjectConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.AgencySubTreeDto; | 
					 | 
					 | 
					import com.epmet.dto.AgencySubTreeDto; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.stats.user.result.UserStatisticalData; | 
					 | 
					 | 
					import com.epmet.dto.stats.user.result.UserStatisticalData; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.StatsUserService; | 
					 | 
					 | 
					import com.epmet.service.StatsUserService; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -10,6 +11,8 @@ import com.epmet.service.stats.DimCustomerService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.stats.user.UserStatisticalService; | 
					 | 
					 | 
					import com.epmet.service.stats.user.UserStatisticalService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.user.UserService; | 
					 | 
					 | 
					import com.epmet.service.user.UserService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.util.DimIdGenerator; | 
					 | 
					 | 
					import com.epmet.util.DimIdGenerator; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import org.slf4j.Logger; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import org.slf4j.LoggerFactory; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.util.CollectionUtils; | 
					 | 
					 | 
					import org.springframework.util.CollectionUtils; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -28,6 +31,8 @@ import java.util.List; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					@Service | 
					 | 
					 | 
					@Service | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					public class StatsUserServiceImpl implements StatsUserService { | 
					 | 
					 | 
					public class StatsUserServiceImpl implements StatsUserService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    protected static final Logger log = LoggerFactory.getLogger(StatsUserServiceImpl.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private DimCustomerService dimCustomerService; | 
					 | 
					 | 
					    private DimCustomerService dimCustomerService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -75,11 +80,19 @@ public class StatsUserServiceImpl implements StatsUserService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //List<AgencySubTreeDto> topAgencies = dimAgencyService.getTopAgency(customerId);
 | 
					 | 
					 | 
					        //List<AgencySubTreeDto> topAgencies = dimAgencyService.getTopAgency(customerId);
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //4.计算机关统计数据、生成唯一性统计数据
 | 
					 | 
					 | 
					        //4.计算机关统计数据、生成唯一性统计数据
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        UserStatisticalData agencyData = userService.traverseAgencyUser(agencies,date,timeDimension); | 
					 | 
					 | 
					        try { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        userStatisticalService.insertUniquely(agencyData); | 
					 | 
					 | 
					            UserStatisticalData agencyData = userService.traverseAgencyUser(agencies, date, timeDimension); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            userStatisticalService.insertUniquely(agencyData); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }catch(Exception e){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyUserStats", customerId, new Date().toString(), e.getMessage())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //5.计算网格统计数据、生成唯一性统计数据
 | 
					 | 
					 | 
					        //5.计算网格统计数据、生成唯一性统计数据
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        UserStatisticalData gridData = userService.traverseGridUser(agencies,date,timeDimension); | 
					 | 
					 | 
					        try { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        userStatisticalService.insertUniquely(gridData); | 
					 | 
					 | 
					            UserStatisticalData gridData = userService.traverseGridUser(agencies, date, timeDimension); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            userStatisticalService.insertUniquely(gridData); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }catch(Exception e){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "gridUserStats", customerId, new Date().toString(), e.getMessage())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					
  |