|  | @@ -467,37 +467,45 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  			pageInfo.setTotal(count);
 | 
	
		
			
				|  |  |  			params.put("offset", pageInfo.getOffset());
 | 
	
		
			
				|  |  |  			dataList = vipGroupDao.findAllByOrgan(params);
 | 
	
		
			
				|  |  | -			List<String> vipGroupIds = dataList.stream().map(vipGroup -> String.valueOf(vipGroup.getId())).distinct().collect(Collectors.toList());
 | 
	
		
			
				|  |  | -			List<Map<Long, Integer>> vipGroupOverCourses = vipGroupDao.countVipGroupOverCourse(vipGroupIds);
 | 
	
		
			
				|  |  | -			Map<String,Integer> vipGroupOverCourseMaps = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(vipGroupOverCourses)),HashMap.class);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -			List<ClassGroup> classGroupsByVipGroups = classGroupDao
 | 
	
		
			
				|  |  | -					.findByMusicGroupsAndType(vipGroupIds.stream().map(vipGroupId->String.valueOf(vipGroupId)).collect(Collectors.toList()),
 | 
	
		
			
				|  |  | -							GroupType.VIP.getCode());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -			Map<String, ClassGroup> vipGroupClassGroupMap = classGroupsByVipGroups.stream().collect(Collectors.toMap(ClassGroup::getMusicGroupId, classGroup -> classGroup));
 | 
	
		
			
				|  |  | -			dataList.forEach(vipGroup -> {
 | 
	
		
			
				|  |  | -				Integer overCourses = vipGroupOverCourseMaps.get(vipGroup.getId().toString());
 | 
	
		
			
				|  |  | -				ClassGroup classGroup = vipGroupClassGroupMap.get(vipGroup.getId().toString());
 | 
	
		
			
				|  |  | -				if(Objects.nonNull(classGroup)){
 | 
	
		
			
				|  |  | +			if(dataList != null && dataList.size() > 0){
 | 
	
		
			
				|  |  | +				List<String> vipGroupIds = dataList.stream().map(vipGroup -> String.valueOf(vipGroup.getId())).distinct().collect(Collectors.toList());
 | 
	
		
			
				|  |  | +				List<Map<Long, Integer>> vipGroupOverCourses = vipGroupDao.countVipGroupOverCourse(vipGroupIds);
 | 
	
		
			
				|  |  | +				Map<String,Integer> vipGroupOverCourseMaps = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(vipGroupOverCourses)),HashMap.class);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +				List<ClassGroup> classGroupsByVipGroups = classGroupDao
 | 
	
		
			
				|  |  | +						.findByMusicGroupsAndType(vipGroupIds.stream().map(vipGroupId->String.valueOf(vipGroupId)).collect(Collectors.toList()),
 | 
	
		
			
				|  |  | +								GroupType.VIP.getCode());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +				Map<String, ClassGroup> vipGroupClassGroupMap = classGroupsByVipGroups.stream().collect(Collectors.toMap(ClassGroup::getMusicGroupId, classGroup -> classGroup));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +				Map<String,Long> totalClassTimeMap = MapUtil.convertIntegerMap(courseScheduleDao.countTotalCourseScheduleNum(vipGroupIds,"VIP"));
 | 
	
		
			
				|  |  | +				Map<String,Long> currentClassTimeMap = MapUtil.convertIntegerMap(courseScheduleDao.countCourseScheduleNum(vipGroupIds,"VIP"));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +				dataList.forEach(vipGroup -> {
 | 
	
		
			
				|  |  | +					Integer overCourses = vipGroupOverCourseMaps.get(vipGroup.getId().toString());
 | 
	
		
			
				|  |  | +					ClassGroup classGroup = vipGroupClassGroupMap.get(vipGroup.getId().toString());
 | 
	
		
			
				|  |  |  					vipGroup.setStudentNum(classGroup.getStudentNum());
 | 
	
		
			
				|  |  | -					vipGroup.setTotalClassTimes(classGroup.getTotalClassTimes());
 | 
	
		
			
				|  |  | -					vipGroup.setCurrentClassTimes(classGroup.getCurrentClassTimes());
 | 
	
		
			
				|  |  | -				}
 | 
	
		
			
				|  |  | -				Integer totalClassTimes=vipGroup.getTotalClassTimes();
 | 
	
		
			
				|  |  | -				if(Objects.isNull(totalClassTimes) || Objects.isNull(overCourses)){
 | 
	
		
			
				|  |  | -					vipGroup.setMonthConsumeRate(0);
 | 
	
		
			
				|  |  | -				}else{
 | 
	
		
			
				|  |  | -					if(totalClassTimes<=0){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +					Long aLong = totalClassTimeMap.get(vipGroup.getId() + "");
 | 
	
		
			
				|  |  | +					vipGroup.setTotalClassTimes(aLong==null?0:aLong.intValue());
 | 
	
		
			
				|  |  | +					Long aLong1 = currentClassTimeMap.get(vipGroup.getId() + "");
 | 
	
		
			
				|  |  | +					vipGroup.setCurrentClassTimes(aLong1==null?0:aLong1.intValue());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +					Integer totalClassTimes=vipGroup.getTotalClassTimes();
 | 
	
		
			
				|  |  | +					if(Objects.isNull(totalClassTimes) || Objects.isNull(overCourses)){
 | 
	
		
			
				|  |  |  						vipGroup.setMonthConsumeRate(0);
 | 
	
		
			
				|  |  |  					}else{
 | 
	
		
			
				|  |  | -						BigDecimal overCoursesOfMonth=new BigDecimal(overCourses),allClassTimes=new BigDecimal(totalClassTimes);
 | 
	
		
			
				|  |  | +						if(totalClassTimes<=0){
 | 
	
		
			
				|  |  | +							vipGroup.setMonthConsumeRate(0);
 | 
	
		
			
				|  |  | +						}else{
 | 
	
		
			
				|  |  | +							BigDecimal overCoursesOfMonth=new BigDecimal(overCourses),allClassTimes=new BigDecimal(totalClassTimes);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -						Integer monthConsumeRate=overCoursesOfMonth.divide(allClassTimes,CommonConstants.DECIMAL_FINAL_PLACE,BigDecimal.ROUND_HALF_UP).intValue();
 | 
	
		
			
				|  |  | -						vipGroup.setMonthConsumeRate(monthConsumeRate * 100);
 | 
	
		
			
				|  |  | +							Integer monthConsumeRate=overCoursesOfMonth.divide(allClassTimes,CommonConstants.DECIMAL_FINAL_PLACE,BigDecimal.ROUND_HALF_UP).intValue();
 | 
	
		
			
				|  |  | +							vipGroup.setMonthConsumeRate(monthConsumeRate * 100);
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  |  					}
 | 
	
		
			
				|  |  | -				}
 | 
	
		
			
				|  |  | -			});
 | 
	
		
			
				|  |  | +				});
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		if (count == 0) {
 | 
	
		
			
				|  |  |  			dataList = new ArrayList<>();
 | 
	
	
		
			
				|  | @@ -2060,7 +2068,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  		if(Objects.isNull(sysUserCashAccount)){
 | 
	
		
			
				|  |  |  			throw new BizException("当前用户没有现金账户");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -		CourseSchedule
 | 
	
		
			
				|  |  |  		vipGroupPayInfo.setBalance(sysUserCashAccount.getBalance());
 | 
	
		
			
				|  |  |  		return  vipGroupPayInfo;
 | 
	
		
			
				|  |  |  	}
 |