Sfoglia il codice sorgente

报名更新用户信息

周箭河 5 anni fa
parent
commit
2dc48f1e42

+ 22 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -309,6 +309,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         List<ClassGroupTeacherMapper> classGroupTeacherMapperList = new ArrayList<>();
         List<ClassGroupImGroupDto> classGroupImGroupList = new ArrayList<>();
         Integer schoolId = musicGroup.getSchoolId();
+
+
         for (HighClassGroupDto highClassGroup : highClassGroupList) {
             if (highClassGroup.getDayOfWeek() < 1 || highClassGroup.getDayOfWeek() > 7) {
                 throw new BizException("上课星期错误,请核查");
@@ -338,15 +340,31 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
             //3、插入班级排课信息
             int times = 0;
-            //LocalDateTime now = LocalDateTime.ofInstant(highClassGroup.getStartDate().toInstant(), ZoneId.systemDefault());
             LocalDateTime now = LocalDate.parse(highClassGroup.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
 
-
             List<Subject> subjectList = subjectService.findBySubjectByIdList(highClassGroup.getSubjectIdList());
 
             String courseScheduleName = subjectList.stream().map(subject -> subject.getName()).collect(Collectors.joining("/"));
 
+
+            Map<String, Integer> holidayDays = new HashMap<>();
+            Map<Integer, Map<String, Integer>> holiday = new HashMap<>();
+            if (highClassGroup.getHoliday()) {
+                holiday = jiaRiFeignService.query(now.getYear());
+                holidayDays = holiday.get(now.getYear());
+            }
+
+            WhileNode:
             while (highClassGroup.getCourseTimes() > times) {
+                if(highClassGroup.getHoliday() && !holiday.containsKey(now.getYear())){
+                    holiday = jiaRiFeignService.query(now.getYear());
+                    holidayDays = holiday.get(now.getYear());
+                }
+                if (highClassGroup.getHoliday() && holidayDays.containsKey(now.format(DateTimeFormatter.ofPattern("MM-dd")))) {
+                    now = now.plusDays(1);
+                    continue;
+                }
+
                 int dayOfWeek = now.getDayOfWeek().getValue();
                 if (highClassGroup.getDayOfWeek() == dayOfWeek) {
                     CourseSchedule courseSchedule = new CourseSchedule();
@@ -384,6 +402,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             classGroupImGroupDto.setUserIds(userIdList);
             classGroupImGroupList.add(classGroupImGroupDto);
         }
+
+
         //加入Im群组
         batchAddImGroup(classGroupImGroupList);
         classGroupTeacherMapperService.classGroupTeachersInsert(classGroupTeacherMapperList);