|
@@ -156,14 +156,14 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
@Override
|
|
|
public Integer searchTeacherId(PracticeGroup practiceGroup) {
|
|
|
if (Objects.isNull(practiceGroup.getSubjectId())) {
|
|
|
- throw new BizException("请选择声部");
|
|
|
+ return null;
|
|
|
}
|
|
|
SysUser sysUser = sysUserFeignService.queryUserById(practiceGroup.getStudentId());
|
|
|
if (Objects.isNull(sysUser)) {
|
|
|
- throw new BizException("用户不存在");
|
|
|
+ return null;
|
|
|
}
|
|
|
if (Objects.isNull(sysUser.getOrganId())) {
|
|
|
- throw new BizException("未找到用户分部属性");
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
//如果是广州分部的,并且声部满足条件的需要特殊处理
|
|
@@ -178,7 +178,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
|
|
|
List<TeacherBasicDto> organAndSubjectTeachers = teacherDao.findTeaTeachersByOrganAndSubject(sysUser.getOrganId(), subjectSubjectsMap.get(practiceGroup.getSubjectId()));
|
|
|
if (CollectionUtils.isEmpty(organAndSubjectTeachers)) {
|
|
|
- throw new BizException("未找到合适教师");
|
|
|
+ return null;
|
|
|
}
|
|
|
SysConfig practiceCourseMinutesConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
|
|
|
Integer practiceCourseMinutes=practiceCourseMinutesConfig.getParanValue(Integer.class);
|
|
@@ -312,13 +312,13 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
}
|
|
|
}
|
|
|
if(CollectionUtils.isEmpty(firstTeacherIds)||CollectionUtils.isEmpty(secondTeacherIds)){
|
|
|
- throw new BizException("未找到符合条件的教师");
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
List<Integer> includeTeacherIds = firstTeacherIds.stream().filter(firstTeacherId -> secondTeacherIds.contains(firstTeacherId)).collect(Collectors.toList());
|
|
|
|
|
|
if(CollectionUtils.isEmpty(includeTeacherIds)){
|
|
|
- throw new BizException("未找到符合条件的教师");
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
List<CourseScheduleTeacherSalary> studentRelateTeachers = courseScheduleTeacherSalaryDao.findStudentRelateTeachers(practiceGroup.getStudentId(), includeTeacherIds);
|
|
@@ -781,9 +781,11 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Map practiceApply(PracticeGroup practiceGroup) {
|
|
|
+ Map result = new HashMap();
|
|
|
SysConfig practiceSubjectIdListConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_SUBJECT_ID_LIST);
|
|
|
if(!Arrays.asList(practiceSubjectIdListConfig.getParanValue().split(",")).contains(practiceGroup.getSubjectId().toString())){
|
|
|
- throw new BizException("此声部不可预约");
|
|
|
+ result.put("status","DISABLE_SUBJECT");
|
|
|
+ return result;
|
|
|
}
|
|
|
Integer practiceCourseMinutes = 25;
|
|
|
SysConfig practiceCourseMinutesConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
|
|
@@ -794,14 +796,17 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
Date now = new Date();
|
|
|
if (practiceGroup.getFirstCourseTime().before(activityStartDate)
|
|
|
||practiceGroup.getFirstCourseTime().after(activityEndDate)) {
|
|
|
- throw new BizException("预约时间超过范围");
|
|
|
+ result.put("status","APPLY_DATE_OVERFLOW");
|
|
|
+ return result;
|
|
|
}
|
|
|
if (practiceGroup.getSecondCourseTime().before(activityStartDate)
|
|
|
||practiceGroup.getSecondCourseTime().after(activityEndDate)) {
|
|
|
- throw new BizException("预约时间超过范围");
|
|
|
+ result.put("status","APPLY_DATE_OVERFLOW");
|
|
|
+ return result;
|
|
|
}
|
|
|
if(DateUtil.isSameDay(practiceGroup.getFirstCourseTime(),practiceGroup.getSecondCourseTime())){
|
|
|
- throw new BizException("两节课不可以在同一天");
|
|
|
+ result.put("status","TWO_DATE_ON_ONE_DAY");
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
List<Date> allCourseDates=new ArrayList<>();
|
|
@@ -824,7 +829,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
Integer applyTimes = practiceGroupDao.countUserPracticeApplyRecord(practiceGroup.getStudentId());
|
|
|
|
|
|
if (applyTimes >= 1) {
|
|
|
- throw new BizException("您的预约次数已经达到限制");
|
|
|
+ result.put("status","IS_APPLIED");
|
|
|
+ return result;
|
|
|
}
|
|
|
applyTimes += 1;
|
|
|
|
|
@@ -832,7 +838,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
practiceGroup.setCoursesExpireDate(DateUtil.addMinutes(allCourseDates.get(3),practiceCourseMinutes));
|
|
|
Integer teacherId = searchTeacherId(practiceGroup);
|
|
|
if (Objects.isNull(teacherId)) {
|
|
|
- throw new BizException("教师指派错误");
|
|
|
+ result.put("status","NO_TEACHER");
|
|
|
+ return result;
|
|
|
}
|
|
|
practiceGroup.setUserId(teacherId);
|
|
|
Teacher teacher = teacherService.getDetail(teacherId);
|
|
@@ -844,7 +851,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
}
|
|
|
Subject subject = subjectDao.get(practiceGroup.getSubjectId());
|
|
|
if (Objects.isNull(subject)) {
|
|
|
- throw new BizException("声部不存在");
|
|
|
+ result.put("status","DISABLE_SUBJECT");
|
|
|
+ return result;
|
|
|
}
|
|
|
SysUser sysUser = sysUserFeignService.queryUserById(practiceGroup.getStudentId());
|
|
|
practiceGroup.setName("陪练课•" + sysUser.getUsername());
|
|
@@ -984,19 +992,23 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
|
|
|
List<CourseSchedule> studentRepeatCourse1=courseScheduleDao.findStudentCoursesWithIncludeDateRange(practiceGroup.getStudentId(),allCourseDates.get(0),DateUtil.addMinutes(allCourseDates.get(2),practiceCourseMinutes));
|
|
|
if(CollectionUtils.isEmpty(studentRepeatCourse1)){
|
|
|
- throw new BizException("您在预约的时间段内有其他课程");
|
|
|
+ result.put("status","STUDENT_COURSE_REPEAT");
|
|
|
+ return result;
|
|
|
}
|
|
|
List<CourseSchedule> studentRepeatCourse2=courseScheduleDao.findStudentCoursesWithIncludeDateRange(practiceGroup.getStudentId(),allCourseDates.get(1),DateUtil.addMinutes(allCourseDates.get(3),practiceCourseMinutes));
|
|
|
if(CollectionUtils.isEmpty(studentRepeatCourse2)){
|
|
|
- throw new BizException("您在预约的时间段内有其他课程");
|
|
|
+ result.put("status","STUDENT_COURSE_REPEAT");
|
|
|
+ return result;
|
|
|
}
|
|
|
List<CourseSchedule> studentRepeatCourse3=courseScheduleDao.findStudentCoursesWithIncludeDateRange(practiceGroup.getStudentId(),allCourseDates.get(2),DateUtil.addMinutes(allCourseDates.get(3),practiceCourseMinutes));
|
|
|
if(CollectionUtils.isEmpty(studentRepeatCourse3)){
|
|
|
- throw new BizException("您在预约的时间段内有其他课程");
|
|
|
+ result.put("status","STUDENT_COURSE_REPEAT");
|
|
|
+ return result;
|
|
|
}
|
|
|
List<CourseSchedule> studentRepeatCourse4=courseScheduleDao.findStudentCoursesWithIncludeDateRange(practiceGroup.getStudentId(),allCourseDates.get(3),DateUtil.addMinutes(allCourseDates.get(3),practiceCourseMinutes));
|
|
|
if(CollectionUtils.isEmpty(studentRepeatCourse4)){
|
|
|
- throw new BizException("您在预约的时间段内有其他课程");
|
|
|
+ result.put("status","STUDENT_COURSE_REPEAT");
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
//推送
|
|
@@ -1017,7 +1029,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
if(courseSchedules1.get(i).getMusicGroupId().equals(practiceGroup.getId().toString())) {
|
|
|
continue;
|
|
|
}else{
|
|
|
- throw new BizException("指派的老师在预约的时间段内存在陪练课");
|
|
|
+ result.put("status","TEACHER_PRACTICE_REPEAT");
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|
|
|
courseDates[i]=DateUtil.dateToString(courseSchedules1.get(i).getStartClassTime(),"yyyy-MM-dd HH:mm:ss");
|
|
@@ -1038,9 +1051,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
// 创建群组
|
|
|
imFeignService.groupCreate(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
|
|
|
|
|
|
- Map result = new HashMap();
|
|
|
result.put("teacherName", teacher.getRealName());
|
|
|
result.put("enableApply", applyTimes < 1 ? 1 : 0);
|
|
|
+ result.put("status","SUCCESS");
|
|
|
return result;
|
|
|
}
|
|
|
|