|
@@ -41,6 +41,9 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -1780,6 +1783,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
Map<String, Object> pauseInfos = new HashMap<>();
|
|
|
//学生剩余课时
|
|
|
List<StudentCourseInfoDto> userSurplusCourseInfoByGroup = courseScheduleDao.findUserSurplusCourseInfoByGroup(GroupType.VIP, vipGroupId.toString(), studentId);
|
|
|
+
|
|
|
+ int days = 0;
|
|
|
+ if(!CollectionUtils.isEmpty(userSurplusCourseInfoByGroup)){
|
|
|
+ LocalDate nowDate = LocalDate.now(DateUtil.zoneId);
|
|
|
+ StudentCourseInfoDto studentCourseInfoDto = userSurplusCourseInfoByGroup.stream().max(Comparator.comparing(StudentCourseInfoDto::getClassDate)).get();
|
|
|
+ days = (int) nowDate
|
|
|
+ .until((LocalDateTime.ofInstant(studentCourseInfoDto.getClassDate().toInstant(), DateUtil.zoneId).toLocalDate()), ChronoUnit.DAYS);
|
|
|
+ }
|
|
|
int[] teachModeSequence=new int[userSurplusCourseInfoByGroup.size()];
|
|
|
List<BigDecimal> coursePrices = new ArrayList<>();
|
|
|
List<Long> courseScheduleIds=new ArrayList<>();
|
|
@@ -1790,6 +1801,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
pauseInfos.put("teaChModeSequence", teachModeSequence);
|
|
|
pauseInfos.put("coursePriceInfo",coursePrices);
|
|
|
+ pauseInfos.put("days", days);
|
|
|
|
|
|
StudentPauseInfo studentPauseInfo=new StudentPauseInfo();
|
|
|
studentPauseInfo.setUserId(studentId);
|
|
@@ -1925,6 +1937,17 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
newCourseSchedules.get(i).setOrganId(vipGroup.getOrganId());
|
|
|
}
|
|
|
+
|
|
|
+ if(courseInfo1.containsKey("days")){
|
|
|
+ int surplusDays = Integer.valueOf(courseInfo1.get("days").toString());
|
|
|
+ LocalDate nowDate = LocalDate.now();
|
|
|
+ CourseSchedule courseSchedule = newCourseSchedules.stream().max(Comparator.comparing(CourseSchedule::getClassDate)).get();
|
|
|
+ int days = (int) nowDate.until(LocalDateTime.ofInstant(courseSchedule.getClassDate().toInstant(), DateUtil.zoneId), ChronoUnit.DAYS);
|
|
|
+ if(days>surplusDays){
|
|
|
+ throw new BizException("您必须在{}天内完成剩余课程", surplusDays);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
courseScheduleService.batchAddCourseSchedule(newCourseSchedules);
|
|
|
|
|
|
ClassGroupTeacherMapper oldClassGroupTeacherMapper = classGroupTeacherMapperDao.findByClassGroupAndTeacher(classGroup.getId(),oldTeacherId);
|