|
|
@@ -618,9 +618,9 @@ public class CollectionService {
|
|
|
}
|
|
|
|
|
|
@Cacheable(value = "subscribeCollectionList", key = "#now.hashCode()")
|
|
|
- public Map<LocalDate, List<SubscribeListDTO>> subscribeAll(LocalDate now) {
|
|
|
-
|
|
|
+ public List<SubscribeListDTO> subscribeAll(LocalDate now) {
|
|
|
List<SubscribeListDTO> subscribeListDTOS = new ArrayList<>();
|
|
|
+ Map<LocalDateTime,List<CollectionDTO>> map = new HashMap<>();
|
|
|
// Map<String, Object> resultMap = new HashMap<>();
|
|
|
// resultMap.put("subList", subscribeListDTOS);
|
|
|
// resultMap.put("notSubscribedIds", dtoPage.getContent().stream().filter(dto -> !dto.isSubscribed())
|
|
|
@@ -656,23 +656,29 @@ public class CollectionService {
|
|
|
PageWrapper<Collection> dtoPage = new PageWrapper<>(page.getContent(), page.getPageable().getPageNumber(),
|
|
|
page.getPageable().getPageSize(), page.getTotalElements());
|
|
|
Page<CollectionDTO> pageNew = toDTO(dtoPage.toPage());
|
|
|
-// LocalDateTime dateTime;
|
|
|
-// if (pageNew.getTotalElements() > 0){
|
|
|
-// dateTime = pageNew.getContent().get(0).getStartTime();
|
|
|
-// subscribeListDTOS
|
|
|
-// .add(SubscribeListDTO.builder().dateTime(dateTime)
|
|
|
-// .collectionDTOS(pageNew.getContent())
|
|
|
-// .build());
|
|
|
-// }
|
|
|
if (CollectionUtils.isNotEmpty(pageNew.getContent())){
|
|
|
- subscribeListDTOS
|
|
|
- .add(SubscribeListDTO.builder().dateTime(subscribeTime.getStart())
|
|
|
- .collectionDTOS(pageNew.getContent())
|
|
|
- .build());
|
|
|
+ LocalDateTime dateTime = null;
|
|
|
+ List<CollectionDTO> collectionDtoList = new ArrayList<>();
|
|
|
+ for (CollectionDTO collectionDTO : pageNew.getContent()) {
|
|
|
+ if (dateTime == null) {
|
|
|
+ dateTime = collectionDTO.getStartTime();
|
|
|
+ collectionDtoList.add(collectionDTO);
|
|
|
+ }else if (dateTime.equals(collectionDTO.getStartTime())){
|
|
|
+ collectionDtoList.add(collectionDTO);
|
|
|
+ }else {
|
|
|
+ map.put(dateTime,collectionDtoList);
|
|
|
+ dateTime = collectionDTO.getStartTime();
|
|
|
+ collectionDtoList.clear();
|
|
|
+ collectionDtoList.add(collectionDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put(dateTime,collectionDtoList);
|
|
|
+ subscribeListDTOS.add(SubscribeListDTO.builder()
|
|
|
+ .dateTime(pageNew.getContent().get(0).getStartTime())
|
|
|
+ .collectionDTOS(map)
|
|
|
+ .build());
|
|
|
}
|
|
|
});
|
|
|
-// resultMap.put("notSubscribedIds", );
|
|
|
- return subscribeListDTOS.stream()
|
|
|
- .collect(Collectors.groupingBy(subscribeListDTO -> subscribeListDTO.getDateTime().toLocalDate()));
|
|
|
+ return subscribeListDTOS;
|
|
|
}
|
|
|
}
|