| 
					
				 | 
			
			
				@@ -404,7 +404,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //获取活动信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(Objects.nonNull(vipGroupActivity.getCoursesEndTime())||Objects.nonNull(vipGroupActivity.getCoursesStartTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(Objects.nonNull(vipGroupActivity)&&(Objects.nonNull(vipGroupActivity.getCoursesEndTime())||Objects.nonNull(vipGroupActivity.getCoursesStartTime()))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(groupCourseEndTime.after(vipGroupActivity.getCoursesEndTime()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     ||groupCourseStartTime.before(vipGroupActivity.getCoursesStartTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw new BizException("课时安排时间超出范围!"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -976,10 +976,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public void updateVipGroupStudentNumAndStatus(Long vipGroupId , ClassGroup classGroup, Integer num, boolean updateVipStatus) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		VipGroup vipGroup = vipGroupDao.getLockVipGroup(vipGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if(Objects.isNull(vipGroup)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			throw new BizException("指定的vip课程不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//		VipGroup vipGroup = vipGroupDao.getLockVipGroup(vipGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//		if(Objects.isNull(vipGroup)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//			throw new BizException("指定的vip课程不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(Objects.isNull(classGroup)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			throw new BizException("未找到关联班级"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -994,9 +994,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(studentPaymentNum.equals(classGroup.getExpectStudentNum())&&updateVipStatus){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			classGroup.setStudentNum(studentPaymentNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			classGroup.setDelFlag(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			vipGroup.setStatus(VipGroupStatusEnum.PROGRESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			createVipGroupCourseScheInfo(vipGroupId,classGroup); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			vipGroupDao.update(vipGroup); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(num!=0||updateVipStatus){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			int i = courseScheduleDao.countVipGroupCourses(vipGroupId.intValue()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1050,8 +1048,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	@Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public Map buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		SysUser user = sysUserFeignService.queryUserInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(user == null){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1292,7 +1290,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		HashSet<Integer> hashSet = new HashSet<>(organIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		String organIdsString = StringUtils.join(hashSet, ","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		vipGroup.setOrganIdList(organIdsString); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		vipGroupDao.update(vipGroup); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(classGroup.getExpectStudentNum().equals(classGroup.getStudentNum())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			vipGroup.setStatus(VipGroupStatusEnum.PROGRESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		update(vipGroup); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			contractService.transferVipGroupCoursesContract(userId,vipGroupId); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1351,7 +1352,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(Objects.isNull(surplusCourseFee)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             surplusCourseFee = new BigDecimal(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        surplusCourseFee = surplusCourseFee.multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId().intValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(vipGroupCategory.getStudentNum()<=1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            surplusCourseFee = surplusCourseFee.multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            surplusCourseFee = surplusCourseFee.multiply(new BigDecimal(0.7)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		studentApplyRefunds.setExpectAmount(surplusCourseFee); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		studentApplyRefunds.setStatus(StudentApplyRefundsStatus.ING); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		String orderNo=StringUtils.join(new String[]{userId.toString(),String.valueOf(System.currentTimeMillis())}); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1744,52 +1752,19 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(Objects.isNull(bigDecimal)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			bigDecimal = new BigDecimal(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		bigDecimal = bigDecimal.multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId().intValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(vipGroupCategory.getStudentNum()<=1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bigDecimal = bigDecimal.multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bigDecimal = bigDecimal.multiply(new BigDecimal(0.7)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		result.put("suplusCourseFee", bigDecimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//	@Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//	public Map<String, BigDecimal> getStudentSurplusCourseFee(Long vipGroupId, Integer studentId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//			throw new BizException("请指定课程和学生"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		VipGroup vipGroup = vipGroupDao.get(vipGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		if(Objects.isNull(vipGroup)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//			throw new BizException("未找到指定vip课"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		if(vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//			throw new BizException("不能对已停止的课程进行退课操作"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		Map<String,BigDecimal> result=new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//			StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//			if(Objects.isNull(studentPaymentOrder)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//				BigDecimal surplusCourseFee = studentPaymentOrderDao.sumSurplusCourseFee(vipGroupId.toString(), studentId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//				if(Objects.isNull(surplusCourseFee)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//					result.put("suplusCourseFee",new BigDecimal(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//				}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//					result.put("suplusCourseFee",surplusCourseFee); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//			}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//				result.put("suplusCourseFee",studentPaymentOrder.getActualAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//			return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		if(Objects.isNull(classGroup)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//			throw new BizException("未找到对应班级"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		BigDecimal bigDecimal = courseScheduleStudentPaymentDao.countSurplusCourseFee(classGroup.getId(), studentId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		if(Objects.isNull(bigDecimal)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//			bigDecimal = new BigDecimal(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		bigDecimal = bigDecimal.multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		result.put("suplusCourseFee", bigDecimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public void applyRefundAudit(Long id, StudentApplyRefundsStatus status, String remark,BigDecimal amount) { 
			 |