|
@@ -1,6 +1,5 @@
|
|
|
package cn.efunbox.audio.impl.hag;
|
|
|
|
|
|
-import cn.efunbox.audio.entity.hag.HagContent;
|
|
|
import cn.efunbox.audio.entity.hag.HagProduct;
|
|
|
import cn.efunbox.audio.repository.hag.HagContentRepository;
|
|
|
import cn.efunbox.audio.repository.hag.HagProductRepository;
|
|
@@ -11,7 +10,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* HagProductServiceImpl
|
|
@@ -72,26 +74,12 @@ public class HagProductServiceImpl implements HagProductService {
|
|
|
|
|
|
hagProducts.forEach(product -> albumIds.add(product.getAlbumId()));
|
|
|
|
|
|
- List<HagContent> contentList = hagContentRepository.findByAlbumIdIn(albumIds);
|
|
|
-
|
|
|
- Map<String,List<String>> albumContentMap = new HashMap<>();
|
|
|
- contentList.forEach(content -> {
|
|
|
-
|
|
|
- List<String> list = albumContentMap.get(content.getAlbumId());
|
|
|
- if (CollectionUtils.isEmpty(list)) {
|
|
|
- list = new ArrayList<>();
|
|
|
- }
|
|
|
- list.add(content.getId());
|
|
|
- albumContentMap.remove(content.getAlbumId());
|
|
|
- albumContentMap.put(content.getAlbumId(),list);
|
|
|
-
|
|
|
- });
|
|
|
|
|
|
List<ProductVO> productVOList = new ArrayList<>();
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(hagProducts)) {
|
|
|
hagProducts.forEach(product ->
|
|
|
- productVOList.add(ProductConverter.productToProductVO(product,albumContentMap.get(product.getAlbumId())))
|
|
|
+ productVOList.add(ProductConverter.productToProductVO(product))
|
|
|
);
|
|
|
}
|
|
|
hagProductResp.setPagination(pagination);
|