|
@@ -283,6 +283,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), sysUser.getAvatar()));
|
|
ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), sysUser.getAvatar()));
|
|
sysUser.setImToken(register.getToken());
|
|
sysUser.setImToken(register.getToken());
|
|
}
|
|
}
|
|
|
|
+ if(!sysUser.getUserType().equals(SysUserType.STUDENT)){
|
|
|
|
+ throw new BizException("您系统存在非学生的账户,不能注册学生");
|
|
|
|
+ }
|
|
sysUser.setUserType(SysUserType.STUDENT);
|
|
sysUser.setUserType(SysUserType.STUDENT);
|
|
sysUser.setOrganId(studentRegistration.getOrganId());
|
|
sysUser.setOrganId(studentRegistration.getOrganId());
|
|
sysUser.setRealName(studentRegistration.getParentsName());
|
|
sysUser.setRealName(studentRegistration.getParentsName());
|
|
@@ -533,6 +536,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
throw new Exception("参数校验失败");
|
|
throw new Exception("参数校验失败");
|
|
}
|
|
}
|
|
String musicGroupId = studentRegistration.getMusicGroupId();
|
|
String musicGroupId = studentRegistration.getMusicGroupId();
|
|
|
|
+
|
|
StudentRegistration phoneAndMusicGroupId = studentRegistrationDao.getByPhoneAndMusicGroupId(musicGroupId, studentRegistration.getParentsPhone());
|
|
StudentRegistration phoneAndMusicGroupId = studentRegistrationDao.getByPhoneAndMusicGroupId(musicGroupId, studentRegistration.getParentsPhone());
|
|
if (phoneAndMusicGroupId != null) {
|
|
if (phoneAndMusicGroupId != null) {
|
|
throw new Exception("该学员已存在");
|
|
throw new Exception("该学员已存在");
|
|
@@ -594,14 +598,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
} else {
|
|
} else {
|
|
throw new Exception("班级不存在");
|
|
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);
|
|
addStudents(classGroup, userId);
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
//获取当前月
|
|
//获取当前月
|
|
@@ -652,14 +649,21 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
studentPaymentOrder.setPayTime(date);
|
|
studentPaymentOrder.setPayTime(date);
|
|
}
|
|
}
|
|
studentPaymentOrder.setExpectAmount(reduce);
|
|
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);
|
|
studentPaymentOrderService.insert(studentPaymentOrder);
|
|
studentPaymentOrderDetails.forEach(e -> {
|
|
studentPaymentOrderDetails.forEach(e -> {
|
|
e.setPaymentOrderId(studentPaymentOrder.getId());
|
|
e.setPaymentOrderId(studentPaymentOrder.getId());
|
|
});
|
|
});
|
|
studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetails);
|
|
studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetails);
|
|
}
|
|
}
|
|
- studentRegistrationDao.updateCurrentClass(studentRegistration);
|
|
|
|
|
|
+// studentRegistrationDao.updateCurrentClass(studentRegistration);
|
|
Map<Integer, String> receivers = new HashMap<>(1);
|
|
Map<Integer, String> receivers = new HashMap<>(1);
|
|
receivers.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone());
|
|
receivers.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone());
|
|
String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId;
|
|
String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId;
|
|
@@ -672,43 +676,45 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
public void addStudents(ClassGroup classGroup, Integer userId) {
|
|
public void addStudents(ClassGroup classGroup, Integer userId) {
|
|
Date nowDate = new Date();
|
|
Date nowDate = new Date();
|
|
//1、班级关系添加
|
|
//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();
|
|
Integer classGroupId = classGroup.getId();
|
|
ClassGroupRelation classGroupRelation = classGroupRelationService.findClassGroupRelation(classGroupId);
|
|
ClassGroupRelation classGroupRelation = classGroupRelationService.findClassGroupRelation(classGroupId);
|
|
|
|
|
|
//校验是否存在历史记录
|
|
//校验是否存在历史记录
|
|
ClassGroupStudentMapper classGroupStudentMapper = classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupId);
|
|
ClassGroupStudentMapper classGroupStudentMapper = classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupId);
|
|
- if (classGroupStudentMapper != null) {
|
|
|
|
|
|
+ if(classGroupStudentMapper != null){
|
|
classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
- } else {
|
|
|
|
- classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
|
- classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
|
classGroupStudentMapper.setClassGroupId(classGroupId);
|
|
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 = new ClassGroupStudentMapper();
|
|
classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
- classGroupStudentMapper.setClassGroupId(classGroupRelation.getClassGroupId());
|
|
|
|
|
|
+ classGroupStudentMapper.setClassGroupId(classGroupId);
|
|
classGroupStudentMapper.setUserId(userId);
|
|
classGroupStudentMapper.setUserId(userId);
|
|
classGroupStudentMapper.setCreateTime(nowDate);
|
|
classGroupStudentMapper.setCreateTime(nowDate);
|
|
classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
classGroupStudentMapper.setGroupType(GroupType.MUSIC);
|
|
classGroupStudentMapper.setGroupType(GroupType.MUSIC);
|
|
- classGroupStudentMappers.add(classGroupStudentMapper);
|
|
|
|
|
|
+ classGroupStudentMapperDao.insert(classGroupStudentMapper);
|
|
}
|
|
}
|
|
- imGroupMemberList.add(new ImGroupMember(userId.toString()));
|
|
|
|
- if (classGroupStudentMappers.size() > 0) {
|
|
|
|
- classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMappers);
|
|
|
|
|
|
+ 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群组
|
|
//添加进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()));
|
|
imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
|
|
|
|
|
|
//2、班级人数调整
|
|
//2、班级人数调整
|