Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 years ago
parent
commit
56c341a835

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

@@ -4168,7 +4168,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		}
 
 		LocalDate courseStartDay = LocalDateTime.ofInstant(practiceGroup.getCoursesStartDate().toInstant(), DateUtil.zoneId).toLocalDate();
-		LocalDate currentExpiredDay = courseStartDay.plusMonths(practiceGroup.getBuyMonths());
+		LocalDate currentExpiredDay = courseStartDay.plusMonths(practiceGroup.getBuyMonths()).plusDays(-1);
 		Date courseExpiredDateTemp=Date.from(currentExpiredDay.atStartOfDay(DateUtil.zoneId).toInstant());
 		if(coursesExpireDate.before(courseExpiredDateTemp)){
 			throw new BizException("课程结束时间不得早于,{}", DateUtil.dateToString(courseExpiredDateTemp, "yyyy年MM月dd日"));

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentAttendanceServiceImpl.java

@@ -43,6 +43,8 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 	@Autowired
 	private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 	@Autowired
+	private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
+	@Autowired
 	private ClassGroupDao classGroupDao;
 	@Autowired
 	private ClassGroupStudentMapperDao classGroupStudentMapperDao;
@@ -231,6 +233,12 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 		if(Objects.isNull(courseSchedule)){
 			throw new BizException("课程不存在");
 		}
+
+		List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = courseScheduleTeacherSalaryDao.findByCourseSchedule(studentAttendanceInfo.getCourseScheduleId());
+		if(CollectionUtils.isEmpty(courseScheduleTeacherSalaries)&&Objects.nonNull(courseScheduleTeacherSalaries.get(0).getSettlementTime())){
+			throw new BizException("此课程已结算");
+		}
+
 		List<Integer> userIds = studentAttendances.stream().map(StudentAttendance::getUserId).collect(Collectors.toList());
 		studentAttendanceDao.deleteStudentAttendancesByCourseAndUsers(studentAttendanceInfo.getCourseScheduleId().longValue(),userIds);
 		for (StudentAttendance studentAttendance : studentAttendances) {

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -50,6 +50,8 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 	@Autowired
 	private SysMessageService sysMessageService;
 	@Autowired
+	private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
+	@Autowired
 	private ClassGroupDao classGroupDao;
 	@Autowired
 	private SubjectDao subjectDao;
@@ -484,6 +486,12 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 		if(Objects.isNull(courseSchedule)){
 			throw new BizException("课程不存在");
 		}
+
+		List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = courseScheduleTeacherSalaryDao.findByCourseSchedule(teacherAttendanceInfo.getCourseScheduleId());
+		if(!CollectionUtils.isEmpty(courseScheduleTeacherSalaries)&&Objects.nonNull(courseScheduleTeacherSalaries.get(0).getSettlementTime())){
+			throw new BizException("此课程已结算");
+		}
+
 		if(Objects.isNull(teacherAttendanceInfo.getTeacherId())||teacherAttendanceInfo.getTeacherId()<=0){
 			if(Objects.isNull(courseSchedule.getActualTeacherId())){
 				throw new BizException("请指定教师");