|
@@ -258,16 +258,24 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
|
|
|
List<CourseSchedule> courseScheduleList = courseScheduleDao.findByCourseScheduleIds(courseScheduleIds);
|
|
|
|
|
|
+ List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = courseScheduleTeacherSalaryDao.findByCourseSchedules(courseScheduleIds);
|
|
|
+ Set<Long> settlementCourseIds = new HashSet<>();
|
|
|
+ if(!CollectionUtils.isEmpty(courseScheduleTeacherSalaries)){
|
|
|
+ settlementCourseIds = courseScheduleTeacherSalaries.stream().filter(c->Objects.nonNull(c.getSettlementTime())).map(CourseScheduleTeacherSalary::getCourseScheduleId).collect(Collectors.toSet());
|
|
|
+ }
|
|
|
+
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
Date date = new Date();
|
|
|
if (courseScheduleList != null) {
|
|
|
for (CourseSchedule cs : courseScheduleList) {
|
|
|
- if (cs.getStatus() != CourseStatusEnum.NOT_START) {
|
|
|
- throw new BizException("删除失败,未开始的课程才能删除");
|
|
|
+ if(settlementCourseIds.contains(cs.getId())){
|
|
|
+ throw new BizException("删除失败,已结算的课程不能删除");
|
|
|
+ }
|
|
|
+ if (CourseStatusEnum.UNDERWAY.equals(cs.getStatus())) {
|
|
|
+ throw new BizException("删除失败,进行中的课程不能删除");
|
|
|
}
|
|
|
- String endDateStr = DateUtil.format(cs.getClassDate(), "yyyy-MM-dd") + " " + DateUtil.format(cs.getStartClassTime(), "HH:mm:ss");
|
|
|
- if (DateUtil.stringToDate(endDateStr, sdf).before(date)) {
|
|
|
- throw new BizException("删除失败,未开始的课程才能删除");
|
|
|
+ if (Objects.nonNull(cs.getIsLock())&&cs.getIsLock()==1) {
|
|
|
+ throw new BizException("删除失败,被锁定的课程不能删除");
|
|
|
}
|
|
|
if(Objects.nonNull(cs.getNewCourseId())){
|
|
|
throw new BizException("删除失败,被合并课程不能删除");
|