|
@@ -261,18 +261,15 @@ public class AppCoureseServiceImpl extends ServiceImpl<AppCoursesMapper, AppCour
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<VerifyCourseInfoDTO> getCourseInfo(String courseId) {
|
|
|
+ public List<CoursesPriceRulesVO> getCourseInfo(String courseId) {
|
|
|
|
|
|
- List<VerifyCourseInfoDTO> verifyCourseInfoDTOList = new ArrayList<>();
|
|
|
+ List<CoursesPriceRulesVO> verifyCourseInfoDTOList = new ArrayList<>();
|
|
|
|
|
|
List<AppCoursesPriceRules> priceRulesList = priceRulesMapper.selectList(Wrappers.lambdaQuery(AppCoursesPriceRules.class).eq(AppCoursesPriceRules::getCoursesId, courseId));
|
|
|
|
|
|
Map<Integer, List<AppCoursesPriceRules>> map = priceRulesList.stream().collect(Collectors.groupingBy(AppCoursesPriceRules::getCoursesType));
|
|
|
|
|
|
map.keySet().forEach(key -> {
|
|
|
- VerifyCourseInfoDTO verifyCourseInfoDTO = new VerifyCourseInfoDTO();
|
|
|
- List<CoursesPriceRulesVO> toDayVoList = new ArrayList<>();
|
|
|
- List<CoursesPriceRulesVO> voList = new ArrayList<>();
|
|
|
map.get(key).forEach(priceRules -> {
|
|
|
CoursesPriceRulesVO coursesPriceRulesVO = new CoursesPriceRulesVO();
|
|
|
coursesPriceRulesVO.setId(priceRules.getId());
|
|
@@ -301,16 +298,20 @@ public class AppCoureseServiceImpl extends ServiceImpl<AppCoursesMapper, AppCour
|
|
|
LocalDate localDate = priceRules.getStartTime().toInstant()
|
|
|
.atZone(ZoneId.systemDefault())
|
|
|
.toLocalDate();
|
|
|
+ if (coursesPriceRulesVO.getEndTime().after(new Date())) {
|
|
|
+ coursesPriceRulesVO.setOrDone(false);
|
|
|
+ }else {
|
|
|
+ coursesPriceRulesVO.setOrDone(true);
|
|
|
+ }
|
|
|
if (today.isAfter(localDate)) {
|
|
|
- toDayVoList.add(coursesPriceRulesVO);
|
|
|
+ coursesPriceRulesVO.setOrToday(true);
|
|
|
} else {
|
|
|
- voList.add(coursesPriceRulesVO);
|
|
|
+ coursesPriceRulesVO.setOrToday(false);
|
|
|
}
|
|
|
+ coursesPriceRulesVO.setCourseType(key);
|
|
|
+ verifyCourseInfoDTOList.add(coursesPriceRulesVO);
|
|
|
});
|
|
|
- verifyCourseInfoDTO.setCourseType(key);
|
|
|
- verifyCourseInfoDTO.setToDayVoList(toDayVoList);
|
|
|
- verifyCourseInfoDTO.setVoList(voList);
|
|
|
- verifyCourseInfoDTOList.add(verifyCourseInfoDTO);
|
|
|
+
|
|
|
});
|
|
|
|
|
|
return verifyCourseInfoDTOList;
|