yonge 5 gadi atpakaļ
vecāks
revīzija
12de6effca

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

@@ -620,13 +620,34 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		String musicGroupId = courseScheduleList.get(0).getMusicGroupId();
 
 		// 批量删课
-		batchDeleteCourseSchedules(batchInsertCoursesDto.getCourseScheduleIdList());
-		
+		List<Long> courseScheduleIds = batchInsertCoursesDto.getCourseScheduleIdList();
+
+		// 学生已点名不能调整(请假可以调整)
+		for (Long courseScheduleId : courseScheduleIds) {
+			List<StudentAttendance> studentAttendanceList = studentAttendanceDao.findByCourseId(courseScheduleId);
+
+			for (StudentAttendance studentAttendance : studentAttendanceList) {
+				if (studentAttendance.getStatus() != null && studentAttendance.getStatus() != StudentAttendanceStatusEnum.LEAVE) {
+					throw new BizException("操作失败,存在已点名课程");
+				}
+			}
+		}
+
+		courseScheduleDao.batchDeleteCourseSchedules(courseScheduleIds);
+		courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
+		courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseScheduleIds);
+		// 删除考勤
+		teacherAttendanceDao.batchDeleteByCourseSchedules(courseScheduleIds);
+		studentAttendanceDao.deleteByCourseSchedules(courseScheduleIds);
+
+		// 删除作业
+		courseHomeworkService.delHomwworkByCourseScheduleId(courseScheduleIds);
+
 		Date endDate = null;
-		if(batchInsertCoursesDto.getType() == CourseScheduleType.PRACTICE){
+		if (batchInsertCoursesDto.getType() == CourseScheduleType.PRACTICE) {
 			PracticeGroup practiceGroup = practiceGroupDao.get(Long.parseLong(musicGroupId));
-			if(practiceGroup == null){
-				throw new BizException("找不到课程组[{}]信息",musicGroupId);
+			if (practiceGroup == null) {
+				throw new BizException("找不到课程组[{}]信息", musicGroupId);
 			}
 			endDate = practiceGroup.getCoursesExpireDate();
 		}

+ 3 - 3
mec-client-api/src/main/java/com/ym/mec/im/UserFeignService.java

@@ -1,12 +1,12 @@
 package com.ym.mec.im;
 
-import com.ym.mec.common.config.FeignConfiguration;
-import com.ym.mec.task.fallback.UserFeignServiceFallback;
 import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import com.ym.mec.common.config.FeignConfiguration;
+import com.ym.mec.im.fallback.UserFeignServiceFallback;
+
 @FeignClient(name = "web-server", contextId = "UserFeignService", configuration = FeignConfiguration.class, fallback = UserFeignServiceFallback.class)
 public interface UserFeignService {
 

+ 1 - 1
mec-client-api/src/main/java/com/ym/mec/task/fallback/UserFeignServiceFallback.java → mec-client-api/src/main/java/com/ym/mec/im/fallback/UserFeignServiceFallback.java

@@ -1,4 +1,4 @@
-package com.ym.mec.task.fallback;
+package com.ym.mec.im.fallback;
 
 import org.springframework.stereotype.Component;