Browse Source

Merge remote-tracking branch 'origin/master'

Joburgess 5 years ago
parent
commit
380b040e7d

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -61,6 +61,8 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      */
     int batchDeleteCourseSchedules(@Param("courseScheduleIds") List<Long> courseScheduleIds);
 
+    int batchDeleteAllCourseSchedules(@Param("courseScheduleIds") List<Long> courseScheduleIds);
+
     /**
      * @param courseScheduleIds: 课程计划编号
      * @return java.util.List<java.lang.Long>

+ 27 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -625,21 +625,42 @@ 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.batchDeleteAllCourseSchedules(courseScheduleIds);
+		courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
+		courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseScheduleIds);
+		// 删除考勤
+		teacherAttendanceDao.batchDeleteByCourseSchedules(courseScheduleIds);
+		studentAttendanceDao.deleteByCourseSchedules(courseScheduleIds);
+
+		// 删除作业
+		courseHomeworkService.delHomwworkByCourseScheduleId(courseScheduleIds);
+
 		Date endDate = null;
 		Date startDate = 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();
 			startDate = practiceGroup.getCoursesStartDate();
 		}
 
 		// 批量加课
-		batchAddCourseSchedule(classGroupId, batchInsertCoursesDto.getCourseScheduleIdList().size(), batchInsertCoursesDto.getStartDate(), endDate,startDate,
+		batchAddCourseSchedule(classGroupId, batchInsertCoursesDto.getCourseScheduleIdList().size(), batchInsertCoursesDto.getStartDate(), endDate, startDate,
 				batchInsertCoursesDto.getTeachingArrangementList(), batchInsertCoursesDto.getTeachMode(), batchInsertCoursesDto.getType(),
 				batchInsertCoursesDto.getSchoolId(), batchInsertCoursesDto.getIsJumpHoliday());
 		return true;

+ 8 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -279,6 +279,14 @@
         </foreach>
     </delete>
 
+    <delete id="batchDeleteAllCourseSchedules">
+        DELETE FROM course_schedule
+        WHERE id_ IN
+        <foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
+            #{courseScheduleId}
+        </foreach>
+    </delete>
+
     <select id="filterNotStartCourseIdsWithIds" resultType="long">
         SELECT id_ FROM course_schedule
         WHERE

+ 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;