|
@@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
@@ -1009,27 +1010,31 @@ 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)) {
|
|
|
-// result.put("status","STUDENT_COURSE_REPEAT");
|
|
|
-// return result;
|
|
|
- throw new BizException("您预约的时间端和您现有的课程冲突");
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ result.put("status","STUDENT_COURSE_REPEAT");
|
|
|
+ return result;
|
|
|
+// throw new BizException("您预约的时间端和您现有的课程冲突");
|
|
|
}
|
|
|
List<CourseSchedule> studentRepeatCourse2 = courseScheduleDao.findStudentCoursesWithIncludeDateRange(practiceGroup.getStudentId(), allCourseDates.get(1), DateUtil.addMinutes(allCourseDates.get(3), practiceCourseMinutes));
|
|
|
if (CollectionUtils.isEmpty(studentRepeatCourse2)) {
|
|
|
-// result.put("status","STUDENT_COURSE_REPEAT");
|
|
|
-// return result;
|
|
|
- throw new BizException("您预约的时间端和您现有的课程冲突");
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ result.put("status","STUDENT_COURSE_REPEAT");
|
|
|
+ return result;
|
|
|
+// throw new BizException("您预约的时间端和您现有的课程冲突");
|
|
|
}
|
|
|
List<CourseSchedule> studentRepeatCourse3 = courseScheduleDao.findStudentCoursesWithIncludeDateRange(practiceGroup.getStudentId(), allCourseDates.get(2), DateUtil.addMinutes(allCourseDates.get(3), practiceCourseMinutes));
|
|
|
if (CollectionUtils.isEmpty(studentRepeatCourse3)) {
|
|
|
-// result.put("status","STUDENT_COURSE_REPEAT");
|
|
|
-// return result;
|
|
|
- throw new BizException("您预约的时间端和您现有的课程冲突");
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ result.put("status","STUDENT_COURSE_REPEAT");
|
|
|
+ return result;
|
|
|
+// throw new BizException("您预约的时间端和您现有的课程冲突");
|
|
|
}
|
|
|
List<CourseSchedule> studentRepeatCourse4 = courseScheduleDao.findStudentCoursesWithIncludeDateRange(practiceGroup.getStudentId(), allCourseDates.get(3), DateUtil.addMinutes(allCourseDates.get(3), practiceCourseMinutes));
|
|
|
if (CollectionUtils.isEmpty(studentRepeatCourse4)) {
|
|
|
-// result.put("status","STUDENT_COURSE_REPEAT");
|
|
|
-// return result;
|
|
|
- throw new BizException("您预约的时间端和您现有的课程冲突");
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ result.put("status","STUDENT_COURSE_REPEAT");
|
|
|
+ return result;
|
|
|
+// throw new BizException("您预约的时间端和您现有的课程冲突");
|
|
|
}
|
|
|
|
|
|
//推送
|
|
@@ -1043,27 +1048,30 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
courseSchedules2 = new ArrayList<>();
|
|
|
}
|
|
|
courseSchedules1.addAll(courseSchedules2);
|
|
|
- String[] courseDates = new String[courseSchedules1.size()];
|
|
|
- String[] courseNames = new String[courseSchedules1.size()];
|
|
|
+ List<String> courseDates = new ArrayList<>();
|
|
|
+ List<String> courseNames = new ArrayList<>();
|
|
|
for (int i = 0; i < courseSchedules1.size(); i++) {
|
|
|
if (courseSchedules1.get(i).getGroupType().equals(GroupType.PRACTICE)) {
|
|
|
if (courseSchedules1.get(i).getMusicGroupId().equals(practiceGroup.getId().toString())) {
|
|
|
continue;
|
|
|
} else {
|
|
|
-// result.put("status","TEACHER_PRACTICE_REPEAT");
|
|
|
-// return result;
|
|
|
- throw new BizException("指派的老师存在课程冲突");
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ result.put("status","TEACHER_PRACTICE_REPEAT");
|
|
|
+ return result;
|
|
|
+// throw new BizException("指派的老师存在课程冲突");
|
|
|
}
|
|
|
}
|
|
|
- courseDates[i] = DateUtil.dateToString(courseSchedules1.get(i).getStartClassTime(), "yyyy-MM-dd HH:mm:ss");
|
|
|
- courseNames[i] = courseSchedules1.get(i).getName();
|
|
|
+ courseDates.add(DateUtil.dateToString(courseSchedules1.get(i).getStartClassTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
+ courseNames.add(courseSchedules1.get(i).getName());
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(courseDates)){
|
|
|
+ String courseDatesStr = StringUtils.join(courseDates, "、");
|
|
|
+ String courseNamesStr = StringUtils.join(courseNames, "、");
|
|
|
+ Map<Integer, String> teacherMap = new HashMap<>();
|
|
|
+ teacherMap.put(teacherId, teacherId.toString());
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.PUSH_TEACHER_COURSE_COLLIDE,
|
|
|
+ teacherMap, null, 0, null, "TEACHER", Objects.isNull(sysUser.getUsername()) ? sysUser.getPhone() : sysUser.getUsername(), courseDatesStr, courseNamesStr, courseNamesStr);
|
|
|
}
|
|
|
- String courseDatesStr = StringUtils.join(courseDates, "、");
|
|
|
- String courseNamesStr = StringUtils.join(courseNames, "、");
|
|
|
- Map<Integer, String> teacherMap = new HashMap<>();
|
|
|
- teacherMap.put(teacherId, teacherId.toString());
|
|
|
- sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.PUSH_TEACHER_COURSE_COLLIDE,
|
|
|
- teacherMap, null, 0, null, "TEACHER", Objects.isNull(sysUser.getUsername()) ? sysUser.getPhone() : sysUser.getUsername(), courseDatesStr, courseNamesStr, courseNamesStr);
|
|
|
}
|
|
|
|
|
|
List<ImGroupMember> imGroupMemberList = new ArrayList<>();
|