소스 검색

fix:vip课休学有效期限制

Joburgess 4 년 전
부모
커밋
264c1999b4

+ 6 - 5
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentRecoverInfoDto.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.dto;
 package com.ym.mec.biz.dal.dto;
 
 
 import java.time.LocalDate;
 import java.time.LocalDate;
+import java.util.Date;
 
 
 /**
 /**
  * @Author Joburgess
  * @Author Joburgess
@@ -20,14 +21,14 @@ public class StudentRecoverInfoDto {
 
 
     private int giveCourseTimes;
     private int giveCourseTimes;
 
 
-    private int days;
+    private Date expireDate;
 
 
-    public int getDays() {
-        return days;
+    public Date getExpireDate() {
+        return expireDate;
     }
     }
 
 
-    public void setDays(int days) {
-        this.days = days;
+    public void setExpireDate(Date expireDate) {
+        this.expireDate = expireDate;
     }
     }
 
 
     public Integer getVipGroupId() {
     public Integer getVipGroupId() {

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRecoverDto.java

@@ -21,6 +21,16 @@ public class StudentRecoverDto extends CourseGenerateDto{
     @ApiModelProperty(value = "课程截至时间")
     @ApiModelProperty(value = "课程截至时间")
     private Date expireDate;
     private Date expireDate;
 
 
+    private int days;
+
+    public int getDays() {
+        return days;
+    }
+
+    public void setDays(int days) {
+        this.days = days;
+    }
+
     public Date getExpireDate() {
     public Date getExpireDate() {
         return expireDate;
         return expireDate;
     }
     }

+ 4 - 19
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -1919,14 +1919,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		//学生剩余课时
 		//学生剩余课时
         List<StudentCourseInfoDto> userSurplusCourseInfoByGroup = courseScheduleDao.findUserSurplusCourseInfoByGroup(GroupType.VIP, vipGroupId.toString(), studentId);
         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);
-		}
-        days += 1;
         int[] teachModeSequence=new int[userSurplusCourseInfoByGroup.size()];
         int[] teachModeSequence=new int[userSurplusCourseInfoByGroup.size()];
         List<BigDecimal> coursePrices = new ArrayList<>();
         List<BigDecimal> coursePrices = new ArrayList<>();
         List<Long> courseScheduleIds=new ArrayList<>();
         List<Long> courseScheduleIds=new ArrayList<>();
@@ -1937,7 +1929,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         }
         }
         pauseInfos.put("teaChModeSequence", teachModeSequence);
         pauseInfos.put("teaChModeSequence", teachModeSequence);
         pauseInfos.put("coursePriceInfo",coursePrices);
         pauseInfos.put("coursePriceInfo",coursePrices);
-        pauseInfos.put("days", days);
 
 
         StudentPauseInfo  studentPauseInfo=new StudentPauseInfo();
         StudentPauseInfo  studentPauseInfo=new StudentPauseInfo();
 		studentPauseInfo.setUserId(studentId);
 		studentPauseInfo.setUserId(studentId);
@@ -2074,12 +2065,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				newCourseSchedules.get(i).setOrganId(vipGroup.getOrganId());
 				newCourseSchedules.get(i).setOrganId(vipGroup.getOrganId());
 			}
 			}
 
 
-			if(Objects.nonNull(studentRecoverInfo.getExpireDate())){
-//				CourseSchedule courseSchedule = newCourseSchedules.stream().max(Comparator.comparing(CourseSchedule::getClassDate)).get();
-				if(vipGroup.getCoursesExpireDate().compareTo(studentRecoverInfo.getExpireDate())<=0||DateUtil.isSameDay(vipGroup.getCoursesExpireDate(), studentRecoverInfo.getExpireDate())){
-					throw new BizException("排课时间不可超过{}", DateUtil.dateToString(vipGroup.getCoursesExpireDate(), "yyyy年MM月dd日"));
-				}
-//				vipGroup.setCoursesExpireDate(courseSchedule.getEndClassTime());
+			CourseSchedule courseSchedule = newCourseSchedules.stream().max(Comparator.comparing(CourseSchedule::getClassDate)).get();
+			if(vipGroup.getCoursesExpireDate().compareTo(courseSchedule.getEndClassTime())<=0||DateUtil.isSameDay(vipGroup.getCoursesExpireDate(), courseSchedule.getEndClassTime())){
+				throw new BizException("排课时间不可超过{}", DateUtil.dateToString(vipGroup.getCoursesExpireDate(), "yyyy年MM月dd日"));
 			}
 			}
 
 
 			courseScheduleService.batchAddCourseSchedule(newCourseSchedules);
 			courseScheduleService.batchAddCourseSchedule(newCourseSchedules);
@@ -2183,11 +2171,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		Map<BigDecimal, Long> collect = coursePrices.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
 		Map<BigDecimal, Long> collect = coursePrices.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
 		studentRecoverInfoDto.setGiveCourseTimes(Objects.isNull(collect.get(new BigDecimal("0.00")))?0:collect.get(new BigDecimal("0.00")).intValue());
 		studentRecoverInfoDto.setGiveCourseTimes(Objects.isNull(collect.get(new BigDecimal("0.00")))?0:collect.get(new BigDecimal("0.00")).intValue());
 		studentRecoverInfoDto.setTotalCourseTimes(coursePrices.size()-studentRecoverInfoDto.getGiveCourseTimes());
 		studentRecoverInfoDto.setTotalCourseTimes(coursePrices.size()-studentRecoverInfoDto.getGiveCourseTimes());
+		studentRecoverInfoDto.setExpireDate(vipGroup.getCoursesExpireDate());
 
 
-		if(courseInfo.containsKey("days")){
-			int surplusDays = Integer.valueOf(courseInfo.get("days").toString());
-			studentRecoverInfoDto.setDays(surplusDays);
-		}
 		return studentRecoverInfoDto;
 		return studentRecoverInfoDto;
     }
     }