|  | @@ -5,6 +5,7 @@ import com.ym.mec.auth.api.entity.SysUserRole;
 | 
											
												
													
														|  |  import com.ym.mec.auth.api.enums.SysUserType;
 |  |  import com.ym.mec.auth.api.enums.SysUserType;
 | 
											
												
													
														|  |  import com.ym.mec.auth.api.enums.UserLockFlag;
 |  |  import com.ym.mec.auth.api.enums.UserLockFlag;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.dao.*;
 |  |  import com.ym.mec.biz.dal.dao.*;
 | 
											
												
													
														|  | 
 |  | +import com.ym.mec.biz.dal.dto.StudentAddDto;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
 |  |  import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.dto.StudentFeeDetailDto;
 |  |  import com.ym.mec.biz.dal.dto.StudentFeeDetailDto;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.dto.StudentInfo;
 |  |  import com.ym.mec.biz.dal.dto.StudentInfo;
 | 
											
										
											
												
													
														|  | @@ -404,7 +405,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      @Transactional(rollbackFor = Exception.class)
 |  |      @Transactional(rollbackFor = Exception.class)
 | 
											
												
													
														|  | -    public Integer insertStudent(StudentRegistration studentRegistration) throws Exception {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    public Integer insertStudent(StudentAddDto studentAddDto) throws Exception {
 | 
											
												
													
														|  | 
 |  | +        StudentRegistration studentRegistration = studentAddDto.getStudentRegistration();
 | 
											
												
													
														|  | 
 |  | +        if(studentRegistration == null){
 | 
											
												
													
														|  | 
 |  | +            throw new Exception("参数校验失败");
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  |          StudentRegistration phoneAndMusicGroupId = studentRegistrationDao.getByPhoneAndMusicGroupId(studentRegistration.getMusicGroupId(), studentRegistration.getParentsPhone());
 |  |          StudentRegistration phoneAndMusicGroupId = studentRegistrationDao.getByPhoneAndMusicGroupId(studentRegistration.getMusicGroupId(), studentRegistration.getParentsPhone());
 | 
											
												
													
														|  |          if (phoneAndMusicGroupId != null) {
 |  |          if (phoneAndMusicGroupId != null) {
 | 
											
												
													
														|  |              throw new Exception("该学员已存在");
 |  |              throw new Exception("该学员已存在");
 | 
											
										
											
												
													
														|  | @@ -463,7 +468,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |                  //新增班级学生关系
 |  |                  //新增班级学生关系
 | 
											
												
													
														|  |                  classGroupStudentMapperDao.insert(new ClassGroupStudentMapper(studentRegistration.getClassGroupId(), userId));
 |  |                  classGroupStudentMapperDao.insert(new ClassGroupStudentMapper(studentRegistration.getClassGroupId(), userId));
 | 
											
												
													
														|  | -                MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |                  //获取当前月
 |  |                  //获取当前月
 | 
											
												
													
														|  |                  Integer month = Integer.parseInt(DateUtil.getMonth(new Date()));
 |  |                  Integer month = Integer.parseInt(DateUtil.getMonth(new Date()));
 | 
											
												
													
														|  |                  //获取下次缴费月份
 |  |                  //获取下次缴费月份
 | 
											
										
											
												
													
														|  | @@ -478,9 +483,25 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 | 
											
												
													
														|  |                  calendar.add(Calendar.MONTH, month);
 |  |                  calendar.add(Calendar.MONTH, month);
 | 
											
												
													
														|  |                  DateUtil.getFirstDayOfMonth(calendar.getTime());
 |  |                  DateUtil.getFirstDayOfMonth(calendar.getTime());
 | 
											
												
													
														|  |                  //保存乐团学生费用表
 |  |                  //保存乐团学生费用表
 | 
											
												
													
														|  | 
 |  | +                if(studentAddDto.getCourseFee() == null){
 | 
											
												
													
														|  | 
 |  | +                    MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
 | 
											
												
													
														|  | 
 |  | +                    studentAddDto.setCourseFee(musicOneSubjectClassPlan.getFee());
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  |                  musicGroupStudentFeeDao.insert(new MusicGroupStudentFee(studentRegistration.getMusicGroupId(),
 |  |                  musicGroupStudentFeeDao.insert(new MusicGroupStudentFee(studentRegistration.getMusicGroupId(),
 | 
											
												
													
														|  | -                        userId, studentRegistration.getSubjectId(), musicOneSubjectClassPlan.getFee(),
 |  | 
 | 
											
												
													
														|  | -                        DateUtil.getFirstDayOfMonth(calendar.getTime()), 0, studentRegistration.getTemporaryCourseFee()));
 |  | 
 | 
											
												
													
														|  | 
 |  | +                        userId, studentRegistration.getSubjectId(), studentAddDto.getCourseFee(),
 | 
											
												
													
														|  | 
 |  | +                        DateUtil.getFirstDayOfMonth(calendar.getTime()), studentAddDto.getTemporaryCourseFee()));
 | 
											
												
													
														|  | 
 |  | +                //生成订单
 | 
											
												
													
														|  | 
 |  | +                StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
 | 
											
												
													
														|  | 
 |  | +                studentPaymentOrder.setUserId(userId);
 | 
											
												
													
														|  | 
 |  | +                studentPaymentOrder.setType(OrderTypeEnum.APPLY);
 | 
											
												
													
														|  | 
 |  | +                studentPaymentOrder.setStatus(DealStatusEnum.ING);
 | 
											
												
													
														|  | 
 |  | +                studentPaymentOrder.setMusicGroupId(studentRegistration.getMusicGroupId());
 | 
											
												
													
														|  | 
 |  | +                studentPaymentOrder.setClassGroupId(studentRegistration.getClassGroupId());
 | 
											
												
													
														|  | 
 |  | +                studentPaymentOrderService.insert(studentPaymentOrder);
 | 
											
												
													
														|  | 
 |  | +                //生成订单明细
 | 
											
												
													
														|  | 
 |  | +                List<StudentPaymentOrderDetail> studentPaymentOrderDetails = studentAddDto.getStudentPaymentOrderDetails();
 | 
											
												
													
														|  | 
 |  | +                studentPaymentOrderDetails.forEach(e->{e.setPaymentOrderId(studentPaymentOrder.getId());});
 | 
											
												
													
														|  | 
 |  | +                studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetails);
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |              return userId;
 |  |              return userId;
 | 
											
												
													
														|  |          }
 |  |          }
 |