zouxuan 5 jaren geleden
bovenliggende
commit
7c39851add

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java

@@ -84,7 +84,7 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
 	 * @param isJumpHoliday 是否跳过节假日
 	 * @return
 	 */
-	boolean batchAddCourseSchedule(Integer classGroupId, int coursesTimes, Date startDate, Date endDate, List<CourseTimeDto> teachingArrangementList,
+	boolean batchAddCourseSchedule(Integer classGroupId, int coursesTimes, Date startDate, Date groupEndDate, Date groupStartDate, List<CourseTimeDto> teachingArrangementList,
 			TeachModeEnum teachMode, CourseScheduleType type, Integer schoolId, boolean isJumpHoliday);
 	
 	/**

+ 12 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -256,7 +256,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
     @Override
 	@Transactional(rollbackFor = Exception.class)
-	public boolean batchAddCourseSchedule(Integer classGroupId, int coursesTimes, Date startDate, Date endDate, List<CourseTimeDto> teachingArrangementList,
+	public boolean batchAddCourseSchedule(Integer classGroupId, int coursesTimes, Date startDate, Date groupEndDate, Date groupStartDate, List<CourseTimeDto> teachingArrangementList,
 			TeachModeEnum teachMode, CourseScheduleType type, Integer schoolId, boolean isJumpHoliday) {
 		ClassGroup classGroup = classGroupService.get(classGroupId);
 		if (classGroup == null) {
@@ -451,9 +451,14 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 					}
 					
 					// 判断课程时间是否超过排课结束时间
-					if (endDate != null) {
-						if (calendar.getTime().after(endDate)) {
-							throw new BizException("排课时间超出排课截止日期({})", endDate);
+					if(groupStartDate != null){
+						if(groupStartDate.after(calendar.getTime())){
+							throw new BizException("调整时间不得早于开课时间({})",groupStartDate);
+						}
+					}
+					if (groupEndDate != null) {
+						if (calendar.getTime().after(groupEndDate)) {
+							throw new BizException("排课时间超出排课截止日期({})", groupEndDate);
 						}
 					}
 					
@@ -623,16 +628,18 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		batchDeleteCourseSchedules(batchInsertCoursesDto.getCourseScheduleIdList());
 		
 		Date endDate = null;
+		Date startDate = null;
 		if(batchInsertCoursesDto.getType() == CourseScheduleType.PRACTICE){
 			PracticeGroup practiceGroup = practiceGroupDao.get(Long.parseLong(musicGroupId));
 			if(practiceGroup == null){
 				throw new BizException("找不到课程组[{}]信息",musicGroupId);
 			}
 			endDate = practiceGroup.getCoursesExpireDate();
+			startDate = practiceGroup.getCoursesStartDate();
 		}
 
 		// 批量加课
-		batchAddCourseSchedule(classGroupId, batchInsertCoursesDto.getCourseScheduleIdList().size(), batchInsertCoursesDto.getStartDate(), endDate,
+		batchAddCourseSchedule(classGroupId, batchInsertCoursesDto.getCourseScheduleIdList().size(), batchInsertCoursesDto.getStartDate(), endDate,startDate,
 				batchInsertCoursesDto.getTeachingArrangementList(), batchInsertCoursesDto.getTeachMode(), batchInsertCoursesDto.getType(),
 				batchInsertCoursesDto.getSchoolId(), batchInsertCoursesDto.getIsJumpHoliday());
 		return true;

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleController.java

@@ -313,7 +313,7 @@ public class CourseScheduleController extends BaseController {
     		batchInsertCoursesDto.setClassGroupId(classGroupList.get(0).getId());
     	}
 		scheduleService.batchAddCourseSchedule(batchInsertCoursesDto.getClassGroupId(), batchInsertCoursesDto.getCoursesTimes(),
-				batchInsertCoursesDto.getStartDate(), null, batchInsertCoursesDto.getTeachingArrangementList(), batchInsertCoursesDto.getTeachMode(),
+				batchInsertCoursesDto.getStartDate(), null,null, batchInsertCoursesDto.getTeachingArrangementList(), batchInsertCoursesDto.getTeachMode(),
 				batchInsertCoursesDto.getType(), batchInsertCoursesDto.getSchoolId(), batchInsertCoursesDto.getIsJumpHoliday());
         return succeed();
     }