|  | @@ -4,13 +4,16 @@ import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.ST
 | 
	
		
			
				|  |  |  import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.*;
 | 
	
		
			
				|  |  |  import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
 | 
	
		
			
				|  |  |  import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
 | 
	
		
			
				|  |  | +import static com.ym.mec.biz.dal.enums.PaymentStatusEnum.YES;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.math.BigDecimal;
 | 
	
		
			
				|  |  |  import java.util.*;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dto.MusicArrearageStudentDto;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.*;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.ArrearageStudentsQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.page.PageInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.page.QueryInfo;
 | 
	
	
		
			
				|  | @@ -21,13 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.SysConfigDao;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dto.FeeStudentDto;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dto.SimpleUserDto;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
 | 
	
	
		
			
				|  | @@ -66,6 +62,8 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 | 
	
		
			
				|  |  |  	@Autowired
 | 
	
		
			
				|  |  |  	private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
 | 
	
		
			
				|  |  |  	@Autowired
 | 
	
		
			
				|  |  | +	private StudentRegistrationDao studentRegistrationDao;
 | 
	
		
			
				|  |  | +	@Autowired
 | 
	
		
			
				|  |  |  	private SysMessageService sysMessageService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	@Override
 | 
	
	
		
			
				|  | @@ -108,6 +106,21 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 | 
	
		
			
				|  |  |  			}else {
 | 
	
		
			
				|  |  |  				calender.setActualNum((calender.getActualNum()==null?0:calender.getActualNum()) + 1);
 | 
	
		
			
				|  |  |  				e.setPaymentStatus(PAID_COMPLETED);
 | 
	
		
			
				|  |  | +				if(calender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.ADD_STUDENT){
 | 
	
		
			
				|  |  | +					MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(e.getUserId(), calender.getMusicGroupId());
 | 
	
		
			
				|  |  | +					if (musicGroupStudentFee != null) {
 | 
	
		
			
				|  |  | +						musicGroupStudentFee.setUpdateTime(date);
 | 
	
		
			
				|  |  | +						musicGroupStudentFee.setLatestPaidTime(date);
 | 
	
		
			
				|  |  | +						musicGroupStudentFee.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
 | 
	
		
			
				|  |  | +						musicGroupStudentFee.setTemporaryCourseFee(new BigDecimal(0));
 | 
	
		
			
				|  |  | +						musicGroupStudentFeeDao.update(musicGroupStudentFee);
 | 
	
		
			
				|  |  | +					}
 | 
	
		
			
				|  |  | +					//如果是进行中加学员
 | 
	
		
			
				|  |  | +					StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(e.getUserId(), calender.getMusicGroupId());
 | 
	
		
			
				|  |  | +					studentRegistration.setPaymentStatus(YES);
 | 
	
		
			
				|  |  | +					studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
 | 
	
		
			
				|  |  | +					studentRegistrationDao.update(studentRegistration);
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  		});
 | 
	
		
			
				|  |  |  		musicGroupPaymentCalenderDao.update(calender);
 |