|
|
@@ -4,13 +4,17 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import com.izouma.nineth.domain.Collection;
|
|
|
import com.izouma.nineth.domain.*;
|
|
|
import com.izouma.nineth.dto.PageQuery;
|
|
|
-import com.izouma.nineth.enums.*;
|
|
|
+import com.izouma.nineth.enums.AssetStatus;
|
|
|
+import com.izouma.nineth.enums.AuthStatus;
|
|
|
+import com.izouma.nineth.enums.CollectionType;
|
|
|
+import com.izouma.nineth.enums.ShowroomType;
|
|
|
import com.izouma.nineth.exception.BusinessException;
|
|
|
import com.izouma.nineth.repo.*;
|
|
|
import com.izouma.nineth.utils.JpaUtils;
|
|
|
import com.izouma.nineth.utils.ObjUtils;
|
|
|
import com.izouma.nineth.utils.SecurityUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
@@ -325,35 +329,37 @@ public class ShowroomService {
|
|
|
Map<Long, Long> finalLikesMap = likesMap;
|
|
|
return all.map(showroom -> {
|
|
|
List<ShowCollection> collections = collect.get(showroom.getId());
|
|
|
- List<ShowCollection> neo = new ArrayList<>();
|
|
|
- if (collections != null) {
|
|
|
- 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);
|
|
|
- }
|
|
|
+// 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 (CollUtil.isNotEmpty(neo)) {
|
|
|
- neo.sort(Comparator.comparingInt(ShowCollection::getSort));
|
|
|
- showroom.setCollections(neo);
|
|
|
+ }
|
|
|
+ }));
|
|
|
}
|
|
|
|
|
|
+// if (CollUtil.isNotEmpty(neo)) {
|
|
|
+// neo.sort(Comparator.comparingInt(ShowCollection::getSort));
|
|
|
+// showroom.setCollections(neo);
|
|
|
+// }
|
|
|
+
|
|
|
+ collections.sort(Comparator.comparingInt(ShowCollection::getSort));
|
|
|
+ showroom.setCollections(collections);
|
|
|
showroom.setLiked(ObjectUtils.isNotEmpty(finalLikesMap.get(showroom.getId())));
|
|
|
return showroom;
|
|
|
});
|