|
@@ -113,6 +113,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
private TeacherDefaultPracticeGroupSalaryDao teacherDefaultPracticeGroupSalaryDao;
|
|
|
@Autowired
|
|
|
private ContractService contractService;
|
|
|
+ @Autowired
|
|
|
+ private PracticeLessonApplyDao practiceLessonApplyDao;
|
|
|
|
|
|
private static Map<Integer, Map<Integer, List<Integer>>> schoolSubjectTeachersMap;
|
|
|
|
|
@@ -205,6 +207,22 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public Map<String, Object> checkCanApplyFreePracticeGroup(Integer userId) {
|
|
|
+ Map<String,Object> result=new HashMap<>();
|
|
|
+ int recordNum = practiceLessonApplyDao.checkUserIsApply(userId);
|
|
|
+ LocalDateTime now=LocalDateTime.now();
|
|
|
+ if(recordNum>0){
|
|
|
+ LocalDateTime applyExpireDateTime=LocalDateTime.parse("2020-03-01 00:00:00", DateUtil.dateTimeFormatter);
|
|
|
+ result.put("canApply", now.compareTo(applyExpireDateTime)<=0?1:0);
|
|
|
+ }else{
|
|
|
+ LocalDateTime applyExpireDateTime=LocalDateTime.parse("2020-02-22 08:00:00", DateUtil.dateTimeFormatter);
|
|
|
+ result.put("canApply", now.compareTo(applyExpireDateTime)<=0?1:0);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public Integer searchTeacherId(PracticeGroup practiceGroup) {
|
|
|
if (Objects.isNull(practiceGroup.getSubjectId())) {
|
|
|
return null;
|
|
@@ -1625,6 +1643,25 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ int recordNum = practiceLessonApplyDao.checkUserIsApply(practiceGroup.getStudentId());
|
|
|
+ if(recordNum>0){
|
|
|
+ LocalDateTime nowDateTime=LocalDateTime.now();
|
|
|
+ LocalDateTime applyExpireDateTime=LocalDateTime.parse("2020-03-01 00:00:00", DateUtil.dateTimeFormatter);
|
|
|
+ if(nowDateTime.compareTo(applyExpireDateTime)>0){
|
|
|
+ result.put("status", "APPLY_DATE_OVERFLOW");
|
|
|
+ result.put("info", "预约失败,超出可预约时间范围。");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ LocalDateTime nowDateTime=LocalDateTime.now();
|
|
|
+ LocalDateTime applyExpireDateTime=LocalDateTime.parse("2020-02-22 08:00:00", DateUtil.dateTimeFormatter);
|
|
|
+ if(nowDateTime.compareTo(applyExpireDateTime)>0){
|
|
|
+ result.put("status", "APPLY_DATE_OVERFLOW");
|
|
|
+ result.put("info", "预约失败,超出可预约时间范围。");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
List<Date> allCourseDates = new ArrayList<>();
|
|
|
allCourseDates.add(practiceGroup.getFirstCourseTime());
|
|
|
allCourseDates.add(practiceGroup.getSecondCourseTime());
|
|
@@ -2458,7 +2495,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
|
|
|
int courseWeekNum = 0;
|
|
|
int practiceCourseNum = 0;
|
|
|
- boolean hasDisableWeek = false;
|
|
|
+ Set<Integer> disableApplyWeek = new HashSet<>();
|
|
|
LocalDateTime tempClassDateTime;
|
|
|
for (int i = 0; i < allTeacherCourses.size(); i++) {
|
|
|
CourseSchedule teacherCourse = allTeacherCourses.get(i);
|
|
@@ -2468,8 +2505,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
courseWeekNum = tempClassDateTime.get(weekFields.weekOfYear());
|
|
|
}
|
|
|
if (Objects.nonNull(maxTeacherCourses) && practiceCourseNum >= maxTeacherCourses) {
|
|
|
- hasDisableWeek = true;
|
|
|
- break;
|
|
|
+ disableApplyWeek.add(courseWeekNum);
|
|
|
}
|
|
|
if (tempClassDateTime.get(weekFields.weekOfYear()) != courseWeekNum) {
|
|
|
courseWeekNum = tempClassDateTime.get(weekFields.weekOfYear());
|
|
@@ -2480,12 +2516,18 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (hasDisableWeek) {
|
|
|
- result.put("teacherFreeDays", new HashMap<>());
|
|
|
- return result;
|
|
|
+ Iterator<Integer> weekNumApplyTimeIterator2 = weekNumApplyTimesMap.keySet().iterator();
|
|
|
+ while (weekNumApplyTimeIterator2.hasNext()) {
|
|
|
+ Integer weekNum=weekNumApplyTimeIterator2.next();
|
|
|
+ if(disableApplyWeek.contains(weekNum)){
|
|
|
+ weekNumApplyTimeIterator2.remove();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
for (CourseSchedule teacherCourse : allTeacherCourses) {
|
|
|
+ if(teacherCourse.getEndClassTime().before(applyStartDate)||teacherCourse.getStartClassTime().after(applyEndDate)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
LocalDateTime courseStartTime = LocalDateTime.ofInstant(teacherCourse.getStartClassTime().toInstant(), zoneId);
|
|
|
LocalDateTime courseEndTime = LocalDateTime.ofInstant(teacherCourse.getEndClassTime().toInstant(), zoneId);
|
|
|
List<String> applyTimeStrs = weekNumApplyTimesMap.get(courseStartTime.getDayOfWeek().getValue());
|