|  |  | @ -36,11 +36,8 @@ import org.springframework.util.CollectionUtils; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import java.math.BigDecimal; | 
			
		
	
		
			
				
					|  |  |  | import java.text.NumberFormat; | 
			
		
	
		
			
				
					|  |  |  | import java.util.ArrayList; | 
			
		
	
		
			
				
					|  |  |  | import java.util.HashMap; | 
			
		
	
		
			
				
					|  |  |  | import java.util.List; | 
			
		
	
		
			
				
					|  |  |  | import java.util.Map; | 
			
		
	
		
			
				
					|  |  |  | import java.util.concurrent.atomic.AtomicReference; | 
			
		
	
		
			
				
					|  |  |  | import java.util.*; | 
			
		
	
		
			
				
					|  |  |  | import java.util.concurrent.atomic.AtomicInteger; | 
			
		
	
		
			
				
					|  |  |  | import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /** | 
			
		
	
	
		
			
				
					|  |  | @ -328,8 +325,10 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { | 
			
		
	
		
			
				
					|  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         //网格办结项目数
 | 
			
		
	
		
			
				
					|  |  |  |         List<GridProjectClosedTotalResultDTO> gridProjectClosedTotalList = projectMainService.selectGridClosedProject(result.stream().map(m -> m.getGridId()).collect(Collectors.toList()), monthId, ExtractConstant.CLOSED); | 
			
		
	
		
			
				
					|  |  |  |         List<String> allGridIds = result.stream().map(GovernAbilityGridMonthlyFormDTO::getGridId).collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |         List<GridProjectClosedTotalResultDTO> gridProjectClosedTotalList = projectMainService.selectGridClosedProject(allGridIds, monthId, ExtractConstant.CLOSED); | 
			
		
	
		
			
				
					|  |  |  |         //网格吹哨部门准确率  【没被退回的项目数/项目总数 】
 | 
			
		
	
		
			
				
					|  |  |  |         //获取网格 存在的项目id及网格Id 没有项目的网格需要过滤出来
 | 
			
		
	
		
			
				
					|  |  |  |         List<TransferRightRatioResultDTO> transferRightRatioResultDTOS = projectMainService.selectTransferRightRatio(customerId, monthId); | 
			
		
	
		
			
				
					|  |  |  |         List<TransferRightRatioResultDTO> transferRightRatioResultDTOS1 = projectLogService.selectNotReturn(customerId, monthId); | 
			
		
	
		
			
				
					|  |  |  |         if (!CollectionUtils.isEmpty(transferRightRatioResultDTOS1)){ | 
			
		
	
	
		
			
				
					|  |  | @ -339,16 +338,19 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { | 
			
		
	
		
			
				
					|  |  |  |         }else { | 
			
		
	
		
			
				
					|  |  |  |             transferRightRatioResultDTOS.forEach(r -> r.setStatus(false)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         Set<String> haveNotProjectSet = new HashSet<>(allGridIds); | 
			
		
	
		
			
				
					|  |  |  |         Map<String, List<TransferRightRatioResultDTO>> groupByGridProject = transferRightRatioResultDTOS.stream().collect(Collectors.groupingBy(TransferRightRatioResultDTO::getGridId)); | 
			
		
	
		
			
				
					|  |  |  |         Map<String,BigDecimal> notReturnMap = new HashMap<>(16); | 
			
		
	
		
			
				
					|  |  |  |         groupByGridProject.forEach((grid,project) -> { | 
			
		
	
		
			
				
					|  |  |  |             AtomicReference<Integer> count = new AtomicReference<>(NumConstant.ZERO); | 
			
		
	
		
			
				
					|  |  |  |             AtomicInteger count = new AtomicInteger(NumConstant.ZERO); | 
			
		
	
		
			
				
					|  |  |  |             project.forEach(p -> { | 
			
		
	
		
			
				
					|  |  |  |                 if (p.getStatus().equals(false)){ | 
			
		
	
		
			
				
					|  |  |  |                     count.getAndSet(count.get() + NumConstant.ONE); | 
			
		
	
		
			
				
					|  |  |  |                     count.incrementAndGet(); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  |             notReturnMap.put(grid,getRound(new BigDecimal(count.get()/project.size()).multiply(NumConstant.ONE_HUNDRED_DECIMAL))); | 
			
		
	
		
			
				
					|  |  |  |             notReturnMap.put(grid,getRound(new BigDecimal(count.get()).divide(new BigDecimal(project.size()),NumConstant.EIGHT,BigDecimal.ROUND_HALF_UP).multiply(NumConstant.ONE_HUNDRED_DECIMAL))); | 
			
		
	
		
			
				
					|  |  |  |             //把有项目数的网格剔除 只剩下没有项目的网格
 | 
			
		
	
		
			
				
					|  |  |  |             haveNotProjectSet.remove(grid); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  |         //网格内解决的项目的满意度
 | 
			
		
	
		
			
				
					|  |  |  |         //项目评价(分值定义下非常满意100,满意80,不满意(一般)60)的人数的平均分(每个项目的参加人数的分数和/评论人数=一个项目的平均分)+其他项目得分/已关闭项目总数
 | 
			
		
	
	
		
			
				
					|  |  | @ -425,6 +427,10 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             //如果项目数为0 则准确率设置为100
 | 
			
		
	
		
			
				
					|  |  |  |             if (haveNotProjectSet.contains(r.getGridId())){ | 
			
		
	
		
			
				
					|  |  |  |                 r.setTransferRightRatio(new BigDecimal(100)); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             // 5. 网格内解决的项目的满意度
 | 
			
		
	
		
			
				
					|  |  |  |             if (!CollectionUtils.isEmpty(resultSatisfactionScore)){ | 
			
		
	
		
			
				
					|  |  |  |                 resultSatisfactionScore.forEach((k, v) -> { | 
			
		
	
	
		
			
				
					|  |  | 
 |