|
@@ -317,9 +317,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
throw new BizException("请登录");
|
|
|
}
|
|
|
Date now = new Date();
|
|
|
+ SysConfig studentAttendanceAfterTimeConfig = sysConfigService.findByParamName(SysConfigService.ENABLE_STUDENT_ATTENDANCE_BEFOR_COURSE_START_TIME_RANGE_VIP);
|
|
|
Map<String, Object> result = new HashMap<>(3);
|
|
|
result.put("vipAppealDaysRange", sysConfigDao.findConfigValue(SysConfigService.VIP_APPEAL_DAYS_RANGE));
|
|
|
result.put("advanceLeaveHours", Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ADVANCE_LEAVE_HOURS)));
|
|
|
+ result.put("joinRoomBeforeTime",studentAttendanceAfterTimeConfig.getParanValue(Integer.class));
|
|
|
// List<Integer> quitClassGroupIds=classGroupStudentMapperDao.findClassGroupIdByUserAndCourseDateAndStatus(user.getId(),classDate, ClassGroupStudentStatusEnum.QUIT.getCode());
|
|
|
List<CourseScheduleDto> studentCourseSchedulesWithDate = courseScheduleDao.getStudentCourseSchedulesWithDate(classDate, user.getId().longValue(), null);
|
|
|
List<Long> courseScheduleIds = studentCourseSchedulesWithDate.stream()
|
|
@@ -410,6 +412,16 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
if (Objects.nonNull(studentNumCourseMaps)) {
|
|
|
studentNumCourseMap = MapUtil.convertIntegerMap(studentNumCourseMaps);
|
|
|
}
|
|
|
+
|
|
|
+ if(CollectionUtils.isEmpty(teacherCourseSchedulesWithDate)){
|
|
|
+ return teacherCourseSchedulesWithDate;
|
|
|
+ }
|
|
|
+
|
|
|
+ SysConfig advanceLeaveHoursConfig = sysConfigService.findByParamName(SysConfigService.ADVANCE_LEAVE_HOURS);
|
|
|
+ Integer advanceLeaveHours=advanceLeaveHoursConfig.getParanValue(Integer.class);
|
|
|
+ List<Map<Long, Integer>> courseLeaveStudentNumMaps = studentAttendanceDao.countCourseLeaveStudentNumWithFourHoursAgo(allCourseScheduleIds, advanceLeaveHours);
|
|
|
+ Map<Long,Long> courseLeaveStudentNumMap = MapUtil.convertIntegerMap((courseLeaveStudentNumMaps));
|
|
|
+
|
|
|
for (CourseScheduleDto courseScheduleDto : teacherCourseSchedulesWithDate) {
|
|
|
Long studentNum = studentNumCourseMap.get(courseScheduleDto.getId());
|
|
|
if (Objects.nonNull(studentNum)) {
|
|
@@ -426,10 +438,14 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
courseScheduleDto.setStatus(CourseStatusEnum.UNDERWAY);
|
|
|
}
|
|
|
if (Objects.nonNull(courseScheduleDto.getClassGroupId())) {
|
|
|
- String[] studentNums = classGroupStudentMapperDao.findCourseStudentName(courseScheduleDto.getId().intValue());
|
|
|
- courseScheduleDto.setStudentNames(org.apache.commons.lang3.StringUtils.join(studentNums, ","));
|
|
|
+ String[] studentNames = classGroupStudentMapperDao.findCourseStudentName(courseScheduleDto.getId().intValue());
|
|
|
+ courseScheduleDto.setStudentNames(org.apache.commons.lang3.StringUtils.join(studentNames, ","));
|
|
|
}
|
|
|
courseScheduleDto.setSubjectName(subjectNameCourseMap.get(courseScheduleDto.getId()));
|
|
|
+ Long leaveStudentNum = courseLeaveStudentNumMap.get(courseScheduleDto.getId());
|
|
|
+ if(Objects.nonNull(leaveStudentNum)&&leaveStudentNum.intValue()==courseScheduleDto.getExpectStudentNum()){
|
|
|
+ courseScheduleDto.setEnableAdjustInToday(1);
|
|
|
+ }
|
|
|
}
|
|
|
return teacherCourseSchedulesWithDate;
|
|
|
}
|
|
@@ -776,6 +792,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
throw new BizException(courseCheckInfo(newCourseSchedule, existCourseSchedule, existCourseScheduleIds, 1));
|
|
|
}
|
|
|
|
|
|
+ if (!existCourseSchedule.getGroupType().equals(newCourseSchedule.getGroupType()) || !existCourseSchedule.getMusicGroupId().equals(newCourseSchedule.getMusicGroupId())) {
|
|
|
+ throw new BizException(courseCheckInfo(newCourseSchedule, existCourseSchedule, existCourseScheduleIds, 1));
|
|
|
+ }
|
|
|
+
|
|
|
if (isTeacherRepeat) {
|
|
|
courseScheduleIds.add(existCourseSchedule.getId());
|
|
|
}
|
|
@@ -1102,6 +1122,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
checkNewCourseSchedules(courseSchedules, false);
|
|
|
courseScheduleDao.batchUpdate(courseSchedules);
|
|
|
classGroupService.updateClassGroupInfo(classGroup.getId());
|
|
|
+ courseScheduleStudentPaymentService.updateVipGiveCourse(vipGroup.getId());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1316,7 +1337,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
}
|
|
|
int num = studentAttendanceDao.countStudentAttendenceNum(oldCourseSchedule.getId().intValue());
|
|
|
if (num > 0) {
|
|
|
- throw new BizException("{}[{}]{}-{}课程已点名",
|
|
|
+ throw new BizException("{}[{}] {}-{}课程已点名",
|
|
|
oldCourseSchedule.getName(),
|
|
|
oldCourseSchedule.getId(),
|
|
|
DateUtil.dateToString(oldCourseSchedule.getStartClassTime(),
|
|
@@ -1338,6 +1359,15 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
if (Objects.isNull(newCourseSchedule.getTeachMode())) {
|
|
|
newCourseSchedule.setTeachMode(oldCourseSchedule.getTeachMode());
|
|
|
}
|
|
|
+ if(Objects.isNull(newCourseSchedule.getClassDate())){
|
|
|
+ newCourseSchedule.setClassDate(oldCourseSchedule.getClassDate());
|
|
|
+ }
|
|
|
+ if(Objects.isNull(newCourseSchedule.getStartClassTime())){
|
|
|
+ newCourseSchedule.setStartClassTime(oldCourseSchedule.getStartClassTime());
|
|
|
+ }
|
|
|
+ if(Objects.isNull(newCourseSchedule.getEndClassTime())){
|
|
|
+ newCourseSchedule.setEndClassTime(oldCourseSchedule.getEndClassTime());
|
|
|
+ }
|
|
|
if (newCourseSchedule.getStartClassTime().after(now)) {
|
|
|
newCourseSchedule.setStatus(CourseStatusEnum.NOT_START);
|
|
|
}
|
|
@@ -1383,20 +1413,39 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
|
|
|
Map<Long, CourseSchedule> oldCourseSchedules = new HashMap<>();
|
|
|
|
|
|
+ List<Integer> classGroupIds = oldCourseScheduleList.stream().map(CourseSchedule::getClassGroupId).collect(Collectors.toList());
|
|
|
+ List<ClassGroup> classGroups = classGroupDao.findByClassGroupIds(classGroupIds);
|
|
|
+ Map<Integer, ClassGroup> idClassGroupMap = classGroups.stream().collect(Collectors.toMap(ClassGroup::getId, classGroup -> classGroup));
|
|
|
+
|
|
|
+ SysConfig advanceLeaveHoursConfig = sysConfigService.findByParamName(SysConfigService.ADVANCE_LEAVE_HOURS);
|
|
|
+ Integer advanceLeaveHours=advanceLeaveHoursConfig.getParanValue(Integer.class);
|
|
|
+ List<Map<Long, Integer>> courseLeaveStudentNumMaps = studentAttendanceDao.countCourseLeaveStudentNumWithFourHoursAgo(newCourseScheduleIds, advanceLeaveHours);
|
|
|
+ Map<Long,Long> courseLeaveStudentNumMap = MapUtil.convertIntegerMap((courseLeaveStudentNumMaps));
|
|
|
+
|
|
|
newCourseSchedules.forEach(newCourseSchedule -> {
|
|
|
- if (!sysUser.getUserType().contains("SYSTEM") && newCourseSchedule.getStartClassTime().before(tomorrow) && sysUser.getUserType().contains("TEACHER")) {
|
|
|
- throw new BizException("调整时间必须为明天及以后");
|
|
|
- }
|
|
|
|
|
|
CourseSchedule oldCourseSchedule = oldCourseScheduleMap.get(newCourseSchedule.getId()).get(0);
|
|
|
|
|
|
+ if (!sysUser.getUserType().contains("SYSTEM") && sysUser.getUserType().contains("TEACHER")) {
|
|
|
+ Long courseLeaveStudentNum = courseLeaveStudentNumMap.get(newCourseSchedule.getId());
|
|
|
+ ClassGroup classGroup=idClassGroupMap.get(oldCourseSchedule.getClassGroupId());
|
|
|
+ if(oldCourseSchedule.getGroupType().equals(GroupType.VIP)
|
|
|
+ &&Objects.nonNull(courseLeaveStudentNum)
|
|
|
+ &&courseLeaveStudentNum.intValue()==classGroup.getExpectStudentNum()){
|
|
|
+ if(!DateUtil.isSameDay(now,oldCourseSchedule.getStartClassTime())&&now.after(oldCourseSchedule.getStartClassTime())){
|
|
|
+ throw new BizException("当前时间不可对相关课程进行调整");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(DateUtil.addHours(now,advanceLeaveHours).after(oldCourseSchedule.getStartClassTime())){
|
|
|
+ throw new BizException("请在课程开始前{}小时进行调整",advanceLeaveHours);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
oldCourseSchedules.put(newCourseSchedule.getId(), oldCourseSchedule);
|
|
|
|
|
|
if (newCourseSchedule.getStartClassTime().after(now)){
|
|
|
teacherAttendanceDao.cleanCourseTeacherSignInfo(newCourseSchedule.getId());
|
|
|
- }
|
|
|
-
|
|
|
- if (oldCourseSchedule.getEndClassTime().before(now)&&newCourseSchedule.getStartClassTime().after(now)){
|
|
|
needCreateStudentPaymentCourses.add(oldCourseSchedule);
|
|
|
}
|
|
|
|
|
@@ -1539,7 +1588,14 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
if (!CollectionUtils.isEmpty(needCreateCourseScheduleTeacherSalaryCourse)) {
|
|
|
classGroupTeacherMapperService.createCourseScheduleTeacherSalary(needCreateCourseScheduleTeacherSalaryCourse, oldCourseSchedules);
|
|
|
}
|
|
|
- courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentByCourseSchedules(needCreateStudentPaymentCourses);
|
|
|
+ if(!CollectionUtils.isEmpty(needCreateStudentPaymentCourses)){
|
|
|
+ courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentByCourseSchedules(needCreateStudentPaymentCourses);
|
|
|
+ studentAttendanceDao.deleteByCourseSchedules(needCreateStudentPaymentCourses.stream().map(CourseSchedule::getId).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(oldCourseScheduleList.get(0).getGroupType().equals(GroupType.VIP)){
|
|
|
+ courseScheduleStudentPaymentService.updateVipGiveCourse(Long.valueOf(oldCourseScheduleList.get(0).getMusicGroupId()));
|
|
|
+ }
|
|
|
|
|
|
try {
|
|
|
//推送课时调整
|
|
@@ -1561,6 +1617,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+
|
|
|
// Set<Integer> roleIds = new HashSet<>(1);
|
|
|
// roleIds.add(SysUserRole.SECTION_MANAGER);
|
|
|
// classGroupDao.get();
|
|
@@ -1581,51 +1638,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
throw new BizException("未找到对应课程");
|
|
|
}
|
|
|
|
|
|
- //获取两个课程的主教、助教
|
|
|
- List<Long> courseScheduleIds = new ArrayList<>();
|
|
|
- courseScheduleIds.add(courseScheduleId1);
|
|
|
- courseScheduleIds.add(courseScheduleId2);
|
|
|
- List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = courseScheduleTeacherSalaryDao.findByCourseSchedules(courseScheduleIds);
|
|
|
- Map<Long, List<CourseScheduleTeacherSalary>> courseScheduleTeacherSalaryByCourse = courseScheduleTeacherSalaries.stream()
|
|
|
- .collect(Collectors.groupingBy(CourseScheduleTeacherSalary::getCourseScheduleId));
|
|
|
- //课程1的主教、助教
|
|
|
- List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries1 = courseScheduleTeacherSalaryByCourse.get(courseScheduleId1);
|
|
|
- //课程2的主教、助教
|
|
|
- List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries2 = courseScheduleTeacherSalaryByCourse.get(courseScheduleId2);
|
|
|
-
|
|
|
- Map<TeachTypeEnum, List<CourseScheduleTeacherSalary>> ct1 = courseScheduleTeacherSalaries1.stream()
|
|
|
- .collect(Collectors.groupingBy(CourseScheduleTeacherSalary::getTeacherRole));
|
|
|
-
|
|
|
- Map<TeachTypeEnum, List<CourseScheduleTeacherSalary>> ct2 = courseScheduleTeacherSalaries2.stream()
|
|
|
- .collect(Collectors.groupingBy(CourseScheduleTeacherSalary::getTeacherRole));
|
|
|
-
|
|
|
- //交换两节课的主教、助教
|
|
|
- if (Objects.nonNull(ct1.get(TeachTypeEnum.BISHOP))) {
|
|
|
- courseSchedule1.setActualTeacherId(ct1.get(TeachTypeEnum.BISHOP).get(0).getUserId());
|
|
|
- } else {
|
|
|
- courseSchedule1.setActualTeacherId(null);
|
|
|
- }
|
|
|
- if (Objects.nonNull(ct2.get(TeachTypeEnum.BISHOP))) {
|
|
|
- courseSchedule2.setActualTeacherId(ct2.get(TeachTypeEnum.BISHOP).get(0).getUserId());
|
|
|
- } else {
|
|
|
- courseSchedule2.setActualTeacherId(null);
|
|
|
- }
|
|
|
- List<CourseScheduleTeacherSalary> ct1t = ct1.get(TeachTypeEnum.TEACHING);
|
|
|
- if (CollectionUtils.isEmpty(ct1t)) {
|
|
|
- courseSchedule1.setTeachingTeacherIdList(null);
|
|
|
- } else {
|
|
|
- List<Integer> collect = ct1t.stream().map(CourseScheduleTeacherSalary::getUserId).collect(Collectors.toList());
|
|
|
- collect.stream().distinct();
|
|
|
- courseSchedule1.setTeachingTeacherIdList(collect);
|
|
|
- }
|
|
|
- List<CourseScheduleTeacherSalary> ct2t = ct2.get(TeachTypeEnum.TEACHING);
|
|
|
- if (CollectionUtils.isEmpty(ct2t)) {
|
|
|
- courseSchedule2.setTeachingTeacherIdList(null);
|
|
|
- } else {
|
|
|
- List<Integer> collect = ct2t.stream().map(CourseScheduleTeacherSalary::getUserId).collect(Collectors.toList());
|
|
|
- collect.stream().distinct();
|
|
|
- courseSchedule2.setTeachingTeacherIdList(collect);
|
|
|
- }
|
|
|
courseSchedule1.setId(courseScheduleId2);
|
|
|
courseSchedule2.setId(courseScheduleId1);
|
|
|
List<CourseSchedule> courseSchedules = new ArrayList<>();
|
|
@@ -1856,27 +1868,27 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
classGroupService.batchIncreaseClassTimes(classGroupIds);
|
|
|
|
|
|
//查询班级信息
|
|
|
- List<ClassGroup> classGroupList = classGroupService.findClassGroupByIds(classGroupIds.stream().map(e -> e.toString()).collect(Collectors.joining(",")));
|
|
|
-
|
|
|
- List<String> vipGroupIdList = new ArrayList<String>();
|
|
|
- for (ClassGroup classGroup : classGroupList) {
|
|
|
- if (classGroup.getGroupType() == GroupType.VIP && classGroup.getCurrentClassTimes() == classGroup.getTotalClassTimes().intValue()) {
|
|
|
- if (!vipGroupIdList.contains(classGroup.getMusicGroupId())) {
|
|
|
- vipGroupIdList.add(classGroup.getMusicGroupId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (vipGroupIdList.size() > 0) {
|
|
|
- List<VipGroup> vipGroupList = vipGroupDao.queryByIds(vipGroupIdList.stream().collect(Collectors.joining(",")));
|
|
|
- for (VipGroup vipGroup : vipGroupList) {
|
|
|
- if (!vipGroup.getStatus().equals(VipGroupStatusEnum.PAUSE)
|
|
|
- && !vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)) {
|
|
|
- vipGroup.setStatus(VipGroupStatusEnum.FINISHED);
|
|
|
- }
|
|
|
- vipGroup.setUpdateTime(date);
|
|
|
- }
|
|
|
- vipGroupDao.batchUpdate(vipGroupList);
|
|
|
- }
|
|
|
+// List<ClassGroup> classGroupList = classGroupService.findClassGroupByIds(classGroupIds.stream().map(e -> e.toString()).collect(Collectors.joining(",")));
|
|
|
+//
|
|
|
+// List<String> vipGroupIdList = new ArrayList<String>();
|
|
|
+// for (ClassGroup classGroup : classGroupList) {
|
|
|
+// if (classGroup.getGroupType() == GroupType.VIP && classGroup.getCurrentClassTimes() == classGroup.getTotalClassTimes().intValue()) {
|
|
|
+// if (!vipGroupIdList.contains(classGroup.getMusicGroupId())) {
|
|
|
+// vipGroupIdList.add(classGroup.getMusicGroupId());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (vipGroupIdList.size() > 0) {
|
|
|
+// List<VipGroup> vipGroupList = vipGroupDao.queryByIds(vipGroupIdList.stream().collect(Collectors.joining(",")));
|
|
|
+// for (VipGroup vipGroup : vipGroupList) {
|
|
|
+// if (!vipGroup.getStatus().equals(VipGroupStatusEnum.PAUSE)
|
|
|
+// && !vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)) {
|
|
|
+// vipGroup.setStatus(VipGroupStatusEnum.FINISHED);
|
|
|
+// }
|
|
|
+// vipGroup.setUpdateTime(date);
|
|
|
+// }
|
|
|
+// vipGroupDao.batchUpdate(vipGroupList);
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
if (courseScheduleIdList.size() > 0) {
|