|
@@ -2082,8 +2082,11 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PracticeGroup findUserLatestPracticeGroup(Integer userId) {
|
|
|
- return practiceGroupDao.findUserLatestPracticeGroup(userId);
|
|
|
+ public PracticeGroup findUserLatestPracticeGroup(Integer userId, Long groupId) {
|
|
|
+ if(Objects.isNull(groupId)){
|
|
|
+ throw new BizException("请选择续费的课程");
|
|
|
+ }
|
|
|
+ return practiceGroupDao.findUserPracticeGroup(userId, groupId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -2234,7 +2237,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map getPayPracticeTeacherFreeTimes(Integer userId, Integer teacherId, Integer buyMonths, Date firstClassTime) {
|
|
|
+ public Map getPayPracticeTeacherFreeTimes(Integer userId, Integer teacherId, Integer buyMonths, boolean renew, Long groupId) {
|
|
|
if (Objects.isNull(teacherId)) {
|
|
|
throw new BizException("请选择教师");
|
|
|
}
|
|
@@ -2245,6 +2248,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
if (Objects.isNull(student.getOrganId())) {
|
|
|
throw new BizException("未找到用户分部属性");
|
|
|
}
|
|
|
+ if(renew&&Objects.isNull(groupId)){
|
|
|
+ throw new BizException("请选择需要续费的课程");
|
|
|
+ }
|
|
|
Teacher teacher = teacherDao.get(teacherId);
|
|
|
if (Objects.isNull(teacher)) {
|
|
|
throw new BizException("教师不存在");
|
|
@@ -2316,11 +2322,20 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
WeekFields weekFields = WeekFields.of(DayOfWeek.MONDAY, 1);
|
|
|
ZoneId zoneId = ZoneId.systemDefault();
|
|
|
|
|
|
- LocalDateTime now = LocalDateTime.now();
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
+ if(renew){
|
|
|
+ PracticeGroup userLatestPracticeGroup = practiceGroupDao.findUserPracticeGroup(userId,groupId);
|
|
|
+ if(Objects.nonNull(userLatestPracticeGroup)){
|
|
|
+ LocalDate lastExpiredDay=LocalDateTime.ofInstant(userLatestPracticeGroup.getCoursesExpireDate().toInstant(),DateUtil.zoneId).toLocalDate();
|
|
|
+ if(Objects.nonNull(lastExpiredDay)&&lastExpiredDay.compareTo(now)>=0){
|
|
|
+ now=lastExpiredDay;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
now.plusDays(1);
|
|
|
- Date applyStartDate = Date.from(now.atZone(zoneId).toInstant());
|
|
|
+ Date applyStartDate = Date.from(now.atStartOfDay(zoneId).toInstant());
|
|
|
now.plusMonths(buyMonths);
|
|
|
- Date applyEndDate = Date.from(now.atZone(zoneId).toInstant());
|
|
|
+ Date applyEndDate = Date.from(now.atStartOfDay(zoneId).toInstant());
|
|
|
Date firstMonday = DateUtil.getWeekDayWithDate(applyStartDate, Calendar.MONDAY);
|
|
|
Date secondSunday = DateUtil.getWeekDayWithDate(applyEndDate, Calendar.SUNDAY);
|
|
|
|
|
@@ -2337,10 +2352,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
checkTeacherLeaveDate = false;
|
|
|
}
|
|
|
|
|
|
- if (Objects.nonNull(firstClassTime)) {
|
|
|
- LocalDateTime localFirstClassTime = LocalDateTime.ofInstant(firstClassTime.toInstant(), zoneId);
|
|
|
- weekNumApplyTimesMap.remove(localFirstClassTime.getDayOfWeek().getValue());
|
|
|
- }
|
|
|
weekNumApplyTimesMap.remove(holiday);
|
|
|
|
|
|
if (teacherId == 100473) {
|
|
@@ -2524,14 +2535,17 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
Date practiceBuyActivityExpireDate=DateUtil.stringToDate(practiceBuyActivityExpireDateConfig.getParanValue(),"yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
Date now=new Date();
|
|
|
- PracticeGroup userLatestPracticeGroup = practiceGroupDao.findUserLatestPracticeGroup(practiceGroupBuyParams.getUserId());
|
|
|
LocalDate courseStartDay=LocalDate.now();
|
|
|
- if(Objects.nonNull(userLatestPracticeGroup)){
|
|
|
- LocalDate lastExpiredDay=LocalDateTime.ofInstant(userLatestPracticeGroup.getCoursesExpireDate().toInstant(),DateUtil.zoneId).toLocalDate();
|
|
|
- if(Objects.nonNull(lastExpiredDay)&&lastExpiredDay.compareTo(courseStartDay)>=0){
|
|
|
- courseStartDay=lastExpiredDay;
|
|
|
+ if(practiceGroupBuyParams.isRenew()){
|
|
|
+ PracticeGroup userLatestPracticeGroup = practiceGroupDao.findUserPracticeGroup(practiceGroupBuyParams.getUserId(),practiceGroupBuyParams.getGroupId());
|
|
|
+ if(Objects.nonNull(userLatestPracticeGroup)){
|
|
|
+ LocalDate lastExpiredDay=LocalDateTime.ofInstant(userLatestPracticeGroup.getCoursesExpireDate().toInstant(),DateUtil.zoneId).toLocalDate();
|
|
|
+ if(Objects.nonNull(lastExpiredDay)&&lastExpiredDay.compareTo(courseStartDay)>=0){
|
|
|
+ courseStartDay=lastExpiredDay;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
courseStartDay=courseStartDay.plusDays(1);
|
|
|
Date courseStartDate=Date.from(courseStartDay.atStartOfDay(DateUtil.zoneId).toInstant());
|
|
|
practiceGroupBuyParams.setCoursesStartDate(courseStartDate);
|
|
@@ -2712,7 +2726,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
courseScheduleService.checkNewCourseSchedules(practiceCourses,false);
|
|
|
} catch (Exception e) {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return BaseController.failed(HttpStatus.FOUND, "课程冲突");
|
|
|
+ return BaseController.failed(HttpStatus.FOUND, e.getMessage());
|
|
|
}
|
|
|
|
|
|
StudentPaymentOrder studentPaymentOrder=new StudentPaymentOrder();
|