| 
					
				 | 
			
			
				@@ -31,6 +31,8 @@ import java.util.stream.Stream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.dto.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.enums.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.service.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ym.mec.common.controller.BaseController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ym.mec.common.entity.HttpResponseResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.collections.ListUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.slf4j.Logger; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -38,9 +40,11 @@ import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.BeanUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.context.annotation.Lazy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.http.HttpStatus; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Propagation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.transaction.interceptor.TransactionAspectSupport; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.util.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSON; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3009,7 +3013,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void courseAdjust(List<CourseSchedule> newCourseSchedules) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public HttpResponseResult courseAdjust(List<CourseSchedule> newCourseSchedules, Boolean allowZeroSalary) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date date = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// 课程信息处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		List<Long> courseScheduleIds = newCourseSchedules.stream().map(CourseSchedule::getId).distinct().collect(Collectors.toList()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3391,6 +3395,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					if(ts.getExpectSalary() == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						throw new BizException("请设置老师的课酬"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					if(!allowZeroSalary&&BigDecimal.ZERO.compareTo(ts.getExpectSalary())==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"当前课程课酬预计为0,是否继续"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					insertCourseScheduleTeacherSalaryList.add(ts); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3441,6 +3449,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return BaseController.succeed(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4991,7 +5000,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	public void classGroupTeacherAdjust(String classGroupIds, Integer teacherId, Integer targetTeacherId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public HttpResponseResult classGroupTeacherAdjust(String classGroupIds, Integer teacherId, Integer targetTeacherId, Boolean allowZeroSalary) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		List<Integer> teachingTeacherIdList = new ArrayList<Integer>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		teachingTeacherIdList.add(targetTeacherId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		List<CourseSchedule> courseSchedules = this.queryNoStartCourseByTeacherId(classGroupIds,teacherId,"BISHOP"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -5001,7 +5010,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				e.setTeachingTeacherIdList(courseScheduleTeacherSalaryDao.queryTeacherByTeaching(e.getClassGroupId(),"TEACHING")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				e.setActualTeacherId(targetTeacherId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			this.courseAdjust(courseSchedules); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			HttpResponseResult httpResponseResult = this.courseAdjust(courseSchedules, allowZeroSalary); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(httpResponseResult.getCode()==HttpStatus.PARTIAL_CONTENT.value()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				return httpResponseResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			//修改老师考勤 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			Set<Integer> collect1 = courseSchedules.stream().map(e -> e.getClassGroupId()).collect(Collectors.toSet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //			teacherAttendanceDao.deleteByCourseAndTeacherId(collect1,teacherId); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -5013,11 +5025,15 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				e.setActualTeacherId(courseScheduleTeacherSalaryDao.queryTeacherByBishop(e.getClassGroupId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				e.setTeachingTeacherIdList(teachingTeacherIdList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			this.courseAdjust(courseSchedules1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			HttpResponseResult httpResponseResult = this.courseAdjust(courseSchedules1, allowZeroSalary); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(httpResponseResult.getCode()==HttpStatus.PARTIAL_CONTENT.value()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				return httpResponseResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			Set<Integer> collect1 = courseSchedules1.stream().map(e -> e.getClassGroupId()).collect(Collectors.toSet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ////			teacherAttendanceDao.deleteByCourseAndTeacherId(collect1,teacherId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			batchUpdateClassTeacher(new ArrayList<>(collect1),teacherId,targetTeacherId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return BaseController.succeed(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -5261,7 +5277,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	public void courseMerge(CourseMergeDto courseMergeInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public HttpResponseResult courseMerge(CourseMergeDto courseMergeInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Date now = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(CollectionUtils.isEmpty(courseMergeInfo.getMergeCourseIds())){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -5374,11 +5390,15 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(!CollectionUtils.isEmpty(newPayments)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			courseScheduleStudentPaymentDao.batchInsert(newPayments); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		courseAdjust(courseSchedules); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		HttpResponseResult httpResponseResult = courseAdjust(courseSchedules, courseMergeInfo.getAllowZeroSalary()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(httpResponseResult.getCode()==HttpStatus.PARTIAL_CONTENT.value()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			return httpResponseResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (insertCourseScheduleModifyLogList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			courseScheduleModifyLogDao.batchInsert(insertCourseScheduleModifyLogList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return BaseController.succeed(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 |