Просмотр исходного кода

1、陪练课调整
2、付费陪练课

Joburgess 5 лет назад
Родитель
Сommit
fdf4e0c034

+ 5 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -2330,21 +2330,14 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         WeekFields weekFields = WeekFields.of(DayOfWeek.MONDAY, 1);
         ZoneId zoneId = ZoneId.systemDefault();
 
-        Date today=new Date();
-
         LocalDate now = LocalDate.now();
         if(renew){
             PracticeGroup userLatestPracticeGroup = practiceGroupDao.findUserPracticeGroup(userId,groupId);
             if(Objects.nonNull(userLatestPracticeGroup)){
-                if(userLatestPracticeGroup.getCoursesExpireDate().after(today)){
-                    throw new BizException("此课程组已超过可续费期限");
-                }
                 LocalDate lastExpiredDay=LocalDateTime.ofInstant(userLatestPracticeGroup.getCoursesExpireDate().toInstant(),DateUtil.zoneId).toLocalDate();
                 if(Objects.nonNull(lastExpiredDay)&&lastExpiredDay.compareTo(now)>=0){
                     now=lastExpiredDay;
                 }
-            }else{
-                throw new BizException("需要续费的课程组不存在");
             }
         }
         now.plusDays(1);
@@ -2560,10 +2553,15 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             }
             PracticeGroup userLatestPracticeGroup = practiceGroupDao.findUserPracticeGroup(practiceGroupBuyParams.getStudentId(),practiceGroupBuyParams.getGroupId());
             if(Objects.nonNull(userLatestPracticeGroup)){
+                if(userLatestPracticeGroup.getCoursesExpireDate().before(now)){
+                    throw new BizException("此课程组已超过可续费期限");
+                }
                 LocalDate lastExpiredDay=LocalDateTime.ofInstant(userLatestPracticeGroup.getCoursesExpireDate().toInstant(),DateUtil.zoneId).toLocalDate();
                 if(Objects.nonNull(lastExpiredDay)&&lastExpiredDay.compareTo(courseStartDay)>=0){
                     courseStartDay=lastExpiredDay;
                 }
+            }else{
+                return BaseController.failed(HttpStatus.EXPECTATION_FAILED, "需要续费的课程组不存在");
             }
         }