| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -33,6 +33,8 @@ import com.epmet.datareport.service.evaluationindex.screen.AgencyService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.datareport.service.plugins.ScreenWorkRecordOrgDailyService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.datareport.utils.DateUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.AgencyInfoDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.ScreenCustomerAgencyCommonDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.ScreenCustomerGridCommonDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.evaluationindex.screen.constant.ScreenConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.plugins.ScreenWorkRecordOrgDailyDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.plugins.form.VoluntaryServiceTrendFormDTO; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -107,21 +109,40 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl<ScreenW | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> typeCodeList=baseDao.selectCustomerTypeCode(formDTO.getDataType(),formDTO.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(CollectionUtils.isEmpty(typeCodeList)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.warn(String.format("当前customerId=%s,screen_customer_work_record_dict 为空")); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return returnDto; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //1)、当前组织的自身的数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<WorkRecordSubRank> currentAgency = baseDao.selectCurrentAgency(formDTO.getAgencyId(),dateId,typeCodeList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        WorkRecordSubRank currentAgency = baseDao.selectCurrentAgency(formDTO.getAgencyId(),dateId,typeCodeList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //2)、下级所有组织
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<WorkRecordSubRank> subAgencyRankList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for(String agencyId:agencyInfoDTO.getSubAgencyIds()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            WorkRecordSubRank agencyRes= baseDao.selectUpToCalAgency(agencyId,dateId,typeCodeList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for(ScreenCustomerAgencyCommonDTO agencyCommonDTO:agencyInfoDTO.getSubAgencies()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            WorkRecordSubRank agencyRes= baseDao.selectUpToCalAgency(agencyCommonDTO.getAgencyId(),dateId,typeCodeList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if(null !=agencyRes){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                subAgencyRankList.add(agencyRes); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                WorkRecordSubRank agencyDefault=new WorkRecordSubRank(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                agencyDefault.setOrgId(agencyCommonDTO.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                agencyDefault.setName(agencyCommonDTO.getAgencyName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                agencyDefault.setParticipateTotal(0); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                agencyDefault.setParticipateUserTotal(0); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                subAgencyRankList.add(agencyDefault); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //3)、直属网格
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<WorkRecordSubRank> subGridList=new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for(String gridId:agencyInfoDTO.getSubGridIds()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            WorkRecordSubRank gridRes=baseDao.selectUpToCalGrid(gridId,dateId,typeCodeList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for(ScreenCustomerGridCommonDTO gridCommonDTO:agencyInfoDTO.getSubGrids()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            WorkRecordSubRank gridRes=baseDao.selectUpToCalGrid(gridCommonDTO.getGridId(),dateId,typeCodeList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (null != gridRes) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                subGridList.add(gridRes); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                WorkRecordSubRank gridResDefault = new WorkRecordSubRank(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                gridResDefault.setOrgId(gridCommonDTO.getGridId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                gridResDefault.setName(gridCommonDTO.getGridName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                gridResDefault.setParticipateTotal(0); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                gridResDefault.setParticipateUserTotal(0); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                subAgencyRankList.add(gridResDefault); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(CollectionUtils.isNotEmpty(subAgencyRankList)){ | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -138,11 +159,9 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl<ScreenW | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            participateUserTotal += subAgency.getParticipateUserTotal(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            participateTotal += subAgency.getParticipateTotal(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isNotEmpty(currentAgency)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            for (WorkRecordSubRank m : currentAgency) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                participateUserTotal += m.getParticipateUserTotal(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                participateTotal += m.getParticipateTotal(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (null != currentAgency) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            participateUserTotal += currentAgency.getParticipateUserTotal(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            participateTotal += currentAgency.getParticipateTotal(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        returnDto.setParticipateTotal(participateTotal); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        returnDto.setParticipateUserTotal(participateUserTotal); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -226,9 +245,9 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl<ScreenW | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        AgencyInfoDTO agencyInfoDTO = agencyService.getAgencyInfoDTO(formDTO.getAreaCode(), formDTO.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> orgIds = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        orgIds.addAll(agencyInfoDTO.getSubAgencyIds()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        orgIds.add(agencyInfoDTO.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        orgIds.addAll(agencyInfoDTO.getSubGridIds()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        orgIds.addAll(agencyInfoDTO.getSubAgencies().stream().map(agency->agency.getAgencyId()).collect(Collectors.toSet())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        orgIds.add(agencyInfoDTO.getCurrentAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        orgIds.addAll(agencyInfoDTO.getSubGrids().stream().map(grid->grid.getGridId()).collect(Collectors.toSet())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<VoluntaryServiceTrendDTO> list = screenWorkRecordOrgMonthlyDao.selectVoluntaryServiceTrendDTO(formDTO.getCustomerId(), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                orgIds, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                monthIdList.get(NumConstant.ZERO), | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |