|  | @@ -22,16 +22,14 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 | 
	
		
			
				|  |  |  import com.ym.mec.im.ImFeignService;
 | 
	
		
			
				|  |  |  import com.ym.mec.thirdparty.eseal.ESealPlugin;
 | 
	
		
			
				|  |  |  import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 | 
	
		
			
				|  |  | -import com.ym.mec.thirdparty.user.realname.RealnameAuthenticationPluginContext;
 | 
	
		
			
				|  |  | -import com.ym.mec.thirdparty.user.realname.provider.LinkfaceRealnameAuthenticationPlugin;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.collection.MapUtil;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.http.HttpUtil;
 | 
	
		
			
				|  |  |  import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.slf4j.Logger;
 | 
	
		
			
				|  |  |  import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | -import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | +import org.springframework.transaction.annotation.Isolation;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import javax.annotation.Resource;
 | 
	
	
		
			
				|  | @@ -106,9 +104,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private GoodsDao goodsDao;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  | -    private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  |      private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public BaseDAO<Long, StudentRegistration> getDAO() {
 | 
	
	
		
			
				|  | @@ -840,6 +838,30 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 | 
	
		
			
				|  |  |          return classGroupStuList;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
 | 
	
		
			
				|  |  | +    public void updateCalender(Long calenderDetailId,Integer userId){
 | 
	
		
			
				|  |  | +        Date date = new Date();
 | 
	
		
			
				|  |  | +        MusicGroupPaymentCalenderDetail calenderDetail = musicGroupPaymentCalenderDetailDao.get(calenderDetailId);
 | 
	
		
			
				|  |  | +        MusicGroupPaymentCalender calender = musicGroupPaymentCalenderService.get(calenderDetail.getMusicGroupPaymentCalenderId());
 | 
	
		
			
				|  |  | +        MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(userId, calender.getMusicGroupId());
 | 
	
		
			
				|  |  | +        if(calender.getIsGiveMusicNetwork()){
 | 
	
		
			
				|  |  | +            //赠送网管课
 | 
	
		
			
				|  |  | +            musicGroupStudentFee.setRemainNetworkClassTimes(musicGroupStudentFee.getRemainNetworkClassTimes() + 1);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        //更新学生的缴费记录状态
 | 
	
		
			
				|  |  | +        calenderDetail.setPaymentStatus(MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED);
 | 
	
		
			
				|  |  | +        calenderDetail.setActualAmount(calenderDetail.getExpectAmount());
 | 
	
		
			
				|  |  | +        calenderDetail.setPayTime(date);
 | 
	
		
			
				|  |  | +        calenderDetail.setUpdateTime(date);
 | 
	
		
			
				|  |  | +        musicGroupPaymentCalenderDetailDao.update(calenderDetail);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //更新实际缴费人数
 | 
	
		
			
				|  |  | +        Integer actualNum = calender.getActualNum() == null ? 0 : calender.getActualNum();
 | 
	
		
			
				|  |  | +        calender.setActualNum(actualNum + 1);
 | 
	
		
			
				|  |  | +        calender.setUpdateTime(date);
 | 
	
		
			
				|  |  | +        musicGroupPaymentCalenderDao.update(calender);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |      public StudentPaymentOrder updateApplyOrder(StudentPaymentOrder studentPaymentOrder) throws Exception {
 | 
	
	
		
			
				|  | @@ -859,7 +881,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 | 
	
		
			
				|  |  |          MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (studentPaymentOrder.getStatus().equals(DealStatusEnum.SUCCESS)) {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |              MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              if (studentRegistration.getTemporaryCourseFee() != null) {
 | 
	
	
		
			
				|  | @@ -869,24 +890,42 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 | 
	
		
			
				|  |  |              studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
 | 
	
		
			
				|  |  |              studentRegistrationDao.update(studentRegistration);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +            //当前乐团报名是否赠送乐团网管课
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            MusicGroupPaymentCalenderDetail calenderDetail = musicGroupPaymentCalenderDetailDao.findByOrderNo(studentPaymentOrder.getOrderNo());
 | 
	
		
			
				|  |  | +            MusicGroupPaymentCalender calender = musicGroupPaymentCalenderService.get(calenderDetail.getMusicGroupPaymentCalenderId());
 | 
	
		
			
				|  |  | +            MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(studentRegistration.getUserId(), studentRegistration.getMusicGroupId());
 | 
	
		
			
				|  |  | +            if(calender.getIsGiveMusicNetwork()){
 | 
	
		
			
				|  |  | +                //赠送网管课
 | 
	
		
			
				|  |  | +                musicGroupStudentFee.setRemainNetworkClassTimes(musicGroupStudentFee.getRemainNetworkClassTimes() + 1);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            //更新学生的缴费记录状态
 | 
	
		
			
				|  |  | +            calenderDetail.setPaymentStatus(MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED);
 | 
	
		
			
				|  |  | +            calenderDetail.setActualAmount(calenderDetail.getExpectAmount());
 | 
	
		
			
				|  |  | +            calenderDetail.setPayTime(nowDate);
 | 
	
		
			
				|  |  | +            calenderDetail.setUpdateTime(nowDate);
 | 
	
		
			
				|  |  | +            musicGroupPaymentCalenderDetailDao.update(calenderDetail);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //更新实际缴费人数
 | 
	
		
			
				|  |  | +            Integer actualNum = calender.getActualNum() == null ? 0 : calender.getActualNum();
 | 
	
		
			
				|  |  | +            calender.setActualNum(actualNum + 1);
 | 
	
		
			
				|  |  | +            calender.setUpdateTime(nowDate);
 | 
	
		
			
				|  |  | +            musicGroupPaymentCalenderDao.update(calender);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              //进行中乐团加入学生缴费
 | 
	
		
			
				|  |  |              if (studentRegistration.getTemporaryCourseFee() != null) {
 | 
	
		
			
				|  |  |                  //关闭待支付订单
 | 
	
		
			
				|  |  |                  StudentPaymentOrder waitPayOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(studentRegistration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
 | 
	
		
			
				|  |  |                  waitPayOrder.setStatus(DealStatusEnum.CLOSE);
 | 
	
		
			
				|  |  |                  studentPaymentOrderService.update(waitPayOrder);
 | 
	
		
			
				|  |  | -                MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(studentRegistration.getUserId(), studentRegistration.getMusicGroupId());
 | 
	
		
			
				|  |  |                  musicGroupStudentFee.setLatestPaidTime(nowDate);
 | 
	
		
			
				|  |  |                  musicGroupStudentFee.setPaymentStatus(MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED);
 | 
	
		
			
				|  |  |                  musicGroupStudentFee.setTemporaryCourseFee(BigDecimal.ZERO);
 | 
	
		
			
				|  |  | -                /*if (musicGroup.getFeeType() != null && musicGroup.getFeeType() != MusicGroupPaymentCalender.FeeType.OFFLINE) {
 | 
	
		
			
				|  |  | -                    musicGroupStudentFee.setRemainNetworkClassTimes(musicGroupStudentFee.getRemainNetworkClassTimes() + 1);
 | 
	
		
			
				|  |  | -                }*/
 | 
	
		
			
				|  |  |                  musicGroupStudentFee.setUpdateTime(nowDate);
 | 
	
		
			
				|  |  | -                musicGroupStudentFeeDao.update(musicGroupStudentFee);
 | 
	
		
			
				|  |  |                  //添加学生
 | 
	
		
			
				|  |  |                  //classGroupStudentMapperService.addStudents(waitPayOrder.getClassGroupId(), studentRegistration.getUserId().toString(), GroupType.MUSIC);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            musicGroupStudentFeeDao.update(musicGroupStudentFee);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              //插入交易明细
 | 
	
		
			
				|  |  |              BigDecimal amount = studentPaymentOrder.getActualAmount();
 |