|  |  | @ -41,10 +41,8 @@ import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import java.util.ArrayList; | 
			
		
	
		
			
				
					|  |  |  | import java.util.Arrays; | 
			
		
	
		
			
				
					|  |  |  | import java.util.List; | 
			
		
	
		
			
				
					|  |  |  | import java.util.Map; | 
			
		
	
		
			
				
					|  |  |  | import java.util.*; | 
			
		
	
		
			
				
					|  |  |  | import java.util.concurrent.atomic.AtomicInteger; | 
			
		
	
		
			
				
					|  |  |  | import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /** | 
			
		
	
	
		
			
				
					|  |  | @ -147,12 +145,18 @@ public class BizPointTotalDetailServiceImpl extends BaseServiceImpl<BizPointTota | 
			
		
	
		
			
				
					|  |  |  |                 .eq("OBJECT_ID", formDTO.getGroupId()) | 
			
		
	
		
			
				
					|  |  |  |                 .eq("DEL_FLAG", NumConstant.ZERO_STR); | 
			
		
	
		
			
				
					|  |  |  |         BizPointTotalDetailEntity entity = baseDao.selectOne(wrapper); | 
			
		
	
		
			
				
					|  |  |  |         int toUpgrade = Integer.parseInt(detail.getNextLevelPoint()) - entity.getTotalPoint(); | 
			
		
	
		
			
				
					|  |  |  |         detail.setToUpgrade(Integer.toString(toUpgrade)); | 
			
		
	
		
			
				
					|  |  |  |         Integer increase = bizPointUserTotalDetailService.getIncrease("group", formDTO.getGroupId()); | 
			
		
	
		
			
				
					|  |  |  |         detail.setIncrease(increase.toString()); | 
			
		
	
		
			
				
					|  |  |  |         detail.setTotal(entity.getTotalPoint().toString()); | 
			
		
	
		
			
				
					|  |  |  |         detail.setCurrentPoint(entity.getTotalPoint().toString()); | 
			
		
	
		
			
				
					|  |  |  |         if (null == entity) { | 
			
		
	
		
			
				
					|  |  |  |             detail.setToUpgrade(detail.getNextLevelPoint()); | 
			
		
	
		
			
				
					|  |  |  |             detail.setTotal(NumConstant.ZERO_STR); | 
			
		
	
		
			
				
					|  |  |  |             detail.setCurrentPoint(NumConstant.ZERO_STR); | 
			
		
	
		
			
				
					|  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |             int toUpgrade = Integer.parseInt(detail.getNextLevelPoint()) - entity.getTotalPoint(); | 
			
		
	
		
			
				
					|  |  |  |             detail.setToUpgrade(Integer.toString(toUpgrade)); | 
			
		
	
		
			
				
					|  |  |  |             detail.setTotal(entity.getTotalPoint().toString()); | 
			
		
	
		
			
				
					|  |  |  |             detail.setCurrentPoint(entity.getTotalPoint().toString()); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         return detail; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -166,7 +170,7 @@ public class BizPointTotalDetailServiceImpl extends BaseServiceImpl<BizPointTota | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public List<GroupPointRankingResultDTO> groupPointRanking(GroupPointFormDTO formDTO) { | 
			
		
	
		
			
				
					|  |  |  |         List<GroupPointRankingResultDTO> list = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |         List<GroupPointRankingResultDTO> list; | 
			
		
	
		
			
				
					|  |  |  |         QueryWrapper<BizPointTotalDetailEntity> wrapper = new QueryWrapper<>(); | 
			
		
	
		
			
				
					|  |  |  |         wrapper.eq("BIZ_TYPE", "group") | 
			
		
	
		
			
				
					|  |  |  |                 .eq("GRID_ID", formDTO.getGridId()) | 
			
		
	
	
		
			
				
					|  |  | @ -174,24 +178,29 @@ public class BizPointTotalDetailServiceImpl extends BaseServiceImpl<BizPointTota | 
			
		
	
		
			
				
					|  |  |  |                 .orderByDesc("TOTAL_POINT"); | 
			
		
	
		
			
				
					|  |  |  |         List<BizPointTotalDetailEntity> totalDetailList = baseDao.selectList(wrapper); | 
			
		
	
		
			
				
					|  |  |  |         Result<List<ResiGroupDTO>> groupList = resiGroupOpenFeignClient.getGroupListByGrid(formDTO.getGridId()); | 
			
		
	
		
			
				
					|  |  |  |         list = groupList.getData().stream().map(item -> { | 
			
		
	
		
			
				
					|  |  |  |             GroupPointRankingResultDTO dto = new GroupPointRankingResultDTO(); | 
			
		
	
		
			
				
					|  |  |  |             dto.setGroupId(item.getId()); | 
			
		
	
		
			
				
					|  |  |  |             dto.setGroupName(item.getGroupName()); | 
			
		
	
		
			
				
					|  |  |  |             dto.setPoint(NumConstant.ZERO_STR); | 
			
		
	
		
			
				
					|  |  |  |             if (formDTO.getGroupId().equals(item.getId())) { | 
			
		
	
		
			
				
					|  |  |  |                 dto.setIsMine(NumConstant.ONE_STR); | 
			
		
	
		
			
				
					|  |  |  |             } else { | 
			
		
	
		
			
				
					|  |  |  |                 dto.setIsMine(NumConstant.ZERO_STR); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             return dto; | 
			
		
	
		
			
				
					|  |  |  |         }).collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |         list.forEach(item -> totalDetailList.stream().filter(detail -> item.getGroupId().equals(detail.getObjectId())).forEach(total -> { | 
			
		
	
		
			
				
					|  |  |  |             item.setPoint(total.getTotalPoint().toString()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         })); | 
			
		
	
		
			
				
					|  |  |  |         list = | 
			
		
	
		
			
				
					|  |  |  |                 totalDetailList.stream().flatMap(detail -> groupList.getData().stream().filter(item -> item.getId().equals(detail.getObjectId())).map(group -> { | 
			
		
	
		
			
				
					|  |  |  |                     GroupPointRankingResultDTO dto = new GroupPointRankingResultDTO(); | 
			
		
	
		
			
				
					|  |  |  |                     dto.setGroupId(group.getId()); | 
			
		
	
		
			
				
					|  |  |  |                     dto.setGroupName(group.getGroupName()); | 
			
		
	
		
			
				
					|  |  |  |                     dto.setPoint(detail.getTotalPoint().toString()); | 
			
		
	
		
			
				
					|  |  |  |                     if (formDTO.getGroupId().equals(group.getId())) { | 
			
		
	
		
			
				
					|  |  |  |                         dto.setIsMine(NumConstant.ONE_STR); | 
			
		
	
		
			
				
					|  |  |  |                     } else { | 
			
		
	
		
			
				
					|  |  |  |                         dto.setIsMine(NumConstant.ZERO_STR); | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |                     return dto; | 
			
		
	
		
			
				
					|  |  |  |         })).collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |         int i = 1; | 
			
		
	
		
			
				
					|  |  |  |         for (GroupPointRankingResultDTO dto : list) { | 
			
		
	
		
			
				
					|  |  |  |             dto.setRanking(String.valueOf(i)); | 
			
		
	
		
			
				
					|  |  |  |             i++; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |                 list.stream().sorted(Comparator.comparing(GroupPointRankingResultDTO :: getPoint, Comparator.comparingInt(Integer::parseInt)).reversed().thenComparing(GroupPointRankingResultDTO::getGroupName)) | 
			
		
	
		
			
				
					|  |  |  |                 .collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |         AtomicInteger i = new AtomicInteger(1); | 
			
		
	
		
			
				
					|  |  |  |         list.forEach(dto -> { | 
			
		
	
		
			
				
					|  |  |  |             dto.setRanking(String.valueOf(i.getAndIncrement())); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  |         return list; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | 
 |