|  | @@ -115,6 +115,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  	private StudentPauseInfoDao studentPauseInfoDao;
 | 
	
		
			
				|  |  |  	@Autowired
 | 
	
		
			
				|  |  |  	private IdGeneratorService idGeneratorService;
 | 
	
		
			
				|  |  | +	@Autowired
 | 
	
		
			
				|  |  | +	private StudentAttendanceDao studentAttendanceDao;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	private static final Logger LOGGER = LoggerFactory
 | 
	
		
			
				|  |  |  			.getLogger(VipGroup.class);
 | 
	
	
		
			
				|  | @@ -747,6 +749,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  					.sorted(Comparator.comparing(CourseSchedule::getStartClassTime))
 | 
	
		
			
				|  |  |  					.collect(Collectors.toList());
 | 
	
		
			
				|  |  |  			vipGroupDetail.setCourseSchedules(collect);
 | 
	
		
			
				|  |  | +			vipGroupDetail.setTotalClassTimes(collect.size());
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          vipGroupDetail.setNumberOfClasses(vipGroupDao.countTeacherVipGroups(vipGroupDetail.getTeacherId().longValue()));
 | 
	
	
		
			
				|  | @@ -1519,6 +1522,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  		classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.QUIT_SCHOOL);
 | 
	
		
			
				|  |  |  		classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +		if(!CollectionUtils.isEmpty(courseScheduleIds)){
 | 
	
		
			
				|  |  | +			studentAttendanceDao.deleteByCourseAndUser(courseScheduleIds,studentId);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  		List<Integer> studentPaymentIds = courseScheduleStudentPaymentDao.findNotStartCourseStudentPaymentIdsWithClassGroupAndStudent(classGroup.getId(), studentId);
 | 
	
		
			
				|  |  |  		if(!CollectionUtils.isEmpty(studentPaymentIds)){
 | 
	
		
			
				|  |  |  			courseScheduleStudentPaymentDao.batchDeleteWithID(studentPaymentIds);
 | 
	
	
		
			
				|  | @@ -1960,10 +1967,16 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |      	if(vipGroup.getStatus()==VipGroupStatusEnum.CANCEL){
 | 
	
		
			
				|  |  |      		throw new BizException("该课程已结束或者已被停止,无法进行此操作");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | +		ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(vipGroupId.toString(), "VIP");
 | 
	
		
			
				|  |  | +    	if(Objects.isNull(classGroup)){
 | 
	
		
			
				|  |  | +    		throw new BizException("班级不存在");
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  |  		List<Long> courseScheduleIds = courseScheduleDao.findVipGroupNotStartCourseScheduleIds(vipGroupId.toString(),GroupType.VIP.getCode());
 | 
	
		
			
				|  |  |      	if(vipGroup.getStatus()==VipGroupStatusEnum.NOT_START){
 | 
	
		
			
				|  |  |  			vipGroup.setStatus(VipGroupStatusEnum.CANCEL);
 | 
	
		
			
				|  |  |      		vipGroupDao.update(vipGroup);
 | 
	
		
			
				|  |  | +    		classGroup.setDelFlag(1);
 | 
	
		
			
				|  |  | +    		classGroupDao.update(classGroup);
 | 
	
		
			
				|  |  |      		if(courseScheduleIds != null && courseScheduleIds.size() > 0){
 | 
	
		
			
				|  |  |  				courseScheduleDao.batchDeleteCourseSchedules(courseScheduleIds);
 | 
	
		
			
				|  |  |  				courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
 | 
	
	
		
			
				|  | @@ -1979,6 +1992,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  			vipGroup.setStatus(VipGroupStatusEnum.CANCEL);
 | 
	
		
			
				|  |  |  			vipGroupDao.update(vipGroup);
 | 
	
		
			
				|  |  | +			classGroup.setDelFlag(1);
 | 
	
		
			
				|  |  | +			classGroupDao.update(classGroup);
 | 
	
		
			
				|  |  |  			stopVipPush(vipGroup.getId(),vipGroup.getName());
 | 
	
		
			
				|  |  |  			return;
 | 
	
		
			
				|  |  |  		}
 | 
	
	
		
			
				|  | @@ -2003,6 +2018,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  		vipGroup.setStatus(VipGroupStatusEnum.CANCEL);
 | 
	
		
			
				|  |  |      	vipGroup.setStopReason(stopReason);
 | 
	
		
			
				|  |  |  		vipGroupDao.update(vipGroup);
 | 
	
		
			
				|  |  | +		classGroup.setDelFlag(1);
 | 
	
		
			
				|  |  | +		classGroupDao.update(classGroup);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		courseScheduleDao.batchDeleteCourseSchedules(courseScheduleIds);
 | 
	
		
			
				|  |  |  		courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
 | 
	
	
		
			
				|  | @@ -2151,8 +2168,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  			throw new BizException("班级不存在");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		if(!vipGroup.getStatus().equals(VipGroupStatusEnum.PROGRESS)
 | 
	
		
			
				|  |  | -			&&!vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING_END)){
 | 
	
		
			
				|  |  | +		if(!vipGroup.getStatus().equals(VipGroupStatusEnum.PROGRESS)){
 | 
	
		
			
				|  |  |  			throw new BizException("此状态的vip课程不支持加课");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2280,8 +2296,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  		if(Objects.isNull(vipGroup)){
 | 
	
		
			
				|  |  |  			throw new BizException("未找到指定的vip课程");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -		if(vipGroup.getStatus().equals(VipGroupStatusEnum.NOT_START)){
 | 
	
		
			
				|  |  | -			throw new BizException("此课程还未开始");
 | 
	
		
			
				|  |  | +		if(!vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)
 | 
	
		
			
				|  |  | +				&&!vipGroup.getStatus().equals(VipGroupStatusEnum.NOT_START)){
 | 
	
		
			
				|  |  | +			throw new BizException("此课程不处于报名状态");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2298,7 +2315,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  		Date now=new Date();
 | 
	
		
			
				|  |  |          List<ImGroupMember> imGroupMemberList = new ArrayList<>();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
 | 
	
		
			
				|  |  | +		if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)||vipGroup.getStatus().equals(VipGroupStatusEnum.NOT_START)){
 | 
	
		
			
				|  |  |  			List<CourseSchedule> courseSchedules = JSON.parseArray(vipGroup.getCourseSchedulesJson(),CourseSchedule.class);
 | 
	
		
			
				|  |  |  			int courseNum = courseScheduleDao.countVipGroupCourses(vipGroupId.intValue());
 | 
	
		
			
				|  |  |  			if(courseNum==0){
 | 
	
	
		
			
				|  | @@ -2535,6 +2552,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  		//用户账户资金变动信息列表
 | 
	
		
			
				|  |  |  		List<SysUserCashAccountDetail> userCashAccountDetails = new ArrayList<>();
 | 
	
		
			
				|  |  |  		for (VipGroup noCreateSuccessVipGroup : noCreateSuccessVipGroups) {
 | 
	
		
			
				|  |  | +			int i = courseScheduleStudentPaymentDao.countStudentCourseNumWithGroup(GroupType.VIP, noCreateSuccessVipGroup.getId().toString());
 | 
	
		
			
				|  |  | +			if(i>0){
 | 
	
		
			
				|  |  | +				break;
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  |  			noCreateSuccessVipGroup.setStatus(VipGroupStatusEnum.CANCEL);
 | 
	
		
			
				|  |  |  			List<StudentPaymentOrder> studentPaymentOrders = studentPaymentOrderDao.queryByDealStatus(noCreateSuccessVipGroup.getId().toString(),
 | 
	
		
			
				|  |  |  					OrderTypeEnum.SMALL_CLASS_TO_BUY, DealStatusEnum.SUCCESS);
 | 
	
	
		
			
				|  | @@ -2597,11 +2618,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  					} else if (vipGroup.getRegistrationStartTime().before(now) && vipGroup.getPaymentExpireDate().after(now)) {
 | 
	
		
			
				|  |  |  						vipGroup.setStatus(VipGroupStatusEnum.APPLYING);
 | 
	
		
			
				|  |  |  					}
 | 
	
		
			
				|  |  | -					if (vipGroup.getPaymentExpireDate().before(now) && vipGroup.getCourseStartDate().after(now)) {
 | 
	
		
			
				|  |  | -						vipGroup.setStatus(VipGroupStatusEnum.APPLYING_END);
 | 
	
		
			
				|  |  | -					} else if (vipGroup.getCourseStartDate().before(now) && vipGroup.getCoursesExpireDate().after(now)) {
 | 
	
		
			
				|  |  | -						vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
 | 
	
		
			
				|  |  | -					}
 | 
	
		
			
				|  |  |  					VipGroup vipGroup1 = new VipGroup();
 | 
	
		
			
				|  |  |  					vipGroup1.setId(vipGroup.getId());
 | 
	
		
			
				|  |  |  					vipGroup1.setStatus(vipGroup.getStatus());
 |