wangqifan 3 年之前
父節點
當前提交
3dcc77e4c4

+ 4 - 3
src/main/java/com/izouma/nineth/service/CollectionService.java

@@ -618,10 +618,10 @@ public class CollectionService {
     }
 
     @Cacheable(value = "subscribeCollectionList", key = "#now.hashCode()")
-    public List<SubscribeListDTO> subscribeAll(LocalDate now) {
+    public Map<LocalDate, List<SubscribeListDTO>> subscribeAll(LocalDate now) {
+
         List<SubscribeListDTO> subscribeListDTOS = new ArrayList<>();
 //        Map<String, Object> resultMap = new HashMap<>();
-//
 //        resultMap.put("subList", subscribeListDTOS);
 //        resultMap.put("notSubscribedIds", dtoPage.getContent().stream().filter(dto -> !dto.isSubscribed())
 //                .map(CollectionDTO::getId).collect(Collectors
@@ -672,6 +672,7 @@ public class CollectionService {
             }
         });
 //        resultMap.put("notSubscribedIds", );
-        return subscribeListDTOS;
+        return subscribeListDTOS.stream()
+                .collect(Collectors.groupingBy(subscribeListDTO -> subscribeListDTO.getDateTime().toLocalDate()));
     }
 }

+ 1 - 1
src/main/java/com/izouma/nineth/web/CollectionController.java

@@ -177,7 +177,7 @@ public class CollectionController extends BaseController {
 
     @GetMapping("/subscribeList")
     public Map<String, Object> subscribeList() {
-        List<SubscribeListDTO> dtoPage = collectionService.subscribeAll(LocalDate.now());
+        Map<LocalDate, List<SubscribeListDTO>> dtoPage = collectionService.subscribeAll(LocalDate.now());
         Map<String, Object> resultMap = new HashMap<>();
         resultMap.put("subList", dtoPage);
 //        resultMap.put("notSubscribedIds", dtoPage.getContent().stream().filter(dto -> !dto.isSubscribed())