|  |  | @ -11,9 +11,11 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.ConvertUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.DateUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.constant.BadgeConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.constant.OrgInfoConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.constant.DataSourceConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.dao.epmetuser.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.dto.epmetuser.FactIcuserCategoryAnalysisDailyDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.dto.epmetuser.form.*; | 
			
		
	
	
		
			
				
					|  |  | @ -30,18 +32,21 @@ import com.epmet.dataaggre.dto.govproject.result.ProjectAnalysisResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.entity.epmetuser.GovStaffRoleEntity; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.entity.epmetuser.ResiUserBadgeEntity; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.service.datastats.DataStatsService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.entity.epmetuser.StaffRoleEntity; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.service.datastats.DataStatsService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.service.epmetuser.EpmetUserService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.service.epmetuser.StaffPatrolDetailService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.service.epmetuser.StaffPatrolRecordService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.service.govorg.GovOrgService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.service.govproject.GovProjectService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.service.opercustomize.CustomerFootBarService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.IcResiUserDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.UserBaseInfoDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.StaffRoleResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.commons.collections4.CollectionUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.commons.collections4.MapUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.commons.lang3.StringUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
	
		
			
				
					|  |  | @ -84,6 +89,8 @@ public class EpmetUserServiceImpl implements EpmetUserService { | 
			
		
	
		
			
				
					|  |  |  |     private GovStaffRoleDao govStaffRoleDao; | 
			
		
	
		
			
				
					|  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |     private IcResiUserDao icResiUserDao; | 
			
		
	
		
			
				
					|  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |     private CustomerFootBarService customerFootBarService; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * @Description  根据UserIds查询 | 
			
		
	
	
		
			
				
					|  |  | @ -742,4 +749,59 @@ public class EpmetUserServiceImpl implements EpmetUserService { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         return customerStaffDao.selectList(query); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * 【人员类别分析】-各类别人数 | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param formDTO | 
			
		
	
		
			
				
					|  |  |  |      * @return | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public List<IcUserCategoryResultDTO> queryIcUserCategoryData(IcUserCategoryFormDTO formDTO) { | 
			
		
	
		
			
				
					|  |  |  |         // 1、 先查询出居民类别配置(状态为显示)
 | 
			
		
	
		
			
				
					|  |  |  |         List<IcUserCategoryResultDTO> resList=customerFootBarService.queryCustomerIcResiCategoryStatsConfig(formDTO.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |         if(CollectionUtils.isNotEmpty(resList)){ | 
			
		
	
		
			
				
					|  |  |  |             //所有类别初始值为0 todo
 | 
			
		
	
		
			
				
					|  |  |  |             List<String> configIds=resList.stream().map(IcUserCategoryResultDTO::getConfigId).collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |             if(OrgInfoConstant.GRID.equals(formDTO.getOrgType())){ | 
			
		
	
		
			
				
					|  |  |  |                 List<FactIcuserCategoryAnalysisDailyDTO> list=dataStatsService.queryGridIcUserCategoryData(formDTO.getOrgId(),formDTO.getDateId(),configIds); | 
			
		
	
		
			
				
					|  |  |  |                 if(CollectionUtils.isNotEmpty(list)){ | 
			
		
	
		
			
				
					|  |  |  |                     Map<String, FactIcuserCategoryAnalysisDailyDTO> configMap = list.stream().collect(Collectors.toMap(FactIcuserCategoryAnalysisDailyDTO::getConfigId, m -> m, (k1, k2) -> k1)); | 
			
		
	
		
			
				
					|  |  |  |                     resList.forEach(resDto->{ | 
			
		
	
		
			
				
					|  |  |  |                         if(MapUtils.isNotEmpty(configMap)&&configMap.containsKey(resDto.getConfigId())){ | 
			
		
	
		
			
				
					|  |  |  |                             FactIcuserCategoryAnalysisDailyDTO dailyDTO=configMap.get(resDto.getConfigId()); | 
			
		
	
		
			
				
					|  |  |  |                             resDto.setTotal(dailyDTO.getTotal()); | 
			
		
	
		
			
				
					|  |  |  |                             resDto.setImmigration(dailyDTO.getQrIncr()); | 
			
		
	
		
			
				
					|  |  |  |                             resDto.setEmigration(dailyDTO.getQcIncr()); | 
			
		
	
		
			
				
					|  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |                     }); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             }else if(OrgInfoConstant.AGENCY.equals(formDTO.getOrgType())){ | 
			
		
	
		
			
				
					|  |  |  |                 CustomerAgencyEntity agencyEntity=govOrgService.getAgencyInfo(formDTO.getOrgId()); | 
			
		
	
		
			
				
					|  |  |  |                 String gridPids=""; | 
			
		
	
		
			
				
					|  |  |  |                 if(NumConstant.ZERO_STR.equals(agencyEntity.getPid())){ | 
			
		
	
		
			
				
					|  |  |  |                     // 当前组织是根组织
 | 
			
		
	
		
			
				
					|  |  |  |                     gridPids=formDTO.getOrgId(); | 
			
		
	
		
			
				
					|  |  |  |                 }else { | 
			
		
	
		
			
				
					|  |  |  |                     gridPids=agencyEntity.getPids().concat(StrConstant.COLON).concat(formDTO.getOrgId()); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |                 List<FactIcuserCategoryAnalysisDailyDTO> list = dataStatsService.queryAgencyIcUserCategoryData(gridPids, formDTO.getDateId(), configIds); | 
			
		
	
		
			
				
					|  |  |  |                 if(CollectionUtils.isNotEmpty(list)){ | 
			
		
	
		
			
				
					|  |  |  |                     Map<String, FactIcuserCategoryAnalysisDailyDTO> configMap = list.stream().collect(Collectors.toMap(FactIcuserCategoryAnalysisDailyDTO::getConfigId, m -> m, (k1, k2) -> k1)); | 
			
		
	
		
			
				
					|  |  |  |                     resList.forEach(resDto->{ | 
			
		
	
		
			
				
					|  |  |  |                         if(MapUtils.isNotEmpty(configMap)&&configMap.containsKey(resDto.getConfigId())){ | 
			
		
	
		
			
				
					|  |  |  |                             FactIcuserCategoryAnalysisDailyDTO dailyDTO=configMap.get(resDto.getConfigId()); | 
			
		
	
		
			
				
					|  |  |  |                             resDto.setTotal(dailyDTO.getTotal()); | 
			
		
	
		
			
				
					|  |  |  |                             resDto.setImmigration(dailyDTO.getQrIncr()); | 
			
		
	
		
			
				
					|  |  |  |                             resDto.setEmigration(dailyDTO.getQcIncr()); | 
			
		
	
		
			
				
					|  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |                     }); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         return resList; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 |