|  | @@ -53,7 +53,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
												
													
														|  |      private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
 |  |      private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
												
													
														|  | -    private SysMessageConfigDao sysMessageConfigDao;
 |  | 
 | 
											
												
													
														|  | 
 |  | +    private ClassGroupRelationDao classGroupRelationDao;
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
												
													
														|  |      private SysMessageService sysMessageService;
 |  |      private SysMessageService sysMessageService;
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
										
											
												
													
														|  | @@ -410,7 +410,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 | 
											
												
													
														|  |          if(studentRegistration == null){
 |  |          if(studentRegistration == null){
 | 
											
												
													
														|  |              throw new Exception("参数校验失败");
 |  |              throw new Exception("参数校验失败");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        StudentRegistration phoneAndMusicGroupId = studentRegistrationDao.getByPhoneAndMusicGroupId(studentRegistration.getMusicGroupId(), studentRegistration.getParentsPhone());
 |  | 
 | 
											
												
													
														|  | 
 |  | +        String musicGroupId = studentRegistration.getMusicGroupId();
 | 
											
												
													
														|  | 
 |  | +        StudentRegistration phoneAndMusicGroupId = studentRegistrationDao.getByPhoneAndMusicGroupId(musicGroupId, studentRegistration.getParentsPhone());
 | 
											
												
													
														|  |          if (phoneAndMusicGroupId != null) {
 |  |          if (phoneAndMusicGroupId != null) {
 | 
											
												
													
														|  |              throw new Exception("该学员已存在");
 |  |              throw new Exception("该学员已存在");
 | 
											
												
													
														|  |          } else {
 |  |          } else {
 | 
											
										
											
												
													
														|  | @@ -442,20 +443,21 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |              studentRegistration.setActualSubjectId(studentRegistration.getSubjectId());
 |  |              studentRegistration.setActualSubjectId(studentRegistration.getSubjectId());
 | 
											
												
													
														|  |              studentRegistration.setUserId(userId);
 |  |              studentRegistration.setUserId(userId);
 | 
											
												
													
														|  | -            studentRegistration.setPaymentStatus(PaymentStatusEnum.YES);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            studentRegistration.setPaymentStatus(PaymentStatusEnum.OPEN);
 | 
											
												
													
														|  |              studentRegistration.setMusicGroupStatus(ClassGroupStudentStatusEnum.NORMAL);
 |  |              studentRegistration.setMusicGroupStatus(ClassGroupStudentStatusEnum.NORMAL);
 | 
											
												
													
														|  |              //学生报名表
 |  |              //学生报名表
 | 
											
												
													
														|  |              studentRegistrationDao.insertBasic(studentRegistration);
 |  |              studentRegistrationDao.insertBasic(studentRegistration);
 | 
											
												
													
														|  | -            MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
 |  | 
 | 
											
												
													
														|  | 
 |  | +            MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
 | 
											
												
													
														|  |              Set<Integer> roleIds = new HashSet<>(1);
 |  |              Set<Integer> roleIds = new HashSet<>(1);
 | 
											
												
													
														|  |              roleIds.add(SysUserRole.OPERATION_EXECUTIVE);
 |  |              roleIds.add(SysUserRole.OPERATION_EXECUTIVE);
 | 
											
												
													
														|  |              sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds), MessageTypeEnum.BACKSTAGE_MUSIC_GROUP_ADD_STUDENT, "", musicGroup.getName(), studentRegistration.getName());
 |  |              sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds), MessageTypeEnum.BACKSTAGE_MUSIC_GROUP_ADD_STUDENT, "", musicGroup.getName(), studentRegistration.getName());
 | 
											
												
													
														|  |              //增加报名学生数
 |  |              //增加报名学生数
 | 
											
												
													
														|  | -//            musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(),1);
 |  | 
 | 
											
												
													
														|  | -            if (studentRegistration.getClassGroupId() != null) {
 |  | 
 | 
											
												
													
														|  | -                ClassGroup classGroup = classGroupDao.get(studentRegistration.getClassGroupId());
 |  | 
 | 
											
												
													
														|  | 
 |  | +            musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId, studentRegistration.getSubjectId(),1);
 | 
											
												
													
														|  | 
 |  | +            Integer classGroupId = studentRegistration.getClassGroupId();
 | 
											
												
													
														|  | 
 |  | +            if (classGroupId != null) {
 | 
											
												
													
														|  | 
 |  | +                ClassGroup classGroup = classGroupDao.get(classGroupId);
 | 
											
												
													
														|  |                  if (classGroup != null) {
 |  |                  if (classGroup != null) {
 | 
											
												
													
														|  | -                    if (!classGroup.getMusicGroupId().equals(studentRegistration.getMusicGroupId())) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    if (!classGroup.getMusicGroupId().equals(musicGroupId)) {
 | 
											
												
													
														|  |                          throw new Exception("班级录入错误");
 |  |                          throw new Exception("班级录入错误");
 | 
											
												
													
														|  |                      } else {
 |  |                      } else {
 | 
											
												
													
														|  |                          //修改实际学生人数
 |  |                          //修改实际学生人数
 | 
											
										
											
												
													
														|  | @@ -466,13 +468,16 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 | 
											
												
													
														|  |                  } else {
 |  |                  } else {
 | 
											
												
													
														|  |                      throw new Exception("班级不存在");
 |  |                      throw new Exception("班级不存在");
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  | -                //新增班级学生关系
 |  | 
 | 
											
												
													
														|  | -                classGroupStudentMapperDao.insert(new ClassGroupStudentMapper(studentRegistration.getClassGroupId(), userId));
 |  | 
 | 
											
												
													
														|  | 
 |  | +                //新增班级学生关系(单技班)
 | 
											
												
													
														|  | 
 |  | +                classGroupStudentMapperDao.insert(new ClassGroupStudentMapper(classGroupId, userId));
 | 
											
												
													
														|  | 
 |  | +                //新增班级学生关系(合奏班)
 | 
											
												
													
														|  | 
 |  | +                ClassGroupRelation classGroupRelation = classGroupRelationDao.findClassGroupRelation(classGroupId);
 | 
											
												
													
														|  | 
 |  | +                classGroupStudentMapperDao.insert(new ClassGroupStudentMapper(classGroupRelation.getClassGroupId(), userId));
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |                  //获取当前月
 |  |                  //获取当前月
 | 
											
												
													
														|  |                  Integer month = Integer.parseInt(DateUtil.getMonth(new Date()));
 |  |                  Integer month = Integer.parseInt(DateUtil.getMonth(new Date()));
 | 
											
												
													
														|  |                  //获取下次缴费月份
 |  |                  //获取下次缴费月份
 | 
											
												
													
														|  | -                List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.findByMusicGroupId(studentRegistration.getMusicGroupId());
 |  | 
 | 
											
												
													
														|  | 
 |  | +                List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
 | 
											
												
													
														|  |                  List<Integer> months = musicGroupPaymentCalenders.stream().map(e -> e.getPaymentMonth()).collect(Collectors.toList());
 |  |                  List<Integer> months = musicGroupPaymentCalenders.stream().map(e -> e.getPaymentMonth()).collect(Collectors.toList());
 | 
											
												
													
														|  |                  for (int i = 0; i < months.size(); i++) {
 |  |                  for (int i = 0; i < months.size(); i++) {
 | 
											
												
													
														|  |                      if (months.get(i).equals(month)) {
 |  |                      if (months.get(i).equals(month)) {
 | 
											
										
											
												
													
														|  | @@ -484,10 +489,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 | 
											
												
													
														|  |                  DateUtil.getFirstDayOfMonth(calendar.getTime());
 |  |                  DateUtil.getFirstDayOfMonth(calendar.getTime());
 | 
											
												
													
														|  |                  //保存乐团学生费用表
 |  |                  //保存乐团学生费用表
 | 
											
												
													
														|  |                  if(studentAddDto.getCourseFee() == null){
 |  |                  if(studentAddDto.getCourseFee() == null){
 | 
											
												
													
														|  | -                    MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(musicGroupId, studentRegistration.getActualSubjectId());
 | 
											
												
													
														|  |                      studentAddDto.setCourseFee(musicOneSubjectClassPlan.getFee());
 |  |                      studentAddDto.setCourseFee(musicOneSubjectClassPlan.getFee());
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  | -                musicGroupStudentFeeDao.insert(new MusicGroupStudentFee(studentRegistration.getMusicGroupId(),
 |  | 
 | 
											
												
													
														|  | 
 |  | +                musicGroupStudentFeeDao.insert(new MusicGroupStudentFee(musicGroupId,
 | 
											
												
													
														|  |                          userId, studentRegistration.getSubjectId(), studentAddDto.getCourseFee(),
 |  |                          userId, studentRegistration.getSubjectId(), studentAddDto.getCourseFee(),
 | 
											
												
													
														|  |                          DateUtil.getFirstDayOfMonth(calendar.getTime()), studentAddDto.getTemporaryCourseFee()));
 |  |                          DateUtil.getFirstDayOfMonth(calendar.getTime()), studentAddDto.getTemporaryCourseFee()));
 | 
											
												
													
														|  |                  //生成订单
 |  |                  //生成订单
 | 
											
										
											
												
													
														|  | @@ -495,8 +500,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 | 
											
												
													
														|  |                  studentPaymentOrder.setUserId(userId);
 |  |                  studentPaymentOrder.setUserId(userId);
 | 
											
												
													
														|  |                  studentPaymentOrder.setType(OrderTypeEnum.APPLY);
 |  |                  studentPaymentOrder.setType(OrderTypeEnum.APPLY);
 | 
											
												
													
														|  |                  studentPaymentOrder.setStatus(DealStatusEnum.ING);
 |  |                  studentPaymentOrder.setStatus(DealStatusEnum.ING);
 | 
											
												
													
														|  | -                studentPaymentOrder.setMusicGroupId(studentRegistration.getMusicGroupId());
 |  | 
 | 
											
												
													
														|  | -                studentPaymentOrder.setClassGroupId(studentRegistration.getClassGroupId());
 |  | 
 | 
											
												
													
														|  | 
 |  | +                studentPaymentOrder.setMusicGroupId(musicGroupId);
 | 
											
												
													
														|  | 
 |  | +                studentPaymentOrder.setClassGroupId(classGroupId);
 | 
											
												
													
														|  |                  studentPaymentOrderService.insert(studentPaymentOrder);
 |  |                  studentPaymentOrderService.insert(studentPaymentOrder);
 | 
											
												
													
														|  |                  //生成订单明细
 |  |                  //生成订单明细
 | 
											
												
													
														|  |                  List<StudentPaymentOrderDetail> studentPaymentOrderDetails = studentAddDto.getStudentPaymentOrderDetails();
 |  |                  List<StudentPaymentOrderDetail> studentPaymentOrderDetails = studentAddDto.getStudentPaymentOrderDetails();
 |