|
@@ -32,6 +32,7 @@ import com.ym.mec.common.tenant.TenantContextHolder;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateConvertor;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -40,8 +41,6 @@ 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 java.math.BigDecimal;
|
|
|
import java.time.*;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
@@ -2138,7 +2137,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
for (ClassGroup4MixDto classGroup4MixDto : classGroup4MixDtos) {
|
|
|
- if (classGroup4MixDto.getCourseTimeDtoList() == null || classGroup4MixDto.getCourseTimeDtoList().size() == 0) {
|
|
|
+ if (CollectionUtils.isEmpty(classGroup4MixDto.getCourseTimeDtoList())) {
|
|
|
break;
|
|
|
}
|
|
|
//5、插入班级排课信息
|
|
@@ -2636,7 +2635,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
throw new BizException("主教与助教存在冲突");
|
|
|
}
|
|
|
//3、插入班级排课信息
|
|
|
- LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
+// LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
+
|
|
|
|
|
|
if (!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())) {
|
|
|
throw new BizException("{}课程类型暂无剩余课程时长", classGroup4MixDto.getCourseType().getMsg());
|
|
@@ -2678,8 +2678,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
WhileNode:
|
|
|
while (true) {
|
|
|
- int dayOfWeek = now.getDayOfWeek().getValue();
|
|
|
+// int dayOfWeek = now.getDayOfWeek().getValue();
|
|
|
for (CourseTimeDto courseTimeDto : classGroup4MixDto.getCourseTimeDtoList()) {
|
|
|
+ //排课开始时间
|
|
|
+ LocalDateTime now = LocalDateTime.parse(classGroup4MixDto.getStartDate() + " 00:00:00", formatter);
|
|
|
List<ClassGroupTeacherMapper> newClassGroupTeacherMapperList = courseTimeDto.getClassGroupTeacherMapperList();
|
|
|
|
|
|
Set<Integer> noRepeatTeacherIds = newClassGroupTeacherMapperList.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toSet());
|
|
@@ -2692,19 +2694,20 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
throw new BizException("请设置主教");
|
|
|
}
|
|
|
|
|
|
- if (courseTimeDto.getDayOfWeek() < 1 || courseTimeDto.getDayOfWeek() > 7) {
|
|
|
- throw new BizException("排课循环周期错误,请核查");
|
|
|
- }
|
|
|
+// if (courseTimeDto.getDayOfWeek() < 1 || courseTimeDto.getDayOfWeek() > 7) {
|
|
|
+// throw new BizException("排课循环周期错误,请核查");
|
|
|
+// }
|
|
|
if (Objects.isNull(courseTimeDto.getStartDate()) || Objects.isNull(courseTimeDto.getEndDate())) {
|
|
|
throw new BizException("排课循环周期错误,请核查");
|
|
|
}
|
|
|
|
|
|
//跳过节假日
|
|
|
if (courseTimeDto.getHoliday() && holidayDays.contains(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))) {
|
|
|
+ now = now.plusDays(courseTimeDto.getIntervalDays());
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- if (!courseTimeDto.getDayOfWeek().equals(dayOfWeek)) continue;
|
|
|
+// if (!courseTimeDto.getDayOfWeek().equals(dayOfWeek)) continue;
|
|
|
|
|
|
Date classDate = DateConvertor.toDate(now);
|
|
|
|
|
@@ -2717,6 +2720,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
if (totalCourseTimes <= generateCourseTimes) {
|
|
|
break WhileNode;
|
|
|
}
|
|
|
+ now = now.plusDays(courseTimeDto.getIntervalDays());
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -2798,9 +2802,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
return BaseController.failed(HttpStatus.MULTI_STATUS, "当前课程课酬预计为0,是否继续");
|
|
|
}
|
|
|
}
|
|
|
+ now = now.plusDays(courseTimeDto.getIntervalDays());
|
|
|
}
|
|
|
-
|
|
|
- now = now.plusDays(1);
|
|
|
}
|
|
|
|
|
|
if (totalCourseDuration > totalMinutes) {
|