|
@@ -15,6 +15,8 @@ import com.ym.mec.biz.dal.enums.*;
|
|
import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
|
|
import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
|
|
import com.ym.mec.biz.service.*;
|
|
import com.ym.mec.biz.service.*;
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
|
+import com.ym.mec.common.entity.ImGroupMember;
|
|
|
|
+import com.ym.mec.common.entity.ImGroupModel;
|
|
import com.ym.mec.common.entity.ImResult;
|
|
import com.ym.mec.common.entity.ImResult;
|
|
import com.ym.mec.common.entity.ImUserModel;
|
|
import com.ym.mec.common.entity.ImUserModel;
|
|
import com.ym.mec.common.exception.BizException;
|
|
import com.ym.mec.common.exception.BizException;
|
|
@@ -48,9 +50,15 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
@Autowired
|
|
@Autowired
|
|
private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
|
|
private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ClassGroupRelationService classGroupRelationService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private CourseScheduleService courseScheduleService;
|
|
|
|
+ @Autowired
|
|
private TeacherDao teacherDao;
|
|
private TeacherDao teacherDao;
|
|
@Autowired
|
|
@Autowired
|
|
- private ClassGroupDao classGroupDao;
|
|
|
|
|
|
+ private ClassGroupService classGroupDao;
|
|
@Autowired
|
|
@Autowired
|
|
private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
|
|
private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -411,6 +419,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public StudentRegistration queryByUserIdAndMusicGroupId(Integer userId, String musicGroupId) {
|
|
public StudentRegistration queryByUserIdAndMusicGroupId(Integer userId, String musicGroupId) {
|
|
StudentRegistration registration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
StudentRegistration registration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
SysUserCashAccount account = sysUserCashAccountDao.getLocked(userId);
|
|
SysUserCashAccount account = sysUserCashAccountDao.getLocked(userId);
|
|
@@ -502,7 +511,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
// ClassGroupRelation classGroupRelation = classGroupRelationDao.findClassGroupRelation(classGroupId);
|
|
// ClassGroupRelation classGroupRelation = classGroupRelationDao.findClassGroupRelation(classGroupId);
|
|
// classGroupStudentMapper.setClassGroupId(classGroupRelation.getClassGroupId());
|
|
// classGroupStudentMapper.setClassGroupId(classGroupRelation.getClassGroupId());
|
|
// classGroupStudentMapperDao.insert(classGroupStudentMapper);
|
|
// classGroupStudentMapperDao.insert(classGroupStudentMapper);
|
|
- classGroupStudentMapperDao.addStudents(classGroupId,userId.toString(),GroupType.MUSIC);
|
|
|
|
|
|
+ addStudents(classGroup,userId);
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
//获取当前月
|
|
//获取当前月
|
|
Integer month = Integer.parseInt(DateUtil.getMonth(date));
|
|
Integer month = Integer.parseInt(DateUtil.getMonth(date));
|
|
@@ -568,6 +577,87 @@ 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<>();
|
|
|
|
+ Integer classGroupId = classGroup.getId();
|
|
|
|
+ ClassGroupRelation classGroupRelation = classGroupRelationService.findClassGroupRelation(classGroupId);
|
|
|
|
+
|
|
|
|
+ //校验是否存在历史记录
|
|
|
|
+ ClassGroupStudentMapper classGroupStudentMapper = classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupId);
|
|
|
|
+ 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) {
|
|
|
|
+ classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
|
+ classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
|
+ classGroupStudentMapper.setClassGroupId(classGroupRelation.getClassGroupId());
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //添加进IM群组
|
|
|
|
+ ImGroupMember[] imGroupMembers = imGroupMemberList.toArray(new ImGroupMember[imGroupMemberList.size()]);
|
|
|
|
+ imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
|
|
|
|
+
|
|
|
|
+ //2、班级人数调整
|
|
|
|
+ classGroupDao.updateClassStudentNum(classGroupId.longValue(), 1);
|
|
|
|
+
|
|
|
|
+ //3、学生加入新班级未开始课程
|
|
|
|
+ List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupId);
|
|
|
|
+
|
|
|
|
+ //4、班级在合奏班、添加合奏课程
|
|
|
|
+ if (classGroupRelation != null) {
|
|
|
|
+ //合奏班增加人数
|
|
|
|
+ classGroupDao.updateClassStudentNum(classGroupRelation.getClassGroupId().longValue(), 1);
|
|
|
|
+ List<CourseSchedule> mixCourseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupRelation.getClassGroupId());
|
|
|
|
+ courseScheduleList.addAll(mixCourseScheduleList);
|
|
|
|
+
|
|
|
|
+ //添加进合奏班IM群组
|
|
|
|
+ imFeignService.groupJoin(new ImGroupModel(classGroupRelation.getClassGroupId().toString(), imGroupMembers, null));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BigDecimal coursePrice = new BigDecimal("0");
|
|
|
|
+
|
|
|
|
+ List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
|
|
|
|
+ for (CourseSchedule courseSchedule : courseScheduleList) {
|
|
|
|
+ CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
|
|
|
|
+ courseScheduleStudentPayment.setGroupType(classGroup.getGroupType());
|
|
|
|
+ courseScheduleStudentPayment.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
|
+ courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
|
|
|
|
+ courseScheduleStudentPayment.setUserId(userId);
|
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(coursePrice);
|
|
|
|
+ courseScheduleStudentPayment.setClassGroupId(classGroupId);
|
|
|
|
+ courseScheduleStudentPayment.setCreateTime(nowDate);
|
|
|
|
+ courseScheduleStudentPayment.setUpdateTime(nowDate);
|
|
|
|
+ courseScheduleStudentPayments.add(courseScheduleStudentPayment);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (courseScheduleStudentPayments.size() == 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ courseScheduleStudentPaymentService.batchInsert(courseScheduleStudentPayments);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<StudentRegistration> findClassGroupStu(String musicGroupId, Integer classGroupId) {
|
|
public List<StudentRegistration> findClassGroupStu(String musicGroupId, Integer classGroupId) {
|
|
//获取所有声部
|
|
//获取所有声部
|