| 
					
				 | 
			
			
				@@ -533,6 +533,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new Exception("参数校验失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String musicGroupId = studentRegistration.getMusicGroupId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         StudentRegistration phoneAndMusicGroupId = studentRegistrationDao.getByPhoneAndMusicGroupId(musicGroupId, studentRegistration.getParentsPhone()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (phoneAndMusicGroupId != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new Exception("该学员已存在"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -594,14 +595,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     throw new Exception("班级不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //新增班级学生关系(单技班) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper(musicGroupId,userId,GroupType.MUSIC); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                classGroupStudentMapper.setClassGroupId(classGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                classGroupStudentMapperDao.insert(classGroupStudentMapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //新增班级学生关系(合奏班) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                ClassGroupRelation classGroupRelation = classGroupRelationDao.findClassGroupRelation(classGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                classGroupStudentMapper.setClassGroupId(classGroupRelation.getClassGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                classGroupStudentMapperDao.insert(classGroupStudentMapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //添加班级关联 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 addStudents(classGroup, userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Date date = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //获取当前月 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -652,14 +646,21 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     studentPaymentOrder.setPayTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 studentPaymentOrder.setExpectAmount(reduce); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                studentRegistrationDao.insertBasic(studentRegistration); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //当前学员是否以前存在过当前乐团 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                StudentRegistration registration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(registration != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    studentRegistration.setId(registration.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    studentRegistrationDao.update(studentRegistration); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    studentRegistrationDao.insertBasic(studentRegistration); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 studentPaymentOrderService.insert(studentPaymentOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 studentPaymentOrderDetails.forEach(e -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     e.setPaymentOrderId(studentPaymentOrder.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetails); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            studentRegistrationDao.updateCurrentClass(studentRegistration); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            studentRegistrationDao.updateCurrentClass(studentRegistration); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Map<Integer, String> receivers = new HashMap<>(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             receivers.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -672,43 +673,45 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void addStudents(ClassGroup classGroup, Integer userId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date nowDate = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //1、班级关系添加 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<ClassGroupStudentMapper> classGroupStudentMappers = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<ImGroupMember> imGroupMemberList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        List<ClassGroupStudentMapper> classGroupStudentMappers = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        List<ImGroupMember> imGroupMemberList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Integer classGroupId = classGroup.getId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ClassGroupRelation classGroupRelation = classGroupRelationService.findClassGroupRelation(classGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //校验是否存在历史记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ClassGroupStudentMapper classGroupStudentMapper = classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (classGroupStudentMapper != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(classGroupStudentMapper != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            classGroupStudentMapper = new ClassGroupStudentMapper(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             classGroupStudentMapper.setClassGroupId(classGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            classGroupStudentMapper.setUserId(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            classGroupStudentMapper.setCreateTime(nowDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            classGroupStudentMapper.setGroupType(GroupType.MUSIC); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            classGroupStudentMappers.add(classGroupStudentMapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //班级在合奏班中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (classGroupRelation != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupStudentMapperDao.update(classGroupStudentMapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             classGroupStudentMapper = new ClassGroupStudentMapper(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            classGroupStudentMapper.setClassGroupId(classGroupRelation.getClassGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupStudentMapper.setClassGroupId(classGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             classGroupStudentMapper.setUserId(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             classGroupStudentMapper.setCreateTime(nowDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             classGroupStudentMapper.setGroupType(GroupType.MUSIC); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            classGroupStudentMappers.add(classGroupStudentMapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        imGroupMemberList.add(new ImGroupMember(userId.toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (classGroupStudentMappers.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMappers); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupStudentMapperDao.insert(classGroupStudentMapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ClassGroupStudentMapper classGroupStudentMapperMix = classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupRelation.getClassGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(classGroupStudentMapperMix != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupStudentMapperMix.setStatus(ClassGroupStudentStatusEnum.NORMAL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupStudentMapperMix.setClassGroupId(classGroupRelation.getClassGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupStudentMapperDao.update(classGroupStudentMapperMix); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupStudentMapperMix = new ClassGroupStudentMapper(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupStudentMapperMix.setMusicGroupId(classGroup.getMusicGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupStudentMapperMix.setClassGroupId(classGroupRelation.getClassGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupStudentMapperMix.setUserId(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupStudentMapperMix.setCreateTime(nowDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupStudentMapperMix.setStatus(ClassGroupStudentStatusEnum.NORMAL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupStudentMapperMix.setGroupType(GroupType.MUSIC); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            classGroupStudentMapperDao.insert(classGroupStudentMapperMix); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        imGroupMemberList.add(new ImGroupMember(userId.toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //添加进IM群组 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ImGroupMember[] imGroupMembers = imGroupMemberList.toArray(new ImGroupMember[imGroupMemberList.size()]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ImGroupMember[] imGroupMembers = {new ImGroupMember(userId.toString())}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //2、班级人数调整 
			 |