licailing %!s(int64=4) %!d(string=hai) anos
pai
achega
2971908e7c
Modificáronse 1 ficheiros con 12 adicións e 21 borrados
  1. 12 21
      src/main/java/com/izouma/nineth/service/ShowroomService.java

+ 12 - 21
src/main/java/com/izouma/nineth/service/ShowroomService.java

@@ -323,43 +323,34 @@ public class ShowroomService {
                     .getId(), ids);
             likesMap = likes.stream()
                     .collect(Collectors.groupingBy(NewsLike::getShowroomId, Collectors.counting()));
-
         }
 
         Map<Long, Long> finalLikesMap = likesMap;
         return all.map(showroom -> {
             List<ShowCollection> collections = collect.get(showroom.getId());
-//            List<ShowCollection> neo = new ArrayList<>();
             if (ShowroomType.COMPANY_BOX.equals(showroom.getType()) && CollectionUtils.isNotEmpty(collections)) {
 
                 collections.forEach(orig -> collectionRepo.findById(orig.getCollectionId())
                         .ifPresent(collection -> {
-//                                orig.setStatus(this.getStatus(collection));
-//                                orig.setPrice(collection.getPrice());
-//                                neo.add(orig);
 
                             //展示数量
-                            if (CollectionType.BLIND_BOX.equals(collection.getType())) {
-                                if (collection.isNoSoldOut()) {
-                                    showroom.setNum(collection.getStock());
-                                } else {
-                                    String name = StringUtils.isEmpty(collection.getPrefixName()) ?
-                                            collection.getName() : collection.getPrefixName();
-
-                                    int num = collectionRepo.countAllByNameLike("%" + name + "%");
-                                    showroom.setNum(num);
-                                }
+                            if (collection.isNoSoldOut()) {
+                                showroom.setNum(collection.getStock());
+                            } else {
+                                String name = StringUtils.isEmpty(collection.getPrefixName()) ?
+                                        collection.getName() : collection.getPrefixName();
+
+                                int num = collectionRepo.countAllByNameLike("%" + name + "%");
+                                showroom.setNum(num);
                             }
                         }));
             }
 
-//            if (CollUtil.isNotEmpty(neo)) {
-//                neo.sort(Comparator.comparingInt(ShowCollection::getSort));
-//                showroom.setCollections(neo);
-//            }
+            if (CollUtil.isNotEmpty(collections)) {
+                collections.sort(Comparator.comparingInt(ShowCollection::getSort));
+                showroom.setCollections(collections);
+            }
 
-            collections.sort(Comparator.comparingInt(ShowCollection::getSort));
-            showroom.setCollections(collections);
             showroom.setLiked(ObjectUtils.isNotEmpty(finalLikesMap.get(showroom.getId())));
             return showroom;
         });