|  | @ -35,6 +35,9 @@ import org.springframework.stereotype.Service; | 
		
	
		
			
				|  |  | import java.util.ArrayList; |  |  | import java.util.ArrayList; | 
		
	
		
			
				|  |  | import java.util.List; |  |  | import java.util.List; | 
		
	
		
			
				|  |  | import java.util.Map; |  |  | import java.util.Map; | 
		
	
		
			
				|  |  |  |  |  | import java.util.concurrent.ConcurrentHashMap; | 
		
	
		
			
				|  |  |  |  |  | import java.util.function.Function; | 
		
	
		
			
				|  |  |  |  |  | import java.util.function.Predicate; | 
		
	
		
			
				|  |  | import java.util.stream.Collectors; |  |  | import java.util.stream.Collectors; | 
		
	
		
			
				|  |  | 
 |  |  | 
 | 
		
	
		
			
				|  |  | @Service |  |  | @Service | 
		
	
	
		
			
				|  | @ -62,11 +65,12 @@ public class CereProductClassifyServiceImpl implements CereProductClassifyServic | 
		
	
		
			
				|  |  | 
 |  |  | 
 | 
		
	
		
			
				|  |  |     @Override |  |  |     @Override | 
		
	
		
			
				|  |  |     public List<Classify> getFirstClassify(ClassifyParam param) throws CoBusinessException { |  |  |     public List<Classify> getFirstClassify(ClassifyParam param) throws CoBusinessException { | 
		
	
		
			
				|  |  |  |  |  |         String project = ContextUtil.getProject(); | 
		
	
		
			
				|  |  |         List<Classify> classifies=null; |  |  |         List<Classify> classifies=null; | 
		
	
		
			
				|  |  |         List<Long> classifyIdList = new ArrayList<>(); |  |  |         List<Long> classifyIdList = new ArrayList<>(); | 
		
	
		
			
				|  |  |         if(EmptyUtils.isEmpty(param.getClassifyId())){ |  |  |         if(EmptyUtils.isEmpty(param.getClassifyId())){ | 
		
	
		
			
				|  |  |             //查询所有一级类目 |  |  |             //查询所有一级类目 | 
		
	
		
			
				|  |  |             classifies = cereProductClassifyDAO.getFirstClassify(ContextUtil.getProject(), null); |  |  |  | 
		
	
		
			
				|  |  |  |  |  |             classifies = cereProductClassifyDAO.getFirstClassify(project, null); | 
		
	
		
			
				|  |  |         }else { |  |  |         }else { | 
		
	
		
			
				|  |  |             //查询所有二级类目 |  |  |             //查询所有二级类目 | 
		
	
		
			
				|  |  |             classifies = cereProductClassifyDAO.getFirstClassify(ContextUtil.getProject(), param.getClassifyId()); |  |  |             classifies = cereProductClassifyDAO.getFirstClassify(ContextUtil.getProject(), param.getClassifyId()); | 
		
	
	
		
			
				|  | @ -138,6 +142,8 @@ public class CereProductClassifyServiceImpl implements CereProductClassifyServic | 
		
	
		
			
				|  |  |         param.setProject(ContextUtil.getProject()); |  |  |         param.setProject(ContextUtil.getProject()); | 
		
	
		
			
				|  |  |         List<Product> list=cereProductClassifyDAO.getClaasifyProducts(param); |  |  |         List<Product> list=cereProductClassifyDAO.getClaasifyProducts(param); | 
		
	
		
			
				|  |  |         if(!EmptyUtils.isEmpty(list)){ |  |  |         if(!EmptyUtils.isEmpty(list)){ | 
		
	
		
			
				|  |  |  |  |  |             //可能会存在重复商品元素。去重处理 | 
		
	
		
			
				|  |  |  |  |  |             list = list.stream().filter(distinctByKey(Product::getProductId)).collect(Collectors.toList()); | 
		
	
		
			
				|  |  |             list.forEach(a -> { |  |  |             list.forEach(a -> { | 
		
	
		
			
				|  |  |                 //查询付款人数 |  |  |                 //查询付款人数 | 
		
	
		
			
				|  |  |                 a.setUsers(cerePlatformShopservice.findPayUsers(a.getProductId())); |  |  |                 a.setUsers(cerePlatformShopservice.findPayUsers(a.getProductId())); | 
		
	
	
		
			
				|  | @ -157,6 +163,11 @@ public class CereProductClassifyServiceImpl implements CereProductClassifyServic | 
		
	
		
			
				|  |  |         return page; |  |  |         return page; | 
		
	
		
			
				|  |  |     } |  |  |     } | 
		
	
		
			
				|  |  | 
 |  |  | 
 | 
		
	
		
			
				|  |  |  |  |  |     public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) { | 
		
	
		
			
				|  |  |  |  |  |         Map<Object, Boolean> seen = new ConcurrentHashMap<>(); | 
		
	
		
			
				|  |  |  |  |  |         return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; | 
		
	
		
			
				|  |  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |  | 
 | 
		
	
		
			
				|  |  |     @Override |  |  |     @Override | 
		
	
		
			
				|  |  |     public Page getClassifyProducts2(ClassifyProductParam param, CereBuyerUser user) { |  |  |     public Page getClassifyProducts2(ClassifyProductParam param, CereBuyerUser user) { | 
		
	
		
			
				|  |  |         PageHelper.startPage(param.getPage(),param.getPageSize()); |  |  |         PageHelper.startPage(param.getPage(),param.getPageSize()); | 
		
	
	
		
			
				|  | 
 |